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
GPS/GPS.h@73:974c1df98553, 2020-01-31 (annotated)
- Committer:
- jacktractive
- Date:
- Fri Jan 31 08:58:37 2020 +0000
- Revision:
- 73:974c1df98553
- Parent:
- 72:67c5bce77999
mode change over the air;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jacktractive | 61:2b30d8e75fe7 | 1 | /* mbed GPS Module Library |
jacktractive | 61:2b30d8e75fe7 | 2 | * Copyright (c) 2008-2010, sford |
jacktractive | 61:2b30d8e75fe7 | 3 | * Copyright (c) 2013, B.Adryan |
jacktractive | 61:2b30d8e75fe7 | 4 | * |
jacktractive | 61:2b30d8e75fe7 | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
jacktractive | 61:2b30d8e75fe7 | 6 | * of this software and associated documentation files (the "Software"), to deal |
jacktractive | 61:2b30d8e75fe7 | 7 | * in the Software without restriction, including without limitation the rights |
jacktractive | 61:2b30d8e75fe7 | 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
jacktractive | 61:2b30d8e75fe7 | 9 | * copies of the Software, and to permit persons to whom the Software is |
jacktractive | 61:2b30d8e75fe7 | 10 | * furnished to do so, subject to the following conditions: |
jacktractive | 61:2b30d8e75fe7 | 11 | * |
jacktractive | 61:2b30d8e75fe7 | 12 | * The above copyright notice and this permission notice shall be included in |
jacktractive | 61:2b30d8e75fe7 | 13 | * all copies or substantial portions of the Software. |
jacktractive | 61:2b30d8e75fe7 | 14 | * |
jacktractive | 61:2b30d8e75fe7 | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
jacktractive | 61:2b30d8e75fe7 | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
jacktractive | 61:2b30d8e75fe7 | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
jacktractive | 61:2b30d8e75fe7 | 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
jacktractive | 61:2b30d8e75fe7 | 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
jacktractive | 61:2b30d8e75fe7 | 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
jacktractive | 61:2b30d8e75fe7 | 21 | * THE SOFTWARE. |
jacktractive | 61:2b30d8e75fe7 | 22 | */ |
jacktractive | 61:2b30d8e75fe7 | 23 | |
jacktractive | 61:2b30d8e75fe7 | 24 | #include "mbed.h" |
jacktractive | 61:2b30d8e75fe7 | 25 | |
jacktractive | 61:2b30d8e75fe7 | 26 | #ifndef MBED_GPS_H |
jacktractive | 61:2b30d8e75fe7 | 27 | #define MBED_GPS_H |
jacktractive | 61:2b30d8e75fe7 | 28 | |
jacktractive | 61:2b30d8e75fe7 | 29 | /** A GPS interface for reading from a serial GPS module */ |
jacktractive | 61:2b30d8e75fe7 | 30 | class GPS { |
jacktractive | 61:2b30d8e75fe7 | 31 | public: |
jacktractive | 61:2b30d8e75fe7 | 32 | |
jacktractive | 61:2b30d8e75fe7 | 33 | /** Create the GPS interface, connected to the specified serial port and speed. |
jacktractive | 61:2b30d8e75fe7 | 34 | * for example, GlobalSat EM406-A (e.g. on SparkFun GPS Shield) is 4800 Baud, |
jacktractive | 61:2b30d8e75fe7 | 35 | * Adafruit Ultimate GPSv3 (connected to serial) is 9600 Baud |
jacktractive | 61:2b30d8e75fe7 | 36 | */ |
jacktractive | 70:65b2f1cc2859 | 37 | GPS(PinName tx, PinName rx, int Baud,DigitalOut *gps_off); |
jacktractive | 61:2b30d8e75fe7 | 38 | |
jacktractive | 61:2b30d8e75fe7 | 39 | /** Sample the incoming GPS data, returning whether there is a lock |
jacktractive | 61:2b30d8e75fe7 | 40 | * |
jacktractive | 61:2b30d8e75fe7 | 41 | * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 |
jacktractive | 61:2b30d8e75fe7 | 42 | */ |
jacktractive | 61:2b30d8e75fe7 | 43 | int sample(); |
jacktractive | 61:2b30d8e75fe7 | 44 | |
jacktractive | 69:316fee01f5d9 | 45 | void idle(bool idle); |
jacktractive | 70:65b2f1cc2859 | 46 | void set_manual_tracking(bool mt) ; |
jacktractive | 72:67c5bce77999 | 47 | void get_Position(); |
jacktractive | 61:2b30d8e75fe7 | 48 | |
jacktractive | 61:2b30d8e75fe7 | 49 | /** Beijig time format(shi,fen,miao) **/ |
jacktractive | 61:2b30d8e75fe7 | 50 | int hour; |
jacktractive | 61:2b30d8e75fe7 | 51 | int minute; |
jacktractive | 61:2b30d8e75fe7 | 52 | int seconed; |
jacktractive | 61:2b30d8e75fe7 | 53 | |
jacktractive | 61:2b30d8e75fe7 | 54 | /** The longitude (call sample() to set) */ |
jacktractive | 61:2b30d8e75fe7 | 55 | float longitude; |
jacktractive | 61:2b30d8e75fe7 | 56 | |
jacktractive | 61:2b30d8e75fe7 | 57 | /** display north/south, east/west unit**/ |
jacktractive | 61:2b30d8e75fe7 | 58 | char ns, ew, unit; |
jacktractive | 61:2b30d8e75fe7 | 59 | |
jacktractive | 61:2b30d8e75fe7 | 60 | /** The latitude (call sample() to set) */ |
jacktractive | 61:2b30d8e75fe7 | 61 | float latitude; |
jacktractive | 61:2b30d8e75fe7 | 62 | |
jacktractive | 61:2b30d8e75fe7 | 63 | /** The time (call sample() to set) */ |
jacktractive | 61:2b30d8e75fe7 | 64 | float time; |
jacktractive | 61:2b30d8e75fe7 | 65 | |
jacktractive | 61:2b30d8e75fe7 | 66 | /** Number of satellites received (call sample() to set) */ |
jacktractive | 61:2b30d8e75fe7 | 67 | int sats; |
jacktractive | 61:2b30d8e75fe7 | 68 | |
jacktractive | 61:2b30d8e75fe7 | 69 | /** Horizontal dilusion of precision (call sample() to set) */ |
jacktractive | 61:2b30d8e75fe7 | 70 | float hdop; |
jacktractive | 61:2b30d8e75fe7 | 71 | |
jacktractive | 61:2b30d8e75fe7 | 72 | /** The altitude (call sample() to set) |
jacktractive | 61:2b30d8e75fe7 | 73 | Note that the accurate altitude is corrected by the geoid |
jacktractive | 61:2b30d8e75fe7 | 74 | See http://homepages.slingshot.co.nz/~geoff36/datum.htm |
jacktractive | 61:2b30d8e75fe7 | 75 | */ |
jacktractive | 61:2b30d8e75fe7 | 76 | float alt; |
jacktractive | 61:2b30d8e75fe7 | 77 | |
jacktractive | 61:2b30d8e75fe7 | 78 | /** The geoid (call sample() to set) */ |
jacktractive | 61:2b30d8e75fe7 | 79 | float geoid; |
jacktractive | 61:2b30d8e75fe7 | 80 | |
jacktractive | 69:316fee01f5d9 | 81 | bool is_idle; |
jacktractive | 70:65b2f1cc2859 | 82 | bool manual_tracking; |
jacktractive | 69:316fee01f5d9 | 83 | |
jacktractive | 73:974c1df98553 | 84 | int mode; |
jacktractive | 73:974c1df98553 | 85 | |
jacktractive | 71:ca2425c0a864 | 86 | bool GPS_signal_okay; |
jacktractive | 71:ca2425c0a864 | 87 | |
jacktractive | 61:2b30d8e75fe7 | 88 | /** The NMEA sentence */ |
jacktractive | 61:2b30d8e75fe7 | 89 | char msg[256]; |
jacktractive | 61:2b30d8e75fe7 | 90 | |
jacktractive | 61:2b30d8e75fe7 | 91 | |
jacktractive | 61:2b30d8e75fe7 | 92 | private: |
jacktractive | 61:2b30d8e75fe7 | 93 | float trunc(float v); |
jacktractive | 61:2b30d8e75fe7 | 94 | void getline(); |
jacktractive | 70:65b2f1cc2859 | 95 | DigitalOut *gps_off; |
jacktractive | 61:2b30d8e75fe7 | 96 | |
jacktractive | 61:2b30d8e75fe7 | 97 | //create a serial object |
jacktractive | 61:2b30d8e75fe7 | 98 | Serial _gps; |
jacktractive | 61:2b30d8e75fe7 | 99 | }; |
jacktractive | 61:2b30d8e75fe7 | 100 | |
jacktractive | 61:2b30d8e75fe7 | 101 | #endif |