MMLocationGpsRaw * mm_modem_location_get_gps_raw_sync (MMModemLocation *self, GCancellable *cancellable, GError **error) { MMLocationGpsRaw *location = NULL; mm_modem_location_get_full_sync (self, NULL, NULL, &location, cancellable, error); return location; }
MMLocation3gpp * mm_modem_location_get_3gpp_sync (MMModemLocation *self, GCancellable *cancellable, GError **error) { MMLocation3gpp *location = NULL; mm_modem_location_get_full_sync (self, &location, NULL, NULL, cancellable, error); return location; }
void mmcli_modem_location_run_synchronous (GDBusConnection *connection) { GError *error = NULL; /* Initialize context */ ctx = g_new0 (Context, 1); ctx->object = mmcli_get_modem_sync (connection, mmcli_get_common_modem_string (), &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 (); /* Request to get location status? */ if (status_flag) { g_debug ("Printing location status..."); print_location_status (); return; } /* 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) { gboolean result; g_debug ("Synchronously setting up location gathering..."); result = mm_modem_location_setup_sync (ctx->modem_location, build_sources_from_flags (), build_signals_location_from_flags (), NULL, &error); setup_process_reply (result, error); return; } /* Request to get location from the modem? */ if (get_3gpp_flag || get_gps_nmea_flag || get_gps_raw_flag || get_cdma_bs_flag) { MMLocation3gpp *location_3gpp = NULL; MMLocationGpsNmea *location_gps_nmea = NULL; MMLocationGpsRaw *location_gps_raw = NULL; MMLocationCdmaBs *location_cdma_bs = NULL; g_debug ("Synchronously getting location from the modem..."); mm_modem_location_get_full_sync (ctx->modem_location, get_3gpp_flag ? &location_3gpp : NULL, get_gps_nmea_flag ? &location_gps_nmea : NULL, get_gps_raw_flag ? &location_gps_raw : NULL, get_cdma_bs_flag ? &location_cdma_bs : NULL, NULL, &error); get_location_process_reply (location_3gpp, location_gps_nmea, location_gps_raw, location_cdma_bs, error); return; } /* Request to set SUPL server? */ if (set_supl_server_str) { gboolean result; g_debug ("Synchronously setting SUPL server..."); result = mm_modem_location_set_supl_server_sync (ctx->modem_location, set_supl_server_str, NULL, &error); set_supl_server_process_reply (result, error); return; } /* Request to set GPS refresh rate? */ if (set_gps_refresh_rate_str) { gboolean result; 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 ("Synchronously setting GPS refresh rate..."); result = mm_modem_location_set_gps_refresh_rate_sync (ctx->modem_location, rate, NULL, &error); set_gps_refresh_rate_process_reply (result, error); return; } g_warn_if_reached (); }