libdrmconf 0.12.3
A library to program DMR radios.
Loading...
Searching...
No Matches
gpssystem.hh
1#ifndef GPSSYSTEM_H
2#define GPSSYSTEM_H
3
4#include "configreference.hh"
5#include <QAbstractTableModel>
6#include "anytone_extension.hh"
7#include "opengd77_extension.hh"
8
9class Config;
10class DMRContact;
11class DMRChannel;
12class FMChannel;
13
14
18{
19 Q_OBJECT
20 Q_CLASSINFO("IdPrefix", "aprs")
21
22
23 Q_PROPERTY(unsigned period READ period WRITE setPeriod)
24
25protected:
27 explicit PositioningSystem(QObject *parent=nullptr);
34 PositioningSystem(const QString &name, unsigned period=300, QObject *parent=nullptr);
35
36public:
38 virtual ~PositioningSystem();
39
41 unsigned period() const;
43 void setPeriod(unsigned period);
44
45public:
46 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
47 bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());
48
49protected:
50 bool populate(YAML::Node &node, const ConfigItem::Context &context, const ErrorStack &err=ErrorStack());
51
52protected slots:
55
56protected:
58 unsigned _period;
59};
60
61
65{
66 Q_OBJECT
67
69 Q_PROPERTY(DMRContactReference* contact READ contact WRITE setContact)
71 Q_PROPERTY(DMRChannelReference* revert READ revert)
72
73public:
75 Q_INVOKABLE explicit GPSSystem(QObject *parent=nullptr);
86 GPSSystem(const QString &name, DMRContact *contact=nullptr,
87 DMRChannel *revertChannel = nullptr, unsigned period=300,
88 QObject *parent = nullptr);
89
90 ConfigItem *clone() const;
91
93 bool hasContact() const;
95 DMRContact *contactObj() const;
97 void setContactObj(DMRContact *contactObj);
99 const DMRContactReference *contact() const;
103 void setContact(DMRContactReference *contactObj);
104
107 bool hasRevertChannel() const;
109 DMRChannel *revertChannel() const;
111 void setRevertChannel(DMRChannel *channel);
113 void resetRevertChannel();
114
116 const DMRChannelReference *revert() const;
119
120public:
121 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
122
123protected:
127 DMRChannelReference _revertChannel;
128};
129
130
134{
135 Q_OBJECT
136
138 Q_PROPERTY(FMChannelReference* revert READ revert)
140 Q_PROPERTY(QString destination READ destination WRITE setDestination SCRIPTABLE false)
142 Q_PROPERTY(unsigned int destSSID READ destSSID WRITE setDestSSID SCRIPTABLE false)
144 Q_PROPERTY(QString source READ source WRITE setSource SCRIPTABLE false)
146 Q_PROPERTY(unsigned int srcSSID READ srcSSID WRITE setSrcSSID SCRIPTABLE false)
148 Q_PROPERTY(QString path READ path WRITE setPath SCRIPTABLE false)
149
151 Q_PROPERTY(Icon icon READ icon WRITE setIcon)
153 Q_PROPERTY(QString message READ message WRITE setMessage)
155 Q_PROPERTY(AnytoneFMAPRSSettingsExtension *anytone READ anytoneExtension WRITE setAnytoneExtension)
157 Q_PROPERTY(OpenGD77APRSSystemExtension *opengd77 READ openGD77Extension WRITE setOpenGD77Extension)
158
159public:
160 static const unsigned PRIMARY_TABLE = (0<<8);
161 static const unsigned SECONDARY_TABLE = (1<<8);
162 static const unsigned TABLE_MASK = (3<<8);
163 static const unsigned ICON_MASK = 0x7f;
164
166 enum class Icon {
167 PoliceStation = (PRIMARY_TABLE | 0), None, Digipeater, Phone, DXCluster, HFGateway, SmallPlane,
168 MobileSatelliteStation, WheelChair, Snowmobile, RedCross, BoyScout, Home, X, RedDot,
169 Circle0, Circle1, Circle2, Circle3, Circle4, Circle5, Circle6, Circle7, Circle8, Circle9,
170 Fire, Campground, Motorcycle, RailEngine, Car, FileServer, HCFuture, AidStation, BBS, Canoe,
171 Eyeball = (PRIMARY_TABLE | 36), Tractor, GridSquare, Hotel, TCPIP, School = (PRIMARY_TABLE | 42),
172 Logon, MacOS, NTSStation, Balloon, PoliceCar, TBD, RV, Shuttle, SSTV, Bus, ATV, WXService, Helo,
173 Yacht, Windows, Jogger, Triangle, PBBS, LargePlane, WXStation, DishAntenna, Ambulance, Bike,
174 ICP, FireStation, Horse, FireTruck, Glider, Hospital, IOTA, Jeep, SmallTruck, Laptop, MicE,
175 Node, EOC, Rover, Grid, Antenna, PowerBoat, TruckStop, TruckLarge, Van, Water, XAPRS, Yagi,
176 Shelter
177 };
178 Q_ENUM(Icon)
179
180public:
182 Q_INVOKABLE explicit APRSSystem(QObject *parent=nullptr);
198 APRSSystem(const QString &name, FMChannel *channel, const QString &dest, unsigned destSSID,
199 const QString &src, unsigned srcSSID, const QString &path="", Icon icon=Icon::Jogger,
200 const QString &message="", unsigned period=300, QObject *parent=nullptr);
201
202 bool copy(const ConfigItem &other);
203 ConfigItem *clone() const;
204
207 bool hasRevertChannel() const;
209 FMChannel *revertChannel() const;
211 void setRevertChannel(FMChannel *revertChannel);
213 void resetRevertChannel();
214
216 const FMChannelReference *revert() const;
219
221 const QString &destination() const;
223 unsigned destSSID() const;
225 void setDestination(const QString &call, unsigned ssid);
227 void setDestination(const QString &call);
229 void setDestSSID(unsigned ssid);
230
232 const QString &source() const;
234 unsigned srcSSID() const;
236 void setSource(const QString &call, unsigned ssid);
238 void setSource(const QString &call);
240 void setSrcSSID(unsigned ssid);
241
243 const QString &path() const;
245 void setPath(const QString &path);
246
248 Icon icon() const;
250 void setIcon(Icon icon);
251
253 const QString &message() const;
255 void setMessage(const QString &msg);
256
258 AnytoneFMAPRSSettingsExtension *anytoneExtension() const;
260 void setAnytoneExtension(AnytoneFMAPRSSettingsExtension *ext);
261
263 OpenGD77APRSSystemExtension *openGD77Extension() const;
265 void setOpenGD77Extension(OpenGD77APRSSystemExtension *ext);
266
267public:
268 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
269 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
270
271protected:
272 bool populate(YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack());
273
274protected:
280 unsigned _destSSID;
282 QString _source;
284 unsigned _srcSSID;
286 QString _path;
290 QString _message;
295};
296
297
301{
302Q_OBJECT
303
304public:
306 explicit PositioningSystems(QObject *parent=nullptr);
307
309 PositioningSystem *system(int idx) const;
310
311 int add(ConfigObject *obj, int row=-1, bool unique=true);
312
314 int gpsCount() const;
317 int indexOfGPSSys(const GPSSystem *gps) const;
320 GPSSystem *gpsSystem(int idx) const;
321
323 int aprsCount() const;
326 int indexOfAPRSSys(APRSSystem *gps) const;
329 APRSSystem *aprsSystem(int idx) const;
330
331public:
332 ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
333};
334
335
336#endif // GPSSYSTEM_H
Represents an APRS system within the generic config.
Definition gpssystem.hh:134
AnytoneFMAPRSSettingsExtension * _anytone
Owns the Anytone settings extension.
Definition gpssystem.hh:292
QString _source
Holds the source call.
Definition gpssystem.hh:282
QString _destination
Holds the destination call.
Definition gpssystem.hh:278
OpenGD77APRSSystemExtension * _openGD77
Owns the OpenGD77 settings extension.
Definition gpssystem.hh:294
unsigned _destSSID
Holds the destination SSID.
Definition gpssystem.hh:280
QString _message
Holds the optional message.
Definition gpssystem.hh:290
FMChannelReference _channel
A weak reference to the transmit channel.
Definition gpssystem.hh:276
FMChannelReference * revert()
Returns a reference to the revert channel.
unsigned _srcSSID
Holds the source SSID.
Definition gpssystem.hh:284
QString _path
Holds the APRS path string.
Definition gpssystem.hh:286
Icon _icon
Holds the map icon.
Definition gpssystem.hh:288
Icon
All implemented APRS icons.
Definition gpssystem.hh:166
Implements some additional settings for the FM APRS system.
Definition anytone_extension.hh:2382
Parse context for config objects.
Definition configobject.hh:48
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:40
virtual bool copy(const ConfigItem &other)
Copies the given item into this one.
Definition configobject.cc:140
virtual ConfigItem * clone() const =0
Clones this item.
virtual YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition configobject.cc:366
List class for config objects.
Definition configobject.hh:349
Base class of all labeled and named objects.
Definition configobject.hh:199
QString name
The name of the object.
Definition configobject.hh:203
The config class, representing the codeplug configuration.
Definition config.hh:70
Implements a reference to a DMR channel.
Definition configreference.hh:139
Extension to the DigitalChannel class to implement an DMR channel.
Definition channel.hh:354
Represents a reference to a DMR contact.
Definition configreference.hh:99
Represents a digital contact, that is a DMR number.
Definition contact.hh:141
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition errorstack.hh:41
Implements a reference to a FM channel.
Definition configreference.hh:151
Extension to the AnalogChannel class to implement an analog FM channel.
Definition channel.hh:210
This class represents a GPS signalling system within the codeplug.
Definition gpssystem.hh:65
Definition opengd77_extension.hh:159
Base class of the positioning systems, that is APRS and DMR position reporting system.
Definition gpssystem.hh:18
bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack())
Links the given object to the rest of the codeplug using the given context.
Definition gpssystem.cc:66
unsigned _period
Holds the update period in seconds.
Definition gpssystem.hh:58
bool populate(YAML::Node &node, const ConfigItem::Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition gpssystem.cc:39
void onReferenceModified()
Gets called, whenever a reference is modified.
Definition gpssystem.cc:71
void setPeriod(unsigned period)
Sets the update period in seconds.
Definition gpssystem.cc:33
bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack())
Parses the given YAML node, updates the given object and updates the given context (IDs).
Definition gpssystem.cc:46
unsigned period
The update period in seconds.
Definition gpssystem.hh:23
The list of positioning systems.
Definition gpssystem.hh:301