forked from arduino/ArduinoCore-mbed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGPS.h
62 lines (51 loc) · 1.63 KB
/
GPS.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
GPS.h - Library for GSM on mbed platforms.
Copyright (c) 2011-2021 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GPS_h
#define GPS_h
#include "api/HardwareSerial.h"
#include "Arduino.h"
#include "CMUXClass.h"
#include "PTYSerial.h"
#include "GSM.h"
namespace arduino {
class GPSClass : public HardwareSerial {
public:
GPSClass();
~GPSClass();
void begin(unsigned long baudrate = 115200);
void begin(unsigned long baudrate, uint16_t config);
void end(void);
int available(void);
int peek(void);
int read(void);
void flush(void);
size_t write(uint8_t);
size_t write(char * buffer);
size_t write(char * buffer, size_t sz);
operator bool();
protected:
bool checkGNSSEngine(const char * prefix);
void readAndPrint();
void readAndDrop();
mbed::CircularBuffer<char, 1500U> * _rxbuf;
events::EventQueue _queue;
private:
PTYSerial * _serial;
bool _engine = false;
};
}
extern GPSClass GPS;
#endif