Qt Virtual Chart Table (QVCT)
CDeviceSample.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_CDEVICESAMPLE_HPP
20 #define QVCT_CDEVICESAMPLE_HPP
21 
22 
23 // QT
24 #include <QDomElement> // QtXml module
25 #include <QString>
26 #include <QXmlStreamWriter>
27 
28 // QVCT
29 #include "devices/CDevice.hpp"
31 
32 
34 class CDeviceSample: public CDevice
35 {
36  Q_OBJECT
37 
38  //------------------------------------------------------------------------------
39  // FIELDS
40  //------------------------------------------------------------------------------
41 
42  //
43  // Driver configuration parameters
44  //
45 
46 private:
48 
49  QString qsHost;
51 
52  int iPort;
53 
54 
55 
56  //------------------------------------------------------------------------------
57  // CONSTRUCTORS / DESTRUCTOR
58  //------------------------------------------------------------------------------
59 
60 public:
61  CDeviceSample( const QString& _rqsName );
62  virtual ~CDeviceSample();
63 
64 
65  //------------------------------------------------------------------------------
66  // METHODS: CDevice (implement/override)
67  //------------------------------------------------------------------------------
68 
69 public:
71 
72 public:
73  virtual CDeviceDriver::EDriver getDriver() const { return CDeviceDriver::SAMPLE; };
74  virtual int getCapabilities() const { return CDevice::FIX & CDevice::SKYVIEW; };
75 
76 public:
77  virtual void showDetail();
78  virtual void showEdit();
79 
80 public:
81  void parseQVCT( const QDomElement& _rqDomElement );
82  void dumpQVCT( QXmlStreamWriter & _rqXmlStreamWriter ) const;
83 
84 
85  //------------------------------------------------------------------------------
86  // METHODS
87  //------------------------------------------------------------------------------
88 
89  //
90  // Methods to process the device data and send corresponding CDeviceDataFix
91  // and/or CDeviceDataSkyView
92  //
93 
94  // SLOTS
95 private slots:
97  void slotProcessData( int );
98 
99  //
100  // Methods to set/retrieve driver configuration parameters
101  //
102 
103  // SETTERS
104 public:
105  // Sets GPSD's network host
106  void setHost( const QString& _rqsHost ) { qsHost = _rqsHost; };
107  // Sets GPSD's network port
108  void setPort( int _iPort ) { iPort = _iPort; };
109 
110  // GETTERS
111 public:
112  // Returns GPSD's network host
113  QString getHost() { return qsHost; };
114  // Returns GPSD's network port
115  int getPort() { return iPort; };
116 
117 };
118 
119 #endif // QVCT_CDEVICESAMPLE_HPP
EDriver
Driver ID.
SAMPLE_DRIVER.
void setHost(const QString &_rqsHost)
QVCT::EStatus setOperatingMode(CDevice::EOperatingMode _eOperatingMode)
Sets the device's operating mode.
virtual ~CDeviceSample()
void setPort(int _iPort)
void parseQVCT(const QDomElement &_rqDomElement)
Retrieves the device's configuration from the given QVCT source (file)
virtual int getCapabilities() const
Returns the device's capabilities.
virtual void showDetail()
Displays the device's details (in the appropriate widget/view)
QString getHost()
virtual void showEdit()
Displays the device's edit (configuration) widget/view.
void dumpQVCT(QXmlStreamWriter &_rqXmlStreamWriter) const
Stores the device's configuration to the given QVCT destination (file)
void slotProcessData(int)
Slots to process device data.
QString qsHost
Network host.
virtual CDeviceDriver::EDriver getDriver() const
Returns the device's driver ID.
int iPort
Network port.
CDeviceSample(const QString &_rqsName)
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