libdrmconf 0.12.1
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
8class Config;
9class DMRContact;
10class DMRChannel;
11class FMChannel;
12
13
17{
18 Q_OBJECT
19 Q_CLASSINFO("IdPrefix", "aprs")
20
21
22 Q_PROPERTY(unsigned period READ period WRITE setPeriod)
23
24protected:
26 explicit PositioningSystem(QObject *parent=nullptr);
33 PositioningSystem(const QString &name, unsigned period=300, QObject *parent=nullptr);
34
35public:
37 virtual ~PositioningSystem();
38
40 unsigned period() const;
42 void setPeriod(unsigned period);
43
44public:
45 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
46 bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());
47
48protected:
49 bool populate(YAML::Node &node, const ConfigItem::Context &context, const ErrorStack &err=ErrorStack());
50
51protected slots:
54
55protected:
57 unsigned _period;
58};
59
60
64{
65 Q_OBJECT
66
68 Q_PROPERTY(DMRContactReference* contact READ contact WRITE setContact)
70 Q_PROPERTY(DMRChannelReference* revert READ revert WRITE setRevert)
71
72public:
74 Q_INVOKABLE explicit GPSSystem(QObject *parent=nullptr);
85 GPSSystem(const QString &name, DMRContact *contact=nullptr,
86 DMRChannel *revertChannel = nullptr, unsigned period=300,
87 QObject *parent = nullptr);
88
89 ConfigItem *clone() const;
90
92 bool hasContact() const;
94 DMRContact *contactObj() const;
96 void setContactObj(DMRContact *contactObj);
98 const DMRContactReference *contact() const;
102 void setContact(DMRContactReference *contactObj);
103
106 bool hasRevertChannel() const;
108 DMRChannel *revertChannel() const;
110 void setRevertChannel(DMRChannel *channel);
112 const DMRChannelReference *revert() const;
116 void setRevert(DMRChannelReference *channel);
117
118public:
119 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
120
121protected:
125 DMRChannelReference _revertChannel;
126};
127
128
132{
133 Q_OBJECT
134
136 Q_PROPERTY(FMChannelReference* revert READ revert WRITE setRevert)
138 Q_PROPERTY(QString destination READ destination WRITE setDestination SCRIPTABLE false)
140 Q_PROPERTY(unsigned int destSSID READ destSSID WRITE setDestSSID SCRIPTABLE false)
142 Q_PROPERTY(QString source READ source WRITE setSource SCRIPTABLE false)
144 Q_PROPERTY(unsigned int srcSSID READ srcSSID WRITE setSrcSSID SCRIPTABLE false)
146 Q_PROPERTY(QString path READ path WRITE setPath SCRIPTABLE false)
147
149 Q_PROPERTY(Icon icon READ icon WRITE setIcon)
151 Q_PROPERTY(QString message READ message WRITE setMessage)
153 Q_PROPERTY(AnytoneFMAPRSSettingsExtension *anytone READ anytoneExtension WRITE setAnytoneExtension)
154
155public:
156 static const unsigned PRIMARY_TABLE = (0<<8);
157 static const unsigned SECONDARY_TABLE = (1<<8);
158 static const unsigned TABLE_MASK = (3<<8);
159 static const unsigned ICON_MASK = 0x7f;
160
162 enum class Icon {
163 PoliceStation = (PRIMARY_TABLE | 0), None, Digipeater, Phone, DXCluster, HFGateway, SmallPlane,
164 MobileSatelliteStation, WheelChair, Snowmobile, RedCross, BoyScout, Home, X, RedDot,
165 Circle0, Circle1, Circle2, Circle3, Circle4, Circle5, Circle6, Circle7, Circle8, Circle9,
166 Fire, Campground, Motorcycle, RailEngine, Car, FileServer, HCFuture, AidStation, BBS, Canoe,
167 Eyeball = (PRIMARY_TABLE | 36), Tractor, GridSquare, Hotel, TCPIP, School = (PRIMARY_TABLE | 42),
168 Logon, MacOS, NTSStation, Balloon, PoliceCar, TBD, RV, Shuttle, SSTV, Bus, ATV, WXService, Helo,
169 Yacht, Windows, Jogger, Triangle, PBBS, LargePlane, WXStation, DishAntenna, Ambulance, Bike,
170 ICP, FireStation, Horse, FireTruck, Glider, Hospital, IOTA, Jeep, SmallTruck, Laptop, MicE,
171 Node, EOC, Rover, Grid, Antenna, PowerBoat, TruckStop, TruckLarge, Van, Water, XAPRS, Yagi,
172 Shelter
173 };
174 Q_ENUM(Icon)
175
176public:
178 Q_INVOKABLE explicit APRSSystem(QObject *parent=nullptr);
194 APRSSystem(const QString &name, FMChannel *channel, const QString &dest, unsigned destSSID,
195 const QString &src, unsigned srcSSID, const QString &path="", Icon icon=Icon::Jogger,
196 const QString &message="", unsigned period=300, QObject *parent=nullptr);
197
198 bool copy(const ConfigItem &other);
199 ConfigItem *clone() const;
200
202 FMChannel *revertChannel() const;
204 void setRevertChannel(FMChannel *revertChannel);
206 const FMChannelReference *revert() const;
210 void setRevert(FMChannelReference *ref);
211
213 const QString &destination() const;
215 unsigned destSSID() const;
217 void setDestination(const QString &call, unsigned ssid);
219 void setDestination(const QString &call);
221 void setDestSSID(unsigned ssid);
222
224 const QString &source() const;
226 unsigned srcSSID() const;
228 void setSource(const QString &call, unsigned ssid);
230 void setSource(const QString &call);
232 void setSrcSSID(unsigned ssid);
233
235 const QString &path() const;
237 void setPath(const QString &path);
238
240 Icon icon() const;
242 void setIcon(Icon icon);
243
245 const QString &message() const;
247 void setMessage(const QString &msg);
248
250 AnytoneFMAPRSSettingsExtension *anytoneExtension() const;
252 void setAnytoneExtension(AnytoneFMAPRSSettingsExtension *ext);
253
254public:
255 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
256 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
257
258protected:
259 bool populate(YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack());
260
261protected:
267 unsigned _destSSID;
269 QString _source;
271 unsigned _srcSSID;
273 QString _path;
277 QString _message;
280};
281
282
286{
287Q_OBJECT
288
289public:
291 explicit PositioningSystems(QObject *parent=nullptr);
292
294 PositioningSystem *system(int idx) const;
295
296 int add(ConfigObject *obj, int row=-1, bool unique=true);
297
299 int gpsCount() const;
302 int indexOfGPSSys(const GPSSystem *gps) const;
305 GPSSystem *gpsSystem(int idx) const;
306
308 int aprsCount() const;
311 int indexOfAPRSSys(APRSSystem *gps) const;
314 APRSSystem *aprsSystem(int idx) const;
315
316public:
317 ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
318};
319
320
321#endif // GPSSYSTEM_H
Represents an APRS system within the generic config.
Definition gpssystem.hh:132
AnytoneFMAPRSSettingsExtension * _anytone
Owns the Anytone settings extension.
Definition gpssystem.hh:279
QString _source
Holds the source call.
Definition gpssystem.hh:269
QString _destination
Holds the destination call.
Definition gpssystem.hh:265
unsigned _destSSID
Holds the destination SSID.
Definition gpssystem.hh:267
QString _message
Holds the optional message.
Definition gpssystem.hh:277
FMChannelReference _channel
A weak reference to the transmit channel.
Definition gpssystem.hh:263
FMChannelReference * revert()
Returns a reference to the revert channel.
unsigned _srcSSID
Holds the source SSID.
Definition gpssystem.hh:271
QString _path
Holds the APRS path string.
Definition gpssystem.hh:273
Icon _icon
Holds the map icon.
Definition gpssystem.hh:275
Icon
All implemented APRS icons.
Definition gpssystem.hh:162
Implements some additional settings for the FM APRS system.
Definition anytone_extension.hh:2368
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:64
Base class of the positioning systems, that is APRS and DMR position reporting system.
Definition gpssystem.hh:17
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:57
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:22
The list of positioning systems.
Definition gpssystem.hh:286