File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -596,21 +596,28 @@ def read_value(self, offset=0):
596596 error = _error_from_dbus_error (e )
597597 self .service .device .characteristic_read_value_failed (self , error = error )
598598
599- def write_value (self , value , offset = 0 ):
599+ def write_value (self , value , offset = 0 , with_response = True ):
600600 """
601601 Attempts to write a value to the characteristic.
602602
603603 Success or failure will be notified by calls to `write_value_succeeded` or `write_value_failed` respectively.
604604
605605 :param value: array of bytes to be written
606606 :param offset: offset from where to start writing the bytes (defaults to 0)
607+ :param with_response: whether a response should be requested for the write (defaults to True)
607608 """
608609 bytes = [dbus .Byte (b ) for b in value ]
609610
611+ if with_response == True :
612+ write_type = "request"
613+ else :
614+ write_type = "command"
615+
610616 try :
611617 self ._object .WriteValue (
612618 bytes ,
613- {'offset' : dbus .UInt16 (offset , variant_level = 1 )},
619+ {'offset' : dbus .UInt16 (offset , variant_level = 1 ),
620+ 'type' : write_type },
614621 reply_handler = self ._write_value_succeeded ,
615622 error_handler = self ._write_value_failed ,
616623 dbus_interface = 'org.bluez.GattCharacteristic1' )
You can’t perform that action at this time.
0 commit comments