libdrmconf 0.15.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#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(Interval period READ period WRITE setPeriod SCRIPTABLE false)
24
25protected:
27 explicit PositionReportingSystem(QObject *parent=nullptr);
34 PositionReportingSystem(const QString &name, const Interval &period=Interval::fromMinutes(5),
35 QObject *parent=nullptr);
36
37public:
39 virtual ~PositionReportingSystem();
40
42 bool periodDisabled() const;
44 Interval period() const;
46 void setPeriod(const Interval &period);
48 void disablePeriod();
49
50public:
51 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
52 bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());
53
54protected:
55 bool populate(YAML::Node &node, const ConfigItem::Context &context, const ErrorStack &err=ErrorStack());
56
57protected slots:
60
61protected:
64};
65
66
70{
71 Q_OBJECT
72
77
78public:
80 Q_INVOKABLE explicit DMRAPRSSystem(QObject *parent=nullptr);
91 DMRAPRSSystem(const QString &name, DMRContact *contact=nullptr,
92 DMRChannel *revertChannel = nullptr, const Interval &period=Interval::fromMinutes(5),
93 QObject *parent = nullptr);
94
95 ConfigItem *clone() const;
96
98 bool hasContact() const;
100 DMRContact *contact() const;
102 void setContact(DMRContact *contactObj);
104 const DMRContactReference *contactRef() const;
107
110 bool hasRevertChannel() const;
112 DMRChannel *revertChannel() const;
114 void setRevertChannel(DMRChannel *channel);
116 void resetRevertChannel();
117
122
123public:
124 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
125
126protected:
131};
132
133
137{
138 Q_OBJECT
139
143 Q_PROPERTY(QString destination READ destination WRITE setDestination SCRIPTABLE false)
145 Q_PROPERTY(unsigned int destSSID READ destSSID WRITE setDestSSID SCRIPTABLE false)
147 Q_PROPERTY(QString source READ source WRITE setSource SCRIPTABLE false)
149 Q_PROPERTY(unsigned int srcSSID READ srcSSID WRITE setSrcSSID SCRIPTABLE false)
151 Q_PROPERTY(QString path READ path WRITE setPath SCRIPTABLE false)
152
154 Q_PROPERTY(Icon icon READ icon WRITE setIcon)
156 Q_PROPERTY(QString message READ message WRITE setMessage)
161
162public:
163 static const unsigned PRIMARY_TABLE = (0<<8);
164 static const unsigned SECONDARY_TABLE = (1<<8);
165 static const unsigned TABLE_MASK = (3<<8);
166 static const unsigned ICON_MASK = 0x7f;
167
169 enum class Icon {
170 PoliceStation = (PRIMARY_TABLE | 0), None, Digipeater, Phone, DXCluster, HFGateway, SmallPlane,
171 MobileSatelliteStation, WheelChair, Snowmobile, RedCross, BoyScout, Home, X, RedDot,
172 Circle0, Circle1, Circle2, Circle3, Circle4, Circle5, Circle6, Circle7, Circle8, Circle9,
173 Fire, Campground, Motorcycle, RailEngine, Car, FileServer, HCFuture, AidStation, BBS, Canoe,
174 Eyeball = (PRIMARY_TABLE | 36), Tractor, GridSquare, Hotel, TCPIP, School = (PRIMARY_TABLE | 42),
175 Logon, MacOS, NTSStation, Balloon, PoliceCar, TBD, RV, Shuttle, SSTV, Bus, ATV, WXService, Helo,
176 Yacht, Windows, Jogger, Triangle, PBBS, LargePlane, WXStation, DishAntenna, Ambulance, Bike,
177 ICP, FireStation, Horse, FireTruck, Glider, Hospital, IOTA, Jeep, SmallTruck, Laptop, MicE,
178 Node, EOC, Rover, Grid, Antenna, PowerBoat, TruckStop, TruckLarge, Van, Water, XAPRS, Yagi,
179 Shelter
180 };
181 Q_ENUM(Icon)
182
183public:
185 Q_INVOKABLE explicit FMAPRSSystem(QObject *parent=nullptr);
201 FMAPRSSystem(const QString &name, FMChannel *channel, const QString &dest, unsigned destSSID,
202 const QString &src, unsigned srcSSID, const QString &path="", Icon icon=Icon::Jogger,
203 const QString &message="", const Interval &period=Interval::fromMinutes(5),
204 QObject *parent=nullptr);
205
206 bool copy(const ConfigItem &other);
207 ConfigItem *clone() const;
208
211 bool hasRevertChannel() const;
213 FMChannel *revertChannel() const;
215 void setRevertChannel(FMChannel *revertChannel);
217 void resetRevertChannel();
218
220 const FMChannelReference *revertChannelRef() const;
222 FMChannelReference *revertChannelRef();
223
225 const QString &destination() const;
227 unsigned destSSID() const;
229 void setDestination(const QString &call, unsigned ssid);
231 void setDestination(const QString &call);
233 void setDestSSID(unsigned ssid);
234
236 const QString &source() const;
238 unsigned srcSSID() const;
240 void setSource(const QString &call, unsigned ssid);
242 void setSource(const QString &call);
244 void setSrcSSID(unsigned ssid);
245
247 const QString &path() const;
249 void setPath(const QString &path);
250
252 Icon icon() const;
254 void setIcon(Icon icon);
255
257 const QString &message() const;
259 void setMessage(const QString &msg);
260
262 AnytoneFMAPRSSettingsExtension *anytoneExtension() const;
264 void setAnytoneExtension(AnytoneFMAPRSSettingsExtension *ext);
265
267 OpenGD77FMAPRSSystemExtension *openGD77Extension() const;
269 void setOpenGD77Extension(OpenGD77FMAPRSSystemExtension *ext);
270
271public:
272 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
273 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
274
275protected:
276 bool populate(YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack());
277
278protected:
284 unsigned _destSSID;
286 QString _source;
288 unsigned _srcSSID;
290 QString _path;
294 QString _message;
299};
300
301
305{
306Q_OBJECT
307
308public:
310 explicit PositionReportingSystems(QObject *parent=nullptr);
311
313 PositionReportingSystem *system(int idx) const;
314
315 int add(ConfigObject *obj, int row=-1, bool unique=true);
316
317public:
318 ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
319};
320
321
322#endif // GPSSYSTEM_H
Implements some additional settings for the FM APRS system.
Definition anytone_extension.hh:310
Parse context for config objects.
Definition configobject.hh:43
Base class for all configuration objects (channels, zones, contacts, etc).
Definition configobject.hh:35
virtual bool copy(const ConfigItem &other)
Copies the given item into this one.
Definition configobject.cc:165
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:405
ConfigItem(QObject *parent=nullptr)
Hidden constructor.
Definition configobject.cc:158
ConfigObjectList(const QMetaObject &elementTypes=ConfigItem::staticMetaObject, QObject *parent=nullptr)
Hidden constructor.
Definition configobject.cc:1521
Base class of all labeled and named objects.
Definition configobject.hh:192
ConfigObject(QObject *parent=nullptr)
Specifies the prefix for every ID assigned to every object during serialization.
Definition configobject.cc:1151
QString name
The name of the object.
Definition configobject.hh:196
The config class, representing the codeplug configuration.
Definition config.hh:70
DMRContactReference * contact
References the destination contact.
Definition gpssystem.hh:74
Q_INVOKABLE DMRAPRSSystem(QObject *parent=nullptr)
Default constructor.
Definition gpssystem.cc:102
ConfigItem * clone() const
Clones this item.
Definition gpssystem.cc:139
DMRChannel * revertChannel() const
Returns the revert channel for the GPS information or nullptr if not set.
Definition gpssystem.cc:181
const DMRChannelReference * revertChannelRef() const
Returns a reference to the revertChannelRef channel.
Definition gpssystem.cc:200
const DMRContactReference * contactRef() const
Returns the reference to the destination contactRef.
Definition gpssystem.cc:165
DMRChannelReference _revertChannel
Holds the revert channel on which the GPS information is sent on.
Definition gpssystem.hh:130
bool hasRevertChannel() const
Returns true if the GPS system has a revert channel set.
Definition gpssystem.cc:176
bool hasContact() const
Returns true if a contact is set for the GPS system.
Definition gpssystem.cc:149
DMRChannelReference * revert
References the revertRef channel.
Definition gpssystem.hh:76
DMRContactReference _contact
Holds the destination contact for the GPS information.
Definition gpssystem.hh:128
void resetRevertChannel()
Resets the revert channel to the current channel.
Definition gpssystem.cc:194
YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition gpssystem.cc:210
void setContact(DMRContact *contactObj)
Sets the destination contact for the GPS information.
Definition gpssystem.cc:159
void setRevertChannel(DMRChannel *channel)
Sets the revert channel for the GPS information to be sent on.
Definition gpssystem.cc:186
Implements a reference to a DMR channel.
Definition configreference.hh:151
Extension to the DigitalChannel class to implement an DMR channel.
Definition channel.hh:411
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:43
Represents an APRS system within the generic config.
Definition gpssystem.hh:137
OpenGD77FMAPRSSystemExtension * openGD77Extension() const
Returns the OpenGD77 settings extension, if set.
Definition gpssystem.cc:421
Q_INVOKABLE FMAPRSSystem(QObject *parent=nullptr)
Default constructor.
Definition gpssystem.cc:223
AnytoneFMAPRSSettingsExtension * _anytone
Owns the Anytone settings extension.
Definition gpssystem.hh:296
QString destination
The destination call.
Definition gpssystem.hh:143
unsigned _destSSID
Holds the destination SSID.
Definition gpssystem.hh:284
QString source
The source call.
Definition gpssystem.hh:147
static const unsigned PRIMARY_TABLE
Primary icon table flag.
Definition gpssystem.hh:163
unsigned _srcSSID
Holds the source SSID.
Definition gpssystem.hh:288
QString _destination
Holds the destination call.
Definition gpssystem.hh:282
static const unsigned TABLE_MASK
Bitmask for icon table flags.
Definition gpssystem.hh:165
QString _path
Holds the APRS path string.
Definition gpssystem.hh:290
void setDestination(const QString &call, unsigned ssid)
Sets the destination call and SSID.
Definition gpssystem.cc:330
AnytoneFMAPRSSettingsExtension * anytoneExtension() const
Returns the Anytone settings extension, if set.
Definition gpssystem.cc:403
static const unsigned ICON_MASK
Bitmask for the icon table entry.
Definition gpssystem.hh:166
OpenGD77FMAPRSSystemExtension * _opengd77
Owns the OpenGD77 settings extension.
Definition gpssystem.hh:298
AnytoneFMAPRSSettingsExtension * anytone
Anytone specific settings.
Definition gpssystem.hh:158
void setPath(const QString &path)
Sets the APRS path.
Definition gpssystem.cc:378
Icon _icon
Holds the map icon.
Definition gpssystem.hh:292
QString message
An optional text message.
Definition gpssystem.hh:156
void setIcon(Icon icon)
Sets the map icon.
Definition gpssystem.cc:388
static const unsigned SECONDARY_TABLE
Secondary icon table flag.
Definition gpssystem.hh:164
void setSource(const QString &call, unsigned ssid)
Sets the source call and SSID.
Definition gpssystem.cc:357
OpenGD77FMAPRSSystemExtension * opengd77
OpenGD77 specific settings.
Definition gpssystem.hh:160
void setMessage(const QString &msg)
Sets the optional APRS message text.
Definition gpssystem.cc:397
unsigned int destSSID
The destination SSID.
Definition gpssystem.hh:145
void setOpenGD77Extension(OpenGD77FMAPRSSystemExtension *ext)
Sets the OpenGD77 settings extension.
Definition gpssystem.cc:425
void setAnytoneExtension(AnytoneFMAPRSSettingsExtension *ext)
Sets the Anytone settings extension.
Definition gpssystem.cc:407
void setDestSSID(unsigned ssid)
Sets the destination SSID.
Definition gpssystem.cc:341
const FMChannelReference * revertChannelRef() const
Returns a reference to the revertChannelRef channel.
Definition gpssystem.cc:309
Icon icon
The APRS icon.
Definition gpssystem.hh:154
FMChannelReference * revert
The transmit channel.
Definition gpssystem.hh:141
void setSrcSSID(unsigned ssid)
Sets the source SSID.
Definition gpssystem.cc:368
unsigned int srcSSID
The source SSID.
Definition gpssystem.hh:149
Icon
All implemented APRS icons.
Definition gpssystem.hh:169
QString path
The APRS path as a string.
Definition gpssystem.hh:151
FMChannelReference _channel
A weak reference to the transmit channel.
Definition gpssystem.hh:280
QString _source
Holds the source call.
Definition gpssystem.hh:286
QString _message
Holds the optional message.
Definition gpssystem.hh:294
Implements a reference to a FM channel.
Definition configreference.hh:163
Extension to the AnalogChannel class to implement an analog FM channel.
Definition channel.hh:258
Represents a time interval.
Definition interval.hh:11
static constexpr Interval fromMinutes(unsigned long long min)
Definition interval.hh:79
Implements the FM-APRS extensions for the OpenGD77 radios.
Definition opengd77_extension.hh:162
Base class of the position reporting 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:89
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:63
Interval _period
Holds the update period in seconds.
Definition gpssystem.hh:63
bool populate(YAML::Node &node, const ConfigItem::Context &context, const ErrorStack &err=ErrorStack())
Recursively serializes the configuration to YAML nodes.
Definition gpssystem.cc:52
void disablePeriod()
Disable update period.
Definition gpssystem.cc:47
void onReferenceModified()
Gets called, whenever a reference is modified.
Definition gpssystem.cc:94
Interval period
The update period in seconds.
Definition gpssystem.hh:23
void setPeriod(const Interval &period)
Sets the update period in seconds.
Definition gpssystem.cc:39
PositionReportingSystem(QObject *parent=nullptr)
Default constructor.
Definition gpssystem.cc:11
bool periodDisabled() const
Returns true, if the period is disabled.
Definition gpssystem.cc:29
PositionReportingSystems(QObject *parent=nullptr)
Constructs an empty list of GPS systems.
Definition gpssystem.cc:538
PositionReportingSystem * system(int idx) const
Returns the positioning system at the specified index.
Definition gpssystem.cc:545
ConfigItem * allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
Allocates a member objects for the given YAML node.
Definition gpssystem.cc:559
int add(ConfigObject *obj, int row=-1, bool unique=true)
Adds an element to the list.
Definition gpssystem.cc:552