How to use the able.structures.Services 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 / 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)