mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-14 10:21:49 +00:00
gatt_client: pass gatt_client_t to setup_long_characteristic_value_packet
This commit is contained in:
parent
8450fbf526
commit
3e78e462d5
@ -1051,7 +1051,9 @@ setup_characteristic_value_packet(const gatt_client_t *gatt_client, uint8_t type
|
||||
#error "Long Characteristic reads requires HCI_INCOMING_PRE_BUFFER_SIZE >= 2"
|
||||
#endif
|
||||
|
||||
static uint8_t * setup_long_characteristic_value_packet(uint8_t type, hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * value, uint16_t length){
|
||||
static uint8_t *
|
||||
setup_long_characteristic_value_packet(const gatt_client_t *gatt_client, uint8_t type, uint16_t attribute_handle,
|
||||
uint16_t offset, uint8_t *value, uint16_t length) {
|
||||
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
|
||||
// avoid using pre ATT headers.
|
||||
// copy value into test packet for testing
|
||||
@ -1063,7 +1065,7 @@ static uint8_t * setup_long_characteristic_value_packet(uint8_t type, hci_con_ha
|
||||
#endif
|
||||
packet[0] = type;
|
||||
packet[1] = LONG_CHARACTERISTIC_VALUE_EVENT_HEADER_SIZE - 2 + length;
|
||||
little_endian_store_16(packet, 2, con_handle);
|
||||
little_endian_store_16(packet, 2, gatt_client->con_handle);
|
||||
little_endian_store_16(packet, 4, attribute_handle);
|
||||
little_endian_store_16(packet, 6, offset);
|
||||
little_endian_store_16(packet, 8, length);
|
||||
@ -1199,7 +1201,10 @@ static void report_gatt_characteristic_value(gatt_client_t * gatt_client, uint16
|
||||
|
||||
// @note assume that value is part of an l2cap buffer - overwrite parts of the HCI/L2CAP/ATT packet (4/4/3) bytes
|
||||
static void report_gatt_long_characteristic_value_blob(gatt_client_t * gatt_client, uint16_t attribute_handle, uint8_t * blob, uint16_t blob_length, int value_offset){
|
||||
uint8_t * packet = setup_long_characteristic_value_packet(GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT, gatt_client->con_handle, attribute_handle, value_offset, blob, blob_length);
|
||||
uint8_t * packet = setup_long_characteristic_value_packet(gatt_client,
|
||||
GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT,
|
||||
attribute_handle, value_offset,
|
||||
blob, blob_length);
|
||||
emit_event_new(gatt_client->callback, packet, blob_length + LONG_CHARACTERISTIC_VALUE_EVENT_HEADER_SIZE);
|
||||
}
|
||||
|
||||
@ -1212,7 +1217,10 @@ static void report_gatt_characteristic_descriptor(gatt_client_t * gatt_client, u
|
||||
}
|
||||
|
||||
static void report_gatt_long_characteristic_descriptor(gatt_client_t * gatt_client, uint16_t descriptor_handle, uint8_t *blob, uint16_t blob_length, uint16_t value_offset){
|
||||
uint8_t * packet = setup_long_characteristic_value_packet(GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT, gatt_client->con_handle, descriptor_handle, value_offset, blob, blob_length);
|
||||
uint8_t * packet = setup_long_characteristic_value_packet(gatt_client,
|
||||
GATT_EVENT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT,
|
||||
descriptor_handle, value_offset,
|
||||
blob, blob_length);
|
||||
emit_event_new(gatt_client->callback, packet, blob_length + LONG_CHARACTERISTIC_VALUE_EVENT_HEADER_SIZE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user