Skip to content

Commit 39a804d

Browse files
committed
Merge 'Adding getDataLength()'
2 parents c7c8979 + 51c693c commit 39a804d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/NimBLECharacteristic.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ uint8_t* NimBLECharacteristic::getData() {
198198
} // getData
199199

200200

201+
/**
202+
* @brief Retrieve the the current data length of the characteristic.
203+
* @return The length of the current characteristic data.
204+
*/
205+
size_t NimBLECharacteristic:: getDataLength() {
206+
return m_value.getLength();
207+
}
208+
209+
201210
int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
202211
struct ble_gatt_access_ctxt *ctxt,
203212
void *arg)
@@ -637,4 +646,4 @@ void NimBLECharacteristicCallbacks::onStatus(NimBLECharacteristic* pCharacterist
637646
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onStatus: default");
638647
} // onStatus
639648

640-
#endif /* CONFIG_BT_ENABLED */
649+
#endif /* CONFIG_BT_ENABLED */

src/NimBLECharacteristic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class NimBLECharacteristic {
9797
NimBLEUUID getUUID();
9898
std::string getValue();
9999
uint8_t* getData();
100+
size_t getDataLength();
100101

101102
void indicate();
102103
void notify(bool is_notification = true);
@@ -191,4 +192,4 @@ class NimBLECharacteristicCallbacks {
191192
virtual void onStatus(NimBLECharacteristic* pCharacteristic, Status s, int code);
192193
};
193194
#endif /* CONFIG_BT_ENABLED */
194-
#endif /*MAIN_NIMBLECHARACTERISTIC_H_*/
195+
#endif /*MAIN_NIMBLECHARACTERISTIC_H_*/

0 commit comments

Comments
 (0)