diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2016-06-10 22:56:10 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-06-10 23:06:42 -0700 |
commit | 86328ed1cc2e1451c095a3c892b7dfd6d1d474d8 (patch) | |
tree | 104c02d14847b767a63eae339777c5560c043472 | |
parent | cd14401f0247b1c1cf9f7c3757669c65e5489a38 (diff) | |
download | libqmi-86328ed1cc2e1451c095a3c892b7dfd6d1d474d8.tar.gz |
nas: support 'Force Network Search'
-rw-r--r-- | data/qmi-service-nas.json | 8 | ||||
-rw-r--r-- | src/qmicli/qmicli-nas.c | 47 |
2 files changed, 55 insertions, 0 deletions
diff --git a/data/qmi-service-nas.json b/data/qmi-service-nas.json index bf3ec0f4..6a1e6e3e 100644 --- a/data/qmi-service-nas.json +++ b/data/qmi-service-nas.json @@ -3144,6 +3144,14 @@ "prerequisites": [ { "common-ref" : "Success" } ] } ] }, // ********************************************************************************* + { "name" : "Force Network Search", + "type" : "Message", + "service" : "NAS", + "id" : "0x0067", + "version" : "1.21", + "output" : [ { "common-ref" : "Operation Result" } ] }, + + // ********************************************************************************* { "name" : "Get CDMA Position Info", "type" : "Message", "service" : "NAS", diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c index 18402c99..2a72f84a 100644 --- a/src/qmicli/qmicli-nas.c +++ b/src/qmicli/qmicli-nas.c @@ -53,6 +53,7 @@ static gboolean get_system_selection_preference_flag; static gchar *set_system_selection_preference_str; static gboolean network_scan_flag; static gboolean get_cell_location_info_flag; +static gboolean force_network_search_flag; static gboolean get_lte_cphy_ca_info_flag; static gboolean get_supported_messages_flag; static gboolean reset_flag; @@ -103,6 +104,10 @@ static GOptionEntry entries[] = { "Get Cell Location Info", NULL }, + { "nas-force-network-search", 0, 0, G_OPTION_ARG_NONE, &force_network_search_flag, + "Force network search", + NULL + }, { "nas-get-lte-cphy-ca-info", 0, 0, G_OPTION_ARG_NONE, &get_lte_cphy_ca_info_flag, "Get LTE Cphy CA Info", NULL @@ -157,6 +162,7 @@ qmicli_nas_options_enabled (void) !!set_system_selection_preference_str + network_scan_flag + get_cell_location_info_flag + + force_network_search_flag + get_lte_cphy_ca_info_flag + get_supported_messages_flag + reset_flag + @@ -2767,6 +2773,35 @@ get_cell_location_info_ready (QmiClientNas *client, } static void +force_network_search_ready (QmiClientNas *client, + GAsyncResult *res) +{ + QmiMessageNasForceNetworkSearchOutput *output; + GError *error = NULL; + + output = qmi_client_nas_force_network_search_finish (client, res, &error); + if (!output) { + g_printerr ("error: operation failed: %s\n", error->message); + g_error_free (error); + operation_shutdown (FALSE); + return; + } + + if (!qmi_message_nas_force_network_search_output_get_result (output, &error)) { + g_printerr ("error: couldn't force network search: %s\n", error->message); + g_error_free (error); + qmi_message_nas_force_network_search_output_unref (output); + operation_shutdown (FALSE); + return; + } + + g_print ("[%s] Successfully forced network search\n", + qmi_device_get_path_display (ctx->device)); + qmi_message_nas_force_network_search_output_unref (output); + operation_shutdown (TRUE); +} + +static void get_lte_cphy_ca_info_ready (QmiClientNas *client, GAsyncResult *res) { @@ -3098,6 +3133,18 @@ qmicli_nas_run (QmiDevice *device, return; } + /* Request to force network search */ + if (force_network_search_flag) { + g_debug ("Forcing network search..."); + qmi_client_nas_force_network_search (ctx->client, + NULL, + 10, + ctx->cancellable, + (GAsyncReadyCallback)force_network_search_ready, + NULL); + return; + } + /* Request to get carrier aggregation info? */ if (get_lte_cphy_ca_info_flag) { g_debug ("Asynchronously getting carrier aggregation info ..."); |