Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/NimBLECharacteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
# include "NimBLECharacteristic.h"
#if CONFIG_BT_NIMBLE_ENABLED && MYNEWT_VAL(BLE_ROLE_PERIPHERAL)

#if defined(ESP_IDF_VERSION_MAJOR)
# if defined(CONFIG_NIMBLE_CPP_IDF) && ESP_IDF_VERSION_MAJOR < 5
# define ble_gatts_notify_custom ble_gattc_notify_custom
# define ble_gatts_indicate_custom ble_gattc_indicate_custom
# endif
#endif

# include "NimBLE2904.h"
# include "NimBLEDevice.h"
# include "NimBLELog.h"
Expand Down Expand Up @@ -278,9 +285,9 @@ bool NimBLECharacteristic::sendValue(const uint8_t* value, size_t length, bool i

// Null buffer will read the value from the characteristic
if (isNotification) {
rc = ble_gattc_notify_custom(connHandle, m_handle, om);
rc = ble_gatts_notify_custom(connHandle, m_handle, om);
} else {
rc = ble_gattc_indicate_custom(connHandle, m_handle, om);
rc = ble_gatts_indicate_custom(connHandle, m_handle, om);
}

goto done;
Expand All @@ -296,17 +303,17 @@ bool NimBLECharacteristic::sendValue(const uint8_t* value, size_t length, bool i
}

if (isNotification) {
rc = ble_gattc_notify_custom(ch, m_handle, om);
rc = ble_gatts_notify_custom(ch, m_handle, om);
} else {
rc = ble_gattc_indicate_custom(ch, m_handle, om);
rc = ble_gatts_indicate_custom(ch, m_handle, om);
}
}
} else if (connHandle != BLE_HS_CONN_HANDLE_NONE) {
// Null buffer will read the value from the characteristic
if (isNotification) {
rc = ble_gattc_notify_custom(connHandle, m_handle, nullptr);
rc = ble_gatts_notify_custom(connHandle, m_handle, nullptr);
} else {
rc = ble_gattc_indicate_custom(connHandle, m_handle, nullptr);
rc = ble_gatts_indicate_custom(connHandle, m_handle, nullptr);
}
} else { // Notify or indicate to all connected peers the characteristic value
ble_gatts_chr_updated(m_handle);
Expand Down