Python Forum
Using Bleck to write - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Using Bleck to write (/thread-30947.html)



Using Bleck to write - JarredAwesome - Nov-14-2020

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