diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-08-01 09:59:19 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-08-28 14:59:06 +0000 |
commit | c999c8e9cf54a6ef34b16325c32a03aa1e31db2d (patch) | |
tree | 4e3aede6280412071061c52aeec79c8846448ee1 /src/mm-base-sim.c | |
parent | 842ad4bd64404e4a98d089c9a8fa60715c7018c6 (diff) |
base-sim: new 'slot number' property
This new property helps us identify in which SIM slot the SIM card is
inserted, when multiple slots are available, in the [1,N] range.
For the single-SIM systems this value will always be '0'.
This property is not publicly exposed in DBus, it is considered an
implementation detail.
Diffstat (limited to 'src/mm-base-sim.c')
-rw-r--r-- | src/mm-base-sim.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c index 1c0443ba..bb681c36 100644 --- a/src/mm-base-sim.c +++ b/src/mm-base-sim.c @@ -45,6 +45,7 @@ enum { PROP_PATH, PROP_CONNECTION, PROP_MODEM, + PROP_SLOT_NUMBER, PROP_LAST }; @@ -64,6 +65,10 @@ struct _MMBaseSimPrivate { MMBaseModem *modem; /* The path where the SIM object is exported */ gchar *path; + + /* The SIM slot number, which will be 0 always if the system + * doesn't support multiple SIMS. */ + guint slot_number; }; static guint signals[SIGNAL_LAST] = { 0 }; @@ -975,6 +980,12 @@ mm_base_sim_get_path (MMBaseSim *self) return self->priv->path; } +guint +mm_base_sim_get_slot_number (MMBaseSim *self) +{ + return self->priv->slot_number; +} + /*****************************************************************************/ gboolean @@ -1833,6 +1844,9 @@ set_property (GObject *object, G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); } break; + case PROP_SLOT_NUMBER: + self->priv->slot_number = g_value_get_uint (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1857,6 +1871,9 @@ get_property (GObject *object, case PROP_MODEM: g_value_set_object (value, self->priv->modem); break; + case PROP_SLOT_NUMBER: + g_value_set_uint (value, self->priv->slot_number); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1971,6 +1988,14 @@ mm_base_sim_class_init (MMBaseSimClass *klass) G_PARAM_READWRITE); g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]); + properties[PROP_SLOT_NUMBER] = + g_param_spec_uint (MM_BASE_SIM_SLOT_NUMBER, + "Slot number", + "The slot number where the SIM is inserted", + 0, G_MAXUINT, 0, + G_PARAM_READWRITE); + g_object_class_install_property (object_class, PROP_SLOT_NUMBER, properties[PROP_SLOT_NUMBER]); + /* Signals */ signals[SIGNAL_PIN_LOCK_ENABLED] = g_signal_new (MM_BASE_SIM_PIN_LOCK_ENABLED, |