aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-01-11 13:35:46 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:49 +0100
commit165a4dcb943d2d81fc3ec371d19695afb4e3508a (patch)
treeb97e78ba9028ef2e37f9ef1522fc3d0fbac388f9
parente7e1a4d15687394d5e4edace29ac2da76d088fe2 (diff)
cli: split the command to register in a 3GPP network
We provide `--3gpp-register-home' to request automatic registration. This will try to register in the home network if available; and if not available, in any other network being allowed. We also provide `--3gpp-register-in-operator' to try to lock the registration in the network of a given specific operator, specified by MCCMNC.
-rw-r--r--cli/mmcli-modem-3gpp.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/cli/mmcli-modem-3gpp.c b/cli/mmcli-modem-3gpp.c
index 598d1cf2..46f5a828 100644
--- a/cli/mmcli-modem-3gpp.c
+++ b/cli/mmcli-modem-3gpp.c
@@ -44,16 +44,21 @@ static Context *ctx;
/* Options */
static gboolean scan_flag;
-static gchar *register_str;
+static gboolean register_home_flag;
+static gchar *register_in_operator_str;
static GOptionEntry entries[] = {
{ "3gpp-scan", 0, 0, G_OPTION_ARG_NONE, &scan_flag,
"Scan for available networks in a given modem.",
NULL
},
- { "3gpp-register", 0, 0, G_OPTION_ARG_STRING, &register_str,
- "Request a given modem to register in the specified network",
- "[NETWORK]"
+ { "3gpp-register-home", 0, 0, G_OPTION_ARG_NONE, &register_home_flag,
+ "Request a given modem to register in its home network",
+ NULL
+ },
+ { "3gpp-register-in-operator", 0, 0, G_OPTION_ARG_STRING, &register_in_operator_str,
+ "Request a given modem to register in the network of the given operator",
+ "[MCCMNC]"
},
{ NULL }
};
@@ -83,7 +88,8 @@ mmcli_modem_3gpp_options_enabled (void)
return !!n_actions;
n_actions = (scan_flag +
- !!register_str);
+ register_home_flag +
+ !!register_in_operator_str);
if (n_actions > 1) {
g_printerr ("error: too many 3GPP actions requested\n");
@@ -235,10 +241,10 @@ get_modem_ready (GObject *source,
}
/* Request to register the modem? */
- if (register_str) {
+ if (register_in_operator_str || register_home_flag) {
g_debug ("Asynchronously registering the modem...");
mm_modem_3gpp_register (ctx->modem_3gpp,
- register_str,
+ (register_in_operator_str ? register_in_operator_str : ""),
ctx->cancellable,
(GAsyncReadyCallback)register_ready,
NULL);
@@ -281,14 +287,15 @@ mmcli_modem_3gpp_run_synchronous (GDBusConnection *connection)
g_assert_not_reached ();
/* Request to register the modem? */
- if (register_str) {
+ if (register_in_operator_str || register_home_flag) {
gboolean result;
g_debug ("Synchronously registering the modem...");
- result = mm_modem_3gpp_register_sync (ctx->modem_3gpp,
- register_str,
- NULL,
- &error);
+ result = mm_modem_3gpp_register_sync (
+ ctx->modem_3gpp,
+ (register_in_operator_str ? register_in_operator_str : ""),
+ NULL,
+ &error);
register_process_reply (result, error);
return;
}