aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-03-24 16:07:06 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-04-02 15:05:02 +0200
commit7dfe6198e1015c3fcc875d7be17e6b1a925c8e00 (patch)
tree9e16d70823a8b79e937c9ea38b2507e9445a483a /src
parentcc59492cafbfff61568870dae640c614c6842415 (diff)
iface-modem: publish helper to abort invocation if state not reached
So that we can use it in other interfaces to abort invocations e.g. if the modem is not yet enabled.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem.c23
-rw-r--r--src/mm-iface-modem.h13
2 files changed, 20 insertions, 16 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index f697e80e..f80e5b7b 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -320,14 +320,11 @@ mm_iface_modem_wait_for_final_state (MMIfaceModem *self,
}
/*****************************************************************************/
-/* Helper to return an error when the modem is in failed state and so it
- * cannot process a given method invocation
- */
-static gboolean
-abort_invocation_if_state_not_reached (MMIfaceModem *self,
- GDBusMethodInvocation *invocation,
- MMModemState minimum_required)
+gboolean
+mm_iface_modem_abort_invocation_if_state_not_reached (MMIfaceModem *self,
+ GDBusMethodInvocation *invocation,
+ MMModemState minimum_required)
{
MMModemState state = MM_MODEM_STATE_UNKNOWN;
@@ -736,7 +733,7 @@ handle_create_bearer_auth_ready (MMBaseModem *self,
return;
}
- if (abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_LOCKED)) {
+ if (mm_iface_modem_abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_LOCKED)) {
handle_create_bearer_context_free (ctx);
return;
}
@@ -944,7 +941,7 @@ handle_delete_bearer_auth_ready (MMBaseModem *self,
return;
}
- if (abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_LOCKED)) {
+ if (mm_iface_modem_abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_LOCKED)) {
handle_delete_bearer_context_free (ctx);
return;
}
@@ -1010,7 +1007,7 @@ handle_list_bearers (MmGdbusModem *skeleton,
GStrv paths;
MMBearerList *list = NULL;
- if (abort_invocation_if_state_not_reached (self, invocation, MM_MODEM_STATE_LOCKED))
+ if (mm_iface_modem_abort_invocation_if_state_not_reached (self, invocation, MM_MODEM_STATE_LOCKED))
return TRUE;
g_object_get (self,
@@ -1975,7 +1972,7 @@ handle_enable_auth_ready (MMBaseModem *self,
return;
}
- if (abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_LOCKED)) {
+ if (mm_iface_modem_abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_LOCKED)) {
handle_enable_context_free (ctx);
return;
}
@@ -2845,7 +2842,7 @@ handle_set_current_bands_auth_ready (MMBaseModem *self,
return;
}
- if (abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_DISABLED)) {
+ if (mm_iface_modem_abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_DISABLED)) {
handle_set_current_bands_context_free (ctx);
return;
}
@@ -3231,7 +3228,7 @@ handle_set_current_modes_auth_ready (MMBaseModem *self,
return;
}
- if (abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_DISABLED)) {
+ if (mm_iface_modem_abort_invocation_if_state_not_reached (ctx->self, ctx->invocation, MM_MODEM_STATE_DISABLED)) {
handle_set_current_modes_context_free (ctx);
return;
}
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index c649a49f..8d3366e4 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -465,6 +465,16 @@ gboolean mm_iface_modem_disable_finish (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
+/* Shutdown Modem interface */
+void mm_iface_modem_shutdown (MMIfaceModem *self);
+
+/* Helper to return an error when the modem is in failed state and so it
+ * cannot process a given method invocation
+ */
+gboolean mm_iface_modem_abort_invocation_if_state_not_reached (MMIfaceModem *self,
+ GDBusMethodInvocation *invocation,
+ MMModemState minimum_required);
+
/* Allow setting power state */
void mm_iface_modem_set_power_state (MMIfaceModem *self,
MMModemPowerState power_state,
@@ -474,9 +484,6 @@ gboolean mm_iface_modem_set_power_state_finish (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
-/* Shutdown Modem interface */
-void mm_iface_modem_shutdown (MMIfaceModem *self);
-
/* Request lock info update.
* It will not only return the lock status, but also set the property values
* in the DBus interface. If 'known_lock' is given, that lock status will be