auth-provider: move auth provider logic into each class
Rather than make all of them rely on MMBaseModem for it. This lets us disentangle dependencies for easier unit testing. For interfaces, rather than casting directly to MMBaseModem use intermediate interfaces (MMIfaceAuth and MMIfaceOpLock) that tests can fake out. Signed-off-by: Dan Williams <dan@ioncontrol.co>
This commit is contained in:
+36
-1
@@ -206,10 +206,43 @@ libport_dep = declare_dependency(
|
||||
link_with: libport,
|
||||
)
|
||||
|
||||
# auth provider library
|
||||
sources = files(
|
||||
'mm-auth-provider.c',
|
||||
'mm-context.c',
|
||||
)
|
||||
|
||||
incs = [
|
||||
top_inc,
|
||||
kerneldevice_inc,
|
||||
]
|
||||
|
||||
deps = [libmm_glib_dep, libhelpers_dep]
|
||||
|
||||
if enable_polkit
|
||||
deps += polkit_gobject_dep
|
||||
endif
|
||||
|
||||
private_deps = []
|
||||
|
||||
libauth = static_library(
|
||||
'auth',
|
||||
sources: sources,
|
||||
include_directories: incs,
|
||||
dependencies: deps,
|
||||
c_args: '-DPLUGINDIR="@0@"'.format(mm_prefix / mm_pkglibdir),
|
||||
)
|
||||
|
||||
libauth_dep = declare_dependency(
|
||||
include_directories: ['.', kerneldevice_inc],
|
||||
dependencies: deps,
|
||||
link_with: libauth,
|
||||
)
|
||||
|
||||
# Daemon enums, required by plugins
|
||||
headers = files(
|
||||
'mm-base-bearer.h',
|
||||
'mm-base-modem.h',
|
||||
'mm-iface-op-lock.h',
|
||||
'mm-filter.h',
|
||||
'mm-port-probe.h',
|
||||
)
|
||||
@@ -292,6 +325,7 @@ sources = files(
|
||||
'mm-iface-modem-simple.c',
|
||||
'mm-iface-modem-time.c',
|
||||
'mm-iface-modem-voice.c',
|
||||
'mm-iface-op-lock.c',
|
||||
'mm-log-helpers.c',
|
||||
'mm-plugin.c',
|
||||
'mm-plugin-manager.c',
|
||||
@@ -308,6 +342,7 @@ deps = [
|
||||
gmodule_dep,
|
||||
libport_dep,
|
||||
libqcdm_dep,
|
||||
libauth_dep,
|
||||
]
|
||||
|
||||
if enable_tests
|
||||
|
||||
@@ -226,3 +226,40 @@ mm_auth_provider_class_init (MMAuthProviderClass *class)
|
||||
}
|
||||
|
||||
MM_DEFINE_SINGLETON_GETTER (MMAuthProvider, mm_auth_provider_get, MM_TYPE_AUTH_PROVIDER)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Auth interface */
|
||||
|
||||
G_DEFINE_INTERFACE (MMIfaceAuth, mm_iface_auth, G_TYPE_OBJECT)
|
||||
|
||||
void
|
||||
mm_iface_auth_authorize (MMIfaceAuth *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_assert (MM_IFACE_AUTH_GET_IFACE (self)->authorize != NULL);
|
||||
|
||||
MM_IFACE_AUTH_GET_IFACE (self)->authorize (self,
|
||||
invocation,
|
||||
authorization,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_iface_auth_authorize_finish (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_assert (MM_IFACE_AUTH_GET_IFACE (self)->authorize_finish != NULL);
|
||||
|
||||
return MM_IFACE_AUTH_GET_IFACE (self)->authorize_finish (self, res, error);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_iface_auth_default_init (MMIfaceAuthInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -56,4 +56,39 @@ gboolean mm_auth_provider_authorize_finish (MMAuthProvider *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Auth interface
|
||||
*
|
||||
* Implemented by objects (mainly MMBaseModem) that provide authorization
|
||||
* capability to other interfaces (MMIfaceModem) since GLib interfaces don't
|
||||
* have private data to store the singletone.
|
||||
*/
|
||||
|
||||
#define MM_TYPE_IFACE_AUTH mm_iface_auth_get_type ()
|
||||
G_DECLARE_INTERFACE (MMIfaceAuth, mm_iface_auth, MM, IFACE_AUTH, GObject)
|
||||
|
||||
struct _MMIfaceAuthInterface {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
void (* authorize) (MMIfaceAuth *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean (* authorize_finish) (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
};
|
||||
|
||||
void mm_iface_auth_authorize (MMIfaceAuth *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean mm_iface_auth_authorize_finish (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
#endif /* MM_AUTH_PROVIDER_H */
|
||||
|
||||
+27
-24
@@ -41,6 +41,7 @@
|
||||
#include "mm-error-helpers.h"
|
||||
#include "mm-bearer-stats.h"
|
||||
#include "mm-dispatcher-connection.h"
|
||||
#include "mm-auth-provider.h"
|
||||
|
||||
/* We require up to 20s to get a proper IP when using PPP */
|
||||
#define BEARER_IP_TIMEOUT_DEFAULT 20
|
||||
@@ -83,6 +84,10 @@ struct _MMBaseBearerPrivate {
|
||||
GDBusConnection *connection;
|
||||
guint dbus_id;
|
||||
|
||||
/* The authorization provider */
|
||||
MMAuthProvider *authp;
|
||||
GCancellable *authp_cancellable;
|
||||
|
||||
/* The modem which owns this BEARER */
|
||||
MMBaseModem *modem;
|
||||
/* The path where the BEARER object is exported */
|
||||
@@ -1118,7 +1123,6 @@ mm_base_bearer_connect (MMBaseBearer *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseBearer *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleConnectContext;
|
||||
|
||||
@@ -1126,7 +1130,6 @@ static void
|
||||
handle_connect_context_free (HandleConnectContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx);
|
||||
}
|
||||
@@ -1147,13 +1150,13 @@ handle_connect_ready (MMBaseBearer *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_connect_auth_ready (MMBaseModem *modem,
|
||||
handle_connect_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleConnectContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_connect_context_free (ctx);
|
||||
return;
|
||||
@@ -1174,15 +1177,13 @@ handle_connect (MMBaseBearer *self,
|
||||
ctx = g_new0 (HandleConnectContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_BEARER_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_connect_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_connect_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1307,7 +1308,6 @@ mm_base_bearer_disconnect (MMBaseBearer *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseBearer *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleDisconnectContext;
|
||||
|
||||
@@ -1315,7 +1315,6 @@ static void
|
||||
handle_disconnect_context_free (HandleDisconnectContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx);
|
||||
}
|
||||
@@ -1336,13 +1335,13 @@ handle_disconnect_ready (MMBaseBearer *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_disconnect_auth_ready (MMBaseModem *modem,
|
||||
handle_disconnect_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleDisconnectContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_disconnect_context_free (ctx);
|
||||
return;
|
||||
@@ -1363,15 +1362,13 @@ handle_disconnect (MMBaseBearer *self,
|
||||
ctx = g_new0 (HandleDisconnectContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_BEARER_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_disconnect_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_disconnect_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1835,6 +1832,10 @@ mm_base_bearer_init (MMBaseBearer *self)
|
||||
/* Each bearer is given a unique id to build its own DBus path */
|
||||
self->priv->dbus_id = id++;
|
||||
|
||||
/* Setup authorization provider */
|
||||
self->priv->authp = mm_auth_provider_get ();
|
||||
self->priv->authp_cancellable = g_cancellable_new ();
|
||||
|
||||
self->priv->status = MM_BEARER_STATUS_DISCONNECTED;
|
||||
self->priv->reason_3gpp = CONNECTION_FORBIDDEN_REASON_NONE;
|
||||
self->priv->reason_cdma = CONNECTION_FORBIDDEN_REASON_NONE;
|
||||
@@ -1886,6 +1887,8 @@ dispose (GObject *object)
|
||||
|
||||
g_clear_object (&self->priv->modem);
|
||||
g_clear_object (&self->priv->config);
|
||||
g_cancellable_cancel (self->priv->authp_cancellable);
|
||||
g_clear_object (&self->priv->authp_cancellable);
|
||||
|
||||
G_OBJECT_CLASS (mm_base_bearer_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
+66
-85
@@ -59,6 +59,10 @@ struct _MMBaseCallPrivate {
|
||||
GDBusConnection *connection;
|
||||
guint dbus_id;
|
||||
|
||||
/* The authorization provider */
|
||||
MMAuthProvider *authp;
|
||||
GCancellable *authp_cancellable;
|
||||
|
||||
/* The modem which owns this call */
|
||||
MMBaseModem *modem;
|
||||
/* The path where the call object is exported */
|
||||
@@ -139,7 +143,6 @@ mm_base_call_change_audio_settings (MMBaseCall *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseCall *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleStartContext;
|
||||
|
||||
@@ -147,7 +150,6 @@ static void
|
||||
handle_start_context_free (HandleStartContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx);
|
||||
}
|
||||
@@ -203,14 +205,14 @@ handle_start_ready (MMBaseCall *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_start_auth_ready (MMBaseModem *modem,
|
||||
handle_start_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleStartContext *ctx)
|
||||
{
|
||||
MMCallState state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_base_call_change_state (ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN);
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_start_context_free (ctx);
|
||||
@@ -230,7 +232,7 @@ handle_start_auth_ready (MMBaseModem *modem,
|
||||
mm_obj_info (ctx->self, "processing user request to start voice call...");
|
||||
|
||||
/* Disallow non-emergency calls when in emergency-only state */
|
||||
if (!mm_iface_modem_voice_authorize_outgoing_call (MM_IFACE_MODEM_VOICE (modem), ctx->self, &error)) {
|
||||
if (!mm_iface_modem_voice_authorize_outgoing_call (MM_IFACE_MODEM_VOICE (ctx->self->priv->modem), ctx->self, &error)) {
|
||||
mm_base_call_change_state (ctx->self, MM_CALL_STATE_TERMINATED, MM_CALL_STATE_REASON_UNKNOWN);
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_start_context_free (ctx);
|
||||
@@ -268,15 +270,13 @@ handle_start (MMBaseCall *self,
|
||||
ctx = g_new0 (HandleStartContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_start_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_start_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -285,7 +285,6 @@ handle_start (MMBaseCall *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseCall *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleAcceptContext;
|
||||
|
||||
@@ -293,7 +292,6 @@ static void
|
||||
handle_accept_context_free (HandleAcceptContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx);
|
||||
}
|
||||
@@ -324,14 +322,14 @@ handle_accept_ready (MMBaseCall *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_accept_auth_ready (MMBaseModem *modem,
|
||||
handle_accept_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleAcceptContext *ctx)
|
||||
{
|
||||
MMCallState state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_accept_context_free (ctx);
|
||||
return;
|
||||
@@ -372,13 +370,11 @@ handle_accept (MMBaseCall *self,
|
||||
ctx = g_new0 (HandleAcceptContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_accept_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
@@ -389,7 +385,6 @@ handle_accept (MMBaseCall *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseCall *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gchar *number;
|
||||
} HandleDeflectContext;
|
||||
@@ -399,7 +394,6 @@ handle_deflect_context_free (HandleDeflectContext *ctx)
|
||||
{
|
||||
g_free (ctx->number);
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_slice_free (HandleDeflectContext, ctx);
|
||||
}
|
||||
@@ -425,14 +419,14 @@ handle_deflect_ready (MMBaseCall *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_deflect_auth_ready (MMBaseModem *modem,
|
||||
handle_deflect_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleDeflectContext *ctx)
|
||||
{
|
||||
MMCallState state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_deflect_context_free (ctx);
|
||||
return;
|
||||
@@ -475,15 +469,13 @@ handle_deflect (MMBaseCall *self,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->number = g_strdup (number);
|
||||
g_object_get (self,
|
||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_deflect_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_deflect_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -492,7 +484,6 @@ handle_deflect (MMBaseCall *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseCall *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleJoinMultipartyContext;
|
||||
|
||||
@@ -500,7 +491,6 @@ static void
|
||||
handle_join_multiparty_context_free (HandleJoinMultipartyContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx);
|
||||
}
|
||||
@@ -520,13 +510,13 @@ modem_voice_join_multiparty_ready (MMIfaceModemVoice *modem,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_join_multiparty_auth_ready (MMBaseModem *modem,
|
||||
GAsyncResult *res,
|
||||
handle_join_multiparty_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleJoinMultipartyContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_join_multiparty_context_free (ctx);
|
||||
return;
|
||||
@@ -537,7 +527,7 @@ handle_join_multiparty_auth_ready (MMBaseModem *modem,
|
||||
/* This action is provided in the Call API, but implemented in the Modem.Voice interface
|
||||
* logic, because the action affects not only one call object, but all call objects that
|
||||
* are part of the multiparty call. */
|
||||
mm_iface_modem_voice_join_multiparty (MM_IFACE_MODEM_VOICE (ctx->modem),
|
||||
mm_iface_modem_voice_join_multiparty (MM_IFACE_MODEM_VOICE (ctx->self->priv->modem),
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)modem_voice_join_multiparty_ready,
|
||||
ctx);
|
||||
@@ -552,15 +542,13 @@ handle_join_multiparty (MMBaseCall *self,
|
||||
ctx = g_new0 (HandleJoinMultipartyContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_join_multiparty_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_join_multiparty_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -569,7 +557,6 @@ handle_join_multiparty (MMBaseCall *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseCall *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleLeaveMultipartyContext;
|
||||
|
||||
@@ -577,7 +564,6 @@ static void
|
||||
handle_leave_multiparty_context_free (HandleLeaveMultipartyContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx);
|
||||
}
|
||||
@@ -598,13 +584,13 @@ modem_voice_leave_multiparty_ready (MMIfaceModemVoice *modem,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_leave_multiparty_auth_ready (MMBaseModem *modem,
|
||||
handle_leave_multiparty_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleLeaveMultipartyContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_leave_multiparty_context_free (ctx);
|
||||
return;
|
||||
@@ -615,7 +601,7 @@ handle_leave_multiparty_auth_ready (MMBaseModem *modem,
|
||||
/* This action is provided in the Call API, but implemented in the Modem.Voice interface
|
||||
* logic, because the action affects not only one call object, but all call objects that
|
||||
* are part of the multiparty call. */
|
||||
mm_iface_modem_voice_leave_multiparty (MM_IFACE_MODEM_VOICE (ctx->modem),
|
||||
mm_iface_modem_voice_leave_multiparty (MM_IFACE_MODEM_VOICE (ctx->self->priv->modem),
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)modem_voice_leave_multiparty_ready,
|
||||
ctx);
|
||||
@@ -630,15 +616,13 @@ handle_leave_multiparty (MMBaseCall *self,
|
||||
ctx = g_new0 (HandleLeaveMultipartyContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_leave_multiparty_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_leave_multiparty_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -647,7 +631,6 @@ handle_leave_multiparty (MMBaseCall *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseCall *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleHangupContext;
|
||||
|
||||
@@ -655,7 +638,6 @@ static void
|
||||
handle_hangup_context_free (HandleHangupContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx);
|
||||
}
|
||||
@@ -681,14 +663,14 @@ handle_hangup_ready (MMBaseCall *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_hangup_auth_ready (MMBaseModem *modem,
|
||||
handle_hangup_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleHangupContext *ctx)
|
||||
{
|
||||
MMCallState state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_hangup_context_free (ctx);
|
||||
return;
|
||||
@@ -728,15 +710,13 @@ handle_hangup (MMBaseCall *self,
|
||||
ctx = g_new0 (HandleHangupContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_hangup_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_hangup_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -745,7 +725,6 @@ handle_hangup (MMBaseCall *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseCall *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
gchar *dtmf;
|
||||
} HandleSendDtmfContext;
|
||||
@@ -754,7 +733,6 @@ static void
|
||||
handle_send_dtmf_context_free (HandleSendDtmfContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_free (ctx->dtmf);
|
||||
g_free (ctx);
|
||||
@@ -777,14 +755,14 @@ handle_send_dtmf_ready (MMBaseCall *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_send_dtmf_auth_ready (MMBaseModem *modem,
|
||||
handle_send_dtmf_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleSendDtmfContext *ctx)
|
||||
{
|
||||
MMCallState state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_send_dtmf_context_free (ctx);
|
||||
return;
|
||||
@@ -825,17 +803,14 @@ handle_send_dtmf (MMBaseCall *self,
|
||||
ctx = g_new0 (HandleSendDtmfContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
|
||||
ctx->dtmf = g_strdup (dtmf);
|
||||
g_object_get (self,
|
||||
MM_BASE_CALL_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_send_dtmf_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_send_dtmf_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1447,6 +1422,10 @@ mm_base_call_init (MMBaseCall *self)
|
||||
|
||||
/* Each call is given a unique id to build its own DBus path */
|
||||
self->priv->dbus_id = id++;
|
||||
|
||||
/* Setup authorization provider */
|
||||
self->priv->authp = mm_auth_provider_get ();
|
||||
self->priv->authp_cancellable = g_cancellable_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1480,6 +1459,8 @@ dispose (GObject *object)
|
||||
}
|
||||
|
||||
g_clear_object (&self->priv->modem);
|
||||
g_cancellable_cancel (self->priv->authp_cancellable);
|
||||
g_clear_object (&self->priv->authp_cancellable);
|
||||
|
||||
G_OBJECT_CLASS (mm_base_call_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -992,8 +992,8 @@ device_shutdown_step (GTask *task)
|
||||
"disabling modem%d",
|
||||
mm_base_modem_get_dbus_id (ctx->modem));
|
||||
mm_base_modem_disable (ctx->modem,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_PRIORITY_OVERRIDE,
|
||||
(GAsyncReadyCallback)shutdown_disable_ready,
|
||||
task);
|
||||
return;
|
||||
@@ -1228,7 +1228,7 @@ mm_base_manager_sync (MMBaseManager *self)
|
||||
/* We just want to start the synchronization, we don't need the result */
|
||||
if (modem) {
|
||||
mm_base_modem_sync (modem,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
(GAsyncReadyCallback)base_modem_sync_ready,
|
||||
NULL);
|
||||
}
|
||||
|
||||
+103
-72
@@ -41,9 +41,13 @@
|
||||
#include "mm-modem-helpers.h"
|
||||
|
||||
static void log_object_iface_init (MMLogObjectInterface *iface);
|
||||
static void auth_iface_init (MMIfaceAuthInterface *iface);
|
||||
static void op_lock_iface_init (MMIfaceOpLockInterface *iface);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MMBaseModem, mm_base_modem, MM_GDBUS_TYPE_OBJECT_SKELETON,
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_AUTH, auth_iface_init)
|
||||
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_OP_LOCK, op_lock_iface_init))
|
||||
|
||||
/* If we get 10 consecutive timeouts in a serial port, we consider the modem
|
||||
* invalid and we request re-probing. */
|
||||
@@ -150,6 +154,16 @@ struct _MMBaseModemPrivate {
|
||||
gboolean scheduled_operations_forbidden_forever;
|
||||
};
|
||||
|
||||
static void mm_base_modem_operation_lock (MMBaseModem *self,
|
||||
MMOperationPriority priority,
|
||||
const gchar *description,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
static gssize mm_base_modem_operation_lock_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
|
||||
guint
|
||||
mm_base_modem_get_dbus_id (MMBaseModem *self)
|
||||
{
|
||||
@@ -774,7 +788,7 @@ state_operation_ready (MMBaseModem *self,
|
||||
ctx = g_task_get_task_data (task);
|
||||
|
||||
if (ctx->operation_id >= 0) {
|
||||
mm_base_modem_operation_unlock (self, ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (self), ctx->operation_id);
|
||||
ctx->operation_id = (gssize) -1;
|
||||
}
|
||||
|
||||
@@ -821,12 +835,12 @@ lock_before_state_operation_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
state_operation (MMBaseModem *self,
|
||||
StateOperationType operation_type,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
MMBaseModemOperationPriority operation_priority,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
state_operation (MMBaseModem *self,
|
||||
StateOperationType operation_type,
|
||||
MMOperationLock operation_lock,
|
||||
MMOperationPriority operation_priority,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
StateOperationContext *ctx;
|
||||
@@ -878,12 +892,12 @@ state_operation (MMBaseModem *self,
|
||||
}
|
||||
g_assert (ctx->operation && ctx->operation_finish);
|
||||
|
||||
if (operation_lock == MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED) {
|
||||
if (operation_lock == MM_OPERATION_LOCK_ALREADY_ACQUIRED) {
|
||||
state_operation_run (task);
|
||||
return;
|
||||
}
|
||||
|
||||
g_assert (operation_lock == MM_BASE_MODEM_OPERATION_LOCK_REQUIRED);
|
||||
g_assert (operation_lock == MM_OPERATION_LOCK_REQUIRED);
|
||||
mm_base_modem_operation_lock (self,
|
||||
operation_priority,
|
||||
operation_description,
|
||||
@@ -905,14 +919,14 @@ mm_base_modem_sync_finish (MMBaseModem *self,
|
||||
|
||||
void
|
||||
mm_base_modem_sync (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
MMOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
state_operation (self,
|
||||
STATE_OPERATION_TYPE_SYNC,
|
||||
operation_lock,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -930,11 +944,11 @@ mm_base_modem_disable_finish (MMBaseModem *self,
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_disable (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
MMBaseModemOperationPriority operation_priority,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
mm_base_modem_disable (MMBaseModem *self,
|
||||
MMOperationLock operation_lock,
|
||||
MMOperationPriority operation_priority,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
state_operation (self,
|
||||
STATE_OPERATION_TYPE_DISABLE,
|
||||
@@ -955,15 +969,15 @@ mm_base_modem_enable_finish (MMBaseModem *self,
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_enable (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
mm_base_modem_enable (MMBaseModem *self,
|
||||
MMOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
state_operation (self,
|
||||
STATE_OPERATION_TYPE_ENABLE,
|
||||
operation_lock,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -979,15 +993,15 @@ mm_base_modem_initialize_finish (MMBaseModem *self,
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_initialize (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
mm_base_modem_initialize (MMBaseModem *self,
|
||||
MMOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
state_operation (self,
|
||||
STATE_OPERATION_TYPE_INITIALIZE,
|
||||
operation_lock,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
@@ -1775,8 +1789,8 @@ mm_base_modem_organize_ports (MMBaseModem *self,
|
||||
/*****************************************************************************/
|
||||
/* Authorization */
|
||||
|
||||
gboolean
|
||||
mm_base_modem_authorize_finish (MMBaseModem *self,
|
||||
static gboolean
|
||||
mm_base_modem_authorize_finish (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -1798,14 +1812,15 @@ authorize_ready (MMAuthProvider *authp,
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_authorize (MMBaseModem *self,
|
||||
static void
|
||||
mm_base_modem_authorize (MMIfaceAuth *auth,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
MMBaseModem *self = MM_BASE_MODEM (auth);
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (self, self->priv->authp_cancellable, callback, user_data);
|
||||
|
||||
@@ -1821,10 +1836,10 @@ mm_base_modem_authorize (MMBaseModem *self,
|
||||
/* Exclusive operation */
|
||||
|
||||
typedef struct {
|
||||
gssize id;
|
||||
MMBaseModemOperationPriority priority;
|
||||
gchar *description;
|
||||
GTask *wait_task;
|
||||
gssize id;
|
||||
MMOperationPriority priority;
|
||||
gchar *description;
|
||||
GTask *wait_task;
|
||||
} OperationInfo;
|
||||
|
||||
static void
|
||||
@@ -1837,7 +1852,7 @@ operation_info_free (OperationInfo *info)
|
||||
|
||||
/* Exclusive operation lock */
|
||||
|
||||
gssize
|
||||
static gssize
|
||||
mm_base_modem_operation_lock_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
@@ -1862,7 +1877,7 @@ base_modem_operation_run (MMBaseModem *self)
|
||||
/* Run the operation in head of the list */
|
||||
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: lock acquired",
|
||||
info->id,
|
||||
mm_base_modem_operation_priority_get_string (info->priority),
|
||||
mm_operation_priority_get_string (info->priority),
|
||||
info->description);
|
||||
task = g_steal_pointer (&info->wait_task);
|
||||
g_task_return_int (task, info->id);
|
||||
@@ -1905,7 +1920,7 @@ abort_pending_operations (MMBaseModem *self)
|
||||
g_assert (info->wait_task);
|
||||
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: aborted early",
|
||||
info->id,
|
||||
mm_base_modem_operation_priority_get_string (info->priority),
|
||||
mm_operation_priority_get_string (info->priority),
|
||||
info->description);
|
||||
|
||||
task = g_steal_pointer (&info->wait_task);
|
||||
@@ -1918,12 +1933,12 @@ abort_pending_operations (MMBaseModem *self)
|
||||
self->priv->scheduled_operations = head;
|
||||
}
|
||||
|
||||
void
|
||||
mm_base_modem_operation_lock (MMBaseModem *self,
|
||||
MMBaseModemOperationPriority priority,
|
||||
const gchar *description,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
static void
|
||||
mm_base_modem_operation_lock (MMBaseModem *self,
|
||||
MMOperationPriority priority,
|
||||
const gchar *description,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
OperationInfo *info;
|
||||
@@ -1950,19 +1965,19 @@ mm_base_modem_operation_lock (MMBaseModem *self,
|
||||
} else
|
||||
operation_id++;
|
||||
|
||||
if (info->priority == MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE) {
|
||||
if (info->priority == MM_OPERATION_PRIORITY_OVERRIDE) {
|
||||
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: override requested - no new operations will be allowed",
|
||||
info->id,
|
||||
mm_base_modem_operation_priority_get_string (info->priority),
|
||||
mm_operation_priority_get_string (info->priority),
|
||||
info->description);
|
||||
g_assert (!self->priv->scheduled_operations_forbidden_forever);
|
||||
self->priv->scheduled_operations_forbidden_forever = TRUE;
|
||||
abort_pending_operations (self);
|
||||
self->priv->scheduled_operations = g_list_append (self->priv->scheduled_operations, info);
|
||||
} else if (info->priority == MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT) {
|
||||
} else if (info->priority == MM_OPERATION_PRIORITY_DEFAULT) {
|
||||
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: scheduled",
|
||||
info->id,
|
||||
mm_base_modem_operation_priority_get_string (info->priority),
|
||||
mm_operation_priority_get_string (info->priority),
|
||||
info->description);
|
||||
self->priv->scheduled_operations = g_list_append (self->priv->scheduled_operations, info);
|
||||
} else
|
||||
@@ -1973,10 +1988,11 @@ mm_base_modem_operation_lock (MMBaseModem *self,
|
||||
|
||||
/* Exclusive operation unlock */
|
||||
|
||||
void
|
||||
mm_base_modem_operation_unlock (MMBaseModem *self,
|
||||
gssize operation_id)
|
||||
static void
|
||||
mm_base_modem_operation_unlock (MMIfaceOpLock *_self,
|
||||
gssize operation_id)
|
||||
{
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
OperationInfo *info;
|
||||
|
||||
g_assert (self->priv->scheduled_operations);
|
||||
@@ -1987,7 +2003,7 @@ mm_base_modem_operation_unlock (MMBaseModem *self,
|
||||
|
||||
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: lock released",
|
||||
info->id,
|
||||
mm_base_modem_operation_priority_get_string (info->priority),
|
||||
mm_operation_priority_get_string (info->priority),
|
||||
info->description);
|
||||
|
||||
/* Remove head list item and free its contents */
|
||||
@@ -2002,9 +2018,9 @@ mm_base_modem_operation_unlock (MMBaseModem *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
GDBusMethodInvocation *invocation;
|
||||
MMBaseModemOperationPriority operation_priority;
|
||||
gchar *operation_description;
|
||||
GDBusMethodInvocation *invocation;
|
||||
MMOperationPriority operation_priority;
|
||||
gchar *operation_description;
|
||||
} AuthorizeAndOperationLockContext;
|
||||
|
||||
static void
|
||||
@@ -2015,8 +2031,8 @@ authorize_and_operation_lock_context_free (AuthorizeAndOperationLockContext *ctx
|
||||
g_slice_free (AuthorizeAndOperationLockContext, ctx);
|
||||
}
|
||||
|
||||
gssize
|
||||
mm_base_modem_authorize_and_operation_lock_finish (MMBaseModem *self,
|
||||
static gssize
|
||||
mm_base_modem_authorize_and_operation_lock_finish (MMIfaceOpLock *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -2040,35 +2056,35 @@ lock_after_authorize_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
authorize_before_lock_ready (MMBaseModem *self,
|
||||
authorize_before_lock_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
GTask *task)
|
||||
{
|
||||
GError *error = NULL;
|
||||
AuthorizeAndOperationLockContext *ctx;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
g_task_return_error (task, error);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx = g_task_get_task_data (task);
|
||||
mm_base_modem_operation_lock (self,
|
||||
mm_base_modem_operation_lock (MM_BASE_MODEM (auth),
|
||||
ctx->operation_priority,
|
||||
ctx->operation_description,
|
||||
(GAsyncReadyCallback) lock_after_authorize_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
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)
|
||||
static void
|
||||
mm_base_modem_authorize_and_operation_lock (MMIfaceOpLock *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
MMOperationPriority operation_priority,
|
||||
const gchar *operation_description,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GTask *task;
|
||||
AuthorizeAndOperationLockContext *ctx;
|
||||
@@ -2081,7 +2097,7 @@ mm_base_modem_authorize_and_operation_lock (MMBaseModem *self,
|
||||
ctx->operation_description = g_strdup (operation_description);
|
||||
g_task_set_task_data (task, ctx, (GDestroyNotify)authorize_and_operation_lock_context_free);
|
||||
|
||||
mm_base_modem_authorize (self,
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
authorization,
|
||||
(GAsyncReadyCallback)authorize_before_lock_ready,
|
||||
@@ -2623,6 +2639,21 @@ log_object_iface_init (MMLogObjectInterface *iface)
|
||||
iface->build_id = log_object_build_id;
|
||||
}
|
||||
|
||||
static void
|
||||
auth_iface_init (MMIfaceAuthInterface *iface)
|
||||
{
|
||||
iface->authorize = mm_base_modem_authorize;
|
||||
iface->authorize_finish = mm_base_modem_authorize_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
op_lock_iface_init (MMIfaceOpLockInterface *iface)
|
||||
{
|
||||
iface->authorize_and_lock = mm_base_modem_authorize_and_operation_lock;
|
||||
iface->authorize_and_lock_finish = mm_base_modem_authorize_and_operation_lock_finish;
|
||||
iface->unlock = mm_base_modem_operation_unlock;
|
||||
}
|
||||
|
||||
static void
|
||||
mm_base_modem_class_init (MMBaseModemClass *klass)
|
||||
{
|
||||
|
||||
+30
-82
@@ -36,6 +36,7 @@
|
||||
#include "mm-port-serial-qcdm.h"
|
||||
#include "mm-port-serial-gps.h"
|
||||
#include "mm-iface-port-at.h"
|
||||
#include "mm-iface-op-lock.h"
|
||||
|
||||
#if defined WITH_QMI
|
||||
#include "mm-port-qmi.h"
|
||||
@@ -219,95 +220,42 @@ guint mm_base_modem_get_subsystem_device_id (MMBaseModem *self);
|
||||
|
||||
GCancellable *mm_base_modem_peek_cancellable (MMBaseModem *self);
|
||||
|
||||
/******************************************************************************/
|
||||
/* 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 >*/
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_UNKNOWN,
|
||||
/* Default operations are scheduled at the end of the list of pending
|
||||
* operations */
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
/* An override operation will make all pending operations be cancelled, and
|
||||
* it will also disallow adding new operations. This type of operation would
|
||||
* be the last one expected in a modem object. */
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
|
||||
} 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);
|
||||
|
||||
/******************************************************************************/
|
||||
/* State operations */
|
||||
|
||||
typedef enum {
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
} MMBaseModemOperationLock;
|
||||
void mm_base_modem_initialize (MMBaseModem *self,
|
||||
MMOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_initialize_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_base_modem_initialize (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_initialize_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
void mm_base_modem_enable (MMBaseModem *self,
|
||||
MMOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_enable_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_base_modem_enable (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_enable_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_base_modem_disable (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
MMBaseModemOperationPriority priority,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_disable_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
void mm_base_modem_disable (MMBaseModem *self,
|
||||
MMOperationLock operation_lock,
|
||||
MMOperationPriority priority,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_disable_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
#if defined WITH_SUSPEND_RESUME
|
||||
void mm_base_modem_sync (MMBaseModem *self,
|
||||
MMBaseModemOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_sync_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
void mm_base_modem_sync (MMBaseModem *self,
|
||||
MMOperationLock operation_lock,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_base_modem_sync_finish (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
#endif
|
||||
|
||||
void mm_base_modem_teardown_ports (MMBaseModem *self,
|
||||
|
||||
+46
-35
@@ -63,6 +63,10 @@ struct _MMBaseSimPrivate {
|
||||
GDBusConnection *connection;
|
||||
guint dbus_id;
|
||||
|
||||
/* The authorization provider */
|
||||
MMAuthProvider *authp;
|
||||
GCancellable *authp_cancellable;
|
||||
|
||||
/* The modem which owns this SIM */
|
||||
MMBaseModem *modem;
|
||||
/* The path where the SIM object is exported */
|
||||
@@ -238,13 +242,13 @@ handle_change_pin_ready (MMBaseSim *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_change_pin_auth_ready (MMBaseModem *modem,
|
||||
handle_change_pin_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleChangePinContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_change_pin_context_free (ctx);
|
||||
return;
|
||||
@@ -296,11 +300,12 @@ handle_change_pin (MMBaseSim *self,
|
||||
ctx->old_pin = g_strdup (old_pin);
|
||||
ctx->new_pin = g_strdup (new_pin);
|
||||
|
||||
mm_base_modem_authorize (self->priv->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_change_pin_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_change_pin_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -421,13 +426,13 @@ handle_enable_pin_ready (MMBaseSim *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_enable_pin_auth_ready (MMBaseModem *modem,
|
||||
handle_enable_pin_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleEnablePinContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_enable_pin_context_free (ctx);
|
||||
return;
|
||||
@@ -478,11 +483,12 @@ handle_enable_pin (MMBaseSim *self,
|
||||
ctx->pin = g_strdup (pin);
|
||||
ctx->enabled = enabled;
|
||||
|
||||
mm_base_modem_authorize (self->priv->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_enable_pin_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_enable_pin_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -844,13 +850,13 @@ handle_send_pin_ready (MMBaseSim *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_send_pin_auth_ready (MMBaseModem *modem,
|
||||
handle_send_pin_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleSendPinContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_send_pin_context_free (ctx);
|
||||
return;
|
||||
@@ -889,11 +895,12 @@ handle_send_pin (MMBaseSim *self,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->pin = g_strdup (pin);
|
||||
|
||||
mm_base_modem_authorize (self->priv->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_send_pin_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_send_pin_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -948,13 +955,13 @@ handle_send_puk_ready (MMBaseSim *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_send_puk_auth_ready (MMBaseModem *modem,
|
||||
handle_send_puk_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleSendPukContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_send_puk_context_free (ctx);
|
||||
return;
|
||||
@@ -996,11 +1003,12 @@ handle_send_puk (MMBaseSim *self,
|
||||
ctx->puk = g_strdup (puk);
|
||||
ctx->new_pin = g_strdup (new_pin);
|
||||
|
||||
mm_base_modem_authorize (self->priv->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_send_puk_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_send_puk_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1504,13 +1512,13 @@ handle_set_preferred_networks_ready (MMBaseSim *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_preferred_networks_auth_ready (MMBaseModem *modem,
|
||||
handle_set_preferred_networks_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleSetPreferredNetworksContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_preferred_networks_context_free (ctx);
|
||||
return;
|
||||
@@ -1558,11 +1566,12 @@ handle_set_preferred_networks (MMBaseSim *self,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->networks = g_variant_ref (networks_variant);
|
||||
|
||||
mm_base_modem_authorize (self->priv->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_preferred_networks_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_set_preferred_networks_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3047,6 +3056,8 @@ dispose (GObject *object)
|
||||
}
|
||||
|
||||
g_clear_object (&self->priv->modem);
|
||||
g_cancellable_cancel (self->priv->authp_cancellable);
|
||||
g_clear_object (&self->priv->authp_cancellable);
|
||||
|
||||
G_OBJECT_CLASS (mm_base_sim_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
+28
-25
@@ -36,6 +36,7 @@
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-modem-helpers.h"
|
||||
#include "mm-error-helpers.h"
|
||||
#include "mm-auth-provider.h"
|
||||
|
||||
static void log_object_iface_init (MMLogObjectInterface *iface);
|
||||
|
||||
@@ -60,6 +61,10 @@ struct _MMBaseSmsPrivate {
|
||||
GDBusConnection *connection;
|
||||
guint dbus_id;
|
||||
|
||||
/* The authorization provider */
|
||||
MMAuthProvider *authp;
|
||||
GCancellable *authp_cancellable;
|
||||
|
||||
/* The modem which owns this SMS */
|
||||
MMBaseModem *modem;
|
||||
/* The path where the SMS object is exported */
|
||||
@@ -324,7 +329,6 @@ generate_submit_pdus (MMBaseSms *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseSms *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
MMSmsStorage storage;
|
||||
} HandleStoreContext;
|
||||
@@ -333,7 +337,6 @@ static void
|
||||
handle_store_context_free (HandleStoreContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_slice_free (HandleStoreContext, ctx);
|
||||
}
|
||||
@@ -406,13 +409,13 @@ prepare_sms_to_be_stored (MMBaseSms *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_store_auth_ready (MMBaseModem *modem,
|
||||
handle_store_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleStoreContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_store_context_free (ctx);
|
||||
return;
|
||||
@@ -442,7 +445,7 @@ handle_store_auth_ready (MMBaseModem *modem,
|
||||
}
|
||||
|
||||
/* Check if the requested storage is allowed for storing */
|
||||
if (!mm_iface_modem_messaging_is_storage_supported_for_storing (MM_IFACE_MODEM_MESSAGING (ctx->modem),
|
||||
if (!mm_iface_modem_messaging_is_storage_supported_for_storing (MM_IFACE_MODEM_MESSAGING (ctx->self->priv->modem),
|
||||
ctx->storage,
|
||||
&error)) {
|
||||
mm_obj_warn (ctx->self, "failed storing SMS message: %s", error->message);
|
||||
@@ -485,9 +488,6 @@ handle_store (MMBaseSms *self,
|
||||
ctx = g_slice_new0 (HandleStoreContext);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_SMS_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
ctx->storage = (MMSmsStorage)storage;
|
||||
|
||||
if (ctx->storage == MM_SMS_STORAGE_UNKNOWN) {
|
||||
@@ -498,11 +498,12 @@ handle_store (MMBaseSms *self,
|
||||
g_assert (ctx->storage != MM_SMS_STORAGE_UNKNOWN);
|
||||
}
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_MESSAGING,
|
||||
(GAsyncReadyCallback)handle_store_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_MESSAGING,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_store_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -511,7 +512,6 @@ handle_store (MMBaseSms *self,
|
||||
|
||||
typedef struct {
|
||||
MMBaseSms *self;
|
||||
MMBaseModem *modem;
|
||||
GDBusMethodInvocation *invocation;
|
||||
} HandleSendContext;
|
||||
|
||||
@@ -519,7 +519,6 @@ static void
|
||||
handle_send_context_free (HandleSendContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->invocation);
|
||||
g_object_unref (ctx->modem);
|
||||
g_object_unref (ctx->self);
|
||||
g_slice_free (HandleSendContext, ctx);
|
||||
}
|
||||
@@ -586,14 +585,14 @@ prepare_sms_to_be_sent (MMBaseSms *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_send_auth_ready (MMBaseModem *modem,
|
||||
handle_send_auth_ready (MMAuthProvider *authp,
|
||||
GAsyncResult *res,
|
||||
HandleSendContext *ctx)
|
||||
{
|
||||
MMSmsState state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
|
||||
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_send_context_free (ctx);
|
||||
return;
|
||||
@@ -650,15 +649,13 @@ handle_send (MMBaseSms *self,
|
||||
ctx = g_slice_new0 (HandleSendContext);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
g_object_get (self,
|
||||
MM_BASE_SMS_MODEM, &ctx->modem,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (ctx->modem,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_MESSAGING,
|
||||
(GAsyncReadyCallback)handle_send_auth_ready,
|
||||
ctx);
|
||||
mm_auth_provider_authorize (self->priv->authp,
|
||||
invocation,
|
||||
MM_AUTHORIZATION_MESSAGING,
|
||||
self->priv->authp_cancellable,
|
||||
(GAsyncReadyCallback)handle_send_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2071,6 +2068,10 @@ mm_base_sms_init (MMBaseSms *self)
|
||||
|
||||
/* Each SMS is given a unique id to build its own DBus path */
|
||||
self->priv->dbus_id = id++;
|
||||
|
||||
/* Setup authorization provider */
|
||||
self->priv->authp = mm_auth_provider_get ();
|
||||
self->priv->authp_cancellable = g_cancellable_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2097,6 +2098,8 @@ dispose (GObject *object)
|
||||
}
|
||||
|
||||
g_clear_object (&self->priv->modem);
|
||||
g_cancellable_cancel (self->priv->authp_cancellable);
|
||||
g_clear_object (&self->priv->authp_cancellable);
|
||||
|
||||
G_OBJECT_CLASS (mm_base_sms_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
+3
-3
@@ -436,7 +436,7 @@ mm_device_initialize_modem (MMDevice *self)
|
||||
|
||||
mm_obj_dbg (self, "modem initializing...");
|
||||
mm_base_modem_initialize (modem,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
(GAsyncReadyCallback)initialize_ready,
|
||||
g_object_ref (self));
|
||||
}
|
||||
@@ -868,8 +868,8 @@ mm_device_inhibit (MMDevice *self,
|
||||
* an exclusive lock marked as override, so the modem object will not
|
||||
* allow any additional lock request any more. */
|
||||
mm_base_modem_disable (self->priv->modem,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_PRIORITY_OVERRIDE,
|
||||
(GAsyncReadyCallback)inhibit_disable_ready,
|
||||
task);
|
||||
}
|
||||
|
||||
@@ -1109,13 +1109,13 @@ list_profiles_ready (MMIfaceModem3gppProfileManager *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_list_auth_ready (MMBaseModem *self,
|
||||
handle_list_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleListContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_list_context_free (ctx);
|
||||
return;
|
||||
@@ -1150,7 +1150,7 @@ handle_list (MmGdbusModem3gppProfileManager *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_list_auth_ready,
|
||||
@@ -1208,7 +1208,7 @@ set_profile_ready (MMIfaceModem3gppProfileManager *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_auth_ready (MMBaseModem *self,
|
||||
handle_set_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleSetContext *ctx)
|
||||
{
|
||||
@@ -1216,7 +1216,7 @@ handle_set_auth_ready (MMBaseModem *self,
|
||||
GError *error = NULL;
|
||||
g_autoptr(MM3gppProfile) profile_requested = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_context_free (ctx);
|
||||
return;
|
||||
@@ -1276,7 +1276,7 @@ handle_set (MmGdbusModem3gppProfileManager *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->requested_dictionary = requested_dictionary ? g_variant_ref (requested_dictionary) : NULL;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_auth_ready,
|
||||
@@ -1325,7 +1325,7 @@ delete_profile_ready (MMIfaceModem3gppProfileManager *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_delete_auth_ready (MMBaseModem *self,
|
||||
handle_delete_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleDeleteContext *ctx)
|
||||
{
|
||||
@@ -1335,7 +1335,7 @@ handle_delete_auth_ready (MMBaseModem *self,
|
||||
gint profile_id = MM_3GPP_PROFILE_ID_UNKNOWN;
|
||||
MMBearerApnType apn_type = MM_BEARER_APN_TYPE_NONE;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_delete_context_free (ctx);
|
||||
return;
|
||||
@@ -1428,7 +1428,7 @@ handle_delete (MmGdbusModem3gppProfileManager *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_delete_auth_ready,
|
||||
|
||||
@@ -79,13 +79,13 @@ handle_cancel_ready (MMIfaceModem3gppUssd *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_cancel_auth_ready (MMBaseModem *self,
|
||||
handle_cancel_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleCancelContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_cancel_context_free (ctx);
|
||||
return;
|
||||
@@ -120,7 +120,7 @@ handle_cancel (MmGdbusModem3gppUssd *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_USSD,
|
||||
(GAsyncReadyCallback)handle_cancel_auth_ready,
|
||||
@@ -168,13 +168,13 @@ handle_respond_ready (MMIfaceModem3gppUssd *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_respond_auth_ready (MMBaseModem *self,
|
||||
handle_respond_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleRespondContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_respond_context_free (ctx);
|
||||
return;
|
||||
@@ -230,7 +230,7 @@ handle_respond (MmGdbusModem3gppUssd *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->command = g_strdup (command);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_USSD,
|
||||
(GAsyncReadyCallback)handle_respond_auth_ready,
|
||||
@@ -278,13 +278,13 @@ handle_initiate_ready (MMIfaceModem3gppUssd *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_initiate_auth_ready (MMBaseModem *self,
|
||||
handle_initiate_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleInitiateContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_initiate_context_free (ctx);
|
||||
return;
|
||||
@@ -340,7 +340,7 @@ handle_initiate (MmGdbusModem3gppUssd *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->command = g_strdup (command);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_USSD,
|
||||
(GAsyncReadyCallback)handle_initiate_auth_ready,
|
||||
|
||||
+50
-41
@@ -30,6 +30,7 @@
|
||||
#include "mm-error-helpers.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-log-helpers.h"
|
||||
#include "mm-iface-op-lock.h"
|
||||
|
||||
#define SUBSYSTEM_3GPP "3gpp"
|
||||
|
||||
@@ -840,14 +841,15 @@ handle_register_ready (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_register_auth_ready (MMBaseModem *self,
|
||||
handle_register_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleRegisterContext *ctx)
|
||||
{
|
||||
MMIfaceModem3gpp *self = MM_IFACE_MODEM_3GPP (auth);
|
||||
MMModemState modem_state = MM_MODEM_STATE_UNKNOWN;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_register_context_free (ctx);
|
||||
return;
|
||||
@@ -915,7 +917,7 @@ handle_register (MmGdbusModem3gpp *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->operator_id = g_strdup (operator_id);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_register_auth_ready,
|
||||
@@ -1007,13 +1009,14 @@ handle_scan_ready (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_scan_auth_ready (MMBaseModem *self,
|
||||
handle_scan_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleScanContext *ctx)
|
||||
{
|
||||
MMIfaceModem3gpp *self = MM_IFACE_MODEM_3GPP (auth);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_scan_context_free (ctx);
|
||||
return;
|
||||
@@ -1053,7 +1056,7 @@ handle_scan (MmGdbusModem3gpp *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_scan_auth_ready,
|
||||
@@ -1145,13 +1148,14 @@ handle_set_eps_ue_mode_operation_ready (MMIfaceModem3gpp *self
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_eps_ue_mode_operation_auth_ready (MMBaseModem *self,
|
||||
handle_set_eps_ue_mode_operation_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleSetEpsUeModeOperationContext *ctx)
|
||||
{
|
||||
MMIfaceModem3gpp *self = MM_IFACE_MODEM_3GPP (auth);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_eps_ue_mode_operation_context_free (ctx);
|
||||
return;
|
||||
@@ -1198,7 +1202,7 @@ handle_set_eps_ue_mode_operation (MmGdbusModem3gpp *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->mode = mode;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_eps_ue_mode_operation_auth_ready,
|
||||
@@ -1233,7 +1237,7 @@ static void
|
||||
handle_set_initial_eps_bearer_settings_context_free (HandleSetInitialEpsBearerSettingsContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_assert (!ctx->saved_error);
|
||||
g_clear_object (&ctx->config);
|
||||
@@ -1419,16 +1423,17 @@ handle_set_initial_eps_bearer_settings_step (HandleSetInitialEpsBearerSettingsCo
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_settings_auth_ready (MMBaseModem *self,
|
||||
set_initial_eps_bearer_settings_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetInitialEpsBearerSettingsContext *ctx)
|
||||
{
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
gboolean force = FALSE;
|
||||
GError *error = NULL;
|
||||
GVariant *old_dictionary;
|
||||
g_autoptr(MMBearerProperties) old_config = NULL;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_initial_eps_bearer_settings_context_free (ctx);
|
||||
@@ -1488,13 +1493,13 @@ handle_set_initial_eps_bearer_settings (MmGdbusModem3gpp *skeleton,
|
||||
ctx->previous_power_state = MM_MODEM_POWER_STATE_UNKNOWN;
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-initial-eps-bearer-settings",
|
||||
(GAsyncReadyCallback)set_initial_eps_bearer_settings_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-initial-eps-bearer-settings",
|
||||
(GAsyncReadyCallback)set_initial_eps_bearer_settings_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1572,13 +1577,14 @@ handle_disable_facility_lock_ready (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
disable_facility_lock_auth_ready (MMBaseModem *self,
|
||||
disable_facility_lock_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleDisableFacilityLockContext *ctx)
|
||||
{
|
||||
MMIfaceModem3gpp *self = MM_IFACE_MODEM_3GPP (auth);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_disable_facility_lock_context_free (ctx);
|
||||
return;
|
||||
@@ -1648,7 +1654,7 @@ handle_disable_facility_lock (MmGdbusModem3gpp *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)disable_facility_lock_auth_ready,
|
||||
@@ -1749,13 +1755,14 @@ internal_set_packet_service_state_ready (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_packet_service_state_auth_ready (MMBaseModem *self,
|
||||
set_packet_service_state_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandlePacketServiceStateContext *ctx)
|
||||
{
|
||||
MMIfaceModem3gpp *self = MM_IFACE_MODEM_3GPP (auth);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_packet_service_state_context_free (ctx);
|
||||
return;
|
||||
@@ -1798,7 +1805,7 @@ handle_set_packet_service_state (MmGdbusModem3gpp *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->packet_service_state = packet_service_state;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)set_packet_service_state_auth_ready,
|
||||
@@ -1821,7 +1828,7 @@ static void
|
||||
handle_set_nr5g_registration_settings_context_free (HandleSetNr5gRegistrationSettingsContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_clear_object (&ctx->settings);
|
||||
g_variant_unref (ctx->dictionary);
|
||||
@@ -1893,17 +1900,18 @@ set_nr5g_registration_settings_ready (MMIfaceModem3gpp *
|
||||
}
|
||||
|
||||
static void
|
||||
set_nr5g_registration_settings_auth_ready (MMBaseModem *self,
|
||||
set_nr5g_registration_settings_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetNr5gRegistrationSettingsContext *ctx)
|
||||
{
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
GError *error = NULL;
|
||||
GVariant *old_dictionary;
|
||||
g_autoptr(MMNr5gRegistrationSettings) old_settings = NULL;
|
||||
MMModem3gppDrxCycle new_drx_cycle;
|
||||
MMModem3gppMicoMode new_mico_mode;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_nr5g_registration_settings_context_free (ctx);
|
||||
@@ -1979,13 +1987,13 @@ handle_set_nr5g_registration_settings (MmGdbusModem3gpp *skeleton,
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-nr5g-registration-settings",
|
||||
(GAsyncReadyCallback)set_nr5g_registration_settings_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-nr5g-registration-settings",
|
||||
(GAsyncReadyCallback)set_nr5g_registration_settings_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3595,15 +3603,16 @@ handle_set_carrier_lock_ready (MMIfaceModem3gpp *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_carrier_lock_auth_ready (MMBaseModem *self,
|
||||
handle_set_carrier_lock_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleSetCarrierLockContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
const guint8 *data;
|
||||
gsize data_size;
|
||||
MMIfaceModem3gpp *self = MM_IFACE_MODEM_3GPP (auth);
|
||||
GError *error = NULL;
|
||||
const guint8 *data;
|
||||
gsize data_size;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_carrier_lock_context_free (ctx);
|
||||
return;
|
||||
@@ -3642,7 +3651,7 @@ handle_set_carrier_lock (MmGdbusModem3gpp *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->data = g_variant_ref (data);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_carrier_lock_auth_ready,
|
||||
|
||||
@@ -136,17 +136,18 @@ handle_activate_ready (MMIfaceModemCdma *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_activate_auth_ready (MMBaseModem *self,
|
||||
handle_activate_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleActivateContext *ctx)
|
||||
{
|
||||
MMIfaceModemCdma *self = MM_IFACE_MODEM_CDMA (_self);
|
||||
Private *priv;
|
||||
MMModemState modem_state;
|
||||
GError *error = NULL;
|
||||
|
||||
priv = get_private (MM_IFACE_MODEM_CDMA (self));
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_activate_context_free (ctx);
|
||||
return;
|
||||
@@ -254,7 +255,7 @@ handle_activate (MmGdbusModemCdma *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->carrier = g_strdup (carrier);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_activate_auth_ready,
|
||||
@@ -302,10 +303,11 @@ handle_activate_manual_ready (MMIfaceModemCdma *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_activate_manual_auth_ready (MMBaseModem *self,
|
||||
handle_activate_manual_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleActivateManualContext *ctx)
|
||||
{
|
||||
MMIfaceModemCdma *self = MM_IFACE_MODEM_CDMA (_self);
|
||||
MMCdmaManualActivationProperties *properties;
|
||||
Private *priv;
|
||||
MMModemState modem_state;
|
||||
@@ -313,7 +315,7 @@ handle_activate_manual_auth_ready (MMBaseModem *self,
|
||||
|
||||
priv = get_private (MM_IFACE_MODEM_CDMA (self));
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_activate_manual_context_free (ctx);
|
||||
return;
|
||||
@@ -422,7 +424,7 @@ handle_activate_manual (MmGdbusModemCdma *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_activate_manual_auth_ready,
|
||||
|
||||
@@ -79,13 +79,14 @@ set_channels_ready (MMIfaceModemCellBroadcast *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_channels_auth_ready (MMBaseModem *self,
|
||||
handle_set_channels_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetChannelsCellBroadcastContext *ctx)
|
||||
{
|
||||
MMIfaceModemCellBroadcast *self = MM_IFACE_MODEM_CELL_BROADCAST (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_channels_context_free (ctx);
|
||||
return;
|
||||
@@ -128,7 +129,8 @@ handle_set_channels (MmGdbusModemCellBroadcast *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->channels = mm_common_cell_broadcast_channels_variant_to_garray (channels);
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_channels_auth_ready,
|
||||
@@ -173,14 +175,15 @@ handle_delete_ready (MMCbmList *list,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_delete_auth_ready (MMBaseModem *self,
|
||||
handle_delete_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleDeleteContext *ctx)
|
||||
{
|
||||
MMIfaceModemCellBroadcast *self = MM_IFACE_MODEM_CELL_BROADCAST (_self);
|
||||
g_autoptr(MMCbmList) list = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_delete_context_free (ctx);
|
||||
return;
|
||||
@@ -229,7 +232,7 @@ handle_delete (MmGdbusModemCellBroadcast *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->path = g_strdup (path);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_CELL_BROADCAST,
|
||||
(GAsyncReadyCallback)handle_delete_auth_ready,
|
||||
|
||||
@@ -180,13 +180,14 @@ load_list_ready (MMIfaceModemFirmware *self,
|
||||
}
|
||||
|
||||
static void
|
||||
list_auth_ready (MMBaseModem *self,
|
||||
list_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleListContext *ctx)
|
||||
{
|
||||
MMIfaceModemFirmware *self = MM_IFACE_MODEM_FIRMWARE (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_list_context_free (ctx);
|
||||
return;
|
||||
@@ -221,7 +222,7 @@ handle_list (MmGdbusModemFirmware *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_FIRMWARE,
|
||||
(GAsyncReadyCallback)list_auth_ready,
|
||||
@@ -265,13 +266,14 @@ change_current_ready (MMIfaceModemFirmware *self,
|
||||
}
|
||||
|
||||
static void
|
||||
select_auth_ready (MMBaseModem *self,
|
||||
select_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSelectContext *ctx)
|
||||
{
|
||||
MMIfaceModemFirmware *self = MM_IFACE_MODEM_FIRMWARE (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_select_context_free (ctx);
|
||||
return;
|
||||
@@ -308,7 +310,7 @@ handle_select (MmGdbusModemFirmware *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->name = g_strdup (name);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_FIRMWARE,
|
||||
(GAsyncReadyCallback)select_auth_ready,
|
||||
|
||||
@@ -924,10 +924,11 @@ setup_gathering_ready (MMIfaceModemLocation *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_setup_auth_ready (MMBaseModem *self,
|
||||
handle_setup_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetupContext *ctx)
|
||||
{
|
||||
MMIfaceModemLocation *self = MM_IFACE_MODEM_LOCATION (_self);
|
||||
GError *error = NULL;
|
||||
MMModemState modem_state;
|
||||
MMModemLocationSource not_supported;
|
||||
@@ -935,7 +936,7 @@ handle_setup_auth_ready (MMBaseModem *self,
|
||||
LocationContext *location_ctx;
|
||||
g_autofree gchar *str = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_setup_context_free (ctx);
|
||||
return;
|
||||
@@ -1018,7 +1019,7 @@ handle_setup (MmGdbusModemLocation *skeleton,
|
||||
ctx->sources = sources;
|
||||
ctx->signal_location = signal_location;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_setup_auth_ready,
|
||||
@@ -1063,13 +1064,14 @@ set_supl_server_ready (MMIfaceModemLocation *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_supl_server_auth_ready (MMBaseModem *self,
|
||||
handle_set_supl_server_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetSuplServerContext *ctx)
|
||||
{
|
||||
MMIfaceModemLocation *self = MM_IFACE_MODEM_LOCATION (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_supl_server_context_free (ctx);
|
||||
return;
|
||||
@@ -1122,7 +1124,7 @@ handle_set_supl_server (MmGdbusModemLocation *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->supl = g_strdup (supl);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_supl_server_auth_ready,
|
||||
@@ -1164,15 +1166,16 @@ inject_assistance_data_ready (MMIfaceModemLocation *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_inject_assistance_data_auth_ready (MMBaseModem *self,
|
||||
handle_inject_assistance_data_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleInjectAssistanceDataContext *ctx)
|
||||
{
|
||||
MMIfaceModemLocation *self = MM_IFACE_MODEM_LOCATION (_self);
|
||||
GError *error = NULL;
|
||||
const guint8 *data;
|
||||
gsize data_size;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_inject_assistance_data_context_free (ctx);
|
||||
return;
|
||||
@@ -1221,7 +1224,7 @@ handle_inject_assistance_data (MmGdbusModemLocation *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->datav = g_variant_ref (datav);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_inject_assistance_data_auth_ready,
|
||||
@@ -1248,13 +1251,14 @@ handle_set_gps_refresh_rate_context_free (HandleSetGpsRefreshRateContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_gps_refresh_rate_auth_ready (MMBaseModem *self,
|
||||
handle_set_gps_refresh_rate_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetGpsRefreshRateContext *ctx)
|
||||
{
|
||||
MMIfaceModemLocation *self = MM_IFACE_MODEM_LOCATION (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_gps_refresh_rate_context_free (ctx);
|
||||
return;
|
||||
@@ -1290,7 +1294,7 @@ handle_set_gps_refresh_rate (MmGdbusModemLocation *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->rate = rate;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_gps_refresh_rate_auth_ready,
|
||||
@@ -1316,14 +1320,15 @@ handle_get_location_context_free (HandleGetLocationContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_get_location_auth_ready (MMBaseModem *self,
|
||||
handle_get_location_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleGetLocationContext *ctx)
|
||||
{
|
||||
MMIfaceModemLocation *self = MM_IFACE_MODEM_LOCATION (_self);
|
||||
LocationContext *location_ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_get_location_context_free (ctx);
|
||||
return;
|
||||
@@ -1354,7 +1359,7 @@ handle_get_location (MmGdbusModemLocation *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_LOCATION,
|
||||
(GAsyncReadyCallback)handle_get_location_auth_ready,
|
||||
|
||||
@@ -180,14 +180,15 @@ handle_delete_ready (MMSmsList *list,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_delete_auth_ready (MMBaseModem *self,
|
||||
handle_delete_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleDeleteContext *ctx)
|
||||
{
|
||||
g_autoptr(MMSmsList) list = NULL;
|
||||
GError *error = NULL;
|
||||
MMIfaceModemMessaging *self = MM_IFACE_MODEM_MESSAGING (auth);
|
||||
g_autoptr(MMSmsList) list = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_delete_context_free (ctx);
|
||||
return;
|
||||
@@ -236,7 +237,7 @@ handle_delete (MmGdbusModemMessaging *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->path = g_strdup (path);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_MESSAGING,
|
||||
(GAsyncReadyCallback)handle_delete_auth_ready,
|
||||
@@ -264,16 +265,17 @@ handle_create_context_free (HandleCreateContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_create_auth_ready (MMBaseModem *self,
|
||||
handle_create_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleCreateContext *ctx)
|
||||
{
|
||||
MMIfaceModemMessaging *self = MM_IFACE_MODEM_MESSAGING (auth);
|
||||
GError *error = NULL;
|
||||
g_autoptr(MMSmsList) list = NULL;
|
||||
g_autoptr(MMSmsProperties) properties = NULL;
|
||||
g_autoptr(MMBaseSms) sms = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_create_context_free (ctx);
|
||||
return;
|
||||
@@ -334,7 +336,7 @@ handle_create (MmGdbusModemMessaging *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_MESSAGING,
|
||||
(GAsyncReadyCallback)handle_create_auth_ready,
|
||||
@@ -416,13 +418,14 @@ handle_set_default_storage_ready (MMIfaceModemMessaging *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_default_storage_auth_ready (MMBaseModem *self,
|
||||
handle_set_default_storage_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleSetDefaultStorageContext *ctx)
|
||||
{
|
||||
MMIfaceModemMessaging *self = MM_IFACE_MODEM_MESSAGING (auth);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_default_storage_context_free (ctx);
|
||||
return;
|
||||
@@ -469,7 +472,7 @@ handle_set_default_storage (MmGdbusModemMessaging *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->storage = (MMSmsStorage)storage;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_MESSAGING,
|
||||
(GAsyncReadyCallback)handle_set_default_storage_auth_ready,
|
||||
|
||||
+16
-12
@@ -182,15 +182,16 @@ setup_ready (MMIfaceModemOma *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_setup_auth_ready (MMBaseModem *self,
|
||||
handle_setup_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetupContext *ctx)
|
||||
{
|
||||
MMIfaceModemOma *self = MM_IFACE_MODEM_OMA (_self);
|
||||
GError *error = NULL;
|
||||
MMModemState modem_state;
|
||||
gchar *str;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_setup_context_free (ctx);
|
||||
return;
|
||||
@@ -240,7 +241,7 @@ handle_setup (MmGdbusModemOma *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->features = features;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_setup_auth_ready,
|
||||
@@ -287,14 +288,15 @@ start_client_initiated_session_ready (MMIfaceModemOma *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_start_client_initiated_session_auth_ready (MMBaseModem *self,
|
||||
handle_start_client_initiated_session_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleStartClientInitiatedSessionContext *ctx)
|
||||
{
|
||||
MMIfaceModemOma *self = MM_IFACE_MODEM_OMA (_self);
|
||||
GError *error = NULL;
|
||||
MMModemState modem_state;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_start_client_initiated_session_context_free (ctx);
|
||||
return;
|
||||
@@ -355,7 +357,7 @@ handle_start_client_initiated_session (MmGdbusModemOma *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->session_type = session_type;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_start_client_initiated_session_auth_ready,
|
||||
@@ -441,14 +443,15 @@ get_pending_network_initiated_session_type (MMIfaceModemOma *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_accept_network_initiated_session_auth_ready (MMBaseModem *self,
|
||||
handle_accept_network_initiated_session_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleAcceptNetworkInitiatedSessionContext *ctx)
|
||||
{
|
||||
MMIfaceModemOma *self = MM_IFACE_MODEM_OMA (_self);
|
||||
GError *error = NULL;
|
||||
MMModemState modem_state;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_accept_network_initiated_session_context_free (ctx);
|
||||
return;
|
||||
@@ -514,7 +517,7 @@ handle_accept_network_initiated_session (MmGdbusModemOma *skeleton,
|
||||
ctx->session_id = session_id;
|
||||
ctx->accept = accept;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_accept_network_initiated_session_auth_ready,
|
||||
@@ -561,14 +564,15 @@ cancel_session_ready (MMIfaceModemOma *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_cancel_session_auth_ready (MMBaseModem *self,
|
||||
handle_cancel_session_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleCancelSessionContext *ctx)
|
||||
{
|
||||
MMIfaceModemOma *self = MM_IFACE_MODEM_OMA (_self);
|
||||
GError *error = NULL;
|
||||
MMModemState modem_state;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_cancel_session_context_free (ctx);
|
||||
return;
|
||||
@@ -612,7 +616,7 @@ handle_cancel_session (MmGdbusModemOma *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_cancel_session_auth_ready,
|
||||
|
||||
@@ -98,13 +98,14 @@ enable_ready (MMIfaceModemSar *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_enable_auth_ready (MMBaseModem *self,
|
||||
handle_enable_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleEnableContext *ctx)
|
||||
{
|
||||
MMIfaceModemSar *self = MM_IFACE_MODEM_SAR (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_enable_context_free (ctx);
|
||||
return;
|
||||
@@ -146,7 +147,7 @@ handle_enable (MmGdbusModemSar *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->enable = enable;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_enable_auth_ready,
|
||||
@@ -193,13 +194,14 @@ set_power_level_ready (MMIfaceModemSar *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_power_level_auth_ready (MMBaseModem *self,
|
||||
handle_set_power_level_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetPowerLevelContext *ctx)
|
||||
{
|
||||
MMIfaceModemSar *self = MM_IFACE_MODEM_SAR (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_power_level_context_free (ctx);
|
||||
return;
|
||||
@@ -248,7 +250,7 @@ handle_set_power_level (MmGdbusModemSar *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->power_level = level;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_power_level_auth_ready,
|
||||
|
||||
@@ -374,7 +374,7 @@ handle_setup_context_free (HandleSetupContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_setup_auth_ready (MMBaseModem *_self,
|
||||
handle_setup_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetupContext *ctx)
|
||||
{
|
||||
@@ -382,7 +382,7 @@ handle_setup_auth_ready (MMBaseModem *_self,
|
||||
GError *error = NULL;
|
||||
Private *priv;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (_self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_setup_context_free (ctx);
|
||||
return;
|
||||
@@ -418,7 +418,7 @@ handle_setup (MmGdbusModemSignal *skeleton,
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->rate = rate;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_setup_auth_ready,
|
||||
@@ -471,7 +471,7 @@ setup_thresholds_restart_ready (MMIfaceModemSignal *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_setup_thresholds_auth_ready (MMBaseModem *_self,
|
||||
handle_setup_thresholds_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetupThresholdsContext *ctx)
|
||||
{
|
||||
@@ -484,7 +484,7 @@ handle_setup_thresholds_auth_ready (MMBaseModem *_self,
|
||||
|
||||
priv = get_private (self);
|
||||
|
||||
if (!mm_base_modem_authorize_finish (_self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_setup_thresholds_context_free (ctx);
|
||||
return;
|
||||
@@ -545,7 +545,7 @@ handle_setup_thresholds (MmGdbusModemSignal *skeleton,
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->settings = g_variant_ref (settings);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_setup_thresholds_auth_ready,
|
||||
|
||||
@@ -756,7 +756,7 @@ connection_step (ConnectionContext *ctx)
|
||||
mm_obj_msg (ctx->self, "simple connect state (%d/%d): enable",
|
||||
ctx->step, CONNECTION_STEP_LAST);
|
||||
mm_base_modem_enable (MM_BASE_MODEM (ctx->self),
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
(GAsyncReadyCallback)enable_ready,
|
||||
ctx);
|
||||
return;
|
||||
@@ -881,14 +881,15 @@ connection_step (ConnectionContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
connect_auth_ready (MMBaseModem *self,
|
||||
connect_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
ConnectionContext *ctx)
|
||||
{
|
||||
MMIfaceModemSimple *self = MM_IFACE_MODEM_SIMPLE (_self);
|
||||
GError *error = NULL;
|
||||
MMModemState current = MM_MODEM_STATE_UNKNOWN;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
connection_context_free (ctx);
|
||||
return;
|
||||
@@ -980,7 +981,7 @@ handle_connect (MmGdbusModemSimple *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)connect_auth_ready,
|
||||
@@ -1025,14 +1026,15 @@ bearer_list_disconnect_bearers_ready (MMBearerList *bearer_list,
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_auth_ready (MMBaseModem *self,
|
||||
disconnect_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
DisconnectionContext *ctx)
|
||||
{
|
||||
MMIfaceModemSimple *self = MM_IFACE_MODEM_SIMPLE (_self);
|
||||
g_autoptr(MMBearerList) list = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
disconnection_context_free (ctx);
|
||||
return;
|
||||
@@ -1087,7 +1089,7 @@ handle_disconnect (MmGdbusModemSimple *skeleton,
|
||||
if (g_strcmp0 (bearer_path, "/") != 0)
|
||||
ctx->bearer_path = g_strdup (bearer_path);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)disconnect_auth_ready,
|
||||
|
||||
@@ -75,14 +75,15 @@ load_network_time_ready (MMIfaceModemTime *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_get_network_time_auth_ready (MMBaseModem *self,
|
||||
handle_get_network_time_auth_ready (MMIfaceAuth *_self,
|
||||
GAsyncResult *res,
|
||||
HandleGetNetworkTimeContext *ctx)
|
||||
{
|
||||
MMModemState state;
|
||||
GError *error = NULL;
|
||||
MMIfaceModemTime *self = MM_IFACE_MODEM_TIME (_self);
|
||||
MMModemState state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (_self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_get_network_time_context_free (ctx);
|
||||
return;
|
||||
@@ -127,7 +128,7 @@ handle_get_network_time (MmGdbusModemTime *skeleton,
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_TIME,
|
||||
(GAsyncReadyCallback)handle_get_network_time_auth_ready,
|
||||
|
||||
+32
-24
@@ -596,14 +596,15 @@ handle_delete_context_free (HandleDeleteContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_delete_auth_ready (MMBaseModem *self,
|
||||
handle_delete_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleDeleteContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
MMCallList *list = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_delete_context_free (ctx);
|
||||
return;
|
||||
@@ -643,7 +644,7 @@ handle_delete (MmGdbusModemVoice *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->path = g_strdup (path);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_delete_auth_ready,
|
||||
@@ -671,16 +672,17 @@ handle_create_context_free (HandleCreateContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_create_auth_ready (MMBaseModem *self,
|
||||
handle_create_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleCreateContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
MMCallList *list = NULL;
|
||||
GError *error = NULL;
|
||||
MMCallProperties *properties;
|
||||
MMBaseCall *call;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_create_context_free (ctx);
|
||||
return;
|
||||
@@ -746,7 +748,7 @@ handle_create (MmGdbusModemVoice *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_create_auth_ready,
|
||||
@@ -855,14 +857,15 @@ prepare_hold_and_accept_foreach (MMBaseCall *call,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_hold_and_accept_auth_ready (MMBaseModem *self,
|
||||
handle_hold_and_accept_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleHoldAndAcceptContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
GError *error = NULL;
|
||||
MMCallList *list = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_hold_and_accept_context_free (ctx);
|
||||
return;
|
||||
@@ -907,7 +910,7 @@ handle_hold_and_accept (MmGdbusModemVoice *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_hold_and_accept_auth_ready,
|
||||
@@ -986,14 +989,15 @@ prepare_hangup_and_accept_foreach (MMBaseCall *call,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_hangup_and_accept_auth_ready (MMBaseModem *self,
|
||||
handle_hangup_and_accept_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleHangupAndAcceptContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
GError *error = NULL;
|
||||
MMCallList *list = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_hangup_and_accept_context_free (ctx);
|
||||
return;
|
||||
@@ -1038,7 +1042,7 @@ handle_hangup_and_accept (MmGdbusModemVoice *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_hangup_and_accept_auth_ready,
|
||||
@@ -1127,14 +1131,15 @@ prepare_hangup_all_foreach (MMBaseCall *call,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_hangup_all_auth_ready (MMBaseModem *self,
|
||||
handle_hangup_all_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleHangupAllContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
GError *error = NULL;
|
||||
MMCallList *list = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_hangup_all_context_free (ctx);
|
||||
return;
|
||||
@@ -1179,7 +1184,7 @@ handle_hangup_all (MmGdbusModemVoice *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_hangup_all_auth_ready,
|
||||
@@ -1248,14 +1253,15 @@ prepare_transfer_foreach (MMBaseCall *call,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_transfer_auth_ready (MMBaseModem *self,
|
||||
handle_transfer_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleTransferContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
GError *error = NULL;
|
||||
MMCallList *list = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_transfer_context_free (ctx);
|
||||
return;
|
||||
@@ -1300,7 +1306,7 @@ handle_transfer (MmGdbusModemVoice *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_transfer_auth_ready,
|
||||
@@ -1344,13 +1350,14 @@ call_waiting_setup_ready (MMIfaceModemVoice *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_call_waiting_setup_auth_ready (MMBaseModem *self,
|
||||
handle_call_waiting_setup_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleCallWaitingSetupContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_call_waiting_setup_context_free (ctx);
|
||||
return;
|
||||
@@ -1386,7 +1393,7 @@ handle_call_waiting_setup (MmGdbusModemVoice *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->enable = enable;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_call_waiting_setup_auth_ready,
|
||||
@@ -1431,13 +1438,14 @@ call_waiting_query_ready (MMIfaceModemVoice *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_call_waiting_query_auth_ready (MMBaseModem *self,
|
||||
handle_call_waiting_query_auth_ready (MMIfaceAuth *auth,
|
||||
GAsyncResult *res,
|
||||
HandleCallWaitingQueryContext *ctx)
|
||||
{
|
||||
MMIfaceModemVoice *self = MM_IFACE_MODEM_VOICE (auth);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_call_waiting_query_context_free (ctx);
|
||||
return;
|
||||
@@ -1470,7 +1478,7 @@ handle_call_waiting_query (MmGdbusModemVoice *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_VOICE,
|
||||
(GAsyncReadyCallback)handle_call_waiting_query_auth_ready,
|
||||
|
||||
+104
-96
@@ -33,6 +33,7 @@
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-log-helpers.h"
|
||||
#include "mm-context.h"
|
||||
#include "mm-iface-op-lock.h"
|
||||
#include "mm-dispatcher-fcc-unlock.h"
|
||||
#if defined WITH_QMI
|
||||
# include "mm-broadband-modem-qmi.h"
|
||||
@@ -362,8 +363,8 @@ mm_iface_modem_process_sim_event (MMIfaceModem *self)
|
||||
* allow any additional lock request any more. */
|
||||
mm_base_modem_set_reprobe (MM_BASE_MODEM (self), TRUE);
|
||||
mm_base_modem_disable (MM_BASE_MODEM (self),
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_PRIORITY_OVERRIDE,
|
||||
(GAsyncReadyCallback) after_sim_event_disable_ready,
|
||||
NULL);
|
||||
}
|
||||
@@ -1050,14 +1051,14 @@ handle_create_bearer_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_create_bearer_auth_ready (MMBaseModem *self,
|
||||
handle_create_bearer_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleCreateBearerContext *ctx)
|
||||
{
|
||||
g_autoptr(MMBearerProperties) properties = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_create_bearer_context_free (ctx);
|
||||
return;
|
||||
@@ -1099,7 +1100,7 @@ handle_create_bearer (MmGdbusModem *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->dictionary = g_variant_ref (dictionary);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_create_bearer_auth_ready,
|
||||
@@ -1148,13 +1149,13 @@ command_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_command_auth_ready (MMBaseModem *self,
|
||||
handle_command_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleCommandContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_command_context_free (ctx);
|
||||
return;
|
||||
@@ -1202,7 +1203,7 @@ handle_command (MmGdbusModem *skeleton,
|
||||
ctx->cmd = g_strdup (cmd);
|
||||
ctx->timeout = timeout;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_command_auth_ready,
|
||||
@@ -1258,13 +1259,13 @@ delete_bearer_disconnect_ready (MMBaseBearer *bearer,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_delete_bearer_auth_ready (MMBaseModem *self,
|
||||
handle_delete_bearer_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleDeleteBearerContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_delete_bearer_context_free (ctx);
|
||||
return;
|
||||
@@ -1313,7 +1314,7 @@ handle_delete_bearer (MmGdbusModem *skeleton,
|
||||
MM_IFACE_MODEM_BEARER_LIST, &ctx->list,
|
||||
NULL);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_delete_bearer_auth_ready,
|
||||
@@ -1396,14 +1397,14 @@ set_primary_sim_slot_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_primary_sim_slot_auth_ready (MMBaseModem *self,
|
||||
handle_set_primary_sim_slot_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleSetPrimarySimSlotContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
const gchar *const *sim_slot_paths;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_primary_sim_slot_context_free (ctx);
|
||||
return;
|
||||
@@ -1448,7 +1449,7 @@ handle_set_primary_sim_slot (MmGdbusModem *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->requested_sim_slot = sim_slot;
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_primary_sim_slot_auth_ready,
|
||||
@@ -1516,13 +1517,13 @@ get_cell_info_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_get_cell_info_auth_ready (MMBaseModem *self,
|
||||
handle_get_cell_info_auth_ready (MMIfaceAuth *self,
|
||||
GAsyncResult *res,
|
||||
HandleGetCellInfoContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
if (!mm_iface_auth_authorize_finish (self, res, &error)) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_get_cell_info_context_free (ctx);
|
||||
return;
|
||||
@@ -1560,7 +1561,7 @@ handle_get_cell_info (MmGdbusModem *skeleton,
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_get_cell_info_auth_ready,
|
||||
@@ -2294,7 +2295,7 @@ static void
|
||||
handle_enable_context_free (HandleEnableContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
@@ -2331,13 +2332,14 @@ enable_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_enable_auth_ready (MMBaseModem *self,
|
||||
handle_enable_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleEnableContext *ctx)
|
||||
{
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_enable_context_free (ctx);
|
||||
@@ -2352,14 +2354,14 @@ handle_enable_auth_ready (MMBaseModem *self,
|
||||
if (ctx->enable) {
|
||||
mm_obj_info (self, "processing user request to enable modem...");
|
||||
mm_base_modem_enable (self,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
MM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
(GAsyncReadyCallback)enable_ready,
|
||||
ctx);
|
||||
} else {
|
||||
mm_obj_info (self, "processing user request to disable modem...");
|
||||
mm_base_modem_disable (self,
|
||||
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_UNKNOWN,
|
||||
MM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
MM_OPERATION_PRIORITY_UNKNOWN,
|
||||
(GAsyncReadyCallback)enable_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -2380,13 +2382,13 @@ handle_enable (MmGdbusModem *skeleton,
|
||||
ctx->enable = enable;
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
enable ? "enable" : "disable",
|
||||
(GAsyncReadyCallback)handle_enable_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
enable ? "enable" : "disable",
|
||||
(GAsyncReadyCallback)handle_enable_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2406,7 +2408,7 @@ static void
|
||||
handle_set_power_state_context_free (HandleSetPowerStateContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_assert (!ctx->saved_error);
|
||||
g_object_unref (ctx->skeleton);
|
||||
@@ -2442,8 +2444,8 @@ disable_after_low (MMIfaceModem *self,
|
||||
{
|
||||
mm_obj_info (self, "automatically disable modem after low-power mode...");
|
||||
mm_base_modem_disable (MM_BASE_MODEM (self),
|
||||
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_UNKNOWN,
|
||||
MM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
MM_OPERATION_PRIORITY_UNKNOWN,
|
||||
(GAsyncReadyCallback)disable_after_low_ready,
|
||||
ctx);
|
||||
}
|
||||
@@ -2477,14 +2479,15 @@ set_power_state_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_power_state_auth_ready (MMBaseModem *self,
|
||||
handle_set_power_state_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetPowerStateContext *ctx)
|
||||
{
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
MMModemState modem_state;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_power_state_context_free (ctx);
|
||||
@@ -2559,13 +2562,13 @@ handle_set_power_state (MmGdbusModem *skeleton,
|
||||
}
|
||||
|
||||
operation_name = g_strdup_printf ("set-power-state-%s", mm_modem_power_state_get_string (ctx->power_state));
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
operation_name,
|
||||
(GAsyncReadyCallback)handle_set_power_state_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
operation_name,
|
||||
(GAsyncReadyCallback)handle_set_power_state_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2582,7 +2585,7 @@ static void
|
||||
handle_reset_context_free (HandleResetContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
@@ -2609,13 +2612,14 @@ handle_reset_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_reset_auth_ready (MMBaseModem *self,
|
||||
handle_reset_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleResetContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_reset_context_free (ctx);
|
||||
@@ -2649,13 +2653,13 @@ handle_reset (MmGdbusModem *skeleton,
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"reset",
|
||||
(GAsyncReadyCallback)handle_reset_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
"reset",
|
||||
(GAsyncReadyCallback)handle_reset_auth_ready,
|
||||
ctx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2674,7 +2678,7 @@ static void
|
||||
handle_factory_reset_context_free (HandleFactoryResetContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
@@ -2702,13 +2706,14 @@ handle_factory_reset_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_factory_reset_auth_ready (MMBaseModem *self,
|
||||
handle_factory_reset_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleFactoryResetContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_factory_reset_context_free (ctx);
|
||||
@@ -2745,13 +2750,13 @@ handle_factory_reset (MmGdbusModem *skeleton,
|
||||
ctx->code = g_strdup (code);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"factory-reset",
|
||||
(GAsyncReadyCallback)handle_factory_reset_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
"factory-reset",
|
||||
(GAsyncReadyCallback)handle_factory_reset_auth_ready,
|
||||
ctx);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2777,7 +2782,7 @@ static void
|
||||
handle_set_current_capabilities_context_free (HandleSetCurrentCapabilitiesContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_free (ctx->capabilities_str);
|
||||
g_object_unref (ctx->skeleton);
|
||||
@@ -2807,16 +2812,17 @@ set_current_capabilities_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_current_capabilities_auth_ready (MMBaseModem *self,
|
||||
handle_set_current_capabilities_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetCurrentCapabilitiesContext *ctx)
|
||||
{
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
GError *error = NULL;
|
||||
g_autoptr(GArray) supported = NULL;
|
||||
gboolean matched = FALSE;
|
||||
guint i;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_current_capabilities_context_free (ctx);
|
||||
@@ -2890,13 +2896,13 @@ handle_set_current_capabilities (MmGdbusModem *skeleton,
|
||||
ctx->capabilities = capabilities;
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-capabilities",
|
||||
(GAsyncReadyCallback)handle_set_current_capabilities_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-capabilities",
|
||||
(GAsyncReadyCallback)handle_set_current_capabilities_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3267,7 +3273,7 @@ static void
|
||||
handle_set_current_bands_context_free (HandleSetCurrentBandsContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_free (ctx->bands_str);
|
||||
g_variant_unref (ctx->bands);
|
||||
@@ -3298,14 +3304,15 @@ handle_set_current_bands_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_current_bands_auth_ready (MMBaseModem *self,
|
||||
handle_set_current_bands_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetCurrentBandsContext *ctx)
|
||||
{
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
g_autoptr(GArray) bands_array = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_current_bands_context_free (ctx);
|
||||
@@ -3342,13 +3349,13 @@ handle_set_current_bands (MmGdbusModem *skeleton,
|
||||
ctx->bands = g_variant_ref (bands_variant);
|
||||
ctx->operation_id = -1;
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-bands",
|
||||
(GAsyncReadyCallback)handle_set_current_bands_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-bands",
|
||||
(GAsyncReadyCallback)handle_set_current_bands_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3672,7 +3679,7 @@ static void
|
||||
handle_set_current_modes_context_free (HandleSetCurrentModesContext *ctx)
|
||||
{
|
||||
if (ctx->operation_id >= 0)
|
||||
mm_base_modem_operation_unlock (MM_BASE_MODEM (ctx->self), ctx->operation_id);
|
||||
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (ctx->self), ctx->operation_id);
|
||||
|
||||
g_free (ctx->preferred_str);
|
||||
g_free (ctx->allowed_str);
|
||||
@@ -3705,13 +3712,14 @@ handle_set_current_modes_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_current_modes_auth_ready (MMBaseModem *self,
|
||||
handle_set_current_modes_auth_ready (MMIfaceOpLock *_self,
|
||||
GAsyncResult *res,
|
||||
HandleSetCurrentModesContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
MMBaseModem *self = MM_BASE_MODEM (_self);
|
||||
GError *error = NULL;
|
||||
|
||||
ctx->operation_id = mm_base_modem_authorize_and_operation_lock_finish (self, res, &error);
|
||||
ctx->operation_id = mm_iface_op_lock_authorize_and_lock_finish (_self, res, &error);
|
||||
if (ctx->operation_id < 0) {
|
||||
mm_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_current_modes_context_free (ctx);
|
||||
@@ -3753,13 +3761,13 @@ handle_set_current_modes (MmGdbusModem *skeleton,
|
||||
&ctx->allowed,
|
||||
&ctx->preferred);
|
||||
|
||||
mm_base_modem_authorize_and_operation_lock (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-modes",
|
||||
(GAsyncReadyCallback)handle_set_current_modes_auth_ready,
|
||||
ctx);
|
||||
mm_iface_op_lock_authorize_and_lock (MM_IFACE_OP_LOCK (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
"set-current-modes",
|
||||
(GAsyncReadyCallback)handle_set_current_modes_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -3784,7 +3792,7 @@ restart_initialize_idle (MMIfaceModem *self)
|
||||
priv = get_private (self);
|
||||
|
||||
mm_base_modem_initialize (MM_BASE_MODEM (self),
|
||||
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
(GAsyncReadyCallback) reinitialize_ready,
|
||||
NULL);
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2012 Google, Inc.
|
||||
* Copyright (C) 2025 Dan Williams <dan@ioncontrol.co>
|
||||
*/
|
||||
|
||||
#include <ModemManager.h>
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-iface-op-lock.h"
|
||||
|
||||
G_DEFINE_INTERFACE (MMIfaceOpLock, mm_iface_op_lock, G_TYPE_OBJECT)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
mm_iface_op_lock_authorize_and_lock (MMIfaceOpLock *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
MMOperationPriority operation_priority,
|
||||
const gchar *operation_description,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_assert (MM_IFACE_OP_LOCK_GET_IFACE (self)->authorize_and_lock != NULL);
|
||||
|
||||
MM_IFACE_OP_LOCK_GET_IFACE (self)->authorize_and_lock (self,
|
||||
invocation,
|
||||
authorization,
|
||||
operation_priority,
|
||||
operation_description,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
gssize
|
||||
mm_iface_op_lock_authorize_and_lock_finish (MMIfaceOpLock *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_assert (MM_IFACE_OP_LOCK_GET_IFACE (self)->authorize_and_lock_finish != NULL);
|
||||
|
||||
return MM_IFACE_OP_LOCK_GET_IFACE (self)->authorize_and_lock_finish (self, res, error);
|
||||
}
|
||||
|
||||
void
|
||||
mm_iface_op_lock_unlock (MMIfaceOpLock *self,
|
||||
gssize operation_id)
|
||||
{
|
||||
g_assert (MM_IFACE_OP_LOCK_GET_IFACE (self)->unlock != NULL);
|
||||
|
||||
return MM_IFACE_OP_LOCK_GET_IFACE (self)->unlock (self, operation_id);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_iface_op_lock_default_init (MMIfaceOpLockInterface *iface)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details:
|
||||
*
|
||||
* Copyright (C) 2025 Dan Williams <dan@ioncontrol.co>
|
||||
*/
|
||||
|
||||
#ifndef MM_IFACE_OP_LOCK_H
|
||||
#define MM_IFACE_OP_LOCK_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
typedef enum { /*< underscore_name=mm_operation_priority >*/
|
||||
MM_OPERATION_PRIORITY_UNKNOWN,
|
||||
/* Default operations are scheduled at the end of the list of pending
|
||||
* operations */
|
||||
MM_OPERATION_PRIORITY_DEFAULT,
|
||||
/* An override operation will make all pending operations be cancelled, and
|
||||
* it will also disallow adding new operations. This type of operation would
|
||||
* be the last one expected in a modem object. */
|
||||
MM_OPERATION_PRIORITY_OVERRIDE,
|
||||
} MMOperationPriority;
|
||||
|
||||
typedef enum {
|
||||
MM_OPERATION_LOCK_REQUIRED,
|
||||
MM_OPERATION_LOCK_ALREADY_ACQUIRED,
|
||||
} MMOperationLock;
|
||||
|
||||
#define MM_TYPE_IFACE_OP_LOCK mm_iface_op_lock_get_type ()
|
||||
G_DECLARE_INTERFACE (MMIfaceOpLock, mm_iface_op_lock, MM, IFACE_OP_LOCK, GObject)
|
||||
|
||||
struct _MMIfaceOpLockInterface {
|
||||
GTypeInterface g_iface;
|
||||
|
||||
void (* authorize_and_lock) (MMIfaceOpLock *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
MMOperationPriority operation_priority,
|
||||
const gchar *operation_description,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gssize (* authorize_and_lock_finish) (MMIfaceOpLock *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void (*unlock) (MMIfaceOpLock *self,
|
||||
gssize operation_id);
|
||||
};
|
||||
|
||||
|
||||
void mm_iface_op_lock_authorize_and_lock (MMIfaceOpLock *self,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *authorization,
|
||||
MMOperationPriority operation_priority,
|
||||
const gchar *operation_description,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
gssize mm_iface_op_lock_authorize_and_lock_finish (MMIfaceOpLock *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
void mm_iface_op_lock_unlock (MMIfaceOpLock *self,
|
||||
gssize operation_id);
|
||||
|
||||
#endif /* MM_IFACE_OP_LOCK_H */
|
||||
Reference in New Issue
Block a user