[Gpredict-svn] SF.net SVN: gpredict:[731] branches/gpsd_testing/src
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <aa...@us...> - 2011-01-05 23:47:48
|
Revision: 731
http://gpredict.svn.sourceforge.net/gpredict/?rev=731&view=rev
Author: aa1vs
Date: 2011-01-05 23:47:41 +0000 (Wed, 05 Jan 2011)
Log Message:
-----------
Update AOS information when qth changes and make distinction between qth_data and qth_data_update in function names
Modified Paths:
--------------
branches/gpsd_testing/src/gtk-sat-module.c
branches/gpsd_testing/src/qth-data.c
branches/gpsd_testing/src/qth-data.h
Modified: branches/gpsd_testing/src/gtk-sat-module.c
===================================================================
--- branches/gpsd_testing/src/gtk-sat-module.c 2011-01-04 02:57:02 UTC (rev 730)
+++ branches/gpsd_testing/src/gtk-sat-module.c 2011-01-05 23:47:41 UTC (rev 731)
@@ -294,7 +294,7 @@
return NULL;
}
/*initialize the qth engine*/
- qth_data_init(GTK_SAT_MODULE(widget)->qth);
+ qth_data_update_init(GTK_SAT_MODULE(widget)->qth);
/* module state */
if ((g_key_file_has_key (GTK_SAT_MODULE (widget)->cfgdata,
@@ -816,7 +816,14 @@
mod->event_count = 0;
}
/*update the qth position*/
- qth_data_update(mod->qth,mod->tmgCdnum);
+ /*if new position update stuff*/
+ /*should probably have window around qth to reduce distance*/
+ if(qth_data_update(mod->qth,mod->tmgCdnum)) {
+ /* reset counter, this will make gtk_sat_module_update_sat
+ recalculate events
+ */
+ mod->event_count = 0;
+ }
@@ -1034,7 +1041,7 @@
/** \brief Module options
*
* Invoke module-wide popup menu
- */
+ */
static void
gtk_sat_module_popup_cb (GtkWidget *button, gpointer data)
{
Modified: branches/gpsd_testing/src/qth-data.c
===================================================================
--- branches/gpsd_testing/src/qth-data.c 2011-01-04 02:57:02 UTC (rev 730)
+++ branches/gpsd_testing/src/qth-data.c 2011-01-05 23:47:41 UTC (rev 731)
@@ -371,7 +371,9 @@
void
qth_data_free (qth_t *qth)
{
- qth_data_stop(qth);
+ /*stop any updating*/
+ qth_data_update_stop(qth);
+
if (qth->name) {
g_free (qth->name);
qth->name = NULL;
@@ -404,6 +406,11 @@
g_free (qth);
}
+
+/** \brief Update the qth data by whatever method is appropriate.
+ * \param qth the qth data structure to update
+ * \param qth the time at which the qth is to be computed. this may be ignored by gps updates.
+ */
gboolean qth_data_update(qth_t * qth, gdouble t) {
switch (qth->type) {
case QTH_STATIC_TYPE:
@@ -441,7 +448,13 @@
}
}
-gboolean qth_data_init(qth_t * qth) {
+/** \brief Initialize whatever structures inside the qth_t stucture for later updates.
+ * \param qth the qth data structure to update
+ *
+ *Initial intention of this is to open sockets and ports to gpsd
+ *and other like services to update the qth position.
+ */
+gboolean qth_data_update_init(qth_t * qth) {
char * server="127.0.0.1";
char *port="2947";
qth->type = QTH_GPSD_TYPE;
@@ -470,7 +483,13 @@
return TRUE;
}
-void qth_data_stop (qth_t *qth) {
+/** \brief Shutdown and free structures inside the qth_t stucture were used for updates.
+ * \param qth the qth data structure to update
+ *
+ *Initial intention of this is to open sockets and ports to gpsd
+ *and other like services to update the qth position.
+ */
+void qth_data_update_stop (qth_t *qth) {
switch (qth->type) {
//case QTH_STATIC_TYPE:
// break;
@@ -491,6 +510,9 @@
}
}
+/** \brief Load initial values into the qth_t data structure
+ * \param qth the qth data structure to update
+ */
void qth_init(qth_t* qth) {
qth->lat=0;
qth->lon=0;
@@ -500,6 +522,11 @@
qth->name=NULL;
qth->loc=NULL;
}
+
+/** \brief Load safe values into the qth_t data structure
+ * \param qth the qth data structure to update
+ * This can be used if some operation is suspected of corrupting the structure or entering invalid data. Originally it is based on code that reset values if a load/read of a .qth failed.
+ */
void qth_safe(qth_t* qth) {
qth->name = g_strdup (_("Error"));
qth->loc = g_strdup (_("Error"));
Modified: branches/gpsd_testing/src/qth-data.h
===================================================================
--- branches/gpsd_testing/src/qth-data.h 2011-01-04 02:57:02 UTC (rev 730)
+++ branches/gpsd_testing/src/qth-data.h 2011-01-05 23:47:41 UTC (rev 731)
@@ -58,7 +58,7 @@
gint qth_data_save (const gchar *filename, qth_t *qth);
void qth_data_free (qth_t *qth);
gboolean qth_data_update(qth_t *qth, gdouble t);
-gboolean qth_data_init(qth_t *qth);
-void qth_data_stop(qth_t *qth);
+gboolean qth_data_update_init(qth_t *qth);
+void qth_data_update_stop(qth_t *qth);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|