|
DESERT 4.0.0
|
#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 () |
| void | setTerminator (std::string terminator) |
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 |
|
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
| UwInterpreterS2C::UwInterpreterS2C | ( | ) |
Class constructor
References usbl_info.
|
virtual |
Class destructor
| std::string UwInterpreterS2C::buildATDI | ( | ) |
Method that builds the command to check the IM delivery status
References w_term.
| 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.
References w_term.
| 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
References w_term.
| 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 |
References w_term.
| std::string UwInterpreterS2C::buildGetATAL | ( | ) |
Method that builds the command to set the local address of the device
References w_term.
| std::string UwInterpreterS2C::buildGetATL | ( | ) |
Method that builds the command to get the source level of the device
References w_term.
| 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 |
References ext_proto_mode, sep, and w_term.
| 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 |
References ext_proto_mode, sep, and w_term.
| 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 |
References w_term.
| 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 |
References w_term.
| 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 |
References NO_COMMAND, and syntax_pool.
| std::shared_ptr< USBLInfo > UwInterpreterS2C::getUSBLInfo | ( | ) |
Method to retrieve the USBL information saved upon reception of a USBL message
References usbl_info.
| 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. |
References BITRATE, BUFFER_FULL, BUSY, CURR_SETTINGS, DELIVERED, DELIVEREDIM, DELIVERING, DROPCNT, EMPTY, ext_proto_mode, FAIL, MODEM_STATUS, OK, r_term, RECV, RECVEND, RECVFAIL, RECVIM, RECVSTART, SENDEND, SENDSTART, UNKNOWN, usbl_info, USBLANGLES, and USBLLONG.
| 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 |
References ext_proto_mode.
|
inline |
Method that sets the terminator for the AT commands wrtten to device
| [in] | terminator | type of the terminator |
References w_term.
|
private |
Flag telling if Extened Protol Mode is in use
Referenced by buildSend(), buildSendIM(), parseResponse(), and setExtProtoMode().
|
private |
Terminating sequence for commands read from device
Referenced by parseResponse().
|
private |
Separator for paramters fo the commands: a comma
Referenced by buildSend(), and buildSendIM().
|
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.
Referenced by findResponse().
|
private |
Strucure holding info retrived via USBL message
Referenced by getUSBLInfo(), parseResponse(), and UwInterpreterS2C().
|
private |
Terminating sequence for commands wrtten to device
Referenced by buildATDI(), buildATS(), buildATV(), buildATZ(), buildGetATAL(), buildGetATL(), buildSend(), buildSendIM(), buildSetATAL(), buildSetATL(), and setTerminator().