query local supported features during HCI setup

This commit is contained in:
matthias.ringwald@gmail.com 2013-03-07 16:32:49 +00:00
parent 941fd279e0
commit 559e517e9c
2 changed files with 17 additions and 3 deletions

View File

@ -450,6 +450,14 @@ static void event_handler(uint8_t *packet, int size){
if (COMMAND_COMPLETE_EVENT(packet, hci_write_scan_enable)){
hci_emit_discoverable_enabled(hci_stack.discoverable);
}
if (COMMAND_COMPLETE_EVENT(packet, hci_read_local_supported_features)){
memcpy(hci_stack.local_supported_features, &packet[OFFSET_OF_DATA_IN_COMMAND_COMPLETE], 8);
log_info("Local Supported Features: 0x%02x%02x%02x%02x%02x%02x%02x%02x",
hci_stack.local_supported_features[0], hci_stack.local_supported_features[1],
hci_stack.local_supported_features[2], hci_stack.local_supported_features[3],
hci_stack.local_supported_features[4], hci_stack.local_supported_features[5],
hci_stack.local_supported_features[6], hci_stack.local_supported_features[7]);
}
break;
case HCI_EVENT_COMMAND_STATUS:
@ -1122,6 +1130,9 @@ void hci_run(){
hci_send_cmd(&hci_write_scan_enable, (hci_stack.connectable << 1) | hci_stack.discoverable); // page scan
break;
case 7:
hci_send_cmd(&hci_read_local_supported_features);
break;
case 8:
#ifndef EMBEDDED
{
char hostname[30];
@ -1130,12 +1141,12 @@ void hci_run(){
hci_send_cmd(&hci_write_local_name, hostname);
break;
}
case 8:
case 9:
#ifdef USE_BLUETOOL
hci_send_cmd(&hci_write_class_of_device, 0x007a020c); // Smartphone
break;
case 9:
case 10:
#endif
#endif
// done.

View File

@ -278,6 +278,9 @@ typedef struct {
uint8_t total_num_acl_packets;
uint16_t acl_data_packet_length;
/* local supported features */
uint8_t local_supported_features[8];
// usable packet types given acl_data_packet_length and HCI_ACL_BUFFER_SIZE
uint16_t packet_types;
@ -357,7 +360,7 @@ void hci_register_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *p
// Requests the change of BTstack power mode.
int hci_power_control(HCI_POWER_MODE mode);
// Allows to control if device is dicoverable. OFF by default.
// Allows to control if device is discoverable. OFF by default.
void hci_discoverable_control(uint8_t enable);
// Creates and sends hci command packets based on a template and