att_db.c (9f7e3af12bd7c10d0f10bf663a023abfc825f8ff) att_db.c (32e1ff05bd6a138a7b468a3ad9ab365dccc9f604)
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

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

1537 if (characteristic_found && att_iterator_match_uuid16(&it, GATT_CLIENT_CHARACTERISTICS_CONFIGURATION)){
1538 return it.handle;
1539 }
1540 }
1541 return 0;
1542}
1543
1544
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

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

1537 if (characteristic_found && att_iterator_match_uuid16(&it, GATT_CLIENT_CHARACTERISTICS_CONFIGURATION)){
1538 return it.handle;
1539 }
1540 }
1541 return 0;
1542}
1543
1544
1545bool gatt_server_get_included_service_with_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t uuid16,
1546 uint16_t * out_included_service_handle, uint16_t * out_included_service_start_handle, uint16_t * out_included_service_end_handle){
1547
1548 att_iterator_t it;
1549 att_iterator_init(&it);
1550 while (att_iterator_has_next(&it)){
1551 att_iterator_fetch_next(&it);
1552 if ((it.handle != 0u) && (it.handle < start_handle)){
1553 continue;
1554 }
1555 if (it.handle > end_handle){
1556 break; // (1)
1557 }
1558 if (it.handle == 0u){
1559 break;
1560 }
1561 if ((it.value_len == 6) && (att_iterator_match_uuid16(&it, GATT_INCLUDE_SERVICE_UUID))){
1562 if (little_endian_read_16(it.value, 4) == uuid16){
1563 *out_included_service_handle = it.handle;
1564 *out_included_service_start_handle = little_endian_read_16(it.value, 0);
1565 *out_included_service_end_handle = little_endian_read_16(it.value, 2);
1566 return true;
1567 }
1568 }
1569 }
1570 return false;
1571}
1572
1545// 1-item cache to optimize query during write_callback
1546static void att_persistent_ccc_cache(att_iterator_t * it){
1547 att_persistent_ccc_handle = it->handle;
1548 if (it->flags & (uint16_t)ATT_PROPERTY_UUID128){
1549 att_persistent_ccc_uuid16 = 0u;
1550 } else {
1551 att_persistent_ccc_uuid16 = little_endian_read_16(it->uuid, 0);
1552 }

--- 198 unchanged lines hidden ---
1573// 1-item cache to optimize query during write_callback
1574static void att_persistent_ccc_cache(att_iterator_t * it){
1575 att_persistent_ccc_handle = it->handle;
1576 if (it->flags & (uint16_t)ATT_PROPERTY_UUID128){
1577 att_persistent_ccc_uuid16 = 0u;
1578 } else {
1579 att_persistent_ccc_uuid16 = little_endian_read_16(it->uuid, 0);
1580 }

--- 198 unchanged lines hidden ---