Try use bytes type

This commit is contained in:
Jesse Hills 2022-09-28 14:22:35 +13:00
parent 65f77279d5
commit debc2f1e93
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
3 changed files with 79 additions and 83 deletions

View File

@ -1244,7 +1244,7 @@ message BluetoothGATTReadResponse {
uint64 address = 1;
uint32 handle = 2;
repeated uint32 data = 3 [packed=true];
bytes data = 3;
}
@ -1257,7 +1257,7 @@ message BluetoothGATTWriteRequest {
uint32 handle = 2;
bool response = 3;
repeated uint32 data = 4 [packed=true];
bytes data = 4;
}
message BluetoothGATTReadDescriptorRequest {
@ -1277,7 +1277,7 @@ message BluetoothGATTWriteDescriptorRequest {
uint64 address = 1;
uint32 handle = 2;
repeated uint32 data = 3 [packed=true];
bytes data = 3;
}
message BluetoothGATTNotifyRequest {
@ -1298,7 +1298,7 @@ message BluetoothGATTNotifyDataResponse {
uint64 address = 1;
uint32 handle = 2;
repeated uint32 data = 3 [packed=true];
bytes data = 3;
}
message SubscribeBluetoothConnectionsFreeRequest {

File diff suppressed because one or more lines are too long

View File

@ -771,7 +771,7 @@ def _convert_bluetooth_le_service_data(
) -> Dict[str, bytes]:
if isinstance(value, dict):
return value
return {_long_uuid(v.uuid): bytes(v.data) for v in value} # type: ignore
return {_long_uuid(v.uuid): v.data for v in value} # type: ignore
def _convert_bluetooth_le_manufacturer_data(
@ -779,7 +779,7 @@ def _convert_bluetooth_le_manufacturer_data(
) -> Dict[int, bytes]:
if isinstance(value, dict):
return value
return {int(v.uuid, 16): bytes(v.data) for v in value} # type: ignore
return {int(v.uuid, 16): v.data for v in value} # type: ignore
@dataclass(frozen=True)
@ -812,7 +812,7 @@ class BluetoothGATTRead(APIModelBase):
address: int = 0
handle: int = 0
data: bytes = converter_field(default_factory=bytes, converter=bytes)
data: bytes = b""
@dataclass(frozen=True)