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 == '00001234-0000-1000-8000-001234567890')
firmware_version_characteristic = next(
c for c in device_information_service.characteristics
if c.uuid == '00001235-0000-1000-8000-001234567890')
firmware_version_characteristic.write_value(b'start')
def characteristic_write_value_succeeded(self, characteristic):
"""
Called when a characteristic value write command succeeded.
"""
# To be implemented by subclass
print("worked")
def characteristic_write_value_failed(self, characteristic, error):
"""
Called when a characteristic value write command failed.
"""
# To be implemented by subclass
print("failed")
device = AnyDevice(mac_address='00:21:7E:24:A7:F1', manager=manager)
device.connect()
manager.run()
On my computer, this works without any issues. On the RPI, i get the autohrization error.
I read that you can set the permissions in the gatt, but couldn't find a proper function in the implementation.
Hi all,
on my Raspberry Pi 4, I'm trying to write some characteristics using this gatt module. However, I run into the following issue:
The python code looks like this:
On my computer, this works without any issues. On the RPI, i get the autohrization error.
I read that you can set the permissions in the gatt, but couldn't find a proper function in the implementation.
Any ideas?
Thanks, Soner