How to send a python dbus advertising (!) packet with Flags

160 Views Asked by At

I am sending BLE packets via raspberry pi device. the python module which I am using is dbus. As for now I am testing my packets sending with the android mobile app nRF Connect, and I am able to send a packet successfully and see that packet over the app.

The problem which I am facing is how to append to my packet the Flags values as showing in the following picture from other BLE device that was reporting a message: enter image description here

See in red rect what Flags I am referring to

adding to add the properties in GetAll method as following 3 options:

1. self.__properties['AdvertisingFlags'] = DBusArray([DBusString('GeneralDiscoverable'), DBusString('BrEdrNotSupported')], signature='ay')

2. self.__properties['AdvertisingFlags'] = DBusArray(['GeneralDiscoverable', 'BrEdrNotSupported'], signature='ay')

3. self.__properties['AdvertisingFlags'] = GLibVariant('ay', 'GeneralDiscoverable')

1

There are 1 best solutions below

0
On

Finally solved by adding
self.__properties['Discoverable'] = dbus.Boolean(True)

When the override method def GetAll(self, interface): is called.
self.__properties is what we return in the GetAll function. :-)