mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-21 12:51:03 +00:00
driver: pairing cancel
This commit is contained in:
parent
aef254c92f
commit
a754ed0280
@ -44,6 +44,7 @@ typedef enum {
|
|||||||
BLE_CONNECTED = 1, // Connected to a device
|
BLE_CONNECTED = 1, // Connected to a device
|
||||||
BLE_DISCONNECTED = 2, // Disconnected from a device
|
BLE_DISCONNECTED = 2, // Disconnected from a device
|
||||||
BLE_PAIRING_REQUEST = 3, // Pairing request received
|
BLE_PAIRING_REQUEST = 3, // Pairing request received
|
||||||
|
BLE_PAIRING_CANCELLED = 4, // Pairing was cancelled by host
|
||||||
} ble_event_type_t;
|
} ble_event_type_t;
|
||||||
|
|
||||||
typedef struct {
|
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);
|
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) {
|
static void ble_process_rx_msg(const uint8_t *data, uint32_t len) {
|
||||||
switch (data[0]) {
|
switch (data[0]) {
|
||||||
case INTERNAL_EVENT_STATUS:
|
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:
|
case INTERNAL_EVENT_PAIRING_REQUEST:
|
||||||
ble_process_rx_msg_pairing_request(data, len);
|
ble_process_rx_msg_pairing_request(data, len);
|
||||||
break;
|
break;
|
||||||
|
case INTERNAL_EVENT_PAIRING_CANCELLED:
|
||||||
|
ble_process_rx_msg_pairing_cancelled(data, len);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ typedef struct {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
INTERNAL_EVENT_STATUS = 0x01,
|
INTERNAL_EVENT_STATUS = 0x01,
|
||||||
INTERNAL_EVENT_PAIRING_REQUEST = 0x04,
|
INTERNAL_EVENT_PAIRING_REQUEST = 0x04,
|
||||||
|
INTERNAL_EVENT_PAIRING_CANCELLED = 0x05,
|
||||||
} InternalEvent_t;
|
} InternalEvent_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
Loading…
Reference in New Issue
Block a user