broadband-modem-qmi: port enable_location_gathering to use GTask
This commit is contained in:

committed by
Aleksander Morgado

parent
07d922e250
commit
d99398b055
@@ -9020,9 +9020,7 @@ location_event_report_indication_cb (QmiClientPds *client,
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MMBroadbandModemQmi *self;
|
|
||||||
QmiClientPds *client;
|
QmiClientPds *client;
|
||||||
GSimpleAsyncResult *result;
|
|
||||||
MMModemLocationSource source;
|
MMModemLocationSource source;
|
||||||
/* Default tracking session (for A-GPS enabling) */
|
/* Default tracking session (for A-GPS enabling) */
|
||||||
QmiPdsOperatingMode session_operation;
|
QmiPdsOperatingMode session_operation;
|
||||||
@@ -9032,13 +9030,10 @@ typedef struct {
|
|||||||
} EnableLocationGatheringContext;
|
} EnableLocationGatheringContext;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enable_location_gathering_context_complete_and_free (EnableLocationGatheringContext *ctx)
|
enable_location_gathering_context_free (EnableLocationGatheringContext *ctx)
|
||||||
{
|
{
|
||||||
g_simple_async_result_complete (ctx->result);
|
|
||||||
g_object_unref (ctx->result);
|
|
||||||
if (ctx->client)
|
if (ctx->client)
|
||||||
g_object_unref (ctx->client);
|
g_object_unref (ctx->client);
|
||||||
g_object_unref (ctx->self);
|
|
||||||
g_slice_free (EnableLocationGatheringContext, ctx);
|
g_slice_free (EnableLocationGatheringContext, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9047,55 +9042,61 @@ enable_location_gathering_finish (MMIfaceModemLocation *self,
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
return g_task_propagate_boolean (G_TASK (res), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ser_location_ready (QmiClientPds *client,
|
ser_location_ready (QmiClientPds *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
EnableLocationGatheringContext *ctx)
|
GTask *task)
|
||||||
{
|
{
|
||||||
|
MMBroadbandModemQmi *self;
|
||||||
|
EnableLocationGatheringContext *ctx;
|
||||||
QmiMessagePdsSetEventReportOutput *output = NULL;
|
QmiMessagePdsSetEventReportOutput *output = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
output = qmi_client_pds_set_event_report_finish (client, res, &error);
|
output = qmi_client_pds_set_event_report_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
g_prefix_error (&error, "QMI operation failed: ");
|
g_prefix_error (&error, "QMI operation failed: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qmi_message_pds_set_event_report_output_get_result (output, &error)) {
|
if (!qmi_message_pds_set_event_report_output_get_result (output, &error)) {
|
||||||
g_prefix_error (&error, "Couldn't set event report: ");
|
g_prefix_error (&error, "Couldn't set event report: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
qmi_message_pds_set_event_report_output_unref (output);
|
qmi_message_pds_set_event_report_output_unref (output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qmi_message_pds_set_event_report_output_unref (output);
|
qmi_message_pds_set_event_report_output_unref (output);
|
||||||
|
|
||||||
|
self = g_task_get_source_object (task);
|
||||||
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
mm_dbg ("Adding location event report indication handling");
|
mm_dbg ("Adding location event report indication handling");
|
||||||
g_assert (ctx->self->priv->location_event_report_indication_id == 0);
|
g_assert (self->priv->location_event_report_indication_id == 0);
|
||||||
ctx->self->priv->location_event_report_indication_id =
|
self->priv->location_event_report_indication_id =
|
||||||
g_signal_connect (client,
|
g_signal_connect (client,
|
||||||
"event-report",
|
"event-report",
|
||||||
G_CALLBACK (location_event_report_indication_cb),
|
G_CALLBACK (location_event_report_indication_cb),
|
||||||
ctx->self);
|
self);
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
mm_dbg ("GPS started");
|
mm_dbg ("GPS started");
|
||||||
ctx->self->priv->enabled_sources |= ctx->source;
|
self->priv->enabled_sources |= ctx->source;
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
auto_tracking_state_start_ready (QmiClientPds *client,
|
auto_tracking_state_start_ready (QmiClientPds *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
EnableLocationGatheringContext *ctx)
|
GTask *task)
|
||||||
{
|
{
|
||||||
|
EnableLocationGatheringContext *ctx;
|
||||||
QmiMessagePdsSetEventReportInput *input;
|
QmiMessagePdsSetEventReportInput *input;
|
||||||
QmiMessagePdsSetAutoTrackingStateOutput *output = NULL;
|
QmiMessagePdsSetAutoTrackingStateOutput *output = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@@ -9103,8 +9104,8 @@ auto_tracking_state_start_ready (QmiClientPds *client,
|
|||||||
output = qmi_client_pds_set_auto_tracking_state_finish (client, res, &error);
|
output = qmi_client_pds_set_auto_tracking_state_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
g_prefix_error (&error, "QMI operation failed: ");
|
g_prefix_error (&error, "QMI operation failed: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9113,8 +9114,8 @@ auto_tracking_state_start_ready (QmiClientPds *client,
|
|||||||
QMI_PROTOCOL_ERROR,
|
QMI_PROTOCOL_ERROR,
|
||||||
QMI_PROTOCOL_ERROR_NO_EFFECT)) {
|
QMI_PROTOCOL_ERROR_NO_EFFECT)) {
|
||||||
g_prefix_error (&error, "Couldn't set auto-tracking state: ");
|
g_prefix_error (&error, "Couldn't set auto-tracking state: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
qmi_message_pds_set_auto_tracking_state_output_unref (output);
|
qmi_message_pds_set_auto_tracking_state_output_unref (output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -9123,6 +9124,8 @@ auto_tracking_state_start_ready (QmiClientPds *client,
|
|||||||
|
|
||||||
qmi_message_pds_set_auto_tracking_state_output_unref (output);
|
qmi_message_pds_set_auto_tracking_state_output_unref (output);
|
||||||
|
|
||||||
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
/* Only gather standard NMEA traces */
|
/* Only gather standard NMEA traces */
|
||||||
input = qmi_message_pds_set_event_report_input_new ();
|
input = qmi_message_pds_set_event_report_input_new ();
|
||||||
qmi_message_pds_set_event_report_input_set_nmea_position_reporting (input, TRUE, NULL);
|
qmi_message_pds_set_event_report_input_set_nmea_position_reporting (input, TRUE, NULL);
|
||||||
@@ -9132,15 +9135,16 @@ auto_tracking_state_start_ready (QmiClientPds *client,
|
|||||||
5,
|
5,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback)ser_location_ready,
|
(GAsyncReadyCallback)ser_location_ready,
|
||||||
ctx);
|
task);
|
||||||
qmi_message_pds_set_event_report_input_unref (input);
|
qmi_message_pds_set_event_report_input_unref (input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gps_service_state_start_ready (QmiClientPds *client,
|
gps_service_state_start_ready (QmiClientPds *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
EnableLocationGatheringContext *ctx)
|
GTask *task)
|
||||||
{
|
{
|
||||||
|
EnableLocationGatheringContext *ctx;
|
||||||
QmiMessagePdsSetAutoTrackingStateInput *input;
|
QmiMessagePdsSetAutoTrackingStateInput *input;
|
||||||
QmiMessagePdsSetGpsServiceStateOutput *output = NULL;
|
QmiMessagePdsSetGpsServiceStateOutput *output = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@@ -9148,8 +9152,8 @@ gps_service_state_start_ready (QmiClientPds *client,
|
|||||||
output = qmi_client_pds_set_gps_service_state_finish (client, res, &error);
|
output = qmi_client_pds_set_gps_service_state_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
g_prefix_error (&error, "QMI operation failed: ");
|
g_prefix_error (&error, "QMI operation failed: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9158,8 +9162,8 @@ gps_service_state_start_ready (QmiClientPds *client,
|
|||||||
QMI_PROTOCOL_ERROR,
|
QMI_PROTOCOL_ERROR,
|
||||||
QMI_PROTOCOL_ERROR_NO_EFFECT)) {
|
QMI_PROTOCOL_ERROR_NO_EFFECT)) {
|
||||||
g_prefix_error (&error, "Couldn't set GPS service state: ");
|
g_prefix_error (&error, "Couldn't set GPS service state: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
qmi_message_pds_set_gps_service_state_output_unref (output);
|
qmi_message_pds_set_gps_service_state_output_unref (output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -9168,6 +9172,8 @@ gps_service_state_start_ready (QmiClientPds *client,
|
|||||||
|
|
||||||
qmi_message_pds_set_gps_service_state_output_unref (output);
|
qmi_message_pds_set_gps_service_state_output_unref (output);
|
||||||
|
|
||||||
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
/* Enable auto-tracking for a continuous fix */
|
/* Enable auto-tracking for a continuous fix */
|
||||||
input = qmi_message_pds_set_auto_tracking_state_input_new ();
|
input = qmi_message_pds_set_auto_tracking_state_input_new ();
|
||||||
qmi_message_pds_set_auto_tracking_state_input_set_state (input, TRUE, NULL);
|
qmi_message_pds_set_auto_tracking_state_input_set_state (input, TRUE, NULL);
|
||||||
@@ -9177,48 +9183,55 @@ gps_service_state_start_ready (QmiClientPds *client,
|
|||||||
10,
|
10,
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
(GAsyncReadyCallback)auto_tracking_state_start_ready,
|
(GAsyncReadyCallback)auto_tracking_state_start_ready,
|
||||||
ctx);
|
task);
|
||||||
qmi_message_pds_set_auto_tracking_state_input_unref (input);
|
qmi_message_pds_set_auto_tracking_state_input_unref (input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_default_tracking_session_start_ready (QmiClientPds *client,
|
set_default_tracking_session_start_ready (QmiClientPds *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
EnableLocationGatheringContext *ctx)
|
GTask *task)
|
||||||
{
|
{
|
||||||
|
MMBroadbandModemQmi *self;
|
||||||
|
EnableLocationGatheringContext *ctx;
|
||||||
QmiMessagePdsSetDefaultTrackingSessionOutput *output = NULL;
|
QmiMessagePdsSetDefaultTrackingSessionOutput *output = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
output = qmi_client_pds_set_default_tracking_session_finish (client, res, &error);
|
output = qmi_client_pds_set_default_tracking_session_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
g_prefix_error (&error, "QMI operation failed: ");
|
g_prefix_error (&error, "QMI operation failed: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qmi_message_pds_set_default_tracking_session_output_get_result (output, &error)) {
|
if (!qmi_message_pds_set_default_tracking_session_output_get_result (output, &error)) {
|
||||||
g_prefix_error (&error, "Couldn't set default tracking session: ");
|
g_prefix_error (&error, "Couldn't set default tracking session: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
qmi_message_pds_set_default_tracking_session_output_unref (output);
|
qmi_message_pds_set_default_tracking_session_output_unref (output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qmi_message_pds_set_default_tracking_session_output_unref (output);
|
qmi_message_pds_set_default_tracking_session_output_unref (output);
|
||||||
|
|
||||||
|
self = g_task_get_source_object (task);
|
||||||
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
/* Done */
|
/* Done */
|
||||||
mm_dbg ("A-GPS enabled");
|
mm_dbg ("A-GPS enabled");
|
||||||
ctx->self->priv->enabled_sources |= ctx->source;
|
self->priv->enabled_sources |= ctx->source;
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_default_tracking_session_start_ready (QmiClientPds *client,
|
get_default_tracking_session_start_ready (QmiClientPds *client,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
EnableLocationGatheringContext *ctx)
|
GTask *task)
|
||||||
{
|
{
|
||||||
|
MMBroadbandModemQmi *self;
|
||||||
|
EnableLocationGatheringContext *ctx;
|
||||||
QmiMessagePdsSetDefaultTrackingSessionInput *input;
|
QmiMessagePdsSetDefaultTrackingSessionInput *input;
|
||||||
QmiMessagePdsGetDefaultTrackingSessionOutput *output = NULL;
|
QmiMessagePdsGetDefaultTrackingSessionOutput *output = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@@ -9226,19 +9239,22 @@ get_default_tracking_session_start_ready (QmiClientPds *client,
|
|||||||
output = qmi_client_pds_get_default_tracking_session_finish (client, res, &error);
|
output = qmi_client_pds_get_default_tracking_session_finish (client, res, &error);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
g_prefix_error (&error, "QMI operation failed: ");
|
g_prefix_error (&error, "QMI operation failed: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!qmi_message_pds_get_default_tracking_session_output_get_result (output, &error)) {
|
if (!qmi_message_pds_get_default_tracking_session_output_get_result (output, &error)) {
|
||||||
g_prefix_error (&error, "Couldn't get default tracking session: ");
|
g_prefix_error (&error, "Couldn't get default tracking session: ");
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
qmi_message_pds_get_default_tracking_session_output_unref (output);
|
qmi_message_pds_get_default_tracking_session_output_unref (output);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self = g_task_get_source_object (task);
|
||||||
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
qmi_message_pds_get_default_tracking_session_output_get_info (
|
qmi_message_pds_get_default_tracking_session_output_get_info (
|
||||||
output,
|
output,
|
||||||
&ctx->session_operation,
|
&ctx->session_operation,
|
||||||
@@ -9252,9 +9268,9 @@ get_default_tracking_session_start_ready (QmiClientPds *client,
|
|||||||
if (ctx->session_operation == QMI_PDS_OPERATING_MODE_MS_ASSISTED) {
|
if (ctx->session_operation == QMI_PDS_OPERATING_MODE_MS_ASSISTED) {
|
||||||
/* Done */
|
/* Done */
|
||||||
mm_dbg ("A-GPS already enabled");
|
mm_dbg ("A-GPS already enabled");
|
||||||
ctx->self->priv->enabled_sources |= ctx->source;
|
self->priv->enabled_sources |= ctx->source;
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9272,29 +9288,33 @@ get_default_tracking_session_start_ready (QmiClientPds *client,
|
|||||||
10,
|
10,
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
(GAsyncReadyCallback)set_default_tracking_session_start_ready,
|
(GAsyncReadyCallback)set_default_tracking_session_start_ready,
|
||||||
ctx);
|
task);
|
||||||
qmi_message_pds_set_default_tracking_session_input_unref (input);
|
qmi_message_pds_set_default_tracking_session_input_unref (input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parent_enable_location_gathering_ready (MMIfaceModemLocation *self,
|
parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
EnableLocationGatheringContext *ctx)
|
GTask *task)
|
||||||
{
|
{
|
||||||
|
MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self);
|
||||||
|
EnableLocationGatheringContext *ctx;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
QmiClient *client;
|
QmiClient *client;
|
||||||
|
|
||||||
if (!iface_modem_location_parent->enable_location_gathering_finish (self, res, &error)) {
|
if (!iface_modem_location_parent->enable_location_gathering_finish (_self, res, &error)) {
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx = g_task_get_task_data (task);
|
||||||
|
|
||||||
/* Nothing else needed in the QMI side for LAC/CI */
|
/* Nothing else needed in the QMI side for LAC/CI */
|
||||||
if (ctx->source == MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI) {
|
if (ctx->source == MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI) {
|
||||||
ctx->self->priv->enabled_sources |= ctx->source;
|
self->priv->enabled_sources |= ctx->source;
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9303,21 +9323,21 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *self,
|
|||||||
* Note that we don't care for when the registration checks get finished.
|
* Note that we don't care for when the registration checks get finished.
|
||||||
*/
|
*/
|
||||||
if (ctx->source == MM_MODEM_LOCATION_SOURCE_CDMA_BS &&
|
if (ctx->source == MM_MODEM_LOCATION_SOURCE_CDMA_BS &&
|
||||||
mm_iface_modem_is_cdma (MM_IFACE_MODEM (ctx->self))) {
|
mm_iface_modem_is_cdma (MM_IFACE_MODEM (self))) {
|
||||||
/* Reload registration to get LAC/CI */
|
/* Reload registration to get LAC/CI */
|
||||||
mm_iface_modem_cdma_run_registration_checks (MM_IFACE_MODEM_CDMA (ctx->self), NULL, NULL);
|
mm_iface_modem_cdma_run_registration_checks (MM_IFACE_MODEM_CDMA (self), NULL, NULL);
|
||||||
/* Just mark it as enabled */
|
/* Just mark it as enabled */
|
||||||
ctx->self->priv->enabled_sources |= ctx->source;
|
self->priv->enabled_sources |= ctx->source;
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup context and client */
|
/* Setup context and client */
|
||||||
client = peek_qmi_client (ctx->self, QMI_SERVICE_PDS, &error);
|
client = peek_qmi_client (self, QMI_SERVICE_PDS, &error);
|
||||||
if (!client) {
|
if (!client) {
|
||||||
g_simple_async_result_take_error (ctx->result, error);
|
g_task_return_error (task, error);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx->client = g_object_ref (client);
|
ctx->client = g_object_ref (client);
|
||||||
@@ -9330,15 +9350,15 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *self,
|
|||||||
10,
|
10,
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
(GAsyncReadyCallback)get_default_tracking_session_start_ready,
|
(GAsyncReadyCallback)get_default_tracking_session_start_ready,
|
||||||
ctx);
|
task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NMEA and RAW are both enabled in the same way */
|
/* NMEA and RAW are both enabled in the same way */
|
||||||
if (ctx->source & (MM_MODEM_LOCATION_SOURCE_GPS_NMEA | MM_MODEM_LOCATION_SOURCE_GPS_RAW)) {
|
if (ctx->source & (MM_MODEM_LOCATION_SOURCE_GPS_NMEA | MM_MODEM_LOCATION_SOURCE_GPS_RAW)) {
|
||||||
/* Only start GPS engine if not done already */
|
/* Only start GPS engine if not done already */
|
||||||
if (!(ctx->self->priv->enabled_sources & (MM_MODEM_LOCATION_SOURCE_GPS_NMEA |
|
if (!(self->priv->enabled_sources & (MM_MODEM_LOCATION_SOURCE_GPS_NMEA |
|
||||||
MM_MODEM_LOCATION_SOURCE_GPS_RAW))) {
|
MM_MODEM_LOCATION_SOURCE_GPS_RAW))) {
|
||||||
QmiMessagePdsSetGpsServiceStateInput *input;
|
QmiMessagePdsSetGpsServiceStateInput *input;
|
||||||
|
|
||||||
input = qmi_message_pds_set_gps_service_state_input_new ();
|
input = qmi_message_pds_set_gps_service_state_input_new ();
|
||||||
@@ -9349,15 +9369,15 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *self,
|
|||||||
10,
|
10,
|
||||||
NULL, /* cancellable */
|
NULL, /* cancellable */
|
||||||
(GAsyncReadyCallback)gps_service_state_start_ready,
|
(GAsyncReadyCallback)gps_service_state_start_ready,
|
||||||
ctx);
|
task);
|
||||||
qmi_message_pds_set_gps_service_state_input_unref (input);
|
qmi_message_pds_set_gps_service_state_input_unref (input);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GPS already started, we're done */
|
/* GPS already started, we're done */
|
||||||
ctx->self->priv->enabled_sources |= ctx->source;
|
self->priv->enabled_sources |= ctx->source;
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
enable_location_gathering_context_complete_and_free (ctx);
|
g_object_unref (task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9374,22 +9394,21 @@ enable_location_gathering (MMIfaceModemLocation *self,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
EnableLocationGatheringContext *ctx;
|
EnableLocationGatheringContext *ctx;
|
||||||
|
GTask *task;
|
||||||
|
|
||||||
ctx = g_slice_new0 (EnableLocationGatheringContext);
|
ctx = g_slice_new0 (EnableLocationGatheringContext);
|
||||||
ctx->self = g_object_ref (self);
|
|
||||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
|
||||||
callback,
|
|
||||||
user_data,
|
|
||||||
enable_location_gathering);
|
|
||||||
/* Store source to enable, there will be only one! */
|
/* Store source to enable, there will be only one! */
|
||||||
ctx->source = source;
|
ctx->source = source;
|
||||||
|
|
||||||
|
task = g_task_new (self, NULL, callback, user_data);
|
||||||
|
g_task_set_task_data (task, ctx, (GDestroyNotify)enable_location_gathering_context_free);
|
||||||
|
|
||||||
/* Chain up parent's gathering enable */
|
/* Chain up parent's gathering enable */
|
||||||
iface_modem_location_parent->enable_location_gathering (
|
iface_modem_location_parent->enable_location_gathering (
|
||||||
MM_IFACE_MODEM_LOCATION (ctx->self),
|
self,
|
||||||
ctx->source,
|
ctx->source,
|
||||||
(GAsyncReadyCallback)parent_enable_location_gathering_ready,
|
(GAsyncReadyCallback)parent_enable_location_gathering_ready,
|
||||||
ctx);
|
task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
Reference in New Issue
Block a user