#include <uwahoimodem.h>
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
◆ ModemState
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 | |
◆ TransmissionState
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 | |
◆ UwAhoiModem()
| UwAhoiModem::UwAhoiModem |
( |
| ) |
|
◆ ~UwAhoiModem()
| UwAhoiModem::~UwAhoiModem |
( |
| ) |
|
|
virtual |
◆ command()
| int UwAhoiModem::command |
( |
int |
argc, |
|
|
const char *const * |
argv |
|
) |
| |
|
virtual |
Tcl command interpreter: Method that maps Tcl commands into C++ methods.
- Parameters
-
| 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). |
- Returns
- TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not
Reimplemented from UwModem.
References UwModem::command().
◆ createRxPacket()
| void UwAhoiModem::createRxPacket |
( |
Packet * |
p | ) |
|
|
private |
◆ endRx()
| void UwAhoiModem::endRx |
( |
Packet * |
p | ) |
|
|
privatevirtual |
Method that ends a packet reception. This method is also in charge of sending the received NS-MIRACLE packet to the upper layers
- Parameters
-
| p | Packet pointer to the packet being sent |
Implements UwModem.
References UwModem::INFO, and UwModem::printOnLog().
Referenced by recv().
◆ fillAhoiPkt()
| ahoi::packet_t UwAhoiModem::fillAhoiPkt |
( |
Packet * |
p | ) |
|
|
private |
◆ parseFooter()
| bool UwAhoiModem::parseFooter |
( |
std::shared_ptr< ahoi::footer_t > |
footer | ) |
|
|
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...
- Parameters
-
| packet | the packet from which to extract the values |
References agc_max, agc_mean, agc_min, bit_errors, power, and rssi.
◆ receivingData()
| void UwAhoiModem::receivingData |
( |
| ) |
|
|
privatevirtual |
◆ recv()
| void UwAhoiModem::recv |
( |
Packet * |
p | ) |
|
|
virtual |
◆ recvSyncClMsg()
| int UwAhoiModem::recvSyncClMsg |
( |
ClMessage * |
m | ) |
|
|
virtual |
Cross-Layer messages synchronous interpreter.
- Parameters
-
| ClMessage* | an instance of ClMessage that represent the message received |
- Returns
- 0 if successful.
Implements UwModem.
◆ start()
| void UwAhoiModem::start |
( |
| ) |
|
|
privatevirtual |
Method that starts the driver operations. It performs all the needed operations to correctly fire up the device's driver.
Implements UwModem.
References baud_rate, UwModem::CheckTimer, UwModem::checkTimer, UwModem::ERROR, flow_control, UwModem::INFO, UwModem::modem_address, p_connector, parity_bit, UwModem::period, UwModem::printOnLog(), receiving, receivingData(), rx_thread, stop_bit, transmitting, transmittingData(), and tx_thread.
◆ startRx()
| void UwAhoiModem::startRx |
( |
Packet * |
p | ) |
|
|
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
- Parameters
-
| p | Packet pointer to the packet to be received |
Implements UwModem.
References UwModem::INFO, and UwModem::printOnLog().
Referenced by recv().
◆ startTx()
| void UwAhoiModem::startTx |
( |
Packet * |
p | ) |
|
|
privatevirtual |
Method that triggers the transmission of a packet through a specified modem.
- Parameters
-
| p | Packet pointer to the packet to be sent |
Implements UwModem.
References UwModem::DEBUG, UwModem::ERROR, fillAhoiPkt(), MAX_RETX, p_connector, p_interpreter, UwModem::printOnLog(), TX_IDLE, tx_status, tx_status_cv, tx_status_m, TX_WAITING, WAIT_DELIVERY, and WAIT_DELIVERY_INT.
Referenced by transmittingData().
◆ stop()
| void UwAhoiModem::stop |
( |
| ) |
|
|
privatevirtual |
◆ storePacketInfo()
| bool UwAhoiModem::storePacketInfo |
( |
std::shared_ptr< ahoi::packet_t > |
header, |
|
|
Packet * |
p |
|
) |
| |
|
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...
- Parameters
-
| header | ahoi header the packet from which to extract the values |
| p | ns2 packet in which to save the destination address, ecc... |
References agc_max, agc_mean, agc_min, bit_errors, UwModem::INFO, power, UwModem::printOnLog(), rssi, rx_payload, and hdr_uwal::srcID().
Referenced by updateStatus().
◆ transmittingData()
| void UwAhoiModem::transmittingData |
( |
| ) |
|
|
privatevirtual |
Method that detach a thread devoted to sending packets found in tx_queue.
References AVAILABLE, UwModem::DEBUG, UwModem::ERROR, UwModem::event_q, MODEM_TIMEOUT, UwModem::printOnLog(), UwModem::realTxEnded(), startTx(), status, status_cv, status_m, TRANSMITTING, transmitting, UwModem::tx_queue, tx_queue_cv, tx_queue_m, and updateSN().
Referenced by start().
◆ updateSN()
| void UwAhoiModem::updateSN |
( |
| ) |
|
|
private |
◆ updateStatus()
| void UwAhoiModem::updateStatus |
( |
std::shared_ptr< ahoi::packet_t > |
packet | ) |
|
|
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.
- Parameters
-
| packet | packet received on the connector interface |
References AVAILABLE, ahoi::commands_id, ahoi::confirm, createRxPacket(), UwModem::DEBUG, UwModem::ERROR, UwModem::event_q, UwModem::modemID, p_interpreter, UwModem::printOnLog(), UwModem::recv(), ahoi::send, sn, status, status_cv, status_m, storePacketInfo(), TX_IDLE, tx_status, tx_status_cv, and tx_status_m.
Referenced by receivingData().
◆ agc_max
| uint UwAhoiModem::agc_max |
|
private |
◆ agc_mean
| uint UwAhoiModem::agc_mean |
|
private |
◆ agc_min
| uint UwAhoiModem::agc_min |
|
private |
◆ baud_rate
| int UwAhoiModem::baud_rate |
|
private |
◆ bit_errors
| uint UwAhoiModem::bit_errors |
|
private |
◆ EPSILON_S
| const double UwAhoiModem::EPSILON_S |
|
staticprivate |
minimum time to wait before to schedule a new event in seconds
◆ flow_control
| int UwAhoiModem::flow_control |
|
private |
◆ id
Modem ID, to be set in simulation
◆ MAX_RETX
| uint UwAhoiModem::MAX_RETX = 0 |
|
staticprivate |
◆ MODEM_TIMEOUT
| const std::chrono::milliseconds UwAhoiModem::MODEM_TIMEOUT |
|
staticprivate |
◆ p_connector
◆ p_interpreter
◆ parity_bit
| int UwAhoiModem::parity_bit |
|
private |
◆ power
◆ receiving
| std::atomic<bool> UwAhoiModem::receiving |
|
private |
◆ rssi
◆ rx_payload
| std::string UwAhoiModem::rx_payload |
|
private |
◆ rx_thread
| std::thread UwAhoiModem::rx_thread |
|
private |
◆ sn
| uint8_t UwAhoiModem::sn = 0 |
|
staticprivate |
◆ status
◆ status_cv
| std::condition_variable UwAhoiModem::status_cv |
|
private |
◆ status_m
| std::mutex UwAhoiModem::status_m |
|
private |
◆ stop_bit
| int UwAhoiModem::stop_bit |
|
private |
◆ tmpPacket
| ahoi::packet_t UwAhoiModem::tmpPacket |
|
private |
Packet to be checked to unlock state machine
◆ transmitting
| std::atomic<bool> UwAhoiModem::transmitting |
|
private |
◆ tx_queue_cv
| std::condition_variable UwAhoiModem::tx_queue_cv |
|
private |
◆ tx_queue_m
| std::mutex UwAhoiModem::tx_queue_m |
|
private |
◆ tx_status
◆ tx_status_cv
| std::condition_variable UwAhoiModem::tx_status_cv |
|
private |
◆ tx_status_m
| std::mutex UwAhoiModem::tx_status_m |
|
private |
◆ tx_thread
| std::thread UwAhoiModem::tx_thread |
|
private |
◆ virtual_time_ref
| double UwAhoiModem::virtual_time_ref |
|
private |
◆ WAIT_DELIVERY
| std::chrono::milliseconds UwAhoiModem::WAIT_DELIVERY |
|
private |
Time interval to wait for the modem notifying the response of a given packet
Referenced by startTx().
◆ WAIT_DELIVERY_INT
| uint UwAhoiModem::WAIT_DELIVERY_INT = 3000 |
|
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]
Referenced by startTx(), and UwAhoiModem().
The documentation for this class was generated from the following files: