daemon: add commands for gap_pin_code_response_binary and gap_pin_code_negative

This commit is contained in:
Matthias Ringwald 2021-07-21 15:53:43 +02:00
parent 91c8d67dea
commit bb2a499a75
4 changed files with 38 additions and 1 deletions

View File

@ -255,6 +255,11 @@ static int loggingEnabled;
static const char * btstack_server_storage_path;
// GAP command buffer
#ifdef ENABLE_CLASSIC
static uint8_t daemon_gap_pin_code[16];
#endif
// TLV
static int tlv_setup_done;
static const btstack_tlv_t * tlv_impl;
@ -1162,6 +1167,15 @@ static int btstack_command_handler(connection_t *connection, uint8_t *packet, ui
case GAP_DELETE_ALL_LINK_KEYS:
gap_delete_all_link_keys();
break;
case GAP_PIN_CODE_RESPONSE:
reverse_bd_addr(&packet[3], addr);
memcpy(daemon_gap_pin_code, &packet[10], 16);
gap_pin_code_response_binary(addr, daemon_gap_pin_code, packet[9]);
break;
case GAP_PIN_CODE_NEGATIVE:
reverse_bd_addr(&packet[3], addr);
gap_pin_code_negative(addr);
break;
#endif
#ifdef ENABLE_BLE
case GAP_LE_SCAN_START:

View File

@ -306,9 +306,26 @@ const hci_cmd_t gap_drop_link_key_cmd = {
/**
*/
const hci_cmd_t gap_delete_all_link_keys_cmd = {
DAEMON_OPCODE_GAP_DELETE_ALL_LINK_KEYS, ""
DAEMON_OPCODE_GAP_DELETE_ALL_LINK_KEYS, ""
};
/**
* @param bd_addr
* @param pin_length
* @param pin (c-string)
*/
const hci_cmd_t gap_pin_code_response_cmd = {
DAEMON_OPCODE_GAP_PIN_CODE_RESPONSE, "B1P"
};
/**
* @param bd_addr
*/
const hci_cmd_t gap_pin_code_negative_cmd = {
DAEMON_OPCODE_GAP_PIN_CODE_NEGATIVE, "B"
};
/**
*/
const hci_cmd_t gap_le_scan_start = {

View File

@ -90,6 +90,8 @@ typedef enum {
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_PIN_CODE_RESPONSE = DAEMON_OPCODE(GAP_PIN_CODE_RESPONSE),
DAEMON_OPCODE_GAP_PIN_CODE_NEGATIVE = DAEMON_OPCODE(GAP_PIN_CODE_NEGATIVE),
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),
@ -170,6 +172,8 @@ 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_pin_code_response_cmd;
extern const hci_cmd_t gap_pin_code_response_cmd;
extern const hci_cmd_t gap_le_scan_start;
extern const hci_cmd_t gap_le_scan_stop;

View File

@ -214,6 +214,8 @@ typedef uint8_t sm_key_t[16];
#define GAP_REMOTE_NAME_REQUEST 0x53
#define GAP_DROP_LINK_KEY_FOR_BD_ADDR 0x54
#define GAP_DELETE_ALL_LINK_KEYS 0x55
#define GAP_PIN_CODE_RESPONSE 0x56
#define GAP_PIN_CODE_NEGATIVE 0x57
// GAP LE 0x60
#define GAP_LE_SCAN_START 0x60