Skip to contentSkip to conversation

client/advertising: Add support for setting min/max intervals

PATCH In review Luiz Augusto von Dentz 2 participants 3 messages May 13, 2021 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 client/advertising: Add support for setting min/max intervals

From: Luiz Augusto von Dentz <[email protected]>

This adds support for setting MinInterval/MaxInterval.

---
 client/advertising.c | 62 ++++++++++++++++++++++++++++++++++++++++++++
 client/advertising.h |  1 +
 client/main.c        | 45 ++++++++++++++++++++++++++++++++
 3 files changed, 108 insertions(+)
client/advertising.c +62 -0
index c1a00502e..3bf12fe87 100644
@@ -52,6 +52,8 @@ static struct ad {
 	char *type;
 	char *local_name;
 	char *secondary;
+	uint32_t min_interval;
+	uint32_t max_interval;
 	uint16_t local_appearance;
 	uint16_t duration;
 	uint16_t timeout;
@@ -182,6 +184,10 @@ static void print_ad(void)
 
 	if (ad.timeout)
 		bt_shell_printf("Timeout: %u sec\n", ad.timeout);
+
+	if (ad.min_interval)
+		bt_shell_printf("Interval: %u-%u msec\n", ad.min_interval,
+					ad.max_interval);
 }
 
 static void register_reply(DBusMessage *message, void *user_data)
@@ -445,6 +451,36 @@ static gboolean get_secondary(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static gboolean min_interval_exits(const GDBusPropertyTable *property,
+							void *data)
+{
+	return ad.min_interval;
+}
+
+static gboolean get_min_interval(const GDBusPropertyTable *property,
+				DBusMessageIter *iter, void *user_data)
+{
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32,
+						&ad.min_interval);
+
+	return TRUE;
+}
+
+static gboolean max_interval_exits(const GDBusPropertyTable *property,
+							void *data)
+{
+	return ad.max_interval;
+}
+
+static gboolean get_max_interval(const GDBusPropertyTable *property,
+				DBusMessageIter *iter, void *user_data)
+{
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32,
+						&ad.max_interval);
+
+	return TRUE;
+}
+
 static const GDBusPropertyTable ad_props[] = {
 	{ "Type", "s", get_type },
 	{ "ServiceUUIDs", "as", get_uuids, NULL, uuids_exists },
@@ -460,6 +496,8 @@ static const GDBusPropertyTable ad_props[] = {
 	{ "Appearance", "q", get_appearance, NULL, appearance_exits },
 	{ "Duration", "q", get_duration, NULL, duration_exits },
 	{ "Timeout", "q", get_timeout, NULL, timeout_exits },
+	{ "MinInterval", "u", get_min_interval, NULL, min_interval_exits },
+	{ "MaxInterval", "u", get_max_interval, NULL, max_interval_exits },
 	{ "SecondaryChannel", "s", get_secondary, NULL, secondary_exits },
 	{ }
 };
@@ -951,3 +989,27 @@ void ad_advertise_secondary(DBusConnection *conn, const char *value)
 
 	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
+
+void ad_advertise_interval(DBusConnection *conn, uint32_t *min, uint32_t *max)
+{
+	if (!min && !max) {
+		if (ad.min_interval && ad.max_interval)
+			bt_shell_printf("Interval: %u-%u msec\n",
+					ad.min_interval, ad.max_interval);
+		return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+	}
+
+	if (ad.min_interval != *min) {
+		ad.min_interval = *min;
+		g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE,
+							"MinInterval");
+	}
+
+	if (ad.max_interval != *max) {
+		ad.max_interval = *max;
+		g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE,
+							"MaxInterval");
+	}
+
+	return bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
client/advertising.h +1 -0
index 25e6aee99..472396efd 100644
@@ -29,3 +29,4 @@ void ad_disable_data(DBusConnection *conn);
 void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value);
 void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value);
 void ad_advertise_secondary(DBusConnection *conn, const char *value);
+void ad_advertise_interval(DBusConnection *conn, uint32_t *min, uint32_t *max);
client/main.c +45 -0

69 lines not on this page · raw message

Signature · 1 line
2.30.2
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=481575

---Test result---

Test Summary:

CheckPatch                    PASS      0.87 seconds
GitLint                       PASS      0.15 seconds
Prep - Setup ELL              PASS      52.17 seconds
Build - Prep                  PASS      0.15 seconds
Build - Configure             PASS      8.90 seconds
Build - Make                  PASS      223.46 seconds
Make Check                    PASS      9.53 seconds
Make Distcheck                PASS      261.17 seconds
Build w/ext ELL - Configure   PASS      9.00 seconds
Build w/ext ELL - Make        PASS      210.86 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration

---
Regards,
Linux Bluetooth

author maintainer
#2 lore raw

Hi,

Quoted 66 lines · On Wed, May 12, 2021 at 6:46 PM <[email protected]> wrote:

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=481575

---Test result---

Test Summary:

CheckPatch                    PASS      0.87 seconds
GitLint                       PASS      0.15 seconds
Prep - Setup ELL              PASS      52.17 seconds
Build - Prep                  PASS      0.15 seconds
Build - Configure             PASS      8.90 seconds
Build - Make                  PASS      223.46 seconds
Make Check                    PASS      9.53 seconds
Make Distcheck                PASS      261.17 seconds
Build w/ext ELL - Configure   PASS      9.00 seconds
Build w/ext ELL - Make        PASS      210.86 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration

Quoted 3 lines

---
Regards,
Linux Bluetooth

Pushed.

Signature · 1 line
Luiz Augusto von Dentz