GVariant * mm_location_gps_nmea_get_string_variant (MMLocationGpsNmea *self) { GVariant *variant = NULL; gchar *built; g_return_val_if_fail (MM_IS_LOCATION_GPS_NMEA (self), NULL); built = mm_location_gps_nmea_build_full (self); variant = g_variant_new_string (built); g_free (built); return variant; }
static void get_location_process_reply (MMLocation3gpp *location_3gpp, MMLocationGpsNmea *location_gps_nmea, MMLocationGpsRaw *location_gps_raw, MMLocationCdmaBs *location_cdma_bs, const GError *error) { /* First, check for failures */ if (!get_all_flag) { gboolean exit_error = FALSE; if (get_3gpp_flag && !location_3gpp) { g_printerr ("error: couldn't get 3GPP-based location from the modem: '%s'\n", error ? error->message : "not available"); exit_error = TRUE; } if (get_gps_nmea_flag && !location_gps_nmea) { g_printerr ("error: couldn't get NMEA GPS traces from the modem: '%s'\n", error ? error->message : "not available"); exit_error = TRUE; } if (get_gps_raw_flag && !location_gps_raw) { g_printerr ("error: couldn't get raw GPS location from the modem: '%s'\n", error ? error->message : "not available"); exit_error = TRUE; } if (get_cdma_bs_flag && !location_cdma_bs) { g_printerr ("error: couldn't get CDMA base station location from the modem: '%s'\n", error ? error->message : "not available"); exit_error = TRUE; } if (exit_error) exit (EXIT_FAILURE); } else if (error) { g_printerr ("error: couldn't get location from the modem: '%s'\n", error ? error->message : "unknown error"); exit (EXIT_FAILURE); } g_print ("\n" "%s\n", mm_modem_location_get_path (ctx->modem_location)); if (get_3gpp_flag) { if (location_3gpp) g_print (" -------------------------\n" " 3GPP location | Mobile country code: '%u'\n" " | Mobile network code: '%u'\n" " | Location area code: '%lu'\n" " | Cell ID: '%lu'\n", mm_location_3gpp_get_mobile_country_code (location_3gpp), mm_location_3gpp_get_mobile_network_code (location_3gpp), mm_location_3gpp_get_location_area_code (location_3gpp), mm_location_3gpp_get_cell_id (location_3gpp)); else g_print (" -------------------------\n" " 3GPP location | Not available\n"); } if (get_gps_nmea_flag) { gchar *full = NULL; if (location_gps_nmea) full = mm_location_gps_nmea_build_full (location_gps_nmea); if (full) { gchar *prefixed; prefixed = mmcli_prefix_newlines (" | ", full); g_print (" -------------------------\n" " GPS NMEA traces | %s\n", prefixed); g_free (prefixed); g_free (full); } else g_print (" -------------------------\n" " GPS NMEA traces | Not available\n"); } if (get_gps_raw_flag) { if (location_gps_raw) g_print (" -------------------------\n" " Raw GPS | UTC time: '%s'\n" " | Longitude: '%lf'\n" " | Latitude: '%lf'\n" " | Altitude: '%lf'\n", mm_location_gps_raw_get_utc_time (location_gps_raw), mm_location_gps_raw_get_longitude (location_gps_raw), mm_location_gps_raw_get_latitude (location_gps_raw), mm_location_gps_raw_get_altitude (location_gps_raw)); else g_print (" -------------------------\n" " Raw GPS | Not available\n"); } if (get_cdma_bs_flag) { if (location_cdma_bs) g_print (" -------------------------\n" " CDMA BS | Longitude: '%lf'\n" " | Latitude: '%lf'\n", mm_location_cdma_bs_get_longitude (location_cdma_bs), mm_location_cdma_bs_get_latitude (location_cdma_bs)); else g_print (" -------------------------\n" " CDMA BS | Not available\n"); } if (location_3gpp) g_object_unref (location_3gpp); if (location_gps_nmea) g_object_unref (location_gps_nmea); if (location_gps_raw) g_object_unref (location_gps_raw); if (location_cdma_bs) g_object_unref (location_cdma_bs); }