Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I call "write_value" #70

Open
s315wx opened this issue Apr 2, 2023 · 0 comments
Open

How do I call "write_value" #70

s315wx opened this issue Apr 2, 2023 · 0 comments

Comments

@s315wx
Copy link

s315wx commented Apr 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant