#include <uwmodemcsa.h>
|
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 () |
|
virtual std::string | findCommand (std::vector< char >::iterator beg_it, std::vector< char >::iterator end_it, std::vector< char >::iterator &cmd_b, std::vector< char >::iterator &cmd_e) |
|
virtual bool | parseCommand (std::vector< char >::iterator cmd_b, std::vector< char >::iterator cmd_e, std::string &rx_payload) |
|
virtual std::string | buildSend (const std::string &payload, int dest) |
|
void | startRealRx (const std::string &cmd) |
|
void | createRxPacket (Packet *p) |
|
Definition at line 52 of file uwmodemcsa.h.
◆ UwModemCSA()
UwModemCSA::UwModemCSA |
( |
| ) |
|
Constructor of the UwModemCSA class.
- Parameters
-
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 70 of file uwmodemcsa.cpp.
◆ ~UwModemCSA()
UwModemCSA::~UwModemCSA |
( |
| ) |
|
|
virtual |
◆ buildSend()
std::string UwModemCSA::buildSend |
( |
const std::string & |
payload, |
|
|
int |
dest |
|
) |
| |
|
privatevirtual |
◆ command()
int UwModemCSA::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.
Definition at line 146 of file uwmodemcsa.cpp.
◆ createRxPacket()
void UwModemCSA::createRxPacket |
( |
Packet * |
p | ) |
|
|
private |
◆ endRx()
void UwModemCSA::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.
Definition at line 269 of file uwmodemcsa.cpp.
◆ findCommand()
std::string UwModemCSA::findCommand |
( |
std::vector< char >::iterator |
beg_it, |
|
|
std::vector< char >::iterator |
end_it, |
|
|
std::vector< char >::iterator & |
cmd_b, |
|
|
std::vector< char >::iterator & |
cmd_e |
|
) |
| |
|
privatevirtual |
Method that finds the position of a command in a buffer.
Definition at line 394 of file uwmodemcsa.cpp.
◆ getTxDuration()
double UwModemCSA::getTxDuration |
( |
Packet * |
p | ) |
|
|
virtual |
Method that returns the duration of a given transmitted packet.
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.
Definition at line 196 of file uwmodemcsa.cpp.
◆ parseCommand()
bool UwModemCSA::parseCommand |
( |
std::vector< char >::iterator |
cmd_b, |
|
|
std::vector< char >::iterator |
cmd_e, |
|
|
std::string & |
rx_payload |
|
) |
| |
|
privatevirtual |
Method that parses the command to obtain the recquired informations.
Definition at line 417 of file uwmodemcsa.cpp.
◆ receivingData()
void UwModemCSA::receivingData |
( |
| ) |
|
|
privatevirtual |
Method that detach a thread devoted to receiving data from the connector.
Definition at line 353 of file uwmodemcsa.cpp.
◆ recv()
void UwModemCSA::recv |
( |
Packet * |
p | ) |
|
|
virtual |
Method that handles the reception of packets arriving from upper layers of the network simulator.
- Parameters
-
p | pointer to the packet that has been received from the simulator upper layers |
Implements UwModem.
Definition at line 97 of file uwmodemcsa.cpp.
◆ recvSyncClMsg()
int UwModemCSA::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.
Definition at line 168 of file uwmodemcsa.cpp.
◆ start()
void UwModemCSA::start |
( |
| ) |
|
|
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 277 of file uwmodemcsa.cpp.
◆ startRealRx()
void UwModemCSA::startRealRx |
( |
const std::string & |
cmd | ) |
|
|
private |
Method that updates the status of the modem State Machine: state change is triggered by reception of commands on the connector interface, or by commands to be sent to the device, e.g., SEND or SENDIM.
- Parameters
-
cmd | command received on the connector interface |
Definition at line 449 of file uwmodemcsa.cpp.
◆ startRx()
void UwModemCSA::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.
Definition at line 261 of file uwmodemcsa.cpp.
◆ startTx()
void UwModemCSA::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.
Definition at line 205 of file uwmodemcsa.cpp.
◆ stop()
void UwModemCSA::stop |
( |
| ) |
|
|
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 307 of file uwmodemcsa.cpp.
◆ transmittingData()
void UwModemCSA::transmittingData |
( |
| ) |
|
|
privatevirtual |
Method that detach a thread devoted to sending packets found in tx_queue.
Definition at line 328 of file uwmodemcsa.cpp.
◆ del_b
std::string UwModemCSA::del_b |
|
private |
◆ del_e
std::string UwModemCSA::del_e |
|
private |
◆ EPSILON_S
const double UwModemCSA::EPSILON_S = 0.01 |
|
staticprivate |
minimum time to wait before to schedule a new event in seconds
Definition at line 210 of file uwmodemcsa.h.
◆ MAX_TX_STATUS_POLL
const size_t UwModemCSA::MAX_TX_STATUS_POLL = 20 |
|
staticprivate |
maximum number of time to poll the modem transmission status before to discard the transmitted packet
Definition at line 213 of file uwmodemcsa.h.
◆ MODEM_TIMEOUT
const std::chrono::milliseconds UwModemCSA::MODEM_TIMEOUT |
|
staticprivate |
◆ p_connector
Pointer to Connector object that interfaces with the device.
Definition at line 180 of file uwmodemcsa.h.
◆ receiving
std::atomic<bool> UwModemCSA::receiving |
|
private |
Atomic boolean variable that controls the receiving looping thread.
Definition at line 193 of file uwmodemcsa.h.
◆ rx_payload
std::string UwModemCSA::rx_payload |
|
private |
String that is updated witn each new received messsage.
Definition at line 201 of file uwmodemcsa.h.
◆ rx_thread
std::thread UwModemCSA::rx_thread |
|
private |
◆ status
Variable holding the current status of the modem.
Definition at line 182 of file uwmodemcsa.h.
◆ status_cv
std::condition_variable UwModemCSA::status_cv |
|
private |
◆ status_m
std::mutex UwModemCSA::status_m |
|
private |
Mutex associated with the state machine of the modem.
Definition at line 185 of file uwmodemcsa.h.
◆ transmitting
std::atomic<bool> UwModemCSA::transmitting |
|
private |
Atomic boolean variable that controls the transmitting looping thread.
Definition at line 195 of file uwmodemcsa.h.
◆ tx_queue_cv
std::condition_variable UwModemCSA::tx_queue_cv |
|
private |
Condition variable that is linked with the transmitting queue.
Definition at line 191 of file uwmodemcsa.h.
◆ tx_queue_m
std::mutex UwModemCSA::tx_queue_m |
|
private |
Mutex associated with the transmission queue.
Definition at line 187 of file uwmodemcsa.h.
◆ tx_thread
std::thread UwModemCSA::tx_thread |
|
private |
The documentation for this class was generated from the following files: