Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Diff: hw/GattServer.h
- Revision:
- 99:58c47085e816
- Parent:
- 94:455363a6eb90
diff -r d751acb2543f -r 58c47085e816 hw/GattServer.h
--- a/hw/GattServer.h Thu Jul 03 09:57:05 2014 +0100
+++ b/hw/GattServer.h Thu Jul 03 09:59:53 2014 +0100
@@ -44,7 +44,8 @@
/* Event callback handlers. */
typedef void (*EventCallback_t)(uint16_t attributeHandle);
- void setOnDataSent(EventCallback_t callback) {
+ typedef void (*ServerEventCallback_t)(void); /* independent of any particular attribute */
+ void setOnDataSent(ServerEventCallback_t callback) {
onDataSent = callback;
}
void setOnDataWritten(EventCallback_t callback) {
@@ -62,11 +63,6 @@
void handleEvent(GattServerEvents::gattEvent_e type, uint16_t charHandle) {
switch (type) {
- case GattServerEvents::GATT_EVENT_DATA_SENT:
- if (onDataSent) {
- onDataSent(charHandle);
- }
- break;
case GattServerEvents::GATT_EVENT_DATA_WRITTEN:
if (onDataWritten) {
onDataWritten(charHandle);
@@ -90,6 +86,18 @@
}
}
+ void handleEvent(GattServerEvents::gattEvent_e type) {
+ switch (type) {
+ case GattServerEvents::GATT_EVENT_DATA_SENT:
+ if (onDataSent) {
+ onDataSent();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
protected:
GattServer() : serviceCount(0), characteristicCount(0), onDataSent(NULL), onDataWritten(NULL), onUpdatesEnabled(NULL), onUpdatesDisabled(NULL), onConfirmationReceived(NULL) {
/* empty */
@@ -100,11 +108,11 @@
uint8_t characteristicCount;
private:
- EventCallback_t onDataSent;
- EventCallback_t onDataWritten;
- EventCallback_t onUpdatesEnabled;
- EventCallback_t onUpdatesDisabled;
- EventCallback_t onConfirmationReceived;
+ ServerEventCallback_t onDataSent;
+ EventCallback_t onDataWritten;
+ EventCallback_t onUpdatesEnabled;
+ EventCallback_t onUpdatesDisabled;
+ EventCallback_t onConfirmationReceived;
};
#endif // ifndef __GATT_SERVER_H__
