Async iterator yielding lines received via BLE NOTIFY. Args: timeout: Maximum time to wait for lines in seconds. Yields: Lines from BLE notifications (stripped of whitespace).
(self, timeout: float)
| 96 | await self._client.write_gatt_char(BLE_CHAR_RX_UUID, payload, response=True) |
| 97 | |
| 98 | async def read_lines(self, timeout: float) -> AsyncIterator[str]: |
| 99 | """Async iterator yielding lines received via BLE NOTIFY. |
| 100 | |
| 101 | Args: |
| 102 | timeout: Maximum time to wait for lines in seconds. |
| 103 | |
| 104 | Yields: |
| 105 | Lines from BLE notifications (stripped of whitespace). |
| 106 | """ |
| 107 | deadline = asyncio.get_event_loop().time() + timeout |
| 108 | while True: |
| 109 | remaining = deadline - asyncio.get_event_loop().time() |
| 110 | if remaining <= 0: |
| 111 | break |
| 112 | try: |
| 113 | line = await asyncio.wait_for(self._rx_queue.get(), timeout=remaining) |
| 114 | yield line |
| 115 | except asyncio.TimeoutError: |
| 116 | break |
no test coverage detected