aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-02-22 08:58:36 +0100
committerAleksander Morgado <aleksander@lanedo.com>2013-02-22 16:35:56 +0100
commit75d20c15d4f844270cfc6c31fae261412e4b1b59 (patch)
tree1a99f7713ae4d5cd1303d94da8744cdfc5b71fa9 /src/mm-iface-modem.c
parenta18140e8ed86e6881d1b5f4bcf33620ff791f35e (diff)
api: notify in the interface about the reason why the modem is FAILED
We currently implement 'SIM missing' and 'SIM error', which are probably the most common ones.
Diffstat (limited to 'src/mm-iface-modem.c')
-rw-r--r--src/mm-iface-modem.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index f02b0bdc..0775add1 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -1145,10 +1145,11 @@ bearer_list_count_connected (MMBearer *bearer,
(*count)++;
}
-void
-mm_iface_modem_update_state (MMIfaceModem *self,
- MMModemState new_state,
- MMModemStateChangeReason reason)
+static void
+__iface_modem_update_state_internal (MMIfaceModem *self,
+ MMModemState new_state,
+ MMModemStateChangeReason reason,
+ MMModemStateFailedReason failed_reason)
{
MMModemState old_state = MM_MODEM_STATE_UNKNOWN;
MmGdbusModem *skeleton = NULL;
@@ -1207,6 +1208,10 @@ mm_iface_modem_update_state (MMIfaceModem *self,
/* Signal status change */
if (skeleton) {
+ /* Set failure reason */
+ if (failed_reason != mm_gdbus_modem_get_state_failed_reason (skeleton))
+ mm_gdbus_modem_set_state_failed_reason (skeleton, failed_reason);
+
/* Flush current change before signaling the state change,
* so that clients get the proper state already in the
* state-changed callback */
@@ -1239,6 +1244,23 @@ mm_iface_modem_update_state (MMIfaceModem *self,
g_object_unref (bearer_list);
}
+void
+mm_iface_modem_update_state (MMIfaceModem *self,
+ MMModemState new_state,
+ MMModemStateChangeReason reason)
+{
+ g_assert (new_state != MM_MODEM_STATE_FAILED);
+
+ __iface_modem_update_state_internal (self, new_state, reason, MM_MODEM_STATE_FAILED_REASON_NONE);
+}
+
+void
+mm_iface_modem_update_failed_state (MMIfaceModem *self,
+ MMModemStateFailedReason failed_reason)
+{
+ __iface_modem_update_state_internal (self, MM_MODEM_STATE_FAILED, MM_MODEM_STATE_CHANGE_REASON_FAILURE, failed_reason);
+}
+
/*****************************************************************************/
typedef struct {
@@ -4092,6 +4114,7 @@ mm_iface_modem_initialize (MMIfaceModem *self,
mm_gdbus_modem_set_supported_bands (skeleton, mm_common_build_bands_unknown ());
mm_gdbus_modem_set_bands (skeleton, mm_common_build_bands_unknown ());
mm_gdbus_modem_set_power_state (skeleton, MM_MODEM_POWER_STATE_UNKNOWN);
+ mm_gdbus_modem_set_state_failed_reason (skeleton, MM_MODEM_STATE_FAILED_REASON_NONE);
/* Bind our State property */
g_object_bind_property (self, MM_IFACE_MODEM_STATE,