DESERT 3.5.1
|
#include <uwahoimodem.h>
Public Types | |
enum class | ModemState { AVAILABLE = 0 , TRANSMITTING , CONFIGURING } |
enum class | TransmissionState { TX_IDLE = 0 , TX_WAITING } |
![]() | |
enum class | LogLevel { ERROR = 0 , INFO = 1 , DEBUG = 2 } |
Public Member Functions | |
UwAhoiModem () | |
virtual | ~UwAhoiModem () |
virtual void | recv (Packet *p) |
virtual int | recvSyncClMsg (ClMessage *m) |
virtual int | command (int argc, const char *const *argv) |
![]() | |
UwModem () | |
virtual | ~UwModem () |
virtual double | getTxDuration (Packet *p) |
virtual int | getModulationType (Packet *P) |
void | setModemID (int ID) |
int | getModemID () |
void | printOnLog (LogLevel log_level, string module, string message) |
LogLevel | getLogLevel () |
int | getDebug () |
std::string | getLogFile () |
void | realTxEnded (Packet *p) |
Private Member Functions | |
virtual void | startTx (Packet *p) |
virtual void | startRx (Packet *p) |
virtual void | endRx (Packet *p) |
virtual void | start () |
virtual void | stop () |
virtual void | transmittingData () |
virtual void | receivingData () |
void | updateStatus (std::shared_ptr< ahoi::packet_t > packet) |
ahoi::packet_t | fillAhoiPkt (Packet *p) |
void | createRxPacket (Packet *p) |
bool | parseFooter (std::shared_ptr< ahoi::footer_t > footer) |
bool | storePacketInfo (std::shared_ptr< ahoi::packet_t > header, Packet *p) |
void | updateSN () |
Private Attributes | |
std::unique_ptr< UwConnector > | p_connector |
std::unique_ptr< UwInterpreterAhoi > | p_interpreter |
ModemState | status |
TransmissionState | tx_status |
std::mutex | status_m |
std::mutex | tx_status_m |
std::mutex | tx_queue_m |
std::condition_variable | status_cv |
std::condition_variable | tx_status_cv |
std::condition_variable | tx_queue_cv |
std::atomic< bool > | receiving |
std::atomic< bool > | transmitting |
std::thread | rx_thread |
std::thread | tx_thread |
std::string | rx_payload |
double | virtual_time_ref |
std::chrono::milliseconds | WAIT_DELIVERY |
ahoi::packet_t | tmpPacket |
uint | id |
int | parity_bit |
int | stop_bit |
int | flow_control |
int | baud_rate |
uint | power |
uint | rssi |
uint | bit_errors |
uint | agc_mean |
uint | agc_min |
uint | agc_max |
Static Private Attributes | |
static const std::chrono::milliseconds | MODEM_TIMEOUT |
static uint | MAX_RETX = 0 |
static uint8_t | sn = 0 |
static const double | EPSILON_S |
static uint | WAIT_DELIVERY_INT = 3000 |
Additional Inherited Members | |
![]() | |
static bool | string2log (const std::string &ll_string, LogLevel &ll) |
static bool | log2string (LogLevel ll, std::string &ll_string) |
![]() | |
virtual void | endTx (Packet *p) |
void | checkEvent () |
![]() | |
int | modemID |
std::vector< char > | data_buffer |
std::queue< Packet * > | tx_queue |
std::queue< Packet * > | rx_queue |
unsigned int | DATA_BUFFER_LEN |
int | MAX_READ_BYTES |
std::string | modem_address |
int | debug_ |
std::ofstream | outLog |
std::string | logFile |
std::string | log_suffix |
LogLevel | loglevel_ |
bool | log_is_open |
CheckTimer * | checkTimer |
double | period |
std::queue< ModemEvent > | event_q |
The ahoi! modems are an underwater acoustic modems developed by TUUH University, Hamburg by the SmartPORT Group.
The reference website can be found here: https://www.tuhh.de/smartport/research/acoustic-modem.html
Definition at line 56 of file uwahoimodem.h.
|
strong |
Enum type for the modem general state.
AVAILABLE: immediately available to perform an operation TRANSMITTING: executing a tranmission command: must wait for it ot complete CONFIGURING: executing a configuration command: must wait for it to complete
Enumerator | |
---|---|
AVAILABLE | |
TRANSMITTING | |
CONFIGURING |
Definition at line 65 of file uwahoimodem.h.
|
strong |
Enum type for the trasnmission state.
TX_IDLE: the modem is available for transmission of a new packet TX_WAITING: a packet was tranmitted but the command was not acknowledged
Enumerator | |
---|---|
TX_IDLE | |
TX_WAITING |
Definition at line 72 of file uwahoimodem.h.
UwAhoiModem::UwAhoiModem | ( | ) |
Constructor of the UwAhoiModem class.
address | string containing the address to connect to |
buflen | lenght in char of the data buffer |
read | len length in char of a signle read from the connector |
Definition at line 73 of file uwahoimodem.cpp.
|
virtual |
Destructor of the UwAhoiModem class.
Definition at line 116 of file uwahoimodem.cpp.
|
virtual |
Tcl command interpreter: Method that maps Tcl commands into C++ methods.
argc | number of arguments in argv |
argv | array of strings which are the command parameters (Note that argv[0] is the name of the object). |
Reimplemented from UwModem.
Definition at line 164 of file uwahoimodem.cpp.
|
private |
Method that fills up a packet with the needed header and payload and makes it ready to be sent to the layer above.
p | instance of an empty packet to be filled |
Definition at line 450 of file uwahoimodem.cpp.
|
privatevirtual |
Method that ends a packet reception.
This method is also in charge of sending the received NS-MIRACLE packet to the upper layers
p | Packet pointer to the packet being sent |
Implements UwModem.
Definition at line 262 of file uwahoimodem.cpp.
|
private |
Method that fills the fields of an ahoi! packet with the needed values, so that later it can be serialized.
param p Packet pointer of the DESERT packet
Definition at line 229 of file uwahoimodem.cpp.
|
private |
Method that extarcts fields from a provided ahoi! packet and save the info values to class field for later access.
Info parameters include values such as received power, RSSI, number of corrupted packets, ecc...
packet | the packet from which to extract the values |
Definition at line 490 of file uwahoimodem.cpp.
|
privatevirtual |
Mehod that detach a thread devoted to receiving data from the connector.
Definition at line 393 of file uwahoimodem.cpp.
|
virtual |
Method that handles the reception of packets arriving from upper layers of the network simulator.
p | pointer to the packet that has been received from the simulator upper layers |
Implements UwModem.
Definition at line 122 of file uwahoimodem.cpp.
|
virtual |
Cross-Layer messages synchronous interpreter.
ClMessage* | an instance of ClMessage that represent the message received |
Implements UwModem.
Definition at line 170 of file uwahoimodem.cpp.
|
privatevirtual |
Method that starts the driver operations.
It performs all the needed operations to correctly fire up the device's driver.
Implements UwModem.
Definition at line 269 of file uwahoimodem.cpp.
|
privatevirtual |
Method that starts a packet reception.
This method is also in charge of sending a ClMsg, Phy2MacStartRx(p), to notify the upper layers of the simulator about the start of the reception
p | Packet pointer to the packet to be received |
Implements UwModem.
Definition at line 255 of file uwahoimodem.cpp.
|
privatevirtual |
Method that triggers the transmission of a packet through a specified modem.
p | Packet pointer to the packet to be sent |
Implements UwModem.
Definition at line 176 of file uwahoimodem.cpp.
|
privatevirtual |
Method that stops the driver operations.
It performs all the needed operations to correctly stop the device's driver before closing the simulation.
Implements UwModem.
Definition at line 322 of file uwahoimodem.cpp.
|
private |
Method that extarcts fields from a provided ahoi! packet and save the info values to class field for later access.
Info parameters include values such as received power, RSSI, number of corrupted packets, ecc...
header | ahoi header the packet from which to extract the values |
p | ns2 packet in which to save the destination address, ecc... |
Definition at line 461 of file uwahoimodem.cpp.
|
privatevirtual |
Method that detach a thread devoted to sending packets found in tx_queue.
Definition at line 342 of file uwahoimodem.cpp.
|
private |
Method for Sequence Number (SN) update.
Definition at line 577 of file uwahoimodem.cpp.
|
private |
Method that updates the status of the modem State Machine: state change is triggered by recepting the response packet from the ahoi! modem on the connector interface.
packet | packet received on the connector interface |
Definition at line 503 of file uwahoimodem.cpp.
|
private |
Maximum gain set by the AGC (if used) in reception of the last packet.
Definition at line 286 of file uwahoimodem.h.
|
private |
Mean gain set by the AGC (if used) in reception of the last packet.
Definition at line 282 of file uwahoimodem.h.
|
private |
Minimum gain set by the AGC (if used) in reception of the last packet.
Definition at line 284 of file uwahoimodem.h.
|
private |
Integer for port baud rate.
Definition at line 272 of file uwahoimodem.h.
|
private |
Number of repaired bit errors during reception in the last packet.
Definition at line 280 of file uwahoimodem.h.
|
staticprivate |
minimum time to wait before to schedule a new event in seconds
Definition at line 248 of file uwahoimodem.h.
|
private |
flag for flow control
Definition at line 270 of file uwahoimodem.h.
|
private |
Modem ID, to be set in simulation.
Definition at line 263 of file uwahoimodem.h.
|
staticprivate |
Maximum number of retransmissions for the same packet.
Definition at line 239 of file uwahoimodem.h.
|
staticprivate |
Maximum time to wait for modem to become ModemState::AVAILABLE.
Definition at line 237 of file uwahoimodem.h.
|
private |
Pointer to Connector object that interfaces with the device.
Definition at line 204 of file uwahoimodem.h.
|
private |
Pointer to Interpreter object to parse device syntax.
Definition at line 207 of file uwahoimodem.h.
|
private |
flag for parity bit
Definition at line 266 of file uwahoimodem.h.
|
private |
Received power (RMSE) ratio and "ideal packet".
Above 100 = clipping
Definition at line 276 of file uwahoimodem.h.
|
private |
Atomic boolean variable that controls the receiving looping thread.
Definition at line 227 of file uwahoimodem.h.
|
private |
|
private |
String that is updated witn each new received messsage.
Definition at line 235 of file uwahoimodem.h.
|
private |
Object with the rx thread.
Definition at line 231 of file uwahoimodem.h.
|
staticprivate |
Sequence number, which follows all the packets transmitted to the modem.
Definition at line 242 of file uwahoimodem.h.
|
private |
Variable holding the current status of the modem.
Definition at line 209 of file uwahoimodem.h.
|
private |
Condition variable to wait for ModemState::AVAILABLE.
Definition at line 221 of file uwahoimodem.h.
|
private |
Mutex associated with the state machine of the modem.
Definition at line 215 of file uwahoimodem.h.
|
private |
flag for stop bit
Definition at line 268 of file uwahoimodem.h.
|
private |
Packet to be checked to unlock state machine.
Definition at line 260 of file uwahoimodem.h.
|
private |
Atomic boolean variable that controls the transmitting looping thread.
Definition at line 229 of file uwahoimodem.h.
|
private |
Condition variable that is linked with the transmitting queue.
Definition at line 225 of file uwahoimodem.h.
|
private |
Mutex associated with the transmission queue.
Definition at line 219 of file uwahoimodem.h.
|
private |
Variable holding the current transmission status of the modem.
Definition at line 211 of file uwahoimodem.h.
|
private |
Condition variable to wait for TransmissionState::TX_IDLE.
Definition at line 223 of file uwahoimodem.h.
|
private |
Mutex associated with the state machine of the transmission process.
Definition at line 217 of file uwahoimodem.h.
|
private |
Object with the tx thread.
Definition at line 233 of file uwahoimodem.h.
|
private |
virtual time reference
Definition at line 245 of file uwahoimodem.h.
|
private |
Time interval to wait for the modem notifying the response of a given packet.
Definition at line 252 of file uwahoimodem.h.
|
staticprivate |
Time interval matching the WAIT_DELIVERY variable: version of type int to match the chrono one, needed because TclObject::bind does not support binding std::chrono variable [milliseconds]
Definition at line 257 of file uwahoimodem.h.