DESERT 3.5.1
Loading...
Searching...
No Matches
UwInterpreterS2C Class Reference

#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< USBLInfogetUSBLInfo ()
 

Private Attributes

std::string sep
 
std::string r_term
 
std::string w_term
 
bool ext_proto_mode
 
std::shared_ptr< USBLInfousbl_info
 

Static Private Attributes

static std::vector< std::pair< std::string, UwInterpreterS2C::Response > > syntax_pool
 

Detailed Description

Definition at line 62 of file uwinterpreters2c.h.

Member Enumeration Documentation

◆ Response

enum class UwInterpreterS2C::Response
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.

Enumerator
RECVIM 
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 

Definition at line 70 of file uwinterpreters2c.h.

Constructor & Destructor Documentation

◆ UwInterpreterS2C()

UwInterpreterS2C::UwInterpreterS2C ( )

Class constructor.

Definition at line 73 of file uwinterpreters2c.cpp.

◆ ~UwInterpreterS2C()

UwInterpreterS2C::~UwInterpreterS2C ( )
virtual

Class destructor.

Definition at line 83 of file uwinterpreters2c.cpp.

Member Function Documentation

◆ buildATDI()

std::string UwInterpreterS2C::buildATDI ( )

Method that builds the command to check the IM delivery status.

Returns
string of the requested command

Definition at line 151 of file uwinterpreters2c.cpp.

◆ buildATS()

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.

Returns
string of the requested command

Definition at line 158 of file uwinterpreters2c.cpp.

◆ buildATV()

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.

Returns
string of the requested command

Definition at line 165 of file uwinterpreters2c.cpp.

◆ buildATZ()

std::string UwInterpreterS2C::buildATZ ( int  level)

Method that builds a reboot sequence: depending on the provided index different levels of reset can be requested.

Parameters
levelinteger level of reset requested
Returns
string of the requested command

Definition at line 136 of file uwinterpreters2c.cpp.

◆ buildGetATAL()

std::string UwInterpreterS2C::buildGetATAL ( )

Method that builds the command to set the local address of the device.

Returns
string of the requested command

Definition at line 196 of file uwinterpreters2c.cpp.

◆ buildGetATL()

std::string UwInterpreterS2C::buildGetATL ( )

Method that builds the command to get the source level of the device.

Returns
string of the requested command

Definition at line 172 of file uwinterpreters2c.cpp.

◆ buildSend()

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.

Parameters
msgstring containing the payload to be sent
destinteger number representing the destination local address
Returns
string of the requested command

Definition at line 88 of file uwinterpreters2c.cpp.

◆ buildSendIM()

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.

Parameters
msgstring containing the payload to be sent
destinteger number representing the destination local address
ackboolean set to true if ACK is needed, false otherwise
Returns
string of the requested command

Definition at line 107 of file uwinterpreters2c.cpp.

◆ buildSetATAL()

std::string UwInterpreterS2C::buildSetATAL ( int  addr)

Method that builds the command to set the local address of the device.

Parameters
levelinteger value of the Local Address of the device
Returns
string of the requested command

Definition at line 206 of file uwinterpreters2c.cpp.

◆ buildSetATL()

std::string UwInterpreterS2C::buildSetATL ( int  level)

Method that builds the command to set the source level of the device.

Parameters
levelinteger level of the Source Level of the device
Returns
string of the requested command

Definition at line 181 of file uwinterpreters2c.cpp.

◆ findResponse()

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.

Parameters
begiterator to beginning of search section
enditerator to end of search section
rspoutput iterator first response found
Returns
type of the first valid response found, of type UwInterpreterS2C::Response

Definition at line 221 of file uwinterpreters2c.cpp.

◆ getUSBLInfo()

std::shared_ptr< USBLInfo > UwInterpreterS2C::getUSBLInfo ( )

Method to retrieve the USBL information saved upon reception of a USBL message.

Returns
USBLinfo structure loaded with values

Definition at line 1306 of file uwinterpreters2c.cpp.

◆ parseResponse()

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.

Parameters
[in]rspresponse found by call to UwInterpreterS2C::findResponse
[in]endbeginning of the buffer section to parse
[in]rsp_begof the responses as found by findResponse()
[out]rsp_endof the response, if found by parsing
[out]rx_payloadcontaining the payload stored in the response, if any.
Returns
false if attempt to parse command fails (e.g., for missing bytes)

Definition at line 247 of file uwinterpreters2c.cpp.

◆ setExtProtoMode()

void UwInterpreterS2C::setExtProtoMode ( bool  enabled)

Method that sets whether Extended Protocol Mode is used or not.

Parameters
enabledtrue if Extended Protocol Mode is used, false otherwise

Definition at line 1300 of file uwinterpreters2c.cpp.

Member Data Documentation

◆ ext_proto_mode

bool UwInterpreterS2C::ext_proto_mode
private

Flag telling if Extened Protol Mode is in use.

Definition at line 242 of file uwinterpreters2c.h.

◆ r_term

std::string UwInterpreterS2C::r_term
private

Terminating sequence for commands read from device.

Definition at line 239 of file uwinterpreters2c.h.

◆ sep

std::string UwInterpreterS2C::sep
private

Separator for paramters fo the commands: a comma.

Definition at line 238 of file uwinterpreters2c.h.

◆ syntax_pool

std::vector< std::pair< std::string, UwInterpreterS2C::Response > > UwInterpreterS2C::syntax_pool
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.

◆ usbl_info

std::shared_ptr<USBLInfo> UwInterpreterS2C::usbl_info
private

Strucure holding info retrived via USBL message.

Definition at line 244 of file uwinterpreters2c.h.

◆ w_term

std::string UwInterpreterS2C::w_term
private

Terminating sequence for commands wrtten to device.

Definition at line 240 of file uwinterpreters2c.h.


The documentation for this class was generated from the following files: