RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
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
13static 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
25 public:
30 explicit ITA2String(char c);
31
36 explicit ITA2String(const char* str);
37
42 ITA2String(const ITA2String& ita2);
43
48 ITA2String& operator=(const ITA2String& ita2);
49
54
59 size_t length();
60
66 uint8_t* byteArr();
67
68#if !RADIOLIB_GODMODE
69 private:
70#endif
71 #if RADIOLIB_STATIC_ONLY
72 char strAscii[RADIOLIB_STATIC_ARRAY_SIZE];
73 #else
74 char* strAscii;
75 #endif
76 size_t asciiLen;
77 size_t ita2Len;
78
79 static uint16_t getBits(char c);
80};
81
82#endif
ITA2-encoded string.
Definition ITA2String.h:24
uint8_t * byteArr()
Gets the ITA2 representation of the ASCII string set in constructor.
Definition ITA2String.cpp:62
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:50
ITA2String & operator=(const ITA2String &ita2)
Overload for assignment operator.
Definition ITA2String.cpp:32
~ITA2String()
Default destructor.
Definition ITA2String.cpp:44