How to use the able.GATT_SUCCESS function in able

To help you get started, we’ve selected a few able examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github b3b / able / testapps / bletest / main.py View on Github external
def update_string_value(self, characteristic, status):
        result = 'ERROR'
        if status == GATT_SUCCESS:
            value = characteristic.getStringValue(0)
            if value == 'test':
                result = 'OK'
        self.test_string = result
github b3b / able / able / android / jni.py View on Github external
def on_services(self, status, services):
        services_dict = Services()
        if status == GATT_SUCCESS:
            for service in services.toArray():
                service_uuid = service.getUuid().toString()
                Logger.debug("Service discovered: {}".format(service_uuid))
                services_dict[service_uuid] = {}
                for c in service.getCharacteristics().toArray():
                    characteristic_uuid = c.getUuid().toString()
                    Logger.debug("Characteristic discovered: {}".format(
                        characteristic_uuid))
                    services_dict[service_uuid][characteristic_uuid] = c
        self.dispatcher.dispatch('on_services', status, services_dict)
github b3b / able / examples / alert / main.py View on Github external
def on_connection_state_change(self, status, state):
        if status == GATT_SUCCESS and state:  # connection established
            self.discover_services()  # discover what services a device offer
        else:  # disconnection or error
            self.alert_characteristic = None
            self.close_gatt()  # close current connection
github slinger360 / NineRiFt-Lite / py9b / link / droidble.py View on Github external
def on_connection_state_change(self, status, state):
        if status == GATT_SUCCESS and state:
            self.discover_services()
            self.state = 'discover'
            print(self.state)
        else:
            self.close_gatt()
            self.rx_characteristic = None
            self.tx_characteristic = None
            self.services = None