Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1722611ybj; Wed, 6 May 2020 04:14:33 -0700 (PDT) X-Google-Smtp-Source: APiQypIFlO8pBZaIPDEgkD0layff5vwgoCz25Xrk2qr6SLGBsXVXOqUzwqv9USJbJaKnijS5Y2h1 X-Received: by 2002:a17:906:ef2:: with SMTP id x18mr6642855eji.234.1588763673075; Wed, 06 May 2020 04:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588763673; cv=none; d=google.com; s=arc-20160816; b=wK4ywX749eWjCcHjPV2sj8fp52s+UiO89+7T3NLdrFbdNYvPNwOyvh2tUjOGfXCutG H0yn73bw5TfYYgge7uwyDThz32Pcnp9oJ4cCSeKBOZ+LkNdyNVQoUOVPjL5LS2seb9cK TL2+ul1NYKmf293mQrjFFTL2Sj7umJJC7j7u5WpFGS37JveQ74QYfkM9d1eFRA0Dg0D8 L9ITuFKwVlIGu9kQ6twzQj9HE9tCLGazl4KBWBb78DOXkNUszfK6c+h+cA6ynFBXxl5h pphcsm93uk7/wxfnVlTWn7GyymhMct438KM9rQ8oRIQNHQ6qZooq/099lgebrFWTuGMS pQLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=QD/Hi0Bfsub4z3FARvr/5CpHDj6XbJohG3fgKvcgsrI=; b=sFXY64S4uj8QgFKG41kGLUj7RAmRHPvgelaklJd+SXJa68LDuR7UXeGcNVwM9pgIdg e7JVBuDlEqDrD2p+mD7lvxHDPY9ZrACTQMhimaLLUAf75PPp8stoFAumMwAnhR6U/Jyo dKEA0PGYuBocljTJpdFVSvpkI87Ynp/yQbQ/zGqb7Mjsxs0zvaJ2fS4VhXi5VPBwuQ1M BYtgvUb0bGQ/w1Zf2RnhLU6VU2AgguyteqKAX9Hlo1f6b1IImhdLxgS3FYo7Cm56zMm0 U/qXoabb8SFDJrsG5N0D3vVD7okFTPgc88DJJ/ncPovhnodhoGAwj/E2Y1c20Cf3S5wh Db+Q== ARC-Authentication-Results: i=1; mx.google.com; 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 k6si1016775ejv.507.2020.05.06.04.14.08; Wed, 06 May 2020 04:14:33 -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; 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 S1727893AbgEFLFQ convert rfc822-to-8bit (ORCPT + 99 others); Wed, 6 May 2020 07:05:16 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:60293 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727959AbgEFLFP (ORCPT ); Wed, 6 May 2020 07:05:15 -0400 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id 67218CED03; Wed, 6 May 2020 13:14:53 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [BlueZ PATCH v5] doc: Describe the new Advertisement Monitor support From: Marcel Holtmann In-Reply-To: <20200429203031.BlueZ.v5.1.If9f6be992cbaeaa35423de29da6db28675b35fcc@changeid> Date: Wed, 6 May 2020 13:05:11 +0200 Cc: Bluetooth Kernel Mailing List , Alain Michaud , Michael Sun , Luiz Augusto von Dentz , Yoni Shavit Content-Transfer-Encoding: 8BIT Message-Id: <6FD8666C-39AD-4D41-9BBF-7E1371FDFFA6@holtmann.org> References: <20200429203031.BlueZ.v5.1.If9f6be992cbaeaa35423de29da6db28675b35fcc@changeid> To: Miao-chen Chou X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Miao-chen, > This describes the following commands and event. > - Read Advertisement Monitor Features command > - Add Advertisement Patterns Monitor command > - Remove Advertisement Monitor command > - Advertisement Monitor Added event > - Advertisement Monitor Removed event > Note that the content of a monitor can differ based on its type. For now we > introduce only pattern-based monitor, so you may find that unlike the > command of removing monitor(s), the Add command is tied to a specific type. > --- > > Changes in v5: > - Add more fields in the return value of Read Advertisement Monitor > Features command. > - Refine the description of commands and events. > > Changes in v4: > - In Read Advertisement Monitor Features command, rename > Adopted_Features to Enabled_Features. > > Changes in v3: > - Remove Advertisement Monitor can perform the removal of one monitor > or all monitors. > - Add Read Advertisement Monitor Features command. > - Add Advertisement Monitor Added event and dvertisement Monitor Removed > event. > > Changes in v2: > - Combine commands to remove one monitor and remove all monitors. The > refined command takes multiple handles and an extra field to indicate > whether to remove all monitors. > > doc/mgmt-api.txt | 147 +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 147 insertions(+) > > diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt > index 39f23c456..4aa755c45 100644 > --- a/doc/mgmt-api.txt > +++ b/doc/mgmt-api.txt > @@ -3138,6 +3138,125 @@ Read Security Information Command > Invalid Index > > > +Read Advertisement Monitor Features Command > +=========================================== > + > + Command Code: 0x0049 > + Controller Index: > + Command Parameters: > + Return Parameters: Supported_Features (4 octets) > + Enabled_Features (4 octets) > + Max_Num_Handles (2 octets) > + Max_Num_Patterns (1 octet) > + Num_Handles (2 octets) > + Handle1 (2 octets) > + Handle2 (2 octets) > + ... Handle[i] (2 Octets) And we have been using Octet(s) and not octet(s). The document should be pretty much consistent with its style. If you see mistakes, please send patches to correct it. > + > + This command is used to read the advertisement monitor features > + supported by the controller and stack. Supported_Features lists all > + related features supported by the controller while Enabled_Features > + lists the ones currently used by the kernel. > + > + Supported_Features and Enabled_Features are bitmasks with currently > + the following available bits: > + > + 1 Advertisement content monitoring based on Microsoft > + HCI extension. Advertising content monitoring based on pattern. Lets leave Microsoft out of it. > + > + Max_Num_Handles indicates the maximum number of supported > + advertisement monitors. Note that the actual number of supported > + ones might be less depending on the limitation of the controller. > + > + Max_Num_Pattern indicates the maximum number of supported patterns > + in an advertisement patterns monitor. Note that the actual number > + of supported ones might be less depending on the limitation of the > + controller. > + > + Num_Handles indicates the number of added advertisement monitors, > + and it is followed by a list of handles. > + > + This command can be used when the controller is not powered. > + > + > +Add Advertisement Patterns Monitor Command > +========================================= > + > + Command Code: 0x004A > + Controller Index: > + Command Parameters: Pattern_count (1 Octets) Pattern_Count please. > + Pattern1 { > + AD_Data_Type (1 Octet) Just call it Type and explain in the description that it is the AD Type. > + Offset (1 Octet) > + Length (1 Octet) > + Value (variable length) We normally give a range and not “variable length”. I wonder if we should just use a fixed size field here. > + } > + Pattern2 { } > + ... > + Return Parameters: Monitor_Handle (2 Octets) > + > + This command is used to add an advertisement monitor whose > + filtering conditions are patterns. The kernel will trigger scanning > + if there is at least one monitor added. If the controller supports > + advertisement filtering, the kernel would offload the content > + filtering to the controller in order to reduce power consumption; > + otherwise the kernel ignores the content of the monitor. Note that > + if the there are more than one patterns, OR logic would applied > + among patterns during filtering. In other words, any advertisement > + matching at least one pattern in a given monitor would be > + considered as a match. > + > + A pattern contains the following fields. > + AD_Data_Type Advertising Data Type. The possible values > + are defined in Core Specification > + Supplement. > + Offset The start index where pattern matching > + shall be performed with in the AD data. > + Length The length of the pattern value in bytes. > + Value The value of the pattern in bytes. > + > + Here is an example of a pattern. > + { > + 0x16, // Service Data - 16-bit UUID > + 0x02, // Skip the UUID part. > + 0x04, > + {0x11, 0x22, 0x33, 0x44}, > + } > + > + This command can be used when the controller is not powered and > + all settings will be programmed once powered. > + > + Possible errors: Failed > + Busy > + No Resources > + Invalid Parameters > + > + > +Remove Advertisement Monitor Command > +==================================== > + > + Command Code: 0x004B > + Controller Index: > + Command Parameters: Monitor_Handle (2 Octets) > + Return Parameters: Include Monitor_Handle in the return value. The events are not send to the caller and so the caller somehow needs to be able to map that response if they have to. > + > + This command is used to remove advertisement monitor(s). The kernel > + would remove the monitor(s) with Monitor_Handle and update the LE > + scanning. > + > + When the Monitor_Handle is set to zero, then all previously added > + handles will be removed. > + > + Removing a monitor while it is being added will be ignored. > + > + This command can be used when the controller is not powered and > + all settings will be programmed once powered. > + > + Possible errors: Failed > + Busy > + Invalid Index > + > + > Command Complete Event > ====================== > > @@ -4020,3 +4139,31 @@ PHY Configuration Changed Event > one through which the change was triggered. > > Refer Get PHY Configuration command for PHYs parameter. > + > + > +Advertisement Monitor Added Event > +================================= > + > + Event Code: 0x0027 > + Controller Index: > + Event Parameters: Monitor_Handle (2 Octets) > + > + This event indicates that an advertisement monitor has been added > + using the Add Advertisement Monitor command. > + > + The event will only be sent to management sockets other than the > + one through which the command was sent. > + > + > +Advertisement Monitor Removed Event > +=================================== > + > + Event Code: 0x0028 > + Controller Index: > + Event Parameters: Monitor_Handle (2 Octets) > + > + This event indicates that an advertisement monitor has been removed > + using the Remove Advertisement Monitor command. > + > + The event will only be sent to management sockets other than the > + one through which the command was sent. Regards Marcel