Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Teckids/hacknfun/libs/mynit
  • schubisu/esp-init
2 results
Show changes
Commits on Source (2)
...@@ -61,6 +61,9 @@ class MynitCompanionApp(App): ...@@ -61,6 +61,9 @@ class MynitCompanionApp(App):
self.widget.update_device_buttons(buttons_map) self.widget.update_device_buttons(buttons_map)
def handle_data(self, data):
Logger.info("Handling received data: %s" % data)
def build(self): def build(self):
self.widget = DeviceListWidget() self.widget = DeviceListWidget()
return self.widget return self.widget
...@@ -38,6 +38,7 @@ class MynitBluetooth(BluetoothDispatcher): ...@@ -38,6 +38,7 @@ class MynitBluetooth(BluetoothDispatcher):
def on_scan_completed(self): def on_scan_completed(self):
if self._device: if self._device:
# FIXME Add retries
self.connect_gatt(self._device) self.connect_gatt(self._device)
def on_connection_state_change(self, status, state): def on_connection_state_change(self, status, state):
...@@ -56,3 +57,9 @@ class MynitBluetooth(BluetoothDispatcher): ...@@ -56,3 +57,9 @@ class MynitBluetooth(BluetoothDispatcher):
def on_services(self, status, services): def on_services(self, status, services):
Logger.info("Services discovered") Logger.info("Services discovered")
self._characteristics = (services.search(_UART_SERVICE_TX_UUID), services.search(_UART_SERVICE_RX_UUID)) self._characteristics = (services.search(_UART_SERVICE_TX_UUID), services.search(_UART_SERVICE_RX_UUID))
self.enable_notifications(self._characteristics[1])
def on_characteristic_changed(self, characteristic):
Logger.info("Data received")
data = characteristic.getStringValue(0)
self._app.handle_data(data)