Skip to content

How do I call "write_value" #70

Description

@s315wx

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions