| 1 |
/******************************************************************************* |
| 2 |
Copyright(c) 2017 Jasem Mutlaq. All rights reserved. |
| 3 |
|
| 4 |
INDI GPS NMEA Driver |
| 5 |
|
| 6 |
This program is free software; you can redistribute it and/or modify it |
| 7 |
under the terms of the GNU General Public License as published by the Free |
| 8 |
Software Foundation; either version 2 of the License, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 12 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 14 |
more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU Library General Public License |
| 17 |
along with this library; see the file COPYING.LIB. If not, write to |
| 18 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 |
Boston, MA 02110-1301, USA. |
| 20 |
|
| 21 |
The full GNU General Public License is included in this distribution in the |
| 22 |
file called LICENSE. |
| 23 |
*******************************************************************************/ |
| 24 |
|
| 25 |
#pragma once |
| 26 |
|
| 27 |
#include <indigps.h> |
| 28 |
|
| 29 |
class GPSNMEA : public INDI::GPS |
| 30 |
{ |
| 31 |
public: |
| 32 |
GPSNMEA(); |
| 33 |
virtual ~GPSNMEA() = default; |
| 34 |
|
| 35 |
IText GPSstatusT[1] {}; |
| 36 |
ITextVectorProperty GPSstatusTP; |
| 37 |
|
| 38 |
static void* parseNMEAHelper(void *); |
| 39 |
virtual bool setSystemTime(time_t& raw_time); |
| 40 |
|
| 41 |
protected: |
| 42 |
// Generic indi device entries |
| 43 |
virtual const char *getDefaultName() override; |
| 44 |
virtual bool initProperties() override; |
| 45 |
virtual bool updateProperties() override; |
| 46 |
virtual IPState updateGPS() override; |
| 47 |
|
| 48 |
private: |
| 49 |
Connection::TCP *tcpConnection { nullptr }; |
| 50 |
bool isNMEA(); |
| 51 |
void parseNEMA(); |
| 52 |
|
| 53 |
int PortFD { -1 }; |
| 54 |
uint8_t timeoutCounter=0; |
| 55 |
bool locationPending = true, timePending=true; |
| 56 |
|
| 57 |
pthread_mutex_t lock; |
| 58 |
pthread_t nmeaThread; |
| 59 |
}; |