hci.c (4536712cf537b30280a15f1dc44cb8a2e738510b) | hci.c (891b9fc2698ee1660239b66b4ecf3d9c2affaae8) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 1902 unchanged lines hidden (view full) --- 1911 hci_stack->acl_packets_total_num = little_endian_read_16(packet, 9); 1912 hci_stack->sco_packets_total_num = little_endian_read_16(packet, 11); 1913 1914 log_info("hci_read_buffer_size: ACL size module %u -> used %u, count %u / SCO size %u, count %u", 1915 acl_len, hci_stack->acl_data_packet_length, hci_stack->acl_packets_total_num, 1916 hci_stack->sco_data_packet_length, hci_stack->sco_packets_total_num); 1917 } 1918 } | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 1902 unchanged lines hidden (view full) --- 1911 hci_stack->acl_packets_total_num = little_endian_read_16(packet, 9); 1912 hci_stack->sco_packets_total_num = little_endian_read_16(packet, 11); 1913 1914 log_info("hci_read_buffer_size: ACL size module %u -> used %u, count %u / SCO size %u, count %u", 1915 acl_len, hci_stack->acl_data_packet_length, hci_stack->acl_packets_total_num, 1916 hci_stack->sco_data_packet_length, hci_stack->sco_packets_total_num); 1917 } 1918 } |
1919 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_read_rssi)){ 1920 if (packet[5] == 0){ 1921 uint8_t event[5]; 1922 event[0] = GAP_EVENT_RSSI_MEASUREMENT; 1923 event[1] = 3; 1924 memcpy(&event[2], &packet[6], 3); 1925 hci_emit_event(event, sizeof(event), 1); 1926 } 1927 } |
|
1919#ifdef ENABLE_BLE 1920 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_read_buffer_size)){ 1921 hci_stack->le_data_packets_length = little_endian_read_16(packet, 6); 1922 hci_stack->le_acl_packets_total_num = packet[8]; 1923 // determine usable ACL payload size 1924 if (HCI_ACL_PAYLOAD_SIZE < hci_stack->le_data_packets_length){ 1925 hci_stack->le_data_packets_length = HCI_ACL_PAYLOAD_SIZE; 1926 } --- 1649 unchanged lines hidden (view full) --- 3576 3577 default: 3578 break; 3579 } 3580 3581 // no further commands if connection is about to get shut down 3582 if (connection->state == SENT_DISCONNECT) continue; 3583 | 1928#ifdef ENABLE_BLE 1929 if (HCI_EVENT_IS_COMMAND_COMPLETE(packet, hci_le_read_buffer_size)){ 1930 hci_stack->le_data_packets_length = little_endian_read_16(packet, 6); 1931 hci_stack->le_acl_packets_total_num = packet[8]; 1932 // determine usable ACL payload size 1933 if (HCI_ACL_PAYLOAD_SIZE < hci_stack->le_data_packets_length){ 1934 hci_stack->le_data_packets_length = HCI_ACL_PAYLOAD_SIZE; 1935 } --- 1649 unchanged lines hidden (view full) --- 3585 3586 default: 3587 break; 3588 } 3589 3590 // no further commands if connection is about to get shut down 3591 if (connection->state == SENT_DISCONNECT) continue; 3592 |
3593 if (connection->authentication_flags & READ_RSSI){ 3594 connectionClearAuthenticationFlags(connection, READ_RSSI); 3595 hci_send_cmd(&hci_read_rssi, connection->con_handle); 3596 return; 3597 } 3598 |
|
3584#ifdef ENABLE_CLASSIC 3585 if (connection->authentication_flags & HANDLE_LINK_KEY_REQUEST){ 3586 log_info("responding to link key request"); 3587 connectionClearAuthenticationFlags(connection, HANDLE_LINK_KEY_REQUEST); 3588 link_key_t link_key; 3589 link_key_type_t link_key_type; 3590 if ( hci_stack->link_key_db 3591 && hci_stack->link_key_db->get_link_key(connection->address, link_key, &link_key_type) --- 1360 unchanged lines hidden (view full) --- 4952 memcpy(hci_stack->remote_name_addr, addr, 6); 4953 hci_stack->remote_name_page_scan_repetition_mode = page_scan_repetition_mode; 4954 hci_stack->remote_name_clock_offset = clock_offset; 4955 hci_stack->remote_name_state = GAP_REMOTE_NAME_STATE_W2_SEND; 4956 hci_run(); 4957 return 0; 4958} 4959 | 3599#ifdef ENABLE_CLASSIC 3600 if (connection->authentication_flags & HANDLE_LINK_KEY_REQUEST){ 3601 log_info("responding to link key request"); 3602 connectionClearAuthenticationFlags(connection, HANDLE_LINK_KEY_REQUEST); 3603 link_key_t link_key; 3604 link_key_type_t link_key_type; 3605 if ( hci_stack->link_key_db 3606 && hci_stack->link_key_db->get_link_key(connection->address, link_key, &link_key_type) --- 1360 unchanged lines hidden (view full) --- 4967 memcpy(hci_stack->remote_name_addr, addr, 6); 4968 hci_stack->remote_name_page_scan_repetition_mode = page_scan_repetition_mode; 4969 hci_stack->remote_name_clock_offset = clock_offset; 4970 hci_stack->remote_name_state = GAP_REMOTE_NAME_STATE_W2_SEND; 4971 hci_run(); 4972 return 0; 4973} 4974 |
4975int gap_read_rssi(hci_con_handle_t con_handle){ 4976 hci_connection_t * hci_connection = hci_connection_for_handle(con_handle); 4977 if (hci_connection == NULL) return 0; 4978 connectionSetAuthenticationFlags(hci_connection, READ_RSSI); 4979 hci_run(); 4980 return 1; 4981} 4982 |
|
4960static int gap_pairing_set_state_and_run(bd_addr_t addr, uint8_t state){ 4961 hci_stack->gap_pairing_state = state; 4962 memcpy(hci_stack->gap_pairing_addr, addr, 6); 4963 hci_run(); 4964 return 0; 4965} 4966 4967/** --- 286 unchanged lines hidden --- | 4983static int gap_pairing_set_state_and_run(bd_addr_t addr, uint8_t state){ 4984 hci_stack->gap_pairing_state = state; 4985 memcpy(hci_stack->gap_pairing_addr, addr, 6); 4986 hci_run(); 4987 return 0; 4988} 4989 4990/** --- 286 unchanged lines hidden --- |