DESERT 3.5.1
|
#include <uwinterpreterahoi.h>
Public Member Functions | |
UwInterpreterAhoi (int id) | |
~UwInterpreterAhoi () | |
std::string | serializePacket (ahoi::packet_t *packet) |
std::string | buildSend (ahoi::packet_t pck) |
std::string | buildID (int id) |
std::string | buildBatVol () |
std::string | buildReset () |
std::string | buildRange () |
std::string | buildAgc () |
std::string | buildRangeDelay () |
std::string | buildDistance () |
std::string | buildRxGain () |
std::string | buildTxGain () |
std::string | buildPacketStat () |
std::string | buildPacketStatReset () |
std::string | buildSyncStat () |
std::string | buildSyncStatReset () |
std::string | buildSfdStat () |
std::string | buildSfdStatReset () |
std::string | buildAllStat () |
std::string | buildAllStatReset () |
std::string | findResponse (std::vector< char >::iterator beg, std::vector< char >::iterator end, std::vector< char >::iterator &rsp_beg, std::vector< char >::iterator &rsp_end) |
void | fixEscapes (std::vector< char > &buffer, std::vector< char >::iterator &c_beg, std::vector< char >::iterator &c_end) |
std::shared_ptr< ahoi::packet_t > | parseResponse (std::vector< char >::iterator c_beg, std::vector< char >::iterator c_end) |
Private Attributes | |
uint8_t | id |
uint8_t | sn |
std::array< uint8_t, 2 > | beg_del |
std::array< uint8_t, 2 > | end_del |
Static Private Attributes | |
static uint | header_size = 6 |
static uint | footer_size = 6 |
static const uint8_t | dle = 0x10 |
static const uint8_t | stx = 0x02 |
static const uint8_t | etx = 0x03 |
Class used for building syntactically compliant commands to send to the ahoi! modems and interpreting the responses from ahoi! modems.
For doubts and requests please refer to: https://www.tuhh.de/smartport/research/acoustic-modem.html
Definition at line 53 of file uwinterpreterahoi.h.
UwInterpreterAhoi::UwInterpreterAhoi | ( | int | id | ) |
Constructor of the interpreter class.
id | integer identifier of the modem |
Definition at line 67 of file uwinterpreterahoi.cpp.
UwInterpreterAhoi::~UwInterpreterAhoi | ( | ) |
Destructor of the interpreter class.
Definition at line 80 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildAgc | ( | ) |
Method that builds the command.
Definition at line 167 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildAllStat | ( | ) |
Method that builds the command.
Definition at line 286 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildAllStatReset | ( | ) |
Method that builds the command.
Definition at line 303 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildBatVol | ( | ) |
Method that builds the command.
Definition at line 133 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildDistance | ( | ) |
Method that builds the command.
Definition at line 201 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildID | ( | int | id | ) |
Method that builds the command to ask the modem its own ID number.
id | integer identifier to set: if 0, ask for id |
Definition at line 115 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildPacketStat | ( | ) |
Method that builds the command.
Definition at line 252 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildPacketStatReset | ( | ) |
Method that builds the command.
Definition at line 269 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildRange | ( | ) |
Method that builds the command.
std::string UwInterpreterAhoi::buildRangeDelay | ( | ) |
Method that builds the command.
Definition at line 184 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildReset | ( | ) |
Method that builds the command.
Definition at line 150 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildRxGain | ( | ) |
Method that builds the command.
Definition at line 218 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildSend | ( | ahoi::packet_t | pck | ) |
Method that builds the command to send a given message.
msg | string message to be sent through the modem |
Definition at line 108 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildSfdStat | ( | ) |
Method that builds the command.
Definition at line 320 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildSfdStatReset | ( | ) |
Method that builds the command.
Definition at line 337 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildSyncStat | ( | ) |
Method that builds the command.
Definition at line 354 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildSyncStatReset | ( | ) |
Method that builds the command.
Definition at line 371 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::buildTxGain | ( | ) |
Method that builds the command.
Definition at line 235 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::findResponse | ( | std::vector< char >::iterator | beg, |
std::vector< char >::iterator | end, | ||
std::vector< char >::iterator & | rsp_beg, | ||
std::vector< char >::iterator & | rsp_end | ||
) |
Method that looks for ahoi! modem responses.
beg | beginning of the region to search |
end | end of the region to search |
rsp | beginning of the modem response found by the method |
Definition at line 388 of file uwinterpreterahoi.cpp.
void UwInterpreterAhoi::fixEscapes | ( | std::vector< char > & | buffer, |
std::vector< char >::iterator & | c_beg, | ||
std::vector< char >::iterator & | c_end | ||
) |
Method that erases an escape (DLE) char if part of 2-cahrs escape sequence.
iterator | pointing to the beginning of the response region |
iterator | pointing to the end of the response region |
Definition at line 421 of file uwinterpreterahoi.cpp.
std::shared_ptr< ahoi::packet_t > UwInterpreterAhoi::parseResponse | ( | std::vector< char >::iterator | c_beg, |
std::vector< char >::iterator | c_end | ||
) |
Method that parses a region of memory where a response was previously found.
This methods extracts the fields of the found response.
iterator | pointing to the beginning of the response region |
iterator | pointing to the end of the response region |
Definition at line 442 of file uwinterpreterahoi.cpp.
std::string UwInterpreterAhoi::serializePacket | ( | ahoi::packet_t * | packet | ) |
Serialize the provided packet.
packet | the ahoi::packet_t pck to be serialized |
Definition at line 85 of file uwinterpreterahoi.cpp.
|
private |
Beginning delimiter.
Definition at line 230 of file uwinterpreterahoi.h.
|
staticprivate |
Definition at line 226 of file uwinterpreterahoi.h.
|
private |
Ending delimiter.
Definition at line 231 of file uwinterpreterahoi.h.
|
staticprivate |
Ending sequence.
Definition at line 228 of file uwinterpreterahoi.h.
|
staticprivate |
Standard ahoi! packet has 6 bytes of header.
Definition at line 224 of file uwinterpreterahoi.h.
|
staticprivate |
Standard ahoi! packet has 6 bytes of header.
Definition at line 223 of file uwinterpreterahoi.h.
|
private |
Identifier of the modem: to fill the src addres field.
Definition at line 220 of file uwinterpreterahoi.h.
|
private |
Sequence number for commands tranmission: at end restart.
Definition at line 221 of file uwinterpreterahoi.h.
|
staticprivate |
Starting sequence.
Definition at line 227 of file uwinterpreterahoi.h.