Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow adding a User Description descriptor to a GattCharacteristic. #9

Closed
rgrover opened this issue Apr 24, 2015 · 1 comment
Closed

Comments

@rgrover
Copy link
Contributor

rgrover commented Apr 24, 2015

This needs special handling since it is a reserved UUID. The present mechanism of adding descriptors through a table during construction doesn't work.

@rgrover
Copy link
Contributor Author

rgrover commented Apr 24, 2015

I used the following patch to HeartRateService to test this change.

diff --git a/services/HeartRateService.h b/services/HeartRateService.h
index 8da7747..8d04b5e 100644
--- a/services/HeartRateService.h
+++ b/services/HeartRateService.h
@@ -18,6 +18,7 @@
 #define __BLE_HEART_RATE_SERVICE_H__

 #include "BLEDevice.h"
+#include "ble_srv_common.h"

 /**
 * @class HeartRateService
@@ -132,7 +133,15 @@ private:
             return;
         }

-        GattCharacteristic *charTable[] = {&hrmRate, &hrmLocation, &controlPoint};
+        GattAttribute desc(BLE_UUID_DESCRIPTOR_CHAR_USER_DESC, (uint8_t *)"something readable", strlen("s
+        uint8_t alertLevel = 1;
+
+        GattAttribute *descs[] = {&desc};
+
+        GattCharacteristic rohit(BLE_UUID_ALERT_LEVEL_CHAR, reinterpret_cast<uint8_t *>(&alertLevel),
+                                 sizeof(uint8_t), sizeof(uint8_t), GattCharacteristic::BLE_GATT_CHAR_PROP
+
+        GattCharacteristic *charTable[] = {&hrmRate,  &rohit, &hrmLocation, &controlPoint};
         GattService         hrmService(GattService::UUID_HEART_RATE_SERVICE, charTable, sizeof(charTable)

         ble.addService(hrmService);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant