<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 25, 2014 at 1:46 AM, Ben Chan <span dir="ltr"><<a href="mailto:benchan@chromium.org" target="_blank">benchan@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/mbimcli/mbimcli-basic-connect.c | 30 ------------------------------<br>
src/mbimcli/mbimcli-phonebook.c | 8 +-------<br>
src/mbimcli/mbimcli.h | 2 ++<br>
3 files changed, 3 insertions(+), 37 deletions(-)<br>
<br>
diff --git a/src/mbimcli/mbimcli-basic-connect.c b/src/mbimcli/mbimcli-basic-connect.c<br>
index b97154c..a73da19 100644<br>
--- a/src/mbimcli/mbimcli-basic-connect.c<br>
+++ b/src/mbimcli/mbimcli-basic-connect.c<br>
@@ -301,9 +301,6 @@ query_device_caps_ready (MbimDevice *device,<br>
sms_caps_str = mbim_sms_caps_build_string_from_mask (sms_caps);<br>
ctrl_caps_str = mbim_ctrl_caps_build_string_from_mask (ctrl_caps);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("[%s] Device capabilities retrieved:\n"<br>
"\t Device type: '%s'\n"<br>
"\t Cellular class: '%s'\n"<br>
@@ -388,9 +385,6 @@ query_subscriber_ready_status_ready (MbimDevice *device,<br>
ready_state_str = mbim_subscriber_ready_state_get_string (ready_state);<br>
ready_info_str = mbim_ready_info_flag_build_string_from_mask (ready_info);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("[%s] Subscriber ready status retrieved:\n"<br>
"\t Ready state: '%s'\n"<br>
"\t Subscriber ID: '%s'\n"<br>
@@ -447,9 +441,6 @@ query_radio_state_ready (MbimDevice *device,<br>
hardware_radio_state_str = mbim_radio_switch_state_get_string (hardware_radio_state);<br>
software_radio_state_str = mbim_radio_switch_state_get_string (software_radio_state);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("[%s] Radio state retrieved:\n"<br>
"\t Hardware Radio State: '%s'\n"<br>
"\t Software Radio State: '%s'\n",<br>
@@ -585,9 +576,6 @@ pin_ready (MbimDevice *device,<br>
g_print ("[%s] PIN operation successful\n\n",<br>
mbim_device_get_path_display (device));<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
pin_state_str = mbim_pin_state_get_string (pin_state);<br>
<br>
g_print ("[%s] Pin Info:\n"<br>
@@ -702,9 +690,6 @@ connect_ready (MbimDevice *device,<br>
break;<br>
}<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("[%s] Connection status:\n"<br>
"\t Session ID: '%u'\n"<br>
"\tActivation state: '%s'\n"<br>
@@ -818,9 +803,6 @@ home_provider_ready (MbimDevice *device,<br>
provider_state_str = mbim_provider_state_build_string_from_mask (provider->provider_state);<br>
cellular_class_str = mbim_cellular_class_build_string_from_mask (provider->cellular_class);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("[%s] Home provider:\n"<br>
"\t Provider ID: '%s'\n"<br>
"\t Provider Name: '%s'\n"<br>
@@ -888,9 +870,6 @@ preferred_providers_ready (MbimDevice *device,<br>
provider_state_str = mbim_provider_state_build_string_from_mask (providers[i]->provider_state);<br>
cellular_class_str = mbim_cellular_class_build_string_from_mask (providers[i]->cellular_class);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("\tProvider [%u]:\n"<br>
"\t\t Provider ID: '%s'\n"<br>
"\t\t Provider Name: '%s'\n"<br>
@@ -959,9 +938,6 @@ visible_providers_ready (MbimDevice *device,<br>
provider_state_str = mbim_provider_state_build_string_from_mask (providers[i]->provider_state);<br>
cellular_class_str = mbim_cellular_class_build_string_from_mask (providers[i]->cellular_class);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("\tProvider [%u]:\n"<br>
"\t\t Provider ID: '%s'\n"<br>
"\t\t Provider Name: '%s'\n"<br>
@@ -1039,9 +1015,6 @@ register_state_ready (MbimDevice *device,<br>
cellular_class_str = mbim_cellular_class_build_string_from_mask (cellular_class);<br>
registration_flag_str = mbim_registration_flag_build_string_from_mask (registration_flag);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("[%s] Registration status:\n"<br>
"\t Network error: '%s'\n"<br>
"\t Register state: '%s'\n"<br>
@@ -1182,9 +1155,6 @@ packet_service_ready (MbimDevice *device,<br>
break;<br>
}<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
highest_available_data_class_str = mbim_data_class_build_string_from_mask (highest_available_data_class);<br>
<br>
g_print ("[%s] Packet service status:\n"<br>
diff --git a/src/mbimcli/mbimcli-phonebook.c b/src/mbimcli/mbimcli-phonebook.c<br>
index 0cbb85f..95c3c48 100644<br>
--- a/src/mbimcli/mbimcli-phonebook.c<br>
+++ b/src/mbimcli/mbimcli-phonebook.c<br>
@@ -276,9 +276,6 @@ query_phonebook_read_ready (MbimDevice *device,<br>
return;<br>
}<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("Successfully read phonebook entries (%d)\n", entry_count);<br>
for (i = 0; i < entry_count; i++) {<br>
g_print ("\tEntry index : %d \n"<br>
@@ -330,16 +327,13 @@ query_phonebook_configuration_ready (MbimDevice *device,<br>
<br>
state_str = mbim_phonebook_state_get_string (state);<br>
<br>
-#undef VALIDATE_UNKNOWN<br>
-#define VALIDATE_UNKNOWN(str) (str ? str : "unknown")<br>
-<br>
g_print ("\n Phonebook configuration retrived... \n"<br>
"\t Phonebook state: %s \n"<br>
"\t Number of entries: %d \n"<br>
"\t used entries: %d \n"<br>
"\t max number length: %d \n"<br>
"\t max name : %d \n",<br>
- VALIDATE_UNKNOWN(state_str),<br>
+ VALIDATE_UNKNOWN (state_str),<br>
number_of_entries,<br>
used_entries,<br>
max_number_length,<br>
diff --git a/src/mbimcli/mbimcli.h b/src/mbimcli/mbimcli.h<br>
index 411b776..5fcdc7a 100644<br>
--- a/src/mbimcli/mbimcli.h<br>
+++ b/src/mbimcli/mbimcli.h<br>
@@ -23,6 +23,8 @@<br>
#ifndef __MBIMCLI_H__<br>
#define __MBIMCLI_H__<br>
<br>
+#define VALIDATE_UNKNOWN(str) ((str) ? (str) : "unknown")<br>
+<br>
/* Common */<br>
void mbimcli_async_operation_done (gboolean operation_status);<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.9.0.rc1.175.g0b1dcb5<br>
<br>
</font></span></blockquote></div><br></div><div class="gmail_extra">Not sure if mbimcli.h is the best location. But I found myself adding the same macro when implementing additional device services, so thought it's better to move the macro in one common place.</div>
<div class="gmail_extra"><br></div></div>