add ServiceIndicesNeedingUUIDDiscovery::getFirst()

This commit is contained in:
Rohit Grover 2015-05-27 08:37:32 +01:00
parent 550aff2493
commit f342dcaed2
2 changed files with 4 additions and 1 deletions

View File

@ -112,7 +112,7 @@ NordicServiceDiscovery::ServiceIndicesNeedingUUIDDiscovery::triggerFirst(void)
while (numIndices) { /* loop until a call to char_value_by_uuid_read() succeeds or we run out of pending indices. */
parentContainer->state = DISCOVER_SERVICE_UUIDS;
unsigned serviceIndex = serviceIndices[0]; /* we chose to use the first index; we could just as easily have chosen the last. */
unsigned serviceIndex = getFirst();
ble_uuid_t uuid = {
.uuid = BLE_UUID_SERVICE_PRIMARY,
.type = BLE_UUID_TYPE_BLE,

View File

@ -131,6 +131,9 @@ private:
void append(int serviceIndex) {
serviceIndices[numIndices++] = serviceIndex;
}
unsigned getFirst(void) const {
return serviceIndices[0];
}
void removeFirst(void) {
numIndices--;
for (unsigned index = 0; index < numIndices; index++) {