Skip to content

Commit

Permalink
health: Use lower-case strings for enum values (for consistency)
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Hedberg committed Dec 20, 2012
1 parent db5d83d commit 98b4797
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions doc/health-api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Methods object CreateApplication(dict config)

string Role:

Mandatory. Possible values: "Source",
"Sink"
Mandatory. Possible values: "source",
"sink"

string Description:

Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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]

Expand Down
10 changes: 5 additions & 5 deletions profiles/health/hdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions profiles/health/hdp_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions test/test-health
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 98b4797

Please sign in to comment.