cli: include 3GPP related stuff when printing modem info
This commit is contained in:
@@ -563,6 +563,19 @@ mmcli_get_3gpp_network_availability_string (MMModem3gppNetworkAvailability avail
|
||||
return value->value_nick;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
mmcli_get_3gpp_registration_state_string (MMModem3gppRegistrationState state)
|
||||
{
|
||||
static GEnumClass *enum_class = NULL;
|
||||
GEnumValue *value;
|
||||
|
||||
if (!enum_class)
|
||||
enum_class = G_ENUM_CLASS (g_type_class_ref (MM_TYPE_MODEM_3GPP_REGISTRATION_STATE));
|
||||
|
||||
value = g_enum_get_value (enum_class, state);
|
||||
return value->value_nick;
|
||||
}
|
||||
|
||||
/* Common options */
|
||||
static gchar *modem_str;
|
||||
static gchar *bearer_str;
|
||||
|
@@ -56,6 +56,7 @@ const gchar *mmcli_get_state_string (MMModemState state);
|
||||
const gchar *mmcli_get_state_reason_string (MMModemStateChangeReason reason);
|
||||
const gchar *mmcli_get_lock_string (MMModemLock lock);
|
||||
const gchar *mmcli_get_3gpp_network_availability_string (MMModem3gppNetworkAvailability availability);
|
||||
const gchar *mmcli_get_3gpp_registration_state_string (MMModem3gppRegistrationState state);
|
||||
|
||||
GOptionGroup *mmcli_get_common_option_group (void);
|
||||
const gchar *mmcli_get_common_modem_string (void);
|
||||
|
@@ -39,6 +39,7 @@ typedef struct {
|
||||
GCancellable *cancellable;
|
||||
MMObject *object;
|
||||
MMModem *modem;
|
||||
MMModem3gpp *modem_3gpp;
|
||||
} Context;
|
||||
static Context *ctx;
|
||||
|
||||
@@ -154,6 +155,8 @@ context_free (Context *ctx)
|
||||
g_object_unref (ctx->cancellable);
|
||||
if (ctx->modem)
|
||||
g_object_unref (ctx->modem);
|
||||
if (ctx->modem_3gpp)
|
||||
g_object_unref (ctx->modem_3gpp);
|
||||
if (ctx->object)
|
||||
g_object_unref (ctx->object);
|
||||
if (ctx->manager)
|
||||
@@ -296,6 +299,20 @@ print_modem_info (void)
|
||||
VALIDATE (mmcli_get_state_string (mm_modem_get_state (ctx->modem))),
|
||||
VALIDATE (access_technologies_string));
|
||||
|
||||
/* If available, 3GPP related stuff */
|
||||
if (ctx->modem_3gpp) {
|
||||
g_print (" -------------------------\n"
|
||||
" 3GPP | imei: '%s'\n"
|
||||
" | operator id: '%s'\n"
|
||||
" | operator name: '%s'\n"
|
||||
" | registration: '%s'\n",
|
||||
VALIDATE (mm_modem_3gpp_get_imei (ctx->modem_3gpp)),
|
||||
VALIDATE (mm_modem_3gpp_get_operator_code (ctx->modem_3gpp)),
|
||||
VALIDATE (mm_modem_3gpp_get_operator_name (ctx->modem_3gpp)),
|
||||
mmcli_get_3gpp_registration_state_string (
|
||||
mm_modem_3gpp_get_registration_state ((ctx->modem_3gpp))));
|
||||
}
|
||||
|
||||
/* SIM related stuff */
|
||||
sim = mm_modem_get_sim_sync (ctx->modem, NULL, &error);
|
||||
if (error) {
|
||||
@@ -620,6 +637,7 @@ get_modem_ready (GObject *source,
|
||||
{
|
||||
ctx->object = mmcli_get_modem_finish (result, &ctx->manager);
|
||||
ctx->modem = mm_object_get_modem (ctx->object);
|
||||
ctx->modem_3gpp = mm_object_get_modem_3gpp (ctx->object);
|
||||
|
||||
if (info_flag)
|
||||
g_assert_not_reached ();
|
||||
@@ -779,6 +797,7 @@ mmcli_modem_run_synchronous (GDBusConnection *connection)
|
||||
mmcli_get_common_modem_string (),
|
||||
&ctx->manager);
|
||||
ctx->modem = mm_object_get_modem (ctx->object);
|
||||
ctx->modem_3gpp = mm_object_get_modem_3gpp (ctx->object);
|
||||
|
||||
/* Request to get info from modem? */
|
||||
if (info_flag) {
|
||||
|
Reference in New Issue
Block a user