From 98b4797764ccb114c9a1ee00d911d0f88c3f7180 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 21 Dec 2012 00:18:18 +0200 Subject: [PATCH] health: Use lower-case strings for enum values (for consistency) --- doc/health-api.txt | 12 ++++++------ profiles/health/hdp.c | 10 +++++----- profiles/health/hdp_util.c | 4 ++-- test/test-health | 16 ++++++++-------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/health-api.txt b/doc/health-api.txt index 26e7a4a08..2c48ff204 100644 --- a/doc/health-api.txt +++ b/doc/health-api.txt @@ -22,8 +22,8 @@ Methods object CreateApplication(dict config) string Role: - Mandatory. Possible values: "Source", - "Sink" + Mandatory. Possible values: "source", + "sink" string Description: @@ -32,7 +32,7 @@ Methods object CreateApplication(dict config) ChannelType: Optional, just for sources. Possible - values: "Reliable", "Streaming" + values: "reliable", "streaming" Possible Errors: org.bluez.Error.InvalidArguments @@ -68,7 +68,7 @@ Methods boolean Echo() Creates a new data channel. The configuration should indicate the channel quality of service using one of - this values "Reliable", "Streaming", "Any". + this values "reliable", "streaming", "any". Returns the object path that identifies the data channel that is already connected. @@ -137,8 +137,8 @@ Methods fd Acquire() Properties string Type [readonly] - The quality of service of the data channel. ("Reliable" - or "Streaming") + The quality of service of the data channel. ("reliable" + or "streaming") object Device [readonly] diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c index 93d260ef4..bf8f82fdf 100644 --- a/profiles/health/hdp.c +++ b/profiles/health/hdp.c @@ -448,9 +448,9 @@ static gboolean channel_property_get_type(const GDBusPropertyTable *property, const char *type; if (chan->config == HDP_RELIABLE_DC) - type = "Reliable"; + type = "reliable"; else - type = "Streaming"; + type = "streaming"; dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &type); @@ -1916,11 +1916,11 @@ static DBusMessage *device_create_channel(DBusConnection *conn, app = l->data; - if (g_ascii_strcasecmp("Reliable", conf) == 0) + if (g_ascii_strcasecmp("reliable", conf) == 0) config = HDP_RELIABLE_DC; - else if (g_ascii_strcasecmp("Streaming", conf) == 0) + else if (g_ascii_strcasecmp("streaming", conf) == 0) config = HDP_STREAMING_DC; - else if (g_ascii_strcasecmp("Any", conf) == 0) + else if (g_ascii_strcasecmp("any", conf) == 0) config = HDP_NO_PREFERENCE_DC; else return btd_error_invalid_args(msg); diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c index b2fb2acc7..5799ae5ab 100644 --- a/profiles/health/hdp_util.c +++ b/profiles/health/hdp_util.c @@ -275,9 +275,9 @@ static gboolean parse_chan_type(DBusMessageIter *iter, gpointer data, dbus_message_iter_get_basic(value, &chan_type); - if (g_ascii_strcasecmp("Reliable", chan_type) == 0) + if (g_ascii_strcasecmp("reliable", chan_type) == 0) app->chan_type = HDP_RELIABLE_DC; - else if (g_ascii_strcasecmp("Streaming", chan_type) == 0) + else if (g_ascii_strcasecmp("streaming", chan_type) == 0) app->chan_type = HDP_STREAMING_DC; else { g_set_error(err, HDP_ERROR, HDP_DIC_ENTRY_PARSE_ERROR, diff --git a/test/test-health b/test/test-health index 666972cc9..052a6024c 100755 --- a/test/test-health +++ b/test/test-health @@ -64,9 +64,9 @@ while role == None: try: sel = int(sys.stdin.readline()) if sel == 1: - role = "Source" + role = "source" elif sel == 2: - role = "Sink" + role = "sink" else: raise ValueError except (TypeError, ValueError): @@ -88,16 +88,16 @@ while dtype == None: sys.exit() pref = None -if role == "Source": +if role == "source": while pref == None: try: print("Select a preferred data channel type 1.",) print("reliable 2. streaming: ",) sel = int(sys.stdin.readline()) if sel == 1: - pref = "Reliable" + pref = "reliable" elif sel == 2: - pref = "Streaming" + pref = "streaming" else: raise ValueError @@ -217,10 +217,10 @@ if echo: print("Connecting to device %s" % (select)) -if role == "Source": - chan = device.CreateChannel(app_path, "Reliable") +if role == "source": + chan = device.CreateChannel(app_path, "reliable") else: - chan = device.CreateChannel(app_path, "Any") + chan = device.CreateChannel(app_path, "any") print(chan) -- 2.47.3