diff options
Diffstat (limited to 'src/ble.cpp')
| -rw-r--r-- | src/ble.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ble.cpp b/src/ble.cpp index 9425686..552055d 100644 --- a/src/ble.cpp +++ b/src/ble.cpp @@ -51,24 +51,24 @@ class BadgeSelectorCallbacks : public NimBLECharacteristicCallbacks { LOG_F("Write!"); const char *val = pCharacteristic->getValue().c_str(); - char *end = NULL; + char *end = nullptr; long newVal = strtol(val, &end, 10); String defVal("0"); - if (end == NULL || end == val) + if (end == nullptr || end == val) { LOG_F("Error parsing value\n"); pCharacteristic->setValue(defVal); - pCharacteristic->notify(defVal, BLE_HS_CONN_HANDLE_NONE); + (void) pCharacteristic->notify(defVal, BLE_HS_CONN_HANDLE_NONE); } else if (newVal >= ARRAY_SIZE(templates)) { - LOG_F("Value out of range: %d\n", newVal); + LOG_F("Value out of range: %ld\n", newVal); pCharacteristic->setValue(defVal); - pCharacteristic->notify(defVal, BLE_HS_CONN_HANDLE_NONE); + (void) pCharacteristic->notify(defVal, BLE_HS_CONN_HANDLE_NONE); } else { - LOG_F("Value set to %d\n", newVal); + LOG_F("Value set to %ld\n", newVal); value_changed.value = newVal; value_changed.changed = true; } @@ -76,7 +76,7 @@ class BadgeSelectorCallbacks : public NimBLECharacteristicCallbacks } } badgeSelectorCallbacks; -void de::uvok::badge::ble_init(void) +void de::uvok::badge::ble_init() { NimBLEDevice::init("Espadge"); @@ -118,13 +118,13 @@ void de::uvok::badge::ble_init(void) server->start(); } -bool de::uvok::badge::ble_is_active(void) +bool de::uvok::badge::ble_is_active() { return pAdvertising->isAdvertising() || server->getConnectedCount() > 0; // ???? NimBLEDevice::getConnectedClients().size() > 0; } -void de::uvok::badge::ble_advertise(void) +void de::uvok::badge::ble_advertise() { if (!pAdvertising->isAdvertising()) { @@ -134,7 +134,7 @@ void de::uvok::badge::ble_advertise(void) } } -de::uvok::badge::ble_poll_result_t de::uvok::badge::ble_poll(void) +de::uvok::badge::ble_poll_result_t de::uvok::badge::ble_poll() { if (value_changed.changed) { @@ -156,5 +156,5 @@ void de::uvok::badge::ble_set_image(uint8_t image) LOG_F("Notify BLE: set image to %d\n", image); String s(image); selectorCharacteristic->setValue(s); - selectorCharacteristic->notify(s, BLE_HS_CONN_HANDLE_NONE); + (void) selectorCharacteristic->notify(s, BLE_HS_CONN_HANDLE_NONE); }
\ No newline at end of file |
