Add MCC and MNC values to service properties
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 18 Sep 2009 01:35:43 +0000 (18:35 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 18 Sep 2009 01:35:43 +0000 (18:35 -0700)
src/service.c

index c1c33f7..b798b04 100644 (file)
@@ -60,6 +60,8 @@ struct connman_service {
        char *apn;
        char *username;
        char *password;
+       char *mcc;
+       char *mnc;
        connman_bool_t roaming;
        struct connman_ipconfig *ipconfig;
        struct connman_device *device;
@@ -492,6 +494,13 @@ static DBusMessage *get_properties(DBusConnection *conn,
                connman_dbus_dict_append_variant(&dict, "Roaming",
                                        DBUS_TYPE_BOOLEAN, &service->roaming);
 
+               if (service->mcc != NULL && service->mnc != NULL) {
+                       connman_dbus_dict_append_variant(&dict, "MCC",
+                                       DBUS_TYPE_STRING, &service->mcc);
+                       connman_dbus_dict_append_variant(&dict, "MNC",
+                                       DBUS_TYPE_STRING, &service->mnc);
+               }
+
                if (service->apn != NULL) {
                        connman_dbus_dict_append_variant(&dict, "APN",
                                        DBUS_TYPE_STRING, &service->apn);
@@ -1030,9 +1039,11 @@ static void service_free(gpointer user_data)
                service->ipconfig = NULL;
        }
 
+       g_free(service->mcc);
+       g_free(service->mnc);
        g_free(service->apn);
        g_free(service->username);
-       g_free(service->passphrase);
+       g_free(service->password);
        g_free(service->profile);
        g_free(service->name);
        g_free(service->passphrase);
@@ -2033,6 +2044,14 @@ static void update_from_network(struct connman_service *service,
        str = connman_network_get_string(network, "WiFi.Security");
        service->security = convert_wifi_security(str);
 
+       str = connman_network_get_string(network, "Cellular.MCC");
+       g_free(service->mcc);
+       service->mcc = g_strdup(str);
+
+       str = connman_network_get_string(network, "Cellular.MNC");
+       g_free(service->mnc);
+       service->mnc = g_strdup(str);
+
        if (service->strength > strength && service->network != NULL) {
                connman_network_unref(service->network);
                service->network = connman_network_ref(network);