aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-12-16 11:40:18 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-12-26 10:12:32 +0100
commit2bfa6863c40cf5794ea36720796dec9911ff9668 (patch)
treef7d250955b398fd5e87968a94cf5555fba4732d3
parent80c4f49940ced46379fe2eb3e84ecb99c479c50b (diff)
mmcli: new '--3gpp-profile-manager-status' operation
In order to show the properties of the profile management interface, e.g.: $ sudo mmcli -m a --3gpp-profile-manager-status ----------------------------------- 3GPP profile manager | index field: apn-type
-rw-r--r--cli/mmcli-modem-3gpp-profile-manager.c31
-rw-r--r--cli/mmcli-output.c1
-rw-r--r--cli/mmcli-output.h1
3 files changed, 32 insertions, 1 deletions
diff --git a/cli/mmcli-modem-3gpp-profile-manager.c b/cli/mmcli-modem-3gpp-profile-manager.c
index bd7a8452..3b1dc5bb 100644
--- a/cli/mmcli-modem-3gpp-profile-manager.c
+++ b/cli/mmcli-modem-3gpp-profile-manager.c
@@ -46,11 +46,16 @@ typedef struct {
static Context *ctx;
/* Options */
+static gboolean status_flag;
static gboolean list_flag;
static gchar *set_str;
static gchar *delete_str;
static GOptionEntry entries[] = {
+ { "3gpp-profile-manager-status", 0, 0, G_OPTION_ARG_NONE, &status_flag,
+ "Show status of the profile management features.",
+ NULL
+ },
{ "3gpp-profile-manager-list", 0, 0, G_OPTION_ARG_NONE, &list_flag,
"List available profiles",
NULL
@@ -90,7 +95,8 @@ mmcli_modem_3gpp_profile_manager_options_enabled (void)
if (checked)
return !!n_actions;
- n_actions = (list_flag +
+ n_actions = (status_flag +
+ list_flag +
!!set_str +
!!delete_str);
@@ -99,6 +105,9 @@ mmcli_modem_3gpp_profile_manager_options_enabled (void)
exit (EXIT_FAILURE);
}
+ if (status_flag)
+ mmcli_force_sync_operation ();
+
checked = TRUE;
return !!n_actions;
}
@@ -143,6 +152,16 @@ mmcli_modem_3gpp_profile_manager_shutdown (void)
}
static void
+print_status (void)
+{
+ const gchar *index_field;
+
+ index_field = mm_modem_3gpp_profile_manager_get_index_field (ctx->modem_3gpp_profile_manager);
+ mmcli_output_string (MMC_F_3GPP_PROFILE_MANAGER_INDEX_FIELD, index_field);
+ mmcli_output_dump ();
+}
+
+static void
delete_process_reply (gboolean result,
const GError *error)
{
@@ -261,6 +280,9 @@ get_modem_ready (GObject *source,
ensure_modem_3gpp_profile_manager ();
+ if (status_flag)
+ g_assert_not_reached ();
+
/* Request to list? */
if (list_flag) {
g_debug ("Asynchronously listing profiles...");
@@ -350,6 +372,13 @@ mmcli_modem_3gpp_profile_manager_run_synchronous (GDBusConnection *connection)
ensure_modem_3gpp_profile_manager ();
+ /* Request to get location status? */
+ if (status_flag) {
+ g_debug ("Printing profile management status...");
+ print_status ();
+ return;
+ }
+
/* Request to list? */
if (list_flag) {
GList *profiles;
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index d094d92c..a01ff48a 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -146,6 +146,7 @@ static FieldInfo field_infos[] = {
[MMC_F_3GPP_USSD_STATUS] = { "modem.3gpp.ussd.status", "status", MMC_S_MODEM_3GPP_USSD, },
[MMC_F_3GPP_USSD_NETWORK_REQUEST] = { "modem.3gpp.ussd.network-request", "network request", MMC_S_MODEM_3GPP_USSD, },
[MMC_F_3GPP_USSD_NETWORK_NOTIFICATION] = { "modem.3gpp.ussd.network-notification", "network notification", MMC_S_MODEM_3GPP_USSD, },
+ [MMC_F_3GPP_PROFILE_MANAGER_INDEX_FIELD] = { "modem.3gpp.profile-manager.index-field", "index field", MMC_S_MODEM_3GPP_PROFILE_MANAGER, },
[MMC_F_3GPP_PROFILE_MANAGER_LIST] = { "modem.3gpp.profile-manager.list", "list", MMC_S_MODEM_3GPP_PROFILE_MANAGER, },
[MMC_F_3GPP_PROFILE_MANAGER_SET] = { "modem.3gpp.profile-manager.set", "set", MMC_S_MODEM_3GPP_PROFILE_MANAGER, },
[MMC_F_CDMA_MEID] = { "modem.cdma.meid", "meid", MMC_S_MODEM_CDMA, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index 601912f1..bd06045b 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -147,6 +147,7 @@ typedef enum {
/* 3GPP scan section */
MMC_F_3GPP_SCAN_NETWORKS,
/* 3GPP profile management section */
+ MMC_F_3GPP_PROFILE_MANAGER_INDEX_FIELD,
MMC_F_3GPP_PROFILE_MANAGER_LIST,
MMC_F_3GPP_PROFILE_MANAGER_SET,
/* USSD section */