Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tcamise-gpsw committed Apr 23, 2024
1 parent a1c99a6 commit 75cb1fe
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
5 changes: 3 additions & 2 deletions demos/python/sdk_wireless_camera_control/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.

Unreleased
----------
0.16.1 (April-23-2024)
----------------------

* Always use extended headers
* Add Delete Media HTTP API's
* Add port argument to Preview Stream HTTP API
* Only ask for sudo password when required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ async def read(self, handle: bleak.BleakClient, uuid: BleUUID) -> bytearray:
logger.debug(f'Received response on BleUUID [{uuid}]: {response.hex( ":")}')
return response

async def write(self, handle: bleak.BleakClient, uuid: BleUUID, data: bytearray) -> None:
async def write(self, handle: bleak.BleakClient, uuid: BleUUID, data: bytes) -> None:
"""Write data to a BleUUID.
Args:
handle (bleak.BleakClient): Device to write to
uuid (BleUUID): characteristic BleUUID to write to
data (bytearray): data to write
data (bytes): data to write
"""
logger.debug(f"Writing to {uuid}: {uuid.hex}")
await handle.write_gatt_char(uuid2bleak_string(uuid), data, response=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,23 @@ async def close(self) -> None:
else:
logger.debug("BLE already disconnected")

async def read(self, uuid: BleUUID) -> bytearray:
async def read(self, uuid: BleUUID) -> bytes:
"""Read byte data from a characteristic (identified by BleUUID)
Args:
uuid (BleUUID): characteristic to read
Returns:
bytearray: byte data that was read
bytes: byte data that was read
"""
return await self._controller.read(self._handle, uuid)

async def write(self, uuid: BleUUID, data: bytearray) -> None:
async def write(self, uuid: BleUUID, data: bytes) -> None:
"""Write byte data to a characteristic (identified by BleUUID)
Args:
uuid (BleUUID): characteristic to write to
data (bytearray): byte data to write
data (bytes): byte data to write
"""
await self._controller.write(self._handle, uuid, data)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@ def __init__(self, exception_handler: Optional[Callable] = None) -> None:
self._exception_handler = exception_handler

@abstractmethod
async def read(self, handle: BleHandle, uuid: BleUUID) -> bytearray:
async def read(self, handle: BleHandle, uuid: BleUUID) -> bytes:
"""Read a bytestream response from a BleUUID.
Args:
handle (BleHandle): handle to pair to
uuid (BleUUID): BleUUID to read from
Returns:
bytearray: response
bytes: response
"""
raise NotImplementedError

@abstractmethod
async def write(self, handle: BleHandle, uuid: BleUUID, data: bytearray) -> None:
async def write(self, handle: BleHandle, uuid: BleUUID, data: bytes) -> None:
"""Write a bytestream to a BleUUID.
Args:
handle (BleHandle): handle to pair to
uuid (BleUUID): BleUUID to write to
data (bytearray): bytestream to write
data (bytes): bytestream to write
Returns:
bytearray: response
bytes: response
"""
raise NotImplementedError

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,6 @@ def _fragment(cls, data: bytes) -> Generator[bytes, None, None]:
Generator[bytes, None, None]: Generator of packets as bytes
"""
MAX_BLE_PKT_LEN = 20
general_header = BitStruct(
"continuation" / Const(0, Bit),
"header" / Const(Header.GENERAL.value, BitsInteger(2)),
"length" / BitsInteger(5),
)

extended_13_header = BitStruct(
"continuation" / Const(0, Bit),
Expand Down

0 comments on commit 75cb1fe

Please sign in to comment.