DESERT 3.5.1
|
#include <uwinterpreters2c.h>
Public Types | |
enum class | Response { RECVIM = 0 , RECV , OK , EMPTY , BUSY , DELIVERING , DELIVERED , DELIVEREDIM , DROPCNT , PHYOFF , NOT_ACCEPTED , WRONG_ADDR , CONN_CLOSED , BUFF_NOT_EMPTY , OUT_OF_RANGE , PROTOCOL_ID , INTERNAL , BUFFER_FULL , FAIL , CURR_SETTINGS , MODEM_STATUS , INIT_NOISE , INIT_DEAF , INIT_LISTEN , RECVSTART , RECVEND , RECVFAIL , SENDSTART , SENDEND , BITRATE , UNKNOWN , USBLANGLES , USBLLONG , NO_COMMAND } |
Public Member Functions | |
UwInterpreterS2C () | |
virtual | ~UwInterpreterS2C () |
std::string | buildSend (std::string msg, int dest) |
std::string | buildSendIM (std::string msg, int dest, bool ack) |
std::string | buildATZ (int level) |
std::string | buildGetATL () |
std::string | buildSetATL (int level) |
std::string | buildGetATAL () |
std::string | buildSetATAL (int addr) |
std::string | buildATDI () |
std::string | buildATS () |
std::string | buildATV () |
UwInterpreterS2C::Response | findResponse (std::vector< char >::iterator beg, std::vector< char >::iterator end, std::vector< char >::iterator &rsp) |
bool | parseResponse (UwInterpreterS2C::Response rsp, std::vector< char >::iterator end, std::vector< char >::iterator rsp_beg, std::vector< char >::iterator &rsp_end, std::string &rx_payload) |
void | setExtProtoMode (bool enabled) |
std::shared_ptr< USBLInfo > | getUSBLInfo () |
Private Attributes | |
std::string | sep |
std::string | r_term |
std::string | w_term |
bool | ext_proto_mode |
std::shared_ptr< USBLInfo > | usbl_info |
Static Private Attributes | |
static std::vector< std::pair< std::string, UwInterpreterS2C::Response > > | syntax_pool |
Definition at line 62 of file uwinterpreters2c.h.
|
strong |
Enum listing the types of commands that could be received or sent by a S2C device; See the EvoLogics S2C manuals or reach for www.evologics.de.
Definition at line 70 of file uwinterpreters2c.h.
UwInterpreterS2C::UwInterpreterS2C | ( | ) |
Class constructor.
Definition at line 73 of file uwinterpreters2c.cpp.
|
virtual |
Class destructor.
Definition at line 83 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildATDI | ( | ) |
Method that builds the command to check the IM delivery status.
Definition at line 151 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildATS | ( | ) |
Method that builds the command to ask for modem status: it enlists local address, acoustic link status and pool status and whether promiscous mode is on.
Definition at line 158 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildATV | ( | ) |
Method that builds the command to ask for current settings: it enlists source level, gain, retry timeout, carrier ID and other See the EvoLogics S2C manuals or reach for www.evologics.de.
Definition at line 165 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildATZ | ( | int | level | ) |
Method that builds a reboot sequence: depending on the provided index different levels of reset can be requested.
level | integer level of reset requested |
Definition at line 136 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildGetATAL | ( | ) |
Method that builds the command to set the local address of the device.
Definition at line 196 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildGetATL | ( | ) |
Method that builds the command to get the source level of the device.
Definition at line 172 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildSend | ( | std::string | msg, |
int | dest | ||
) |
Method that builds the command to send data through SEND command SEND is used to send burst data: payload is saved in S2C internal memory until the device is ready to transmit, at the negotiated bitrate.
msg | string containing the payload to be sent |
dest | integer number representing the destination local address |
Definition at line 88 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildSendIM | ( | std::string | msg, |
int | dest, | ||
bool | ack | ||
) |
Method that builds the command to send data through SENDIM command SENDIM is used to send Instant Messages: these messages are immediately transmitted at the minimum bitrate availbale in the device.
msg | string containing the payload to be sent |
dest | integer number representing the destination local address |
ack | boolean set to true if ACK is needed, false otherwise |
Definition at line 107 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildSetATAL | ( | int | addr | ) |
Method that builds the command to set the local address of the device.
level | integer value of the Local Address of the device |
Definition at line 206 of file uwinterpreters2c.cpp.
std::string UwInterpreterS2C::buildSetATL | ( | int | level | ) |
Method that builds the command to set the source level of the device.
level | integer level of the Source Level of the device |
Definition at line 181 of file uwinterpreters2c.cpp.
UwInterpreterS2C::Response UwInterpreterS2C::findResponse | ( | std::vector< char >::iterator | beg, |
std::vector< char >::iterator | end, | ||
std::vector< char >::iterator & | rsp | ||
) |
Method to look for S2C response inside a provided chunk of unparsed data This method only finds the beginning of the returned response,not the end.
beg | iterator to beginning of search section |
end | iterator to end of search section |
rsp | output iterator first response found |
Definition at line 221 of file uwinterpreters2c.cpp.
std::shared_ptr< USBLInfo > UwInterpreterS2C::getUSBLInfo | ( | ) |
Method to retrieve the USBL information saved upon reception of a USBL message.
Definition at line 1306 of file uwinterpreters2c.cpp.
bool UwInterpreterS2C::parseResponse | ( | UwInterpreterS2C::Response | rsp, |
std::vector< char >::iterator | end, | ||
std::vector< char >::iterator | rsp_beg, | ||
std::vector< char >::iterator & | rsp_end, | ||
std::string & | rx_payload | ||
) |
Method that tries to parse a found response: if the response section of the buffer, which needs to be passed, is found to be incomplete, the method return false.
If parsing is successful, proper action is taken. The method also locates the end of the response looking for term
.
[in] | rsp | response found by call to UwInterpreterS2C::findResponse |
[in] | end | beginning of the buffer section to parse |
[in] | rsp_beg | of the responses as found by findResponse() |
[out] | rsp_end | of the response, if found by parsing |
[out] | rx_payload | containing the payload stored in the response, if any. |
Definition at line 247 of file uwinterpreters2c.cpp.
void UwInterpreterS2C::setExtProtoMode | ( | bool | enabled | ) |
Method that sets whether Extended Protocol Mode is used or not.
enabled | true if Extended Protocol Mode is used, false otherwise |
Definition at line 1300 of file uwinterpreters2c.cpp.
|
private |
Flag telling if Extened Protol Mode is in use.
Definition at line 242 of file uwinterpreters2c.h.
|
private |
Terminating sequence for commands read from device.
Definition at line 239 of file uwinterpreters2c.h.
|
private |
Separator for paramters fo the commands: a comma.
Definition at line 238 of file uwinterpreters2c.h.
|
staticprivate |
Vector holding all possible commands for the S2C syntax and corresponding identifying token.
It is important that RECV and RECVIM remain at the beginning, as the other commands may be inside the binary payload of these two.
Definition at line 36 of file uwinterpreters2c.h.
|
private |
Strucure holding info retrived via USBL message.
Definition at line 244 of file uwinterpreters2c.h.
|
private |
Terminating sequence for commands wrtten to device.
Definition at line 240 of file uwinterpreters2c.h.