예제 #1
0
파일: dbusted.py 프로젝트: wrtcoder/bluew
    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()
예제 #2
0
파일: dbusted.py 프로젝트: wrtcoder/bluew
    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())
예제 #3
0
파일: dbusted.py 프로젝트: wrtcoder/bluew
    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)
예제 #4
0
파일: dbusted.py 프로젝트: wrtcoder/bluew
    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)