From: Marcel Holtmann Date: Sat, 28 Nov 2009 14:15:38 +0000 (+0000) Subject: Use one common service type to string conversion routine X-Git-Tag: accepted/2.0alpha-wayland/20121110.002834~3140 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b4c823115b9cf4db45227b6152b75170df10d48;p=profile%2Fivi%2Fconnman.git Use one common service type to string conversion routine --- diff --git a/src/connman.h b/src/connman.h index 098bed5..1475d0a 100644 --- a/src/connman.h +++ b/src/connman.h @@ -359,6 +359,8 @@ int __connman_service_disconnect(struct connman_service *service); int __connman_service_create_and_connect(DBusMessage *msg); void __connman_service_auto_connect(void); +const char *__connman_service_type2string(enum connman_service_type type); + #include #include diff --git a/src/notifier.c b/src/notifier.c index 63e2a9d..303bc42 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -70,26 +70,6 @@ void connman_notifier_unregister(struct connman_notifier *notifier) notifier_list = g_slist_remove(notifier_list, notifier); } -static const char *type2string(enum connman_service_type type) -{ - switch (type) { - case CONNMAN_SERVICE_TYPE_UNKNOWN: - break; - case CONNMAN_SERVICE_TYPE_ETHERNET: - return "ethernet"; - case CONNMAN_SERVICE_TYPE_WIFI: - return "wifi"; - case CONNMAN_SERVICE_TYPE_WIMAX: - return "wimax"; - case CONNMAN_SERVICE_TYPE_BLUETOOTH: - return "bluetooth"; - case CONNMAN_SERVICE_TYPE_CELLULAR: - return "cellular"; - } - - return NULL; -} - #define MAX_TECHNOLOGIES 10 static volatile gint registered[MAX_TECHNOLOGIES]; @@ -101,7 +81,7 @@ void __connman_notifier_list_registered(DBusMessageIter *iter) int i; for (i = 0; i < 10; i++) { - const char *type = type2string(i); + const char *type = __connman_service_type2string(i); if (type == NULL) continue; @@ -117,7 +97,7 @@ void __connman_notifier_list_enabled(DBusMessageIter *iter) int i; for (i = 0; i < 10; i++) { - const char *type = type2string(i); + const char *type = __connman_service_type2string(i); if (type == NULL) continue; @@ -133,7 +113,7 @@ void __connman_notifier_list_connected(DBusMessageIter *iter) int i; for (i = 0; i < 10; i++) { - const char *type = type2string(i); + const char *type = __connman_service_type2string(i); if (type == NULL) continue; diff --git a/src/service.c b/src/service.c index 4a7e885..b2f2029 100644 --- a/src/service.c +++ b/src/service.c @@ -116,7 +116,7 @@ static struct connman_service *find_service(const char *path) return data.service; } -static const char *type2string(enum connman_service_type type) +const char *__connman_service_type2string(enum connman_service_type type) { switch (type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: @@ -243,7 +243,7 @@ const char *__connman_service_default(void) if (service->state != CONNMAN_SERVICE_STATE_READY) return ""; - return type2string(service->type); + return __connman_service_type2string(service->type); } static void mode_changed(struct connman_service *service) @@ -503,7 +503,7 @@ static DBusMessage *get_properties(DBusConnection *conn, DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict); - str = type2string(service->type); + str = __connman_service_type2string(service->type); if (str != NULL) connman_dbus_dict_append_variant(&dict, "Type", DBUS_TYPE_STRING, &str);