api,modem-3gpp: new 'SetInitialEpsBearerSettings' method
This method allows users to modify the settings used during the initial LTE attach procedure.
This commit is contained in:
committed by
Dan Williams
parent
8281b5048b
commit
4cb6751daf
@@ -51,6 +51,7 @@ static gboolean scan_flag;
|
||||
static gboolean register_home_flag;
|
||||
static gchar *register_in_operator_str;
|
||||
static gchar *set_eps_ue_mode_operation_str;
|
||||
static gchar *set_initial_eps_bearer_settings_str;
|
||||
static gboolean ussd_status_flag;
|
||||
static gchar *ussd_initiate_str;
|
||||
static gchar *ussd_respond_str;
|
||||
@@ -73,6 +74,10 @@ static GOptionEntry entries[] = {
|
||||
"Set the UE mode of operation for EPS",
|
||||
"[ps-1|ps-2|csps-1|csps-2]"
|
||||
},
|
||||
{ "3gpp-set-initial-eps-bearer-settings", 0, 0, G_OPTION_ARG_STRING, &set_initial_eps_bearer_settings_str,
|
||||
"Set the initial EPS bearer settings",
|
||||
"[\"key=value,...\"]"
|
||||
},
|
||||
{ "3gpp-ussd-status", 0, 0, G_OPTION_ARG_NONE, &ussd_status_flag,
|
||||
"Show status of any ongoing USSD session",
|
||||
NULL
|
||||
@@ -120,6 +125,7 @@ mmcli_modem_3gpp_options_enabled (void)
|
||||
register_home_flag +
|
||||
!!register_in_operator_str +
|
||||
!!set_eps_ue_mode_operation_str +
|
||||
!!set_initial_eps_bearer_settings_str +
|
||||
ussd_status_flag +
|
||||
!!ussd_initiate_str +
|
||||
!!ussd_respond_str +
|
||||
@@ -261,6 +267,32 @@ register_ready (MMModem3gpp *modem_3gpp,
|
||||
mmcli_async_operation_done ();
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_settings_process_reply (gboolean result,
|
||||
const GError *error)
|
||||
{
|
||||
if (!result) {
|
||||
g_printerr ("error: couldn't set initial EPS bearer properties: '%s'\n",
|
||||
error ? error->message : "unknown error");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_print ("Successfully set initial EPS bearer properties\n");
|
||||
}
|
||||
|
||||
static void
|
||||
set_initial_eps_bearer_settings_ready (MMModem3gpp *modem,
|
||||
GAsyncResult *res)
|
||||
{
|
||||
gboolean result;
|
||||
GError *error = NULL;
|
||||
|
||||
result = mm_modem_3gpp_set_initial_eps_bearer_settings_finish (modem, res, &error);
|
||||
set_initial_eps_bearer_settings_process_reply (result, error);
|
||||
|
||||
mmcli_async_operation_done ();
|
||||
}
|
||||
|
||||
static void
|
||||
set_eps_ue_mode_operation_process_reply (gboolean result,
|
||||
const GError *error)
|
||||
@@ -452,6 +484,28 @@ get_modem_ready (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Request to set initial EPS bearer properties? */
|
||||
if (set_initial_eps_bearer_settings_str) {
|
||||
GError *error = NULL;
|
||||
MMBearerProperties *config;
|
||||
|
||||
config = mm_bearer_properties_new_from_string (set_initial_eps_bearer_settings_str, &error);
|
||||
if (!config) {
|
||||
g_printerr ("Error parsing properties string: '%s'\n", error->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_debug ("Asynchronously setting initial EPS bearer properties...");
|
||||
mm_modem_3gpp_set_initial_eps_bearer_settings (ctx->modem_3gpp,
|
||||
config,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)set_initial_eps_bearer_settings_ready,
|
||||
NULL);
|
||||
g_object_unref (config);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/* Request to initiate USSD session? */
|
||||
if (ussd_initiate_str) {
|
||||
ensure_modem_3gpp_ussd ();
|
||||
@@ -568,6 +622,28 @@ mmcli_modem_3gpp_run_synchronous (GDBusConnection *connection)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Request to set initial EPS bearer properties? */
|
||||
if (set_initial_eps_bearer_settings_str) {
|
||||
GError *error = NULL;
|
||||
gboolean result;
|
||||
MMBearerProperties *config;
|
||||
|
||||
config = mm_bearer_properties_new_from_string (set_initial_eps_bearer_settings_str, &error);
|
||||
if (!config) {
|
||||
g_printerr ("Error parsing properties string: '%s'\n", error->message);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_debug ("Synchronously setting initial EPS bearer properties...");
|
||||
result = mm_modem_3gpp_set_initial_eps_bearer_settings_sync (ctx->modem_3gpp,
|
||||
config,
|
||||
NULL,
|
||||
&error);
|
||||
set_initial_eps_bearer_settings_process_reply (result, error);
|
||||
g_object_unref (config);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Request to show USSD status? */
|
||||
if (ussd_status_flag) {
|
||||
ensure_modem_3gpp_ussd ();
|
||||
|
||||
Reference in New Issue
Block a user