Re: BLE Advertisement frustrations with pydbus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Barry,

On Mon, May 8, 2017 at 11:51 AM, Barry Byford <31baz66@xxxxxxxxx> wrote:
> Hello Luiz & Travis,
>
> I've been taking a look at this also
>
> On 8 May 2017 at 09:01, Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx> wrote:
>> On Sat, May 6, 2017 at 1:28 AM, Travis Griggs <travisgriggs@xxxxxxxxx> wrote:
>>> $ sudo busctl get-property :1.5 /nic/twigpilot org.bluez.LEAdvertisement1 Type
>>> s “peripheral"
>>>
>>> So I *am* able to get the Type using busctl. Why is that bluetoothd cannot? Using busctl introspect, I see that the pydbus variant automagically makes a lot more available than the dubs-python variant did.
>>>
>>> Any hints? Pointers? Help?
>>
>> Does pydbus have ObjectManager support?
>
> Looking at the following entry in the libraries issue list it seems
> like it does.
> https://github.com/LEW21/pydbus/issues/28
> Is there anything in particular we should be testing for?

This is support for ObjectManager as a client, I was asking for the
server side so we can query the advertisement objects. Though this
used to work even without ObjectManager support so perhaps there is
some regression.

>
>> What about GetAll properties?
> Yes it does. It creates these standard interfaces automatically based
> on the XML in the Python class doc string. So for example Get and
> GetAll give the following:
>
>
> $ busctl call ukBaz.bluezero /ukBaz/bluezero
> org.freedesktop.DBus.Properties Get ss org.bluez.LEAdvertisement1 Type
>
> v s "peripheral"
>
> $ busctl call ukBaz.bluezero /ukBaz/bluezero
> org.freedesktop.DBus.Properties GetAll s org.bluez.LEAdvertisement1
>
> a{sv} 3 "Type" s "peripheral" "SolicitUUIDs" as 1 "180F"
> "IncludeTxPower" b false
>
>
>> You could perhaps try to sniff the message with eavesdrop option:
>>
>> https://wiki.ubuntu.com/DebuggingDBus
>
> Good suggestion. I'll try that later.
>
>>
>>> TIA
>>>
>>> ——
>>>
>>> #!/usr/bin/env python3
>>>
>>> import pydbus
>>> from gi.repository import GLib
>>>
>>> class Advertisement(object):
>>>     """
>>>       <node>
>>>         <interface name="org.bluez.LEAdvertisement1">
>>>           <method name="Release">
>>>             <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
>>>           </method>
>>>           <annotation name="org.freedesktop.DBus.Properties.PropertiesChanged" value="const"/>
>>>           <property name="Type" type="s" access="read"/>
>>>           <property name="ServiceUUIDs" type="as" access="read"/>
>>>           <property name="ManufacturerData" type="a{sv}" access="read"/>
>>>           <property name="SolicitUUIDs" type="as" access="read"/>
>>>           <property name="ServiceData" type="a{sv}" access="read"/>
>>>           <property name="IncludeTxPower" type="b" access="read"/>
>>>         </interface>
>>>       </node>
>>>     """
>>>
>>>     def __init__(self, bus):
>>>         self.Type = 'peripheral'
>>>         self.ServiceUUIDs = []
>>>         self.ManufacturerData = {}
>>>         self.SolicitUUIDs = []
>>>         self.ServiceData = {}
>>>         self.IncludeTxPower = False
>>>         bus.register_object('/nic/twigpilot', self, None)
>>>
>>>     def Release(self):
>>>         print('{}: Advertisement Released!'.format(self))
>>>
>>>
>>> def main():
>>>     bus = pydbus.SystemBus()
>>>     adaptor = bus.get('org.bluez', '/org/bluez/hci0')
>>>     adaptor.Powered = True
>>>     adaptor.Alias = 'SeeMe'
>>>
>>>     advertisement = Advertisement(bus)
>>>     advertisement.IncludeTxPower = True
>>>
>>>     #adaptor.RegisterAdvertisement('/nic/twigpilot', {})
>>>
>>>     loop = GLib.MainLoop()
>>>     try:
>>>         loop.run()
>>>     except KeyboardInterrupt:
>>>         loop.quit()
>>>
>>> if __name__ == '__main__':
>>>     main()--
>>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>> --
>> Luiz Augusto von Dentz
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux