fdsf
Fork of nRF51822 by
Diff: source/nRF5xServiceDiscovery.cpp
- Revision:
- 555:dc3945bd78d7
- Parent:
- 549:3f782c64d014
- Child:
- 557:e4218a32be51
diff -r 05200b69a95f -r dc3945bd78d7 source/nRF5xServiceDiscovery.cpp --- a/source/nRF5xServiceDiscovery.cpp Mon Jan 11 10:19:11 2016 +0000 +++ b/source/nRF5xServiceDiscovery.cpp Mon Jan 11 10:19:12 2016 +0000 @@ -251,10 +251,7 @@ if (state == DISCOVER_SERVICE_UUIDS) { if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID)) { UUID::LongUUIDBytes_t uuid; - /* Switch longUUID bytes to MSB */ - for (unsigned i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) { - uuid[i] = response->handle_value[0].p_value[UUID::LENGTH_OF_LONG_UUID - 1 - i]; - } + memcpy(uuid, response->handle_value[0].p_value, UUID::LENGTH_OF_LONG_UUID); unsigned serviceIndex = serviceUUIDDiscoveryQueue.dequeue(); services[serviceIndex].setupLongUUID(uuid); @@ -266,10 +263,8 @@ } else if (state == DISCOVER_CHARACTERISTIC_UUIDS) { if ((response->count == 1) && (response->value_len == UUID::LENGTH_OF_LONG_UUID + 1 /* props */ + 2 /* value handle */)) { UUID::LongUUIDBytes_t uuid; - /* Switch longUUID bytes to MSB */ - for (unsigned i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) { - uuid[i] = response->handle_value[0].p_value[3 + UUID::LENGTH_OF_LONG_UUID - 1 - i]; - } + + memcpy(uuid, &(response->handle_value[0].p_value[3]), UUID::LENGTH_OF_LONG_UUID); unsigned charIndex = charUUIDDiscoveryQueue.dequeue(); characteristics[charIndex].setupLongUUID(uuid);