Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4426144pxb; Tue, 10 Nov 2020 16:38:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKIM4GbmIwCljUE7ptoLGw03/7xHCk+aJMzgYr9rNIg5m3EMgiTnfmvEXNDm59bIkYYq1Z X-Received: by 2002:a50:cc48:: with SMTP id n8mr2257383edi.137.1605055125548; Tue, 10 Nov 2020 16:38:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605055125; cv=none; d=google.com; s=arc-20160816; b=zPrb5Q21fhk9GgGllZvQc1veiBWMPnSiVTBn5YviQetTzMQQ6vi3R6vOzLt4WDI5ai KVoDUzBYjYMZZZTsnMGMDlg0P+VuRzko2PYTgsZIXxmP0XoekFiOJnESGohEXioBlhEY I/C1ZA+MZrCKsDipe82B41ofDEXe6l4CMq3FaKlQDk7M+oDKrFHB7QdWohsXMCPL4uq9 iXYxcxFk9JCMhbTVgCr7Wc2vy4rQc1BgG670Uq6Lo1ghahQp6ChB8sTF6DwFTUr3CnFv oqaGlos0Jp7xioIUMLMNM98onCy23d3SqJE2+HzMsLhw5ldyzIinptsw1adGhFoHZpJc SYHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=9hRqRMyL+AzvEMmu5hr5eKBiDaSSQBxLBJXxmPAp2yE=; b=fAefND1B/pC9sDpbv6jzFB5z7JI4/NGxre8FZRv0l2vraXmzyHGAL6Or4rKrE4g3Fe 1tDylY7o3SkRJ7HFcd/3IyYeI56k4oLjTnxqHscKPGKt4NgGYTxHCjgT9/vjP6KcJjka 7G2dSB7NWA0iZK/kDjxBGz5j7GHlIULuPwackusoRH2pjJHMtoVFijjeQ9mnL9lHobkw /3D7jGp6TyK1GsBqV7V2b5R1uep0sc4HJvrkW2WWPC2ZXEjCEzUVSnXocHj7tuvbg+xH s51uA9gO29FQzlGKyqLIoMG3exI+8FW6Pn0n4QCWv/2aws26xW3BHvZjFXixsef2BIaQ UAYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ObqqyTR7; 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 f22si290770edx.179.2020.11.10.16.38.01; Tue, 10 Nov 2020 16:38:45 -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=ObqqyTR7; 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 S1732233AbgKKAhk (ORCPT + 99 others); Tue, 10 Nov 2020 19:37:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732213AbgKKAhj (ORCPT ); Tue, 10 Nov 2020 19:37:39 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E3D0C0613D1 for ; Tue, 10 Nov 2020 16:37:38 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id q10so468003pfn.0 for ; Tue, 10 Nov 2020 16:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9hRqRMyL+AzvEMmu5hr5eKBiDaSSQBxLBJXxmPAp2yE=; b=ObqqyTR74lUG1ZoeuL13SS0+REKbyD8yMSSSvf/2hKJ+dZbwfvy8DA8c1nxy5ZiSOu KiaNpe7O+kJ9RisFgJPv636YLTNjhXCnSwjIuzsGd/g2gCVH5Ayxzz7iecsBvTUYXXko 4IXcXcLfotQanJ6T0PfSGbRs4i71zYoD4gx9o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9hRqRMyL+AzvEMmu5hr5eKBiDaSSQBxLBJXxmPAp2yE=; b=J73udS2yVOKuuPF6yn6Z7W1xLSv4djKCsrGpxlEfBmto28vVbIvSsj7PdKy2s08mzn cjfoGddhz3ODqgZ4RjyX6ebt82OpZzJdMbUTW2YR2o6oO7AJe1rgnLp+OwNwhesWXsHW rZ4H+VF1zIM5y03sTcwgC8JUx+qPl4jTJD+ZNz/MpNtoJXmdJtxgpm6w5QbFOa+u0upR lQZm5nxVPmepq+7FXrFZnc8Q2IxYBEuEIQOlQeP+m9fN3oH1IVsYoWUeKh+48nqlwmHz +SC1MQuInvTQsX7TZqbgPQJH4ViSnMqGPc5Ft893mx3yJLKuRCGrin7a8yV9CfK6Jzny zVoQ== X-Gm-Message-State: AOAM532ReUZ4QLr/TzYh7xbT4Kc6Z+Clwqd/gdab8Wn905VaAyUC34UF PZ+hNShdWP2YXB/a42XpiNQ8egnu9hxZOw== X-Received: by 2002:a17:90b:784:: with SMTP id l4mr916731pjz.146.1605055057746; Tue, 10 Nov 2020 16:37:37 -0800 (PST) Received: from sonnysasaka-chrome.mtv.corp.google.com ([2620:15c:202:201:4a0f:cfff:fe66:e60c]) by smtp.gmail.com with ESMTPSA id b16sm180655pju.16.2020.11.10.16.37.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2020 16:37:37 -0800 (PST) From: Sonny Sasaka To: linux-bluetooth@vger.kernel.org Cc: Sonny Sasaka Subject: [PATCH BlueZ 0/7] Battery Provider API Date: Tue, 10 Nov 2020 16:37:13 -0800 Message-Id: <20201111003720.1727-1-sonnysasaka@chromium.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi BlueZ Maintainers, This is a patch series that introduces Battery Provider API, a means for external clients to feed battery reporting to BlueZ if they can decode it from a profile/protocol. A sample use case would be for HFP handlers (e.g. pulseaudio commonly in Linux system or CRAS in Chrome OS) that has the battery information reported via HFP extensions. This patch series also refactors the existing battery API to be split into internal API rather than GATT BAS specific. This way internal plugins can also make use of convenient functions to reliable register battery objects. The battery information is then exposed via the existing Battery1 API. Many UI components already consume this so they will be able to display many Bluetooth peripherals' battery information via a unified BlueZ API. Sonny Sasaka (7): battery: Add the internal Battery API profiles/battery: Refactor to use battery library battery: Add Source property to Battery API doc: Add Battery Provider API doc test: Add test app for Battery Provider API adapter: Add a public function to find a device by path battery: Implement Battery Provider API Makefile.am | 3 +- doc/battery-api.txt | 55 ++++ profiles/battery/battery.c | 52 +-- src/adapter.c | 44 ++- src/adapter.h | 2 + src/battery.c | 580 ++++++++++++++++++++++++++++++++++ src/battery.h | 22 ++ test/example-battery-provider | 230 ++++++++++++++ 8 files changed, 942 insertions(+), 46 deletions(-) create mode 100644 src/battery.c create mode 100644 src/battery.h create mode 100755 test/example-battery-provider -- 2.26.2