getsenic/gatt-python

How do I call "write_value"

s315wx opened this issue · 0 comments

import gatt

manager = gatt.DeviceManager(adapter_name='hci0')

class AnyDevice(gatt.Device):
def services_resolved(self):
super().services_resolved()

    device_information_service = next(
        s for s in self.services
        if s.uuid == '0000180a-0000-1000-8000-00805f9b34fb')

    firmware_version_characteristic = next(
        c for c in device_information_service.characteristics
        if c.uuid == '00002a26-0000-1000-8000-00805f9b34fb')

    firmware_version_characteristic.read_value()

def characteristic_value_updated(self, characteristic, value):
    print("Firmware version:", value.decode("utf-8"))

**def characteristic_enable_notification_failed(self)**
      pass

  def characteristic_enable_notification_succeeded(self)
      pass

device = AnyDevice(mac_address='AA:BB:CC:DD:EE:FF', manager=manager)
device.connect()

manager.run()


I don't know how to write to the device. I have been confused for many days. Is there anyone who can help me?
Thank you