Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2768424ybi; Thu, 18 Jul 2019 14:04:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCvWJKzukW/xNoUW28CCH4U68p2by5WgQ1kxuDWu7kQJZzfr1Md40/c7Wt518jDk4vsNjX X-Received: by 2002:a17:902:654f:: with SMTP id d15mr49430780pln.253.1563483893875; Thu, 18 Jul 2019 14:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563483893; cv=none; d=google.com; s=arc-20160816; b=mAgTWVEv3xoxZesk0HAS+CG6QzAF37rGNG/sMMsloNdJ0ei5YTTkO3wtaEbLuhqa5I TWFZRxh/rdUyoe9Dh1iOSFrK896dZ0dbTAz7GmyFlNCubeNjDK9rn+E4U3BFiQkhuvIz gw3/eMEegrxKzIGOrEUz9eiqiIGxFytN2aOAk+KXYZKnswfCAT1NV8jlox10+GIjoI/D vGubetgaB9mo3T2W45X07pYCxwmmeXwHgVF/DUQ8Ndz332qoVRclOLFVaYzV29sCuCKM Vjlto1mk/1El2tUjQSv5MPN9/hs7PhxHRsxl7MnNjty2VvZcsPEfDLphVaDXKpxWz0Zm n4tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PmQIRFbOoiqfW6WFCk6HkCrL09SCrEYJXCensd6atjU=; b=Didesr0MWWE4Sqcq/c9c9eiJisiVdTw7BiPbPQnqgRQhsDRBHOI7ZiN9HnrTy78kzP 4SH4249Am+MyHt/4NTd7AP2DsIaxBDMAz9gZUD44IoEPa+djvi3NqmYKdnSXx78wIUCz iMQYrWiqGj/yxL/0WGTn8GhDRyZBlvI2FMtsmUVml134s0VzP9Rl7K6yZsaE2utMl45e wRP90wD4+2//EGOITHmoosIw57w8KEBJfayBwQXruWZeQ9S7fLkbauO/wlDiaGqBbIuL mp8gVKdw9z9HMKeQqJ9zgkcRChhyps5IDR7L6oJymR9uDHIASX2cRnR4BjPDAamWhF3t EK8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vIVPxTZF; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n61si115783pjb.20.2019.07.18.14.04.24; Thu, 18 Jul 2019 14:04:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vIVPxTZF; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfGRVEX (ORCPT + 99 others); Thu, 18 Jul 2019 17:04:23 -0400 Received: from mail-yb1-f172.google.com ([209.85.219.172]:45627 "EHLO mail-yb1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727685AbfGRVEX (ORCPT ); Thu, 18 Jul 2019 17:04:23 -0400 Received: by mail-yb1-f172.google.com with SMTP id s41so9114883ybe.12 for ; Thu, 18 Jul 2019 14:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=PmQIRFbOoiqfW6WFCk6HkCrL09SCrEYJXCensd6atjU=; b=vIVPxTZFFUjVZznc+bECAqtyn3kMBXeXg/Qop8ib0c5qeB+Ip7dv+VsBnNGt4Gijxi zvMo28Eatkd+Dw1gwWv5YsnH6ujKWSbLABuGbtOEYGZ68QU7ZqRKqSBm9iZVaJTJAkqs 4HXpLsaHJqylaDKE+oVV6psfvy1m6w0ptFnLZ0OR5DgruxfFA8jxK88RSBjGY+5JhbrY psqKuuWwdH7epgpdvlk08aT+ucV/zJ13c0Po6dwEZVX5bifidtouxVVqMxAZBv26AljE 9APx9hYxFOyZKEY3/k0pjvADhcKU+YTtotPTisGAtw+9PfvI7itzZCmyJUgi0wfuKevc HK7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=PmQIRFbOoiqfW6WFCk6HkCrL09SCrEYJXCensd6atjU=; b=BVhTRZzNCM7N9Qt7ADXWuz9G2uxxkJuArcrQo40rSoSNhZThoGeIvOm0If7Bm8eSwm kI1UmeCXnJ0QWEyrChWv8G+sVDwfhcnt/5MQLVANhfSezkKdOI+F0lVZKP7QPdmJl/Za OrisL/wlMn90SG44l+54ZZO3HdzzxaJr7YlCoT7fqRxC36pbm0Cj7xnhypYN7wDAD4wR JNN5sMeMGURzbCdAyjMmLR8+YrcZerwSSBF0LZ0rB7HfRYEtJX/kIc4gy5M+lSnQL5lM ZwDwBhReVm3HKz5rtVj3+pekRIgkQ+E9GufPYXk07HVExzkqYbDyTlWo03JVUR83Fcbz H4QA== X-Gm-Message-State: APjAAAXMZxGCTC0EasT7yXgyquRufWUK3v+HObdloyC2g6t6ZLBoNtZ7 HGGf0SreQhydPYECKmOlP+P7JEIbTB0VRKSMLW50QQ6V X-Received: by 2002:a25:6756:: with SMTP id b83mr29433993ybc.37.1563483861473; Thu, 18 Jul 2019 14:04:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Barry Byford <31baz66@gmail.com> Date: Thu, 18 Jul 2019 22:04:06 +0100 Message-ID: Subject: Re: DBus LEAdvertisement and Python To: Bluez mailing list Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hello Luiz, Thanks for the prompt response. Below are some updates following your input. On Thu, 18 Jul 2019 at 09:26, Luiz Augusto von Dentz wrote: > > Hi Barry, > > On Thu, Jul 18, 2019 at 10:03 AM Barry Byford <31baz66@gmail.com> wrote: > > > > Hello, > > > > The Python examples provided in the test directory of the BlueZ > > repository use the python-dbus library. Looking at the documentation > > of that library it does start by raising concerns and offering > > alternatives. I have been looking at some of the alternatives and am > > having difficultly getting them to work with BlueZ. I have been > > focusing on the org.bluez.LEAdvertisement1 interface. > > > > Looking at the documentation, it says the service, interface and > > object details are: > > Service org.bluez > > Interface org.bluez.LEAdvertisement1 > > Object path freely definable > > > > I am not being successful at publishing to the org.bluez service. It > > is also not where the current examples publish to. > > Looking at the GattProfile1 documentation, it has service and object > > as application dependant. > > Service > > Interface org.bluez.GattProfile1 > > Object path > > Should the documentation of Service on LEAdvertisement1 be freely > > definable also? > > Yep, the bus name is up to the application which usually don't > register a friendly name if you try to register with 'org.bluez' it > would probably conflict with the daemon itself so you wouldn't be able > to register that name anyway. > > > I have created the LEAdvertisement1 interface so that it has an > > ObjectManager and is introspectable. When I pass the object to > > RegisterAdvertisement on the org.bluez.LEAdvertisingManager1 interface > > it accepts it (does not give an error) but does not register the data > > and I see no advertisement appear. Is there somewhere I can find a > > more detailed description of what needs to be on the > > org.bluez.LEAdvertisement1 interface that will work with > > RegisterAdvertisement? > > Do you have the bluetoothd output when you register, I get the > following when using bluetoothctl: > > bluetooth]# power on > Changing power on succeeded > [bluetooth]# advertise on > [CHG] Controller B8:8A:60:D8:17:D7 SupportedInstances: 0x04 > [CHG] Controller B8:8A:60:D8:17:D7 ActiveInstances: 0x01 > Advertising object registered > Tx Power: off > Name: off > Apperance: off > Discoverable: off > [bluetooth]# Using the new dbus library I get: Log from bluetoothctl: [CHG] Controller FC:F8:AE:8F:0C:A4 SupportedInstances: 0x04 [CHG] Controller FC:F8:AE:8F:0C:A4 ActiveInstances: 0x01 From the bluetoothd log: bluetoothd[2856]: src/advertising.c:register_advertisement() RegisterAdvertisement bluetoothd[2856]: src/advertising.c:client_create() Adding proxy for /ukBaz/bluezero/advertisement1 bluetoothd[2856]: src/advertising.c:register_advertisement() Registered advertisement at path /ukBaz/bluezero/advertisement1 bluetoothd[2856]: src/advertising.c:refresh_adv() Refreshing advertisement: /ukBaz/bluezero/advertisement1 bluetoothd[2856]: src/advertising.c:add_adv_callback() Advertisement registered: /ukBaz/bluezero/advertisement1 With the old pyton-dbus library (that is working) I get: log from bluetoothctl: [CHG] Controller FC:F8:AE:8F:0C:A4 SupportedInstances: 0x04 [CHG] Controller FC:F8:AE:8F:0C:A4 ActiveInstances: 0x01 From the bluetoothd log: bluetoothd[2856]: src/advertising.c:register_advertisement() RegisterAdvertisement bluetoothd[2856]: src/advertising.c:client_create() Adding proxy for /ukBaz/bluezero/advertisement0001 bluetoothd[2856]: src/advertising.c:register_advertisement() Registered advertisement at path /ukBaz/bluezero/advertisement0001 bluetoothd[2856]: src/advertising.c:parse_service_uuids() Adding ServiceUUID: FEAA bluetoothd[2856]: src/advertising.c:parse_service_data() Adding ServiceData for FEAA bluetoothd[2856]: src/advertising.c:refresh_adv() Refreshing advertisement: /ukBaz/bluezero/advertisement0001 bluetoothd[2856]: src/advertising.c:add_adv_callback() Advertisement registered: /ukBaz/bluezero/advertisement0001 > > bluetoothd[6103]: src/advertising.c:client_create() Adding proxy for > /org/bluez/advertising > bluetoothd[6103]: src/advertising.c:register_advertisement() > Registered advertisement at path /org/bluez/advertising > bluetoothd[6103]: src/advertising.c:refresh_adv() Refreshing > advertisement: /org/bluez/advertising > bluetoothd[6103]: src/advertising.c:add_adv_callback() Advertisement > registered: /org/bluez/advertising > > > > For reference, I have put below what I am currently putting on the > > org.bluez.LEAdvertisement1 interface. > > > > Thanks, > > Barry > > > > > > $ busctl call ukBaz.bluezero /ukBaz/bluezero/advertisement1 > > org.freedesktop.DBus.ObjectManager GetManagedObjects > > a{oa{sa{sv}}} 1 "/ukBaz/bluezero/advertisement1" 5 > > "org.freedesktop.DBus.Properties" 0 > > "org.freedesktop.DBus.Introspectable" 0 "org.freedesktop.DBus.Peer" 0 > > "org.freedesktop.DBus.ObjectManager" 0 "org.bluez.LEAdvertisement1" 6 > > "Type" s "broadcast" "ServiceUUIDs" as 0 "ManufacturerData" a{sv} 0 > > "SolicitUUIDs" as 0 "ServiceData" a{sv} 1 "FEAA" ay 18 16 8 3 117 107 > > 66 97 122 46 103 105 116 104 117 98 46 105 111 "IncludeTxPower" b > > false > > Not sure if that is the problem but usually ObjectManager is suppose > to be on the '/' (root) path. Good point. It is not clear (to me anyway) exactly what the requirement is from reading the spec https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager I have moved the object manager to the root (/) but this does not seem to have changed anything. $ busctl call ukBaz.bluezero / org.freedesktop.DBus.ObjectManager GetManagedObjects a{oa{sa{sv}}} 1 "/ukBaz/bluezero/advertisement1" 4 "org.freedesktop.DBus.Properties" 0 "org.freedesktop.DBus.Introspectable" 0 "org.freedesktop.DBus.Peer" 0 "org.bluez.LEAdvertisement1" 6 "Type" s "broadcast" "ServiceUUIDs" as 0 "ManufacturerData" a{sv} 0 "SolicitUUIDs" as 0 "ServiceData" a{sv} 1 "FEAA" ay 18 16 8 3 117 107 66 97 122 46 103 105 116 104 117 98 46 105 111 "IncludeTxPower" b false > > > $ busctl call ukBaz.bluezero /ukBaz/bluezero/advertisement1 > > org.freedesktop.DBus.Properties GetAll s org.bluez.LEAdvertisement1 > > a{sv} 6 "Type" s "broadcast" "ServiceUUIDs" as 0 "ManufacturerData" > > a{sv} 0 "SolicitUUIDs" as 0 "ServiceData" a{sv} 1 "FEAA" ay 18 16 8 3 > > 117 107 66 97 122 46 103 105 116 104 117 98 46 105 111 > > "IncludeTxPower" b false > > Using the d-feet application I did a GetAll on the advertisements and the data looks identical for both Using the new DBus library: {'IncludeTxPower': False, 'ManufacturerData': {}, 'ServiceData': {'FEAA': [16, 8, 3, 117, 107, 66, 97, 122, 46, 103, 105, 116, 104, 117, 98, 46, 105, 111]}, 'ServiceUUIDs': ['FEAA'], 'SolicitUUIDs': [], 'Type': 'broadcast'} Using the old Python-dbus library: {'IncludeTxPower': False, 'ServiceData': {'FEAA': [16, 8, 3, 117, 107, 66, 97, 122, 46, 103, 105, 116, 104, 117, 98, 46, 105, 111]}, 'ServiceUUIDs': ['FEAA'], 'Type': 'broadcast'} > > $ busctl call ukBaz.bluezero /ukBaz/bluezero/advertisement1 > > org.freedesktop.DBus.Introspectable Introspect > > s " > Introspection 1.0//EN\"\n > > \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n\n\n > name=\"org.freedesktop.DBus.Properties\">\n \n > > \n > > \n > type=\"v\" name=\"value\" direction=\"out\"/>\n \n > > \n > name=\"interface_name\" direction=\"in\"/>\n > name=\"properties\" direction=\"out\"/>\n \n > name=\"Set\">\n > direction=\"in\"/>\n > direction=\"in\"/>\n > direction=\"in\"/>\n \n > name=\"PropertiesChanged\">\n > name=\"interface_name\"/>\n > name=\"changed_properties\"/>\n > name=\"invalidated_properties\"/>\n \n \n > > \n > name=\"Introspect\">\n > direction=\"out\"/>\n \n \n > name=\"org.freedesktop.DBus.Peer\">\n \n > > \n > name=\"machine_uuid\" direction=\"out\"/>\n \n > > \n > name=\"org.freedesktop.DBus.ObjectManager\">\n > name=\"GetManagedObjects\">\n > name=\"object_paths_interfaces_and_properties\" direction=\"out\">\n > > \n \n \n > > \n \n > type=\"a{sa{sv}}\" name=\"interfaces_and_properties\">\n \n > > \n \n > type=\"o\" name=\"object_path\">\n \n > name=\"interfaces\">\n \n \n \n > > \n > name=\"org.freedesktop.DBus.Properties.PropertiesChanged\" > > value=\"const\">\n \n \n > > > value=\"true\">\n \n \n > type=\"s\" name=\"Type\" access=\"read\">\n \n > > \n > > \n > access=\"read\">\n \n > name=\"SolicitUUIDs\" access=\"read\">\n \n > type=\"a{sv}\" name=\"ServiceData\" access=\"read\">\n > > \n > access=\"read\">\n \n \n\n" > > > > -- > Luiz Augusto von Dentz