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.
This commit is contained in:
@@ -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,
|
||||
|
@@ -39,6 +39,7 @@ typedef struct _MMBaseSimPrivate MMBaseSimPrivate;
|
||||
#define MM_BASE_SIM_PATH "sim-path"
|
||||
#define MM_BASE_SIM_CONNECTION "sim-connection"
|
||||
#define MM_BASE_SIM_MODEM "sim-modem"
|
||||
#define MM_BASE_SIM_SLOT_NUMBER "sim-slot-number"
|
||||
|
||||
/* Signals */
|
||||
#define MM_BASE_SIM_PIN_LOCK_ENABLED "sim-pin-lock-enabled"
|
||||
@@ -173,6 +174,8 @@ void mm_base_sim_export (MMBaseSim *self);
|
||||
|
||||
const gchar *mm_base_sim_get_path (MMBaseSim *sim);
|
||||
|
||||
guint mm_base_sim_get_slot_number (MMBaseSim *self);
|
||||
|
||||
void mm_base_sim_load_sim_identifier (MMBaseSim *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
Reference in New Issue
Block a user