From patchwork Mon Mar 30 08:03:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Howard Chung X-Patchwork-Id: 197207 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 673D7C2D0E9 for ; Mon, 30 Mar 2020 08:04:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E0C820784 for ; Mon, 30 Mar 2020 08:04:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cyUm7P1K" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729597AbgC3IEL (ORCPT ); Mon, 30 Mar 2020 04:04:11 -0400 Received: from mail-pf1-f201.google.com ([209.85.210.201]:43821 "EHLO mail-pf1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729555AbgC3IEL (ORCPT ); Mon, 30 Mar 2020 04:04:11 -0400 Received: by mail-pf1-f201.google.com with SMTP id 20so14727117pfw.10 for ; Mon, 30 Mar 2020 01:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=J6H28Klia+nbbPjZRhE37qHnAkPZWC0Dwshk4a+wzMs=; b=cyUm7P1KQPFg++nCDUmpuDPJgRF+fbJoqtUKfu2VaY1gHhG1kI3zVimZZYIT6tI8aJ xJla3/kRp43KiP47oYFCUi+F8yBP69T+BkXpK6Zl+Y7qCBMiHv3h1kEoPYaWmBCcZyQL OWkMsBcHYwhWTmJKYGYk4Imumvzf6tX15OHRSs6l0XCWrZQjeOLQQvbHnN3KD7Fs98h8 jcA8g+rpUTxKn7TaucF1yNWIdTlOYGWVGl7KKXwM79ZOdBdEemHzNrHrztZ9Ofe7Yzll zkgDV66oprVUyE8TQqMm46z5hfpOFwY04ARvK+9B57raVx/BaFDWgWnLq/GW5mX/vUAN YShA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=J6H28Klia+nbbPjZRhE37qHnAkPZWC0Dwshk4a+wzMs=; b=ivM5uRAT6gU6PJCau99PcnT888A3aAUKa2WeNBBhcRlS8hfJ2RcWf96bmywxOz9C84 EXHxQfLvmpaEdgjkhs+8k2qj8Jw+Y+kYJQi7Phs4DQjNYyiL7GO6skrBsnNQSwyh3b9H JCs66OKMj6uInIFx2UVppBEqem6+3x4/4ywHDMoI3zscIjYgUw0emvb4OBpnXCCFvGZX 61q5WZURxaPehrP7MxvEFjBDAGFZ2k4OjB4PWNsfMHvC1BDZxuG8D6ooqcp6+OzGCkl/ 980yDV6m2NCRxv2n6R0jZPQ7WbMPLx+4esh+pa3t3nqduVH/th1lXdPwfRofWWR3CnAR 2gmQ== X-Gm-Message-State: ANhLgQ3L3W6l8G41hwal4uWDtJwerDWhjg2sCi353+HoYRjhM8EDVLfp ohL5aZeTRybMMo4Gaj1+HVLcvXk1usltM6ueJb42cp9IBO7IAyOpXEDDVHmrTzvlBireU2794u4 sxbQXxCWDtkMjbroZRZfRzk96laDJFWMtNlfEAlwnU3bL3kIwsofnPrDifEIwvsw7j4yzd3btcQ zikVkimrCiH0s= X-Google-Smtp-Source: ADFU+vv0IhByRpco9vm5vcXHGWuvf47bupyYbZ/7scNcRRGDTKdz/mPF7V0/y2RDK47sVCCmgR9dIXKRVwW3+95vkw== X-Received: by 2002:a17:90a:bf18:: with SMTP id c24mr14308679pjs.125.1585555450046; Mon, 30 Mar 2020 01:04:10 -0700 (PDT) Date: Mon, 30 Mar 2020 16:03:52 +0800 In-Reply-To: <20200330080357.96989-1-howardchung@google.com> Message-Id: <20200330160343.Bluez.v2.1.I0c5d660478f6a1c2d70f4bf683460e11a96ec223@changeid> Mime-Version: 1.0 References: <20200330080357.96989-1-howardchung@google.com> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog Subject: [Bluez PATCH v2 1/6] lib/mgmt: Add LE Set Advertising Interval definition From: Howard Chung To: linux-bluetooth@vger.kernel.org, luiz.von.dentz@intel.com Cc: chromeos-bluetooth-upstreaming@chromium.org, Howard Chung , josephsih@chromium.org Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Suggested-by: josephsih@chromium.org Signed-off-by: Howard Chung --- Changes in v2: - Rebase and resolve conflict in monitor/control.c lib/mgmt.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/mgmt.h b/lib/mgmt.h index 7520c7ae9..75302f5fd 100644 --- a/lib/mgmt.h +++ b/lib/mgmt.h @@ -103,6 +103,7 @@ struct mgmt_rp_read_index_list { #define MGMT_SETTING_STATIC_ADDRESS 0x00008000 #define MGMT_SETTING_PHY_CONFIGURATION 0x00010000 #define MGMT_SETTING_WIDEBAND_SPEECH 0x00020000 +#define MGMT_SETTING_ADVERTISING_INTERVALS 0x00040000 #define MGMT_OP_READ_INFO 0x0004 struct mgmt_rp_read_info { @@ -602,6 +603,15 @@ struct mgmt_cp_set_blocked_keys { #define MGMT_OP_SET_WIDEBAND_SPEECH 0x0047 +#define MGMT_OP_SET_ADVERTISING_INTERVALS 0x0048 +#define ADVERTISING_INTERVAL_UNIT_TIME 0.625 +struct mgmt_cp_set_advertising_intervals { + /* A unit of the intervals below is 0.625 ms.*/ + uint16_t min_interval; + uint16_t max_interval; +} __packed; +#define MGMT_SET_ADVERTISING_INTERVALS_SIZE 4 + #define MGMT_EV_CMD_COMPLETE 0x0001 struct mgmt_ev_cmd_complete { uint16_t opcode; @@ -898,6 +908,7 @@ static const char *mgmt_op[] = { "Set PHY Configuration", "Set Blocked Keys", "Set Wideband Speech", + "Set Advertising Intervals", /* 0x0048 */ }; static const char *mgmt_ev[] = { From patchwork Mon Mar 30 08:03:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Howard Chung X-Patchwork-Id: 197206 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB155C43331 for ; Mon, 30 Mar 2020 08:04:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94A9420748 for ; Mon, 30 Mar 2020 08:04:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FXYNFLRh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729603AbgC3IEV (ORCPT ); Mon, 30 Mar 2020 04:04:21 -0400 Received: from mail-pl1-f202.google.com ([209.85.214.202]:49017 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729586AbgC3IEV (ORCPT ); Mon, 30 Mar 2020 04:04:21 -0400 Received: by mail-pl1-f202.google.com with SMTP id w3so12381423plz.15 for ; Mon, 30 Mar 2020 01:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=oOIxK3ZqM6LAAqkV1X/+V85HxrPtsXuK8F3nIXKiwNw=; b=FXYNFLRhaCq6XHrYgg4fWOre+j9fLqwuoc9GbelSkdVsYcXrUXg3xr+qiGG5XNlIAm 2Big+71X0uGHSXe6T0g4+zMYUxvAHOAwofHgPfMnrxIbjjgoJwiJyMpkimqLIbSMqB01 QLiuC/vWF8BtI8BjhsEFw15YXMBwULQfpBYCTM9xzGSE7WBoPVkveQE1MHEVRQnC7sGk erbai/tjC/QsVlYY6r8nMO94BlsvYWRaegIlXfIfocUGhFPDV3qvCXw5ssccrMYRO0zz 9v3KsU6oTwtw0DD81qdjMEhaoaO9N89qT0xSzYT7Yu05p8HpzhB/91W636lIx+ZESQVm Cibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=oOIxK3ZqM6LAAqkV1X/+V85HxrPtsXuK8F3nIXKiwNw=; b=l2gRb54wpVkEFbiQL+vkXFNkqq52/0nb49TtalM2C4aG2ZKpgB+zk3iqLrXNAR1UlU bphS1trBlEaTgvo5W7lYeZcpnTQTXHN2EVkuB6ZcpW4GhIpRG5Cn1A2Qerpt0y0o0364 F6QCuYUW2SVPazivCUXU3uixPA66dgepZ4czC9yoBvQxSFqcp1YbngMLV4XamjZ80rCR 0nmg/MQdkDznvm6D5Y9JCniidTZaklhC9+E+wVEGQZ4/0gIFQf8/Ow94Bjagjp5z1ikf lEnnOzxjkTKYJek5IaTz5vP8V5yucNabkuPlWyo5mQ4Ni+LHCFmCLXi4CjBg1P60kGQA OirA== X-Gm-Message-State: ANhLgQ1YTXBgeEBH1LHF7Q8zr+r+7D4lMmtzcJK6vsi5AHSOXJ0tIX1d A48rIH9jzzYrQLDFCx/VPsdKBISDn8lFnfhhlBsJTbOdHlws4Cs9zh/y/noMxk8Mki/aElQuQb/ cHhFrI4LyTPooa3myEStsnPGRzjumU4sb2qLpuoV3wfQA99YCjc+tDA6uU4pIxje1bk4hGp8P23 Bzdhw5IlhSko0= X-Google-Smtp-Source: ADFU+vuVXlyYF1UEpqbgBbsSsKB7dcFdgPJqh+YYyV2fnIAQwDBSJqHLK8d+ll0N2iCcZg/Bw4mvRksr6o8iyJrOmg== X-Received: by 2002:a17:90b:3849:: with SMTP id nl9mr14060702pjb.86.1585555459981; Mon, 30 Mar 2020 01:04:19 -0700 (PDT) Date: Mon, 30 Mar 2020 16:03:54 +0800 In-Reply-To: <20200330080357.96989-1-howardchung@google.com> Message-Id: <20200330160343.Bluez.v2.3.Ia74c1ab0a71d90f46f10b4e32743cab722a97bbb@changeid> Mime-Version: 1.0 References: <20200330080357.96989-1-howardchung@google.com> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog Subject: [Bluez PATCH v2 3/6] doc: Add documentation for LE Set Advertising Interval From: Howard Chung To: linux-bluetooth@vger.kernel.org, luiz.von.dentz@intel.com Cc: chromeos-bluetooth-upstreaming@chromium.org, Howard Chung Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Signed-off-by: Howard Chung --- Changes in v2: None doc/advertising-api.txt | 13 +++++++++++++ doc/mgmt-api.txt | 25 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/doc/advertising-api.txt b/doc/advertising-api.txt index b0565eab2..9264cdb27 100644 --- a/doc/advertising-api.txt +++ b/doc/advertising-api.txt @@ -209,3 +209,16 @@ Properties byte ActiveInstances Possible values: "1M" "2M" "Coded" + + void SetAdvertisingIntervals(uint16 min_interval_ms, + uint16 max_interval_ms) + + This method sets the advertising intervals. + + The parameters min_interval_ms and max_interval_ms + are specified in milli-seconds. Valid values of + the intervals must fall between 20 ms and 10,240 ms. + + Possible errors: org.bluez.Error.Failed + org.bluez.Error.InProgress + org.bluez.Error.InvalidArguments diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt index 27a41f334..5eff87e24 100644 --- a/doc/mgmt-api.txt +++ b/doc/mgmt-api.txt @@ -2925,6 +2925,31 @@ Read Extended Controller Information Command Invalid Index +Set Advertising Intervals Command +================================= + + Command Code: 0x0101 + Controller Index: + Command Parameters: Min_Interval (2 Octets) + Max_Interval (2 Octets) + Return Parameters: Current_Settings (4 Octets) + + This command is used to set advertising intervals. The intervals + are expressed in multiples of 0.625 ms. The default values of + both intervals are 0x0800. Valid Min_Interval and Max_Interval + values must fall between 0x0020 and 0x4000. + + The advertising intervals are first kept in hdev struct. The values + would be sent to the controller and take effect when advertising is + actually enabled. If the advertising intervals are set when + advertising is already on, the advertising would be disabled and + re-enabled to make the intervals take effect. + + Possible errors: Busy + Rejected + Invalid Parameters + + Set Appearance Command ====================== From patchwork Mon Mar 30 08:03:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Howard Chung X-Patchwork-Id: 197205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2F2AC43331 for ; Mon, 30 Mar 2020 08:04:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A3F6A206E6 for ; Mon, 30 Mar 2020 08:04:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ffyP0Yfe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729606AbgC3IEd (ORCPT ); Mon, 30 Mar 2020 04:04:33 -0400 Received: from mail-vk1-f202.google.com ([209.85.221.202]:54606 "EHLO mail-vk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729586AbgC3IEd (ORCPT ); Mon, 30 Mar 2020 04:04:33 -0400 Received: by mail-vk1-f202.google.com with SMTP id i26so5249050vkk.21 for ; Mon, 30 Mar 2020 01:04:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=t9KWA9TXseSGKzSaj2xUqPufvYRn2IcAIkpo4hpGUsc=; b=ffyP0YfeWxCIApygAbhLHpnjKIfPKABqJpPKCFr0wm7vM/pBH7Q77tFwzLta0vKY2M OuGEcVtwXb8b8MfALymPYYoSSdUVbuGB6L/my4jIktEeFbbA7mHtyvtKwDuexR5+6KiQ +kxti8BKd7RoTNO+5j9S86SbE0Uv7lDgXwWDrn+JmBDe1M+JPdIUuYDHQkQAQLUqHVEF Jk/JR9skcw7oqK9D9aHnFOXfbN98hTy8Abm4bdwDCLt8/g5/+F576q5DcCx8rqk3DRpu GlNjol8OOLWCGKSuYM3IgayzsoOckJFj8+TPMS4ohYay8jFi0cg0Z+rsvW8ZDM3HU7D4 t0EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=t9KWA9TXseSGKzSaj2xUqPufvYRn2IcAIkpo4hpGUsc=; b=eevGhsEe8aGKIGOMvvNo2SS9DAPbnsfMBigmxBBwiD4QK8b8quxxELAOTTGtDzRGsc PR76FYOIkue9GZfhah55y7GOrtsg08jjSTmfOlyZ4P1xEal9cxm+h9UCccAz0fdINkP4 kTCnR/wjv3Hk/COWBjZQZMJvGOHt+4QqUT2bxomDXxPqcGChU6vPFLPvZoSsQHmGX3He AuF/tRfvilnXSRgG5RoTJ+bcU70h+DXNL8NnYK1BsIrVSm3wBzhvlBmS3XwbTIDdxijM w3W6ol11+6fuhq4j4+l/bPrFJ32T0yzg/6SmfCLkP675oQiXg06JB5CZML835a524TqQ M/dQ== X-Gm-Message-State: AGi0PuYIAxykrmZsxTfpBmYjphq/CasdRFlDAFOBWHsaxirp2fpFXhDY WGM0DOw0Cv5nQEm0vI0SdPYUR8fl4yI5GMfOUys2gLWRf6P8aLHiRRZbZaISojEemGvkPr9mBRi b81P8hAQUTwj7eqgCP91XjjzIS5C8GW0JCtPxvPixV3m0UoTFSKyB0AH5hmPNyXcUE6DLVsKka3 DGOnuwTLFBIWw= X-Google-Smtp-Source: APiQypJWq/jMiO9R9NJkeJqgdv8vPdBSslwLiONw8f+xVCg5bfDNbKB1Gej+EdOly+MZAV6wDdTk571ABgbKXg75rw== X-Received: by 2002:a1f:a2d0:: with SMTP id l199mr6578040vke.77.1585555470048; Mon, 30 Mar 2020 01:04:30 -0700 (PDT) Date: Mon, 30 Mar 2020 16:03:56 +0800 In-Reply-To: <20200330080357.96989-1-howardchung@google.com> Message-Id: <20200330160343.Bluez.v2.5.Ie551a8a414d17604f04e10cf8d9c514a2b170e31@changeid> Mime-Version: 1.0 References: <20200330080357.96989-1-howardchung@google.com> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog Subject: [Bluez PATCH v2 5/6] test: Add test for LE Set Advertising Interval From: Howard Chung To: linux-bluetooth@vger.kernel.org, luiz.von.dentz@intel.com Cc: chromeos-bluetooth-upstreaming@chromium.org, Howard Chung Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Perform the following steps to verify advertising intervals. Open a terminal on the DUT, and execute $ btmon Open another terminal on the DUT, and register an advertisement. $ ./example-advertisement Observe that the default intervals are 1280 msec in btmon log. < HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15 Min advertising interval: 1280.000 msec (0x0800) Max advertising interval: 1280.000 msec (0x0800) Press ctrl-c to terminate the advertisement. Set new intervals to 200 ms. $ ./example-advertising-intervals 200 200 It would show the following line in btmon log. = bluetoothd: Set Advertising Intervals: 0x0140, 0x0140 Register an advertisement again. $ ./example-advertisement Observe that the new intervals bcome 200 msec in btmon log. < HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15 Min advertising interval: 200.000 msec (0x0140) Max advertising interval: 200.000 msec (0x0140) Press ctrl-c to terminate the advertisement. Signed-off-by: Howard Chung --- Changes in v2: None test/example-advertising-intervals | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/example-advertising-intervals diff --git a/test/example-advertising-intervals b/test/example-advertising-intervals new file mode 100644 index 000000000..8afc7225e --- /dev/null +++ b/test/example-advertising-intervals @@ -0,0 +1,48 @@ +#!/usr/bin/python + +"""A simple script to set advertising intervals through the dbus method. + +Usage: + $ ./example_advertising_intervals.py min_interval_ms max_interval_ms + + Example: + # Set both min and max advertising intervals to 200 ms. + $ ./exampel_advertising_intervals.py 200 200 +""" + +import dbus +import time +import subprocess +import sys + +argv = sys.argv +argc = len(argv) +prog = argv[0] +if argc == 3: + min_interval_ms = int(argv[1]) + max_interval_ms = int(argv[2]) + print 'Set advertising intervals: [%d, %d]' % (min_interval_ms, + max_interval_ms) +else: + print 'Usage: python %s min_interval_ms max_interval_ms' % prog + print ' python %s 200 200' % prog + sys.exit(1) + + +# Set advertising intervals. +bus = dbus.SystemBus() +adapter = bus.get_object('org.bluez', '/org/bluez/hci0') +adapter.SetAdvertisingIntervals( + min_interval_ms, max_interval_ms, + dbus_interface='org.bluez.LEAdvertisingManager1') + + +# Wait a little while for dbus method to complete. +time.sleep(0.2) + + +# Check the current settings using btmgmt. +btmgmt_cmd = 'btmgmt info' +for line in subprocess.check_output(btmgmt_cmd.split()).splitlines(): + if 'current settings' in line: + print line.strip()