@@ -66,6 +66,7 @@ class NimBLEConnInfo;
66
66
# endif
67
67
68
68
class NimBLEAddress ;
69
+ class NimBLEDeviceCallbacks ;
69
70
70
71
# define BLEDevice NimBLEDevice
71
72
# define BLEClient NimBLEClient
@@ -129,6 +130,7 @@ class NimBLEDevice {
129
130
static bool setOwnAddrType (uint8_t type);
130
131
static bool setOwnAddr (const NimBLEAddress& addr);
131
132
static bool setOwnAddr (const uint8_t * addr);
133
+ static void setDeviceCallbacks (NimBLEDeviceCallbacks* cb);
132
134
static void setScanDuplicateCacheSize (uint16_t cacheSize);
133
135
static void setScanFilterMode (uint8_t type);
134
136
static bool setCustomGapHandler (gap_event_handler handler);
@@ -213,6 +215,8 @@ class NimBLEDevice {
213
215
static ble_gap_event_listener m_listener;
214
216
static uint8_t m_ownAddrType;
215
217
static std::vector<NimBLEAddress> m_whiteList;
218
+ static NimBLEDeviceCallbacks* m_pDeviceCallbacks;
219
+ static NimBLEDeviceCallbacks defaultDeviceCallbacks;
216
220
217
221
# if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
218
222
static NimBLEScan* m_pScan;
@@ -295,5 +299,27 @@ class NimBLEDevice {
295
299
296
300
# include " NimBLEUtils.h"
297
301
302
+ /* *
303
+ * @brief Callbacks associated with a BLE device.
304
+ */
305
+ class NimBLEDeviceCallbacks {
306
+ public:
307
+ virtual ~NimBLEDeviceCallbacks () {};
308
+
309
+ /* *
310
+ * @brief Indicates an inability to perform a store operation.
311
+ * This callback should do one of two things:
312
+ * -Address the problem and return 0, indicating that the store operation
313
+ * should proceed.
314
+ * -Return nonzero to indicate that the store operation should be aborted.
315
+ * @param event Describes the store event being reported.
316
+ * BLE_STORE_EVENT_FULL; or
317
+ * BLE_STORE_EVENT_OVERFLOW
318
+ * @return 0 if the store operation should proceed;
319
+ * nonzero if the store operation should be aborted.
320
+ */
321
+ virtual int onStoreStatus (struct ble_store_status_event * event, void * arg);
322
+ };
323
+
298
324
#endif // CONFIG_BT_ENABLED
299
325
#endif // NIMBLE_CPP_DEVICE_H_
0 commit comments