#include <uwmodamodem.h>
◆ ModemResponse
Enum type representing modem responses. UNDEFINED: unrecognized signaling TX_END: modem signals that it has ended a transmission RX_BEG: modem signals that it has begun receiving data CFG_END: modem signals that it has ended an ongoing configuration
| Enumerator |
|---|
| UNDEFINED | |
| TX_END | |
| RX_BEG | |
| CFG_END | |
◆ 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 | |
| RECEIVING | |
| CONFIGURING | |
◆ UwMODAModem()
| UwMODAModem::UwMODAModem |
( |
| ) |
|
◆ ~UwMODAModem()
| UwMODAModem::~UwMODAModem |
( |
| ) |
|
|
virtual |
◆ command()
| int UwMODAModem::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(), and signal_address.
◆ createRxPacket()
| void UwMODAModem::createRxPacket |
( |
Packet * |
p | ) |
|
|
private |
◆ endRx()
| void UwMODAModem::endRx |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
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().
◆ getModulationType()
| int UwMODAModem::getModulationType |
( |
Packet * |
p | ) |
|
|
virtual |
Method that returns the modulation type used for the packet being transmitted. Inherited from MPhy, in NS-MIRACLE, could be left empty if no way exists to retrieve this information
- Parameters
-
| p | Packet pointer to the given packet being transmitted |
| modulation | type represented by an integer |
Reimplemented from UwModem.
Referenced by recv().
◆ getTxDuration()
| double UwMODAModem::getTxDuration |
( |
Packet * |
p | ) |
|
|
virtual |
Method that returns the duration of a given transmitted packet. It uses a linear interpolation given the packet size. Inherited from MPhy, in NS-MIRACLE, could be empty if there is no way to retrieve this information.
- Parameters
-
| p | Packet pointer to the given packet being transmitted |
- Returns
- duration in seconds
Reimplemented from UwModem.
References hdr_uwal::binPktLength(), and premodulation.
Referenced by recv(), and recvSyncClMsg().
◆ parseSignaling()
◆ receivingData()
| void UwMODAModem::receivingData |
( |
| ) |
|
|
private |
Method that dispatch a thread dedicated to receiving data from the data connector
References AVAILABLE, createRxPacket(), UwModem::data_buffer, UwModem::DATA_BUFFER_LEN, data_conn, UwModem::DEBUG, UwModem::event_q, UwModem::MAX_READ_BYTES, MODEM_TIMEOUT, UwModem::printOnLog(), receiving, UwModem::recv(), rx_payload, rx_size, status, status_cv, and status_m.
Referenced by start().
◆ receivingSignaling()
| void UwMODAModem::receivingSignaling |
( |
| ) |
|
|
private |
◆ recv()
| void UwMODAModem::recv |
( |
Packet * |
p | ) |
|
|
virtual |
◆ recvSyncClMsg()
| int UwMODAModem::recvSyncClMsg |
( |
ClMessage * |
m | ) |
|
|
virtual |
◆ start()
| void UwMODAModem::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 UwModem::CheckTimer, UwModem::checkTimer, data_conn, UwModem::DEBUG, UwModem::ERROR, UwModem::modem_address, UwModem::period, UwModem::printOnLog(), receiving, receivingData(), receivingSignaling(), rx_thread, sig_thread, signal_address, signal_conn, transmitting, transmittingData(), and tx_thread.
◆ startRx()
| void UwMODAModem::startRx |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
Method that starts a packet reception. This method is also in charge of sending a CrLayerMsg, 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 UwMODAModem::startTx |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
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 hdr_uwal::binPkt(), hdr_uwal::binPktLength(), data_conn, UwModem::ERROR, UwModem::event_q, UwModem::INFO, MODEM_TIMEOUT, UwModem::printOnLog(), UwModem::realTxEnded(), status, status_cv, status_m, and TRANSMITTING.
Referenced by transmittingData().
◆ stop()
| void UwMODAModem::stop |
( |
| ) |
|
|
privatevirtual |
Method that stops the driver operations. It performs all the needed operations to correctly stop the device's driver before closing operations.
Implements UwModem.
References UwModem::checkTimer, data_conn, UwModem::ERROR, UwModem::printOnLog(), receiving, rx_thread, sig_thread, signal_conn, status_cv, transmitting, tx_queue_cv, and tx_thread.
Referenced by ~UwMODAModem().
◆ transmittingData()
| void UwMODAModem::transmittingData |
( |
| ) |
|
|
private |
◆ updateStatus()
Method that, based on the received signaling, updates the state machine of the driver
- Parameters
-
| response | ModemRresponse response from the modem |
References AVAILABLE, CFG_END, UwModem::DEBUG, UwModem::ERROR, UwModem::printOnLog(), RECEIVING, RX_BEG, stateToString, status, status_cv, status_m, and TX_END.
Referenced by receivingSignaling().
◆ DATA_ADDRESS
| const int UwMODAModem::DATA_ADDRESS = 55555 |
|
staticprivate |
◆ data_conn
◆ end_delim
| const std::string UwMODAModem::end_delim = {";"} |
|
private |
String end delimiter used in reception signaling
Referenced by parseSignaling().
◆ MODEM_TIMEOUT
| const std::chrono::milliseconds UwMODAModem::MODEM_TIMEOUT |
|
staticprivate |
◆ premodulation
| int UwMODAModem::premodulation |
|
private |
◆ receiving
| std::atomic<bool> UwMODAModem::receiving |
|
private |
◆ rx_payload
| std::string UwMODAModem::rx_payload |
|
private |
◆ rx_size
◆ rx_thread
| std::thread UwMODAModem::rx_thread |
|
private |
Thread managing the data reception process
Referenced by start(), and stop().
◆ sep
| const std::string UwMODAModem::sep = {"::"} |
|
private |
◆ sig_thread
| std::thread UwMODAModem::sig_thread |
|
private |
Thread managing the signaling reception process
Referenced by start(), and stop().
◆ signal_address
| std::string UwMODAModem::signal_address |
|
private |
◆ signal_buffer
| std::vector<char> UwMODAModem::signal_buffer |
|
private |
◆ signal_conn
◆ signal_tag
| std::string UwMODAModem::signal_tag |
|
private |
Signaling tag to recognize signaling from the modem. It is not necessary but added in case of future additional features that want to use the signaling channel
Referenced by parseSignaling().
◆ SIGNALING_ADDRESS
| const int UwMODAModem::SIGNALING_ADDRESS = 55006 |
|
staticprivate |
Port of the signaling channel
◆ signaling_dict
Initial value:Dictionary of accepted signaling states
Referenced by parseSignaling().
◆ stateToString
Initial value:Dictionary for converting a state to a printable string
Referenced by updateStatus().
◆ status
◆ status_cv
| std::condition_variable UwMODAModem::status_cv |
|
private |
◆ status_m
| std::mutex UwMODAModem::status_m |
|
private |
◆ transmitting
| std::atomic<bool> UwMODAModem::transmitting |
|
private |
◆ tx_queue_cv
| std::condition_variable UwMODAModem::tx_queue_cv |
|
private |
◆ tx_queue_m
| std::mutex UwMODAModem::tx_queue_m |
|
private |
◆ tx_thread
| std::thread UwMODAModem::tx_thread |
|
private |
Thread managing the data transmission process
Referenced by start(), and stop().
The documentation for this class was generated from the following files: