def stop_notify(self, mac: str, attribute: str) -> None: """ Overriding EngineBluew's trust method. :param mac: Device path. @mac_to_dev takes care of getting the proper path from the device's mac address. :param attribute: UUID of the BLE attribute. :return: True if succeeded, False otherwise.. """ path = self._uuid_to_path(attribute, mac) gattchrciface = BluezGattCharInterface(self._bus, path) gattchrciface.stop_notify()
def read_attribute(self, mac: str, attribute: str) -> List[bytes]: """ Overriding EngineBluew's read_attribute method. :param mac: Device path. @mac_to_dev takes care of getting the proper path from the device's mac address. :param attribute: UUID of the BLE attribute. :return: Value of attribute, raise exception otherwise. """ path = self._uuid_to_path(attribute, mac) gattchrciface = BluezGattCharInterface(self._bus, path) return dbus_object_parser(gattchrciface.read_value())
def write_attribute(self, mac: str, attribute: str, data: List[int]) -> None: """ Overriding EngineBluew's write_attribute method. :param mac: Device path. @mac_to_dev takes care of getting the proper path from the device's mac address. :param attribute: UUID of the BLE attribute. :param data: The data you want to write. :return: True if succeeded, False otherwise.. """ path = self._uuid_to_path(attribute, mac) gattchrciface = BluezGattCharInterface(self._bus, path) gattchrciface.write_value(data)
def notify(self, mac: str, attribute: str, handler: Callable) -> None: """ Overriding EngineBluew's trust method. :param mac: Device path. @mac_to_dev takes care of getting the proper path from the device's mac address. :param attribute: UUID of the BLE attribute. :param handler: A callback function with the values returned by the notifications. :return: True if succeeded, False otherwise.. """ path = self._uuid_to_path(attribute, mac) gattchrciface = BluezGattCharInterface(self._bus, path) handler = self._handle_notification(handler) gattchrciface.start_notify(handler)