Re: BLE Advertisement frustrations with pydbus

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

 



Hello,

On 8 May 2017 at 11:18, Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx> wrote:
> 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.

Given the information below, this seems like it is the issue.
Does this mean it is a bug in BlueZ?
Or is this how it is intend to work going forward?

>
>>
>>> 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

This was a good suggestion. And you were correct about your suspicion
that it was missing ObjectManager.

method call time=1494270131.995970 sender=:1.13 ->
destination=org.freedesktop.DBus serial=78 path=/org/freedesktop/DBus;
interface=org.freedesktop.DBus; member=AddMatch
   string "type='signal',sender=':1.51',path='/ukBaz/bluezero',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.bluez.LEAdvertisement1'"
method return time=1494270131.996002 sender=org.freedesktop.DBus ->
destination=:1.13 serial=33 reply_serial=78
method call time=1494270131.996317 sender=:1.13 -> destination=:1.51
serial=79 path=/ukBaz/bluezero;
interface=org.freedesktop.DBus.Properties; member=GetAll
   string "org.bluez.LEAdvertisement1"
method call time=1494270131.996358 sender=:1.13 -> destination=:1.51
serial=80 path=/ukBaz/bluezero;
interface=org.freedesktop.DBus.ObjectManager; member=GetManagedObjects
error time=1494270131.997525 sender=:1.51 -> destination=:1.13
error_name=org.freedesktop.DBus.Error.UnknownMethod reply_serial=80
   string "No such interface 'org.freedesktop.DBus.ObjectManager' on
object at path /ukBaz/bluezero"


I'll do some investigation as to how difficult it is to implement
ObjectManager for this.


>>
>> 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