Clone of the nRF51822 repository from github The correct home is https://github.com/lancaster-university/nRF51822
Dependencies: nrf51-sdk
Dependents: microbit-dal microbit-ble-open microbit-dal-eddystone microbit-dal-ble-accelerometer-example ... more
Diff: btle/custom/custom_helper.cpp
- Revision:
- 187:61589d822b7d
- Parent:
- 186:d0fc349b9a1b
- Child:
- 285:55ac765bcc8d
--- a/btle/custom/custom_helper.cpp Mon Jun 08 10:43:30 2015 +0100 +++ b/btle/custom/custom_helper.cpp Fri Jun 19 15:55:14 2015 +0100 @@ -23,7 +23,7 @@ * structures involved in maintaining a local cache of 128-bit UUIDs. */ typedef struct { - UUID::LongUUIDBytes_t uuid; + LongUUIDBytes_t uuid; uint8_t type; } converted_uuid_table_entry_t; static const unsigned UUID_TABLE_MAX_ENTRIES = 8; /* This is the maximum number of 128-bit UUIDs with distinct bases that @@ -38,12 +38,12 @@ * @return true if a match is found. */ static bool -lookupConvertedUUIDTable(const UUID::LongUUIDBytes_t uuid, uint8_t *recoveredType) +lookupConvertedUUIDTable(const LongUUIDBytes_t uuid, uint8_t *recoveredType) { unsigned i; for (i = 0; i < uuidTableEntries; i++) { unsigned byteIndex; - for (byteIndex = 0; byteIndex < UUID::LENGTH_OF_LONG_UUID; byteIndex++) { + for (byteIndex = 0; byteIndex < LENGTH_OF_LONG_UUID; byteIndex++) { /* Skip bytes 2 and 3, because they contain the shortUUID (16-bit) version of the * long UUID; and we're comparing against the remainder. */ if ((byteIndex == 2) || (byteIndex == 3)) { @@ -55,7 +55,7 @@ } } - if (byteIndex == UUID::LENGTH_OF_LONG_UUID) { + if (byteIndex == LENGTH_OF_LONG_UUID) { *recoveredType = convertedUUIDTable[i].type; return true; } @@ -65,13 +65,13 @@ } static void -addToConvertedUUIDTable(const UUID::LongUUIDBytes_t uuid, uint8_t type) +addToConvertedUUIDTable(const LongUUIDBytes_t uuid, uint8_t type) { if (uuidTableEntries == UUID_TABLE_MAX_ENTRIES) { return; /* recovery needed; or at least the user should be warned about this fact.*/ } - memcpy(convertedUUIDTable[uuidTableEntries].uuid, uuid, UUID::LENGTH_OF_LONG_UUID); + memcpy(convertedUUIDTable[uuidTableEntries].uuid, uuid, LENGTH_OF_LONG_UUID); convertedUUIDTable[uuidTableEntries].uuid[2] = 0; convertedUUIDTable[uuidTableEntries].uuid[3] = 0; convertedUUIDTable[uuidTableEntries].type = type; @@ -149,8 +149,8 @@ uint8_t uuid_type = 0; /* Reverse the bytes since ble_uuid128_t is LSB */ - for (unsigned i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) { - base_uuid.uuid128[i] = p_uuid_base[UUID::LENGTH_OF_LONG_UUID - 1 - i]; + for (unsigned i = 0; i < LENGTH_OF_LONG_UUID; i++) { + base_uuid.uuid128[i] = p_uuid_base[LENGTH_OF_LONG_UUID - 1 - i]; } ASSERT_INT( ERROR_NONE, sd_ble_uuid_vs_add( &base_uuid, &uuid_type ), 0); @@ -166,14 +166,14 @@ error_t custom_decode_uuid_base(uint8_t const *const p_uuid_base, ble_uuid_t *p_uuid) { - UUID::LongUUIDBytes_t uuid_base_le; + LongUUIDBytes_t uuid_base_le; /* Reverse the bytes since ble_uuid128_t is LSB */ - for (uint8_t i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) { - uuid_base_le[i] = p_uuid_base[UUID::LENGTH_OF_LONG_UUID - 1 - i]; + for (uint8_t i = 0; i < LENGTH_OF_LONG_UUID; i++) { + uuid_base_le[i] = p_uuid_base[LENGTH_OF_LONG_UUID - 1 - i]; } - ASSERT_STATUS( sd_ble_uuid_decode(UUID::LENGTH_OF_LONG_UUID, uuid_base_le, p_uuid)); + ASSERT_STATUS( sd_ble_uuid_decode(LENGTH_OF_LONG_UUID, uuid_base_le, p_uuid)); return ERROR_NONE; }