btbricks 0.2.4__tar.gz → 0.2.5__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.
- {btbricks-0.2.4 → btbricks-0.2.5}/PKG-INFO +1 -1
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks/bt.py +13 -7
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks.egg-info/PKG-INFO +1 -1
- {btbricks-0.2.4 → btbricks-0.2.5}/docs/index.rst +2 -1
- {btbricks-0.2.4 → btbricks-0.2.5}/pyproject.toml +1 -1
- {btbricks-0.2.4 → btbricks-0.2.5}/.readthedocs.yaml +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/CHANGELOG.md +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/LICENSE +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/MANIFEST.in +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/README.md +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks/__init__.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks/bthub.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks/ctrl_plus.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks.egg-info/SOURCES.txt +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks.egg-info/dependency_links.txt +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks.egg-info/requires.txt +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/btbricks.egg-info/top_level.txt +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/docs/Makefile +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/docs/conf.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/ble-midi-esp/main.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/ble_uart_light_matrix_client.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/ble_uart_light_matrix_server.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/ble_uart_simple_central.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/ble_uart_simple_peripheral.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/inventor_ble_midi_guitar.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/midi_controller_example.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_batmobile_spike_wheel.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_extreme_offroader_spike_wheel.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_hotrod_car_receiver.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_hotrod_transmitter.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_mecanum_wheels.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_multi_snake_head.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_multi_snake_seg_1.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_receiver_example.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_snake.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_snake_with_simple_remote.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_snake_with_spike_steering_wheel.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/rc_transmitter_example.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/uart_central_example.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/examples/uart_peripheral_example.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/setup.cfg +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/setup.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/tests/__init__.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/tests/test_bthub.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/tests/test_constants.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/tests/test_imports.py +0 -0
- {btbricks-0.2.4 → btbricks-0.2.5}/tests/test_precommit_checks.py +0 -0
|
@@ -531,10 +531,9 @@ class BLEHandler:
|
|
|
531
531
|
|
|
532
532
|
def advertise(self, payload, interval_us=100000):
|
|
533
533
|
"""
|
|
534
|
-
Advertise a BLE payload for a
|
|
534
|
+
Advertise a BLE payload for a microsecond time interval.
|
|
535
535
|
Create the payload with the _advertising_payload() function.
|
|
536
536
|
"""
|
|
537
|
-
print("Started advertising")
|
|
538
537
|
self._ble.gap_advertise(interval_us, adv_data=payload)
|
|
539
538
|
|
|
540
539
|
def on_write(self, value_handle, callback):
|
|
@@ -913,7 +912,12 @@ class UARTPeripheral(BleUARTBase):
|
|
|
913
912
|
)
|
|
914
913
|
|
|
915
914
|
self.ble_handler.on_write(self._handle_rx, self._on_rx)
|
|
916
|
-
|
|
915
|
+
|
|
916
|
+
def _on_disconnect(conn_handle):
|
|
917
|
+
# Flush buffer
|
|
918
|
+
self.read()
|
|
919
|
+
self.start_advertising()
|
|
920
|
+
self.ble_handler._central_disconn_callback = _on_disconnect
|
|
917
921
|
|
|
918
922
|
# Characteristics and descriptors have a default maximum size of 20 bytes.
|
|
919
923
|
# Anything written to them by a client will be truncated to this length.
|
|
@@ -929,15 +933,17 @@ class UARTPeripheral(BleUARTBase):
|
|
|
929
933
|
|
|
930
934
|
# Flush
|
|
931
935
|
_ = self.ble_handler._ble.gatts_read(self._handle_rx)
|
|
936
|
+
|
|
937
|
+
# Advertise
|
|
938
|
+
self.start_advertising()
|
|
939
|
+
|
|
940
|
+
def start_advertising(self):
|
|
932
941
|
self.ble_handler.advertise(advertising_payload(name=self.name, services=[_UART_UUID]))
|
|
942
|
+
print("Advertising as:", self.name)
|
|
933
943
|
|
|
934
944
|
def is_connected(self):
|
|
935
945
|
return self.ble_handler._connected_central >= 0
|
|
936
946
|
|
|
937
|
-
def _on_disconnect(self, conn_handle):
|
|
938
|
-
# Flush buffer
|
|
939
|
-
self.read()
|
|
940
|
-
|
|
941
947
|
def write(self, data):
|
|
942
948
|
"""
|
|
943
949
|
Write uart data to remote. This is a blocking call.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|