api,sim: new 'Active' property
In preparation for the multi-SIM setup, we need a way to tell whether a given SIM card is active or not in the system. On systems with one single SIM slot, the available SIM card will always be active. On Multi-SIM Single-Standby setups we may have multiple SIM slots with multiple SIM cards, but only one of them will be active at any given time. On Multi-SIM Multi-Standby setups we may have multiple SIM slots with multiple SIM cards that may be active at the same time. E.g. the QMI protocol allows up to 5 different active SIM cards (primary, secondary, tertiary...).
This commit is contained in:
@@ -264,6 +264,7 @@ static FieldInfo field_infos[] = {
|
||||
[MMC_F_SMS_PROPERTIES_DELIVERY_STATE] = { "sms.properties.delivery-state", "delivery state", MMC_S_SMS_PROPERTIES, },
|
||||
[MMC_F_SMS_PROPERTIES_DISCH_TIMESTAMP] = { "sms.properties.discharge-timestamp", "discharge timestamp", MMC_S_SMS_PROPERTIES, },
|
||||
[MMC_F_SIM_GENERAL_DBUS_PATH] = { "sim.dbus-path", "path", MMC_S_SIM_GENERAL, },
|
||||
[MMC_F_SIM_PROPERTIES_ACTIVE] = { "sim.properties.active", "active", MMC_S_SIM_PROPERTIES, },
|
||||
[MMC_F_SIM_PROPERTIES_IMSI] = { "sim.properties.imsi", "imsi", MMC_S_SIM_PROPERTIES, },
|
||||
[MMC_F_SIM_PROPERTIES_ICCID] = { "sim.properties.iccid", "iccid", MMC_S_SIM_PROPERTIES, },
|
||||
[MMC_F_SIM_PROPERTIES_OPERATOR_ID] = { "sim.properties.operator-code", "operator id", MMC_S_SIM_PROPERTIES, },
|
||||
|
@@ -281,6 +281,7 @@ typedef enum {
|
||||
MMC_F_SMS_PROPERTIES_DELIVERY_STATE,
|
||||
MMC_F_SMS_PROPERTIES_DISCH_TIMESTAMP,
|
||||
MMC_F_SIM_GENERAL_DBUS_PATH,
|
||||
MMC_F_SIM_PROPERTIES_ACTIVE,
|
||||
MMC_F_SIM_PROPERTIES_IMSI,
|
||||
MMC_F_SIM_PROPERTIES_ICCID,
|
||||
MMC_F_SIM_PROPERTIES_OPERATOR_ID,
|
||||
|
@@ -159,6 +159,7 @@ static void
|
||||
print_sim_info (MMSim *sim)
|
||||
{
|
||||
mmcli_output_string (MMC_F_SIM_GENERAL_DBUS_PATH, mm_sim_get_path (sim));
|
||||
mmcli_output_string (MMC_F_SIM_PROPERTIES_ACTIVE, mm_sim_get_active (sim) ? "yes" : "no");
|
||||
mmcli_output_string (MMC_F_SIM_PROPERTIES_IMSI, mm_sim_get_imsi (sim));
|
||||
mmcli_output_string (MMC_F_SIM_PROPERTIES_ICCID, mm_sim_get_identifier (sim));
|
||||
mmcli_output_string (MMC_F_SIM_PROPERTIES_OPERATOR_ID, mm_sim_get_operator_identifier (sim));
|
||||
|
@@ -1209,6 +1209,7 @@ MMSim
|
||||
<SUBSECTION Getters>
|
||||
mm_sim_get_path
|
||||
mm_sim_dup_path
|
||||
mm_sim_get_active
|
||||
mm_sim_get_identifier
|
||||
mm_sim_dup_identifier
|
||||
mm_sim_get_imsi
|
||||
@@ -3088,6 +3089,7 @@ mm_gdbus_object_manager_client_get_type
|
||||
MmGdbusSim
|
||||
MmGdbusSimIface
|
||||
<SUBSECTION Getters>
|
||||
mm_gdbus_sim_get_active
|
||||
mm_gdbus_sim_get_imsi
|
||||
mm_gdbus_sim_dup_imsi
|
||||
mm_gdbus_sim_get_sim_identifier
|
||||
@@ -3112,6 +3114,7 @@ mm_gdbus_sim_call_change_pin
|
||||
mm_gdbus_sim_call_change_pin_finish
|
||||
mm_gdbus_sim_call_change_pin_sync
|
||||
<SUBSECTION Private>
|
||||
mm_gdbus_sim_set_active
|
||||
mm_gdbus_sim_set_imsi
|
||||
mm_gdbus_sim_set_operator_identifier
|
||||
mm_gdbus_sim_set_operator_name
|
||||
|
@@ -65,6 +65,19 @@
|
||||
<arg name="new_pin" type="s" direction="in" />
|
||||
</method>
|
||||
|
||||
<!--
|
||||
Active:
|
||||
|
||||
Boolean indicating whether the SIM is currently active.
|
||||
|
||||
On systems that support Multi SIM Single Standby, only one SIM may be
|
||||
active at any given time, which will be the one considered primary.
|
||||
|
||||
On systems that support Multi SIM Multi Standby, more than one SIM may
|
||||
be active at any given time, but only one of them is considered primary.
|
||||
-->
|
||||
<property name="Active" type="b" access="read" />
|
||||
|
||||
<!--
|
||||
SimIdentifier:
|
||||
|
||||
|
@@ -86,6 +86,26 @@ mm_sim_dup_path (MMSim *self)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_sim_get_active:
|
||||
* @self: A #MMSim.
|
||||
*
|
||||
* Checks whether the #MMSim is currently active.
|
||||
*
|
||||
* Returns: %TRUE if the SIM is active, %FALSE otherwise.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
mm_sim_get_active (MMSim *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_SIM (self), FALSE);
|
||||
|
||||
return mm_gdbus_sim_get_active (MM_GDBUS_SIM (self));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_sim_get_identifier:
|
||||
* @self: A #MMSim.
|
||||
|
@@ -67,6 +67,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMSim, g_object_unref)
|
||||
const gchar *mm_sim_get_path (MMSim *self);
|
||||
gchar *mm_sim_dup_path (MMSim *self);
|
||||
|
||||
gboolean mm_sim_get_active (MMSim *self);
|
||||
|
||||
const gchar *mm_sim_get_identifier (MMSim *self);
|
||||
gchar *mm_sim_dup_identifier (MMSim *self);
|
||||
|
||||
|
@@ -148,6 +148,7 @@ mm_sim_huawei_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -63,6 +63,7 @@ mm_sim_iridium_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -221,6 +221,7 @@ mm_sim_mbm_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -62,6 +62,7 @@ mm_sim_nokia_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -215,6 +215,7 @@ mm_sim_novatel_lte_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -62,6 +62,7 @@ mm_sim_pantech_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -139,6 +139,7 @@ mm_sim_sierra_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -144,6 +144,7 @@ mm_sim_ublox_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -1715,6 +1715,7 @@ mm_base_sim_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -752,6 +752,7 @@ mm_sim_mbim_new (MMBaseModem *modem,
|
||||
callback,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@@ -1315,6 +1315,7 @@ mm_sim_qmi_new (MMBaseModem *modem,
|
||||
user_data,
|
||||
MM_BASE_SIM_MODEM, modem,
|
||||
MM_SIM_QMI_DMS_UIM_DEPRECATED, dms_uim_deprecated,
|
||||
"active", TRUE, /* by default always active */
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user