diff --git a/connectiq/.gitignore b/connectiq/.gitignore
new file mode 100644
index 0000000..55aa8f5
--- /dev/null
+++ b/connectiq/.gitignore
@@ -0,0 +1,2 @@
+*.prg
+*.debug.xml
diff --git a/connectiq/.project b/connectiq/.project
new file mode 100644
index 0000000..95e8f8d
--- /dev/null
+++ b/connectiq/.project
@@ -0,0 +1,17 @@
+
+
+ ura-busstops
+
+
+
+
+
+ connectiq.builder
+
+
+
+
+
+ connectiq.projectNature
+
+
diff --git a/connectiq/manifest.xml b/connectiq/manifest.xml
new file mode 100644
index 0000000..646f7b4
--- /dev/null
+++ b/connectiq/manifest.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/connectiq/resources/drawables/drawables.xml b/connectiq/resources/drawables/drawables.xml
new file mode 100644
index 0000000..d0de5d6
--- /dev/null
+++ b/connectiq/resources/drawables/drawables.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/connectiq/resources/drawables/launcher_icon.png b/connectiq/resources/drawables/launcher_icon.png
new file mode 100644
index 0000000..d3594e7
Binary files /dev/null and b/connectiq/resources/drawables/launcher_icon.png differ
diff --git a/connectiq/resources/strings/strings.xml b/connectiq/resources/strings/strings.xml
new file mode 100644
index 0000000..ec44fdc
--- /dev/null
+++ b/connectiq/resources/strings/strings.xml
@@ -0,0 +1,3 @@
+
+ ASEAG Fahrplan
+
\ No newline at end of file
diff --git a/connectiq/source/BusStopApp.mc b/connectiq/source/BusStopApp.mc
new file mode 100644
index 0000000..df3e1cc
--- /dev/null
+++ b/connectiq/source/BusStopApp.mc
@@ -0,0 +1,54 @@
+using Toybox.Application as App;
+using Toybox.Position as Position;
+using Toybox.Time as Time;
+
+class BusStopApp extends App.AppBase {
+ var mView;
+ var mDelegate;
+
+ function intialize() {
+ AppBase.initialize();
+ }
+
+ //! onStart() is called on application start up
+ function onStart() {
+ Position.enableLocationEvents(Position.LOCATION_CONTINUOUS, method(:onPosition));
+ }
+
+ //! onStop() is called when your application is exiting
+ function onStop() {
+ Position.enableLocationEvents(Position.LOCATION_DISABLE, method(:onPosition));
+ }
+
+ function fakePosition() {
+ var pos = new Position.Info();
+
+ pos.accuracy = 0;
+ pos.altitude = 0;
+ pos.heading = 0;
+ pos.speed = 0;
+ pos.when = Time.now();
+ pos.position = new Position.Location({
+ :latitude => 50.7855,
+ :longitude => 6.0541,
+ :format => :degrees
+ });
+
+ mView.setPosition(pos);
+ }
+
+ function onPosition(info) {
+ positionView.setPosition(info);
+ }
+
+ //! Return the initial view of your application here
+ function getInitialView() {
+ mView = new BusStopView();
+ mDelegate = new BusStopDelegate();
+
+ fakePosition();
+
+ return [ mView, mDelegate ];
+ }
+
+}
\ No newline at end of file
diff --git a/connectiq/source/BusStopDelegate.mc b/connectiq/source/BusStopDelegate.mc
new file mode 100644
index 0000000..6fd792e
--- /dev/null
+++ b/connectiq/source/BusStopDelegate.mc
@@ -0,0 +1,10 @@
+using Toybox.WatchUi as Ui;
+using Toybox.Graphics as Gfx;
+using Toybox.System as Sys;
+
+var last_key = null;
+
+class InputTestDelegate extends Ui.BehaviorDelegate {
+
+
+}
\ No newline at end of file
diff --git a/connectiq/source/BusStopView.mc b/connectiq/source/BusStopView.mc
new file mode 100644
index 0000000..18accd2
--- /dev/null
+++ b/connectiq/source/BusStopView.mc
@@ -0,0 +1,105 @@
+using Toybox.WatchUi as Ui;
+using Toybox.Graphics as Gfx;
+using Toybox.System as Sys;
+using Toybox.Lang as Lang;
+using Toybox.Communications as Comm;
+using Toybox.System as Sys;
+using Toybox.Time as Time;
+using Toybox.Timer as Timer;
+
+class BusStopView extends Ui.View {
+ var schedule = null;
+ var tmr;
+
+ function intialize() {
+ View.initialize();
+ }
+
+ //! Load your resources here
+ function onLayout(dc) {
+ }
+
+ //! Called when this View is brought to the foreground. Restore
+ //! the state of this View and prepare it to be shown. This includes
+ //! loading resources into memory.
+ function onShow() {
+ tmr = new Timer.Timer();
+ tmr.start(method(:redraw), 1000, true);
+ }
+
+ //! Called when this View is removed from the screen. Save the
+ //! state of this View here. This includes freeing resources from
+ //! memory.
+ function onHide() {
+ tmr.stop();
+ }
+
+ //! Update the view
+ function onUpdate(dc) {
+ var string;
+
+ // Set background color
+ dc.setColor( Gfx.COLOR_TRANSPARENT, Gfx.COLOR_BLACK );
+ dc.clear();
+ dc.setColor( Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT );
+
+ if( schedule != null ) {
+ var ts = new Time.Moment(schedule[1][4] / 1000);
+ var duration = Time.now().subtract(ts);
+ var ts_greg = Time.Gregorian.info(ts, Time.FORMAT_MEDIUM);
+ var dur_greg = Time.Gregorian.info(new Time.Moment(duration.value()), Time.FORMAT_SHORT);
+
+ /* Timezone offset */
+ dur_greg.hour -= 2;
+
+ var arr = Lang.format("$1$:$2$:$3$", [
+ (ts_greg.hour - 2),
+ (ts_greg.min).format("%02u"),
+ (ts_greg.sec).format("%02u")
+ ]);
+
+ var due = "";
+ if (dur_greg.hour > 0) {
+ due += dur_greg.hour + " h ";
+ }
+ if (dur_greg.min > 0) {
+ due += dur_greg.min + " min ";
+ }
+ if (dur_greg.sec > 0) {
+ due += dur_greg.sec + " sec ";
+ }
+
+ dc.drawText( (dc.getWidth() / 2), (dc.getHeight() / 2) - 80, Gfx.FONT_LARGE, schedule[1][2], Gfx.TEXT_JUSTIFY_CENTER );
+ dc.drawText( (dc.getWidth() / 2), (dc.getHeight() / 2) - 40, Gfx.FONT_SMALL, schedule[1][1], Gfx.TEXT_JUSTIFY_CENTER );
+ dc.drawText( (dc.getWidth() / 2), (dc.getHeight() / 2) - 20, Gfx.FONT_SMALL, schedule[1][3], Gfx.TEXT_JUSTIFY_CENTER );
+ dc.drawText( (dc.getWidth() / 2), (dc.getHeight() / 2) + 10, Gfx.FONT_SMALL, arr, Gfx.TEXT_JUSTIFY_CENTER );
+ dc.drawText( (dc.getWidth() / 2), (dc.getHeight() / 2) + 40, Gfx.FONT_SMALL, due, Gfx.TEXT_JUSTIFY_CENTER );
+ }
+ else {
+ dc.drawText( (dc.getWidth() / 2), (dc.getHeight() / 2), Gfx.FONT_SMALL, "No schedule avail", Gfx.TEXT_JUSTIFY_CENTER );
+ }
+ }
+
+ function setPosition(info) {
+ var url = "http://web.0l.de:8080/";
+ var parameters = { "Circle" => info.position.toDegrees()[0] + "," +
+ info.position.toDegrees()[1] + ",150",
+ "ReturnList" => "StopPointName,DestinationName,LineName,EstimatedTime" };
+ var options = { :method => Comm.HTTP_REQUEST_METHOD_GET };
+
+ Comm.makeJsonRequest(url, parameters, options, method(:requestCompleted));
+ }
+
+ function requestCompleted(responseCode, data) {
+ Sys.println("Request completed: " + responseCode);
+
+ if (responseCode == 200) {
+ schedule = data;
+ redraw();
+ }
+ }
+
+ function redraw() {
+ WatchUi.requestUpdate();
+ }
+}