mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-12 03:39:54 +00:00
gatt_client: prefix gatt structs with gatt_client
This commit is contained in:
parent
f31a71cf4b
commit
d25c33e5a2
@ -60,7 +60,7 @@ keywordstyle=\bfseries\color{black},
|
||||
identifierstyle=\color{black},
|
||||
stringstyle=\color{blue},
|
||||
morekeywords={*, btstack_timer_source_t, btstack_data_source_t, uint32_t, uint16_t, uint8_t, btstack_run_loop_TYPE, le_command_status_t, gatt_client_t,
|
||||
le_characteristic_t, le_service_t, le_characteristic_descriptor_t, service_record_item_t, bd_addr_t, btstack_packet_handler_t,
|
||||
gatt_client_characteristic_t, gatt_client_service_t, gatt_client_characteristic_descriptor_t, service_record_item_t, bd_addr_t, btstack_packet_handler_t,
|
||||
hci_cmd_t, btstack_control_t, remote_device_db_t, link_key_t, device_name_t, hci_transport_t, hci_uart_config_t, sdp_query_event_t,
|
||||
sdp_query_complete_event_t, sdp_query_rfcomm_service_event_t, sdp_parser_event_t, sdp_parser_event_type_t,
|
||||
sdp_parser_attribute_value_event_t, sdp_parser_complete_event_t, advertising_report_t, gc_state_t, le_service_event_t,
|
||||
|
@ -89,8 +89,8 @@ static int cmdline_addr_found = 0;
|
||||
uint16_t gc_handle;
|
||||
static uint16_t battery_service_uuid = 0x180F;
|
||||
static uint16_t battery_level_characteristic_uuid = 0x2a19;
|
||||
static le_service_t battery_service;
|
||||
static le_characteristic_t config_characteristic;
|
||||
static gatt_client_service_t battery_service;
|
||||
static gatt_client_characteristic_t config_characteristic;
|
||||
|
||||
static gc_state_t state = TC_IDLE;
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
@ -116,14 +116,14 @@ static void dump_characteristic_value(uint8_t * blob, uint16_t blob_length){
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void dump_characteristic(le_characteristic_t * characteristic){
|
||||
static void dump_characteristic(gatt_client_characteristic_t * characteristic){
|
||||
printf(" * characteristic: [0x%04x-0x%04x-0x%04x], properties 0x%02x, uuid ",
|
||||
characteristic->start_handle, characteristic->value_handle, characteristic->end_handle, characteristic->properties);
|
||||
printUUID(characteristic->uuid128, characteristic->uuid16);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void dump_service(le_service_t * service){
|
||||
static void dump_service(gatt_client_service_t * service){
|
||||
printf(" * service: [0x%04x-0x%04x], uuid ", service->start_group_handle, service->end_group_handle);
|
||||
printUUID(service->uuid128, service->uuid16);
|
||||
printf("\n");
|
||||
@ -140,7 +140,7 @@ static void error_code(int status){
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
static void extract_service(gatt_client_service_t * service, uint8_t * packet){
|
||||
service->start_group_handle = little_endian_read_16(packet, 4);
|
||||
service->end_group_handle = little_endian_read_16(packet, 6);
|
||||
service->uuid16 = 0;
|
||||
@ -150,7 +150,7 @@ static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_characteristic(le_characteristic_t * characteristic, uint8_t * packet){
|
||||
static void extract_characteristic(gatt_client_characteristic_t * characteristic, uint8_t * packet){
|
||||
characteristic->start_handle = little_endian_read_16(packet, 4);
|
||||
characteristic->value_handle = little_endian_read_16(packet, 6);
|
||||
characteristic->end_handle = little_endian_read_16(packet, 8);
|
||||
|
@ -86,7 +86,7 @@ static bd_addr_t cmdline_addr = { };
|
||||
static int cmdline_addr_found = 0;
|
||||
|
||||
static uint16_t gc_handle;
|
||||
static le_service_t services[40];
|
||||
static gatt_client_service_t services[40];
|
||||
static int service_count = 0;
|
||||
static int service_index = 0;
|
||||
|
||||
@ -144,14 +144,14 @@ static void dump_advertising_report(advertising_report_t * e){
|
||||
|
||||
}
|
||||
|
||||
static void dump_characteristic(le_characteristic_t * characteristic){
|
||||
static void dump_characteristic(gatt_client_characteristic_t * characteristic){
|
||||
printf(" * characteristic: [0x%04x-0x%04x-0x%04x], properties 0x%02x, uuid ",
|
||||
characteristic->start_handle, characteristic->value_handle, characteristic->end_handle, characteristic->properties);
|
||||
printUUID(characteristic->uuid128, characteristic->uuid16);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void dump_service(le_service_t * service){
|
||||
static void dump_service(gatt_client_service_t * service){
|
||||
printf(" * service: [0x%04x-0x%04x], uuid ", service->start_group_handle, service->end_group_handle);
|
||||
printUUID(service->uuid128, service->uuid16);
|
||||
printf("\n");
|
||||
@ -237,7 +237,7 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
|
||||
/* LISTING_START(GATTBrowserQueryHandler): Handling of the GATT client queries */
|
||||
static int search_services = 1;
|
||||
|
||||
static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
static void extract_service(gatt_client_service_t * service, uint8_t * packet){
|
||||
service->start_group_handle = little_endian_read_16(packet, 4);
|
||||
service->end_group_handle = little_endian_read_16(packet, 6);
|
||||
service->uuid16 = 0;
|
||||
@ -247,7 +247,7 @@ static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_characteristic(le_characteristic_t * characteristic, uint8_t * packet){
|
||||
static void extract_characteristic(gatt_client_characteristic_t * characteristic, uint8_t * packet){
|
||||
characteristic->start_handle = little_endian_read_16(packet, 4);
|
||||
characteristic->value_handle = little_endian_read_16(packet, 6);
|
||||
characteristic->end_handle = little_endian_read_16(packet, 8);
|
||||
@ -260,8 +260,8 @@ static void extract_characteristic(le_characteristic_t * characteristic, uint8_t
|
||||
}
|
||||
|
||||
static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
le_service_t service;
|
||||
le_characteristic_t characteristic;
|
||||
gatt_client_service_t service;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
switch(packet[0]){
|
||||
case GATT_EVENT_SERVICE_QUERY_RESULT:\
|
||||
extract_service(&service, packet);
|
||||
|
@ -853,19 +853,19 @@ btstack_linked_list_gatt_client_helper_t * daemon_setup_gatt_client_request(conn
|
||||
|
||||
// (de)serialize structs from/to HCI commands/events
|
||||
|
||||
void daemon_gatt_deserialize_service(uint8_t *packet, int offset, le_service_t *service){
|
||||
void daemon_gatt_deserialize_service(uint8_t *packet, int offset, gatt_client_service_t *service){
|
||||
service->start_group_handle = little_endian_read_16(packet, offset);
|
||||
service->end_group_handle = little_endian_read_16(packet, offset + 2);
|
||||
reverse_128(&packet[offset + 4], service->uuid128);
|
||||
}
|
||||
|
||||
void daemon_gatt_serialize_service(le_service_t * service, uint8_t * event, int offset){
|
||||
void daemon_gatt_serialize_service(gatt_client_service_t * service, uint8_t * event, int offset){
|
||||
little_endian_store_16(event, offset, service->start_group_handle);
|
||||
little_endian_store_16(event, offset+2, service->end_group_handle);
|
||||
reverse_128(service->uuid128, &event[offset + 4]);
|
||||
}
|
||||
|
||||
void daemon_gatt_deserialize_characteristic(uint8_t * packet, int offset, le_characteristic_t * characteristic){
|
||||
void daemon_gatt_deserialize_characteristic(uint8_t * packet, int offset, gatt_client_characteristic_t * characteristic){
|
||||
characteristic->start_handle = little_endian_read_16(packet, offset);
|
||||
characteristic->value_handle = little_endian_read_16(packet, offset + 2);
|
||||
characteristic->end_handle = little_endian_read_16(packet, offset + 4);
|
||||
@ -874,7 +874,7 @@ void daemon_gatt_deserialize_characteristic(uint8_t * packet, int offset, le_cha
|
||||
reverse_128(&packet[offset+10], characteristic->uuid128);
|
||||
}
|
||||
|
||||
void daemon_gatt_serialize_characteristic(le_characteristic_t * characteristic, uint8_t * event, int offset){
|
||||
void daemon_gatt_serialize_characteristic(gatt_client_characteristic_t * characteristic, uint8_t * event, int offset){
|
||||
little_endian_store_16(event, offset, characteristic->start_handle);
|
||||
little_endian_store_16(event, offset+2, characteristic->value_handle);
|
||||
little_endian_store_16(event, offset+4, characteristic->end_handle);
|
||||
@ -882,12 +882,12 @@ void daemon_gatt_serialize_characteristic(le_characteristic_t * characteristic,
|
||||
reverse_128(characteristic->uuid128, &event[offset+8]);
|
||||
}
|
||||
|
||||
void daemon_gatt_deserialize_characteristic_descriptor(uint8_t * packet, int offset, le_characteristic_descriptor_t * descriptor){
|
||||
void daemon_gatt_deserialize_characteristic_descriptor(uint8_t * packet, int offset, gatt_client_characteristic_descriptor_t * descriptor){
|
||||
descriptor->handle = little_endian_read_16(packet, offset);
|
||||
reverse_128(&packet[offset+2], descriptor->uuid128);
|
||||
}
|
||||
|
||||
void daemon_gatt_serialize_characteristic_descriptor(le_characteristic_descriptor_t * characteristic_descriptor, uint8_t * event, int offset){
|
||||
void daemon_gatt_serialize_characteristic_descriptor(gatt_client_characteristic_descriptor_t * characteristic_descriptor, uint8_t * event, int offset){
|
||||
little_endian_store_16(event, offset, characteristic_descriptor->handle);
|
||||
reverse_128(characteristic_descriptor->uuid128, &event[offset+2]);
|
||||
}
|
||||
@ -912,9 +912,9 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
uint8_t * data;
|
||||
#if defined(HAVE_MALLOC) && defined(ENABLE_BLE)
|
||||
uint8_t uuid128[16];
|
||||
le_service_t service;
|
||||
le_characteristic_t characteristic;
|
||||
le_characteristic_descriptor_t descriptor;
|
||||
gatt_client_service_t service;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
gatt_client_characteristic_descriptor_t descriptor;
|
||||
uint16_t data_length;
|
||||
btstack_linked_list_gatt_client_helper_t * gatt_helper;
|
||||
#endif
|
||||
|
@ -193,7 +193,7 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
static void extract_service(gatt_client_service_t * service, uint8_t * packet){
|
||||
service->start_group_handle = little_endian_read_16(packet, 4);
|
||||
service->end_group_handle = little_endian_read_16(packet, 6);
|
||||
service->uuid16 = 0;
|
||||
@ -203,7 +203,7 @@ static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_characteristic(le_characteristic_t * characteristic, uint8_t * packet){
|
||||
static void extract_characteristic(gatt_client_characteristic_t * characteristic, uint8_t * packet){
|
||||
characteristic->start_handle = little_endian_read_16(packet, 4);
|
||||
characteristic->value_handle = little_endian_read_16(packet, 6);
|
||||
characteristic->end_handle = little_endian_read_16(packet, 8);
|
||||
@ -232,7 +232,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
|
||||
switch(packet[0]){
|
||||
case GATT_EVENT_SERVICE_QUERY_RESULT:
|
||||
if (gattServiceDiscoveredCallback) {
|
||||
le_service_t service;
|
||||
gatt_client_service_t service;
|
||||
extract_service(&service, packet);
|
||||
BLEService bleService(service);
|
||||
(*gattServiceDiscoveredCallback)(BLE_STATUS_OK, &device, &bleService);
|
||||
@ -240,7 +240,7 @@ static void gatt_client_callback(uint8_t packet_type, uint8_t * packet, uint16_t
|
||||
break;
|
||||
case GATT_EVENT_CHARACTERISTIC_QUERY_RESULT:
|
||||
if (gattCharacteristicDiscoveredCallback){
|
||||
le_characteristic_t characteristic;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
extract_characteristic(&characteristic, packet);
|
||||
BLECharacteristic bleCharacteristic(characteristic);
|
||||
(*gattCharacteristicDiscoveredCallback)(BLE_STATUS_OK, &device, &bleCharacteristic);
|
||||
@ -483,7 +483,7 @@ uint8_t BLEAdvertisement::getiBeaconMeasuredPower(void){
|
||||
BLECharacteristic::BLECharacteristic(void){
|
||||
}
|
||||
|
||||
BLECharacteristic::BLECharacteristic(le_characteristic_t characteristic)
|
||||
BLECharacteristic::BLECharacteristic(gatt_client_characteristic_t characteristic)
|
||||
: characteristic(characteristic), uuid(characteristic.uuid128) {
|
||||
}
|
||||
|
||||
@ -499,7 +499,7 @@ bool BLECharacteristic::isValueHandle(uint16_t value_handle){
|
||||
return characteristic.value_handle == value_handle;
|
||||
}
|
||||
|
||||
const le_characteristic_t * BLECharacteristic::getCharacteristic(void){
|
||||
const gatt_client_characteristic_t * BLECharacteristic::getCharacteristic(void){
|
||||
return &characteristic;
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ const le_characteristic_t * BLECharacteristic::getCharacteristic(void){
|
||||
BLEService::BLEService(void){
|
||||
}
|
||||
|
||||
BLEService::BLEService(le_service_t service)
|
||||
BLEService::BLEService(gatt_client_service_t service)
|
||||
: service(service), uuid(service.uuid128){
|
||||
}
|
||||
|
||||
@ -519,7 +519,7 @@ bool BLEService::matches(UUID * uuid){
|
||||
return this->uuid.matches(uuid);
|
||||
}
|
||||
|
||||
const le_service_t * BLEService::getService(void){
|
||||
const gatt_client_service_t * BLEService::getService(void){
|
||||
return &service;
|
||||
}
|
||||
|
||||
@ -659,10 +659,10 @@ int BTstackManager::discoverGATTServices(BLEDevice * device){
|
||||
}
|
||||
int BTstackManager::discoverCharacteristicsForService(BLEDevice * device, BLEService * service){
|
||||
gattAction = gattActionCharacteristicQuery;
|
||||
return gatt_client_discover_characteristics_for_service(gatt_client_id, device->getHandle(), (le_service_t*) service->getService());
|
||||
return gatt_client_discover_characteristics_for_service(gatt_client_id, device->getHandle(), (gatt_client_service_t*) service->getService());
|
||||
}
|
||||
int BTstackManager::readCharacteristic(BLEDevice * device, BLECharacteristic * characteristic){
|
||||
return gatt_client_read_value_of_characteristic(gatt_client_id, device->getHandle(), (le_characteristic_t*) characteristic->getCharacteristic());
|
||||
return gatt_client_read_value_of_characteristic(gatt_client_id, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic());
|
||||
}
|
||||
int BTstackManager::writeCharacteristic(BLEDevice * device, BLECharacteristic * characteristic, uint8_t * data, uint16_t size){
|
||||
gattAction = gattActionWrite;
|
||||
@ -675,22 +675,22 @@ int BTstackManager::writeCharacteristicWithoutResponse(BLEDevice * device, BLEC
|
||||
}
|
||||
int BTstackManager::subscribeForNotifications(BLEDevice * device, BLECharacteristic * characteristic){
|
||||
gattAction = gattActionSubscribe;
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (le_characteristic_t*) characteristic->getCharacteristic(),
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic(),
|
||||
GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION);
|
||||
}
|
||||
int BTstackManager::subscribeForIndications(BLEDevice * device, BLECharacteristic * characteristic){
|
||||
gattAction = gattActionSubscribe;
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (le_characteristic_t*) characteristic->getCharacteristic(),
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic(),
|
||||
GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION);
|
||||
}
|
||||
int BTstackManager::unsubscribeFromNotifications(BLEDevice * device, BLECharacteristic * characteristic){
|
||||
gattAction = gattActionUnsubscribe;
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (le_characteristic_t*) characteristic->getCharacteristic(),
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic(),
|
||||
GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NONE);
|
||||
}
|
||||
int BTstackManager::unsubscribeFromIndications(BLEDevice * device, BLECharacteristic * characteristic){
|
||||
gattAction = gattActionUnsubscribe;
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (le_characteristic_t*) characteristic->getCharacteristic(),
|
||||
return gatt_client_write_client_characteristic_configuration(gatt_client_id, device->getHandle(), (gatt_client_characteristic_t*) characteristic->getCharacteristic(),
|
||||
GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NONE);
|
||||
}
|
||||
void BTstackManager::bleConnect(BLEAdvertisement * advertisement, int timeout_ms){
|
||||
|
@ -81,27 +81,27 @@ public:
|
||||
|
||||
class BLECharacteristic {
|
||||
private:
|
||||
le_characteristic_t characteristic;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
UUID uuid;
|
||||
public:
|
||||
BLECharacteristic();
|
||||
BLECharacteristic(le_characteristic_t characteristic);
|
||||
BLECharacteristic(gatt_client_characteristic_t characteristic);
|
||||
const UUID * getUUID();
|
||||
bool matches(UUID * uuid);
|
||||
bool isValueHandle(uint16_t value_handle);
|
||||
const le_characteristic_t * getCharacteristic();
|
||||
const gatt_client_characteristic_t * getCharacteristic();
|
||||
};
|
||||
|
||||
class BLEService {
|
||||
private:
|
||||
le_service_t service;
|
||||
gatt_client_service_t service;
|
||||
UUID uuid;
|
||||
public:
|
||||
BLEService();
|
||||
BLEService(le_service_t service);
|
||||
BLEService(gatt_client_service_t service);
|
||||
const UUID * getUUID();
|
||||
bool matches(UUID * uuid);
|
||||
const le_service_t * getService();
|
||||
const gatt_client_service_t * getService();
|
||||
};
|
||||
|
||||
class BLEDevice {
|
||||
|
@ -90,10 +90,10 @@ static uint32_t ancs_notification_uid;
|
||||
static uint16_t gc_handle;
|
||||
static gatt_client_notification_t client_notification;
|
||||
static int ancs_service_found;
|
||||
static le_service_t ancs_service;
|
||||
static le_characteristic_t ancs_notification_source_characteristic;
|
||||
static le_characteristic_t ancs_control_point_characteristic;
|
||||
static le_characteristic_t ancs_data_source_characteristic;
|
||||
static gatt_client_service_t ancs_service;
|
||||
static gatt_client_characteristic_t ancs_notification_source_characteristic;
|
||||
static gatt_client_characteristic_t ancs_control_point_characteristic;
|
||||
static gatt_client_characteristic_t ancs_data_source_characteristic;
|
||||
static int ancs_characteristcs;
|
||||
static tc_state_t tc_state = TC_IDLE;
|
||||
|
||||
@ -175,7 +175,7 @@ static void ancs_chunk_parser_handle_byte(uint8_t data){
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
static void extract_service(gatt_client_service_t * service, uint8_t * packet){
|
||||
service->start_group_handle = little_endian_read_16(packet, 4);
|
||||
service->end_group_handle = little_endian_read_16(packet, 6);
|
||||
service->uuid16 = 0;
|
||||
@ -185,7 +185,7 @@ static void extract_service(le_service_t * service, uint8_t * packet){
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_characteristic(le_characteristic_t * characteristic, uint8_t * packet){
|
||||
static void extract_characteristic(gatt_client_characteristic_t * characteristic, uint8_t * packet){
|
||||
characteristic->start_handle = little_endian_read_16(packet, 4);
|
||||
characteristic->value_handle = little_endian_read_16(packet, 6);
|
||||
characteristic->end_handle = little_endian_read_16(packet, 8);
|
||||
@ -239,7 +239,7 @@ static void handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
|
||||
break;
|
||||
}
|
||||
|
||||
le_characteristic_t characteristic;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
uint8_t * value;
|
||||
uint16_t value_handle;
|
||||
uint16_t value_length;
|
||||
|
@ -458,7 +458,7 @@ static void emit_event_new(btstack_packet_handler_t callback, uint8_t * packet,
|
||||
* @param con_handle
|
||||
* @param characteristic
|
||||
*/
|
||||
void gatt_client_listen_for_characteristic_value_updates(gatt_client_notification_t * notification, uint16_t con_handle, le_characteristic_t * characteristic){
|
||||
void gatt_client_listen_for_characteristic_value_updates(gatt_client_notification_t * notification, uint16_t con_handle, gatt_client_characteristic_t * characteristic){
|
||||
notification->con_handle = con_handle;
|
||||
notification->attribute_handle = characteristic->value_handle;
|
||||
btstack_linked_list_add(&gatt_client_value_listeners, (btstack_linked_item_t*) notification);
|
||||
@ -1417,7 +1417,7 @@ uint8_t gatt_client_discover_primary_services_by_uuid128(btstack_packet_handler_
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, uint16_t con_handle, le_service_t *service){
|
||||
uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_service_t *service){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
@ -1433,7 +1433,7 @@ uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, uint16_t con_handle, le_service_t *service){
|
||||
uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_service_t *service){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
@ -1487,15 +1487,15 @@ uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(btstack
|
||||
}
|
||||
|
||||
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packet_handler_t callback, uint16_t handle, le_service_t *service, uint16_t uuid16){
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packet_handler_t callback, uint16_t handle, gatt_client_service_t *service, uint16_t uuid16){
|
||||
return gatt_client_discover_characteristics_for_handle_range_by_uuid16(callback, handle, service->start_group_handle, service->end_group_handle, uuid16);
|
||||
}
|
||||
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, uint16_t handle, le_service_t *service, uint8_t * uuid128){
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, uint16_t handle, gatt_client_service_t *service, uint8_t * uuid128){
|
||||
return gatt_client_discover_characteristics_for_handle_range_by_uuid128(callback, handle, service->start_group_handle, service->end_group_handle, uuid128);
|
||||
}
|
||||
|
||||
uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_t *characteristic){
|
||||
uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_t *characteristic){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
@ -1565,7 +1565,7 @@ uint8_t gatt_client_read_value_of_characteristics_by_uuid128(btstack_packet_hand
|
||||
}
|
||||
|
||||
|
||||
uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, uint16_t handle, le_characteristic_t *characteristic){
|
||||
uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, uint16_t handle, gatt_client_characteristic_t *characteristic){
|
||||
return gatt_client_read_value_of_characteristic_using_value_handle(callback, handle, characteristic->value_handle);
|
||||
}
|
||||
|
||||
@ -1587,7 +1587,7 @@ uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack
|
||||
return gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(callback, con_handle, characteristic_value_handle, 0);
|
||||
}
|
||||
|
||||
uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, uint16_t handle, le_characteristic_t *characteristic){
|
||||
uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, uint16_t handle, gatt_client_characteristic_t *characteristic){
|
||||
return gatt_client_read_long_value_of_characteristic_using_value_handle(callback, handle, characteristic->value_handle);
|
||||
}
|
||||
|
||||
@ -1670,7 +1670,7 @@ uint8_t gatt_client_reliable_write_long_value_of_characteristic(btstack_packet_h
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t gatt_client_write_client_characteristic_configuration(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration){
|
||||
uint8_t gatt_client_write_client_characteristic_configuration(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_t * characteristic, uint16_t configuration){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
@ -1710,7 +1710,7 @@ uint8_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(btsta
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){
|
||||
uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor){
|
||||
return gatt_client_read_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle);
|
||||
}
|
||||
|
||||
@ -1732,7 +1732,7 @@ uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(
|
||||
return gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(callback, con_handle, descriptor_handle, 0);
|
||||
}
|
||||
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor){
|
||||
return gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle);
|
||||
}
|
||||
|
||||
@ -1752,7 +1752,7 @@ uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(btst
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
return gatt_client_write_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle, length, value);
|
||||
}
|
||||
|
||||
@ -1776,7 +1776,7 @@ uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle
|
||||
return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(callback, con_handle, descriptor_handle, 0, length, data );
|
||||
}
|
||||
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle, length, value);
|
||||
}
|
||||
|
||||
|
@ -186,27 +186,27 @@ typedef struct gatt_client_notification {
|
||||
|
||||
/* API_START */
|
||||
|
||||
typedef struct le_service{
|
||||
typedef struct {
|
||||
uint16_t start_group_handle;
|
||||
uint16_t end_group_handle;
|
||||
uint16_t uuid16;
|
||||
uint8_t uuid128[16];
|
||||
} le_service_t;
|
||||
} gatt_client_service_t;
|
||||
|
||||
typedef struct le_characteristic{
|
||||
typedef struct {
|
||||
uint16_t start_handle;
|
||||
uint16_t value_handle;
|
||||
uint16_t end_handle;
|
||||
uint16_t properties;
|
||||
uint16_t uuid16;
|
||||
uint8_t uuid128[16];
|
||||
} le_characteristic_t;
|
||||
} gatt_client_characteristic_t;
|
||||
|
||||
typedef struct le_characteristic_descriptor{
|
||||
typedef struct {
|
||||
uint16_t handle;
|
||||
uint16_t uuid16;
|
||||
uint8_t uuid128[16];
|
||||
} le_characteristic_descriptor_t;
|
||||
} gatt_client_characteristic_descriptor_t;
|
||||
|
||||
/**
|
||||
* @brief Set up GATT client.
|
||||
@ -237,30 +237,30 @@ uint8_t gatt_client_discover_primary_services_by_uuid128(btstack_packet_handler_
|
||||
/**
|
||||
* @brief Finds included services within the specified service. For each found included service, an le_service_event_t with type set to GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery. Information about included service type (primary/secondary) can be retrieved either by sending an ATT find information request for the returned start group handle (returning the handle and the UUID for primary or secondary service) or by comparing the service to the list of all primary services.
|
||||
*/
|
||||
uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, uint16_t con_handle, le_service_t *service);
|
||||
uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_service_t *service);
|
||||
|
||||
/**
|
||||
* @brief Discovers all characteristics within the specified service. For each found characteristic, an le_characteristics_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, uint16_t con_handle, le_service_t *service);
|
||||
uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_service_t *service);
|
||||
|
||||
/**
|
||||
* @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid16(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
|
||||
uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid);
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid16 (btstack_packet_handler_t callback, uint16_t con_handle, le_service_t *service, uint16_t uuid16);
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, uint16_t con_handle, le_service_t *service, uint8_t * uuid128);
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid16 (btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_service_t *service, uint16_t uuid16);
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_service_t *service, uint8_t * uuid128);
|
||||
|
||||
/**
|
||||
* @brief Discovers attribute handle and UUID of a characteristic descriptor within the specified characteristic. For each found descriptor, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_t *characteristic);
|
||||
|
||||
/**
|
||||
* @brief Reads the characteristic value using the characteristic's value handle. If the characteristic value is found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
|
||||
*/
|
||||
uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_read_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t characteristic_value_handle);
|
||||
|
||||
/**
|
||||
@ -272,7 +272,7 @@ uint8_t gatt_client_read_value_of_characteristics_by_uuid128(btstack_packet_hand
|
||||
/**
|
||||
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
|
||||
*/
|
||||
uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t characteristic_value_handle);
|
||||
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset);
|
||||
|
||||
@ -308,29 +308,29 @@ uint8_t gatt_client_reliable_write_long_value_of_characteristic(btstack_packet_h
|
||||
/**
|
||||
* @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
|
||||
*/
|
||||
uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
|
||||
uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor);
|
||||
uint8_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t descriptor_handle);
|
||||
|
||||
/**
|
||||
* @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read.
|
||||
*/
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor);
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t descriptor_handle);
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset);
|
||||
|
||||
/**
|
||||
* @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.
|
||||
*/
|
||||
uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief Writes the client characteristic configuration of the specified characteristic. It is used to subscribe for notifications or indications of the characteristic value. For notifications or indications specify: GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION resp. GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION as configuration value.
|
||||
*/
|
||||
uint8_t gatt_client_write_client_characteristic_configuration(btstack_packet_handler_t callback, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration);
|
||||
uint8_t gatt_client_write_client_characteristic_configuration(btstack_packet_handler_t callback, uint16_t con_handle, gatt_client_characteristic_t * characteristic, uint16_t configuration);
|
||||
|
||||
/**
|
||||
* @brief Register for notifications and indications of a characteristic enabled by gatt_client_write_client_characteristic_configuration
|
||||
@ -338,7 +338,7 @@ uint8_t gatt_client_write_client_characteristic_configuration(btstack_packet_han
|
||||
* @param con_handle
|
||||
* @param characteristic
|
||||
*/
|
||||
void gatt_client_listen_for_characteristic_value_updates(gatt_client_notification_t * notification, uint16_t con_handle, le_characteristic_t * characteristic);
|
||||
void gatt_client_listen_for_characteristic_value_updates(gatt_client_notification_t * notification, uint16_t con_handle, gatt_client_characteristic_t * characteristic);
|
||||
|
||||
/**
|
||||
* @brief -> gatt complete event
|
||||
|
@ -65,11 +65,11 @@ uint16_t characteristic_uuid16 = 0xF000;
|
||||
static int result_index;
|
||||
static uint8_t result_counter;
|
||||
|
||||
static le_service_t services[50];
|
||||
static le_service_t included_services[50];
|
||||
static gatt_client_service_t services[50];
|
||||
static gatt_client_service_t included_services[50];
|
||||
|
||||
static le_characteristic_t characteristics[50];
|
||||
static le_characteristic_descriptor_t descriptors[50];
|
||||
static gatt_client_characteristic_t characteristics[50];
|
||||
static gatt_client_characteristic_descriptor_t descriptors[50];
|
||||
|
||||
void mock_simulate_discover_primary_services_response();
|
||||
void mock_simulate_att_exchange_mtu_response();
|
||||
@ -144,9 +144,9 @@ static void verify_blob(uint16_t value_length, uint16_t value_offset, uint8_t *
|
||||
static void handle_ble_client_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
uint8_t status;
|
||||
le_service_t service;
|
||||
le_characteristic_t characteristic;
|
||||
le_characteristic_descriptor_t descriptor;
|
||||
gatt_client_service_t service;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
gatt_client_characteristic_descriptor_t descriptor;
|
||||
switch (packet[0]){
|
||||
case GATT_EVENT_QUERY_COMPLETE:
|
||||
status = packet[4];
|
||||
|
@ -191,11 +191,11 @@ static int le_device_db_index;
|
||||
static sm_key_t signing_csrk;
|
||||
|
||||
static central_state_t central_state = CENTRAL_IDLE;
|
||||
static le_characteristic_t gap_name_characteristic;
|
||||
static le_characteristic_t gap_reconnection_address_characteristic;
|
||||
static le_characteristic_t gap_peripheral_privacy_flag_characteristic;
|
||||
static le_characteristic_t signed_write_characteristic;
|
||||
static le_service_t service;
|
||||
static gatt_client_characteristic_t gap_name_characteristic;
|
||||
static gatt_client_characteristic_t gap_reconnection_address_characteristic;
|
||||
static gatt_client_characteristic_t gap_peripheral_privacy_flag_characteristic;
|
||||
static gatt_client_characteristic_t signed_write_characteristic;
|
||||
static gatt_client_service_t service;
|
||||
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
static btstack_packet_callback_registration_t sm_event_callback_registration;
|
||||
@ -408,7 +408,7 @@ static void use_public_pts_address(void){
|
||||
current_pts_address_type = public_pts_address_type;
|
||||
}
|
||||
|
||||
static void extract_service(le_service_t * aService, uint8_t * data){
|
||||
static void extract_service(gatt_client_service_t * aService, uint8_t * data){
|
||||
aService->start_group_handle = little_endian_read_16(data, 0);
|
||||
aService->end_group_handle = little_endian_read_16(data, 2);
|
||||
aService->uuid16 = 0;
|
||||
@ -418,7 +418,7 @@ static void extract_service(le_service_t * aService, uint8_t * data){
|
||||
}
|
||||
}
|
||||
|
||||
static void extract_characteristic(le_characteristic_t * characteristic, uint8_t * packet){
|
||||
static void extract_characteristic(gatt_client_characteristic_t * characteristic, uint8_t * packet){
|
||||
characteristic->start_handle = little_endian_read_16(packet, 4);
|
||||
characteristic->value_handle = little_endian_read_16(packet, 6);
|
||||
characteristic->end_handle = little_endian_read_16(packet, 8);
|
||||
@ -436,7 +436,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
|
||||
uint8_t address_type;
|
||||
bd_addr_t flipped_address;
|
||||
le_characteristic_t characteristic;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
uint8_t * value;
|
||||
uint16_t value_handle;
|
||||
uint16_t value_length;
|
||||
@ -725,7 +725,7 @@ static void handle_gatt_client_event(uint8_t packet_type, uint16_t channel, uint
|
||||
{
|
||||
printf("Searching Characteristic Declaration\n");
|
||||
central_state = CENTRAL_GPA_W4_RESPONSE2;
|
||||
le_service_t aService;
|
||||
gatt_client_service_t aService;
|
||||
aService.start_group_handle = ui_start_handle;
|
||||
aService.end_group_handle = ui_end_handle;
|
||||
gatt_client_discover_characteristics_for_service(handle_gatt_client_event, handle, &aService);
|
||||
@ -1037,7 +1037,7 @@ static int ui_process_uint16_request(char buffer){
|
||||
case CENTRAL_ENTER_END_HANDLE_4_DISCOVER_CHARACTERISTICS: {
|
||||
printf("Discover Characteristics from 0x%04x to 0x%04x\n", ui_attribute_handle, ui_uint16);
|
||||
central_state = CENTRAL_W4_CHARACTERISTICS;
|
||||
le_service_t aService;
|
||||
gatt_client_service_t aService;
|
||||
aService.start_group_handle = ui_attribute_handle;
|
||||
aService.end_group_handle = ui_uint16;
|
||||
gatt_client_discover_characteristics_for_service(handle_gatt_client_event, handle, &aService);
|
||||
@ -1048,7 +1048,7 @@ static int ui_process_uint16_request(char buffer){
|
||||
gatt_client_discover_characteristics_for_handle_range_by_uuid16(handle_gatt_client_event, handle, 0x0001, 0xffff, ui_uint16);
|
||||
return 0;
|
||||
case CENTRAL_W4_DISCOVER_CHARACTERISTIC_DESCRIPTORS: {
|
||||
le_characteristic_t characteristic;
|
||||
gatt_client_characteristic_t characteristic;
|
||||
characteristic.value_handle = ui_uint16 - 1;
|
||||
characteristic.end_handle = ui_uint16;
|
||||
gatt_client_discover_characteristic_descriptors(handle_gatt_client_event, handle, &characteristic);
|
||||
@ -1511,7 +1511,7 @@ static void ui_process_command(char buffer){
|
||||
case 'i':
|
||||
{
|
||||
central_state = CENTRAL_W4_CHARACTERISTICS;
|
||||
le_service_t aService;
|
||||
gatt_client_service_t aService;
|
||||
aService.start_group_handle = 0x0001;
|
||||
aService.end_group_handle = 0xffff;
|
||||
gatt_client_find_included_services_for_service(handle_gatt_client_event, handle, &aService);
|
||||
|
Loading…
x
Reference in New Issue
Block a user