mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-01 00:28:18 +00:00
deamon: add commands for classic inquiry and drop link key
This commit is contained in:
parent
ac973fd6f4
commit
a512b22891
@ -976,6 +976,7 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
hci_power_control(HCI_POWER_OFF);
|
||||
}
|
||||
break;
|
||||
#ifdef ENABLE_CLASSIC
|
||||
case L2CAP_CREATE_CHANNEL_MTU:
|
||||
reverse_bd_addr(&packet[3], addr);
|
||||
psm = little_endian_read_16(packet, 9);
|
||||
@ -1138,6 +1139,30 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
|
||||
sdp_client_query(&handle_sdp_client_query_result, addr, (uint8_t*)&serviceSearchPattern[0], (uint8_t*)&attributeIDList[0]);
|
||||
break;
|
||||
#endif
|
||||
case GAP_DISCONNECT:
|
||||
handle = little_endian_read_16(packet, 3);
|
||||
gap_disconnect(handle);
|
||||
break;
|
||||
#ifdef ENABLE_CLASSIC
|
||||
case GAP_INQUIRY_START:
|
||||
gap_inquiry_start(packet[3]);
|
||||
break;
|
||||
case GAP_INQUIRY_STOP:
|
||||
gap_inquiry_stop();
|
||||
break;
|
||||
case GAP_REMOTE_NAME_REQUEST:
|
||||
reverse_bd_addr(&packet[3], addr);
|
||||
gap_remote_name_request(addr, packet[9], little_endian_read_16(packet, 10));
|
||||
break;
|
||||
case GAP_DROP_LINK_KEY_FOR_BD_ADDR:
|
||||
reverse_bd_addr(&packet[3], addr);
|
||||
gap_drop_link_key_for_bd_addr(addr);
|
||||
break;
|
||||
case GAP_DELETE_ALL_LINK_KEYS:
|
||||
gap_delete_all_link_keys();
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_BLE
|
||||
case GAP_LE_SCAN_START:
|
||||
gap_start_scan();
|
||||
@ -1156,10 +1181,6 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
|
||||
case GAP_LE_CONNECT_CANCEL:
|
||||
gap_connect_cancel();
|
||||
break;
|
||||
case GAP_DISCONNECT:
|
||||
handle = little_endian_read_16(packet, 3);
|
||||
gap_disconnect(handle);
|
||||
break;
|
||||
#endif
|
||||
#if defined(HAVE_MALLOC) && defined(ENABLE_BLE)
|
||||
case GATT_DISCOVER_ALL_PRIMARY_SERVICES:
|
||||
@ -1966,6 +1987,9 @@ static void btstack_server_configure_stack(void){
|
||||
gap_ssp_set_enable(0);
|
||||
#endif
|
||||
|
||||
// enabled EIR
|
||||
hci_set_inquiry_mode(INQUIRY_MODE_RSSI_AND_EIR);
|
||||
|
||||
// register for HCI events
|
||||
hci_event_callback_registration.callback = &stack_packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
@ -274,6 +274,41 @@ const hci_cmd_t gap_disconnect_cmd = {
|
||||
DAEMON_OPCODE_GAP_DISCONNECT, "H"
|
||||
};
|
||||
|
||||
/**
|
||||
* @param duration in 1.28s units
|
||||
*/
|
||||
const hci_cmd_t gap_inquiry_start_cmd = {
|
||||
DAEMON_OPCODE_GAP_INQUIRY_START, "1"
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
const hci_cmd_t gap_inquiry_stop_cmd = {
|
||||
DAEMON_OPCODE_GAP_INQUIRY_STOP, ""
|
||||
};
|
||||
|
||||
/**
|
||||
* @param addr
|
||||
* @param page_scan_repetition_mode
|
||||
* @param clock_offset only used when bit 15 is set - pass 0 if not known
|
||||
*/
|
||||
const hci_cmd_t gap_remote_name_request_cmd = {
|
||||
DAEMON_OPCODE_GAP_REMOTE_NAME_REQUEST, "B12"
|
||||
};
|
||||
|
||||
/**
|
||||
* @param addr
|
||||
*/
|
||||
const hci_cmd_t gap_drop_link_key_cmd = {
|
||||
DAEMON_OPCODE_GAP_DROP_LINK_KEY_FOR_BD_ADDR, "B"
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
const hci_cmd_t gap_delete_all_link_keys_cmd = {
|
||||
DAEMON_OPCODE_GAP_DELETE_ALL_LINK_KEYS, ""
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
const hci_cmd_t gap_le_scan_start = {
|
||||
|
@ -85,6 +85,11 @@ typedef enum {
|
||||
DAEMON_OPCODE_RFCOMM_DECLINE_CONNECTION = DAEMON_OPCODE(RFCOMM_DECLINE_CONNECTION),
|
||||
DAEMON_OPCODE_RFCOMM_PERSISTENT_CHANNEL_FOR_SERVICE = DAEMON_OPCODE(RFCOMM_PERSISTENT_CHANNEL),
|
||||
DAEMON_OPCODE_GAP_DISCONNECT = DAEMON_OPCODE(GAP_DISCONNECT),
|
||||
DAEMON_OPCODE_GAP_INQUIRY_START = DAEMON_OPCODE(GAP_INQUIRY_START),
|
||||
DAEMON_OPCODE_GAP_INQUIRY_STOP = DAEMON_OPCODE(GAP_INQUIRY_STOP),
|
||||
DAEMON_OPCODE_GAP_REMOTE_NAME_REQUEST = DAEMON_OPCODE(GAP_REMOTE_NAME_REQUEST),
|
||||
DAEMON_OPCODE_GAP_DROP_LINK_KEY_FOR_BD_ADDR = DAEMON_OPCODE(GAP_DROP_LINK_KEY_FOR_BD_ADDR),
|
||||
DAEMON_OPCODE_GAP_DELETE_ALL_LINK_KEYS = DAEMON_OPCODE(GAP_DELETE_ALL_LINK_KEYS),
|
||||
DAEMON_OPCODE_GAP_LE_SCAN_START = DAEMON_OPCODE(GAP_LE_SCAN_START),
|
||||
DAEMON_OPCODE_GAP_LE_SCAN_STOP = DAEMON_OPCODE(GAP_LE_SCAN_STOP),
|
||||
DAEMON_OPCODE_GAP_LE_SET_SCAN_PARAMETERS = DAEMON_OPCODE(GAP_LE_SET_SCAN_PARAMETERS),
|
||||
@ -159,7 +164,13 @@ extern const hci_cmd_t rfcomm_unregister_service_cmd;
|
||||
extern const hci_cmd_t rfcomm_persistent_channel_for_service_cmd;
|
||||
extern const hci_cmd_t rfcomm_grants_credits_cmd;
|
||||
|
||||
extern const hci_cmd_t gap_delete_all_link_keys_cmd;
|
||||
extern const hci_cmd_t gap_disconnect_cmd;
|
||||
extern const hci_cmd_t gap_drop_link_key_for_bd_addr_cmd;
|
||||
extern const hci_cmd_t gap_inquiry_start_cmd;
|
||||
extern const hci_cmd_t gap_inquiry_stop_cmd;
|
||||
extern const hci_cmd_t gap_remote_name_request_cmd;
|
||||
|
||||
extern const hci_cmd_t gap_le_scan_start;
|
||||
extern const hci_cmd_t gap_le_scan_stop;
|
||||
extern const hci_cmd_t gap_le_set_scan_parameters;
|
||||
|
@ -208,9 +208,14 @@ typedef uint8_t sm_key_t[16];
|
||||
#define RFCOMM_GRANT_CREDITS 0x49
|
||||
|
||||
// GAP Classic 0x50
|
||||
#define GAP_DISCONNECT 0x50
|
||||
#define GAP_DISCONNECT 0x50
|
||||
#define GAP_INQUIRY_START 0x51
|
||||
#define GAP_INQUIRY_STOP 0x52
|
||||
#define GAP_REMOTE_NAME_REQUEST 0x53
|
||||
#define GAP_DROP_LINK_KEY_FOR_BD_ADDR 0x54
|
||||
#define GAP_DELETE_ALL_LINK_KEYS 0x55
|
||||
|
||||
// GAP LE 0x60
|
||||
// GAP LE 0x60
|
||||
#define GAP_LE_SCAN_START 0x60
|
||||
#define GAP_LE_SCAN_STOP 0x61
|
||||
#define GAP_LE_CONNECT 0x62
|
||||
|
Loading…
Reference in New Issue
Block a user