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

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ UwInterpreterAhoi()

UwInterpreterAhoi::UwInterpreterAhoi ( int  id)

Constructor of the interpreter class.

Parameters
idinteger identifier of the modem

Definition at line 67 of file uwinterpreterahoi.cpp.

◆ ~UwInterpreterAhoi()

UwInterpreterAhoi::~UwInterpreterAhoi ( )

Destructor of the interpreter class.

Definition at line 80 of file uwinterpreterahoi.cpp.

Member Function Documentation

◆ buildAgc()

std::string UwInterpreterAhoi::buildAgc ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 167 of file uwinterpreterahoi.cpp.

◆ buildAllStat()

std::string UwInterpreterAhoi::buildAllStat ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 286 of file uwinterpreterahoi.cpp.

◆ buildAllStatReset()

std::string UwInterpreterAhoi::buildAllStatReset ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 303 of file uwinterpreterahoi.cpp.

◆ buildBatVol()

std::string UwInterpreterAhoi::buildBatVol ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 133 of file uwinterpreterahoi.cpp.

◆ buildDistance()

std::string UwInterpreterAhoi::buildDistance ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 201 of file uwinterpreterahoi.cpp.

◆ buildID()

std::string UwInterpreterAhoi::buildID ( int  id)

Method that builds the command to ask the modem its own ID number.

Parameters
idinteger identifier to set: if 0, ask for id
Returns
string containing the symbols of the command

Definition at line 115 of file uwinterpreterahoi.cpp.

◆ buildPacketStat()

std::string UwInterpreterAhoi::buildPacketStat ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 252 of file uwinterpreterahoi.cpp.

◆ buildPacketStatReset()

std::string UwInterpreterAhoi::buildPacketStatReset ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 269 of file uwinterpreterahoi.cpp.

◆ buildRange()

std::string UwInterpreterAhoi::buildRange ( )

Method that builds the command.

Returns
string containing the symbols of the command

◆ buildRangeDelay()

std::string UwInterpreterAhoi::buildRangeDelay ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 184 of file uwinterpreterahoi.cpp.

◆ buildReset()

std::string UwInterpreterAhoi::buildReset ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 150 of file uwinterpreterahoi.cpp.

◆ buildRxGain()

std::string UwInterpreterAhoi::buildRxGain ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 218 of file uwinterpreterahoi.cpp.

◆ buildSend()

std::string UwInterpreterAhoi::buildSend ( ahoi::packet_t  pck)

Method that builds the command to send a given message.

Parameters
msgstring message to be sent through the modem
Returns
formatted string for sending msg

Definition at line 108 of file uwinterpreterahoi.cpp.

◆ buildSfdStat()

std::string UwInterpreterAhoi::buildSfdStat ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 320 of file uwinterpreterahoi.cpp.

◆ buildSfdStatReset()

std::string UwInterpreterAhoi::buildSfdStatReset ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 337 of file uwinterpreterahoi.cpp.

◆ buildSyncStat()

std::string UwInterpreterAhoi::buildSyncStat ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 354 of file uwinterpreterahoi.cpp.

◆ buildSyncStatReset()

std::string UwInterpreterAhoi::buildSyncStatReset ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 371 of file uwinterpreterahoi.cpp.

◆ buildTxGain()

std::string UwInterpreterAhoi::buildTxGain ( )

Method that builds the command.

Returns
string containing the symbols of the command

Definition at line 235 of file uwinterpreterahoi.cpp.

◆ findResponse()

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.

Parameters
begbeginning of the region to search
endend of the region to search
rspbeginning of the modem response found by the method
Returns
boolean true if the method found a command

Definition at line 388 of file uwinterpreterahoi.cpp.

◆ fixEscapes()

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.

Parameters
iteratorpointing to the beginning of the response region
iteratorpointing to the end of the response region

Definition at line 421 of file uwinterpreterahoi.cpp.

◆ parseResponse()

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.

Parameters
iteratorpointing to the beginning of the response region
iteratorpointing to the end of the response region
Returns
packet filled with the correct fields

Definition at line 442 of file uwinterpreterahoi.cpp.

◆ serializePacket()

std::string UwInterpreterAhoi::serializePacket ( ahoi::packet_t *  packet)

Serialize the provided packet.

Parameters
packetthe ahoi::packet_t pck to be serialized
Returns
a vector of uint8_t of serialized data

Definition at line 85 of file uwinterpreterahoi.cpp.

Member Data Documentation

◆ beg_del

std::array<uint8_t, 2> UwInterpreterAhoi::beg_del
private

Beginning delimiter.

Definition at line 230 of file uwinterpreterahoi.h.

◆ dle

const uint8_t UwInterpreterAhoi::dle = 0x10
staticprivate

Definition at line 226 of file uwinterpreterahoi.h.

◆ end_del

std::array<uint8_t, 2> UwInterpreterAhoi::end_del
private

Ending delimiter.

Definition at line 231 of file uwinterpreterahoi.h.

◆ etx

const uint8_t UwInterpreterAhoi::etx = 0x03
staticprivate

Ending sequence.

Definition at line 228 of file uwinterpreterahoi.h.

◆ footer_size

uint UwInterpreterAhoi::footer_size = 6
staticprivate

Standard ahoi! packet has 6 bytes of header.

Definition at line 224 of file uwinterpreterahoi.h.

◆ header_size

uint UwInterpreterAhoi::header_size = 6
staticprivate

Standard ahoi! packet has 6 bytes of header.

Definition at line 223 of file uwinterpreterahoi.h.

◆ id

uint8_t UwInterpreterAhoi::id
private

Identifier of the modem: to fill the src addres field.

Definition at line 220 of file uwinterpreterahoi.h.

◆ sn

uint8_t UwInterpreterAhoi::sn
private

Sequence number for commands tranmission: at end restart.

Definition at line 221 of file uwinterpreterahoi.h.

◆ stx

const uint8_t UwInterpreterAhoi::stx = 0x02
staticprivate

Starting sequence.

Definition at line 227 of file uwinterpreterahoi.h.


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