[Gpredict-svn] SF.net SVN: gpredict:[893] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <aa...@us...> - 2011-09-01 11:39:27
|
Revision: 893 http://gpredict.svn.sourceforge.net/gpredict/?rev=893&view=rev Author: aa1vs Date: 2011-09-01 11:39:20 +0000 (Thu, 01 Sep 2011) Log Message: ----------- Tracks operational status through tle-update and stores it in .sat files when available. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/gtk-sat-data.c trunk/src/tle-update.c trunk/src/tle-update.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/ChangeLog 2011-09-01 11:39:20 UTC (rev 893) @@ -1,3 +1,14 @@ +2011-09-01 Charles Suprin <hamaa1vs at gmail.com> + + * ChangeLog + * NEWS + * src/tle-update.c + * src/tle-update.h + * src/gtk-sat-data.c + Tracks operational status through tle-update and stores it in .sat files when available. + Fixes Bug 3400534: Operational Status + + 2011-08-26 Charles Suprin <hamaa1vs at gmail.com> * ChangeLog Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/NEWS 2011-09-01 11:39:20 UTC (rev 893) @@ -12,6 +12,7 @@ - Fixed bug 3272993: Issue controlling Yaesu FT-847. - Fixed bug 3334657: Old log files not being saved. - Fixed bug 3271573: Track button in rotator controller has no effect. +- Fixed bug 3400534: Operational Status. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/gtk-sat-data.c =================================================================== --- trunk/src/gtk-sat-data.c 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/src/gtk-sat-data.c 2011-09-01 11:39:20 UTC (rev 893) @@ -100,6 +100,7 @@ /* get TLE data */ tlestr1 = g_key_file_get_string (data, "Satellite", "TLE1", NULL); tlestr2 = g_key_file_get_string (data, "Satellite", "TLE2", NULL); + rawtle = g_strconcat (tlestr1, tlestr2, NULL); if (!Good_Elements (rawtle)) { @@ -109,6 +110,9 @@ errorcode = 2; } Convert_Satellite_Data (rawtle, &sat->tle); + + if (g_key_file_has_key(data, "Satellite", "STATUS",NULL)) + sat->tle.status = g_key_file_get_integer (data, "Satellite", "STATUS", NULL); g_free (tlestr1); g_free (tlestr2); Modified: trunk/src/tle-update.c =================================================================== --- trunk/src/tle-update.c 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/src/tle-update.c 2011-09-01 11:39:20 UTC (rev 893) @@ -532,7 +532,6 @@ gchar *userconfdir; CURL *curl; CURLcode res; - gboolean error = FALSE; gdouble fraction,start=0; FILE *outfile; GDir *dir; @@ -626,7 +625,6 @@ sat_log_log (SAT_LOG_LEVEL_ERROR, _("%s: Error fetching %s (%s)"), __FUNCTION__, curfile, curl_easy_strerror (res)); - error = TRUE; } else { sat_log_log (SAT_LOG_LEVEL_MSG, @@ -818,6 +816,11 @@ catfile = g_fopen (catpath, "r"); if (catfile!=NULL) { b = fgets (category, 80, catfile); + if (b == NULL) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: There is no category in %s"), + __FILE__, __FUNCTION__, catpath); + } fclose (catfile); catsync = TRUE; } @@ -894,6 +897,7 @@ ntle = g_try_new (new_tle_t, 1); ntle->catnum = catnr; ntle->epoch = tle.epoch; + ntle->status = tle.status; ntle->satname = g_strdup (g_strchomp(tle_str[0])); ntle->line1 = g_strdup (tle_str[1]); ntle->line2 = g_strdup (tle_str[2]); @@ -907,10 +911,23 @@ /* if the satellite in the hash is older than the one just loaded, copy the values over. */ ntle = g_hash_table_lookup (data, key); - - if (ntle->epoch <tle.epoch) { + if (ntle->epoch == tle.epoch) { + if (ntle->status!=tle.status) { + if (tle.status != OP_STAT_UNKNOWN) { + if (ntle->status!= OP_STAT_UNKNOWN) { + sat_log_log (SAT_LOG_LEVEL_ERROR, + _("%s:%s: Two different statuses for the same satellite at the same time."), + __FILE__, __FUNCTION__); + + } + ntle->status = tle.status; + } + } + } + else if (ntle->epoch <tle.epoch) { ntle->catnum = catnr; ntle->epoch = tle.epoch; + ntle->status = tle.status; g_free (ntle->satname); ntle->satname = g_strdup (g_strchomp(tle_str[0])); g_free (ntle->line1); @@ -988,6 +1005,7 @@ guint *key = NULL; tle_t tle; new_tle_t *ntle; + op_stat_t status; GError *error = NULL; GKeyFile *satdata; gchar *tlestr1, *tlestr2, *rawtle, *satname, *satnickname; @@ -1041,6 +1059,13 @@ tlestr2 = g_key_file_get_string (satdata, "Satellite", "TLE2", NULL); satname = g_key_file_get_string (satdata, "Satellite", "NAME", NULL); satnickname = g_key_file_get_string (satdata, "Satellite", "NICKNAME", NULL); + if (g_key_file_has_key(satdata,"Satellite","STATUS", NULL)) { + status = g_key_file_get_integer (satdata, "Satellite", "STATUS", NULL); + } + else { + status = OP_STAT_UNKNOWN; + } + rawtle = g_strconcat (tlestr1, tlestr2, NULL); if (!Good_Elements (rawtle)) { @@ -1086,7 +1111,16 @@ g_free(satname); g_free(satnickname); - + + if ( status != ntle->status ){ + + sat_log_log (SAT_LOG_LEVEL_MSG, + _("%s: Data for %d updated for operational status."), + __FUNCTION__, catnr); + g_key_file_set_integer (satdata, "Satellite", "STATUS", ntle->status); + updateddata = TRUE; + } + if (tle.epoch < ntle->epoch) { /* new data is newer than what we already have */ /* store new data */ Modified: trunk/src/tle-update.h =================================================================== --- trunk/src/tle-update.h 2011-08-26 15:32:06 UTC (rev 892) +++ trunk/src/tle-update.h 2011-09-01 11:39:20 UTC (rev 893) @@ -65,6 +65,7 @@ gchar *line2; /*!< Line 2. */ gchar *srcfile; /*!< The file where TLE comes from (needed for cat) */ gboolean isnew; /*!< Flag indicating whether sat is new. */ + op_stat_t status; /*!< Enum indicating current satellite status. */ } new_tle_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |