att_db.c (9305033e0290a73b79a29900c5b9f35f77d880b1) att_db.c (1979f09cf045e87f55a9cd8067e8ef902cc8d78b)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 1257 unchanged lines hidden (view full) ---

1266 if (att_iterator_match_uuid16(&it, uuid16)) return it.handle;
1267 }
1268 return 0;
1269}
1270
1271uint16_t gatt_server_get_descriptor_handle_for_characteristic_with_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t characteristic_uuid16, uint16_t descriptor_uuid16){
1272 att_iterator_t it;
1273 att_iterator_init(&it);
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 1257 unchanged lines hidden (view full) ---

1266 if (att_iterator_match_uuid16(&it, uuid16)) return it.handle;
1267 }
1268 return 0;
1269}
1270
1271uint16_t gatt_server_get_descriptor_handle_for_characteristic_with_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t characteristic_uuid16, uint16_t descriptor_uuid16){
1272 att_iterator_t it;
1273 att_iterator_init(&it);
1274 int characteristic_found = 0;
1274 bool characteristic_found = false;
1275 while (att_iterator_has_next(&it)){
1276 att_iterator_fetch_next(&it);
1277 if (it.handle && (it.handle < start_handle)) continue;
1278 if (it.handle > end_handle) break; // (1)
1279 if (it.handle == 0u) break;
1280 if (att_iterator_match_uuid16(&it, characteristic_uuid16)){
1275 while (att_iterator_has_next(&it)){
1276 att_iterator_fetch_next(&it);
1277 if (it.handle && (it.handle < start_handle)) continue;
1278 if (it.handle > end_handle) break; // (1)
1279 if (it.handle == 0u) break;
1280 if (att_iterator_match_uuid16(&it, characteristic_uuid16)){
1281 characteristic_found = 1;
1281 characteristic_found = true;
1282 continue;
1283 }
1284 if (att_iterator_match_uuid16(&it, GATT_PRIMARY_SERVICE_UUID)
1285 || att_iterator_match_uuid16(&it, GATT_SECONDARY_SERVICE_UUID)
1286 || att_iterator_match_uuid16(&it, GATT_CHARACTERISTICS_UUID)){
1287 if (characteristic_found) break;
1288 continue;
1289 }

--- 287 unchanged lines hidden ---
1282 continue;
1283 }
1284 if (att_iterator_match_uuid16(&it, GATT_PRIMARY_SERVICE_UUID)
1285 || att_iterator_match_uuid16(&it, GATT_SECONDARY_SERVICE_UUID)
1286 || att_iterator_match_uuid16(&it, GATT_CHARACTERISTICS_UUID)){
1287 if (characteristic_found) break;
1288 continue;
1289 }

--- 287 unchanged lines hidden ---