0
votes

For BLE, I use BLUEZ5 stack on my Raspberry pi 3 Device, For running gatt server i used example-gatt-server.py in my board(server) and used mobile for central device(client side) when i write value from characteristics from my mobile,its received in my device(callback) is in byte array format like "dbus.Array([dbus.Byte(1), dbus.Byte(35)], signature=dbus.Signature('y'))" i can't decoded this,

How I can extract any useful information from the dbus bluez api that returns a byte array

I use following link for example-gatt-server.py : https://github.com/RadiusNetworks/bluez/blob/master/test/example-gatt-server

1
You can try and use the hcidump tool on the server to check.Prabhakar Lad
yes,you are right and thanks for your suggestion regarding usage of "hcidump" but i need capture value in my code and print it through this code thats why i required itlucifer

1 Answers

1
votes

The following python code is callback function that prints the parameters. In my case, each byte of the array represents an ASCII character).

def notification_callback(*args, **kwargs):
    """
        Function that will receive DBus notifications signals (properties_changed signals)
        when the temperature is updated
    """
    #Get the byte array 
    byte_array = args[1]['Value']

    #Convert the byte array into a string
    received_value = ''.join(chr(byte) for byte in byte_array)
    print ("Received value " + received_value)