aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am1
-rw-r--r--src/mm-marshal.list1
-rw-r--r--src/mm-sim.c24
-rw-r--r--src/mm-sim.h8
4 files changed, 33 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 661012c0..c17093db 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -196,6 +196,7 @@ ModemManager_SOURCES = \
# Additional dependency rules
mm-bearer.c: mm-daemon-enums-types.h
mm-sms-list.c: mm-marshal.h
+mm-sim.c: mm-marshal.h
if WITH_POLKIT
ModemManager_SOURCES += \
diff --git a/src/mm-marshal.list b/src/mm-marshal.list
index 4c3277dd..62b68822 100644
--- a/src/mm-marshal.list
+++ b/src/mm-marshal.list
@@ -1,2 +1,3 @@
VOID:STRING,BOOLEAN
VOID:STRING
+VOID:BOOLEAN
diff --git a/src/mm-sim.c b/src/mm-sim.c
index 129584e9..b7624854 100644
--- a/src/mm-sim.c
+++ b/src/mm-sim.c
@@ -32,6 +32,7 @@
#include "mm-utils.h"
#include "mm-log.h"
#include "mm-modem-helpers.h"
+#include "mm-marshal.h"
static void async_initable_iface_init (GAsyncInitableIface *iface);
@@ -47,6 +48,11 @@ enum {
PROP_LAST
};
+enum {
+ SIGNAL_PIN_LOCK_ENABLED,
+ SIGNAL_LAST
+};
+
static GParamSpec *properties[PROP_LAST];
struct _MMSimPrivate {
@@ -58,6 +64,8 @@ struct _MMSimPrivate {
gchar *path;
};
+static guint signals[SIGNAL_LAST] = { 0 };
+
/*****************************************************************************/
void
@@ -310,9 +318,13 @@ handle_enable_pin_ready (MMSim *self,
MM_SIM_GET_CLASS (self)->enable_pin_finish (self, res, &error);
if (error)
g_dbus_method_invocation_take_error (ctx->invocation, error);
- else
+ else {
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);
}
@@ -1778,4 +1790,14 @@ mm_sim_class_init (MMSimClass *klass)
MM_TYPE_BASE_MODEM,
G_PARAM_READWRITE);
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);
}
diff --git a/src/mm-sim.h b/src/mm-sim.h
index cba15c07..6ff875ff 100644
--- a/src/mm-sim.h
+++ b/src/mm-sim.h
@@ -35,10 +35,14 @@ typedef struct _MMSim MMSim;
typedef struct _MMSimClass MMSimClass;
typedef struct _MMSimPrivate MMSimPrivate;
+/* Properties */
#define MM_SIM_PATH "sim-path"
#define MM_SIM_CONNECTION "sim-connection"
#define MM_SIM_MODEM "sim-modem"
+/* Signals */
+#define MM_SIM_PIN_LOCK_ENABLED "pin-lock-enabled"
+
struct _MMSim {
MmGdbusSimSkeleton parent;
MMSimPrivate *priv;
@@ -117,6 +121,10 @@ struct _MMSimClass {
gboolean (* send_puk_finish) (MMSim *self,
GAsyncResult *res,
GError **error);
+
+ /* Signals */
+ void (*pin_lock_enabled) (MMSim *self,
+ gboolean enabled);
};
GType mm_sim_get_type (void);