change BLEUuid.size() to return number of bits instead of bytes

This commit is contained in:
hathach committed 2017-03-22 15:02:44 +07:00
1 parent 98402b1a50
commit 9ca48429cf
3 files changed
+10 -6

No files matched your search

@@ -105,11 +105,11 @@ bool BLEAdvertising::addUuid(BLEUuid bleuuid)
{
switch ( bleuuid.size() )
{
case 2:
case 16:
return addData(BLE_GAP_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE, &bleuuid._uuid.uuid, 2);
break;
case 16:
case 128:
return addData(BLE_GAP_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE, bleuuid._uuid128, 16);
break;
+7 -3
View File
@@ -54,11 +54,15 @@ void BLEUuid::get(uint16_t& uuid16 )
}
uint8_t BLEUuid::size (void) const
/**
* Get size of uuid in BIT
* @return 16, 32 or 128
*/
size_t BLEUuid::size (void) const
{
// uuid 16
if (_uuid.type == BLE_UUID_TYPE_BLE ) return 2;
if (_uuid128 != NULL ) return 16;
if (_uuid.type == BLE_UUID_TYPE_BLE ) return 16;
if (_uuid128 != NULL || _uuid.type >= BLE_UUID_TYPE_VENDOR_BEGIN) return 128;
// unknown
return 0;
+1 -1
View File
@@ -54,7 +54,7 @@ class BLEUuid
void get(uint16_t& uuid16);
uint8_t size (void) const;
size_t size (void) const;
// Add UUID128 if needed, in case of UUID16, no actions is required
void begin(void);