Gps *gps;
gps=g_slice_new0(Gps);
-gps->data.fix=FIX_NOFIX;
+g_assert(gps);
+gps->io.type=type;
+gps_clear(gps);
+return gps;
+}
+
+void
+gps_clear(Gps *gps)
+{
+g_assert(gps);
gps->io.fd=-1;
gps->io.address=NULL;
-gps->io.type=type;
gps->io.conn=RCVR_OFF;
gps->io.nmea=NULL;
gps->io.nmea_cnt=0;
+gps->data.fix=FIX_NOFIX;
gps->data.lat=60.20;
gps->data.lon=22.20;
+gps->data.satinview=0;
+gps->data.satinuse=0;
gps->connection_error=NULL;
gps->connection_retry=NULL;
gps->connection_progress=NULL;
gps->update_info=NULL;
gps->update_satellite=NULL;
gps_data_integerize(&gps->data);
-return gps;
}
void
}
#endif
+gps_clear(gps);
}
static void
gps_simulate_start(Gps *gps)
{
+g_assert(gps);
gps->data.lat=60.45;
gps->data.lon=22.26;
gps->io.conn=RCVR_FIXED;
gps->data.fix=FIX_2D;
+gps->data.satinview=0;
+gps->data.satinuse=0;
gps_data_integerize(&gps->data);
}
static gdouble slat=0, slon=0;
gdouble plat, plon;
gfloat h;
+
g_assert(gps);
if (g_random_double()<0.2) {
const GpsTypes *gps_get_supported_types(void);
Gps *gps_new(GpsIOSourceType type);
+void gps_clear(Gps *gps);
void gps_set_address(Gps *gps, gchar *address, guint port);
void gps_set_type(Gps *gps, GpsIOSourceType type);
void gps_free(Gps *gps);