summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Caruso <ejcaruso@chromium.org>2020-10-16 12:28:10 -0700
committerAleksander Morgado <aleksander@aleksander.es>2020-10-19 20:38:43 +0000
commit61739ab934e46c9693e964a20aced349e0f02d51 (patch)
tree812e77b35f6d566e574786edca99c7831ae1fd3e
parente24a8240cb957c1875f2f3eab14aa5005c3b8f40 (diff)
libmm-glib,mmcli: add mm_sim_get_eid and add EID to mmcli output
This exposes the new EID property of the SIM object on mmcli.
-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.txt2
-rw-r--r--libmm-glib/mm-sim.c46
-rw-r--r--libmm-glib/mm-sim.h3
6 files changed, 54 insertions, 0 deletions
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index ec540545..275e7066 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -269,6 +269,7 @@ static FieldInfo field_infos[] = {
[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_EID] = { "sim.properties.eid", "eid", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_OPERATOR_ID] = { "sim.properties.operator-code", "operator id", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_OPERATOR_NAME] = { "sim.properties.operator-name", "operator name", MMC_S_SIM_PROPERTIES, },
[MMC_F_SIM_PROPERTIES_EMERGENCY_NUMBERS] = { "sim.properties.emergency-numbers", "emergency numbers", MMC_S_SIM_PROPERTIES, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index 98702d3a..928bcd38 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -286,6 +286,7 @@ typedef enum {
MMC_F_SIM_PROPERTIES_ACTIVE,
MMC_F_SIM_PROPERTIES_IMSI,
MMC_F_SIM_PROPERTIES_ICCID,
+ MMC_F_SIM_PROPERTIES_EID,
MMC_F_SIM_PROPERTIES_OPERATOR_ID,
MMC_F_SIM_PROPERTIES_OPERATOR_NAME,
MMC_F_SIM_PROPERTIES_EMERGENCY_NUMBERS,
diff --git a/cli/mmcli-sim.c b/cli/mmcli-sim.c
index e5501ca9..2a1fed3a 100644
--- a/cli/mmcli-sim.c
+++ b/cli/mmcli-sim.c
@@ -162,6 +162,7 @@ print_sim_info (MMSim *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_EID, mm_sim_get_eid (sim));
mmcli_output_string (MMC_F_SIM_PROPERTIES_OPERATOR_ID, mm_sim_get_operator_identifier (sim));
mmcli_output_string (MMC_F_SIM_PROPERTIES_OPERATOR_NAME, mm_sim_get_operator_name (sim));
mmcli_output_string_array (MMC_F_SIM_PROPERTIES_EMERGENCY_NUMBERS, (const gchar **) mm_sim_get_emergency_numbers (sim), FALSE);
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt
index 107cd94d..23224dbe 100644
--- a/docs/reference/libmm-glib/libmm-glib-sections.txt
+++ b/docs/reference/libmm-glib/libmm-glib-sections.txt
@@ -1223,6 +1223,8 @@ mm_sim_get_identifier
mm_sim_dup_identifier
mm_sim_get_imsi
mm_sim_dup_imsi
+mm_sim_get_eid
+mm_sim_dup_eid
mm_sim_get_operator_identifier
mm_sim_dup_operator_identifier
mm_sim_get_operator_name
diff --git a/libmm-glib/mm-sim.c b/libmm-glib/mm-sim.c
index d59f7990..0a3b6071 100644
--- a/libmm-glib/mm-sim.c
+++ b/libmm-glib/mm-sim.c
@@ -202,6 +202,52 @@ mm_sim_dup_imsi (MMSim *self)
/*****************************************************************************/
/**
+ * mm_sim_get_eid:
+ * @self: A #MMSim.
+ *
+ * Gets the Embedded UICC ID (or EID) of the #MMSim object.
+ *
+ * <warning>The returned value is only valid until the property changes so it is
+ * only safe to use this function on the thread where @self was constructed. Use
+ * mm_sim_dup_eid() if on another thread.</warning>
+ *
+ * Returns: (transfer none): The EID of the #MMSim object, or %NULL if it
+ * couldn't be retrieved.
+ *
+ * Since: 1.16
+ */
+const gchar *
+mm_sim_get_eid (MMSim *self)
+{
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
+
+ RETURN_NON_EMPTY_CONSTANT_STRING (
+ mm_gdbus_sim_get_eid (MM_GDBUS_SIM (self)));
+}
+
+/**
+ * mm_sim_dup_eid:
+ * @self: A #MMSim.
+ *
+ * Gets a copy of the Embedded UICC ID (EID) of the #MMSim object.
+ *
+ * Returns: (transfer full): The EID of the #MMSim object, or %NULL if it
+ * couldn't be retrieved. The returned value should be freed with g_free().
+ *
+ * Since: 1.16
+ */
+gchar *
+mm_sim_dup_eid (MMSim *self)
+{
+ g_return_val_if_fail (MM_IS_SIM (self), NULL);
+
+ RETURN_NON_EMPTY_STRING (
+ mm_gdbus_sim_dup_eid (MM_GDBUS_SIM (self)));
+}
+
+/*****************************************************************************/
+
+/**
* mm_sim_get_operator_identifier:
* @self: A #MMSim.
*
diff --git a/libmm-glib/mm-sim.h b/libmm-glib/mm-sim.h
index efafea45..3449e289 100644
--- a/libmm-glib/mm-sim.h
+++ b/libmm-glib/mm-sim.h
@@ -75,6 +75,9 @@ gchar *mm_sim_dup_identifier (MMSim *self);
const gchar *mm_sim_get_imsi (MMSim *self);
gchar *mm_sim_dup_imsi (MMSim *self);
+const gchar *mm_sim_get_eid (MMSim *self);
+gchar *mm_sim_dup_eid (MMSim *self);
+
const gchar *mm_sim_get_operator_identifier (MMSim *self);
gchar *mm_sim_dup_operator_identifier (MMSim *self);