libdrmconf  0.12.0
A library to program DMR radios.
smsextension.hh
1 #ifndef SMSEXTENSION_HH
2 #define SMSEXTENSION_HH
3 
4 #include "configobject.hh"
5 #include "interval.hh"
6 
7 
11 {
12  Q_OBJECT
13 
15  Q_CLASSINFO("IdPrefix", "sms")
16 
17 
18  Q_PROPERTY(QString message READ message WRITE setMessage)
19 
20 public:
22  Q_INVOKABLE explicit SMSTemplate(QObject *parent = nullptr);
23 
24  ConfigItem *clone() const;
25 
27  const QString &message() const;
29  void setMessage(const QString message);
30 
31 protected:
33  QString _message;
34 };
35 
36 
39 {
40  Q_OBJECT
41 
42 public:
44  Q_INVOKABLE SMSTemplates(QObject *parent=nullptr);
45 
46  ConfigItem *allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack());
47 
49  SMSTemplate *message(unsigned int i) const;
50 };
51 
52 
55 {
56  Q_OBJECT
57 
59  Q_PROPERTY(Format format READ format WRITE setFormat)
61  Q_PROPERTY(SMSTemplates *templates READ smsTemplates)
62 
63 public:
65  enum class Format {
66  Motorola, Hytera, DMR
67  };
68  Q_ENUM(Format)
69 
70 public:
72  Q_INVOKABLE explicit SMSExtension(QObject *parent = nullptr);
73 
74  ConfigItem *clone() const;
75 
77  Format format() const;
79  void setFormat(Format format);
80 
82  SMSTemplates *smsTemplates() const;
83 
84 protected:
89 };
90 
91 #endif // SMSEXTENSION_HH
Base class of all device/vendor specific confiuration extensions.
Definition: configobject.hh:246
Parse context for config objects.
Definition: configobject.hh:48
Base class for all configuration objects (channels, zones, contacts, etc).
Definition: configobject.hh:40
List class for config objects.
Definition: configobject.hh:349
Base class of all labeled and named objects.
Definition: configobject.hh:199
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Extension collecting all settings associated with SMS messages.
Definition: smsextension.hh:55
SMSTemplates * _smsTemplates
Owns a reference to the list of SMS templates.
Definition: smsextension.hh:88
Format _format
Holds the SMS format.
Definition: smsextension.hh:86
Format
Possible SMS formats, DMR is usually a good idea.
Definition: smsextension.hh:65
ConfigItem * clone() const
Clones this item.
Definition: smsextension.cc:81
void setFormat(Format format)
Sets the SMS format.
Definition: smsextension.cc:73
Format format
The format for the SMS.
Definition: smsextension.hh:59
Q_INVOKABLE SMSExtension(QObject *parent=nullptr)
Default constructor.
Definition: smsextension.cc:62
SMSTemplates * smsTemplates() const
Retunrs a weak reference to the list of SMS templates.
Definition: smsextension.cc:91
SMSTemplates * templates
All predefined SMS messages.
Definition: smsextension.hh:61
Represents a SMS message template (pre defined message).
Definition: smsextension.hh:11
QString _message
Holds the message text.
Definition: smsextension.hh:33
QString message
Specifies the prefix for every ID assigned to every message during serialization.
Definition: smsextension.hh:18
Q_INVOKABLE SMSTemplate(QObject *parent=nullptr)
Default constructor.
Definition: smsextension.cc:7
ConfigItem * clone() const
Clones this item.
Definition: smsextension.cc:14
void setMessage(const QString message)
Sets the message text.
Definition: smsextension.cc:29
Just a list, holding the SMS templates.
Definition: smsextension.hh:39
Q_INVOKABLE SMSTemplates(QObject *parent=nullptr)
Default constructor.
Definition: smsextension.cc:41
SMSTemplate * message(unsigned int i) const
Returns the i-th message.
Definition: smsextension.cc:54
ConfigItem * allocateChild(const YAML::Node &node, ConfigItem::Context &ctx, const ErrorStack &err=ErrorStack())
Allocates a member objects for the given YAML node.
Definition: smsextension.cc:48