Alpha release.
authorwellu <wellu@wellu.org>
Sat, 6 Sep 2008 17:28:12 +0000 (17:28 +0000)
committerwellu <wellu@wellu.org>
Sat, 6 Sep 2008 17:28:12 +0000 (17:28 +0000)
git-svn-id: file:///svnroot/speedometer/trunk@31 df364472-da61-43ef-8a67-511c89aa921b

Makefile
README
TODO [new file with mode: 0644]
callbacks.c
callbacks.h
debian/changelog
ui.c
ui.h
util.c
util.h

index 29ce894..91ee7bc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,6 @@ $(TARGET):  $(OBJECTS)
 $(OBJECTS): $(SOURCES)
        $(CC) -c $(SOURCES) $(INCPATH)
 
-
 clean:
        rm -f $(OBJECTS) $(TARGET)
 
diff --git a/README b/README
index e3fdd96..d25d582 100644 (file)
--- a/README
+++ b/README
@@ -1,3 +1,22 @@
-This is Speedometer, a simple GPS application that
-shows current speed on the device screen.
+This application and all its files are released under
+GPL license. See COPYING for the whole license text.
 
+There is one catch though.. If you really like this
+program I would like to get a postcard from you. Include 
+word Speedometer in the card so I know that the card is 
+related to this software (like I'm getting tons of 
+anynomous postcards all around the world ;)
+
+This is *not* to say you have to but it would be very nice.
+
+See http://en.wikipedia.org/wiki/Cardware if you don't know
+what this means.
+
+
+Anyway, here goes the address:
+
+Wellu Mäkinen
+PO Box 
+33580 Tampere
+
+FINLAND
diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..f773ee5
--- /dev/null
+++ b/TODO
@@ -0,0 +1,8 @@
+This is a list of things that are on the pipeline:
+
+ - Make AppData part of ui.h --> lots of AppData pointer passing
+   fades away :)
+ - Themes: Splitting the package into two graphics and the program.
+
+ -
index 5953252..3c48b2d 100644 (file)
@@ -18,6 +18,7 @@
 
 #include "callbacks.h"
 #include "appdata.h"
+#include "util.h"
 
 // this is just here for debugging and tracing purposes
 static void print_location(LocationGPSDevice* device) {
@@ -31,8 +32,15 @@ static void print_location(LocationGPSDevice* device) {
                        device->fix->speed);
 }
 
-void location_changed(LocationGPSDevice* device, gpointer userdata) {
+void location_changed(LocationGPSDevice* device, gpointer data) {
+       print_location(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);
+       }
 }
 
 gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, HildonWindow* window) {
index e36d354..66b868d 100644 (file)
@@ -24,7 +24,7 @@
 #include <gtk/gtk.h>
 
 // called by GPSD whenever location changes
-void location_changed(LocationGPSDevice* device, gpointer userdata);
+void location_changed(LocationGPSDevice* device, gpointer data);
 
 // for hardware keys
 gboolean key_press_cb(GtkWidget* widget, GdkEventKey* event, HildonWindow* window);
index 5d487eb..a1a620f 100644 (file)
@@ -1,3 +1,9 @@
+speedometer (0.3-alpha1) unstable; urgency=low
+
+  * First alpha release.
+
+ -- Wellu Mäkinen <wellu@wellu.org>  Sat,  6 Sep 2008 20:19:17 +0300
+
 speedometer (0.3) unstable; urgency=low
 
   * Experimental UI layout implemented.
diff --git a/ui.c b/ui.c
index ea70e28..d582f5b 100644 (file)
--- a/ui.c
+++ b/ui.c
@@ -54,6 +54,15 @@ void reset_speed(AppData* appdata) {
        appdata->speed_array[2] = (GtkImage*) gtk_image_new_from_pixbuf(zero);
 }
 
+void set_nth_digit(AppData* appdata, guint n, guint value) {
+       //assert(nth >= 0 && nth < 3);
+
+       GtkImage* image = appdata->speed_array[n];
+       GdkPixbuf* buf = gtk_image_get_pixbuf(appdata->image_array[value]);
+       gtk_image_set_from_pixbuf(image, buf);
+       gtk_widget_queue_draw(GTK_WIDGET(appdata->speed_array[n]));
+}
+
 guint randomize(AppData* appdata) {
 
        gint32 n = g_random_int_range(0, 3);
diff --git a/ui.h b/ui.h
index 0b44c4d..fc5f8ea 100644 (file)
--- a/ui.h
+++ b/ui.h
@@ -25,6 +25,8 @@ void load_images(AppData *appdata);
 
 void reset_speed(AppData* appdata);
 
+void set_nth_digit(AppData* appdata, guint n, guint value);
+
 guint randomize(AppData* appdata);
 
 void create_ui(AppData* appdata);
diff --git a/util.c b/util.c
index 0b246f5..b53b8aa 100644 (file)
--- a/util.c
+++ b/util.c
@@ -22,6 +22,7 @@
 #include "util.h"
 #include "appdata.h"
 #include "callbacks.h"
+#include "ui.h"
 
 static LocationGPSDevice *device = NULL;
 static LocationGPSDControl *control = NULL;
@@ -50,3 +51,21 @@ void stop_gps(AppData* appdata) {
 #endif // __arm__
 }
 
+void interpret_speed_from_gps(AppData* appdata, gdouble speed) {
+
+       // first let's convert the number to characters
+       gchar* c_digits = calloc(30, 1);
+
+       g_sprintf(c_digits, "%f", speed);
+
+       g_print("interpret_speed_from_gps: %s", c_digits);
+
+       int i = 0;
+       while(i < 3) {
+               guint value = g_ascii_digit_value(c_digits[i]);
+               set_nth_digit(appdata, i, value);
+               i++;
+       }
+       g_free(c_digits);
+}
+
diff --git a/util.h b/util.h
index 64ba629..d6b639b 100644 (file)
--- a/util.h
+++ b/util.h
 
 #include "appdata.h"
 
+// starts the gps
 void start_gps(AppData* appdata);
+
+// stops the gps
 void stop_gps(AppData* appdata);
 
+// converts the speed from the gps
+void interpret_speed_from_gps(AppData* appdata, gdouble speed);
+
 #endif /* UTIL_H_ */