Change to error int

This commit is contained in:
Jesse Hills 2022-09-28 12:15:28 +13:00
parent 0c5d109951
commit 869ba8c977
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
3 changed files with 4 additions and 7 deletions

View File

@ -1187,7 +1187,7 @@ message BluetoothDeviceConnectionResponse {
uint64 address = 1;
bool connected = 2;
uint32 mtu = 3;
bool failed = 4;
int error = 4;
}
message BluetoothGATTGetServicesRequest {

View File

@ -446,8 +446,7 @@ class APIClient:
async def bluetooth_device_connect(
self,
address: int,
on_bluetooth_connection_state: Callable[[bool, int], None],
on_bluetooth_connection_failed: Callable[[], None],
on_bluetooth_connection_state: Callable[[bool, int, int], None],
timeout: float = 10.0,
) -> Callable[[], None]:
self._check_authenticated()
@ -458,9 +457,7 @@ class APIClient:
if isinstance(msg, BluetoothDeviceConnectionResponse):
resp = BluetoothDeviceConnection.from_pb(msg)
if address == resp.address:
on_bluetooth_connection_state(resp.connected, resp.mtu)
if resp.failed:
on_bluetooth_connection_failed()
on_bluetooth_connection_state(resp.connected, resp.mtu, resp.error)
assert self._connection is not None
await self._connection.send_message_callback_response(

View File

@ -804,7 +804,7 @@ class BluetoothDeviceConnection(APIModelBase):
address: int = 0
connected: bool = False
mtu: int = 0
failed: bool = False
error: int = 0
@dataclass(frozen=True)