Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2614192pxu; Sat, 28 Nov 2020 22:18:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuC/ZexGi5G2E5elv6wJz2DOkxHAM4pPT8nYYx3+1gLyymE0txv6zOGBtPuZx7MMqZoU1C X-Received: by 2002:a50:fe8d:: with SMTP id d13mr9718833edt.132.1606630718384; Sat, 28 Nov 2020 22:18:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606630718; cv=none; d=google.com; s=arc-20160816; b=Y+zLKQUSYmPzaqWSb7sRgoQLm5yhlEDZDW7CwjfrBpeCdwdGaMdyoSHX82AFVbMM3C nz5Vrf+cO1QxQ/0WTMpZjomA6YALVGaTnMPmGVbpCj5rCt7YjghnGtVRxTBrYXSYMcfF GN4VL/IckXUcpxi2eUVLJZBdmUYbMo+vxNe8/6nusc+fCcw6nFUCeoFwEFjIZMmwSt7c FnERnMmXc7rQN4RkD3bkGQy/98TpEZfhvTQesA5APlEAHMTVuzntGLAKj6Xt2BFbNQM3 jcWYoq1TF8tRsIlDHSBPReQ4oryAZZxGpyRbPBKo0YaPECx+0vgJb0w9bIfNvUFNkLMV 4QUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7eW9bminp0OEtkTFQbMi/Ec/im3FG0PCM9L6gMU2DBg=; b=H/U9qbf79AmNWj6mpjYDQ3SzqeQbJ/J2XVwiEHQbrH4BZcB4o+Qvy4AW3OHPonGRHI uAEvIt3QjC9513WbmapnYOqawjG0j0RcvZYd9aYDROyFtS60g3sXREDORJo0QiIytUux viBs+bGseW7e3FIztbS5o3Qiqtz/kZOmsGVWum2uFb04SNsdBq8I0cHincdadlh1T1mS +nTCLE9osQiJkWi8jslHHTvASCWKzOsXqdFrhZjRp3cKFPAstGXwDt3owrM6R3xhHd5+ A2eR6ekp19S7FhTMMtCuPCF0rPYoyRdOPDM23aXbfP/XTtDLWkbIyC4iQbjyfno3b0OX Yu5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IWPQJOY/"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id ks8si3090838ejb.478.2020.11.28.22.18.00; Sat, 28 Nov 2020 22:18:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="IWPQJOY/"; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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 S1725852AbgK2GQ4 (ORCPT + 99 others); Sun, 29 Nov 2020 01:16:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725849AbgK2GQz (ORCPT ); Sun, 29 Nov 2020 01:16:55 -0500 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68E3DC0613D1 for ; Sat, 28 Nov 2020 22:16:15 -0800 (PST) Received: by mail-ot1-x335.google.com with SMTP id n11so8393101ota.2 for ; Sat, 28 Nov 2020 22:16:15 -0800 (PST) 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 :cc; bh=7eW9bminp0OEtkTFQbMi/Ec/im3FG0PCM9L6gMU2DBg=; b=IWPQJOY/FmKOxfL7I1KNYLUql8NLT6k3hEdFjr60HbjRVmx7/GlczoIV9TDdsZne7Q 62eEQy6DVMzHqjjvOQ2Jp3ir/WPrF5smbSJMHyRXx3pHmqMJx2tFYZxjAqIjgtaV/w2A 9UDNFDhxpZDrVIKyIaV4ESzz76UTrQLa3fw8C2JpgBzyTX5iQkktn0ZXKPYYFBxVd4Hi 91lgDb5AzqE91Zq8tAp68WqvjCfciLyvjs7IJJ6cQAmdJVMvTzQgX3iqwyK0nIR+9qzG jdv5m11FAMiE6XZNgA2HGPHR1Zn1u+Kh6Fl1yiYM80tD8WhdBUe4jd93GSt8JhxsLWY0 M29g== 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:cc; bh=7eW9bminp0OEtkTFQbMi/Ec/im3FG0PCM9L6gMU2DBg=; b=nqLTKZN38v9wmPwdvAPYavpY5KKI83g9HQWNsq0ieRQPDBTE9QeW0zPWOdQqYUvNkk VOy3Vbdzz164BmL6OFuLh7yq0NFWKmMTIHDDp2Us04zDuO5LEjDs6E3UReRbdtspbnjG l0ejFK3ZRkgz24MBtRc+qViipcsfrAlbb/A5wJj+Tn0J8HCzd6+U+0xU2ZZelDyLf6cR cve9JTJ1qpKtTur3vn66FBtIV+HW2oiEPQmm2b0bU21b82gBUaVYVJByJ0leBCUYH3YY tnqHiMJWBCMjmp/msxwlD49zPzXx8/aEgRewFNEMh/ln/XXvCuWvRkTRYOMpBDsE39OV SRFg== X-Gm-Message-State: AOAM5333fJeMtYBdt5gjrChTe5LW0XVVUxCPWEMVtQ80Gk2Y9HTo1cvf Jn87O0EsGVbZ2yoHIAwxIU2bGZ3LlZ2i+z5Yeozg/35P X-Received: by 2002:a9d:4b81:: with SMTP id k1mr12378089otf.371.1606630574512; Sat, 28 Nov 2020 22:16:14 -0800 (PST) MIME-Version: 1.0 References: <20201120205728.339325-1-sonnysasaka@chromium.org> <20201120205728.339325-4-sonnysasaka@chromium.org> In-Reply-To: From: Luiz Augusto von Dentz Date: Sat, 28 Nov 2020 22:16:03 -0800 Message-ID: Subject: Re: [PATCH BlueZ v3 4/7] doc: Add Battery Provider API doc To: Sonny Sasaka Cc: "linux-bluetooth@vger.kernel.org" , Miao-chen Chou Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sonny, On Tue, Nov 24, 2020 at 5:20 PM Sonny Sasaka wrote: > > Hi Luiz, > > On Tue, Nov 24, 2020 at 4:23 PM Luiz Augusto von Dentz > wrote: > > > > Hi Sonny, > > > > On Tue, Nov 24, 2020 at 1:30 PM Sonny Sasaka wrote: > > > > > > Hi Luiz, > > > > > > > > > On Tue, Nov 24, 2020 at 1:21 PM Luiz Augusto von Dentz > > > wrote: > > > > > > > > Hi Sonny, > > > > > > > > On Fri, Nov 20, 2020 at 1:00 PM Sonny Sasaka wrote: > > > > > > > > > > This patch add the documentation of the Battery Provider which lets > > > > > external clients feed battery information to BlueZ if they are able to > > > > > decode battery reporting via any profile. BlueZ UI clients can then use > > > > > the org.bluez.Battery1 API as a single source of battery information > > > > > coming from many different profiles. > > > > > > > > > > Reviewed-by: Miao-chen Chou > > > > > > > > > > --- > > > > > Changes in v3: > > > > > * Remove doc duplication in BatteryProvider1 and mention that it's the > > > > > same as Battery1 instead. > > > > > * Suggest profile UUID in Source property. > > > > > > > > > > doc/battery-api.txt | 49 +++++++++++++++++++++++++++++++++++++++++++++ > > > > > 1 file changed, 49 insertions(+) > > > > > > > > > > diff --git a/doc/battery-api.txt b/doc/battery-api.txt > > > > > index dc7dbeda2..b5c9a7be1 100644 > > > > > --- a/doc/battery-api.txt > > > > > +++ b/doc/battery-api.txt > > > > > @@ -12,3 +12,52 @@ Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX > > > > > Properties byte Percentage [readonly] > > > > > > > > > > The percentage of battery left as an unsigned 8-bit integer. > > > > > + > > > > > + string Source [readonly, optional, experimental] > > > > > + > > > > > + Describes where the battery information comes from > > > > > + This property is informational only and may be useful > > > > > + for debugging purposes. > > > > > + Providers from BatteryProvider1 may make use of this > > > > > + property to indicate where the battery report comes from > > > > > + (e.g. "HFP 1.7", "HID", or the profile UUID). > > > > > > > > We might need to remove the version number here since there is no > > > > equivalent on UUID, in fact friendly names may be a bad idea after all > > > > since for new profiles we may not have a friendly name to do the > > > > translation and since this is property that would be hard to notify > > > > the provider that we don't understand what is the Source while UUIDs, > > > > if well formatted, should not have this problem so Id just get rid of > > > > the use of friendly names altogether and expect the Source to be a > > > > 128bits UUID in string format. > > > Ack. Will change to 128bit UUID format. > > > > > > > > > + > > > > > + > > > > > +Battery Provider Manager hierarchy > > > > > +================================== > > > > > +A battery provider starts by registering itself as a battery provider with the > > > > > +RegisterBatteryProvider method passing an object path as the provider ID. Then, > > > > > +it can start exposing org.bluez.BatteryProvider1 objects having the path > > > > > +starting with the given provider ID. It can also remove objects at any time. > > > > > +The objects and their properties exposed by battery providers will be reflected > > > > > +on org.bluez.Battery1 interface. > > > > > + > > > > > +BlueZ will stop monitoring these exposed and removed objects after > > > > > +UnregisterBatteryProvider is called for that provider ID. > > > > > + > > > > > +Service org.bluez > > > > > +Interface org.bluez.BatteryProviderManager1 [experimental] > > > > > +Object path /org/bluez/{hci0,hci1,...} > > > > > + > > > > > +Methods void RegisterBatteryProvider(object provider) > > > > > + > > > > > + This registers a battery provider. A registered > > > > > + battery provider can then expose objects with > > > > > + org.bluez.BatteryProvider1 interface described below. > > > > > > > > We should probably mention this expects an object implementing > > > > ObjectManaged in order to list the Battery1 provider. > > > Ack. Will add more explanation. > > > > > > > > > + void UnregisterBatteryProvider(object provider) > > > > > + > > > > > + This unregisters a battery provider. After > > > > > + unregistration, the BatteryProvider1 objects provided > > > > > + by this client are ignored by BlueZ. > > > > > + > > > > > + > > > > > +Battery Provider hierarchy > > > > > +========================== > > > > > + > > > > > +Service > > > > > +Interface org.bluez.BatteryProvider1 [experimental] > > > > > +Object path {provider_root}/org/bluez/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX > > > > > > > > If this is on the client the object path does not necessarily need to > > > > follow our object hierarchy. > > > We need a convention to match the exposed object by the battery > > > provider and BlueZ's device. I am suggesting that the simplest > > > convention is to use the same path of the BlueZ's device object, which > > > is easy to follow and implement by providers. Otherwise, we would > > > still need another convention to match them, but I think any other > > > convention is likely more complex to implement by battery providers. > > > Can you suggest an alternative convention to match the battery and the > > > device? > > > > I thought the objects would be registered directly on the device > > object itself but it looks like it is on the adapter thus why you need > > the device in the first place, but if you are using the object path it > > is just a matter of moving BatteryProviderManager1 to the device > > object. > If we move BatteryProviderManager1 to the device object, that means we > can't use the object manager style and providers have to register each > battery once rather than registering once in the beginning and expose > several objects afterwards, so this would lose your suggestion to use > object manager in the first place. I prefer we stick to using object > manager style, it is simple, easy to understand and implement for > providers (refer to my python test app in one of the patches in this > series). Well not really, you can still use the object manager style the only difference is that you will register on a per-device basis instead of per adapter, not every device is going to have battery providers but some can have multiple providers from different profiles, but I guess you were suggesting that one could register a single time per adapter so we don't have round trips of registration per device in which case then I would prefer to just have a property indicating the device object path, but note that if there are different entities handling different profiles each would have to register individually anyway. > > > > > > > > > > > + > > > > > +Properties Objects provided on this interface contain the same properties > > > > > + as org.bluez.Battery1 interface. > > > > > -- > > > > > 2.26.2 > > > > > > > > > > > > > > > > -- > > > > Luiz Augusto von Dentz > > > > > > > > -- > > Luiz Augusto von Dentz -- Luiz Augusto von Dentz