libdrmconf 0.14.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(Interval period READ period WRITE setPeriod SCRIPTABLE false)
23
24protected:
26 explicit PositionReportingSystem(QObject *parent=nullptr);
33 PositionReportingSystem(const QString &name, const Interval &period=Interval::fromMinutes(5),
34 QObject *parent=nullptr);
35
36public:
38 virtual ~PositionReportingSystem();
39
41 bool periodDisabled() const;
43 Interval period() const;
45 void setPeriod(const Interval &period);
47 void disablePeriod();
48
49public:
50 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
51 bool link(const YAML::Node &node, const Context &ctx, const ErrorStack &err=ErrorStack());
52
53protected:
54 bool populate(YAML::Node &node, const ConfigItem::Context &context, const ErrorStack &err=ErrorStack());
55
56protected slots:
59
60protected:
63};
64
65
69{
70 Q_OBJECT
71
76
77public:
79 Q_INVOKABLE explicit DMRAPRSSystem(QObject *parent=nullptr);
90 DMRAPRSSystem(const QString &name, DMRContact *contact=nullptr,
91 DMRChannel *revertChannel = nullptr, const Interval &period=Interval::fromMinutes(5),
92 QObject *parent = nullptr);
93
94 ConfigItem *clone() const;
95
97 bool hasContact() const;
99 DMRContact *contact() const;
101 void setContact(DMRContact *contactObj);
103 const DMRContactReference *contactRef() const;
106
109 bool hasRevertChannel() const;
111 DMRChannel *revertChannel() const;
113 void setRevertChannel(DMRChannel *channel);
115 void resetRevertChannel();
116
121
122public:
123 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
124
125protected:
130};
131
132
136{
137 Q_OBJECT
138
142 Q_PROPERTY(QString destination READ destination WRITE setDestination SCRIPTABLE false)
144 Q_PROPERTY(unsigned int destSSID READ destSSID WRITE setDestSSID SCRIPTABLE false)
146 Q_PROPERTY(QString source READ source WRITE setSource SCRIPTABLE false)
148 Q_PROPERTY(unsigned int srcSSID READ srcSSID WRITE setSrcSSID SCRIPTABLE false)
150 Q_PROPERTY(QString path READ path WRITE setPath SCRIPTABLE false)
151
153 Q_PROPERTY(Icon icon READ icon WRITE setIcon)
155 Q_PROPERTY(QString message READ message WRITE setMessage)
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 FMAPRSSystem(QObject *parent=nullptr);
198 FMAPRSSystem(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="", const Interval &period=Interval::fromMinutes(5),
201 QObject *parent=nullptr);
202
203 bool copy(const ConfigItem &other);
204 ConfigItem *clone() const;
205
208 bool hasRevertChannel() const;
210 FMChannel *revertChannel() const;
212 void setRevertChannel(FMChannel *revertChannel);
214 void resetRevertChannel();
215
217 const FMChannelReference *revertChannelRef() const;
219 FMChannelReference *revertChannelRef();
220
222 const QString &destination() const;
224 unsigned destSSID() const;
226 void setDestination(const QString &call, unsigned ssid);
228 void setDestination(const QString &call);
230 void setDestSSID(unsigned ssid);
231
233 const QString &source() const;
235 unsigned srcSSID() const;
237 void setSource(const QString &call, unsigned ssid);
239 void setSource(const QString &call);
241 void setSrcSSID(unsigned ssid);
242
244 const QString &path() const;
246 void setPath(const QString &path);
247
249 Icon icon() const;
251 void setIcon(Icon icon);
252
254 const QString &message() const;
256 void setMessage(const QString &msg);
257
259 AnytoneFMAPRSSettingsExtension *anytoneExtension() const;
261 void setAnytoneExtension(AnytoneFMAPRSSettingsExtension *ext);
262
263public:
264 YAML::Node serialize(const Context &context, const ErrorStack &err=ErrorStack());
265 bool parse(const YAML::Node &node, Context &ctx, const ErrorStack &err=ErrorStack());
266
267protected:
268 bool populate(YAML::Node &node, const Context &context, const ErrorStack &err=ErrorStack());
269
270protected:
276 unsigned _destSSID;
278 QString _source;
280 unsigned _srcSSID;
282 QString _path;
286 QString _message;
289};
290
291
295{
296Q_OBJECT
297
298public:
300 explicit PositionReportingSystems(QObject *parent=nullptr);
301
303 PositionReportingSystem *system(int idx) const;
304
305 int add(ConfigObject *obj, int row=-1, bool unique=true);
306
307public:
308 ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
309};
310
311
312#endif // GPSSYSTEM_H
Implements some additional settings for the FM APRS system.
Definition anytone_extension.hh:302
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:1511
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:1141
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:73
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:129
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:75
DMRContactReference _contact
Holds the destination contact for the GPS information.
Definition gpssystem.hh:127
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:139
Extension to the DigitalChannel class to implement an DMR channel.
Definition channel.hh:402
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:136
Q_INVOKABLE FMAPRSSystem(QObject *parent=nullptr)
Default constructor.
Definition gpssystem.cc:223
AnytoneFMAPRSSettingsExtension * _anytone
Owns the Anytone settings extension.
Definition gpssystem.hh:288
QString destination
The destination call.
Definition gpssystem.hh:142
unsigned _destSSID
Holds the destination SSID.
Definition gpssystem.hh:276
QString source
The source call.
Definition gpssystem.hh:146
static const unsigned PRIMARY_TABLE
Primary icon table flag.
Definition gpssystem.hh:160
unsigned _srcSSID
Holds the source SSID.
Definition gpssystem.hh:280
QString _destination
Holds the destination call.
Definition gpssystem.hh:274
static const unsigned TABLE_MASK
Bitmask for icon table flags.
Definition gpssystem.hh:162
QString _path
Holds the APRS path string.
Definition gpssystem.hh:282
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:163
AnytoneFMAPRSSettingsExtension * anytone
Anytone specific settings.
Definition gpssystem.hh:157
void setPath(const QString &path)
Sets the APRS path.
Definition gpssystem.cc:378
Icon _icon
Holds the map icon.
Definition gpssystem.hh:284
QString message
An optional text message.
Definition gpssystem.hh:155
void setIcon(Icon icon)
Sets the map icon.
Definition gpssystem.cc:388
static const unsigned SECONDARY_TABLE
Secondary icon table flag.
Definition gpssystem.hh:161
void setSource(const QString &call, unsigned ssid)
Sets the source call and SSID.
Definition gpssystem.cc:357
void setMessage(const QString &msg)
Sets the optional APRS message text.
Definition gpssystem.cc:397
unsigned int destSSID
The destination SSID.
Definition gpssystem.hh:144
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:153
FMChannelReference * revert
The transmit channel.
Definition gpssystem.hh:140
void setSrcSSID(unsigned ssid)
Sets the source SSID.
Definition gpssystem.cc:368
unsigned int srcSSID
The source SSID.
Definition gpssystem.hh:148
Icon
All implemented APRS icons.
Definition gpssystem.hh:166
QString path
The APRS path as a string.
Definition gpssystem.hh:150
FMChannelReference _channel
A weak reference to the transmit channel.
Definition gpssystem.hh:272
QString _source
Holds the source call.
Definition gpssystem.hh:278
QString _message
Holds the optional message.
Definition gpssystem.hh:286
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:249
Represents a time interval.
Definition interval.hh:11
static constexpr Interval fromMinutes(unsigned long long min)
Definition interval.hh:79
Base class of the position reporting 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: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:62
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:22
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:520
PositionReportingSystem * system(int idx) const
Returns the positioning system at the specified index.
Definition gpssystem.cc:527
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:541
int add(ConfigObject *obj, int row=-1, bool unique=true)
Adds an element to the list.
Definition gpssystem.cc:534