static void on_modem_enabled (GObject *source_object, GAsyncResult *res, gpointer user_data) { GClueModemSource *source= GCLUE_MODEM_SOURCE (user_data); GClueModemSourcePrivate *priv = source->priv; MMModemLocationSource caps; GError *error = NULL; if (!mm_modem_enable_finish (priv->modem, res, &error)) { if (error->code == MM_CORE_ERROR_IN_PROGRESS) /* Seems another source instance is already on it */ g_signal_connect (G_OBJECT (priv->modem_location), "notify::location", G_CALLBACK (on_location_changed), user_data); else g_warning ("Failed to enable modem: %s", error->message); g_error_free (error); return; } g_signal_connect (G_OBJECT (priv->modem_location), "notify::location", G_CALLBACK (on_location_changed), user_data); caps = mm_modem_location_get_capabilities (priv->modem_location); mm_modem_location_setup (priv->modem_location, caps, TRUE, priv->cancellable, on_modem_location_setup, user_data); }
static void get_modem_ready (GObject *source, GAsyncResult *result, gpointer none) { ctx->object = mmcli_get_modem_finish (result, &ctx->manager); ctx->modem_location = mm_object_get_modem_location (ctx->object); /* Setup operation timeout */ if (ctx->modem_location) mmcli_force_operation_timeout (G_DBUS_PROXY (ctx->modem_location)); ensure_modem_location (); if (status_flag) g_assert_not_reached (); /* Request to setup location gathering? */ if (enable_3gpp_flag || disable_3gpp_flag || enable_agps_flag || disable_agps_flag || enable_gps_nmea_flag || disable_gps_nmea_flag || enable_gps_raw_flag || disable_gps_raw_flag || enable_cdma_bs_flag || disable_cdma_bs_flag || enable_gps_unmanaged_flag || disable_gps_unmanaged_flag || set_enable_signal_flag || set_disable_signal_flag) { g_debug ("Asynchronously setting up location gathering..."); mm_modem_location_setup (ctx->modem_location, build_sources_from_flags (), build_signals_location_from_flags (), ctx->cancellable, (GAsyncReadyCallback)setup_ready, NULL); return; } /* Request to get location from the modem? */ if (get_3gpp_flag || get_gps_nmea_flag || get_gps_raw_flag || get_cdma_bs_flag) { g_debug ("Asynchronously getting location from the modem..."); mm_modem_location_get_full (ctx->modem_location, ctx->cancellable, (GAsyncReadyCallback)get_location_ready, NULL); return; } /* Request to set SUPL server? */ if (set_supl_server_str) { g_debug ("Asynchronously setting SUPL server..."); mm_modem_location_set_supl_server (ctx->modem_location, set_supl_server_str, ctx->cancellable, (GAsyncReadyCallback)set_supl_server_ready, NULL); return; } /* Request to set GPS refresh rate? */ if (set_gps_refresh_rate_str) { guint rate; if (!mm_get_uint_from_str (set_gps_refresh_rate_str, &rate)) { g_printerr ("error: couldn't set GPS refresh rate: invalid rate given: '%s'\n", set_gps_refresh_rate_str); exit (EXIT_FAILURE); } g_debug ("Asynchronously setting GPS refresh rate..."); mm_modem_location_set_gps_refresh_rate (ctx->modem_location, rate, ctx->cancellable, (GAsyncReadyCallback)set_gps_refresh_rate_ready, NULL); return; } g_warn_if_reached (); }