upm  1.5.0
Sensor/Actuator repository for libmraa (v1.8.0)
nmea_gps.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 #pragma once
25 
26 #include <string>
27 #include <iostream>
28 
29 #include <stdlib.h>
30 #include <unistd.h>
31 
32 #include "nmea_gps.h"
33 
34 namespace upm {
67  class NMEAGPS {
68  public:
69 
79  NMEAGPS(unsigned int uart, unsigned int baudrate,
80  int enable_pin);
81 
89  NMEAGPS(unsigned int bus, uint8_t addr);
90 
94  ~NMEAGPS();
95 
102  std::string readStr(size_t size);
103 
111  int writeStr(std::string buffer);
112 
120  void enable(bool enable);
121 
129  void setBaudrate(unsigned int baudrate);
130 
142  bool dataAvailable(unsigned int millis);
143 
144  protected:
145  // nmeaGPS device context
146  nmea_gps_context m_nmea_gps;
147 
148  private:
149  /* Disable implicit copy and assignment operators */
150  NMEAGPS(const NMEAGPS&) = delete;
151  NMEAGPS &operator=(const NMEAGPS&) = delete;
152  };
153 }
154 
155 
int writeStr(std::string buffer)
Definition: nmea_gps.cxx:68
Definition: nmea_gps.h:51
API for the NMEA GPS Module.
Definition: nmea_gps.hpp:67
void enable(bool enable)
Definition: nmea_gps.cxx:80
Definition: a110x.hpp:29
NMEAGPS(unsigned int uart, unsigned int baudrate, int enable_pin)
Definition: nmea_gps.cxx:33
void setBaudrate(unsigned int baudrate)
Definition: nmea_gps.cxx:87
std::string readStr(size_t size)
Definition: nmea_gps.cxx:55
bool dataAvailable(unsigned int millis)
Definition: nmea_gps.cxx:94
~NMEAGPS()
Definition: nmea_gps.cxx:50