aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-08-01 09:59:13 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-08-28 14:59:06 +0000
commit86a183778b5b123f6556ecbe53ec7d06d6e7c575 (patch)
treeb3ba49e4b8d2eb82ecf8bad2713f98faf6c72422
parent48973e3d72307ca84375d1c7811eb0b04def91ce (diff)
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...).
-rw-r--r--cli/mmcli-output.c1
-rw-r--r--cli/mmcli-output.h1
-rw-r--r--cli/mmcli-sim.c1
-rw-r--r--docs/reference/libmm-glib/libmm-glib-sections.txt3
-rw-r--r--introspection/org.freedesktop.ModemManager1.Sim.xml13
-rw-r--r--libmm-glib/mm-sim.c20
-rw-r--r--libmm-glib/mm-sim.h2
-rw-r--r--plugins/huawei/mm-sim-huawei.c1
-rw-r--r--plugins/iridium/mm-sim-iridium.c1
-rw-r--r--plugins/mbm/mm-sim-mbm.c1
-rw-r--r--plugins/nokia/mm-sim-nokia.c1
-rw-r--r--plugins/novatel/mm-sim-novatel-lte.c1
-rw-r--r--plugins/pantech/mm-sim-pantech.c1
-rw-r--r--plugins/sierra/mm-sim-sierra.c1
-rw-r--r--plugins/ublox/mm-sim-ublox.c1
-rw-r--r--src/mm-base-sim.c1
-rw-r--r--src/mm-sim-mbim.c1
-rw-r--r--src/mm-sim-qmi.c1
18 files changed, 52 insertions, 0 deletions
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index 81a402ac..7f68e812 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -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, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index e350b340..0bf40a41 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -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,
diff --git a/cli/mmcli-sim.c b/cli/mmcli-sim.c
index efb15df3..e5501ca9 100644
--- a/cli/mmcli-sim.c
+++ b/cli/mmcli-sim.c
@@ -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));
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt
index 32524e7a..3ffd8c87 100644
--- a/docs/reference/libmm-glib/libmm-glib-sections.txt
+++ b/docs/reference/libmm-glib/libmm-glib-sections.txt
@@ -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
diff --git a/introspection/org.freedesktop.ModemManager1.Sim.xml b/introspection/org.freedesktop.ModemManager1.Sim.xml
index ceba2629..f214ba5f 100644
--- a/introspection/org.freedesktop.ModemManager1.Sim.xml
+++ b/introspection/org.freedesktop.ModemManager1.Sim.xml
@@ -66,6 +66,19 @@
</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:
The ICCID of the SIM card.
diff --git a/libmm-glib/mm-sim.c b/libmm-glib/mm-sim.c
index 7246fff4..d59f7990 100644
--- a/libmm-glib/mm-sim.c
+++ b/libmm-glib/mm-sim.c
@@ -87,6 +87,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.
*
diff --git a/libmm-glib/mm-sim.h b/libmm-glib/mm-sim.h
index eee4bc49..efafea45 100644
--- a/libmm-glib/mm-sim.h
+++ b/libmm-glib/mm-sim.h
@@ -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);
diff --git a/plugins/huawei/mm-sim-huawei.c b/plugins/huawei/mm-sim-huawei.c
index 54b388b3..f937c773 100644
--- a/plugins/huawei/mm-sim-huawei.c
+++ b/plugins/huawei/mm-sim-huawei.c
@@ -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);
}
diff --git a/plugins/iridium/mm-sim-iridium.c b/plugins/iridium/mm-sim-iridium.c
index 1240e6af..1d9af32a 100644
--- a/plugins/iridium/mm-sim-iridium.c
+++ b/plugins/iridium/mm-sim-iridium.c
@@ -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);
}
diff --git a/plugins/mbm/mm-sim-mbm.c b/plugins/mbm/mm-sim-mbm.c
index 1b160d6c..d3f73954 100644
--- a/plugins/mbm/mm-sim-mbm.c
+++ b/plugins/mbm/mm-sim-mbm.c
@@ -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);
}
diff --git a/plugins/nokia/mm-sim-nokia.c b/plugins/nokia/mm-sim-nokia.c
index 043d6349..a0d7c81a 100644
--- a/plugins/nokia/mm-sim-nokia.c
+++ b/plugins/nokia/mm-sim-nokia.c
@@ -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);
}
diff --git a/plugins/novatel/mm-sim-novatel-lte.c b/plugins/novatel/mm-sim-novatel-lte.c
index 676db569..4d71bd80 100644
--- a/plugins/novatel/mm-sim-novatel-lte.c
+++ b/plugins/novatel/mm-sim-novatel-lte.c
@@ -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);
}
diff --git a/plugins/pantech/mm-sim-pantech.c b/plugins/pantech/mm-sim-pantech.c
index 0cf61e97..33414572 100644
--- a/plugins/pantech/mm-sim-pantech.c
+++ b/plugins/pantech/mm-sim-pantech.c
@@ -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);
}
diff --git a/plugins/sierra/mm-sim-sierra.c b/plugins/sierra/mm-sim-sierra.c
index d81e82b2..2f3caa48 100644
--- a/plugins/sierra/mm-sim-sierra.c
+++ b/plugins/sierra/mm-sim-sierra.c
@@ -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);
}
diff --git a/plugins/ublox/mm-sim-ublox.c b/plugins/ublox/mm-sim-ublox.c
index 0e8006cc..5850767e 100644
--- a/plugins/ublox/mm-sim-ublox.c
+++ b/plugins/ublox/mm-sim-ublox.c
@@ -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);
}
diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c
index 27759532..0a91d385 100644
--- a/src/mm-base-sim.c
+++ b/src/mm-base-sim.c
@@ -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);
}
diff --git a/src/mm-sim-mbim.c b/src/mm-sim-mbim.c
index f48bb31d..2619687a 100644
--- a/src/mm-sim-mbim.c
+++ b/src/mm-sim-mbim.c
@@ -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);
}
diff --git a/src/mm-sim-qmi.c b/src/mm-sim-qmi.c
index 6eb5854d..584dbe99 100644
--- a/src/mm-sim-qmi.c
+++ b/src/mm-sim-qmi.c
@@ -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);
}