Gps
Dependencies: mbed
Fork of GPS_System_with_Google_Maps by
GPS.h@3:3c7906d60f89, 2012-12-13 (annotated)
- Committer:
- Ifrah
- Date:
- Thu Dec 13 23:59:40 2012 +0000
- Revision:
- 3:3c7906d60f89
Getting Google Maps based on the GPS coordinates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Ifrah | 3:3c7906d60f89 | 1 | /* mbed EM-406 GPS Module Library |
Ifrah | 3:3c7906d60f89 | 2 | * Copyright (c) 2008-2010, sford |
Ifrah | 3:3c7906d60f89 | 3 | * |
Ifrah | 3:3c7906d60f89 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
Ifrah | 3:3c7906d60f89 | 5 | * of this software and associated documentation files (the "Software"), to deal |
Ifrah | 3:3c7906d60f89 | 6 | * in the Software without restriction, including without limitation the rights |
Ifrah | 3:3c7906d60f89 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
Ifrah | 3:3c7906d60f89 | 8 | * copies of the Software, and to permit persons to whom the Software is |
Ifrah | 3:3c7906d60f89 | 9 | * furnished to do so, subject to the following conditions: |
Ifrah | 3:3c7906d60f89 | 10 | * |
Ifrah | 3:3c7906d60f89 | 11 | * The above copyright notice and this permission notice shall be included in |
Ifrah | 3:3c7906d60f89 | 12 | * all copies or substantial portions of the Software. |
Ifrah | 3:3c7906d60f89 | 13 | * |
Ifrah | 3:3c7906d60f89 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Ifrah | 3:3c7906d60f89 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Ifrah | 3:3c7906d60f89 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
Ifrah | 3:3c7906d60f89 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
Ifrah | 3:3c7906d60f89 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
Ifrah | 3:3c7906d60f89 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
Ifrah | 3:3c7906d60f89 | 20 | * THE SOFTWARE. |
Ifrah | 3:3c7906d60f89 | 21 | */ |
Ifrah | 3:3c7906d60f89 | 22 | |
Ifrah | 3:3c7906d60f89 | 23 | #include "mbed.h" |
Ifrah | 3:3c7906d60f89 | 24 | |
Ifrah | 3:3c7906d60f89 | 25 | #ifndef MBED_GPS_H |
Ifrah | 3:3c7906d60f89 | 26 | #define MBED_GPS_H |
Ifrah | 3:3c7906d60f89 | 27 | |
Ifrah | 3:3c7906d60f89 | 28 | /** A GPS interface for reading from a Globalsat EM-406 GPS Module */ |
Ifrah | 3:3c7906d60f89 | 29 | class GPS { |
Ifrah | 3:3c7906d60f89 | 30 | public: |
Ifrah | 3:3c7906d60f89 | 31 | |
Ifrah | 3:3c7906d60f89 | 32 | /** Create the GPS interface, connected to the specified serial port |
Ifrah | 3:3c7906d60f89 | 33 | */ |
Ifrah | 3:3c7906d60f89 | 34 | GPS(PinName tx, PinName rx); |
Ifrah | 3:3c7906d60f89 | 35 | |
Ifrah | 3:3c7906d60f89 | 36 | /** Sample the incoming GPS data, returning whether there is a lock |
Ifrah | 3:3c7906d60f89 | 37 | * |
Ifrah | 3:3c7906d60f89 | 38 | * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 |
Ifrah | 3:3c7906d60f89 | 39 | */ |
Ifrah | 3:3c7906d60f89 | 40 | int sample(); |
Ifrah | 3:3c7906d60f89 | 41 | |
Ifrah | 3:3c7906d60f89 | 42 | /** The longitude (call sample() to set) */ |
Ifrah | 3:3c7906d60f89 | 43 | float longitude; |
Ifrah | 3:3c7906d60f89 | 44 | |
Ifrah | 3:3c7906d60f89 | 45 | /** The latitude (call sample() to set) */ |
Ifrah | 3:3c7906d60f89 | 46 | float latitude; |
Ifrah | 3:3c7906d60f89 | 47 | |
Ifrah | 3:3c7906d60f89 | 48 | private: |
Ifrah | 3:3c7906d60f89 | 49 | float trunc(float v); |
Ifrah | 3:3c7906d60f89 | 50 | void getline(); |
Ifrah | 3:3c7906d60f89 | 51 | |
Ifrah | 3:3c7906d60f89 | 52 | Serial _gps; |
Ifrah | 3:3c7906d60f89 | 53 | char msg[256]; |
Ifrah | 3:3c7906d60f89 | 54 | |
Ifrah | 3:3c7906d60f89 | 55 | }; |
Ifrah | 3:3c7906d60f89 | 56 | |
Ifrah | 3:3c7906d60f89 | 57 | #endif |