Qt Virtual Chart Table (QVCT)
CDeviceGpsdGps.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_CDEVICEGPSDGPS_HPP
20 #define QVCT_CDEVICEGPSDGPS_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 CDeviceGpsdGps: public CDevice
48 {
49  Q_OBJECT
50 
51  //------------------------------------------------------------------------------
52  // FIELDS
53  //------------------------------------------------------------------------------
54 
55 private:
57 
58  QString qsHost;
60 
61  int iPort;
63 
64  QString qsSource;
66 
67  struct gps_data_t sGpsData;
68  // /// GPSD source filter
69  // /** @see gpsdclient.h */
70  // struct fixsource_t sGpsSource;
72  struct gps_data_t* psGpsData;
74  QSocketNotifier* pqSocketNotifier;
76  bool bPaused;
77 
78 
79  //------------------------------------------------------------------------------
80  // CONSTRUCTORS / DESTRUCTOR
81  //------------------------------------------------------------------------------
82 
83 public:
84  CDeviceGpsdGps( const QString& _rqsName );
85  virtual ~CDeviceGpsdGps();
86 
87 
88  //------------------------------------------------------------------------------
89  // METHODS: CDevice (implement/override)
90  //------------------------------------------------------------------------------
91 
92 public:
94 
95 public:
97  virtual int getCapabilities() const { return CDevice::FIX & CDevice::SKYVIEW; };
98 
99 public:
100  virtual void showDetail();
101  virtual void showEdit();
102 
103 public:
104  void parseQVCT( const QDomElement& _rqDomElement );
105  void dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const;
106 
107 
108  //------------------------------------------------------------------------------
109  // METHODS
110  //------------------------------------------------------------------------------
111 
112  // SLOTS
113 private slots:
115  void slotProcessData( int );
116 
117  // SETTERS
118 public:
119  // Sets GPSD's network host
120  void setHost( const QString& _rqsHost ) { qsHost = _rqsHost; };
121  // Sets GPSD's network port
122  void setPort( int _iPort ) { iPort = _iPort; };
123  // Sets GPSD's source (filter)
124  void setSource( const QString& _rqsSource ) { qsSource = _rqsSource; };
125 
126  // GETTERS
127 public:
128  // Returns GPSD's network host
129  QString getHost() { return qsHost; };
130  // Returns GPSD's network port
131  int getPort() { return iPort; };
132  // Returns GPSD's source (filter)
133  QString getSource() { return qsSource; };
134 
135  // OTHER
136 private:
145 
146 };
147 
148 #endif // QVCT_CDEVICEGPSDGPS_HPP
EDriver
Driver ID.
@ GPSD_GPS
GPSD daemon (GPS mode)
GPSD daemon (GPS mode) navigation device.
struct gps_data_t sGpsData
GPSD data.
bool bPaused
Pause status.
int iPort
Network port.
virtual CDeviceDriver::EDriver getDriver() const
Returns the device's driver ID.
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves the device's configuration from the given QVCT source (file)
CDeviceGpsdGps(const QString &_rqsName)
void setPort(int _iPort)
virtual int getCapabilities() const
Returns the device's capabilities.
void setHost(const QString &_rqsHost)
virtual ~CDeviceGpsdGps()
QVCT::EStatus setOperatingMode(CDevice::EOperatingMode _eOperatingMode)
Sets the device's operating mode.
QString qsSource
Source (filter)
QVCT::EStatus start()
Stop the device.
struct gps_data_t * psGpsData
GPSD data pointer.
virtual void showDetail()
Displays the device's details (in the appropriate widget/view)
QString qsHost
Network host.
virtual void showEdit()
Displays the device's edit (configuration) widget/view.
QVCT::EStatus stop()
Start the device.
void setSource(const QString &_rqsSource)
QVCT::EStatus pause()
Pause the device.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores the device's configuration to the given QVCT destination (file)
QSocketNotifier * pqSocketNotifier
Socket notifier.
CDevice::EOperatingMode status()
Returns the device's status (operating mode)
void slotProcessData(int)
Slots to process device data.
Generic navigation device (GPS, speedometer, compass, etc.)
Definition: CDevice.hpp:43
@ SKYVIEW
Device emits 'newDataSkyView' signal.
Definition: CDevice.hpp:55
@ 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