class ColaAsciiBinaryConverter converts between Cola-ASCII and Cola-Binary telegrams. See Operation-Instruction-v1.1.0.241R.pdf, chapter 5.8 "About CoLa-A telegrams", page 46-48, Telegram-Listing-v1.1.0.241R.pdf, chapter 2.3.9 "Command: LocRequestTimestamp", page 21, and Technical_information_Telegram_Listing_NAV_LOC_en_IM0076556.PDF for further details about Cola telegrams. More...
#include <cola_converter.h>
Static Public Member Functions | |
static std::vector< uint8_t > | ColaAsciiToColaBinary (const std::vector< uint8_t > &cola_telegram, int parameter_is_ascii=-1) |
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary. More... | |
static uint32_t | ColaBinaryTelegramLength (const std::vector< uint8_t > &cola_telegram) |
Decodes the header and returns the length of a Cola-Binary telegram. More... | |
static std::vector< uint8_t > | ColaBinaryToColaAscii (const std::vector< uint8_t > &cola_telegram, bool parameter_to_ascii=true) |
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary. More... | |
static std::vector< uint8_t > | ColaTelegramToColaBinary (const sick_scan::SickLocColaTelegramMsg &cola_telegram, int parameter_is_ascii=-1) |
Converts and returns a Cola telegram to Cola-Binary. More... | |
static std::vector< uint8_t > | ConvertColaAscii (const std::string &cola_telegram) |
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary. More... | |
static std::string | ConvertColaAscii (const std::vector< uint8_t > &cola_telegram) |
Converts and returns a Cola-ASCII telegram to string. More... | |
static bool | IsColaBinary (const std::vector< uint8_t > &cola_telegram) |
Returns true for Cola-Binary, if a given telegram is Cola-Binary encoded and starts with 4 Bytes { 0x02, 0x02, 0x02, 0x02 }, otherwise false (Cola-ASCII telegram) More... | |
Static Protected Attributes | |
static const std::map< std::string, uint8_t > | s_ascii_map |
static ascii map to convert ascii to binary, f.e. s_ascii_map["<STX>"]:=0x02, s_ascii_map["<ETX>"]:=0x03, s_ascii_map["A"]:=0x41 and so on More... | |
static const std::string | s_ascii_table [256] |
static ascii table to convert binary to ascii, f.e. s_ascii_table[0x02]:="<STX>", s_ascii_table[0x03]:="<ETX>", s_ascii_table[0x41]:="A" and so on More... | |
class ColaAsciiBinaryConverter converts between Cola-ASCII and Cola-Binary telegrams. See Operation-Instruction-v1.1.0.241R.pdf, chapter 5.8 "About CoLa-A telegrams", page 46-48, Telegram-Listing-v1.1.0.241R.pdf, chapter 2.3.9 "Command: LocRequestTimestamp", page 21, and Technical_information_Telegram_Listing_NAV_LOC_en_IM0076556.PDF for further details about Cola telegrams.
Definition at line 78 of file cola_converter.h.
|
static |
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary.
[in] | cola_telegram | Cola-ASCII telegram, f.e. { 0x02, 0x73, 0x4D, 0x4E, 0x20, 0x53, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4D, 0x6F, 0x64, 0x65, 0x20, 0x33, 0x20, 0x46, 0x34, 0x37, 0x32, 0x34, 0x37, 0x34, 0x34, 0x03 } ("<STX>sMN SetAccessMode 3 F4724744<ETX>") |
[in] | parameter_is_ascii | Command parameter given in ascii (f.e. if 1, a parameter 0x31 == ASCII-"1" will be converted to 0x01 (default), otherwise to 0x01) |
[in] | parameter_is_ascii | Command parameter given in ascii (f.e. if 1, a parameter 0x31 == ASCII-"1" will be converted to 0x01 (default), otherwise to 0x01) parameter_is_ascii = 1: Command parameter given in ascii and will be converted to binary parameter_is_ascii = 0: Command parameter given binary and will be copied to binary output parameter_is_ascii = -1: Auto determination (1. assumption is true, 2. assumption is false in case of errors) |
[in] | cola_telegram | Cola-ASCII telegram, f.e. { 0x02, 0x73, 0x4D, 0x4E, 0x20, 0x53, 0x65, 0x74, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4D, 0x6F, 0x64, 0x65, 0x20, 0x33, 0x20, 0x46, 0x34, 0x37, 0x32, 0x34, 0x37, 0x34, 0x34, 0x03 } ("<STX>sMN SetAccessMode 3 F4724744<ETX>") |
[in] | parameter_is_ascii | Command parameter given in ascii (f.e. if 1, a parameter 0x31 == ASCII-"1" will be converted to 0x01 (default), otherwise to 0x01) parameter_is_ascii = 1: Command parameter given in ascii and will be converted to binary parameter_is_ascii = 0: Command parameter given binary and will be copied to binary output parameter_is_ascii = -1: Auto determination (1. assumption is true, 2. assumption is false in case of errors) |
Definition at line 162 of file cola_converter.cpp.
|
static |
Decodes the header and returns the length of a Cola-Binary telegram.
[in] | cola_telegram | Cola-Binary telegram |
Definition at line 354 of file cola_converter.cpp.
|
static |
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary.
[in] | cola_telegram | Cola-Binary telegram |
[in] | parameter_to_ascii | Conversion of command parameter to ascii (f.e. if true, a parameter 0x01 will be converted to 0x31 == ASCII-"1" (default), otherwise to 0x01) |
[in] | cola_telegram | Cola-Binary telegram |
[in] | parameter_to_ascii | Conversion of command parameter to ascii (f.e. if true, a parameter 0x01 == ASCII-"1" will be converted to 0x31 (default), otherwise to 0x01) |
Definition at line 267 of file cola_converter.cpp.
|
static |
Converts and returns a Cola telegram to Cola-Binary.
[in] | cola_telegram | Cola telegram, |
[in] | parameter_is_ascii | Command parameter given in ascii (f.e. if 1, a parameter 0x31 == ASCII-"1" will be converted to 0x01 (default), otherwise to 0x01) |
[in] | parameter_is_ascii | Command parameter given in ascii (f.e. if 1, a parameter 0x31 == ASCII-"1" will be converted to 0x01 (default), otherwise to 0x01) parameter_is_ascii = 1: Command parameter given in ascii and will be converted to binary parameter_is_ascii = 0: Command parameter given binary and will be copied to binary output parameter_is_ascii = -1: Auto determination (1. assumption is true, 2. assumption is false in case of errors) |
Definition at line 185 of file cola_converter.cpp.
|
static |
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary.
[in] | cola_telegram | Cola-ASCII string, f.e. "<STX>sMN SetAccessMode 3 F4724744<ETX>" |
Definition at line 122 of file cola_converter.cpp.
|
static |
Converts and returns a Cola-ASCII telegram to string.
[in] | cola_telegram | Cola-ASCII telegram, starting with 0x02 and ending with 0x03 |
Definition at line 105 of file cola_converter.cpp.
|
static |
Returns true for Cola-Binary, if a given telegram is Cola-Binary encoded and starts with 4 Bytes { 0x02, 0x02, 0x02, 0x02 }, otherwise false (Cola-ASCII telegram)
[in] | cola_telegram | Cola telegram (Cola-ASCII to Cola-Binary) |
Definition at line 342 of file cola_converter.cpp.
|
staticprotected |
static ascii map to convert ascii to binary, f.e. s_ascii_map["<STX>"]:=0x02, s_ascii_map["<ETX>"]:=0x03, s_ascii_map["A"]:=0x41 and so on
Definition at line 155 of file cola_converter.h.
|
staticprotected |
static ascii table to convert binary to ascii, f.e. s_ascii_table[0x02]:="<STX>", s_ascii_table[0x03]:="<ETX>", s_ascii_table[0x41]:="A" and so on
Definition at line 154 of file cola_converter.h.