DESERT 3.5.1
|
#include <uwevologicss2cmodem.h>
Public Types | |
enum class | TransmissionMode { BURST = 0 , IM = 1 } |
enum class | TransmissionState { TX_IDLE = 0 , TX_PENDING } |
![]() | |
enum class | LogLevel { ERROR = 0 , INFO = 1 , DEBUG = 2 } |
Public Member Functions | |
UwEvoLogicsS2CModem () | |
virtual | ~UwEvoLogicsS2CModem () |
virtual void | recv (Packet *p) |
virtual int | command (int argc, const char *const *argv) |
virtual int | recvSyncClMsg (ClMessage *m) |
virtual double | getTxDuration (Packet *p) |
virtual bool | configure (Config cmd) |
virtual void | initializeLUT () |
![]() | |
UwModem () | |
virtual | ~UwModem () |
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 Types | |
enum class | Config { ATL_GET , ATL_SET , ATAL_GET , ATAL_SET , MODEM_STATUS , CURR_SETTINGS , UNKNOWN } |
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 (UwInterpreterS2C::Response cmd) |
void | setFailedTx (Packet *p) |
void | createRxPacket (Packet *p) |
Private Attributes | |
std::unique_ptr< UwConnector > | p_connector |
std::unique_ptr< UwInterpreterS2C > | 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::atomic< bool > | im_status_updated |
std::thread | rx_thread |
std::thread | tx_thread |
std::string | rx_payload |
TransmissionMode | tx_mode |
bool | ack_mode |
double | virtual_time_ref |
int | curr_source_level |
int | n_rx_failed |
int | pend_source_level |
bool | source_level_change |
TransmissionDurationLUT | size2dur_ |
std::string | txdur_file_name_ |
char | txdur_token_separator_ |
bool | initLUT_ |
Static Private Attributes | |
static const std::chrono::milliseconds | MODEM_TIMEOUT |
static const std::chrono::milliseconds | WAIT_DELIVERY_IM |
static const std::chrono::seconds | WAIT_DELIVERY_BURST |
static const double | EPSILON_S |
static uint | MAX_N_STATUS_QUERIES = 10 |
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 |
Definition at line 65 of file uwevologicss2cmodem.h.
|
strongprivate |
Enum listing the availbale configuration settings.
See the EvoLogics S2C manuals or reach for www.evologics.de
Enumerator | |
---|---|
ATL_GET | |
ATL_SET | |
ATAL_GET | |
ATAL_SET | |
MODEM_STATUS | |
CURR_SETTINGS | |
UNKNOWN |
Definition at line 71 of file uwevologicss2cmodem.h.
|
strong |
Transmission mode: either IM or BURST See the EvoLogics S2C manuals or reach for www.evologics.de.
Enumerator | |
---|---|
BURST | |
IM |
Definition at line 85 of file uwevologicss2cmodem.h.
|
strong |
Transmission state: controls the flow of execution for sending commands to the S2C device.
Enumerator | |
---|---|
TX_IDLE | |
TX_PENDING |
Definition at line 91 of file uwevologicss2cmodem.h.
UwEvoLogicsS2CModem::UwEvoLogicsS2CModem | ( | ) |
Constructor of the UwEvoLogicsS2CModem 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 76 of file uwevologicss2cmodem.cpp.
|
virtual |
Destructor of the UwEvoLogicsS2CModem class.
Definition at line 111 of file uwevologicss2cmodem.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 161 of file uwevologicss2cmodem.cpp.
|
virtual |
Method that sends a written configuration the the EvoLgoics modem.
The configuration string could be a request of configurations (the AT commands conaining '?') or a setting command (the AT commands containing '!').
command | the command string complying with the device format requirements. |
Definition at line 386 of file uwevologicss2cmodem.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 961 of file uwevologicss2cmodem.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 569 of file uwevologicss2cmodem.cpp.
|
virtual |
Method that return 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.
p | Packet pointer to the given packet being transmitted |
Reimplemented from UwModem.
Definition at line 370 of file uwevologicss2cmodem.cpp.
|
virtual |
Method that loads the TX LUT into a map.
Also adds the processing delay if any.
Definition at line 235 of file uwevologicss2cmodem.cpp.
|
privatevirtual |
Mehod that detach a thread devoted to receiving data from the connector.
Definition at line 657 of file uwevologicss2cmodem.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 117 of file uwevologicss2cmodem.cpp.
|
virtual |
Cross-Layer messages synchronous interpreter.
ClMessage* | an instance of ClMessage that represent the message received |
Implements UwModem.
Definition at line 297 of file uwevologicss2cmodem.cpp.
|
private |
Method that allows to set the error flag on the packet to notify upper layers about un-tranmsitted packets due to, e.g., modem unavailability.
p | Packet pointer ot the packet being transmitted |
Definition at line 954 of file uwevologicss2cmodem.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 576 of file uwevologicss2cmodem.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 560 of file uwevologicss2cmodem.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 448 of file uwevologicss2cmodem.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 608 of file uwevologicss2cmodem.cpp.
|
privatevirtual |
Method that detach a thread devoted to sending packets found in tx_queue.
Definition at line 632 of file uwevologicss2cmodem.cpp.
|
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.
cmd | command received on the connector interface |
Definition at line 713 of file uwevologicss2cmodem.cpp.
|
private |
Set to true to enable IM ack.
Definition at line 272 of file uwevologicss2cmodem.h.
|
private |
Current source level already set in device.
Definition at line 274 of file uwevologicss2cmodem.h.
|
staticprivate |
Minimum time to wait before to schedule a new event in seconds.
Definition at line 286 of file uwevologicss2cmodem.h.
|
private |
Atomic boolean variable controlling if the modem had responded to ATDI.
Definition at line 255 of file uwevologicss2cmodem.h.
|
private |
Flag that tells whether the TX duration LUT is loaded or not.
Definition at line 283 of file uwevologicss2cmodem.h.
|
staticprivate |
Maximum number of time to query the modem transmission status before to discard the transmitted packet.
Definition at line 289 of file uwevologicss2cmodem.h.
|
staticprivate |
Maximum time to wait for modem to become ModemState::AVAILABLE.
Definition at line 263 of file uwevologicss2cmodem.h.
|
private |
Number of failed receptions up to now.
Definition at line 275 of file uwevologicss2cmodem.h.
|
private |
Pointer to Connector object that interfaces with the device.
Definition at line 229 of file uwevologicss2cmodem.h.
|
private |
Pointer to Interpreter object to parse device syntax.
Definition at line 231 of file uwevologicss2cmodem.h.
|
private |
Pending source level, requested but not set.
Definition at line 276 of file uwevologicss2cmodem.h.
|
private |
Atomic boolean variable that controls the receiving looping thread.
Definition at line 251 of file uwevologicss2cmodem.h.
|
private |
String that is updated witn each new received messsage.
Definition at line 261 of file uwevologicss2cmodem.h.
|
private |
Object with the rx thread.
Definition at line 257 of file uwevologicss2cmodem.h.
|
private |
|
private |
Flag that tells a new SL value to be applied.
Definition at line 277 of file uwevologicss2cmodem.h.
|
private |
Variable holding the current status of the modem.
Definition at line 233 of file uwevologicss2cmodem.h.
|
private |
Condition variable to wait for ModemState::AVAILABLE.
Definition at line 245 of file uwevologicss2cmodem.h.
|
private |
Mutex associated with the state machine of the modem.
Definition at line 239 of file uwevologicss2cmodem.h.
|
private |
Atomic boolean variable that controls the transmitting looping thread.
Definition at line 253 of file uwevologicss2cmodem.h.
|
private |
Either burst or im.
Definition at line 271 of file uwevologicss2cmodem.h.
|
private |
Condition variable that is linked with the transmitting queue.
Definition at line 249 of file uwevologicss2cmodem.h.
|
private |
Mutex associated with the transmission queue.
Definition at line 243 of file uwevologicss2cmodem.h.
|
private |
Variable holding the current transmission status of the modem.
Definition at line 235 of file uwevologicss2cmodem.h.
|
private |
Condition variable to wait for TransmissionState::TX_IDLE.
Definition at line 247 of file uwevologicss2cmodem.h.
|
private |
Mutex associated with the transmission state machine of the modem.
Definition at line 241 of file uwevologicss2cmodem.h.
|
private |
Object with the tx thread.
Definition at line 259 of file uwevologicss2cmodem.h.
|
private |
TX duration LUT file name.
Definition at line 281 of file uwevologicss2cmodem.h.
|
private |
TX duration LUT separator.
Definition at line 282 of file uwevologicss2cmodem.h.
|
private |
virtual time reference
Definition at line 273 of file uwevologicss2cmodem.h.
|
staticprivate |
Time interval tu wait for a burst message tobe confirmed through a DELIVERED response.
Given in SECONDS
Definition at line 269 of file uwevologicss2cmodem.h.
|
staticprivate |
Time interval to wait for the modem notifying that there no more IM in its queue and a new IM can be sent.
Definition at line 266 of file uwevologicss2cmodem.h.