technology: Update tethering properties when relevant
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Thu, 20 Sep 2012 13:33:36 +0000 (16:33 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 1 Oct 2012 10:17:41 +0000 (13:17 +0300)
src/technology.c

index 3fc7afc..d78e7b3 100644 (file)
@@ -734,9 +734,17 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (strlen(str) < 1 || strlen(str) > 32)
                        return __connman_error_invalid_arguments(msg);
 
-               g_free(technology->tethering_ident);
-               technology->tethering_ident = g_strdup(str);
-               technology_save(technology);
+               if (g_strcmp0(technology->tethering_ident, str) != 0) {
+                       g_free(technology->tethering_ident);
+                       technology->tethering_ident = g_strdup(str);
+                       technology_save(technology);
+
+                       connman_dbus_property_changed_basic(technology->path,
+                                               CONNMAN_TECHNOLOGY_INTERFACE,
+                                               "TetheringIdentifier",
+                                               DBUS_TYPE_STRING,
+                                               &technology->tethering_ident);
+               }
        } else if (g_str_equal(name, "TetheringPassphrase") == TRUE) {
                const char *str;
 
@@ -748,9 +756,17 @@ static DBusMessage *set_property(DBusConnection *conn,
                if (strlen(str) < 8 || strlen(str) > 63)
                        return __connman_error_passphrase_required(msg);
 
-               g_free(technology->tethering_passphrase);
-               technology->tethering_passphrase = g_strdup(str);
-               technology_save(technology);
+               if (g_strcmp0(technology->tethering_passphrase, str) != 0) {
+                       g_free(technology->tethering_passphrase);
+                       technology->tethering_passphrase = g_strdup(str);
+                       technology_save(technology);
+
+                       connman_dbus_property_changed_basic(technology->path,
+                                       CONNMAN_TECHNOLOGY_INTERFACE,
+                                       "TetheringPassphrase",
+                                       DBUS_TYPE_STRING,
+                                       &technology->tethering_passphrase);
+               }
        } else if (g_str_equal(name, "Powered") == TRUE) {
                connman_bool_t enable;