Skip to content

Commit

Permalink
Implemented SMS templates (#453)
Browse files Browse the repository at this point in the history
* Moved SMS extension to extensions tab.
* Implemented SMS template encoding for Radioddity GD73.
* Implemented SMS templates for TyT/Retevis devices. Addresses 413.
* Implemented message templates for radioddity devices. Addresses #413.
* Fixed encoding of SMS templates for AnyTone devices. Addresses #413.
  • Loading branch information
hmatuschek authored Jul 18, 2024
1 parent f865560 commit a055639
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 4 deletions.
83 changes: 82 additions & 1 deletion doc/manual/codeplug/smsextension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,91 @@
xmlns:xi="http://www.w3.org/2001/XInclude">

<info>
<title></title>
<title>SMS Extension</title>
</info>

<para>
This extension allows for configuring the SMS (text message) feature of all DMR radios. For now,
it is implemented as an extension, but might be changed into a common core setting in the future.
</para>

<para>
This extension only has two elements: the SMS format and a list of predefined text messages. The
latter is important for devices that do not have a keypad and thus do not allow for entering any
messages. E.g., the Radioddity GD-73.
</para>

<para>
As this extension configures a common feature, the extension is always present.
</para>

<example>
<title>Example of a single SMS pre-defined text or template.</title>
<programlisting><![CDATA[sms:
format: Motorola
templates:
- id: sms1
name: RSSI
message: RSSI
]]></programlisting>
</example>

<section>
<info> <title>Common SMS settings</title> </info>

<variablelist>
<varlistentry>
<term><token>format</token></term>
<listitem>
<para>
Specifies the SMS format to be used. This must be one of <token>Motorola</token>,
<token>Hytera</token> or <token>DMR</token>. If an incompatible format is chosen, you cannot
receive or send text messages.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>

<section>
<info> <title>Message templates</title> </info>

<para>
The <token>templates</token> key defines a list of SMS templates to be programmed onto the radio.
Each template is a config object with a name and ID. The latter can be used to reference the
template somewhere else in the codeplug.
</para>

<para>
Each template has the following properties:
</para>

<variablelist>
<varlistentry>
<term><token>id</token></term>
<listitem>
<para>
Specifies the unique ID of the message. This can be used to reference the message.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><token>name</token></term>
<listitem>
<para>
Specifies the display name of the message. Please note, that not all radios store
descriptive names alongside with the preset messages.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><token>message</token></term>
<listitem>
<para>
The actual preset message. The length might differ but is usually limited to 144 chars.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</section>
5 changes: 3 additions & 2 deletions lib/gd73_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ GD73Codeplug::DMRSettingsElement::encode(Context &ctx, const ErrorStack &err) {


/* ********************************************************************************************* *
<<<<<<< HEAD
=======
* Implementation of GD73Codeplug::EncryptionKeyElement
* ********************************************************************************************* */
GD73Codeplug::EncryptionKeyElement::EncryptionKeyElement(uint8_t *ptr, size_t size)
Expand Down Expand Up @@ -876,7 +878,7 @@ GD73Codeplug::MessageElement::MessageElement(uint8_t *ptr, size_t size)
GD73Codeplug::MessageElement::MessageElement(uint8_t *ptr)
: Element(ptr, GD73Codeplug::MessageElement::size())
{
// passs...
// pass...
}

QString
Expand Down Expand Up @@ -954,7 +956,6 @@ GD73Codeplug::MessageBankElement::decode(SMSExtension *ext, const ErrorStack &er
sms->setName(QString("Message %1").arg(i+1));
ext->smsTemplates()->add(sms);
}

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/smsextension.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SMSExtension : public ConfigExtension
/** The format for the SMS. */
Q_PROPERTY(Format format READ format WRITE setFormat)
/** All predefined SMS messages. */
Q_PROPERTY(SMSTemplates *smsTemplates READ smsTemplates)
Q_PROPERTY(SMSTemplates *templates READ smsTemplates)

public:
/** Possible SMS formats, DMR is usually a good idea. */
Expand Down
1 change: 1 addition & 0 deletions lib/tyt_codeplug.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,7 @@ public:
};
};


protected:
/** Empty constructor. */
explicit TyTCodeplug(QObject *parent = nullptr);
Expand Down

0 comments on commit a055639

Please sign in to comment.