예제 #1
0
파일: dispatcher.py 프로젝트: zsf1975/able
    def write_characteristic(self, characteristic, value):
        """Write a given characteristic value to the associated remote device

        :param characteristic: BluetoothGattCharacteristic Java object
        :param value: value to write
        """
        self._ble.writeCharacteristic(characteristic,
                                      force_convertible_to_java_array(value))
예제 #2
0
    def write_descriptor(self, descriptor, value):
        """Set and write the value of a given descriptor to the associated
        remote device

        :param descriptor: BluetoothGattDescriptor Java object
        :param value: value to write
        """
        if not descriptor.setValue(force_convertible_to_java_array(value)):
            Logger.error("Error on set descriptor value")
            return
        if not self.gatt.writeDescriptor(descriptor):
            Logger.error("Error on descriptor write")
예제 #3
0
    def write_characteristic(self,
                             characteristic,
                             value,
                             write_type: Optional[WriteType] = None):
        """Write a given characteristic value to the associated remote device

        :param characteristic: BluetoothGattCharacteristic Java object
        :param value: value to write
        :param write_type: specific write type to set for the characteristic
        """
        self._ble.writeCharacteristic(characteristic,
                                      force_convertible_to_java_array(value),
                                      int(write_type or 0))
예제 #4
0
 def add_payload(self, builder):
     builder.addServiceData(ParcelUuid.fromString(self.uid),
                            force_convertible_to_java_array(self.data))
예제 #5
0
 def add_payload(self, builder):
     builder.addManufacturerData(self.id,
                                 force_convertible_to_java_array(self.data))