Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using Bleck to write
#1
Hey everyone,


does anyone have experience using bleak?

I am trying to write to a device using this:

async def run(address):
    async with BleakClient(address) as client:
        answer = await client.write_gatt_char('00001001-0000-1000-8000-00805f9b34fb', b'stringValue', response=True)
        print(answer)
and I get:
txdbus.error.MarshallingError: List, Tuple, Bytearray, or Dictionary required for DBus array.  Received:
I try encoding the text as follows:

async def run(address):
    async with BleakClient(address) as client:
        answer = await client.write_gatt_char('00001001-0000-1000-8000-00805f9b34fb', bytearray('stringValue', 'utf-8'), response=True)
        print(answer)
and it return's none, and the device doesn't do what it is supposed to

when I send the same value using an iPhone Gatt app, it has no problem. what am I doing wrong? is it the encoding I picked?

Thanks
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020