Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4621306ybz; Tue, 28 Apr 2020 15:03:42 -0700 (PDT) X-Google-Smtp-Source: APiQypKmiz4YFD8GT2o2yKigyOTStqvvKjGNmh3DSM2WVLyRfw5SG1E5fVyQPSv8BCXmxCU3Rf8p X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr23643490edy.182.1588111422383; Tue, 28 Apr 2020 15:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588111422; cv=none; d=google.com; s=arc-20160816; b=DcO/6IfCZwxCy9RhnnJA7/lAtWT2hBNFsSomqAOb4H2Wl6hrlWQx3yjg1jmM4X1+yV Gr5Wl7KiQ2vMY5In5aPnyJ4HxwKOLqkfzz3RK0A/uNmTLZXcyXJEgPGRtW2CTspukZpl 27uggAJWjkD47S5PPQSTZawunfPwAMd7XM5rHZRKEtmMwb8KhVjj867Ih0iKrG7p4oVb z7mo8THSHu5wUm9g8iDANx6/zaCbEuNFmRpREmEBDJOgWqFprhs5MtuKNUhw87rvBk+v tdW3ONlmnhknzeFkYbBdwEuBhaEcNZfSCjG/Im48nwqXJi3O6LPPtpWlNkenunJAbHYC cDug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iSi7aTQiGBFWtl/N3/RLyQibHZcuchs5ZvLVr2t+HMo=; b=m4RNnDFiQu3tQ0UIrMYpFF0vlQDtrnclgYHLSS4D6K/ncA/ciOH2t45IYBgW1EihQ+ cq7Vldo1eHnLwR7v6hayw7/04BLOvzgMZfutSbh41dj5U5yAIVrRZFltMEe/CEl898qb uiE0fAXgKaV4oHH5guRSx5mWa1URntacizExurt6/YFZDwBOBiCtNC81qyViGNJWF0b+ lwjpX3noR+kP+TBccrM9Du4vER0vhog+cbh+8LsClG8qomlnwFGTOwEoX+rw1OweDiYI l2NNAqaGFwyckTBxR+F7p/PFpHehh2IEBEcAg6Y3IkzfzVpViZgFEwqZbzKLdy/+my1c yThQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=g8Sly55F; 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 n12si2556201edo.392.2020.04.28.15.02.52; Tue, 28 Apr 2020 15:03:42 -0700 (PDT) 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=g8Sly55F; 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 S1726357AbgD1WCj (ORCPT + 99 others); Tue, 28 Apr 2020 18:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726355AbgD1WCj (ORCPT ); Tue, 28 Apr 2020 18:02:39 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4FEC03C1AC for ; Tue, 28 Apr 2020 15:02:38 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id f8so18121169lfe.12 for ; Tue, 28 Apr 2020 15:02:38 -0700 (PDT) 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=iSi7aTQiGBFWtl/N3/RLyQibHZcuchs5ZvLVr2t+HMo=; b=g8Sly55FBb6gRbW4Vr4PsoSkm3ZW4YDr9GtWLEDSFU16lMSaGO9FvErZm4kAJZqHOB Jb0rh1k9AWVNGXSNaL5+Oqrgl3vN1GP9Yv+aVmRrjm6ELKfpDKlGw1zU0BWZ1VdkpDxt UsGXV3vjXGDzQhp4lNDlbqiZpRyUDIrIcO2cI= 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=iSi7aTQiGBFWtl/N3/RLyQibHZcuchs5ZvLVr2t+HMo=; b=m878eg2LKFvFPSDWC/G+lHn9JewzEwE+pkAnN0kAdVlMx2NnthAZYAunITp/uPks+g 42NIF61ue1D5lVXQTcrvqD2n/Wn0lXdTdz/ayfnOK5y6KktlhBzHHCKsevhtpNZ3lhny /rQAtzQtEoCtqKIYY9EU8/RzSFcoU23wEFbP493PkcLf8kUHaWHxkrIo2PaIBytp1cjC fA2fOP1g1P6jJrGOP+HQPXiQEdEMc32/pvYLqxcqMK29uhwwXSJBxcY0fc7KPzSG4QYb bij/VuFEqFkVoAUOEji/C7wALHyA34Ap1CDSVdZYSUCJTR3M7Ofh40Fb5DAh8R0+S3/g UgqA== X-Gm-Message-State: AGi0Pua/oTiEC/Em6V695Qo96pTiZ1+xSKDTnzy00c7VBfkIyxPk9lyI 7ZeabMP6bS0JYg8AVRR5tUGNNup5DtMIGpD6S/kRIg== X-Received: by 2002:ac2:569b:: with SMTP id 27mr20694044lfr.134.1588111355781; Tue, 28 Apr 2020 15:02:35 -0700 (PDT) MIME-Version: 1.0 References: <20200427131208.BlueZ.v4.1.I137a529ab03c9d0d2327f1659bd1af4954a28e78@changeid> In-Reply-To: From: Miao-chen Chou Date: Tue, 28 Apr 2020 15:02:24 -0700 Message-ID: Subject: Re: [BlueZ PATCH v4] doc: Add Advertisement Monitoring API To: Luiz Augusto von Dentz Cc: Bluetooth Kernel Mailing List , Michael Sun , Luiz Augusto von Dentz , Marcel Holtmann , Yoni Shavit , Alain Michaud 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 Great! Thank you so much. On Mon, Apr 27, 2020 at 2:38 PM Luiz Augusto von Dentz wrote: > > Hi Miao, > > On Mon, Apr 27, 2020 at 1:16 PM Miao-chen Chou wrote: > > > > This patch proposes an Advertisement Monitoring API for an application to > > register a job of monitoring ADV reports with content filter and RSSI > > thresholds. > > --- > > > > Changes in v4: > > - Change the signature of SupportedMonitorTypes to be array of strings. > > - Fix document formatting. > > > > Changes in v3: > > - Introduce SupportedFeatures to reflect the features based on > > controller's capabilities. > > - Modify SupportedMonitorTypes to list available types of monitors. > > > > Changes in v2: > > - Rename the interfaces and functions. > > - Adopt the object manager mechanism so that a client can expose > > multiple monitor objects and expect to get notified on whether the > > monitor has been activated or not. > > - Change the contract of DeviceFound so that it is called to indicate > > the starting point of monitoring on a device instead of reporting every > > ADV. In other words, the client is expected to monitor corresponding > > device events. > > > > doc/advertisement-monitor-api.txt | 137 ++++++++++++++++++++++++++++++ > > 1 file changed, 137 insertions(+) > > create mode 100644 doc/advertisement-monitor-api.txt > > > > diff --git a/doc/advertisement-monitor-api.txt b/doc/advertisement-monitor-api.txt > > new file mode 100644 > > index 000000000..012fce420 > > --- /dev/null > > +++ b/doc/advertisement-monitor-api.txt > > @@ -0,0 +1,137 @@ > > +BlueZ D-Bus Advertisement Monitor API Description > > +************************************************* > > + > > +This API allows an client to specify a job of monitoring advertisements by > > +registering the root of hierarchy and then exposing advertisement monitors > > +under the root with filtering conditions, thresholds of RSSI and timers > > +of RSSI thresholds. > > + > > +Once a monitoring job is activated by BlueZ, the client can expect to get > > +notified on the targeted advertisements no matter if there is an ongoing > > +discovery session (a discovery session is started/stopped with methods in > > +org.bluez.Adapter1 interface). > > + > > +Advertisement Monitor hierarchy > > +=============================== > > +Service org.bluez > > +Interface org.bluez.AdvertisementMonitor1 [experimental] > > +Object path freely definable > > + > > +Methods void Release() [noreply] > > + > > + This gets called as a signal for a client to perform > > + clean-up when (1)a monitor cannot be activated after it > > + was exposed or (2)a monitor has been deactivated. > > + > > + void Activate() [noreply] > > + > > + After a monitor was exposed, this gets called as a > > + signal for client to get acknowledged when a monitor > > + has been activated, so the client can expect to receive > > + calls on DeviceFound() or DeviceLost(). > > + > > + void DeviceFound(object device) [noreply] > > + > > + This gets called to notify the client of finding the > > + targeted device. Once receiving the call, the client > > + should start to monitor the corresponding device to > > + retrieve the changes on RSSI and advertisement content. > > + > > + void DeviceLost(object device) [noreply] > > + > > + This gets called to notify the client of losing the > > + targeted device. Once receiving this call, the client > > + should stop monitoring the corresponding device. > > + > > +Properties uint8 Type [read-only] > > + > > + The type of the monitor. See SupportedMonitorTypes in > > + org.bluez.AdvertisementMonitorManager1 for the available > > + options. > > + > > + (Int16, Uint16, Int16, Uint16) RSSIThreshholdsAndTimers [read-only, optional] > > + > > + This contains HighRSSIThreshold, HighRSSIThresholdTimer, > > + LowRSSIThreshold, LowRSSIThresholdTimer in order. The > > + unit of HighRSSIThreshold and LowRSSIThreshold is dBm. > > + The unit of HighRSSIThresholdTimer and > > + LowRSSIThresholdTimer is second. > > + > > + If these are provided, RSSI would be used as a factor to > > + notify the client of whether a device stays in range or > > + move out of range. A device is considered in-range when > > + the RSSIs of the received advertisement(s) during > > + HighRSSIThresholdTimer seconds exceed HighRSSIThreshold. > > + Likewise, a device is considered out-of-range when the > > + RSSIs of the received advertisement(s) during > > + LowRSSIThresholdTimer do not reach LowRSSIThreshold. > > + > > + array{(uint8, uint8, string)} Patterns [read-only, optional] > > + > > + If Type is set to 0x01, this must exist and has at least > > + one entry in the array. > > + > > + The structure of a pattern contains the following. > > + uint8 start_position > > + The index in an AD data field where the search > > + should start. The beginning of an AD data field > > + is index 0. > > + uint8 AD_data_type > > + See https://www.bluetooth.com/specifications/ > > + assigned-numbers/generic-access-profile/ for > > + the possible allowed value. > > + string content_of_pattern > > + This is the value of the pattern. > > + > > +Advertisement Monitor Manager hierarchy > > +======================================= > > +Service org.bluez > > +Interface org.bluez.AdvertisementMonitorManager1 [experimental] > > +Object path /org/bluez/{hci0,hci1,...} > > + > > +Methods void RegisterApplication(object application) > > + > > + This registers a hierarchy of advertisement monitors. > > + The application object path together with the D-Bus > > + system bus connection ID define the identification of > > + the application registering advertisement monitors. > > + > > + Possible errors: org.bluez.Error.InvalidArguments > > + org.bluez.Error.AlreadyExists > > + > > + void UnregisterApplication(object application) > > + > > + This unregisters advertisement monitors that have been > > + previously registered. The object path parameter must > > + match the same value that has been used on > > + registration. > > + > > + Possible errors: org.bluez.Error.InvalidArguments > > + org.bluez.Error.DoesNotExist > > + > > +Properties array{string} SupportedMonitorTypes [read-only] > > + > > + This lists the supported types of advertisement > > + monitors. An application should check this before > > + instantiate and expose an object of > > + org.bluez.AdvertisementMonitor1. > > + > > + Possible values for monitor types: > > + > > + "patterns_with_logic_or" > > + Patterns with logic OR applied. With this type, > > + property "Patterns" must exist and has at least > > + one pattern. > > + > > + array{string} SupportedFeatures [read-only] > > + > > + This lists the features of advertisement monitoring > > + supported by BlueZ. > > + > > + Possible values for features: > > + > > + "controller-based-monitor-by-patterns" > > + If the controller is capable of performing > > + advertisement monitoring by patterns, BlueZ > > + would offload the patterns to the controller to > > + reduce power consumption. > > -- > > 2.24.1 > > Applied, thanks, note that I did change the Type to be string as well > so we is consistent with SupportMonitorTypes. > > -- > Luiz Augusto von Dentz