RadioLib Universal wireless communication library for Arduino

ITA2String.h
1 #if !defined(_RADIOLIB_ITA2_STRING_H)
2 #define _RADIOLIB_ITA2_STRING_H
3
4 #include "../../TypeDef.h"
5
6 #define RADIOLIB_ITA2_FIGS 0x1B
7 #define RADIOLIB_ITA2_LTRS 0x1F
8 #define RADIOLIB_ITA2_LENGTH 32
9
10 // ITA2 character table: - position in array corresponds to 5-bit ITA2 code
11 // - characters to the left are in letters shift, characters to the right in figures shift
12 // - characters marked 0x7F do not have ASCII equivalent
13 static const char ITA2Table[RADIOLIB_ITA2_LENGTH][2] RADIOLIB_NONVOLATILE = {
14 {'\0', '\0'}, {'E', '3'}, {'\n', '\n'}, {'A', '-'}, {' ', ' '}, {'S', '\''}, {'I', '8'}, {'U', '7'},
15 {'\r', '\r'}, {'D', 0x05}, {'R', '4'}, {'J', '\a'}, {'N', ','}, {'F', '!'}, {'C', ':'}, {'K', '('},
16 {'T', '5'}, {'Z', '+'}, {'L', ')'}, {'W', '2'}, {'H', 0x7F}, {'Y', '6'}, {'P', '0'}, {'Q', '1'},
17 {'O', '9'}, {'B', '?'}, {'G', '&'}, {0x7F, 0x7F}, {'M', '.'}, {'X', '/'}, {'V', ';'}, {0x7F, 0x7F}
18 };
19
24 class ITA2String {
25 public:
30 ITA2String(char c);
31
36 ITA2String(const char* str);
37
41 ~ITA2String();
42
47 size_t length();
48
54 uint8_t* byteArr();
55
56 #if !defined(RADIOLIB_GODMODE)
57 private:
58 #endif
59 #if defined(RADIOLIB_STATIC_ONLY)
60 char strAscii[RADIOLIB_STATIC_ARRAY_SIZE];
61 #else
62 char* strAscii;
63 #endif
64 size_t asciiLen;
65 size_t ita2Len;
66
67 static uint16_t getBits(char c);
68 };
69
70 #endif
ITA2String
ITA2-encoded string.
Definition: ITA2String.h:24
ITA2String::byteArr
uint8_t * byteArr()
Gets the ITA2 representation of the ASCII string set in constructor.
Definition: ITA2String.cpp:41
ITA2String::length
size_t length()
Gets the length of the ITA2 string. This number is not the same as the length of ASCII-encoded string...
Definition: ITA2String.cpp:29
ITA2String::ITA2String
ITA2String(char c)
Default single-character constructor.
Definition: ITA2String.cpp:5
ITA2String::~ITA2String
~ITA2String()
Default destructor.
Definition: ITA2String.cpp:23