#endif
/**
+ *
* Place a request to connect about 1 second after the function is called.
*/
void
{
g_assert(gps);
g_assert(gps->io.clater_sid==0);
+
gps->io.clater_sid=g_timeout_add(1000, (GSourceFunc)gps_connect_now, gps);
}
gps_connect_socket(Gps *gps)
{
gint r, e;
+
g_assert(gps);
switch (gps->io.type) {
gps_simulate_start(Gps *gps, Position *p_from)
{
g_assert(gps);
-if (p_from->valid) {
+if (p_from && p_from->valid) {
gps->data.lat=p_from->lat;
gps->data.lon=p_from->lon;
} else {
}
gps->io.conn=RCVR_FIXED;
-gps->data.fix=FIX_2D;
+gps->data.fix=FIX_3D;
gps->data.satinview=0;
gps->data.satinuse=0;
gps_data_integerize(&gps->data);
g_assert(gps);
-if (p_to->valid) {
+if (p_to && p_to->valid) {
gdouble c;
c=calculate_course_rad(p_to->lat, p_to->lon, gps->data.lat, gps->data.lon);
}
/**
+ * gps_read_buffer_prepare:
+ * @gps
+ *
* Reset GPS read buffer
*/
static void
}
/**
+ * gps_connect_channel_connect:
+ * @gps
+ *
* Connect file descriptor to channel and add watches.
*/
static void
}
/**
+ * gps_connect_now:
+ * @gps
+ *
* Connect to the receiver.
* This method assumes that fd is -1 and _channel is NULL. If unsure, call
* gps_disconnect() first.
perror("TCP:");
return FALSE;
}
- ip=ip = inet_ntop (AF_INET, (struct in_addr *)hostinfo->h_addr_list[0], ipbuf, sizeof (ipbuf));
+ ip=inet_ntop (AF_INET, (struct in_addr *)hostinfo->h_addr_list[0], ipbuf, sizeof (ipbuf));
}
if (inet_pton(AF_INET, ip, &gps->io.rcvr_addr_in.sin_addr.s_addr)<1) {
g_warning("Failed to start gpsd: %d (%s) %s\n", errno, strerror(errno), errbuf);
return FALSE;
} else {
+ /* XXX: Use timer cb instead to flag it's ok to connect */
g_debug("Waiting for gpsd");
sleep(2);
g_debug("Done wating");