broadband-modem-qmi,bearer-qmi: avoid depending on the client version
The QMI client version is an information provided by the QMI protocol only when QMUX or MBIM backends are used, it won't be available when e.g. QRTR is used. The logic in ModemManager should not rely on this information.
This commit is contained in:
@@ -1372,8 +1372,7 @@ connect_context_step (GTask *task)
|
|||||||
|
|
||||||
case CONNECT_STEP_IP_FAMILY_IPV4:
|
case CONNECT_STEP_IP_FAMILY_IPV4:
|
||||||
/* If client is new enough, select IP family */
|
/* If client is new enough, select IP family */
|
||||||
if (!ctx->no_ip_family_preference &&
|
if (!ctx->no_ip_family_preference) {
|
||||||
qmi_client_check_version (QMI_CLIENT (ctx->client_ipv4), 1, 9)) {
|
|
||||||
QmiMessageWdsSetIpFamilyInput *input;
|
QmiMessageWdsSetIpFamilyInput *input;
|
||||||
|
|
||||||
mm_obj_dbg (self, "setting default IP family to: IPv4");
|
mm_obj_dbg (self, "setting default IP family to: IPv4");
|
||||||
@@ -1467,31 +1466,23 @@ connect_context_step (GTask *task)
|
|||||||
ctx->step++;
|
ctx->step++;
|
||||||
} /* fall through */
|
} /* fall through */
|
||||||
|
|
||||||
case CONNECT_STEP_IP_FAMILY_IPV6:
|
case CONNECT_STEP_IP_FAMILY_IPV6: {
|
||||||
|
QmiMessageWdsSetIpFamilyInput *input;
|
||||||
|
|
||||||
g_assert (ctx->no_ip_family_preference == FALSE);
|
g_assert (ctx->no_ip_family_preference == FALSE);
|
||||||
|
|
||||||
/* If client is new enough, select IP family */
|
mm_obj_dbg (self, "setting default IP family to: IPv6");
|
||||||
if (qmi_client_check_version (QMI_CLIENT (ctx->client_ipv6), 1, 9)) {
|
input = qmi_message_wds_set_ip_family_input_new ();
|
||||||
QmiMessageWdsSetIpFamilyInput *input;
|
qmi_message_wds_set_ip_family_input_set_preference (input, QMI_WDS_IP_FAMILY_IPV6, NULL);
|
||||||
|
qmi_client_wds_set_ip_family (ctx->client_ipv6,
|
||||||
mm_obj_dbg (self, "setting default IP family to: IPv6");
|
input,
|
||||||
input = qmi_message_wds_set_ip_family_input_new ();
|
10,
|
||||||
qmi_message_wds_set_ip_family_input_set_preference (input, QMI_WDS_IP_FAMILY_IPV6, NULL);
|
g_task_get_cancellable (task),
|
||||||
qmi_client_wds_set_ip_family (ctx->client_ipv6,
|
(GAsyncReadyCallback)set_ip_family_ready,
|
||||||
input,
|
task);
|
||||||
10,
|
qmi_message_wds_set_ip_family_input_unref (input);
|
||||||
g_task_get_cancellable (task),
|
return;
|
||||||
(GAsyncReadyCallback)set_ip_family_ready,
|
}
|
||||||
task);
|
|
||||||
qmi_message_wds_set_ip_family_input_unref (input);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->default_ip_family_set = FALSE;
|
|
||||||
|
|
||||||
ctx->step++;
|
|
||||||
/* fall through */
|
|
||||||
|
|
||||||
case CONNECT_STEP_ENABLE_INDICATIONS_IPV6:
|
case CONNECT_STEP_ENABLE_INDICATIONS_IPV6:
|
||||||
common_setup_cleanup_packet_service_status_unsolicited_events (ctx->self,
|
common_setup_cleanup_packet_service_status_unsolicited_events (ctx->self,
|
||||||
|
@@ -1715,24 +1715,20 @@ load_signal_quality (MMIfaceModem *self,
|
|||||||
mm_obj_dbg (self, "loading signal quality...");
|
mm_obj_dbg (self, "loading signal quality...");
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
/* Signal info introduced in NAS 1.8 */
|
qmi_client_nas_get_signal_info (QMI_CLIENT_NAS (client),
|
||||||
if (qmi_client_check_version (client, 1, 8)) {
|
NULL,
|
||||||
qmi_client_nas_get_signal_info (QMI_CLIENT_NAS (client),
|
10,
|
||||||
NULL,
|
NULL,
|
||||||
10,
|
(GAsyncReadyCallback)get_signal_info_ready,
|
||||||
NULL,
|
task);
|
||||||
(GAsyncReadyCallback)get_signal_info_ready,
|
#else
|
||||||
task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
qmi_client_nas_get_signal_strength (QMI_CLIENT_NAS (client),
|
qmi_client_nas_get_signal_strength (QMI_CLIENT_NAS (client),
|
||||||
NULL,
|
NULL,
|
||||||
10,
|
10,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)get_signal_strength_ready,
|
(GAsyncReadyCallback)get_signal_strength_ready,
|
||||||
task);
|
task);
|
||||||
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -3373,24 +3369,20 @@ modem_3gpp_run_registration_checks (MMIfaceModem3gpp *self,
|
|||||||
task = g_task_new (self, NULL, callback, user_data);
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
/* System Info was added in NAS 1.8 */
|
qmi_client_nas_get_system_info (QMI_CLIENT_NAS (client),
|
||||||
if (qmi_client_check_version (client, 1, 8)) {
|
NULL,
|
||||||
qmi_client_nas_get_system_info (QMI_CLIENT_NAS (client),
|
10,
|
||||||
NULL,
|
NULL,
|
||||||
10,
|
(GAsyncReadyCallback)get_system_info_ready,
|
||||||
NULL,
|
task);
|
||||||
(GAsyncReadyCallback)get_system_info_ready,
|
#else
|
||||||
task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
qmi_client_nas_get_serving_system (QMI_CLIENT_NAS (client),
|
qmi_client_nas_get_serving_system (QMI_CLIENT_NAS (client),
|
||||||
NULL,
|
NULL,
|
||||||
10,
|
10,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)get_serving_system_3gpp_ready,
|
(GAsyncReadyCallback)get_serving_system_3gpp_ready,
|
||||||
task);
|
task);
|
||||||
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -3429,9 +3421,9 @@ unsolicited_registration_events_task_new (MMBroadbandModemQmi *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
modem_3gpp_enable_disable_unsolicited_registration_events_finish (MMIfaceModem3gpp *self,
|
modem_3gpp_enable_disable_unsolicited_registration_events_finish (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
return g_task_propagate_boolean (G_TASK (res), error);
|
||||||
}
|
}
|
||||||
@@ -3439,28 +3431,28 @@ modem_3gpp_enable_disable_unsolicited_registration_events_finish (MMIfaceModem3g
|
|||||||
static void
|
static void
|
||||||
ri_serving_system_or_system_info_ready (QmiClientNas *client,
|
ri_serving_system_or_system_info_ready (QmiClientNas *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
MMBroadbandModemQmi *self;
|
MMBroadbandModemQmi *self;
|
||||||
UnsolicitedRegistrationEventsContext *ctx;
|
UnsolicitedRegistrationEventsContext *ctx;
|
||||||
QmiMessageNasRegisterIndicationsOutput *output = NULL;
|
g_autoptr(QmiMessageNasRegisterIndicationsOutput) output = NULL;
|
||||||
GError *error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
self = g_task_get_source_object (task);
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
output = qmi_client_nas_register_indications_finish (client, res, &error);
|
output = qmi_client_nas_register_indications_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output || !qmi_message_nas_register_indications_output_get_result (output, &error)) {
|
||||||
mm_obj_dbg (self, "QMI operation failed: '%s'", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
} else if (!qmi_message_nas_register_indications_output_get_result (output, &error)) {
|
|
||||||
mm_obj_dbg (self, "couldn't register indications: '%s'", error->message);
|
mm_obj_dbg (self, "couldn't register indications: '%s'", error->message);
|
||||||
g_error_free (error);
|
if (ctx->enable) {
|
||||||
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
|
mm_obj_dbg (self, "assuming system info indications are always enabled");
|
||||||
|
#else
|
||||||
|
mm_obj_dbg (self, "assuming serving system indications are always enabled");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output)
|
|
||||||
qmi_message_nas_register_indications_output_unref (output);
|
|
||||||
|
|
||||||
/* Just ignore errors for now */
|
/* Just ignore errors for now */
|
||||||
self->priv->unsolicited_registration_events_enabled = ctx->enable;
|
self->priv->unsolicited_registration_events_enabled = ctx->enable;
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
@@ -3470,8 +3462,8 @@ ri_serving_system_or_system_info_ready (QmiClientNas *client,
|
|||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_registration_events_serving_system (GTask *task)
|
common_enable_disable_unsolicited_registration_events_serving_system (GTask *task)
|
||||||
{
|
{
|
||||||
UnsolicitedRegistrationEventsContext *ctx;
|
UnsolicitedRegistrationEventsContext *ctx;
|
||||||
QmiMessageNasRegisterIndicationsInput *input;
|
g_autoptr(QmiMessageNasRegisterIndicationsInput) input = NULL;
|
||||||
|
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
input = qmi_message_nas_register_indications_input_new ();
|
input = qmi_message_nas_register_indications_input_new ();
|
||||||
@@ -3483,15 +3475,14 @@ common_enable_disable_unsolicited_registration_events_serving_system (GTask *tas
|
|||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)ri_serving_system_or_system_info_ready,
|
(GAsyncReadyCallback)ri_serving_system_or_system_info_ready,
|
||||||
task);
|
task);
|
||||||
qmi_message_nas_register_indications_input_unref (input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_registration_events_system_info (GTask *task)
|
common_enable_disable_unsolicited_registration_events_system_info (GTask *task)
|
||||||
{
|
{
|
||||||
UnsolicitedRegistrationEventsContext *ctx;
|
UnsolicitedRegistrationEventsContext *ctx;
|
||||||
QmiMessageNasRegisterIndicationsInput *input;
|
g_autoptr(QmiMessageNasRegisterIndicationsInput) input = NULL;
|
||||||
|
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
input = qmi_message_nas_register_indications_input_new ();
|
input = qmi_message_nas_register_indications_input_new ();
|
||||||
@@ -3503,20 +3494,18 @@ common_enable_disable_unsolicited_registration_events_system_info (GTask *task)
|
|||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)ri_serving_system_or_system_info_ready,
|
(GAsyncReadyCallback)ri_serving_system_or_system_info_ready,
|
||||||
task);
|
task);
|
||||||
qmi_message_nas_register_indications_input_unref (input);
|
|
||||||
}
|
}
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
modem_3gpp_disable_unsolicited_registration_events (MMIfaceModem3gpp *_self,
|
modem_3gpp_disable_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
||||||
gboolean cs_supported,
|
gboolean cs_supported,
|
||||||
gboolean ps_supported,
|
gboolean ps_supported,
|
||||||
gboolean eps_supported,
|
gboolean eps_supported,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
|
GTask *task;
|
||||||
GTask *task;
|
|
||||||
QmiClient *client = NULL;
|
QmiClient *client = NULL;
|
||||||
|
|
||||||
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
||||||
@@ -3524,46 +3513,28 @@ modem_3gpp_disable_unsolicited_registration_events (MMIfaceModem3gpp *_self,
|
|||||||
callback, user_data))
|
callback, user_data))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
task = unsolicited_registration_events_task_new (self,
|
task = unsolicited_registration_events_task_new (MM_BROADBAND_MODEM_QMI (self),
|
||||||
client,
|
client,
|
||||||
FALSE,
|
FALSE,
|
||||||
callback,
|
callback,
|
||||||
user_data);
|
user_data);
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
/* System Info was added in NAS 1.8 */
|
common_enable_disable_unsolicited_registration_events_system_info (task);
|
||||||
if (qmi_client_check_version (client, 1, 8)) {
|
#else
|
||||||
common_enable_disable_unsolicited_registration_events_system_info (task);
|
common_enable_disable_unsolicited_registration_events_serving_system (task);
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
|
|
||||||
/* Ability to explicitly enable/disable serving system indications was
|
|
||||||
* added in NAS 1.2 */
|
|
||||||
if (qmi_client_check_version (client, 1, 2)) {
|
|
||||||
common_enable_disable_unsolicited_registration_events_serving_system (task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Devices with NAS < 1.2 will just always issue serving system indications */
|
|
||||||
self->priv->unsolicited_registration_events_enabled = FALSE;
|
|
||||||
g_task_return_new_error (task,
|
|
||||||
MM_CORE_ERROR,
|
|
||||||
MM_CORE_ERROR_FAILED,
|
|
||||||
"Device doesn't allow disabling registration events");
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
modem_3gpp_enable_unsolicited_registration_events (MMIfaceModem3gpp *_self,
|
modem_3gpp_enable_unsolicited_registration_events (MMIfaceModem3gpp *self,
|
||||||
gboolean cs_supported,
|
gboolean cs_supported,
|
||||||
gboolean ps_supported,
|
gboolean ps_supported,
|
||||||
gboolean eps_supported,
|
gboolean eps_supported,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
|
GTask *task;
|
||||||
GTask *task;
|
|
||||||
QmiClient *client = NULL;
|
QmiClient *client = NULL;
|
||||||
|
|
||||||
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
||||||
@@ -3571,24 +3542,17 @@ modem_3gpp_enable_unsolicited_registration_events (MMIfaceModem3gpp *_self,
|
|||||||
callback, user_data))
|
callback, user_data))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
task = unsolicited_registration_events_task_new (self,
|
task = unsolicited_registration_events_task_new (MM_BROADBAND_MODEM_QMI (self),
|
||||||
client,
|
client,
|
||||||
TRUE,
|
TRUE,
|
||||||
callback,
|
callback,
|
||||||
user_data);
|
user_data);
|
||||||
|
|
||||||
/* Ability to explicitly enable/disable serving system indications was
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
* added in NAS 1.2 */
|
common_enable_disable_unsolicited_registration_events_system_info (task);
|
||||||
if (qmi_client_check_version (client, 1, 2)) {
|
#else
|
||||||
common_enable_disable_unsolicited_registration_events_serving_system (task);
|
common_enable_disable_unsolicited_registration_events_serving_system (task);
|
||||||
return;
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
}
|
|
||||||
|
|
||||||
/* Devices with NAS < 1.2 will just always issue serving system indications */
|
|
||||||
mm_obj_dbg (self, "assuming serving system indications are always enabled");
|
|
||||||
self->priv->unsolicited_registration_events_enabled = TRUE;
|
|
||||||
g_task_return_boolean (task, TRUE);
|
|
||||||
g_object_unref (task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -4594,38 +4558,34 @@ common_setup_cleanup_unsolicited_registration_events (MMBroadbandModemQmi *self,
|
|||||||
self->priv->unsolicited_registration_events_setup = enable;
|
self->priv->unsolicited_registration_events_setup = enable;
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
/* Signal info introduced in NAS 1.8 */
|
/* Connect/Disconnect "System Info" indications */
|
||||||
if (qmi_client_check_version (client, 1, 8)) {
|
if (enable) {
|
||||||
/* Connect/Disconnect "System Info" indications */
|
g_assert (self->priv->system_info_indication_id == 0);
|
||||||
if (enable) {
|
self->priv->system_info_indication_id =
|
||||||
g_assert (self->priv->system_info_indication_id == 0);
|
g_signal_connect (client,
|
||||||
self->priv->system_info_indication_id =
|
"system-info",
|
||||||
g_signal_connect (client,
|
G_CALLBACK (system_info_indication_cb),
|
||||||
"system-info",
|
self);
|
||||||
G_CALLBACK (system_info_indication_cb),
|
} else {
|
||||||
self);
|
g_assert (self->priv->system_info_indication_id != 0);
|
||||||
} else {
|
g_signal_handler_disconnect (client, self->priv->system_info_indication_id);
|
||||||
g_assert (self->priv->system_info_indication_id != 0);
|
self->priv->system_info_indication_id = 0;
|
||||||
g_signal_handler_disconnect (client, self->priv->system_info_indication_id);
|
|
||||||
self->priv->system_info_indication_id = 0;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
{
|
|
||||||
/* Connect/Disconnect "Serving System" indications */
|
|
||||||
if (enable) {
|
|
||||||
g_assert (self->priv->serving_system_indication_id == 0);
|
|
||||||
self->priv->serving_system_indication_id =
|
|
||||||
g_signal_connect (client,
|
|
||||||
"serving-system",
|
|
||||||
G_CALLBACK (serving_system_indication_cb),
|
|
||||||
self);
|
|
||||||
} else {
|
|
||||||
g_assert (self->priv->serving_system_indication_id != 0);
|
|
||||||
g_signal_handler_disconnect (client, self->priv->serving_system_indication_id);
|
|
||||||
self->priv->serving_system_indication_id = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
/* Connect/Disconnect "Serving System" indications */
|
||||||
|
if (enable) {
|
||||||
|
g_assert (self->priv->serving_system_indication_id == 0);
|
||||||
|
self->priv->serving_system_indication_id =
|
||||||
|
g_signal_connect (client,
|
||||||
|
"serving-system",
|
||||||
|
G_CALLBACK (serving_system_indication_cb),
|
||||||
|
self);
|
||||||
|
} else {
|
||||||
|
g_assert (self->priv->serving_system_indication_id != 0);
|
||||||
|
g_signal_handler_disconnect (client, self->priv->serving_system_indication_id);
|
||||||
|
self->priv->serving_system_indication_id = 0;
|
||||||
|
}
|
||||||
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
|
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
@@ -4727,19 +4687,11 @@ modem_cdma_load_esn (MMIfaceModemCdma *_self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Enabling/disabling unsolicited events (3GPP and CDMA interface)
|
/* Enabling/disabling unsolicited events (3GPP and CDMA interface) */
|
||||||
*
|
|
||||||
* If NAS >= 1.8:
|
|
||||||
* - Config Signal Info (only when enabling)
|
|
||||||
* - Register Indications with Signal Info
|
|
||||||
*
|
|
||||||
* If NAS < 1.8:
|
|
||||||
* - Set Event Report with Signal Strength
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
QmiClientNas *client;
|
QmiClientNas *client;
|
||||||
gboolean enable;
|
gboolean enable;
|
||||||
} EnableUnsolicitedEventsContext;
|
} EnableUnsolicitedEventsContext;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -4750,9 +4702,9 @@ enable_unsolicited_events_context_free (EnableUnsolicitedEventsContext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
common_enable_disable_unsolicited_events_finish (MMBroadbandModemQmi *self,
|
common_enable_disable_unsolicited_events_finish (MMBroadbandModemQmi *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return g_task_propagate_boolean (G_TASK (res), error);
|
return g_task_propagate_boolean (G_TASK (res), error);
|
||||||
}
|
}
|
||||||
@@ -4760,27 +4712,19 @@ common_enable_disable_unsolicited_events_finish (MMBroadbandModemQmi *self,
|
|||||||
static void
|
static void
|
||||||
ser_signal_strength_ready (QmiClientNas *client,
|
ser_signal_strength_ready (QmiClientNas *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
MMBroadbandModemQmi *self;
|
MMBroadbandModemQmi *self;
|
||||||
EnableUnsolicitedEventsContext *ctx;
|
EnableUnsolicitedEventsContext *ctx;
|
||||||
QmiMessageNasSetEventReportOutput *output = NULL;
|
g_autoptr(QmiMessageNasSetEventReportOutput) output = NULL;
|
||||||
GError *error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
self = g_task_get_source_object (task);
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
output = qmi_client_nas_set_event_report_finish (client, res, &error);
|
output = qmi_client_nas_set_event_report_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output || !qmi_message_nas_set_event_report_output_get_result (output, &error))
|
||||||
mm_obj_dbg (self, "QMI operation failed: '%s'", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
} else if (!qmi_message_nas_set_event_report_output_get_result (output, &error)) {
|
|
||||||
mm_obj_dbg (self, "couldn't set event report: '%s'", error->message);
|
mm_obj_dbg (self, "couldn't set event report: '%s'", error->message);
|
||||||
g_error_free (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output)
|
|
||||||
qmi_message_nas_set_event_report_output_unref (output);
|
|
||||||
|
|
||||||
/* Just ignore errors for now */
|
/* Just ignore errors for now */
|
||||||
self->priv->unsolicited_events_enabled = ctx->enable;
|
self->priv->unsolicited_events_enabled = ctx->enable;
|
||||||
@@ -4791,30 +4735,28 @@ ser_signal_strength_ready (QmiClientNas *client,
|
|||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_events_signal_strength (GTask *task)
|
common_enable_disable_unsolicited_events_signal_strength (GTask *task)
|
||||||
{
|
{
|
||||||
EnableUnsolicitedEventsContext *ctx;
|
EnableUnsolicitedEventsContext *ctx;
|
||||||
|
g_autoptr(QmiMessageNasSetEventReportInput) input = NULL;
|
||||||
/* The device doesn't really like to have many threshold values, so don't
|
g_autoptr(GArray) thresholds = NULL;
|
||||||
* grow this array without checking first */
|
|
||||||
static const gint8 thresholds_data[] = { -80, -40, 0, 40, 80 };
|
|
||||||
QmiMessageNasSetEventReportInput *input;
|
|
||||||
GArray *thresholds;
|
|
||||||
|
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
input = qmi_message_nas_set_event_report_input_new ();
|
|
||||||
|
|
||||||
/* Prepare thresholds, separated 20 each */
|
|
||||||
thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data));
|
|
||||||
|
|
||||||
/* Only set thresholds during enable */
|
/* Only set thresholds during enable */
|
||||||
if (ctx->enable)
|
if (ctx->enable) {
|
||||||
g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data));
|
/* The device doesn't really like to have many threshold values, so don't
|
||||||
|
* grow this array without checking first */
|
||||||
|
static const gint8 thresholds_data[] = { -80, -40, 0, 40, 80 };
|
||||||
|
|
||||||
|
thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data));
|
||||||
|
g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data));
|
||||||
|
}
|
||||||
|
|
||||||
|
input = qmi_message_nas_set_event_report_input_new ();
|
||||||
qmi_message_nas_set_event_report_input_set_signal_strength_indicator (
|
qmi_message_nas_set_event_report_input_set_signal_strength_indicator (
|
||||||
input,
|
input,
|
||||||
ctx->enable,
|
ctx->enable,
|
||||||
thresholds,
|
thresholds,
|
||||||
NULL);
|
NULL);
|
||||||
g_array_unref (thresholds);
|
|
||||||
qmi_client_nas_set_event_report (
|
qmi_client_nas_set_event_report (
|
||||||
ctx->client,
|
ctx->client,
|
||||||
input,
|
input,
|
||||||
@@ -4822,7 +4764,6 @@ common_enable_disable_unsolicited_events_signal_strength (GTask *task)
|
|||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)ser_signal_strength_ready,
|
(GAsyncReadyCallback)ser_signal_strength_ready,
|
||||||
task);
|
task);
|
||||||
qmi_message_nas_set_event_report_input_unref (input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
@@ -4830,27 +4771,19 @@ common_enable_disable_unsolicited_events_signal_strength (GTask *task)
|
|||||||
static void
|
static void
|
||||||
ri_signal_info_ready (QmiClientNas *client,
|
ri_signal_info_ready (QmiClientNas *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
MMBroadbandModemQmi *self;
|
MMBroadbandModemQmi *self;
|
||||||
EnableUnsolicitedEventsContext *ctx;
|
EnableUnsolicitedEventsContext *ctx;
|
||||||
QmiMessageNasRegisterIndicationsOutput *output = NULL;
|
g_autoptr(QmiMessageNasRegisterIndicationsOutput) output = NULL;
|
||||||
GError *error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
self = g_task_get_source_object (task);
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
output = qmi_client_nas_register_indications_finish (client, res, &error);
|
output = qmi_client_nas_register_indications_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output || !qmi_message_nas_register_indications_output_get_result (output, &error))
|
||||||
mm_obj_dbg (self, "QMI operation failed: '%s'", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
} else if (!qmi_message_nas_register_indications_output_get_result (output, &error)) {
|
|
||||||
mm_obj_dbg (self, "couldn't register indications: '%s'", error->message);
|
mm_obj_dbg (self, "couldn't register indications: '%s'", error->message);
|
||||||
g_error_free (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output)
|
|
||||||
qmi_message_nas_register_indications_output_unref (output);
|
|
||||||
|
|
||||||
/* Just ignore errors for now */
|
/* Just ignore errors for now */
|
||||||
self->priv->unsolicited_events_enabled = ctx->enable;
|
self->priv->unsolicited_events_enabled = ctx->enable;
|
||||||
@@ -4861,8 +4794,8 @@ ri_signal_info_ready (QmiClientNas *client,
|
|||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_events_signal_info (GTask *task)
|
common_enable_disable_unsolicited_events_signal_info (GTask *task)
|
||||||
{
|
{
|
||||||
EnableUnsolicitedEventsContext *ctx;
|
EnableUnsolicitedEventsContext *ctx;
|
||||||
QmiMessageNasRegisterIndicationsInput *input;
|
g_autoptr(QmiMessageNasRegisterIndicationsInput) input = NULL;
|
||||||
|
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
input = qmi_message_nas_register_indications_input_new ();
|
input = qmi_message_nas_register_indications_input_new ();
|
||||||
@@ -4874,28 +4807,19 @@ common_enable_disable_unsolicited_events_signal_info (GTask *task)
|
|||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)ri_signal_info_ready,
|
(GAsyncReadyCallback)ri_signal_info_ready,
|
||||||
task);
|
task);
|
||||||
qmi_message_nas_register_indications_input_unref (input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
config_signal_info_ready (QmiClientNas *client,
|
config_signal_info_ready (QmiClientNas *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
QmiMessageNasConfigSignalInfoOutput *output = NULL;
|
g_autoptr(QmiMessageNasConfigSignalInfoOutput) output = NULL;
|
||||||
GError *error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
output = qmi_client_nas_config_signal_info_finish (client, res, &error);
|
output = qmi_client_nas_config_signal_info_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output || !qmi_message_nas_config_signal_info_output_get_result (output, &error))
|
||||||
mm_obj_dbg (self, "QMI operation failed: '%s'", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
} else if (!qmi_message_nas_config_signal_info_output_get_result (output, &error)) {
|
|
||||||
mm_obj_dbg (self, "couldn't config signal info: '%s'", error->message);
|
mm_obj_dbg (self, "couldn't config signal info: '%s'", error->message);
|
||||||
g_error_free (error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (output)
|
|
||||||
qmi_message_nas_config_signal_info_output_unref (output);
|
|
||||||
|
|
||||||
/* Keep on */
|
/* Keep on */
|
||||||
common_enable_disable_unsolicited_events_signal_info (task);
|
common_enable_disable_unsolicited_events_signal_info (task);
|
||||||
@@ -4904,12 +4828,8 @@ config_signal_info_ready (QmiClientNas *client,
|
|||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_events_signal_info_config (GTask *task)
|
common_enable_disable_unsolicited_events_signal_info_config (GTask *task)
|
||||||
{
|
{
|
||||||
EnableUnsolicitedEventsContext *ctx;
|
EnableUnsolicitedEventsContext *ctx;
|
||||||
/* RSSI values go between -105 and -60 for 3GPP technologies,
|
g_autoptr(QmiMessageNasConfigSignalInfoInput) input = NULL;
|
||||||
* and from -105 to -90 in 3GPP2 technologies (approx). */
|
|
||||||
static const gint8 thresholds_data[] = { -100, -97, -95, -92, -90, -85, -80, -75, -70, -65 };
|
|
||||||
QmiMessageNasConfigSignalInfoInput *input;
|
|
||||||
GArray *thresholds;
|
|
||||||
|
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
@@ -4922,14 +4842,20 @@ common_enable_disable_unsolicited_events_signal_info_config (GTask *task)
|
|||||||
input = qmi_message_nas_config_signal_info_input_new ();
|
input = qmi_message_nas_config_signal_info_input_new ();
|
||||||
|
|
||||||
/* Prepare thresholds, separated 20 each */
|
/* Prepare thresholds, separated 20 each */
|
||||||
thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data));
|
{
|
||||||
g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data));
|
/* RSSI values go between -105 and -60 for 3GPP technologies,
|
||||||
|
* and from -105 to -90 in 3GPP2 technologies (approx). */
|
||||||
|
static const gint8 thresholds_data[] = { -100, -97, -95, -92, -90, -85, -80, -75, -70, -65 };
|
||||||
|
g_autoptr(GArray) thresholds = NULL;
|
||||||
|
|
||||||
|
thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data));
|
||||||
|
g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data));
|
||||||
|
qmi_message_nas_config_signal_info_input_set_rssi_threshold (
|
||||||
|
input,
|
||||||
|
thresholds,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
qmi_message_nas_config_signal_info_input_set_rssi_threshold (
|
|
||||||
input,
|
|
||||||
thresholds,
|
|
||||||
NULL);
|
|
||||||
g_array_unref (thresholds);
|
|
||||||
qmi_client_nas_config_signal_info (
|
qmi_client_nas_config_signal_info (
|
||||||
ctx->client,
|
ctx->client,
|
||||||
input,
|
input,
|
||||||
@@ -4937,20 +4863,19 @@ common_enable_disable_unsolicited_events_signal_info_config (GTask *task)
|
|||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)config_signal_info_ready,
|
(GAsyncReadyCallback)config_signal_info_ready,
|
||||||
task);
|
task);
|
||||||
qmi_message_nas_config_signal_info_input_unref (input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
common_enable_disable_unsolicited_events (MMBroadbandModemQmi *self,
|
common_enable_disable_unsolicited_events (MMBroadbandModemQmi *self,
|
||||||
gboolean enable,
|
gboolean enable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
EnableUnsolicitedEventsContext *ctx;
|
EnableUnsolicitedEventsContext *ctx;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
QmiClient *client = NULL;
|
QmiClient *client = NULL;
|
||||||
|
|
||||||
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
if (!mm_shared_qmi_ensure_client (MM_SHARED_QMI (self),
|
||||||
QMI_SERVICE_NAS, &client,
|
QMI_SERVICE_NAS, &client,
|
||||||
@@ -4973,14 +4898,10 @@ common_enable_disable_unsolicited_events (MMBroadbandModemQmi *self,
|
|||||||
g_task_set_task_data (task, ctx, (GDestroyNotify)enable_unsolicited_events_context_free);
|
g_task_set_task_data (task, ctx, (GDestroyNotify)enable_unsolicited_events_context_free);
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
/* Signal info introduced in NAS 1.8 */
|
common_enable_disable_unsolicited_events_signal_info_config (task);
|
||||||
if (qmi_client_check_version (client, 1, 8)) {
|
#else
|
||||||
common_enable_disable_unsolicited_events_signal_info_config (task);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
|
||||||
|
|
||||||
common_enable_disable_unsolicited_events_signal_strength (task);
|
common_enable_disable_unsolicited_events_signal_strength (task);
|
||||||
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -5177,21 +5098,17 @@ common_setup_cleanup_unsolicited_events (MMBroadbandModemQmi *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined WITH_NEWEST_QMI_COMMANDS
|
#if defined WITH_NEWEST_QMI_COMMANDS
|
||||||
/* Connect/Disconnect "Signal Info" indications.
|
if (enable) {
|
||||||
* Signal info introduced in NAS 1.8 */
|
g_assert (self->priv->signal_info_indication_id == 0);
|
||||||
if (qmi_client_check_version (client, 1, 8)) {
|
self->priv->signal_info_indication_id =
|
||||||
if (enable) {
|
g_signal_connect (client,
|
||||||
g_assert (self->priv->signal_info_indication_id == 0);
|
"signal-info",
|
||||||
self->priv->signal_info_indication_id =
|
G_CALLBACK (signal_info_indication_cb),
|
||||||
g_signal_connect (client,
|
self);
|
||||||
"signal-info",
|
} else {
|
||||||
G_CALLBACK (signal_info_indication_cb),
|
g_assert (self->priv->signal_info_indication_id != 0);
|
||||||
self);
|
g_signal_handler_disconnect (client, self->priv->signal_info_indication_id);
|
||||||
} else {
|
self->priv->signal_info_indication_id = 0;
|
||||||
g_assert (self->priv->signal_info_indication_id != 0);
|
|
||||||
g_signal_handler_disconnect (client, self->priv->signal_info_indication_id);
|
|
||||||
self->priv->signal_info_indication_id = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
#endif /* WITH_NEWEST_QMI_COMMANDS */
|
||||||
|
|
||||||
@@ -8549,32 +8466,25 @@ typedef struct {
|
|||||||
} SignalLoadValuesResult;
|
} SignalLoadValuesResult;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
QmiClientNas *client;
|
QmiClientNas *client;
|
||||||
SignalLoadValuesStep step;
|
SignalLoadValuesStep step;
|
||||||
SignalLoadValuesResult *values_result;
|
SignalLoadValuesResult *values_result;
|
||||||
} SignalLoadValuesContext;
|
} SignalLoadValuesContext;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
signal_load_values_result_free (SignalLoadValuesResult *result)
|
signal_load_values_result_free (SignalLoadValuesResult *result)
|
||||||
{
|
{
|
||||||
if (result->cdma)
|
g_clear_object (&result->cdma);
|
||||||
g_object_unref (result->cdma);
|
g_clear_object (&result->evdo);
|
||||||
if (result->evdo)
|
g_clear_object (&result->gsm);
|
||||||
g_object_unref (result->evdo);
|
g_clear_object (&result->lte);
|
||||||
if (result->gsm)
|
|
||||||
g_object_unref (result->gsm);
|
|
||||||
if (result->umts)
|
|
||||||
g_object_unref (result->umts);
|
|
||||||
if (result->lte)
|
|
||||||
g_object_unref (result->lte);
|
|
||||||
g_slice_free (SignalLoadValuesResult, result);
|
g_slice_free (SignalLoadValuesResult, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
signal_load_values_context_free (SignalLoadValuesContext *ctx)
|
signal_load_values_context_free (SignalLoadValuesContext *ctx)
|
||||||
{
|
{
|
||||||
if (ctx->values_result)
|
g_clear_pointer (&ctx->values_result, (GDestroyNotify)signal_load_values_result_free);
|
||||||
signal_load_values_result_free (ctx->values_result);
|
|
||||||
g_slice_free (SignalLoadValuesContext, ctx);
|
g_slice_free (SignalLoadValuesContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8599,14 +8509,14 @@ get_db_from_sinr_level (MMBroadbandModemQmi *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
signal_load_values_finish (MMIfaceModemSignal *self,
|
signal_load_values_finish (MMIfaceModemSignal *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMSignal **cdma,
|
MMSignal **cdma,
|
||||||
MMSignal **evdo,
|
MMSignal **evdo,
|
||||||
MMSignal **gsm,
|
MMSignal **gsm,
|
||||||
MMSignal **umts,
|
MMSignal **umts,
|
||||||
MMSignal **lte,
|
MMSignal **lte,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
SignalLoadValuesResult *values_result;
|
SignalLoadValuesResult *values_result;
|
||||||
|
|
||||||
@@ -8628,28 +8538,26 @@ static void signal_load_values_context_step (GTask *task);
|
|||||||
static void
|
static void
|
||||||
signal_load_values_get_signal_strength_ready (QmiClientNas *client,
|
signal_load_values_get_signal_strength_ready (QmiClientNas *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
MMBroadbandModemQmi *self;
|
MMBroadbandModemQmi *self;
|
||||||
SignalLoadValuesContext *ctx;
|
SignalLoadValuesContext *ctx;
|
||||||
QmiMessageNasGetSignalStrengthOutput *output;
|
GArray *array;
|
||||||
GArray *array;
|
gint32 aux_int32;
|
||||||
gint32 aux_int32;
|
gint16 aux_int16;
|
||||||
gint16 aux_int16;
|
gint8 aux_int8;
|
||||||
gint8 aux_int8;
|
QmiNasRadioInterface radio_interface;
|
||||||
QmiNasRadioInterface radio_interface;
|
QmiNasEvdoSinrLevel sinr;
|
||||||
QmiNasEvdoSinrLevel sinr;
|
g_autoptr(QmiMessageNasGetSignalStrengthOutput) output = NULL;
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
self = g_task_get_source_object (task);
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
output = qmi_client_nas_get_signal_strength_finish (client, res, NULL);
|
output = qmi_client_nas_get_signal_strength_finish (client, res, NULL);
|
||||||
if (!output || !qmi_message_nas_get_signal_strength_output_get_result (output, NULL)) {
|
if (!output || !qmi_message_nas_get_signal_strength_output_get_result (output, NULL)) {
|
||||||
/* No hard errors, go on to next step */
|
/* No hard errors, go on to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
signal_load_values_context_step (task);
|
signal_load_values_context_step (task);
|
||||||
if (output)
|
|
||||||
qmi_message_nas_get_signal_strength_output_unref (output);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8775,8 +8683,6 @@ signal_load_values_get_signal_strength_ready (QmiClientNas *client,
|
|||||||
mm_signal_set_sinr (ctx->values_result->evdo, get_db_from_sinr_level (self, sinr));
|
mm_signal_set_sinr (ctx->values_result->evdo, get_db_from_sinr_level (self, sinr));
|
||||||
}
|
}
|
||||||
|
|
||||||
qmi_message_nas_get_signal_strength_output_unref (output);
|
|
||||||
|
|
||||||
/* Go on */
|
/* Go on */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
signal_load_values_context_step (task);
|
signal_load_values_context_step (task);
|
||||||
@@ -8785,29 +8691,27 @@ signal_load_values_get_signal_strength_ready (QmiClientNas *client,
|
|||||||
static void
|
static void
|
||||||
signal_load_values_get_signal_info_ready (QmiClientNas *client,
|
signal_load_values_get_signal_info_ready (QmiClientNas *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
MMBroadbandModemQmi *self;
|
MMBroadbandModemQmi *self;
|
||||||
SignalLoadValuesContext *ctx;
|
SignalLoadValuesContext *ctx;
|
||||||
QmiMessageNasGetSignalInfoOutput *output;
|
gint8 rssi;
|
||||||
gint8 rssi;
|
gint16 ecio;
|
||||||
gint16 ecio;
|
QmiNasEvdoSinrLevel sinr_level;
|
||||||
QmiNasEvdoSinrLevel sinr_level;
|
gint32 io;
|
||||||
gint32 io;
|
gint8 rsrq;
|
||||||
gint8 rsrq;
|
gint16 rsrp;
|
||||||
gint16 rsrp;
|
gint16 snr;
|
||||||
gint16 snr;
|
g_autoptr(QmiMessageNasGetSignalInfoOutput) output = NULL;
|
||||||
|
|
||||||
self = g_task_get_source_object (task);
|
self = g_task_get_source_object (task);
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
output = qmi_client_nas_get_signal_info_finish (client, res, NULL);
|
output = qmi_client_nas_get_signal_info_finish (client, res, NULL);
|
||||||
if (!output || !qmi_message_nas_get_signal_info_output_get_result (output, NULL)) {
|
if (!output || !qmi_message_nas_get_signal_info_output_get_result (output, NULL)) {
|
||||||
/* No hard errors, go on to next step */
|
/* No hard errors, go on to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
signal_load_values_context_step (task);
|
signal_load_values_context_step (task);
|
||||||
if (output)
|
|
||||||
qmi_message_nas_get_signal_info_output_unref (output);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8870,8 +8774,6 @@ signal_load_values_get_signal_info_ready (QmiClientNas *client,
|
|||||||
mm_signal_set_snr (ctx->values_result->lte, (0.1) * ((gdouble)snr));
|
mm_signal_set_snr (ctx->values_result->lte, (0.1) * ((gdouble)snr));
|
||||||
}
|
}
|
||||||
|
|
||||||
qmi_message_nas_get_signal_info_output_unref (output);
|
|
||||||
|
|
||||||
/* Keep on */
|
/* Keep on */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
signal_load_values_context_step (task);
|
signal_load_values_context_step (task);
|
||||||
@@ -8898,22 +8800,18 @@ signal_load_values_context_step (GTask *task)
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
|
|
||||||
case SIGNAL_LOAD_VALUES_STEP_SIGNAL_INFO:
|
case SIGNAL_LOAD_VALUES_STEP_SIGNAL_INFO:
|
||||||
if (qmi_client_check_version (QMI_CLIENT (ctx->client), 1, 8)) {
|
qmi_client_nas_get_signal_info (ctx->client,
|
||||||
qmi_client_nas_get_signal_info (ctx->client,
|
NULL,
|
||||||
NULL,
|
5,
|
||||||
5,
|
NULL,
|
||||||
NULL,
|
(GAsyncReadyCallback)signal_load_values_get_signal_info_ready,
|
||||||
(GAsyncReadyCallback)signal_load_values_get_signal_info_ready,
|
task);
|
||||||
task);
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
ctx->step++;
|
|
||||||
/* Fall through */
|
|
||||||
|
|
||||||
case SIGNAL_LOAD_VALUES_STEP_SIGNAL_STRENGTH:
|
case SIGNAL_LOAD_VALUES_STEP_SIGNAL_STRENGTH:
|
||||||
/* If already loaded with signal info, don't try signal strength */
|
/* If already loaded with signal info, don't try signal strength */
|
||||||
if (!VALUES_RESULT_LOADED (ctx)) {
|
if (!VALUES_RESULT_LOADED (ctx)) {
|
||||||
QmiMessageNasGetSignalStrengthInput *input;
|
g_autoptr(QmiMessageNasGetSignalStrengthInput) input = NULL;
|
||||||
|
|
||||||
input = qmi_message_nas_get_signal_strength_input_new ();
|
input = qmi_message_nas_get_signal_strength_input_new ();
|
||||||
qmi_message_nas_get_signal_strength_input_set_request_mask (
|
qmi_message_nas_get_signal_strength_input_set_request_mask (
|
||||||
@@ -8932,7 +8830,6 @@ signal_load_values_context_step (GTask *task)
|
|||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)signal_load_values_get_signal_strength_ready,
|
(GAsyncReadyCallback)signal_load_values_get_signal_strength_ready,
|
||||||
task);
|
task);
|
||||||
qmi_message_nas_get_signal_strength_input_unref (input);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
@@ -8940,22 +8837,15 @@ signal_load_values_context_step (GTask *task)
|
|||||||
|
|
||||||
case SIGNAL_LOAD_VALUES_STEP_SIGNAL_LAST:
|
case SIGNAL_LOAD_VALUES_STEP_SIGNAL_LAST:
|
||||||
/* If any result is set, succeed */
|
/* If any result is set, succeed */
|
||||||
if (VALUES_RESULT_LOADED (ctx)) {
|
if (VALUES_RESULT_LOADED (ctx))
|
||||||
SignalLoadValuesResult *values_result;
|
|
||||||
|
|
||||||
/* Steal results from context in order to return them */
|
|
||||||
values_result = ctx->values_result;
|
|
||||||
ctx->values_result = NULL;
|
|
||||||
|
|
||||||
g_task_return_pointer (task,
|
g_task_return_pointer (task,
|
||||||
values_result,
|
g_steal_pointer (&ctx->values_result),
|
||||||
(GDestroyNotify)signal_load_values_result_free);
|
(GDestroyNotify)signal_load_values_result_free);
|
||||||
} else {
|
else
|
||||||
g_task_return_new_error (task,
|
g_task_return_new_error (task,
|
||||||
MM_CORE_ERROR,
|
MM_CORE_ERROR,
|
||||||
MM_CORE_ERROR_FAILED,
|
MM_CORE_ERROR_FAILED,
|
||||||
"No way to load extended signal information");
|
"No way to load extended signal information");
|
||||||
}
|
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -8969,14 +8859,14 @@ signal_load_values_context_step (GTask *task)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
signal_load_values (MMIfaceModemSignal *self,
|
signal_load_values (MMIfaceModemSignal *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
SignalLoadValuesContext *ctx;
|
SignalLoadValuesContext *ctx;
|
||||||
GTask *task;
|
GTask *task;
|
||||||
QmiClient *client = NULL;
|
QmiClient *client = NULL;
|
||||||
|
|
||||||
mm_obj_dbg (self, "loading extended signal information...");
|
mm_obj_dbg (self, "loading extended signal information...");
|
||||||
|
|
||||||
@@ -8990,9 +8880,7 @@ signal_load_values (MMIfaceModemSignal *self,
|
|||||||
ctx->step = SIGNAL_LOAD_VALUES_STEP_SIGNAL_FIRST;
|
ctx->step = SIGNAL_LOAD_VALUES_STEP_SIGNAL_FIRST;
|
||||||
|
|
||||||
task = g_task_new (self, cancellable, callback, user_data);
|
task = g_task_new (self, cancellable, callback, user_data);
|
||||||
g_task_set_task_data (task,
|
g_task_set_task_data (task, ctx, (GDestroyNotify)signal_load_values_context_free);
|
||||||
ctx,
|
|
||||||
(GDestroyNotify)signal_load_values_context_free);
|
|
||||||
|
|
||||||
signal_load_values_context_step (task);
|
signal_load_values_context_step (task);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user