mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 15:44:32 +00:00
replace le_command_status_t with regular Bluetooth uint8_t error codes, add le_command_status_t enums to error list
This commit is contained in:
parent
e6e81fa083
commit
616edd56bc
@ -102,7 +102,7 @@ void loop(void){
|
||||
if (sendCounter){
|
||||
sprintf(counterString, "BTstack %u\n", counter);
|
||||
int result = myBLEDevice.writeCharacteristicWithoutResponse(&characteristics[charTX].characteristic, (uint8_t*) counterString, strlen(counterString) );
|
||||
if (result == BLE_PERIPHERAL_OK){
|
||||
if (result == 0){
|
||||
Serial.print("Wrote without response: ");
|
||||
Serial.println(counterString);
|
||||
counter++;
|
||||
|
@ -217,14 +217,14 @@ int gatt_client_is_ready(uint16_t handle){
|
||||
return is_ready(context);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_get_mtu(uint16_t handle, uint16_t * mtu){
|
||||
uint8_t gatt_client_get_mtu(uint16_t handle, uint16_t * mtu){
|
||||
gatt_client_t * context = provide_context_for_conn_handle(handle);
|
||||
if (context && context->mtu_state == MTU_EXCHANGED){
|
||||
*mtu = context->mtu;
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
*mtu = ATT_DEFAULT_MTU;
|
||||
return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
return GATT_CLIENT_IN_WRONG_STATE;
|
||||
}
|
||||
|
||||
// precondition: can_send_packet_now == TRUE
|
||||
@ -1390,11 +1390,11 @@ static void att_signed_write_handle_cmac_result(uint8_t hash[8]){
|
||||
}
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_signed_write_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message){
|
||||
uint8_t gatt_client_signed_write_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle(con_handle);
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
peripheral->le_device_index = sm_le_device_index(con_handle);
|
||||
if (peripheral->le_device_index < 0) return BLE_PERIPHERAL_IN_WRONG_STATE; // device lookup not done / no stored bonding information
|
||||
if (peripheral->le_device_index < 0) return GATT_CLIENT_IN_WRONG_STATE; // device lookup not done / no stored bonding information
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = handle;
|
||||
@ -1403,13 +1403,13 @@ le_command_status_t gatt_client_signed_write_without_response(uint16_t gatt_clie
|
||||
peripheral->gatt_client_state = P_W4_CMAC_READY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_discover_primary_services(uint16_t gatt_client_id, uint16_t con_handle){
|
||||
uint8_t gatt_client_discover_primary_services(uint16_t gatt_client_id, uint16_t con_handle){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = 0x0001;
|
||||
@ -1417,15 +1417,15 @@ le_command_status_t gatt_client_discover_primary_services(uint16_t gatt_client_i
|
||||
peripheral->gatt_client_state = P_W2_SEND_SERVICE_QUERY;
|
||||
peripheral->uuid16 = 0;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
le_command_status_t gatt_client_discover_primary_services_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t uuid16){
|
||||
uint8_t gatt_client_discover_primary_services_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t uuid16){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = 0x0001;
|
||||
@ -1434,14 +1434,14 @@ le_command_status_t gatt_client_discover_primary_services_by_uuid16(uint16_t gat
|
||||
peripheral->uuid16 = uuid16;
|
||||
sdp_normalize_uuid((uint8_t*) &(peripheral->uuid128), peripheral->uuid16);
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_discover_primary_services_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, const uint8_t * uuid128){
|
||||
uint8_t gatt_client_discover_primary_services_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, const uint8_t * uuid128){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = 0x0001;
|
||||
@ -1450,14 +1450,14 @@ le_command_status_t gatt_client_discover_primary_services_by_uuid128(uint16_t ga
|
||||
memcpy(peripheral->uuid128, uuid128, 16);
|
||||
peripheral->gatt_client_state = P_W2_SEND_SERVICE_WITH_UUID_QUERY;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_discover_characteristics_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service){
|
||||
uint8_t gatt_client_discover_characteristics_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = service->start_group_handle;
|
||||
@ -1466,14 +1466,14 @@ le_command_status_t gatt_client_discover_characteristics_for_service(uint16_t ga
|
||||
peripheral->characteristic_start_handle = 0;
|
||||
peripheral->gatt_client_state = P_W2_SEND_ALL_CHARACTERISTICS_OF_SERVICE_QUERY;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_find_included_services_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service){
|
||||
uint8_t gatt_client_find_included_services_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = service->start_group_handle;
|
||||
@ -1481,14 +1481,14 @@ le_command_status_t gatt_client_find_included_services_for_service(uint16_t gatt
|
||||
peripheral->gatt_client_state = P_W2_SEND_INCLUDED_SERVICE_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uuid16(uint16_t gatt_client_id, 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_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = start_handle;
|
||||
@ -1500,14 +1500,14 @@ le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uui
|
||||
peripheral->gatt_client_state = P_W2_SEND_CHARACTERISTIC_WITH_UUID_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128){
|
||||
uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = start_handle;
|
||||
@ -1519,27 +1519,27 @@ le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uui
|
||||
peripheral->gatt_client_state = P_W2_SEND_CHARACTERISTIC_WITH_UUID_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
le_command_status_t gatt_client_discover_characteristics_for_service_by_uuid16(uint16_t gatt_client_id, uint16_t handle, le_service_t *service, uint16_t uuid16){
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(uint16_t gatt_client_id, uint16_t handle, le_service_t *service, uint16_t uuid16){
|
||||
return gatt_client_discover_characteristics_for_handle_range_by_uuid16(gatt_client_id, handle, service->start_group_handle, service->end_group_handle, uuid16);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_discover_characteristics_for_service_by_uuid128(uint16_t gatt_client_id, uint16_t handle, le_service_t *service, uint8_t * uuid128){
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(uint16_t gatt_client_id, uint16_t handle, le_service_t *service, uint8_t * uuid128){
|
||||
return gatt_client_discover_characteristics_for_handle_range_by_uuid128(gatt_client_id, handle, service->start_group_handle, service->end_group_handle, uuid128);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_discover_characteristic_descriptors(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic){
|
||||
uint8_t gatt_client_discover_characteristic_descriptors(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
if (characteristic->value_handle == characteristic->end_handle){
|
||||
emit_gatt_complete_event(peripheral, 0);
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = characteristic->value_handle + 1;
|
||||
@ -1547,28 +1547,28 @@ le_command_status_t gatt_client_discover_characteristic_descriptors(uint16_t gat
|
||||
peripheral->gatt_client_state = P_W2_SEND_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY;
|
||||
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle){
|
||||
uint8_t gatt_client_read_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = value_handle;
|
||||
peripheral->attribute_offset = 0;
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_CHARACTERISTIC_VALUE_QUERY;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_value_of_characteristics_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16){
|
||||
uint8_t gatt_client_read_value_of_characteristics_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = start_handle;
|
||||
@ -1579,14 +1579,14 @@ le_command_status_t gatt_client_read_value_of_characteristics_by_uuid16(uint16_t
|
||||
sdp_normalize_uuid((uint8_t*) &(peripheral->uuid128), uuid16);
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_BY_TYPE_REQUEST;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_value_of_characteristics_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128){
|
||||
uint8_t gatt_client_read_value_of_characteristics_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->start_group_handle = start_handle;
|
||||
@ -1597,69 +1597,69 @@ le_command_status_t gatt_client_read_value_of_characteristics_by_uuid128(uint16_
|
||||
memcpy(peripheral->uuid128, uuid128, 16);
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_BY_TYPE_REQUEST;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
le_command_status_t gatt_client_read_value_of_characteristic(uint16_t gatt_client_id, uint16_t handle, le_characteristic_t *characteristic){
|
||||
uint8_t gatt_client_read_value_of_characteristic(uint16_t gatt_client_id, uint16_t handle, le_characteristic_t *characteristic){
|
||||
return gatt_client_read_value_of_characteristic_using_value_handle(gatt_client_id, handle, characteristic->value_handle);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset){
|
||||
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = characteristic_value_handle;
|
||||
peripheral->attribute_offset = offset;
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_BLOB_QUERY;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle){
|
||||
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle){
|
||||
return gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(gatt_client_id, con_handle, characteristic_value_handle, 0);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t handle, le_characteristic_t *characteristic){
|
||||
uint8_t gatt_client_read_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t handle, le_characteristic_t *characteristic){
|
||||
return gatt_client_read_long_value_of_characteristic_using_value_handle(gatt_client_id, handle, characteristic->value_handle);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_multiple_characteristic_values(uint16_t gatt_client_id, uint16_t con_handle, int num_value_handles, uint16_t * value_handles){
|
||||
uint8_t gatt_client_read_multiple_characteristic_values(uint16_t gatt_client_id, uint16_t con_handle, int num_value_handles, uint16_t * value_handles){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->read_multiple_handle_count = num_value_handles;
|
||||
peripheral->read_multiple_handles = value_handles;
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_MULTIPLE_REQUEST;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_value_of_characteristic_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){
|
||||
uint8_t gatt_client_write_value_of_characteristic_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
if (value_length > peripheral_mtu(peripheral) - 3) return BLE_VALUE_TOO_LONG;
|
||||
if (!l2cap_can_send_fixed_channel_packet_now(peripheral->handle)) return BLE_PERIPHERAL_BUSY;
|
||||
if (value_length > peripheral_mtu(peripheral) - 3) return GATT_CLIENT_VALUE_TOO_LONG;
|
||||
if (!l2cap_can_send_fixed_channel_packet_now(peripheral->handle)) return GATT_CLIENT_BUSY;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
att_write_request(ATT_WRITE_COMMAND, peripheral->handle, value_handle, value_length, value);
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * data){
|
||||
uint8_t gatt_client_write_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * data){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = value_handle;
|
||||
@ -1667,14 +1667,14 @@ le_command_status_t gatt_client_write_value_of_characteristic(uint16_t gatt_clie
|
||||
peripheral->attribute_value = data;
|
||||
peripheral->gatt_client_state = P_W2_SEND_WRITE_CHARACTERISTIC_VALUE;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_long_value_of_characteristic_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t offset, uint16_t value_length, uint8_t * data){
|
||||
uint8_t gatt_client_write_long_value_of_characteristic_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t offset, uint16_t value_length, uint8_t * data){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = value_handle;
|
||||
@ -1683,18 +1683,18 @@ le_command_status_t gatt_client_write_long_value_of_characteristic_with_offset(u
|
||||
peripheral->attribute_value = data;
|
||||
peripheral->gatt_client_state = P_W2_PREPARE_WRITE;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){
|
||||
uint8_t gatt_client_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){
|
||||
return gatt_client_write_long_value_of_characteristic_with_offset(gatt_client_id, con_handle, value_handle, 0, value_length, value);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_reliable_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){
|
||||
uint8_t gatt_client_reliable_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = value_handle;
|
||||
@ -1703,23 +1703,23 @@ le_command_status_t gatt_client_reliable_write_long_value_of_characteristic(uint
|
||||
peripheral->attribute_value = value;
|
||||
peripheral->gatt_client_state = P_W2_PREPARE_RELIABLE_WRITE;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_client_characteristic_configuration(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration){
|
||||
uint8_t gatt_client_write_client_characteristic_configuration(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
if ( (configuration & GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION) &&
|
||||
(characteristic->properties & ATT_PROPERTY_NOTIFY) == 0) {
|
||||
log_info("le_central_write_client_characteristic_configuration: BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED");
|
||||
return BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED;
|
||||
log_info("le_central_write_client_characteristic_configuration: GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED");
|
||||
return GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED;
|
||||
} else if ( (configuration & GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_INDICATION) &&
|
||||
(characteristic->properties & ATT_PROPERTY_INDICATE) == 0){
|
||||
log_info("le_central_write_client_characteristic_configuration: BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED");
|
||||
return BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED;
|
||||
log_info("le_central_write_client_characteristic_configuration: GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED");
|
||||
return GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
@ -1729,54 +1729,54 @@ le_command_status_t gatt_client_write_client_characteristic_configuration(uint16
|
||||
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_CLIENT_CHARACTERISTIC_CONFIGURATION_QUERY;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle){
|
||||
uint8_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = descriptor_handle;
|
||||
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_CHARACTERISTIC_DESCRIPTOR_QUERY;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){
|
||||
uint8_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){
|
||||
return gatt_client_read_characteristic_descriptor_using_descriptor_handle(gatt_client_id, con_handle, descriptor->handle);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset){
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = descriptor_handle;
|
||||
peripheral->attribute_offset = offset;
|
||||
peripheral->gatt_client_state = P_W2_SEND_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_QUERY;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle){
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle){
|
||||
return gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(gatt_client_id, con_handle, descriptor_handle, 0);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){
|
||||
return gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(gatt_client_id, con_handle, descriptor->handle);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data){
|
||||
uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = descriptor_handle;
|
||||
@ -1785,18 +1785,18 @@ le_command_status_t gatt_client_write_characteristic_descriptor_using_descriptor
|
||||
peripheral->attribute_value = data;
|
||||
peripheral->gatt_client_state = P_W2_SEND_WRITE_CHARACTERISTIC_DESCRIPTOR;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
uint8_t gatt_client_write_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
return gatt_client_write_characteristic_descriptor_using_descriptor_handle(gatt_client_id, con_handle, descriptor->handle, length, value);
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t * data){
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t * data){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = descriptor_handle;
|
||||
@ -1805,25 +1805,25 @@ le_command_status_t gatt_client_write_long_characteristic_descriptor_using_descr
|
||||
peripheral->attribute_value = data;
|
||||
peripheral->gatt_client_state = P_W2_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, 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(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data){
|
||||
return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(gatt_client_id, con_handle, descriptor_handle, 0, length, data );
|
||||
}
|
||||
|
||||
le_command_status_t gatt_client_write_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){
|
||||
return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(gatt_client_id, con_handle, descriptor->handle, length, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief -> gatt complete event
|
||||
*/
|
||||
le_command_status_t gatt_client_prepare_write(uint16_t gatt_client_id, uint16_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t length, uint8_t * data){
|
||||
uint8_t gatt_client_prepare_write(uint16_t gatt_client_id, uint16_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t length, uint8_t * data){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->attribute_handle = attribute_handle;
|
||||
@ -1832,37 +1832,37 @@ le_command_status_t gatt_client_prepare_write(uint16_t gatt_client_id, uint16_t
|
||||
peripheral->attribute_value = data;
|
||||
peripheral->gatt_client_state = P_W2_PREPARE_WRITE_SINGLE;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief -> gatt complete event
|
||||
*/
|
||||
le_command_status_t gatt_client_execute_write(uint16_t gatt_client_id, uint16_t con_handle){
|
||||
uint8_t gatt_client_execute_write(uint16_t gatt_client_id, uint16_t con_handle){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->gatt_client_state = P_W2_EXECUTE_PREPARED_WRITE;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief -> gatt complete event
|
||||
*/
|
||||
le_command_status_t gatt_client_cancel_write(uint16_t gatt_client_id, uint16_t con_handle){
|
||||
uint8_t gatt_client_cancel_write(uint16_t gatt_client_id, uint16_t con_handle){
|
||||
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);
|
||||
|
||||
if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
if (!peripheral) return BTSTACK_MEMORY_ALLOC_FAILED;
|
||||
if (!is_ready(peripheral)) return GATT_CLIENT_IN_WRONG_STATE;
|
||||
|
||||
peripheral->subclient_id = gatt_client_id;
|
||||
peripheral->gatt_client_state = P_W2_CANCEL_PREPARED_WRITE;
|
||||
gatt_client_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gatt_client_pts_suppress_mtu_exchange(void){
|
||||
|
@ -230,9 +230,9 @@ uint16_t gatt_client_register_packet_handler (gatt_client_callback_t callback);
|
||||
void gatt_client_unregister_packet_handler(uint16_t gatt_client_id);
|
||||
|
||||
/**
|
||||
* @brief MTU is available after the first query has completed. If status is equal to BLE_PERIPHERAL_OK, it returns the real value, otherwise the default value of 23.
|
||||
* @brief MTU is available after the first query has completed. If status is equal to 0, it returns the real value, otherwise the default value of 23.
|
||||
*/
|
||||
le_command_status_t gatt_client_get_mtu(uint16_t handle, uint16_t * mtu);
|
||||
uint8_t gatt_client_get_mtu(uint16_t handle, uint16_t * mtu);
|
||||
|
||||
/**
|
||||
* @brief Returns if the GATT client is ready to receive a query. It is used with daemon.
|
||||
@ -242,126 +242,126 @@ int gatt_client_is_ready(uint16_t handle);
|
||||
/**
|
||||
* @brief Discovers all primary services. For each found service, an le_service_event_t with type set to GATT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
le_command_status_t gatt_client_discover_primary_services(uint16_t gatt_client_id, uint16_t con_handle);
|
||||
uint8_t gatt_client_discover_primary_services(uint16_t gatt_client_id, uint16_t con_handle);
|
||||
|
||||
/**
|
||||
* @brief Discovers a specific primary service given its UUID. This service may exist multiple times. For each found service, an le_service_event_t with type set to GATT_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t, with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
le_command_status_t gatt_client_discover_primary_services_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t uuid16);
|
||||
le_command_status_t gatt_client_discover_primary_services_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, const uint8_t * uuid);
|
||||
uint8_t gatt_client_discover_primary_services_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t uuid16);
|
||||
uint8_t gatt_client_discover_primary_services_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, const uint8_t * uuid);
|
||||
|
||||
/**
|
||||
* @brief Finds included services within the specified service. For each found included service, an le_service_event_t with type set to GATT_INCLUDED_SERVICE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_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.
|
||||
*/
|
||||
le_command_status_t gatt_client_find_included_services_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service);
|
||||
uint8_t gatt_client_find_included_services_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_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_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
le_command_status_t gatt_client_discover_characteristics_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service);
|
||||
uint8_t gatt_client_discover_characteristics_for_service(uint16_t gatt_client_id, uint16_t con_handle, le_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_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
|
||||
le_command_status_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid);
|
||||
le_command_status_t gatt_client_discover_characteristics_for_service_by_uuid16 (uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service, uint16_t uuid16);
|
||||
le_command_status_t gatt_client_discover_characteristics_for_service_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service, uint8_t * uuid128);
|
||||
uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid16(uint16_t gatt_client_id, 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(uint16_t gatt_client_id, 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 (uint16_t gatt_client_id, uint16_t con_handle, le_service_t *service, uint16_t uuid16);
|
||||
uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, le_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_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of discovery.
|
||||
*/
|
||||
le_command_status_t gatt_client_discover_characteristic_descriptors(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_discover_characteristic_descriptors(uint16_t gatt_client_id, uint16_t con_handle, le_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_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
|
||||
*/
|
||||
le_command_status_t gatt_client_read_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
le_command_status_t gatt_client_read_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle);
|
||||
uint8_t gatt_client_read_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_read_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle);
|
||||
|
||||
/**
|
||||
* @brief Reads the characteric value of all characteristics with the uuid. For each found, an le_characteristic_value_event_t with type set to GATT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
|
||||
*/
|
||||
le_command_status_t gatt_client_read_value_of_characteristics_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
|
||||
le_command_status_t gatt_client_read_value_of_characteristics_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128);
|
||||
uint8_t gatt_client_read_value_of_characteristics_by_uuid16(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
|
||||
uint8_t gatt_client_read_value_of_characteristics_by_uuid128(uint16_t gatt_client_id, uint16_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128);
|
||||
|
||||
/**
|
||||
* @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_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_QUERY_COMPLETE, mark the end of read.
|
||||
*/
|
||||
le_command_status_t gatt_client_read_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle);
|
||||
le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset);
|
||||
uint8_t gatt_client_read_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic);
|
||||
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle);
|
||||
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset);
|
||||
|
||||
/*
|
||||
* @brief Read multiple characteristic values
|
||||
* @param number handles
|
||||
* @param list_of_handles list of handles
|
||||
*/
|
||||
le_command_status_t gatt_client_read_multiple_characteristic_values(uint16_t gatt_client_id, uint16_t con_handle, int num_value_handles, uint16_t * value_handles);
|
||||
uint8_t gatt_client_read_multiple_characteristic_values(uint16_t gatt_client_id, uint16_t con_handle, int num_value_handles, uint16_t * value_handles);
|
||||
|
||||
/**
|
||||
* @brief Writes the characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed.
|
||||
*/
|
||||
le_command_status_t gatt_client_write_value_of_characteristic_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_value_of_characteristic_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief Writes the authenticated characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed.
|
||||
*/
|
||||
le_command_status_t gatt_client_signed_write_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message);
|
||||
uint8_t gatt_client_signed_write_without_response(uint16_t gatt_client_id, uint16_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message);
|
||||
|
||||
/**
|
||||
* @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.
|
||||
*/
|
||||
le_command_status_t gatt_client_write_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
le_command_status_t gatt_client_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
le_command_status_t gatt_client_write_long_value_of_characteristic_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_value_of_characteristic_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset, uint16_t length, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief Writes of the long characteristic value using the characteristic's value handle. It uses server response to validate that the write was correctly received. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE marks the end of write. The write is successfully performed, if the event's status field is set to 0.
|
||||
*/
|
||||
le_command_status_t gatt_client_reliable_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_reliable_write_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @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_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
|
||||
*/
|
||||
le_command_status_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
|
||||
le_command_status_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle);
|
||||
uint8_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
|
||||
uint8_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, 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_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
|
||||
*/
|
||||
le_command_status_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
|
||||
le_command_status_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle);
|
||||
le_command_status_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset);
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle);
|
||||
uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, 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_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.
|
||||
*/
|
||||
le_command_status_t gatt_client_write_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
le_command_status_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data);
|
||||
le_command_status_t gatt_client_write_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
le_command_status_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data);
|
||||
le_command_status_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, 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(uint16_t gatt_client_id, 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.
|
||||
*/
|
||||
le_command_status_t gatt_client_write_client_characteristic_configuration(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration);
|
||||
uint8_t gatt_client_write_client_characteristic_configuration(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t * characteristic, uint16_t configuration);
|
||||
|
||||
/**
|
||||
* @brief -> gatt complete event
|
||||
*/
|
||||
le_command_status_t gatt_client_prepare_write(uint16_t gatt_client_id, uint16_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t length, uint8_t * data);
|
||||
uint8_t gatt_client_prepare_write(uint16_t gatt_client_id, uint16_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t length, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief -> gatt complete event
|
||||
*/
|
||||
le_command_status_t gatt_client_execute_write(uint16_t gatt_client_id, uint16_t con_handle);
|
||||
uint8_t gatt_client_execute_write(uint16_t gatt_client_id, uint16_t con_handle);
|
||||
|
||||
/**
|
||||
* @brief -> gatt complete event
|
||||
*/
|
||||
le_command_status_t gatt_client_cancel_write(uint16_t gatt_client_id, uint16_t con_handle);
|
||||
uint8_t gatt_client_cancel_write(uint16_t gatt_client_id, uint16_t con_handle);
|
||||
|
||||
|
||||
/* API_END */
|
||||
|
135
src/bluetooth.h
135
src/bluetooth.h
@ -60,8 +60,8 @@
|
||||
|
||||
// packet header sizes
|
||||
#define HCI_CMD_HEADER_SIZE 3
|
||||
#define HCI_ACL_HEADER_SIZE 4
|
||||
#define HCI_SCO_HEADER_SIZE 3
|
||||
#define HCI_ACL_HEADER_SIZE 4
|
||||
#define HCI_SCO_HEADER_SIZE 3
|
||||
#define HCI_EVENT_HEADER_SIZE 2
|
||||
|
||||
/**
|
||||
@ -73,13 +73,14 @@
|
||||
//
|
||||
|
||||
// from Bluetooth Core Specification
|
||||
#define ERROR_CODE_SUCCESS 0x00
|
||||
#define ERROR_CODE_UNKNOWN_HCI_COMMAND 0x01
|
||||
#define ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02
|
||||
#define ERROR_CODE_HARDWARE_FAILURE 0x03
|
||||
#define ERROR_CODE_PAGE_TIMEOUT 0x04
|
||||
#define ERROR_CODE_AUTHENTICATION_FAILURE 0x05
|
||||
#define ERROR_CODE_AUTHENTICATION_FAILURE 0x05
|
||||
#define ERROR_CODE_PIN_OR_KEY_MISSING 0x06
|
||||
#define ERROR_CODE_MEMORY_CAPACITY_EXCEEDED 0x07
|
||||
#define ERROR_CODE_MEMORY_CAPACITY_EXCEEDED 0x07
|
||||
#define ERROR_CODE_CONNECTION_TIMEOUT 0x08
|
||||
#define ERROR_CODE_CONNECTION_LIMIT_EXCEEDED 0x09
|
||||
#define ERROR_CODE_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED 0x0A
|
||||
@ -451,8 +452,8 @@
|
||||
|
||||
// Fixed PSM numbers
|
||||
#define PSM_SDP 0x01
|
||||
#define PSM_RFCOMM 0x03
|
||||
#define PSM_BNEP 0x0F
|
||||
#define PSM_RFCOMM 0x03
|
||||
#define PSM_BNEP 0x0F
|
||||
#define PSM_HID_CONTROL 0x11
|
||||
#define PSM_HID_INTERRUPT 0x13
|
||||
|
||||
@ -463,13 +464,13 @@
|
||||
// PDU Types
|
||||
typedef enum {
|
||||
SDP_Invalid = 0,
|
||||
SDP_ErrorResponse = 1,
|
||||
SDP_ServiceSearchRequest,
|
||||
SDP_ServiceSearchResponse,
|
||||
SDP_ServiceAttributeRequest,
|
||||
SDP_ServiceAttributeResponse,
|
||||
SDP_ServiceSearchAttributeRequest,
|
||||
SDP_ServiceSearchAttributeResponse
|
||||
SDP_ErrorResponse = 1,
|
||||
SDP_ServiceSearchRequest,
|
||||
SDP_ServiceSearchResponse,
|
||||
SDP_ServiceAttributeRequest,
|
||||
SDP_ServiceAttributeResponse,
|
||||
SDP_ServiceSearchAttributeRequest,
|
||||
SDP_ServiceSearchAttributeResponse
|
||||
} SDP_PDU_ID_t;
|
||||
|
||||
// UNIVERSAL ATTRIBUTE DEFINITIONS
|
||||
@ -478,12 +479,12 @@ typedef enum {
|
||||
#define SDP_ServiceRecordState 0x0002
|
||||
#define SDP_ServiceID 0x0003
|
||||
#define SDP_ProtocolDescriptorList 0x0004
|
||||
#define SDP_BrowseGroupList 0x0005
|
||||
#define SDP_BrowseGroupList 0x0005
|
||||
#define SDP_LanguageBaseAttributeIDList 0x0006
|
||||
#define SDP_ServiceInfoTimeToLive 0x0007
|
||||
#define SDP_ServiceAvailability 0x0008
|
||||
#define SDP_ServiceInfoTimeToLive 0x0007
|
||||
#define SDP_ServiceAvailability 0x0008
|
||||
#define SDP_BluetoothProfileDescriptorList 0x0009
|
||||
#define SDP_DocumentationURL 0x000a
|
||||
#define SDP_DocumentationURL 0x000a
|
||||
#define SDP_ClientExecutableURL 0x000b
|
||||
#define SDP_IconURL 0x000c
|
||||
#define SDP_AdditionalProtocolDescriptorList 0x000d
|
||||
@ -535,7 +536,7 @@ typedef enum {
|
||||
#define BT_RFCOMM_SABM 0x3F // 1 1 1 1 1 1 0 0
|
||||
#define BT_RFCOMM_UA 0x73 // 1 1 0 0 1 1 1 0
|
||||
#define BT_RFCOMM_DM 0x0F // 1 1 1 1 0 0 0 0
|
||||
#define BT_RFCOMM_DM_PF 0x1F // 1 1 1 1 1 0 0 0
|
||||
#define BT_RFCOMM_DM_PF 0x1F // 1 1 1 1 1 0 0 0
|
||||
#define BT_RFCOMM_DISC 0x53 // 1 1 0 0 1 0 1 0
|
||||
#define BT_RFCOMM_UIH 0xEF // 1 1 1 1 0 1 1 1
|
||||
#define BT_RFCOMM_UIH_PF 0xFF // 1 1 1 1 0 1 1 1
|
||||
@ -640,83 +641,83 @@ typedef enum rpn_flow_control {
|
||||
#endif
|
||||
|
||||
#ifndef ETHERTYPE_VLAN
|
||||
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tag */
|
||||
#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tag */
|
||||
#endif
|
||||
|
||||
#define BNEP_MTU_MIN 1691
|
||||
|
||||
#define BNEP_EXT_FLAG 0x80
|
||||
#define BNEP_TYPE_MASK 0x7F
|
||||
#define BNEP_TYPE(header) ((header) & BNEP_TYPE_MASK)
|
||||
#define BNEP_HEADER_HAS_EXT(x) (((x) & BNEP_EXT_FLAG) == BNEP_EXT_FLAG)
|
||||
#define BNEP_TYPE(header) ((header) & BNEP_TYPE_MASK)
|
||||
#define BNEP_HEADER_HAS_EXT(x) (((x) & BNEP_EXT_FLAG) == BNEP_EXT_FLAG)
|
||||
|
||||
/* BNEP packet types */
|
||||
#define BNEP_PKT_TYPE_GENERAL_ETHERNET 0x00
|
||||
#define BNEP_PKT_TYPE_CONTROL 0x01
|
||||
#define BNEP_PKT_TYPE_COMPRESSED_ETHERNET 0x02
|
||||
#define BNEP_PKT_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY 0x03
|
||||
#define BNEP_PKT_TYPE_COMPRESSED_ETHERNET_DEST_ONLY 0x04
|
||||
#define BNEP_PKT_TYPE_GENERAL_ETHERNET 0x00
|
||||
#define BNEP_PKT_TYPE_CONTROL 0x01
|
||||
#define BNEP_PKT_TYPE_COMPRESSED_ETHERNET 0x02
|
||||
#define BNEP_PKT_TYPE_COMPRESSED_ETHERNET_SOURCE_ONLY 0x03
|
||||
#define BNEP_PKT_TYPE_COMPRESSED_ETHERNET_DEST_ONLY 0x04
|
||||
|
||||
/* BNEP control types */
|
||||
#define BNEP_CONTROL_TYPE_COMMAND_NOT_UNDERSTOOD 0x00
|
||||
#define BNEP_CONTROL_TYPE_SETUP_CONNECTION_REQUEST 0x01
|
||||
#define BNEP_CONTROL_TYPE_SETUP_CONNECTION_RESPONSE 0x02
|
||||
#define BNEP_CONTROL_TYPE_FILTER_NET_TYPE_SET 0x03
|
||||
#define BNEP_CONTROL_TYPE_FILTER_NET_TYPE_RESPONSE 0x04
|
||||
#define BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_SET 0x05
|
||||
#define BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_RESPONSE 0x06
|
||||
#define BNEP_CONTROL_TYPE_COMMAND_NOT_UNDERSTOOD 0x00
|
||||
#define BNEP_CONTROL_TYPE_SETUP_CONNECTION_REQUEST 0x01
|
||||
#define BNEP_CONTROL_TYPE_SETUP_CONNECTION_RESPONSE 0x02
|
||||
#define BNEP_CONTROL_TYPE_FILTER_NET_TYPE_SET 0x03
|
||||
#define BNEP_CONTROL_TYPE_FILTER_NET_TYPE_RESPONSE 0x04
|
||||
#define BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_SET 0x05
|
||||
#define BNEP_CONTROL_TYPE_FILTER_MULTI_ADDR_RESPONSE 0x06
|
||||
|
||||
/* BNEP extension header types */
|
||||
#define BNEP_EXT_HEADER_TYPE_EXTENSION_CONTROL 0x00
|
||||
#define BNEP_EXT_HEADER_TYPE_EXTENSION_CONTROL 0x00
|
||||
|
||||
/* BNEP setup response codes */
|
||||
#define BNEP_RESP_SETUP_SUCCESS 0x0000
|
||||
#define BNEP_RESP_SETUP_INVALID_DEST_UUID 0x0001
|
||||
#define BNEP_RESP_SETUP_INVALID_SOURCE_UUID 0x0002
|
||||
#define BNEP_RESP_SETUP_INVALID_SERVICE_UUID_SIZE 0x0003
|
||||
#define BNEP_RESP_SETUP_CONNECTION_NOT_ALLOWED 0x0004
|
||||
#define BNEP_RESP_SETUP_SUCCESS 0x0000
|
||||
#define BNEP_RESP_SETUP_INVALID_DEST_UUID 0x0001
|
||||
#define BNEP_RESP_SETUP_INVALID_SOURCE_UUID 0x0002
|
||||
#define BNEP_RESP_SETUP_INVALID_SERVICE_UUID_SIZE 0x0003
|
||||
#define BNEP_RESP_SETUP_CONNECTION_NOT_ALLOWED 0x0004
|
||||
|
||||
/* BNEP filter response codes */
|
||||
#define BNEP_RESP_FILTER_SUCCESS 0x0000
|
||||
#define BNEP_RESP_FILTER_UNSUPPORTED_REQUEST 0x0001
|
||||
#define BNEP_RESP_FILTER_ERR_INVALID_RANGE 0x0002
|
||||
#define BNEP_RESP_FILTER_ERR_TOO_MANY_FILTERS 0x0003
|
||||
#define BNEP_RESP_FILTER_ERR_SECURITY 0x0004
|
||||
#define BNEP_RESP_FILTER_SUCCESS 0x0000
|
||||
#define BNEP_RESP_FILTER_UNSUPPORTED_REQUEST 0x0001
|
||||
#define BNEP_RESP_FILTER_ERR_INVALID_RANGE 0x0002
|
||||
#define BNEP_RESP_FILTER_ERR_TOO_MANY_FILTERS 0x0003
|
||||
#define BNEP_RESP_FILTER_ERR_SECURITY 0x0004
|
||||
|
||||
/**
|
||||
* PAN Profile
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
PANU_UUID = 0x1115,
|
||||
NAP_UUID = 0x1116,
|
||||
GN_UUID = 0x1117
|
||||
PANU_UUID = 0x1115,
|
||||
NAP_UUID = 0x1116,
|
||||
GN_UUID = 0x1117
|
||||
} bnep_service_uuid_t;
|
||||
|
||||
typedef enum {
|
||||
BNEP_SECURITY_NONE = 0x0000,
|
||||
BNEP_SECURITY_SERVICE_LEVEL_ENFORCED,
|
||||
BNEP_SECURITY_802_1X
|
||||
BNEP_SECURITY_NONE = 0x0000,
|
||||
BNEP_SECURITY_SERVICE_LEVEL_ENFORCED,
|
||||
BNEP_SECURITY_802_1X
|
||||
} security_description_t;
|
||||
|
||||
typedef enum {
|
||||
PAN_NET_ACCESS_TYPE_PSTN = 0x0000,
|
||||
PAN_NET_ACCESS_TYPE_ISDN,
|
||||
PAN_NET_ACCESS_TYPE_DSL,
|
||||
PAN_NET_ACCESS_TYPE_CABLE_MODEM,
|
||||
PAN_NET_ACCESS_TYPE_10MB_ETHERNET,
|
||||
PAN_NET_ACCESS_TYPE_100MB_ETHERNET,
|
||||
PAN_NET_ACCESS_TYPE_4MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_16MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_100MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_FDDI,
|
||||
PAN_NET_ACCESS_TYPE_GSM,
|
||||
PAN_NET_ACCESS_TYPE_CDMA,
|
||||
PAN_NET_ACCESS_TYPE_GPRS,
|
||||
PAN_NET_ACCESS_TYPE_3G,
|
||||
PAN_NET_ACCESS_TYPE_CELULAR,
|
||||
PAN_NET_ACCESS_TYPE_OTHER = 0xFFFE,
|
||||
PAN_NET_ACCESS_TYPE_NONE
|
||||
PAN_NET_ACCESS_TYPE_PSTN = 0x0000,
|
||||
PAN_NET_ACCESS_TYPE_ISDN,
|
||||
PAN_NET_ACCESS_TYPE_DSL,
|
||||
PAN_NET_ACCESS_TYPE_CABLE_MODEM,
|
||||
PAN_NET_ACCESS_TYPE_10MB_ETHERNET,
|
||||
PAN_NET_ACCESS_TYPE_100MB_ETHERNET,
|
||||
PAN_NET_ACCESS_TYPE_4MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_16MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_100MB_TOKEN_RING,
|
||||
PAN_NET_ACCESS_TYPE_FDDI,
|
||||
PAN_NET_ACCESS_TYPE_GSM,
|
||||
PAN_NET_ACCESS_TYPE_CDMA,
|
||||
PAN_NET_ACCESS_TYPE_GPRS,
|
||||
PAN_NET_ACCESS_TYPE_3G,
|
||||
PAN_NET_ACCESS_TYPE_CELULAR,
|
||||
PAN_NET_ACCESS_TYPE_OTHER = 0xFFFE,
|
||||
PAN_NET_ACCESS_TYPE_NONE
|
||||
} net_access_type_t;
|
||||
|
||||
/**
|
||||
|
@ -116,22 +116,16 @@
|
||||
|
||||
#define GATT_CLIENT_NOT_CONNECTED 0x93
|
||||
#define GATT_CLIENT_BUSY 0x94
|
||||
#define GATT_CLIENT_IN_WRONG_STATE 0x95
|
||||
#define GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS 0x96
|
||||
#define GATT_CLIENT_VALUE_TOO_LONG 0x97
|
||||
#define GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED 0x98
|
||||
#define GATT_CLIENT_CHARACTERISTIC_INDICATION_NOT_SUPPORTED 0x99
|
||||
|
||||
#define BNEP_SERVICE_ALREADY_REGISTERED 0xA0
|
||||
#define BNEP_CHANNEL_NOT_CONNECTED 0xA1
|
||||
#define BNEP_DATA_LEN_EXCEEDS_MTU 0xA2
|
||||
|
||||
typedef enum {
|
||||
BLE_PERIPHERAL_OK = 0xA0,
|
||||
BLE_PERIPHERAL_IN_WRONG_STATE,
|
||||
BLE_PERIPHERAL_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS,
|
||||
BLE_PERIPHERAL_NOT_CONNECTED,
|
||||
BLE_VALUE_TOO_LONG,
|
||||
BLE_PERIPHERAL_BUSY,
|
||||
BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED,
|
||||
BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED
|
||||
} le_command_status_t;
|
||||
|
||||
// COMMANDS
|
||||
|
||||
#define OGF_BTSTACK 0x3d
|
||||
|
32
src/hci.c
32
src/hci.c
@ -3032,18 +3032,18 @@ void gap_set_local_name(const char * local_name){
|
||||
hci_stack->local_name = local_name;
|
||||
}
|
||||
|
||||
le_command_status_t le_central_start_scan(void){
|
||||
if (hci_stack->le_scanning_state == LE_SCANNING) return BLE_PERIPHERAL_OK;
|
||||
uint8_t le_central_start_scan(void){
|
||||
if (hci_stack->le_scanning_state == LE_SCANNING) return 0;
|
||||
hci_stack->le_scanning_state = LE_START_SCAN;
|
||||
hci_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t le_central_stop_scan(void){
|
||||
if ( hci_stack->le_scanning_state == LE_SCAN_IDLE) return BLE_PERIPHERAL_OK;
|
||||
uint8_t le_central_stop_scan(void){
|
||||
if ( hci_stack->le_scanning_state == LE_SCAN_IDLE) return 0;
|
||||
hci_stack->le_scanning_state = LE_STOP_SCAN;
|
||||
hci_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void le_central_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window){
|
||||
@ -3053,7 +3053,7 @@ void le_central_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, u
|
||||
hci_run();
|
||||
}
|
||||
|
||||
le_command_status_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type){
|
||||
uint8_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type){
|
||||
hci_connection_t * conn = hci_connection_for_bd_addr_and_type(addr, addr_type);
|
||||
if (!conn){
|
||||
log_info("le_central_connect: no connection exists yet, creating context");
|
||||
@ -3067,7 +3067,7 @@ le_command_status_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type)
|
||||
conn->state = SEND_CREATE_CONNECTION;
|
||||
log_info("le_central_connect: send create connection next");
|
||||
hci_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!hci_is_le_connection(conn) ||
|
||||
@ -3075,13 +3075,13 @@ le_command_status_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type)
|
||||
conn->state == SENT_CREATE_CONNECTION) {
|
||||
hci_emit_le_connection_complete(conn->address_type, conn->address, 0, ERROR_CODE_COMMAND_DISALLOWED);
|
||||
log_error("le_central_connect: classic connection or connect is already being created");
|
||||
return BLE_PERIPHERAL_IN_WRONG_STATE;
|
||||
return GATT_CLIENT_IN_WRONG_STATE;
|
||||
}
|
||||
|
||||
log_info("le_central_connect: context exists with state %u", conn->state);
|
||||
hci_emit_le_connection_complete(conn->address_type, conn->address, conn->con_handle, 0);
|
||||
hci_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// @assumption: only a single outgoing LE Connection exists
|
||||
@ -3101,9 +3101,9 @@ static hci_connection_t * le_central_get_outgoing_connection(void){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
le_command_status_t le_central_connect_cancel(void){
|
||||
uint8_t le_central_connect_cancel(void){
|
||||
hci_connection_t * conn = le_central_get_outgoing_connection();
|
||||
if (!conn) return BLE_PERIPHERAL_OK;
|
||||
if (!conn) return 0;
|
||||
switch (conn->state){
|
||||
case SEND_CREATE_CONNECTION:
|
||||
// skip sending create connection and emit event instead
|
||||
@ -3119,7 +3119,7 @@ le_command_status_t le_central_connect_cancel(void){
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3233,15 +3233,15 @@ void gap_advertisements_enable(int enabled){
|
||||
}
|
||||
|
||||
|
||||
le_command_status_t gap_disconnect(hci_con_handle_t handle){
|
||||
uint8_t gap_disconnect(hci_con_handle_t handle){
|
||||
hci_connection_t * conn = hci_connection_for_handle(handle);
|
||||
if (!conn){
|
||||
hci_emit_disconnection_complete(handle, 0);
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
conn->state = SEND_DISCONNECT;
|
||||
hci_run();
|
||||
return BLE_PERIPHERAL_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
12
src/hci.h
12
src/hci.h
@ -718,12 +718,12 @@ void gap_le_set_connection_parameter_range(le_connection_parameter_range_t range
|
||||
|
||||
/* LE Client Start */
|
||||
|
||||
le_command_status_t le_central_start_scan(void);
|
||||
le_command_status_t le_central_stop_scan(void);
|
||||
le_command_status_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type);
|
||||
le_command_status_t le_central_connect_cancel(void);
|
||||
le_command_status_t gap_disconnect(hci_con_handle_t handle);
|
||||
void le_central_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window);
|
||||
uint8_t le_central_start_scan(void);
|
||||
uint8_t le_central_stop_scan(void);
|
||||
uint8_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type);
|
||||
uint8_t le_central_connect_cancel(void);
|
||||
uint8_t gap_disconnect(hci_con_handle_t handle);
|
||||
void le_central_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window);
|
||||
|
||||
/* LE Client End */
|
||||
|
||||
|
@ -276,23 +276,23 @@ extern "C" uint16_t att_read_callback(uint16_t handle, uint16_t attribute_handle
|
||||
return 0;
|
||||
}
|
||||
|
||||
// static const char * decode_status(le_command_status_t status){
|
||||
// static const char * decode_status(uint8_t status){
|
||||
// switch (status){
|
||||
// case BLE_PERIPHERAL_OK: return "BLE_PERIPHERAL_OK";
|
||||
// case BLE_PERIPHERAL_IN_WRONG_STATE: return "BLE_PERIPHERAL_IN_WRONG_STATE";
|
||||
// case BLE_PERIPHERAL_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS: return "BLE_PERIPHERAL_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS";
|
||||
// case BLE_PERIPHERAL_NOT_CONNECTED: return "BLE_PERIPHERAL_NOT_CONNECTED";
|
||||
// case BLE_VALUE_TOO_LONG: return "BLE_VALUE_TOO_LONG";
|
||||
// case BLE_PERIPHERAL_BUSY: return "BLE_PERIPHERAL_BUSY";
|
||||
// case BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED: return "BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED";
|
||||
// case BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED: return "BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED";
|
||||
// case 0: return "0";
|
||||
// case GATT_CLIENT_IN_WRONG_STATE: return "GATT_CLIENT_IN_WRONG_STATE";
|
||||
// case GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS: return "GATT_CLIENT_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS";
|
||||
// case GATT_CLIENT_NOT_CONNECTED: return "GATT_CLIENT_NOT_CONNECTED";
|
||||
// case GATT_CLIENT_VALUE_TOO_LONG: return "GATT_CLIENT_VALUE_TOO_LONG";
|
||||
// case GATT_CLIENT_BUSY: return "GATT_CLIENT_BUSY";
|
||||
// case GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED: return "GATT_CLIENT_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED";
|
||||
// case GATT_CLIENTCHARACTERISTIC_INDICATION_NOT_SUPPORTED: return "GATT_CLIENTCHARACTERISTIC_INDICATION_NOT_SUPPORTED";
|
||||
// }
|
||||
// }
|
||||
|
||||
TEST_GROUP(GATTClient){
|
||||
int acl_buffer_size;
|
||||
uint8_t acl_buffer[27];
|
||||
le_command_status_t status;
|
||||
uint8_t status;
|
||||
|
||||
void setup(void){
|
||||
result_counter = 0;
|
||||
@ -312,7 +312,7 @@ TEST(GATTClient, TestDiscoverPrimaryServices){
|
||||
test = DISCOVER_PRIMARY_SERVICES;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services(gatt_client_id, gatt_client_handle);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
verify_primary_services();
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
@ -322,7 +322,7 @@ TEST(GATTClient, TestDiscoverPrimaryServicesByUUID16){
|
||||
test = DISCOVER_PRIMARY_SERVICE_WITH_UUID16;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
verify_primary_services_with_uuid16();
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
@ -331,7 +331,7 @@ TEST(GATTClient, TestDiscoverPrimaryServicesByUUID16){
|
||||
TEST(GATTClient, TestDiscoverPrimaryServicesByUUID128){
|
||||
test = DISCOVER_PRIMARY_SERVICE_WITH_UUID128;
|
||||
status = gatt_client_discover_primary_services_by_uuid128(gatt_client_id, gatt_client_handle, primary_service_uuid128);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
verify_primary_services_with_uuid128();
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
@ -341,12 +341,12 @@ TEST(GATTClient, TestFindIncludedServicesForServiceWithUUID16){
|
||||
test = DISCOVER_INCLUDED_SERVICE_FOR_SERVICE_WITH_UUID16;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_find_included_services_for_service(gatt_client_id, gatt_client_handle, &services[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
verify_included_services_uuid16();
|
||||
}
|
||||
@ -355,12 +355,12 @@ TEST(GATTClient, TestFindIncludedServicesForServiceWithUUID128){
|
||||
test = DISCOVER_INCLUDED_SERVICE_FOR_SERVICE_WITH_UUID128;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid128(gatt_client_id, gatt_client_handle, primary_service_uuid128);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_find_included_services_for_service(gatt_client_id, gatt_client_handle, &services[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
verify_included_services_uuid128();
|
||||
}
|
||||
@ -369,12 +369,12 @@ TEST(GATTClient, TestDiscoverCharacteristicsForService){
|
||||
test = DISCOVER_CHARACTERISTICS_FOR_SERVICE_WITH_UUID16;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service(gatt_client_id, gatt_client_handle, &services[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
verify_charasteristics();
|
||||
}
|
||||
@ -383,7 +383,7 @@ TEST(GATTClient, TestDiscoverCharacteristicsByUUID16){
|
||||
test = DISCOVER_CHARACTERISTICS_BY_UUID16;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_handle_range_by_uuid16(gatt_client_id, gatt_client_handle, 0x30, 0x32, 0xF102);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
}
|
||||
@ -392,7 +392,7 @@ TEST(GATTClient, TestDiscoverCharacteristicsByUUID128){
|
||||
test = DISCOVER_CHARACTERISTICS_BY_UUID128;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_handle_range_by_uuid128(gatt_client_id, gatt_client_handle, characteristic_handles[1][0], characteristic_handles[1][1], characteristic_uuids[1]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
}
|
||||
@ -401,20 +401,20 @@ TEST(GATTClient, TestDiscoverCharacteristics4ServiceByUUID128){
|
||||
test = DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid128(gatt_client_id, gatt_client_handle, primary_service_uuid128);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
uint8_t characteristic_uuid[] = {0x00, 0x00, 0xF2, 0x01, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid128(gatt_client_id, gatt_client_handle, &services[0], characteristic_uuid);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF200);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
}
|
||||
@ -423,20 +423,20 @@ TEST(GATTClient, TestDiscoverCharacteristics4ServiceByUUID16){
|
||||
test = DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
uint8_t characteristic_uuid[]= { 0x00, 0x00, 0xF1, 0x05, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid128(gatt_client_id, gatt_client_handle, &services[0], characteristic_uuid);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
}
|
||||
@ -445,19 +445,19 @@ TEST(GATTClient, TestDiscoverCharacteristicDescriptor){
|
||||
test = DISCOVER_CHARACTERISTIC_DESCRIPTORS;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristic_descriptors(gatt_client_id, gatt_client_handle, &characteristics[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK(result_counter);
|
||||
CHECK_EQUAL(3, result_index);
|
||||
@ -470,19 +470,19 @@ TEST(GATTClient, TestWriteClientCharacteristicConfiguration){
|
||||
test = WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_write_client_characteristic_configuration(gatt_client_id, gatt_client_handle, &characteristics[0], GATT_CLIENT_CHARACTERISTICS_CONFIGURATION_NOTIFICATION);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
}
|
||||
@ -491,25 +491,25 @@ TEST(GATTClient, TestReadCharacteristicDescriptor){
|
||||
test = READ_CHARACTERISTIC_DESCRIPTOR;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristic_descriptors(gatt_client_id, gatt_client_handle, &characteristics[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 3);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_read_characteristic_descriptor(gatt_client_id, gatt_client_handle, &descriptors[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 3);
|
||||
}
|
||||
@ -518,19 +518,19 @@ TEST(GATTClient, TestReadCharacteristicValue){
|
||||
test = READ_CHARACTERISTIC_VALUE;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_read_value_of_characteristic(gatt_client_id, gatt_client_handle, &characteristics[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 3);
|
||||
}
|
||||
@ -539,19 +539,19 @@ TEST(GATTClient, TestWriteCharacteristicValue){
|
||||
test = WRITE_CHARACTERISTIC_VALUE;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_write_value_of_characteristic(gatt_client_id, gatt_client_handle, characteristics[0].value_handle, short_value_length, (uint8_t*)short_value);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
}
|
||||
|
||||
@ -559,25 +559,25 @@ TEST(GATTClient, TestWriteCharacteristicDescriptor){
|
||||
test = WRITE_CHARACTERISTIC_DESCRIPTOR;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristic_descriptors(gatt_client_id, gatt_client_handle, &characteristics[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 3);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_write_characteristic_descriptor(gatt_client_id, gatt_client_handle, &descriptors[0], sizeof(indication), indication);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
}
|
||||
|
||||
@ -585,19 +585,19 @@ TEST(GATTClient, TestReadLongCharacteristicValue){
|
||||
test = READ_LONG_CHARACTERISTIC_VALUE;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_read_long_value_of_characteristic(gatt_client_id, gatt_client_handle, &characteristics[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 7);
|
||||
}
|
||||
@ -606,26 +606,26 @@ TEST(GATTClient, TestReadLongCharacteristicDescriptor){
|
||||
test = READ_LONG_CHARACTERISTIC_DESCRIPTOR;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid128(gatt_client_id, gatt_client_handle, primary_service_uuid128);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF200);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristic_descriptors(gatt_client_id, gatt_client_handle, &characteristics[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 3);
|
||||
|
||||
reset_query_state();
|
||||
result_counter = 0;
|
||||
status = gatt_client_read_long_characteristic_descriptor(gatt_client_id, gatt_client_handle, &descriptors[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 7);
|
||||
}
|
||||
@ -635,25 +635,25 @@ TEST(GATTClient, TestWriteLongCharacteristicDescriptor){
|
||||
test = WRITE_LONG_CHARACTERISTIC_DESCRIPTOR;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid128(gatt_client_id, gatt_client_handle, primary_service_uuid128);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF200);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristic_descriptors(gatt_client_id, gatt_client_handle, &characteristics[0]);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 3);
|
||||
|
||||
result_counter = 0;
|
||||
status = gatt_client_write_long_characteristic_descriptor(gatt_client_id, gatt_client_handle, &descriptors[0], sizeof(long_value), (uint8_t *)long_value);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
}
|
||||
@ -662,20 +662,20 @@ TEST(GATTClient, TestWriteLongCharacteristicValue){
|
||||
test = WRITE_LONG_CHARACTERISTIC_VALUE;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_write_long_value_of_characteristic(gatt_client_id, gatt_client_handle, characteristics[0].value_handle, long_value_length, (uint8_t*)long_value);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
}
|
||||
|
||||
@ -683,19 +683,19 @@ TEST(GATTClient, TestWriteReliableLongCharacteristicValue){
|
||||
test = WRITE_RELIABLE_LONG_CHARACTERISTIC_VALUE;
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_primary_services_by_uuid16(gatt_client_id, gatt_client_handle, service_uuid16);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_discover_characteristics_for_service_by_uuid16(gatt_client_id, gatt_client_handle, &services[0], 0xF100);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
CHECK_EQUAL(result_counter, 1);
|
||||
|
||||
reset_query_state();
|
||||
status = gatt_client_reliable_write_long_value_of_characteristic(gatt_client_id, gatt_client_handle, characteristics[0].value_handle, long_value_length, (uint8_t*)long_value);
|
||||
CHECK_EQUAL(status, BLE_PERIPHERAL_OK);
|
||||
CHECK_EQUAL(status, 0);
|
||||
CHECK_EQUAL(gatt_query_complete, 1);
|
||||
}
|
||||
|
||||
|
@ -43,14 +43,14 @@ void mock_simulate_scan_response(void){
|
||||
registered_l2cap_packet_handler(HCI_EVENT_PACKET, NULL, (uint8_t *)&packet, sizeof(packet));
|
||||
}
|
||||
|
||||
le_command_status_t le_central_start_scan(void){
|
||||
return BLE_PERIPHERAL_OK;
|
||||
uint8_t le_central_start_scan(void){
|
||||
return 0;
|
||||
}
|
||||
le_command_status_t le_central_stop_scan(void){
|
||||
return BLE_PERIPHERAL_OK;
|
||||
uint8_t le_central_stop_scan(void){
|
||||
return 0;
|
||||
}
|
||||
le_command_status_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type){
|
||||
return BLE_PERIPHERAL_OK;
|
||||
uint8_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type){
|
||||
return 0;
|
||||
}
|
||||
void le_central_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window){
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user