aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem.h
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2024-07-11 17:00:57 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2024-09-30 07:54:56 +0000
commita24a6ee4c5af47859e433fe9559946515fb1869c (patch)
tree35cebc56093c113ef9994d7ad0ef201c171185f2 /src/mm-base-modem.h
parent8e8e88b75df329eb065e11491bbe5420c75cfd4e (diff)
base-modem: add setup to allow exclusive operations
There are certain operations that cannot be run in parallel, e.g. one should not disable and bring the modem to low power mode while there are also incoming requests to enable the modem. This type of errors will typically happen when multiple DBus clients are trying to use the same modem at the same time for different purposes. We do not have any way to have DBus clients take exclusive ownership of a given modem object, so the best we can do for now is trying to synchronize operations that cannot be run together, preserving the order in which they arrived, and running them one by one.
Diffstat (limited to 'src/mm-base-modem.h')
-rw-r--r--src/mm-base-modem.h52
1 files changed, 44 insertions, 8 deletions
diff --git a/src/mm-base-modem.h b/src/mm-base-modem.h
index 39e203f9..24dfcdc9 100644
--- a/src/mm-base-modem.h
+++ b/src/mm-base-modem.h
@@ -227,14 +227,50 @@ guint mm_base_modem_get_subsystem_vendor_id (MMBaseModem *self);
GCancellable *mm_base_modem_peek_cancellable (MMBaseModem *self);
-void mm_base_modem_authorize (MMBaseModem *self,
- GDBusMethodInvocation *invocation,
- const gchar *authorization,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gboolean mm_base_modem_authorize_finish (MMBaseModem *self,
- GAsyncResult *res,
- GError **error);
+/******************************************************************************/
+/* Polkit */
+
+void mm_base_modem_authorize (MMBaseModem *self,
+ GDBusMethodInvocation *invocation,
+ const gchar *authorization,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean mm_base_modem_authorize_finish (MMBaseModem *self,
+ GAsyncResult *res,
+ GError **error);
+
+/******************************************************************************/
+/* Operation lock support */
+
+typedef enum { /*< underscore_name=mm_base_modem_operation_priority >*/
+ /* Default operations are scheduled at the end of the list of pending
+ * operations */
+ MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
+} MMBaseModemOperationPriority;
+
+void mm_base_modem_operation_lock (MMBaseModem *self,
+ MMBaseModemOperationPriority priority,
+ const gchar *description,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gssize mm_base_modem_operation_lock_finish (MMBaseModem *self,
+ GAsyncResult *res,
+ GError **error);
+void mm_base_modem_operation_unlock (MMBaseModem *self,
+ gssize operation_id);
+
+void mm_base_modem_authorize_and_operation_lock (MMBaseModem *self,
+ GDBusMethodInvocation *invocation,
+ const gchar *authorization,
+ MMBaseModemOperationPriority operation_priority,
+ const gchar *operation_description,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gssize mm_base_modem_authorize_and_operation_lock_finish (MMBaseModem *self,
+ GAsyncResult *res,
+ GError **error);
+
+/******************************************************************************/
void mm_base_modem_initialize (MMBaseModem *self,
GAsyncReadyCallback callback,