libdrmconf  0.12.0
A library to program DMR radios.
utils.hh
1 
6 #ifndef UTILS_HH
7 #define UTILS_HH
8 
9 #include <QString>
10 #include <inttypes.h>
11 
12 #include "signaling.hh"
13 #include "gpssystem.hh"
14 #include <QGeoCoordinate>
15 
19 QString decode_unicode(const uint16_t *data, size_t size, uint16_t fill=0x0000);
22 void encode_unicode(uint16_t *data, const QString &text, size_t size, uint16_t fill=0x0000);
23 
26 QString decode_ascii(const uint8_t *data, size_t size, uint16_t fill=0x00);
29 void encode_ascii(uint8_t *data, const QString &text, size_t size, uint16_t fill=0x00);
30 
33 QString decode_utf8(const uint8_t *data, size_t size, uint16_t fill=0x00);
36 void encode_utf8(uint8_t *data, const QString &text, size_t size, uint16_t fill=0x00);
37 
39 double decode_frequency(uint32_t bcd);
41 uint32_t encode_frequency(double freq);
42 
44 uint32_t decode_dmr_id_bin(const uint8_t *id);
46 void encode_dmr_id_bin(uint8_t *id, uint32_t num);
48 uint32_t decode_dmr_id_bcd(const uint8_t *id);
50 uint32_t decode_dmr_id_bcd_le(const uint8_t *id);
52 void encode_dmr_id_bcd(uint8_t *id, uint32_t num);
54 void encode_dmr_id_bcd_le(uint8_t *id, uint32_t num);
55 
56 QString decode_dtmf_bin(const uint8_t *num, int size=16, uint8_t fill=0xff);
57 bool encode_dtmf_bin(const QString &number, uint8_t *num, int size=16, uint8_t fill=0xff);
58 
59 QString decode_dtmf_bcd_be(const uint8_t *num, int digits);
60 bool encode_dtmf_bcd_be(const QString &number, uint8_t *num, int size, uint8_t fill);
61 
63 Signaling::Code decode_ctcss_tone_table(uint16_t data);
65 uint16_t encode_ctcss_tone_table(Signaling::Code code);
68 uint16_t oct_to_dec(uint16_t oct);
71 uint16_t dec_to_oct(uint16_t dec);
72 
74 bool validDMRNumber(const QString &text);
76 bool validDTMFNumber(const QString &text);
77 
78 QString aprsicon2config(APRSSystem::Icon icon);
79 QString aprsicon2name(APRSSystem::Icon icon);
80 APRSSystem::Icon name2aprsicon(const QString &name);
81 char aprsicon2iconcode(APRSSystem::Icon icon);
82 char aprsicon2tablecode(APRSSystem::Icon icon);
83 APRSSystem::Icon code2aprsicon(char table, char icon);
84 
88 int levDist(const QString &source, const QString &target,
89  Qt::CaseSensitivity cs=Qt::CaseInsensitive);
90 
92 uint32_t align_size(uint32_t size, uint32_t block);
94 uint32_t align_addr(uint32_t addr, uint32_t block);
95 
96 QGeoCoordinate loc2deg(const QString &loc);
97 QString deg2loc(const QGeoCoordinate &coor);
98 
99 #endif // UTILS_HH
Icon
All implemented APRS icons.
Definition: gpssystem.hh:151
Code
This huge enum lists all possible RX/TX tones that can be associated with analog channels.
Definition: signaling.hh:18