Fix bytes

This commit is contained in:
Jesse Hills 2022-09-28 15:32:22 +13:00
parent debc2f1e93
commit a3904aabfd
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
2 changed files with 5 additions and 4 deletions

View File

@ -545,7 +545,7 @@ class APIClient:
req.address = address req.address = address
req.handle = characteristic_handle req.handle = characteristic_handle
req.response = response req.response = response
req.data.extend(list(data)) req.data = data
assert self._connection is not None assert self._connection is not None
await self._connection.send_message(req) await self._connection.send_message(req)
@ -593,7 +593,7 @@ class APIClient:
req = BluetoothGATTWriteDescriptorRequest() req = BluetoothGATTWriteDescriptorRequest()
req.address = address req.address = address
req.handle = handle req.handle = handle
req.data.extend(list(data)) req.data = data
assert self._connection is not None assert self._connection is not None
await self._connection.send_message(req) await self._connection.send_message(req)

View File

@ -771,7 +771,8 @@ def _convert_bluetooth_le_service_data(
) -> Dict[str, bytes]: ) -> Dict[str, bytes]:
if isinstance(value, dict): if isinstance(value, dict):
return value return value
return {_long_uuid(v.uuid): v.data for v in value} # type: ignore
return {_long_uuid(v.uuid): bytes(v.data) for v in value} # type: ignore
def _convert_bluetooth_le_manufacturer_data( def _convert_bluetooth_le_manufacturer_data(
@ -779,7 +780,7 @@ def _convert_bluetooth_le_manufacturer_data(
) -> Dict[int, bytes]: ) -> Dict[int, bytes]:
if isinstance(value, dict): if isinstance(value, dict):
return value return value
return {int(v.uuid, 16): v.data for v in value} # type: ignore return {int(v.uuid, 16): bytes(v.data) for v in value} # type: ignore
@dataclass(frozen=True) @dataclass(frozen=True)