Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1012820ybz; Thu, 16 Apr 2020 00:50:25 -0700 (PDT) X-Google-Smtp-Source: APiQypJ2D4EUnW4F8QI6PDrTPcZlZPHzdDRccchq2336Kh4IHIYfgR0BwztnkxkOjXKSiXN+f76U X-Received: by 2002:aa7:d514:: with SMTP id y20mr2696870edq.28.1587023425531; Thu, 16 Apr 2020 00:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587023425; cv=none; d=google.com; s=arc-20160816; b=jYWQbhW0mBDRpXyhodcBzpNQoya0zDfrKay5y9uETBsmqJOMsW+7A3oTVApmev2IVe ZMTWFXdpiLJaKFVeahrN++FX3ltH6S4SH8G6PxT7AAzgwB+cFGVp94HtrKSucQuaQlve HfGTJpM179DXWx4ozgOXT0gJSfd+NC99buX3Mq544sKf+S/yrJMAWdhXyApc8gYfQPB+ 7NA5dmNrW6j/YxBltjTV9aCxXBNxfg9BVkwiMfLRzFRjoD4Kagr25i9Xg1njJC+zDe6+ Q501eiCuhpUp1aG03ps2FbbXytMVagr61BSh0wK1bngBlsc5s/XyW2yy5UFEdgC9iQ3n cX5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature; bh=PetXaBQAAP5AlhnkJpxvt9p7JmrT7o+CxrcKtSclo/s=; b=VYgaM13KAcZ711niWCRD1fvXlkCPyF1NN+6A8iLvIGajaU/vd1jPcCeclHxXM2CuRm DAXNEpirVYnmMrhOD8/hi82TGm/7KgirG9x1KzSy7nC5GSzD4vk/4ZeJCM+DjYYTTATq Tvn6GKZLu2ODMsdSnwefQjhSZW394kwM1yGPPyPgfH1POVIRTvensnml6itWQ1+4ORhu FW1zR7ZtXKlkHtvLF1CkcpcmfiZZJMeaA4W1DWJYFkUEX9B9V2U5pckl7rPCVwAgTS2T aa1eUZoF0fRVAM/0hHAevT9tFeOkkj0BK85kjrbCDZx9oodcvHcueVeu7CvWqYjGq1v3 ITxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b="Du/eCGQy"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce15si13666746edb.442.2020.04.16.00.49.43; Thu, 16 Apr 2020 00:50:25 -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=@codecoup-pl.20150623.gappssmtp.com header.s=20150623 header.b="Du/eCGQy"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439442AbgDPHtd (ORCPT + 99 others); Thu, 16 Apr 2020 03:49:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2439430AbgDPHt2 (ORCPT ); Thu, 16 Apr 2020 03:49:28 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C9EC061A0C for ; Thu, 16 Apr 2020 00:49:28 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id w145so4851346lff.3 for ; Thu, 16 Apr 2020 00:49:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codecoup-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:in-reply-to :references:mime-version:content-transfer-encoding; bh=PetXaBQAAP5AlhnkJpxvt9p7JmrT7o+CxrcKtSclo/s=; b=Du/eCGQyVQTJxM/RYBhf3ITQ2rLzAQeE781WuH/DlRYneRANji2xSCdYFZ5LhRWHO7 c6mctNZUjAftMjit42SsVHh0i9d+IfDn6cRQ6A8LbtC0zraxAeQotNHOtTO7Hv6Y4Msd QwQudSw6M0kdHYDfvs3IiHJsbSE4cIG4qjYAAzELmPGumr5pgHmSaYqKhs/46NVwdYer P0WfR3jzlnQQgViBAYHE/C9aN0AXZaVEwlA2cmoNzMRvudQSiiBtVhwDafipJ8rGKPzZ 6hOdoIQNb5h9J63zPr6IDkvqTR4NT3Asd2qPCdpc0jKtwQio+2/d4OAFs+2G70p5xsd7 V3Zw== 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:organization :in-reply-to:references:mime-version:content-transfer-encoding; bh=PetXaBQAAP5AlhnkJpxvt9p7JmrT7o+CxrcKtSclo/s=; b=RlZrRB8We7tBrCnrt3nykdOXCqcWlRY1BcfnH9yem5EjAnWLzaCaMx08dI0v0kDErI PHRwTGyJgDIm8m12jzSubDTG/TTzDi3TS0CoTnJsepRX0ketLl7ff7jwat8MgolJ1Teh lTH29BzxmlGI0LLKqbs79qkPykmVgqYtDcAAxtc5smOWT3qgm2h+h9nH3oKPppDuIzDr Ws5+UwQstskbfTBg2saR4q5XGyBbJzHMK0FI7OdXnuPmkveIy1+ZxWvdT21k6+SCBfn6 yXf4uGIdpPashcrijhbp1PgDJ5WJUEBResdm5z4vAoTuE9AquGRA/x/L3KTlqPfahDKa eO9Q== X-Gm-Message-State: AGi0PuYUshVHvHPaDvSPJfb8JuQ+yArmmOYH1cqAiElYPMgdGmScffQ6 Ovsgz224br13/S1KP14lrkL7Kg== X-Received: by 2002:a05:6512:31c1:: with SMTP id j1mr5396293lfe.14.1587023366673; Thu, 16 Apr 2020 00:49:26 -0700 (PDT) Received: from ix.localnet (45-11-60-42.ip4.greenlan.pl. [45.11.60.42]) by smtp.gmail.com with ESMTPSA id a28sm14189463lfr.4.2020.04.16.00.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2020 00:49:26 -0700 (PDT) From: Szymon Janc To: Miao-chen Chou Cc: Bluetooth Kernel Mailing List , Yoni Shavit , Alain Michaud , Marcel Holtmann , Michael Sun , Luiz Augusto von Dentz Subject: Re: [BlueZ PATCH v2] doc: Add Advertisement Monitoring API Date: Thu, 16 Apr 2020 09:49:24 +0200 Message-ID: <13923060.5j3lsEUdY8@ix> Organization: CODECOUP In-Reply-To: <20200415200831.BlueZ.v2.1.I137a529ab03c9d0d2327f1659bd1af4954a28e78@changeid> References: <20200415200831.BlueZ.v2.1.I137a529ab03c9d0d2327f1659bd1af4954a28e78@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi, On Thursday, 16 April 2020 05:09:03 CEST 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. > > Signed-off-by: Miao-chen Chou > --- > > 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 | 127 ++++++++++++++++++++++++++++++ > 1 file changed, 127 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..6491dab29 > --- /dev/null > +++ b/doc/advertisement-monitor-api.txt > @@ -0,0 +1,127 @@ > +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 > +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] Isn't is enough for RegisterApplication to return to ack this? > + > + 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 a monitor can be the following values. More > + will be added. > + 0x01 - Patterns with logic OR applied > + Supported only if "patterns-with- logic-or- > + applied" is supported. > + > + (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. > + > +======================================= > +Service org.bluez > +Interface org.bluez.AdvertisementMonitorManager1 > +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} SupportedFeatures [read-only] > + > + This reflects the supported features of advertisement > + monitoring. An application should check this before > + instantiate and expose an object of > + org.bluez.AdvertisementMonitor1. > + > + Here are the potential features. More will be added. > + software-based-filtering > + The filtering process is mainly done in BlueZ. > + patterns-with-logic-or-applied > + Logic OR would be applied among the patterns > + provided by a monitor object. > + rssi-monitoring > + Values of RSSIThreshholdsAndTimers would be > + applied during the filtering process. I'm bit confused about this API. Why can't this be achieved with (possible extended) SetDiscoveryFilter? We could just add extra prop to Device1 to indicate that device is "present". -- pozdrawiam Szymon Janc