From 86a183778b5b123f6556ecbe53ec7d06d6e7c575 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sat, 1 Aug 2020 09:59:13 +0200 Subject: [PATCH] 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...). --- cli/mmcli-output.c | 1 + cli/mmcli-output.h | 1 + cli/mmcli-sim.c | 1 + .../libmm-glib/libmm-glib-sections.txt | 3 +++ .../org.freedesktop.ModemManager1.Sim.xml | 13 ++++++++++++ libmm-glib/mm-sim.c | 20 +++++++++++++++++++ libmm-glib/mm-sim.h | 2 ++ plugins/huawei/mm-sim-huawei.c | 1 + plugins/iridium/mm-sim-iridium.c | 1 + plugins/mbm/mm-sim-mbm.c | 1 + plugins/nokia/mm-sim-nokia.c | 1 + plugins/novatel/mm-sim-novatel-lte.c | 1 + plugins/pantech/mm-sim-pantech.c | 1 + plugins/sierra/mm-sim-sierra.c | 1 + plugins/ublox/mm-sim-ublox.c | 1 + src/mm-base-sim.c | 1 + src/mm-sim-mbim.c | 1 + src/mm-sim-qmi.c | 1 + 18 files changed, 52 insertions(+) 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 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 +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 +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 @@ -65,6 +65,19 @@ + + +