brickpipe 0.2.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brickpipe
3
- Version: 0.2.0
3
+ Version: 0.3.2
4
4
  Summary: A json IPC interface for interacting with pybricks hubs
5
5
  License: GNU GENERAL PUBLIC LICENSE
6
6
  Version 3, 29 June 2007
@@ -661,7 +661,7 @@ These commands are sent to the script via `stdin`.
661
661
 
662
662
  | `event_type` | Parameters | Description |
663
663
  |:-------------------------|:--------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------|
664
- | `start_ble_scanning` | `timout` : int \| float (required) | Begins bluetooth scanning with a specified timeout. |
664
+ | `start_ble_scanning` | `timeout` : int \| float (required) | Begins bluetooth scanning with a specified timeout. |
665
665
  | `connect_to_hub` | `conn_type`: `"ble"` or `"usb"` (required)<br>`ble_address`: string (optional)<br>`ble_hub_name`: string (optional) | Connects to a hub. `ble_address` and `ble_hub_name` are used for filtering bluetooth hubs. |
666
666
  | `disconnect_from_hub` | None | Disconnects the currently connected hub. |
667
667
  | `recompile_download` | `program_path`: string (required) | Stops any running program, recompiles the specified Python file, and downloads it to the hub. |
@@ -24,7 +24,7 @@ These commands are sent to the script via `stdin`.
24
24
 
25
25
  | `event_type` | Parameters | Description |
26
26
  |:-------------------------|:--------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------|
27
- | `start_ble_scanning` | `timout` : int \| float (required) | Begins bluetooth scanning with a specified timeout. |
27
+ | `start_ble_scanning` | `timeout` : int \| float (required) | Begins bluetooth scanning with a specified timeout. |
28
28
  | `connect_to_hub` | `conn_type`: `"ble"` or `"usb"` (required)<br>`ble_address`: string (optional)<br>`ble_hub_name`: string (optional) | Connects to a hub. `ble_address` and `ble_hub_name` are used for filtering bluetooth hubs. |
29
29
  | `disconnect_from_hub` | None | Disconnects the currently connected hub. |
30
30
  | `recompile_download` | `program_path`: string (required) | Stops any running program, recompiles the specified Python file, and downloads it to the hub. |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "brickpipe"
3
- version = "0.2.0"
3
+ version = "0.3.2"
4
4
  requires-python = ">=3.10"
5
5
  description = "A json IPC interface for interacting with pybricks hubs"
6
6
  readme = "README.md"
@@ -1,5 +1,6 @@
1
1
  import asyncio
2
2
  import json
3
+ import os
3
4
  import struct
4
5
  import sys
5
6
  from enum import Enum
@@ -266,11 +267,14 @@ async def main_loop():
266
267
 
267
268
  ble_scan_stop_event.clear()
268
269
 
269
- async with BleakScanner(ble_scanner_callback) as scanner:
270
- try:
271
- await asyncio.wait_for(ble_scan_stop_event.wait(), timeout)
272
- except TimeoutError:
273
- pass
270
+ async def scan_ble(timeout: float | int):
271
+ async with BleakScanner(ble_scanner_callback) as scanner:
272
+ try:
273
+ await asyncio.wait_for(ble_scan_stop_event.wait(), timeout)
274
+ except TimeoutError:
275
+ pass
276
+
277
+ asyncio.create_task(scan_ble(timeout))
274
278
 
275
279
  case IncomingEventType.connect_to_hub:
276
280
  if hub:
@@ -295,6 +299,8 @@ async def main_loop():
295
299
  if 'ble_address' in command:
296
300
  device_or_address = await BleakScanner.find_device_by_address(
297
301
  command.get('ble_address'))
302
+ if device_or_address is None:
303
+ raise TimeoutError
298
304
  else:
299
305
  device_or_address = await find_ble(name)
300
306
 
@@ -418,7 +424,7 @@ async def main_loop():
418
424
  if hub_monitor_tasks:
419
425
  hub_monitor_tasks.cancel()
420
426
  await hub.disconnect()
421
- exit(0)
427
+ os._exit(0)
422
428
 
423
429
  case _:
424
430
  print(f"Invalid command: {command}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brickpipe
3
- Version: 0.2.0
3
+ Version: 0.3.2
4
4
  Summary: A json IPC interface for interacting with pybricks hubs
5
5
  License: GNU GENERAL PUBLIC LICENSE
6
6
  Version 3, 29 June 2007
@@ -661,7 +661,7 @@ These commands are sent to the script via `stdin`.
661
661
 
662
662
  | `event_type` | Parameters | Description |
663
663
  |:-------------------------|:--------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------|
664
- | `start_ble_scanning` | `timout` : int \| float (required) | Begins bluetooth scanning with a specified timeout. |
664
+ | `start_ble_scanning` | `timeout` : int \| float (required) | Begins bluetooth scanning with a specified timeout. |
665
665
  | `connect_to_hub` | `conn_type`: `"ble"` or `"usb"` (required)<br>`ble_address`: string (optional)<br>`ble_hub_name`: string (optional) | Connects to a hub. `ble_address` and `ble_hub_name` are used for filtering bluetooth hubs. |
666
666
  | `disconnect_from_hub` | None | Disconnects the currently connected hub. |
667
667
  | `recompile_download` | `program_path`: string (required) | Stops any running program, recompiles the specified Python file, and downloads it to the hub. |
File without changes
File without changes