1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-05 23:58:46 +00:00

chore(python): update ble to session-based

This commit is contained in:
M1nd3r 2025-04-03 18:41:11 +02:00
parent e4088ad90e
commit 648cf93c0a
2 changed files with 8 additions and 10 deletions

View File

@ -1,19 +1,17 @@
import typing as t import typing as t
from . import messages from . import messages
from .tools import session
if t.TYPE_CHECKING: if t.TYPE_CHECKING:
from ..client import TrezorClient from .transport.session import Session
@session
def unpair( def unpair(
client: "TrezorClient", session: "Session",
all: bool, all: bool,
): ):
resp = client.call(messages.BleUnpair(all=all)) resp = session.call(messages.BleUnpair(all=all))
if isinstance(resp, messages.Success): if isinstance(resp, messages.Success):
return return

View File

@ -20,10 +20,10 @@ from typing import TYPE_CHECKING
import click import click
from .. import ble, exceptions from .. import ble, exceptions
from . import with_client from . import with_session
if TYPE_CHECKING: if TYPE_CHECKING:
from ..client import TrezorClient from ..transport.session import Session
@click.group(name="ble") @click.group(name="ble")
@ -38,15 +38,15 @@ def cli() -> None:
help="Erase all bonds.", help="Erase all bonds.",
is_flag=True, is_flag=True,
) )
@with_client @with_session(seedless=True)
def unpair( def unpair(
client: "TrezorClient", session: "Session",
all: bool, all: bool,
) -> None: ) -> None:
"""Erase bond of currently connected device, or all devices (on device side)""" """Erase bond of currently connected device, or all devices (on device side)"""
try: try:
ble.unpair(client, all) ble.unpair(session, all)
click.echo("Unpair successful.") click.echo("Unpair successful.")
except exceptions.Cancelled: except exceptions.Cancelled:
click.echo("Unpair cancelled on device.") click.echo("Unpair cancelled on device.")