diff options
Diffstat (limited to 'examples/bluetooth/ble_uart_peripheral.py')
-rw-r--r-- | examples/bluetooth/ble_uart_peripheral.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/bluetooth/ble_uart_peripheral.py b/examples/bluetooth/ble_uart_peripheral.py index cc8d589b0..59b35f7e6 100644 --- a/examples/bluetooth/ble_uart_peripheral.py +++ b/examples/bluetooth/ble_uart_peripheral.py @@ -20,7 +20,7 @@ _UART_RX = ( ) _UART_SERVICE = ( _UART_UUID, - (_UART_TX, _UART_RX,), + (_UART_TX, _UART_RX), ) # org.bluetooth.characteristic.gap.appearance.xml @@ -32,9 +32,7 @@ class BLEUART: self._ble = ble self._ble.active(True) self._ble.irq(handler=self._irq) - ((self._tx_handle, self._rx_handle,),) = self._ble.gatts_register_services( - (_UART_SERVICE,) - ) + ((self._tx_handle, self._rx_handle),) = self._ble.gatts_register_services((_UART_SERVICE,)) # Increase the size of the rx buffer and enable append mode. self._ble.gatts_set_buffer(self._rx_handle, rxbuf, True) self._connections = set() @@ -50,16 +48,16 @@ class BLEUART: def _irq(self, event, data): # Track connections so we can send notifications. if event == _IRQ_CENTRAL_CONNECT: - conn_handle, _, _, = data + conn_handle, _, _ = data self._connections.add(conn_handle) elif event == _IRQ_CENTRAL_DISCONNECT: - conn_handle, _, _, = data + conn_handle, _, _ = data if conn_handle in self._connections: self._connections.remove(conn_handle) # Start advertising again to allow a new connection. self._advertise() elif event == _IRQ_GATTS_WRITE: - conn_handle, value_handle, = data + conn_handle, value_handle = data if conn_handle in self._connections and value_handle == self._rx_handle: self._rx_buffer += self._ble.gatts_read(self._rx_handle) if self._handler: |