along with this program. If not, see <http://www.gnu.org/licenses/>.
****/
+#include <math.h>
+#include <hildon/hildon-banner.h>
+
#include "callbacks.h"
#include "appdata.h"
#include "util.h"
-// this is just here for debugging and tracing purposes
-static void print_location(LocationGPSDevice* device) {
- g_print("Latitude: %.2f\n"
- "Longitude: %.2f\n"
- "Altitude: %.2f\n"
- "Speed: %d",
- device->fix->latitude,
- device->fix->longitude,
- device->fix->altitude,
- device->fix->speed);
-}
-
void location_changed(LocationGPSDevice* device, gpointer data) {
- print_location(device);
+ g_assert(data);
+ g_assert(device);
AppData* appdata = (AppData*) data;
- if(device->fix && LOCATION_GPS_DEVICE_SPEED_SET) {
- g_print("Speed is %f km/h", device->fix->speed);
- interpret_speed_from_gps(appdata, device->fix->speed);
+ // check for NaN before passing values
+ if(device->fix->fields & LOCATION_GPS_DEVICE_SPEED_SET) {
+ if(!isnan(device->fix->speed)) {
+ interpret_speed_from_gps(appdata, device->fix->speed);
+ }
}
}
if(x > 750) {
g_print("Exiting..\n");
- stop_gps(appdata);
g_signal_emit_by_name(appdata->window, "delete_event");
}
- else {
- randomize(appdata);
- }
return TRUE;
}
gboolean bottom_event_box_button_press(GtkWidget* widget, GdkEventButton* event, gpointer data) {
gdouble x = event->x;
g_print("Bottom event box pressed at: %f\n", x);
- AppData* appdata = (AppData*) data;
-
- randomize(data);
return TRUE;
}