@@ -68,6 +68,9 @@ friend class tinyb::BluetoothNotificationHandler;
6868 std::function<void (bool )> paired_callback;
6969 std::function<void (bool )> connected_callback;
7070 std::function<void (bool )> blocked_callback;
71+ std::function<void (std::map<uint16_t , std::vector<uint8_t >> &)> mfg_callback;
72+ std::function<void (std::map<std::string, std::vector<uint8_t >> &)> service_callback;
73+ std::function<void (bool )> services_resolved_callback;
7174
7275public:
7376
@@ -381,12 +384,67 @@ friend class tinyb::BluetoothNotificationHandler;
381384 * @return manufacturer specific advertisement data.
382385 */
383386 std::map<uint16_t , std::vector<uint8_t >> get_manufacturer_data ();
387+ /* *
388+ * Enables notifications for changes of the manufacturer data of the device
389+ * and triggers the callback when the value changes.
390+ * Uninstalls the previous connected callback, if any was installed.
391+ * @param callback A function of the form void(BluetoothDevice&, bool, void *), where
392+ * BluetoothDevice& is the device for which the callback was set, bool will contain the
393+ * new value of the connected property and void * contains optional, user set data
394+ * @param userdata The data which will be delivered to the callback when it is triggered.
395+ * Memory must be managed by user.
396+ */
397+ void enable_manufacturer_data_notifications (
398+ std::function<void (BluetoothDevice &device, std::map<uint16_t , std::vector<uint8_t >> &mfgdata, void *userdata)> callback,
399+ void *userdata);
400+ /* *
401+ * Enables notifications for changes in the manufacturer data of the device
402+ * and triggers the callback when the value changes.
403+ * Uninstalls the previous connected callback, if any was installed.
404+ * @param callback A function of the form void(bool), where
405+ * bool will contain the new value of the connected property
406+ */
407+ void enable_manufacturer_data_notifications (
408+ std::function<void (std::map<uint16_t , std::vector<uint8_t >> &mfgdata)> callback);
409+ /* *
410+ * Disables notifications for changes in the manufacturer data of the device
411+ * and uninstalls any callback.
412+ */
413+ void disable_manufacturer_data_notifications ();
414+
384415
385416 /* * Returns a map containing service advertisement data.
386417 * An entry has a UUID string key and an array of bytes.
387418 * @return service advertisement data.
388419 */
389420 std::map<std::string, std::vector<uint8_t >> get_service_data ();
421+ /* *
422+ * Enables notifications for changes of the service data of the device
423+ * and triggers the callback when the value changes.
424+ * Uninstalls the previous connected callback, if any was installed.
425+ * @param callback A function of the form void(BluetoothDevice&, bool, void *), where
426+ * BluetoothDevice& is the device for which the callback was set, bool will contain the
427+ * new value of the connected property and void * contains optional, user set data
428+ * @param userdata The data which will be delivered to the callback when it is triggered.
429+ * Memory must be managed by user.
430+ */
431+ void enable_service_data_notifications (
432+ std::function<void (BluetoothDevice &device, std::map<std::string, std::vector<uint8_t >> &servicedata, void *userdata)> callback,
433+ void *userdata);
434+ /* *
435+ * Enables notifications for changes in the manufacturer data of the device
436+ * and triggers the callback when the value changes.
437+ * Uninstalls the previous connected callback, if any was installed.
438+ * @param callback A function of the form void(bool), where
439+ * bool will contain the new value of the connected property
440+ */
441+ void enable_service_data_notifications (
442+ std::function<void (std::map<std::string, std::vector<uint8_t >> &servicedata)> callback);
443+ /* *
444+ * Disables notifications for changes in the service data of the device
445+ * and uninstalls any callback.
446+ */
447+ void disable_service_data_notifications ();
390448
391449 /* * Returns the transmission power level (0 means unknown).
392450 * @return the transmission power level (0 means unknown).
@@ -397,4 +455,32 @@ friend class tinyb::BluetoothNotificationHandler;
397455 * @return true if the service discovery has ended.
398456 */
399457 bool get_services_resolved ();
458+ /* *
459+ * Enables notifications for changes of the services resolved status of the device
460+ * and triggers the callback when the value changes.
461+ * Uninstalls the previous services resolved callback, if any was installed.
462+ * @param callback A function of the form void(BluetoothDevice&, bool, void *), where
463+ * BluetoothDevice& is the device for which the callback was set, bool will contain the
464+ * new value of the services resolved property and void * contains optional, user set data
465+ * @param userdata The data which will be delivered to the callback when it is triggered.
466+ * Memory must be managed by user.
467+ */
468+ void enable_services_resolved_notifications (
469+ std::function<void (BluetoothDevice &device, bool services_resolved, void *userdata)> callback,
470+ void *userdata);
471+ /* *
472+ * Enables notifications for changes of the services resolved status of the device
473+ * and triggers the callback when the value changes.
474+ * Uninstalls the previous services resolved callback, if any was installed.
475+ * @param callback A function of the form void(bool), where
476+ * bool will contain the new value of the services resolved property
477+ */
478+ void enable_services_resolved_notifications (
479+ std::function<void (bool connec)> callback);
480+ /* *
481+ * Disables notifications for changes of the services resolved status of the device
482+ * and uninstalls any callback.
483+ */
484+ void disable_services_resolved_notifications ();
485+
400486};
0 commit comments