def __processEventCharInterface(path): bus = dbus.SystemBus() obj = bus.get_object(testutils.SERVICE_NAME, path) if bleAdapter.notificationCb != None: uuid = bleAdapter.getPropertie(obj, "UUID", interface=testutils.CHARACTERISTIC_INTERFACE) value = testutils.convert_dbus_array_to_string(bleAdapter.getPropertie(obj, "Value", interface=testutils.CHARACTERISTIC_INTERFACE)) bleAdapter.notificationCb.im_func(uuid, value)
def _readAttribute(objInterface, uuid): isSuccessfull = True value = "" try: objInterface.ReadValue({}, reply_handler=attributeRead, error_handler=attributeAccessError, timeout=bleAdapter.DBUS_HANDLER_GENERIC_TIMEOUT) mainloop.run() (isSuccessfull, getAttrValue) = attributeAccessEvent.get() value = testutils.convert_dbus_array_to_string(getAttrValue) except Exception as e: print("BLE ADAPTER: Can't read attribute: "+uuid+" error: "+str(e)) sys.stdout.flush() isSuccessfull = False return (isSuccessfull, value)