uint8_t (*get_ble_resolving_list_max_size)(void);
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
+ uint8_t *(*get_local_supported_codecs)(uint8_t *number_of_codecs);
} controller_t;
const controller_t *controller_get_interface();
#define MAX_FEATURES_CLASSIC_PAGE_COUNT 3
#define BLE_SUPPORTED_STATES_SIZE 8
#define BLE_SUPPORTED_FEATURES_SIZE 8
+#define MAX_LOCAL_SUPPORTED_CODECS_SIZE 8
static const hci_t *hci;
static const hci_packet_factory_t *packet_factory;
static uint8_t ble_supported_states[BLE_SUPPORTED_STATES_SIZE];
static bt_device_features_t features_ble;
static uint16_t ble_suggested_default_data_length;
+static uint8_t local_supported_codecs[MAX_LOCAL_SUPPORTED_CODECS_SIZE];
+static uint8_t number_of_local_supported_codecs = 0;
static bool readable;
static bool ble_supported;
packet_parser->parse_generic_command_complete(response);
}
+ // read local supported codecs
+ if(HCI_READ_LOCAL_CODECS_SUPPORTED(supported_commands)) {
+ response = AWAIT_COMMAND(packet_factory->make_read_local_supported_codecs());
+ packet_parser->parse_read_local_supported_codecs_response(
+ response,
+ &number_of_local_supported_codecs, local_supported_codecs);
+ }
+
readable = true;
return future_new_immediate(FUTURE_SUCCESS);
}
return last_features_classic_page_index;
}
+static uint8_t *get_local_supported_codecs(uint8_t *number_of_codecs) {
+ assert(readable);
+ if(number_of_local_supported_codecs) {
+ *number_of_codecs = number_of_local_supported_codecs;
+ return local_supported_codecs;
+ }
+ return NULL;
+}
+
static const bt_device_features_t *get_features_ble(void) {
assert(readable);
assert(ble_supported);
get_ble_white_list_size,
get_ble_resolving_list_max_size,
- set_ble_resolving_list_max_size
+ set_ble_resolving_list_max_size,
+ get_local_supported_codecs
};
const controller_t *controller_get_interface() {
BT_HDR *(*make_ble_read_resolving_list_size)(void);
BT_HDR *(*make_ble_read_suggested_default_data_length)(void);
BT_HDR *(*make_ble_set_event_mask)(const bt_event_mask_t *event_mask);
+ BT_HDR *(*make_read_local_supported_codecs)(void);
} hci_packet_factory_t;
const hci_packet_factory_t *hci_packet_factory_get_interface();
BT_HDR *response,
uint16_t *ble_default_packet_length_ptr
);
+
+ void (*parse_read_local_supported_codecs_response)(
+ BT_HDR *response,
+ uint8_t *number_of_local_supported_codecs, uint8_t *local_supported_codecs);
+
} hci_packet_parser_t;
const hci_packet_parser_t *hci_packet_parser_get_interface();
return make_command_no_params(HCI_BLE_READ_DEFAULT_DATA_LENGTH);
}
+static BT_HDR *make_read_local_supported_codecs(void) {
+ return make_command_no_params(HCI_READ_LOCAL_SUPPORTED_CODECS);
+}
+
static BT_HDR *make_ble_set_event_mask(const bt_event_mask_t *event_mask) {
uint8_t *stream;
uint8_t parameter_size = sizeof(bt_event_mask_t);
make_ble_read_local_supported_features,
make_ble_read_resolving_list_size,
make_ble_read_suggested_default_data_length,
- make_ble_set_event_mask
+ make_ble_set_event_mask,
+ make_read_local_supported_codecs
};
const hci_packet_factory_t *hci_packet_factory_get_interface() {
buffer_allocator->free(response);
}
+static void parse_read_local_supported_codecs_response(
+ BT_HDR *response,
+ uint8_t *number_of_local_supported_codecs, uint8_t *local_supported_codecs) {
+
+ uint8_t *stream = read_command_complete_header(response, HCI_READ_LOCAL_SUPPORTED_CODECS, 0 /* bytes after */);
+ if(stream) {
+ STREAM_TO_UINT8(*number_of_local_supported_codecs, stream);
+ for ( uint8_t i = 0; i < *number_of_local_supported_codecs; i++)
+ {
+ STREAM_TO_UINT8(*local_supported_codecs, stream);
+ local_supported_codecs++;
+ }
+ }
+
+ buffer_allocator->free(response);
+}
+
static void parse_read_bd_addr_response(
BT_HDR *response,
bt_bdaddr_t *address_ptr) {
// Assume the next field is the status field
STREAM_TO_UINT8(status, stream);
- if (status != HCI_SUCCESS)
+ if (status != HCI_SUCCESS){
+ LOG_ERROR("%s: return status - 0x%x", __func__, status);
return NULL;
+ }
return stream;
}
parse_ble_read_supported_states_response,
parse_ble_read_local_supported_features_response,
parse_ble_read_resolving_list_size_response,
- parse_ble_read_suggested_default_data_length_response
+ parse_ble_read_suggested_default_data_length_response,
+ parse_read_local_supported_codecs_response
};
const hci_packet_parser_t *hci_packet_parser_get_interface() {