The program sends the current location over the cellular network.

Dependencies:   aconno_I2C ublox-at-cellular-interface gnss ublox-cellular-base Lis2dh12 ublox-cellular-base-n2xx ublox-at-cellular-interface-n2xx low-power-sleep

Fork of example-gnss by u-blox

Revision:
8:2bf886335fd0
Child:
9:f943c09d9173
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tasks/tasks.cpp	Fri Nov 30 16:19:41 2018 +0100
@@ -0,0 +1,85 @@
+/**
+ * Collection of all tasks  
+ * Made by Jurica @ aconno
+ * More info @ aconno.de
+ * 
+ */
+
+#include "tasks.h"
+#include "aconnoHelpers.h"
+#include "gnss.h"
+#include "aconnoConfig.h"
+
+extern MainStates state;
+extern char locationGlobal[UDP_MSG_SIZE_B];
+
+void idleCallback()
+{
+    while(1)
+    {
+        Thread::signal_wait(IDLE_SIGNAL);
+        Thread::signal_clr(IDLE_SIGNAL);
+        printf("In idle thread.\r\n");
+        while(state == STATE_IDLE)
+        {   
+            wait_ms(1000);
+        }
+    }
+}
+
+void alarmCallback(myParams_t *myParams)
+{
+    //char udpMsg[UDP_MSG_SIZE_B];
+    
+    while(1)
+    {
+        Thread::signal_wait(ALARM_SIGNAL);
+        Thread::signal_clr(ALARM_SIGNAL);
+        printf("Alarm thread.\r\n");
+        while(state == STATE_ALARM)
+        {
+            printf("Sending location on server...\r\n");
+            myParams->sara->sendUdpMsg(locationGlobal);
+            wait_ms(5000);
+        }
+    }
+}
+
+void alarmOffCallback()
+{
+    while(1)
+    {   
+        Thread::signal_wait(ALARM_OFF_SIGNAL);
+        Thread::signal_clr(ALARM_OFF_SIGNAL);
+        printf("In alarm off thread.\r\n");
+        while(state == STATE_ALARM_OFF)
+        {
+            wait_ms(1000);
+        }
+    }
+}
+
+void movementCallback()
+{
+    while(1)
+    {
+        while(state == STATE_LIS_DETECTION)
+        {
+            printf("In movement thread.\r\n");
+            wait_ms(1000);
+        }
+    }
+}
+
+void gnssLocationCallback(GnssSerial *gnss)
+{
+    while(1)
+    {
+        while(state == STATE_ALARM)
+        {
+            getGPSData(locationGlobal, gnss);
+            Thread::wait(UPDATE_LOCATION_TIME_MS);
+        }
+    }
+}
+