Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp25565pxu; Tue, 24 Nov 2020 17:22:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlZ0Y446gk6vQiFoBEV6FJXtVT7YJ8efaiuyugHBU6xJyEUwgXeLqHW743qQ5vMZ9Mpllk X-Received: by 2002:a50:d745:: with SMTP id i5mr828664edj.166.1606267346829; Tue, 24 Nov 2020 17:22:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606267346; cv=none; d=google.com; s=arc-20160816; b=R8af59+L6dGJ1YWyi0M5pDY07KVZ+xGVROIVzkZp6g3T3Pa1UuuUixp+tKEmZvXaIC p2uQCSt2dPFY49qvnCI6ujIoaZV35n/5iNTPfeDEJ4GQWWkkRDhhvDQQm8njhNiYjIUS Be6ED1H1N4PYO4SxO86uhlUP6vmNpFcH5/EI/YFCGXfM3w0u9PvDfzZcWMcpYcLZGT2P LeBMHSnu0Bm23ZNi529SXITZREVY08DbPsdOQn6J5tZE2vE1lcs1Fxs5UUMQlmNscrWk 9Dgwvi0E9JBKCUM9rfRUvIXbhhu54WCVza/MIrne3pV+hO88OFa1AFLSyaoIaznAEcYq 547g== 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=L/Rdk0yma2bzgHMN56uxJpn0cv1FtkE/KGIxIAbRABI=; b=Wlk8r8ggEpz7xxJcAj09GB3C2n5TCOJXFdt94uzfBhcAULPkzgNPd/LEfC1i28NWkX 2d+JMZnjn6imBWpFbXyHfaf1QWJJNoQYXIz3Oo4y7CzJkBe+ZM4lliDy6svEDmBtsJFw 4kOGwh26TCDhRInw/dmjLZXIyzfIt2c2yBDXn5Bh7W8f0Tb57X8vIq3Hevi39XygAzkA zIBymxI2AUcpeC3AizoOuipQEBL4gtj/OMd6wG3VxzBzyDf6pXtPJ/oL6kdxZJqhTdlX Jbry2R5MTFkwmTNcEOeQ6xWC0gX1/heDx9Jzp5MtUto0/lLxiiFTKgNhCe8nglb4A4VU Tt1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="RV462q/c"; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ok23si387296ejb.243.2020.11.24.17.22.03; Tue, 24 Nov 2020 17:22:26 -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=@chromium.org header.s=google header.b="RV462q/c"; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727900AbgKYBUy (ORCPT + 99 others); Tue, 24 Nov 2020 20:20:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727692AbgKYBUy (ORCPT ); Tue, 24 Nov 2020 20:20:54 -0500 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E95C4C0613D4 for ; Tue, 24 Nov 2020 17:20:53 -0800 (PST) Received: by mail-ed1-x544.google.com with SMTP id d17so43796edq.2 for ; Tue, 24 Nov 2020 17:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L/Rdk0yma2bzgHMN56uxJpn0cv1FtkE/KGIxIAbRABI=; b=RV462q/cqNaSe34Z3c2fD45UIAgRJCzodPZZaXatTLGRQyFTIiEx6E3BmvGQelk9Ay TFT/pxPcam5JZnRO2gF7NONqEwvLDkaFDcolN+hd9vQqwtA/Mtb3ZnRqp3M5gD07e7hA b3TDbIcioYu/WjWrbzOJz7Be+ADugvkcL1I+c= 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=L/Rdk0yma2bzgHMN56uxJpn0cv1FtkE/KGIxIAbRABI=; b=RoQprJgrcEQWO3Baft1+9KHqY54HWxygOsVLc2rk2TGRQVEoaEYQs3Sw6CmqPkBYeu /i75kScfZwv4yNvtCEe4HozcjgYg+dYMdQKTaFKEVtlBk6R3h/96Gw4MGGvu3oZFzAgN 8Le6p52o3N3BJK0WJ3x84u9t/PivXQfl1R2KeJwgHzUMgLCSO1tmJGxAch7yz6ObYKkc Yx2JcLXpanOY33DnFPOxqwkU4DHZEyWXL+kFqLaTPhg20bwII0eN+tVPKa7G7TUZvBzE 6kVFyK1Ijz/PGlCNP8SYOv3B+ASxVpXBNeX3lru/sxhpMavHZR1nJiE4VbqmyKupBw1W qTsQ== X-Gm-Message-State: AOAM530lTgqNuzMc5HQOgvs3IIqubtPXb8BU8716LqvWTU20ADWw67l+ xztb3cUuknYDpG/OjpEEG7YTBWEvNHgv8A== X-Received: by 2002:aa7:dd0d:: with SMTP id i13mr1292173edv.174.1606267252232; Tue, 24 Nov 2020 17:20:52 -0800 (PST) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com. [209.85.128.53]) by smtp.gmail.com with ESMTPSA id j7sm330107ejk.14.2020.11.24.17.20.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Nov 2020 17:20:51 -0800 (PST) Received: by mail-wm1-f53.google.com with SMTP id a186so620900wme.1 for ; Tue, 24 Nov 2020 17:20:51 -0800 (PST) X-Received: by 2002:a1c:6306:: with SMTP id x6mr1132050wmb.154.1606267250864; Tue, 24 Nov 2020 17:20:50 -0800 (PST) MIME-Version: 1.0 References: <20201120205728.339325-1-sonnysasaka@chromium.org> <20201120205728.339325-4-sonnysasaka@chromium.org> In-Reply-To: From: Sonny Sasaka Date: Tue, 24 Nov 2020 17:20:39 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH BlueZ v3 4/7] doc: Add Battery Provider API doc To: Luiz Augusto von Dentz 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 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). > > > > > > > > + > > > > +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