Qt Virtual Chart Table (QVCT)
CDeviceGpsdAis.hpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Qt Virtual Chart Table (QVCT)
5  * Copyright (C) 2012 Cedric Dufour <http://cedric.dufour.name>
6  * Author: Cedric Dufour <http://cedric.dufour.name>
7  *
8  * The Qt Virtual Chart Table (QVCT) is free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Qt Virtual Chart Table (QVCT) is distributed in the hope
13  * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
14  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  *
16  * See the GNU General Public License for more details.
17  */
18 
19 #ifndef QVCT_CDEVICEGPSDAIS_HPP
20 #define QVCT_CDEVICEGPSDAIS_HPP
21 
22 // GPSD
23 #include "gps.h"
24 #if GPSD_API_MAJOR_VERSION < 4
25 #error "Unsupported GPSD API version (<4)"
26 #endif
27 // #include "gpsdclient.h"
28 
29 
30 // QT
31 #include <QDomElement> // QtXml module
32 #include <QSocketNotifier>
33 #include <QString>
34 #include <QXmlStreamWriter>
35 
36 // QVCT
37 #include "devices/CDevice.hpp"
39 
40 
42 
47 class CDeviceGpsdAis: public CDevice
48 {
49  Q_OBJECT
50 
51  //------------------------------------------------------------------------------
52  // FIELDS
53  //------------------------------------------------------------------------------
54 
55 private:
57 
58  QString qsHost;
60 
61  int iPort;
63 
64  struct gps_data_t sGpsData;
66  struct gps_data_t* psGpsData;
68  QSocketNotifier* pqSocketNotifier;
70  bool bPaused;
71 
72 
73  //------------------------------------------------------------------------------
74  // CONSTRUCTORS / DESTRUCTOR
75  //------------------------------------------------------------------------------
76 
77 public:
78  CDeviceGpsdAis( const QString& _rqsName );
79  virtual ~CDeviceGpsdAis();
80 
81 
82  //------------------------------------------------------------------------------
83  // METHODS: CDevice (implement/override)
84  //------------------------------------------------------------------------------
85 
86 public:
88 
89 public:
91  virtual int getCapabilities() const { return CDevice::FIX; };
92 
93 public:
94  virtual void showDetail();
95  virtual void showEdit();
96 
97 public:
98  void parseQVCT( const QDomElement& _rqDomElement );
99  void dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const;
100 
101 
102  //------------------------------------------------------------------------------
103  // METHODS
104  //------------------------------------------------------------------------------
105 
106  // SLOTS
107 private slots:
109  void slotProcessData( int );
110 
111  // SETTERS
112 public:
113  // Sets GPSD's network host
114  void setHost( const QString& _rqsHost ) { qsHost = _rqsHost; };
115  // Sets GPSD's network port
116  void setPort( int _iPort ) { iPort = _iPort; };
117 
118  // GETTERS
119 public:
120  // Returns GPSD's network host
121  QString getHost() { return qsHost; };
122  // Returns GPSD's network port
123  int getPort() { return iPort; };
124 
125  // OTHER
126 private:
135 
136 };
137 
138 #endif // QVCT_CDEVICEGPSDAIS_HPP
EDriver
Driver ID.
@ GPSD_AIS
GPSD daemon (AIS mode)
GPSD daemon (GPS mode) navigation device.
virtual CDeviceDriver::EDriver getDriver() const
Returns the device's driver ID.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores the device's configuration to the given QVCT destination (file)
QVCT::EStatus setOperatingMode(CDevice::EOperatingMode _eOperatingMode)
Sets the device's operating mode.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves the device's configuration from the given QVCT source (file)
QVCT::EStatus stop()
Start the device.
QString qsHost
Network host.
virtual void showDetail()
Displays the device's details (in the appropriate widget/view)
QVCT::EStatus start()
Stop the device.
virtual int getCapabilities() const
Returns the device's capabilities.
int iPort
Network port.
void slotProcessData(int)
Slots to process device data.
CDeviceGpsdAis(const QString &_rqsName)
CDevice::EOperatingMode status()
Returns the device's status (operating mode)
bool bPaused
Pause status.
QVCT::EStatus pause()
Pause the device.
virtual ~CDeviceGpsdAis()
void setPort(int _iPort)
struct gps_data_t sGpsData
GPSD data.
struct gps_data_t * psGpsData
GPSD data pointer.
virtual void showEdit()
Displays the device's edit (configuration) widget/view.
QSocketNotifier * pqSocketNotifier
Socket notifier.
void setHost(const QString &_rqsHost)
Generic navigation device (GPS, speedometer, compass, etc.)
Definition: CDevice.hpp:43
@ FIX
Device emits 'newDataFix' signal.
Definition: CDevice.hpp:54
EOperatingMode
Device operating mode (stop, start, pause)
Definition: CDevice.hpp:58
EStatus
Definition: QVCT.hpp:41