This is an example application based on Mbed-OS LoRaWAN protocol APIs. The Mbed-OS LoRaWAN stack implementation is compliant with LoRaWAN v1.0.2 specification.

Dependencies:   Lorawan_Version_0_1

Dependents:   Lorawan_Version_0_1

Revision:
63:2bfceda4c30c
Parent:
62:35d41c8b9419
Child:
64:85fa08519e1e
--- a/GPS/GPS.cpp	Tue Dec 03 16:02:12 2019 +0000
+++ b/GPS/GPS.cpp	Wed Dec 11 19:35:25 2019 +0000
@@ -28,29 +28,53 @@
     _gps.baud(Baud);
     longitude = 0.0;
     latitude = 0.0;
+    _gps.printf("$$PMTK161,1*28\r\n");  //wake up
 }
  
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
 int GPS::sample()
 {
  
     int lock;
+    int h;
  
-    while(1) {
-        printf("GPS 1");
+        printf("GPS suchen:"); 
+    
+    for (h = 0; h < 6; h++) 
+  {
+        printf("\n%Try: %i:",h); 
         getline();
-        printf("GPS 2");
-        i=i+1;
-        printf("%d",i);
+  
+        
+        
         // Check if it is a GPGGA msg (matches both locked and non-locked msg)
-        if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f,%c,%f", &time, &latitude, &ns, &longitude, &ew, &lock, &sats, &hdop, &alt, &unit, &geoid) >= 1) {
-            if(!lock) {
-                time = 0.0;
-                longitude = 0.0;
-                latitude = 0.0;
-                sats = 0;
-                hdop = 0.0;
-                alt = 0.0;
-                geoid = 0.0;
+         //if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f,%c,%f", &time, &latitude, &ns, &longitude, &ew, &lock, &sats, &hdop, &alt, &unit, &geoid) >= 1) {
+               
+        //printf("\nQualität: %f %f %f\n",time,longitude,latitude); 
+        
+        
+        if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f,%c,%f", &time, &latitude, &ns, &longitude, &ew, &lock, &sats, &hdop, &alt, &unit, &geoid)>0) {
+            if(false) { 
+                //time = 0.0;
+                //longitude = 0.0;
+                //latitude = 0.0;
+                //sats = 0;
+                ////hdop = 0.0;
+                //alt = 0.0;
+                //geoid = 0.0;
+                
+                printf("\n Fehler: %f %ih %im %is\n",time,hour,minute,seconed); 
                 return 0;
             } else {
                 //GPGGA format according http://aprs.gids.nl/nmea/#gga
@@ -59,15 +83,22 @@
                 //GPGGA,092010.000,5210.9546,N,00008.8913,E,1,07,1.3,9.7,M,47.0,M,,0000*5D
  
                 //format utc time to beijing time,add 8 time zone
-                time = time + 80000.00f;
+                time = time;// + 80000.00f;
                 hour = int(time) / 10000;
                 minute = (int(time) % 10000) / 100;
                 seconed = int(time) % 100;
-            
+                
+                printf("\n Erfolg: %f %ih %im %is\n",time,hour,minute,seconed); 
+                
                 return 1;
             }
-        }
-    }
+        }    
+        
+        }   
+        
+        return 0 ;
+        
+        
 }
  
 float GPS::trunc(float v)
@@ -84,11 +115,17 @@
  
 void GPS::getline()
 {
+       
     while(_gps.getc() != '$');    // wait for the start of a line
     for(int i=0; i<256; i++) {
         msg[i] = _gps.getc();
+        printf("%c",msg[i]); 
         if(msg[i] == '\r') {
             msg[i] = 0;
+            
+                if (msg[3] == 'S' and msg[4] == 'V') 
+                {printf("\nAnzahl Satelliten: %c",msg[11]);      }          
+            
             return;
         }
     }