mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-27 19:28:47 +00:00
feat(core): ble: expose allow/reject pairing in micropython
[no changelog]
This commit is contained in:
parent
3c405602b0
commit
88706d12f8
@ -169,6 +169,28 @@ STATIC mp_obj_t mod_trezorio_BLE_peer_count(void) {
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorio_BLE_peer_count_obj,
|
||||
mod_trezorio_BLE_peer_count);
|
||||
|
||||
/// def allow_pairing() -> bool:
|
||||
/// """
|
||||
/// Accept BLE pairing request
|
||||
/// """
|
||||
STATIC mp_obj_t mod_trezorio_BLE_allow_pairing() {
|
||||
ble_command_t cmd = {.cmd_type = BLE_ALLOW_PAIRING, .data_len = 0};
|
||||
return mp_obj_new_bool(ble_issue_command(&cmd));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorio_BLE_allow_pairing_obj,
|
||||
mod_trezorio_BLE_allow_pairing);
|
||||
|
||||
/// def reject_pairing() -> bool:
|
||||
/// """
|
||||
/// Reject BLE pairing request
|
||||
/// """
|
||||
STATIC mp_obj_t mod_trezorio_BLE_reject_pairing(void) {
|
||||
ble_command_t cmd = {.cmd_type = BLE_REJECT_PAIRING, .data_len = 0};
|
||||
return mp_obj_new_bool(ble_issue_command(&cmd));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorio_BLE_reject_pairing_obj,
|
||||
mod_trezorio_BLE_reject_pairing);
|
||||
|
||||
/// class BleInterface:
|
||||
/// """
|
||||
/// BLE interface wrapper.
|
||||
@ -302,6 +324,10 @@ STATIC const mp_rom_map_elem_t mod_trezorio_BLE_globals_table[] = {
|
||||
MP_ROM_PTR(&mod_trezorio_BLE_disconnect_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_peer_count),
|
||||
MP_ROM_PTR(&mod_trezorio_BLE_peer_count_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_allow_pairing),
|
||||
MP_ROM_PTR(&mod_trezorio_BLE_allow_pairing_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_reject_pairing),
|
||||
MP_ROM_PTR(&mod_trezorio_BLE_reject_pairing_obj)},
|
||||
{MP_ROM_QSTR(MP_QSTR_BleInterface),
|
||||
MP_ROM_PTR(&mod_trezorio_BleInterface_type)},
|
||||
};
|
||||
|
@ -44,6 +44,20 @@ def peer_count() -> int:
|
||||
"""
|
||||
|
||||
|
||||
# upymod/modtrezorio/modtrezorio-ble.h
|
||||
def allow_pairing() -> bool:
|
||||
"""
|
||||
Accept BLE pairing request
|
||||
"""
|
||||
|
||||
|
||||
# upymod/modtrezorio/modtrezorio-ble.h
|
||||
def reject_pairing() -> bool:
|
||||
"""
|
||||
Reject BLE pairing request
|
||||
"""
|
||||
|
||||
|
||||
# upymod/modtrezorio/modtrezorio-ble.h
|
||||
class BleInterface:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user