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 X_NUCLEO_IDB0XA1 by
Revision 189:30fa96fa8ec4, committed 2015-11-20
- Comitter:
- Andrea Palmieri
- Date:
- Fri Nov 20 15:13:14 2015 +0100
- Parent:
- 187:2e517d3ddd71
- Child:
- 190:738b8ca1e1ad
- Commit message:
- Support 128-bit UUID Services list
Signed-off-by: Andrea Palmieri <andrea.palmieri@st.com>
Changed in this revision
| source/BlueNRGGap.cpp | Show annotated file Show diff for this revision Revisions of this file |
| x-nucleo-idb0xa1/BlueNRGGap.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/BlueNRGGap.cpp Fri Nov 20 12:14:47 2015 +0100
+++ b/source/BlueNRGGap.cpp Fri Nov 20 15:13:14 2015 +0100
@@ -134,13 +134,15 @@
}
case GapAdvertisingData::INCOMPLETE_LIST_16BIT_SERVICE_IDS: /**< Incomplete list of 16-bit Service IDs */
case GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS: /**< Complete list of 16-bit Service IDs */
+ case GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS: /**< Incomplete list of 128-bit Service IDs */
+ case GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS: /**< Complete list of 128-bit Service IDs */
{
- PRINTF("Advertising type: INCOMPLETE_LIST_16BIT_SERVICE_IDS/COMPLETE_LIST_16BIT_SERVICE_IDS\n\r");
+ PRINTF("Advertising type: INCOMPLETE_LIST SERVICE_IDS/COMPLETE_LIST SERVICE_IDS\n\r");
uint8_t buffSize = *loadPtr.getUnitAtIndex(index).getLenPtr()-1;
// The total lenght should include the Data Type Value
if(buffSize>UUID_BUFFER_SIZE-1) {
- return BLE_ERROR_PARAM_OUT_OF_RANGE;
+ return BLE_ERROR_INVALID_PARAM;
}
servUuidlength = buffSize+1; // +1 to include the Data Type Value
@@ -149,7 +151,7 @@
PRINTF("servUuidlength=%d servUuidData[0]=%d buffSize=%d\n\r", servUuidlength, servUuidData[0], buffSize);
// Save the Service UUID list just after the Data Type Value field
memcpy(servUuidData+1, loadPtr.getUnitAtIndex(index).getDataPtr(), buffSize);
-
+#ifdef DEBUG
for(unsigned i=0; i<servUuidlength; i++) {
PRINTF("servUuidData[%d] = 0x%x\n\r", i, servUuidData[i]);
}
@@ -157,7 +159,7 @@
for(unsigned i=0; i<buffSize; i++) {
PRINTF("loadPtr.getUnitAtIndex(index).getDataPtr()[%d] = 0x%x\n\r", i, loadPtr.getUnitAtIndex(index).getDataPtr()[i]);
}
-
+#endif /* DEBUG */
break;
}
case GapAdvertisingData::INCOMPLETE_LIST_32BIT_SERVICE_IDS: /**< Incomplete list of 32-bit Service IDs (not relevant for Bluetooth 4.0) */
@@ -170,16 +172,6 @@
PRINTF("Advertising type: COMPLETE_LIST_32BIT_SERVICE_IDS\n\r");
return BLE_ERROR_NOT_IMPLEMENTED;
}
- case GapAdvertisingData::INCOMPLETE_LIST_128BIT_SERVICE_IDS: /**< Incomplete list of 128-bit Service IDs */
- {
- PRINTF("Advertising type: INCOMPLETE_LIST_128BIT_SERVICE_IDS\n\r");
- return BLE_ERROR_NOT_IMPLEMENTED;
- }
- case GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS: /**< Complete list of 128-bit Service IDs */
- {
- PRINTF("Advertising type: COMPLETE_LIST_128BIT_SERVICE_IDS\n\r");
- return BLE_ERROR_NOT_IMPLEMENTED;
- }
case GapAdvertisingData::SHORTENED_LOCAL_NAME: /**< Shortened Local Name */
{
break;
--- a/x-nucleo-idb0xa1/BlueNRGGap.h Fri Nov 20 12:14:47 2015 +0100 +++ b/x-nucleo-idb0xa1/BlueNRGGap.h Fri Nov 20 15:13:14 2015 +0100 @@ -62,7 +62,8 @@ #define CONN_P2 (CONN_P(50))//(CONN_P(1000)) #define CONN_L1 (CONN_L(5)) #define CONN_L2 (CONN_L(5)) -#define UUID_BUFFER_SIZE 13 //6*2(16-bit UUIDs)+1 + +#define UUID_BUFFER_SIZE 17 //Either 8*2(16-bit UUIDs) or 4*4(32-bit UUIDs) or 1*16(128-bit UUIDs) +1 #define ADV_DATA_MAX_SIZE 31 /**************************************************************************/
