+static void xsim_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ifx_data *data = ofono_modem_get_data(modem);
+
+ GAtResultIter iter;
+ int state;
+
+ if (data->sim == NULL)
+ return;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XSIM:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &state))
+ return;
+
+ ifx_set_sim_state(modem, state);
+}
+
+static void xsimstate_query(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct ifx_data *data = ofono_modem_get_data(modem);
+ GAtResultIter iter;
+ int mode;
+ int state;
+
+ DBG("");
+
+ if (!ok)
+ return;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+XSIMSTATE:"))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &mode))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &state))
+ return;
+
+ ifx_set_sim_state(modem, state);
+}
+