+ if (!has_interface(modem->interfaces, OFONO_API_NETREG))
+ return;
+
+ netreg_get_properties(modem);
+}
+
+static void cm_update_powered(struct modem_data *modem,
+ DBusMessageIter *value)
+{
+ dbus_bool_t cm_powered;
+
+ dbus_message_iter_get_basic(value, &cm_powered);
+ modem->cm_powered = cm_powered;
+
+ DBG("%s ConnnectionManager Powered %d", modem->path,
+ modem->cm_powered);
+
+ if (modem->cm_powered)
+ return;
+
+ cm_set_powered(modem, TRUE);
+}
+
+static gboolean cm_changed(DBusConnection *conn, DBusMessage *message,
+ void *user_data)
+{
+ const char *path = dbus_message_get_path(message);
+ struct modem_data *modem;
+ DBusMessageIter iter, value;
+ const char *key;
+
+ modem = g_hash_table_lookup(modem_hash, path);
+ if (!modem)
+ return TRUE;
+
+ if (modem->ignore)
+ return TRUE;
+
+ if (!dbus_message_iter_init(message, &iter))
+ return TRUE;
+
+ dbus_message_iter_get_basic(&iter, &key);
+
+ dbus_message_iter_next(&iter);
+ dbus_message_iter_recurse(&iter, &value);
+
+ if (g_str_equal(key, "Attached"))
+ cm_update_attached(modem, &value);
+ else if (g_str_equal(key, "Powered"))
+ cm_update_powered(modem, &value);
+
+ return TRUE;
+}
+
+static void cdma_cm_update_powered(struct modem_data *modem,
+ DBusMessageIter *value)
+{
+ struct network_context *context = NULL;
+ dbus_bool_t cdma_cm_powered;
+
+ dbus_message_iter_get_basic(value, &cdma_cm_powered);
+ modem->cdma_cm_powered = cdma_cm_powered;
+
+ DBG("%s CDMA cm Powered %d", modem->path, modem->cdma_cm_powered);
+
+ if (!modem->context_list)
+ return;
+
+ /* In case of CDMA, there is only one context */
+ context = modem->context_list->data;
+ if (modem->cdma_cm_powered)
+ set_connected(modem, context);
+ else
+ set_disconnected(context);
+}
+
+static void cdma_cm_update_settings(struct modem_data *modem,
+ DBusMessageIter *value)
+{
+ DBG("%s Settings", modem->path);
+
+ extract_ipv4_settings(value, modem->context_list->data);
+}
+
+static gboolean cdma_cm_changed(DBusConnection *conn,
+ DBusMessage *message, void *user_data)
+{
+ const char *path = dbus_message_get_path(message);
+ struct modem_data *modem;
+ DBusMessageIter iter, value;
+ const char *key;
+
+ modem = g_hash_table_lookup(modem_hash, path);
+ if (!modem)
+ return TRUE;
+
+ if (modem->online && !modem->context_list)
+ cdma_netreg_get_properties(modem);
+
+ if (!dbus_message_iter_init(message, &iter))
+ return TRUE;
+
+ dbus_message_iter_get_basic(&iter, &key);
+
+ dbus_message_iter_next(&iter);
+ dbus_message_iter_recurse(&iter, &value);
+
+ if (g_str_equal(key, "Powered"))
+ cdma_cm_update_powered(modem, &value);
+ if (g_str_equal(key, "Settings"))
+ cdma_cm_update_settings(modem, &value);
+