|
DESERT 4.0.0
|
#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
| UwInterpreterAhoi::UwInterpreterAhoi | ( | int | id | ) |
| UwInterpreterAhoi::~UwInterpreterAhoi | ( | ) |
Destructor of the interpreter class
| std::string UwInterpreterAhoi::buildAgc | ( | ) |
Method that builds the command
References ahoi::agc, ahoi::commands_id, id, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildAllStat | ( | ) |
Method that builds the command
References ahoi::allstat, ahoi::commands_id, id, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildAllStatReset | ( | ) |
Method that builds the command
References ahoi::allstatreset, ahoi::commands_id, id, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildBatVol | ( | ) |
Method that builds the command
References ahoi::batvol, ahoi::commands_id, id, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildDistance | ( | ) |
Method that builds the command
References ahoi::commands_id, ahoi::distance, id, serializePacket(), and sn.

| 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 |
References ahoi::commands_id, ahoi::id, id, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildPacketStat | ( | ) |
Method that builds the command
References ahoi::commands_id, id, ahoi::packetstat, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildPacketStatReset | ( | ) |
Method that builds the command
References ahoi::commands_id, id, ahoi::packetstatreset, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildRange | ( | ) |
Method that builds the command
| std::string UwInterpreterAhoi::buildRangeDelay | ( | ) |
Method that builds the command
References ahoi::commands_id, id, ahoi::range_delay, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildReset | ( | ) |
Method that builds the command
References ahoi::commands_id, id, ahoi::reset, serializePacket(), and sn.

| std::string UwInterpreterAhoi::buildRxGain | ( | ) |
Method that builds the command
References ahoi::commands_id, id, ahoi::rxgain, serializePacket(), and sn.

| 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 |
References serializePacket().

| std::string UwInterpreterAhoi::buildSfdStat | ( | ) |
Method that builds the command
References ahoi::commands_id, id, serializePacket(), ahoi::sfdstat, and sn.

| std::string UwInterpreterAhoi::buildSfdStatReset | ( | ) |
Method that builds the command
References ahoi::commands_id, id, serializePacket(), ahoi::sfdstatreset, and sn.

| std::string UwInterpreterAhoi::buildSyncStat | ( | ) |
Method that builds the command
References ahoi::commands_id, id, serializePacket(), sn, and ahoi::syncstat.

| std::string UwInterpreterAhoi::buildSyncStatReset | ( | ) |
Method that builds the command
References ahoi::commands_id, id, serializePacket(), sn, and ahoi::syncstatreset.

| std::string UwInterpreterAhoi::buildTxGain | ( | ) |
Method that builds the command
References ahoi::commands_id, id, serializePacket(), sn, and ahoi::txgain.

| 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 |
References dle, end_del, etx, ahoi::HEADER_LEN, and stx.
| 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 |
References dle.
| 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 |
| std::string UwInterpreterAhoi::serializePacket | ( | ahoi::packet_t * | packet | ) |
Serialize the provided packet.
| packet | the ahoi::packet_t pck to be serialized |
References dle, etx, header_size, and stx.
Referenced by buildAgc(), buildAllStat(), buildAllStatReset(), buildBatVol(), buildDistance(), buildID(), buildPacketStat(), buildPacketStatReset(), buildRangeDelay(), buildReset(), buildRxGain(), buildSend(), buildSfdStat(), buildSfdStatReset(), buildSyncStat(), buildSyncStatReset(), and buildTxGain().
|
private |
Beginning delimiter
Referenced by parseResponse(), and UwInterpreterAhoi().
|
staticprivate |
Referenced by findResponse(), fixEscapes(), serializePacket(), and UwInterpreterAhoi().
|
private |
Ending delimiter
Referenced by findResponse(), parseResponse(), and UwInterpreterAhoi().
|
staticprivate |
Ending sequence
Referenced by findResponse(), serializePacket(), and UwInterpreterAhoi().
|
staticprivate |
Standard ahoi! packet has 6 bytes of header
|
staticprivate |
Standard ahoi! packet has 6 bytes of header
Referenced by serializePacket().
|
private |
Identifier of the modem: to fill the src addres field
Referenced by buildAgc(), buildAllStat(), buildAllStatReset(), buildBatVol(), buildDistance(), buildID(), buildPacketStat(), buildPacketStatReset(), buildRangeDelay(), buildReset(), buildRxGain(), buildSfdStat(), buildSfdStatReset(), buildSyncStat(), buildSyncStatReset(), and buildTxGain().
|
private |
Sequence number for commands tranmission: at end restart
Referenced by buildAgc(), buildAllStat(), buildAllStatReset(), buildBatVol(), buildDistance(), buildID(), buildPacketStat(), buildPacketStatReset(), buildRangeDelay(), buildReset(), buildRxGain(), buildSfdStat(), buildSfdStatReset(), buildSyncStat(), buildSyncStatReset(), and buildTxGain().
|
staticprivate |
Starting sequence
Referenced by findResponse(), serializePacket(), and UwInterpreterAhoi().