mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-27 15:35:30 +00:00
baseband connection accepted
This commit is contained in:
parent
1f7b95a184
commit
37eaa4cf13
@ -118,7 +118,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
|
|||||||
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {
|
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_local_name) ) {
|
||||||
bt_send_cmd(&hci_write_authentication_enable, 0);
|
bt_send_cmd(&hci_write_authentication_enable, 0);
|
||||||
}
|
}
|
||||||
|
if ( COMMAND_COMPLETE_EVENT(packet, hci_write_authentication_enable) ) {
|
||||||
|
bt_send_cmd(&hci_write_class_of_device, 0x2580);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// other event
|
// other event
|
||||||
break;
|
break;
|
||||||
|
22
src/hci.c
22
src/hci.c
@ -188,15 +188,21 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HCI_EVENT_CONNECTION_REQUEST:
|
case HCI_EVENT_CONNECTION_REQUEST:
|
||||||
bt_flip_addr(addr, &packet[5]);
|
bt_flip_addr(addr, &packet[2]);
|
||||||
printf("Connection_incoming: "); print_bd_addr(addr); printf("\n");
|
// TODO: eval COD 8-10
|
||||||
conn = connection_for_address(addr);
|
uint8_t link_type = packet[11];
|
||||||
if (!conn) {
|
printf("Connection_incoming: "); print_bd_addr(addr); printf(", type %u\n", link_type);
|
||||||
conn = create_connection_for_addr(addr);
|
if (link_type == 1) { // ACL
|
||||||
|
conn = connection_for_address(addr);
|
||||||
|
if (!conn) {
|
||||||
|
conn = create_connection_for_addr(addr);
|
||||||
|
}
|
||||||
|
// TODO: check for malloc failure
|
||||||
|
conn->state = ACCEPTED_CONNECTION_REQUEST;
|
||||||
|
hci_send_cmd(&hci_accept_connection_request, addr, 1);
|
||||||
|
} else {
|
||||||
|
// TODO: decline request
|
||||||
}
|
}
|
||||||
// TODO: check for malloc failure
|
|
||||||
conn->state = ACCEPTED_CONNECTION_REQUEST;
|
|
||||||
hci_send_cmd(&hci_accept_connection_request, 1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCI_EVENT_CONNECTION_COMPLETE:
|
case HCI_EVENT_CONNECTION_COMPLETE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user