mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-21 04:41:18 +00:00
driver: pairing cancel
This commit is contained in:
parent
aef254c92f
commit
a754ed0280
@ -40,10 +40,11 @@ typedef enum {
|
||||
} ble_command_t;
|
||||
|
||||
typedef enum {
|
||||
BLE_NONE = 0, // No event
|
||||
BLE_CONNECTED = 1, // Connected to a device
|
||||
BLE_DISCONNECTED = 2, // Disconnected from a device
|
||||
BLE_PAIRING_REQUEST = 3, // Pairing request received
|
||||
BLE_NONE = 0, // No event
|
||||
BLE_CONNECTED = 1, // Connected to a device
|
||||
BLE_DISCONNECTED = 2, // Disconnected from a device
|
||||
BLE_PAIRING_REQUEST = 3, // Pairing request received
|
||||
BLE_PAIRING_CANCELLED = 4, // Pairing was cancelled by host
|
||||
} ble_event_type_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -191,6 +191,17 @@ static void ble_process_rx_msg_pairing_request(const uint8_t *data,
|
||||
tsqueue_insert(&drv->event_queue, (uint8_t *)&event, sizeof(event), NULL);
|
||||
}
|
||||
|
||||
static void ble_process_rx_msg_pairing_cancelled(const uint8_t *data,
|
||||
uint32_t len) {
|
||||
ble_driver_t *drv = &g_ble_driver;
|
||||
if (!drv->initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
ble_event_t event = {.type = BLE_PAIRING_CANCELLED, .data_len = 0};
|
||||
tsqueue_insert(&drv->event_queue, (uint8_t *)&event, sizeof(event), NULL);
|
||||
}
|
||||
|
||||
static void ble_process_rx_msg(const uint8_t *data, uint32_t len) {
|
||||
switch (data[0]) {
|
||||
case INTERNAL_EVENT_STATUS:
|
||||
@ -199,6 +210,9 @@ static void ble_process_rx_msg(const uint8_t *data, uint32_t len) {
|
||||
case INTERNAL_EVENT_PAIRING_REQUEST:
|
||||
ble_process_rx_msg_pairing_request(data, len);
|
||||
break;
|
||||
case INTERNAL_EVENT_PAIRING_CANCELLED:
|
||||
ble_process_rx_msg_pairing_cancelled(data, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ typedef struct {
|
||||
typedef enum {
|
||||
INTERNAL_EVENT_STATUS = 0x01,
|
||||
INTERNAL_EVENT_PAIRING_REQUEST = 0x04,
|
||||
INTERNAL_EVENT_PAIRING_CANCELLED = 0x05,
|
||||
} InternalEvent_t;
|
||||
|
||||
typedef enum {
|
||||
|
Loading…
Reference in New Issue
Block a user