1 #ifndef OPENRTX_CODEPLUG_HH
2 #define OPENRTX_CODEPLUG_HH
5 #include "signaling.hh"
62 virtual uint16_t
version()
const;
67 virtual QString
author()
const;
69 virtual void setAuthor(
const QString &name);
96 OffsetMagic = 0x00, MagicNumber = 0x43585452, OffsetVersion = 0x08, OffsetAuthor = 0x0a,
97 OffsetDescription = 0x2a, OffsetTimestamp = 0x4a, OffsetContactCount = 0x52,
98 OffsetChannelCount = 0x54, OffsetZoneCount = 0x56, StringLength = 0x20,
99 SupportedVersion = ((0<<8)|1)
150 virtual void clear();
158 virtual bool rxOnly()
const;
168 virtual float power()
const;
200 virtual QString
name()
const;
217 virtual unsigned int altitude()
const;
296 OffsetMode = 0x00, OffsetBandwidth = 0x01, BitBandwidth = 0x00, OffsetRXOnly = 0x01,
297 BitRXOnly = 0x02, OffsetPower = 0x02, OffsetRXFrequency = 0x03, OffsetTXFrequency = 0x07,
298 OffsetScanList = 0x0b, OffsetGroupList = 0x0c, OffsetName = 0x0d, OffsetDescription = 0x2d,
299 OffsetChLatInt = 0x4d, OffsetChLatDec = 0x4e, OffsetChLonInt = 0x50, OffsetChLonDec = 0x51,
300 OffsetChAltitude = 0x53, OffsetRXTone = 0x55, OffsetTXTone = 0x56, OffsetRXColorCode = 0x55,
301 BitRXColorCode = 0x00, OffsetTXColorCode = 0x55, BitTXColorCode = 0x04, OffsetTimeSlot = 0x56,
302 OffsetDMRContact = 0x57, OffsetRXCAN = 0x55, BitRXCAN = 0x00, OffsetTXCAN = 0x55,
303 BitTXCAN = 0x04, OffsetEncrMode = 0x56, BitEncrMode = 0x04, OffsetM17ChMode = 0x56,
304 BitM17ChMode = 0x00, OffsetM17GPSMode = 0x57, OffsetM17Contact = 0x58, StringLength = 0x20
330 virtual QString
name()
const;
340 virtual unsigned int dmrId()
const;
342 virtual void setDMRId(
unsigned int id);
355 virtual QString
m17Call()
const;
367 OffsetName = 0x00, OffsetMode = 0x20, OffsetDMRId = 0x21, OffsetDMRCallType = 0x25,
368 BitDMRCallType = 0, OffsetDMRRing = 0x25, BitDMRRing = 0x02, OffsetM17Address = 0x21,
396 virtual QString
name()
const;
406 virtual unsigned int channelIndex(
unsigned int n)
const;
423 OffsetName = 0x00, OffsetCount = 0x20, OffsetChannel = 0x22, StringLength = 0x20
435 virtual void clear();
476 virtual unsigned int offsetZone(
unsigned int n);
487 HeaderSize = 0x58, ChannelSize = 0x5a, ContactSize = 0x27, ZoneHeaderSize=0x22
The base class of all channels (analog and digital) of a codeplug configuration.
Definition: channel.hh:34
Base class for all codeplug contexts.
Definition: codeplug.hh:238
Represents the abstract base class of all codeplug elements.
Definition: codeplug.hh:51
This class defines the interface all device-specific code-plugs must implement.
Definition: codeplug.hh:19
The config class, representing the codeplug configuration.
Definition: config.hh:70
uint32_t size() const
Returns the total size of the DFU file.
Definition: dfufile.cc:52
TimeSlot
Possible timeslots for digital channels.
Definition: channel.hh:389
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Implements the binary representation of a channel.
Definition: openrtx_codeplug.hh:108
virtual void setM17ContactIndex(unsigned int idx)
Sets the M17 contact index.
Definition: openrtx_codeplug.cc:507
EncryptionMode
Specifies the M17 encryption modes.
Definition: openrtx_codeplug.hh:131
virtual void setTXFrequency(Frequency MHz)
Sets the TX frequency in MHz.
Definition: openrtx_codeplug.cc:215
virtual void clear()
Resets the channel.
Definition: openrtx_codeplug.cc:148
virtual void setName(const QString &name)
Sets the channel name.
Definition: openrtx_codeplug.cc:268
virtual unsigned int groupListIndex() const
Returns the group list index.
Definition: openrtx_codeplug.cc:247
virtual Mode mode() const
Returns the channel mode.
Definition: openrtx_codeplug.cc:154
virtual void setTXChannelAccessNumber(unsigned int cc)
Sets the TX color code.
Definition: openrtx_codeplug.cc:455
virtual void clearDMRContactIndex()
Clears the DMR contact index.
Definition: openrtx_codeplug.cc:435
virtual void setLatitude(float lat)
Sets the latitude.
Definition: openrtx_codeplug.cc:289
virtual void enableGPSData(bool enable)
Enables/disables sending of GPS position as meta-data.
Definition: openrtx_codeplug.cc:488
virtual float power() const
Power in dBm.
Definition: openrtx_codeplug.cc:187
Offsets
Just contains the offsets within the channel element.
Definition: openrtx_codeplug.hh:295
virtual unsigned int rxChannelAccessNumber() const
Returns the RX channel access number.
Definition: openrtx_codeplug.cc:440
virtual Frequency txFrequency() const
Returns the TX frequency in MHz.
Definition: openrtx_codeplug.cc:210
virtual bool linkChannelObj(Channel *c, Context &ctx, const ErrorStack &err=ErrorStack()) const
Links a previously constructed channel to the rest of the configuration.
Definition: openrtx_codeplug.cc:569
virtual unsigned int altitude() const
Returns the height in meters.
Definition: openrtx_codeplug.cc:306
virtual void setAltitude(unsigned int alt)
Sets the height in meters.
Definition: openrtx_codeplug.cc:310
virtual void setScanListIndex(unsigned int index)
Sets the scan list index.
Definition: openrtx_codeplug.cc:231
virtual bool hasDMRContactIndex() const
Returns true if the DMR contact index is set.
Definition: openrtx_codeplug.cc:420
virtual ChannelMode channelMode() const
Returns the channel mode.
Definition: openrtx_codeplug.cc:472
virtual bool rxOnly() const
Returns true, if the channel is RX only.
Definition: openrtx_codeplug.cc:165
virtual float longitude() const
Returns the channel longitude.
Definition: openrtx_codeplug.cc:295
virtual void setRXFrequency(Frequency MHz)
Sets the RX frequency in MHz.
Definition: openrtx_codeplug.cc:205
virtual void setRXTone(Signaling::Code code, const ErrorStack &err=ErrorStack())
Sets the CTCSS RX sub-tone.
Definition: openrtx_codeplug.cc:326
bool isValid() const
Returns true if the pointer is not null.
Definition: openrtx_codeplug.cc:143
virtual void setTXColorCode(unsigned int cc)
Sets the TX color code.
Definition: openrtx_codeplug.cc:398
virtual void clearScanListIndex()
Clears the scan list index.
Definition: openrtx_codeplug.cc:236
virtual unsigned int scanListIndex() const
Returns the scan list index.
Definition: openrtx_codeplug.cc:226
virtual unsigned int txChannelAccessNumber() const
Returns the TX color code.
Definition: openrtx_codeplug.cc:450
virtual void setPower(float dBm)
Set power in dBm.
Definition: openrtx_codeplug.cc:192
virtual unsigned int rxColorCode() const
Returns the RX color code.
Definition: openrtx_codeplug.cc:383
virtual bool hasM17ContactIndex() const
Returns true if the M17 contact index is set.
Definition: openrtx_codeplug.cc:497
virtual Signaling::Code rxTone() const
Returns the CTCSS RX sub-tone.
Definition: openrtx_codeplug.cc:316
virtual unsigned int dmrContactIndex() const
Returns the contact index for the DMR contact.
Definition: openrtx_codeplug.cc:425
virtual void setTimeslot(DMRChannel::TimeSlot ts)
Sets the timeslot for the channel.
Definition: openrtx_codeplug.cc:411
Bandwidth
Specifies the possible bandwidth settings.
Definition: openrtx_codeplug.hh:111
virtual void setMode(Mode mode)
Sets the channel mode.
Definition: openrtx_codeplug.cc:159
virtual ~ChannelElement()
Destructor.
Definition: openrtx_codeplug.cc:138
virtual void setDescription(const QString &description)
Sets the channel description.
Definition: openrtx_codeplug.cc:278
virtual void setRXChannelAccessNumber(unsigned int cc)
Sets the RX channel access number.
Definition: openrtx_codeplug.cc:445
virtual Frequency rxFrequency() const
Returns the RX frequency in MHz.
Definition: openrtx_codeplug.cc:200
virtual void setTXTone(Signaling::Code code, const ErrorStack &err=ErrorStack())
Sets the CTCSS TX sub-tone.
Definition: openrtx_codeplug.cc:359
virtual void setChannelMode(ChannelMode mode)
Sets the channel mode.
Definition: openrtx_codeplug.cc:477
ChannelElement(uint8_t *ptr, size_t size)
Constructs a channel from the given memory.
Definition: openrtx_codeplug.cc:126
virtual unsigned int txColorCode() const
Returns the TX color code.
Definition: openrtx_codeplug.cc:393
virtual void setLongitude(float lat)
Sets the longitude.
Definition: openrtx_codeplug.cc:300
virtual void setBandwidth(Bandwidth bw)
Sets the bandwidth of the channel.
Definition: openrtx_codeplug.cc:181
virtual EncryptionMode encryptionMode() const
Returns the encryption mode of the channel.
Definition: openrtx_codeplug.cc:461
virtual void setRXColorCode(unsigned int cc)
Sets the RX color code.
Definition: openrtx_codeplug.cc:388
Timeslot
Specifies the DMR time slot settings.
Definition: openrtx_codeplug.hh:118
virtual void setRXOnly(bool enable)
Enables/disables RX only for the channel.
Definition: openrtx_codeplug.cc:170
ChannelMode
Specifies the M17 channel mode.
Definition: openrtx_codeplug.hh:124
virtual unsigned int m17ContactIndex() const
Returns the M17 contact index.
Definition: openrtx_codeplug.cc:502
virtual DMRChannel::TimeSlot timeslot() const
Returns the times slot for the channel.
Definition: openrtx_codeplug.cc:404
virtual bool hasScanListIndex() const
Retrusn true if the scan list is set.
Definition: openrtx_codeplug.cc:221
virtual bool gpsDataEnabled() const
Returns true if GPS position is sent as meta-data.
Definition: openrtx_codeplug.cc:483
virtual QString description() const
Returns the channel description.
Definition: openrtx_codeplug.cc:273
virtual Channel * toChannelObj(Context &ctx, const ErrorStack &err=ErrorStack()) const
Constructs a generic Channel object from the codeplug channel.
Definition: openrtx_codeplug.cc:518
virtual void setEncryptionMode(EncryptionMode mode)
Sets the encryption mode for the channel.
Definition: openrtx_codeplug.cc:466
virtual bool hasGroupListIndex() const
Retrusn true if the group list is set.
Definition: openrtx_codeplug.cc:242
virtual void clearM17ContactIndex()
Clears the M17 contact index.
Definition: openrtx_codeplug.cc:512
virtual float latitude() const
Returns the channel latitude.
Definition: openrtx_codeplug.cc:284
virtual void setDMRContactIndex(unsigned int idx)
Sets the DMR contact index.
Definition: openrtx_codeplug.cc:430
virtual Signaling::Code txTone() const
Returns the CTCSS TX sub-tone.
Definition: openrtx_codeplug.cc:349
virtual Bandwidth bandwidth() const
Returns the bandwidth of the channel.
Definition: openrtx_codeplug.cc:176
virtual bool fromChannelObj(const Channel *c, Context &ctx, const ErrorStack &err=ErrorStack())
Initializes this codeplug channel from the given generic configuration.
Definition: openrtx_codeplug.cc:616
virtual void clearGroupListIndex()
Clears the group list index.
Definition: openrtx_codeplug.cc:257
virtual QString name() const
Returns the channel name.
Definition: openrtx_codeplug.cc:263
virtual void setGroupListIndex(unsigned int index)
Sets the group list index.
Definition: openrtx_codeplug.cc:252
The binary encoding of a zone.
Definition: openrtx_codeplug.hh:380
virtual void setName(const QString &name)
Sets the name of the zone.
Definition: openrtx_codeplug.cc:856
Offsets
Just defines the offsets with the element.
Definition: openrtx_codeplug.hh:422
virtual void setChannelCount(unsigned int n)
Sets the number of channels in zone.
Definition: openrtx_codeplug.cc:867
virtual bool linkZoneObj(Zone *zone, Context &ctx, bool putInB, const ErrorStack &err=ErrorStack()) const
Links a previously constructed Zone object to the rest of the configuration.
Definition: openrtx_codeplug.cc:893
virtual void fromZoneObjA(const Zone *zone, Context &ctx)
Resets this codeplug zone representation from the given generic Zone object.
Definition: openrtx_codeplug.cc:909
virtual void fromZoneObjB(const Zone *zone, Context &ctx)
Resets this codeplug zone representation from the given generic Zone object.
Definition: openrtx_codeplug.cc:921
void clear()
Resets the zone.
Definition: openrtx_codeplug.cc:839
virtual void setChannelIndex(unsigned int n, unsigned int idx)
Sets the n-th channel index.
Definition: openrtx_codeplug.cc:879
virtual Zone * toZoneObj(Context &ctx) const
Constructs a generic Zone object from this codeplug zone.
Definition: openrtx_codeplug.cc:885
bool isValid() const
Returns true if the zone is valid.
Definition: openrtx_codeplug.cc:845
virtual unsigned int channelIndex(unsigned int n) const
Returns the n-th channel index.
Definition: openrtx_codeplug.cc:874
virtual unsigned int channelCount() const
Returns the number of channels in zone.
Definition: openrtx_codeplug.cc:862
virtual QString name() const
Returns the zone name.
Definition: openrtx_codeplug.cc:851
ZoneElement(uint8_t *ptr, unsigned size)
Hidden constructor.
Definition: openrtx_codeplug.cc:822
Implements the binary encoding and decoding of the OpenRTX codeplug.
Definition: openrtx_codeplug.hh:31
virtual void clear()
Clears and resets the complete codeplug to some default values.
Definition: openrtx_codeplug.cc:945
virtual unsigned int numChannels()
Returns the number of stored channels.
Definition: openrtx_codeplug.cc:1108
Offsets
Just stores some sizes.
Definition: openrtx_codeplug.hh:486
virtual unsigned int offsetZoneOffsets()
Returns the offset to the zone offset array.
Definition: openrtx_codeplug.cc:1182
bool encode(Config *config, const Flags &flags=Flags(), const ErrorStack &err=ErrorStack())
Encodes the given generic configuration as a binary codeplug.
Definition: openrtx_codeplug.cc:976
virtual unsigned int offsetContact(unsigned int n)
Returns the offset to the n-th contact element.
Definition: openrtx_codeplug.cc:1064
bool index(Config *config, Context &ctx, const ErrorStack &err=ErrorStack()) const
Indexes all elements of the codeplug.
Definition: openrtx_codeplug.cc:952
virtual bool encodeChannels(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encode all channels.
Definition: openrtx_codeplug.cc:1119
virtual bool createZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds zones to the configuration.
Definition: openrtx_codeplug.cc:1241
OpenRTXCodeplug(QObject *parent=nullptr)
Hidden constructor, use a device specific class to instantiate.
Definition: openrtx_codeplug.cc:933
bool decode(Config *config, const ErrorStack &err=ErrorStack())
Decodes the binary codeplug and stores its content in the given generic configuration.
Definition: openrtx_codeplug.cc:1018
virtual bool linkZones(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all zones within the configuration.
Definition: openrtx_codeplug.cc:1266
Mode
Possible modes for a channel or contact.
Definition: openrtx_codeplug.hh:36
@ Mode_DMR
DMR Channel.
Definition: openrtx_codeplug.hh:39
@ Mode_None
Disabled?
Definition: openrtx_codeplug.hh:37
@ Mode_FM
FM Channel.
Definition: openrtx_codeplug.hh:38
@ Mode_M17
M17 Channel.
Definition: openrtx_codeplug.hh:40
virtual unsigned int offsetChannel(unsigned int n)
Returns the offset to the n-th channel element.
Definition: openrtx_codeplug.cc:1113
virtual bool createContacts(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds a digital contact to the configuration for each one in the codeplug.
Definition: openrtx_codeplug.cc:1090
virtual bool linkChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Links all channels.
Definition: openrtx_codeplug.cc:1159
virtual unsigned int numContacts()
Returns the number of stored contacts.
Definition: openrtx_codeplug.cc:1059
virtual bool decodeElements(Context &ctx, const ErrorStack &err=ErrorStack())
Decodes the binary codeplug and stores its content in the given generic configuration using the given...
Definition: openrtx_codeplug.cc:1029
virtual bool encodeZones(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes zones.
Definition: openrtx_codeplug.cc:1200
virtual bool encodeContacts(Config *config, const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes all digital contacts in the configuration into the codeplug.
Definition: openrtx_codeplug.cc:1069
virtual bool encodeElements(const Flags &flags, Context &ctx, const ErrorStack &err=ErrorStack())
Encodes the given generic configuration as a binary codeplug using the given context.
Definition: openrtx_codeplug.cc:992
virtual ~OpenRTXCodeplug()
Destructor.
Definition: openrtx_codeplug.cc:940
virtual bool createChannels(Config *config, Context &ctx, const ErrorStack &err=ErrorStack())
Adds all defined channels to the configuration.
Definition: openrtx_codeplug.cc:1141
virtual unsigned int offsetZone(unsigned int n)
Returns the offset to the n-th zone element.
Definition: openrtx_codeplug.cc:1190
virtual unsigned int numZones()
Returns the number of stored zones.
Definition: openrtx_codeplug.cc:1177
Generic representation of a RX group list.
Definition: rxgrouplist.hh:14
Generic representation of a scan list.
Definition: scanlist.hh:15
Code
This huge enum lists all possible RX/TX tones that can be associated with analog channels.
Definition: signaling.hh:18
Represents a zone within the generic configuration.
Definition: zone.hh:15
Helper type to encode frequencies without any rounding error.
Definition: frequency.hh:11