sim: signal when the pin lock enabling status changes
This commit is contained in:
@@ -196,6 +196,7 @@ ModemManager_SOURCES = \
|
|||||||
# Additional dependency rules
|
# Additional dependency rules
|
||||||
mm-bearer.c: mm-daemon-enums-types.h
|
mm-bearer.c: mm-daemon-enums-types.h
|
||||||
mm-sms-list.c: mm-marshal.h
|
mm-sms-list.c: mm-marshal.h
|
||||||
|
mm-sim.c: mm-marshal.h
|
||||||
|
|
||||||
if WITH_POLKIT
|
if WITH_POLKIT
|
||||||
ModemManager_SOURCES += \
|
ModemManager_SOURCES += \
|
||||||
|
@@ -1,2 +1,3 @@
|
|||||||
VOID:STRING,BOOLEAN
|
VOID:STRING,BOOLEAN
|
||||||
VOID:STRING
|
VOID:STRING
|
||||||
|
VOID:BOOLEAN
|
||||||
|
24
src/mm-sim.c
24
src/mm-sim.c
@@ -32,6 +32,7 @@
|
|||||||
#include "mm-utils.h"
|
#include "mm-utils.h"
|
||||||
#include "mm-log.h"
|
#include "mm-log.h"
|
||||||
#include "mm-modem-helpers.h"
|
#include "mm-modem-helpers.h"
|
||||||
|
#include "mm-marshal.h"
|
||||||
|
|
||||||
static void async_initable_iface_init (GAsyncInitableIface *iface);
|
static void async_initable_iface_init (GAsyncInitableIface *iface);
|
||||||
|
|
||||||
@@ -47,6 +48,11 @@ enum {
|
|||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SIGNAL_PIN_LOCK_ENABLED,
|
||||||
|
SIGNAL_LAST
|
||||||
|
};
|
||||||
|
|
||||||
static GParamSpec *properties[PROP_LAST];
|
static GParamSpec *properties[PROP_LAST];
|
||||||
|
|
||||||
struct _MMSimPrivate {
|
struct _MMSimPrivate {
|
||||||
@@ -58,6 +64,8 @@ struct _MMSimPrivate {
|
|||||||
gchar *path;
|
gchar *path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static guint signals[SIGNAL_LAST] = { 0 };
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -310,9 +318,13 @@ handle_enable_pin_ready (MMSim *self,
|
|||||||
MM_SIM_GET_CLASS (self)->enable_pin_finish (self, res, &error);
|
MM_SIM_GET_CLASS (self)->enable_pin_finish (self, res, &error);
|
||||||
if (error)
|
if (error)
|
||||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||||
else
|
else {
|
||||||
mm_gdbus_sim_complete_enable_pin (MM_GDBUS_SIM (self), ctx->invocation);
|
mm_gdbus_sim_complete_enable_pin (MM_GDBUS_SIM (self), ctx->invocation);
|
||||||
|
|
||||||
|
/* Signal about the new lock state */
|
||||||
|
g_signal_emit (self, signals[SIGNAL_PIN_LOCK_ENABLED], 0, ctx->enabled);
|
||||||
|
}
|
||||||
|
|
||||||
handle_enable_pin_context_free (ctx);
|
handle_enable_pin_context_free (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1778,4 +1790,14 @@ mm_sim_class_init (MMSimClass *klass)
|
|||||||
MM_TYPE_BASE_MODEM,
|
MM_TYPE_BASE_MODEM,
|
||||||
G_PARAM_READWRITE);
|
G_PARAM_READWRITE);
|
||||||
g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]);
|
g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]);
|
||||||
|
|
||||||
|
/* Signals */
|
||||||
|
signals[SIGNAL_PIN_LOCK_ENABLED] =
|
||||||
|
g_signal_new (MM_SIM_PIN_LOCK_ENABLED,
|
||||||
|
G_OBJECT_CLASS_TYPE (object_class),
|
||||||
|
G_SIGNAL_RUN_FIRST,
|
||||||
|
G_STRUCT_OFFSET (MMSimClass, pin_lock_enabled),
|
||||||
|
NULL, NULL,
|
||||||
|
mm_marshal_VOID__BOOLEAN,
|
||||||
|
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
|
||||||
}
|
}
|
||||||
|
@@ -35,10 +35,14 @@ typedef struct _MMSim MMSim;
|
|||||||
typedef struct _MMSimClass MMSimClass;
|
typedef struct _MMSimClass MMSimClass;
|
||||||
typedef struct _MMSimPrivate MMSimPrivate;
|
typedef struct _MMSimPrivate MMSimPrivate;
|
||||||
|
|
||||||
|
/* Properties */
|
||||||
#define MM_SIM_PATH "sim-path"
|
#define MM_SIM_PATH "sim-path"
|
||||||
#define MM_SIM_CONNECTION "sim-connection"
|
#define MM_SIM_CONNECTION "sim-connection"
|
||||||
#define MM_SIM_MODEM "sim-modem"
|
#define MM_SIM_MODEM "sim-modem"
|
||||||
|
|
||||||
|
/* Signals */
|
||||||
|
#define MM_SIM_PIN_LOCK_ENABLED "pin-lock-enabled"
|
||||||
|
|
||||||
struct _MMSim {
|
struct _MMSim {
|
||||||
MmGdbusSimSkeleton parent;
|
MmGdbusSimSkeleton parent;
|
||||||
MMSimPrivate *priv;
|
MMSimPrivate *priv;
|
||||||
@@ -117,6 +121,10 @@ struct _MMSimClass {
|
|||||||
gboolean (* send_puk_finish) (MMSim *self,
|
gboolean (* send_puk_finish) (MMSim *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
/* Signals */
|
||||||
|
void (*pin_lock_enabled) (MMSim *self,
|
||||||
|
gboolean enabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType mm_sim_get_type (void);
|
GType mm_sim_get_type (void);
|
||||||
|
Reference in New Issue
Block a user