DESERT 3.5.1
|
#include <uwmphy_modem.h>
Public Member Functions | |
UWMPhy_modem (std::string) | |
~UWMPhy_modem () | |
virtual void | recv (Packet *) |
virtual int | command (int, const char *const *) |
virtual int | recvSyncClMsg (ClMessage *m)=0 |
int | getID () |
double | getPeriod () |
std::string | getPathToDevice () |
uint | getQueueLength () |
int | getDebug () |
std::string | getLogFile () |
log_level_t | getLogLevel () |
unsigned long int | getEpoch () |
void | updatePktRx (Packet *) |
UWMPhy_modem (std::string) | |
~UWMPhy_modem () | |
virtual void | recv (Packet *) |
virtual int | command (int, const char *const *) |
virtual int | recvSyncClMsg (ClMessage *m)=0 |
int | getID () |
double | getPeriod () |
std::string | getPathToDevice () |
uint | getQueueLength () |
int | getDebug () |
std::string | getLogFile () |
log_level_t | getLogLevel () |
unsigned long int | getEpoch () |
void | updatePktRx (Packet *) |
Protected Member Functions | |
void | setConnections (CheckTimer *, UWMdriver *, DropTimer *) |
virtual void | start () |
virtual void | stop () |
virtual modem_state_t | check_modem ()=0 |
virtual void | startTx (Packet *) |
virtual void | endTx (Packet *) |
virtual void | startRx (Packet *) |
virtual void | endRx (Packet *) |
Packet * | popTxBuff () |
virtual double | getTxDuration (Packet *p) |
virtual int | getModulationType (Packet *p) |
void | setConnections (CheckTimer *, UWMdriver *, DropTimer *) |
virtual void | start () |
virtual void | stop () |
virtual modem_state_t | check_modem ()=0 |
virtual void | startTx (Packet *) |
virtual void | endTx (Packet *) |
virtual void | startRx (Packet *) |
virtual void | endRx (Packet *) |
Packet * | popTxBuff () |
virtual double | getTxDuration (Packet *p) |
virtual int | getModulationType (Packet *p) |
Protected Attributes | |
CheckTimer * | pcheckTmr |
UWMdriver * | pmDriver |
DropTimer * | pDropTimer |
int | ID |
double | period |
Packet * | modemTxBuff [_MTBL] |
int | t |
Packet * | PktRx |
std::string | pToDevice |
int | debug_ |
std::ofstream | outLog |
std::string | logFile |
char * | log_suffix |
int | loglevel_ |
int | SetModemID |
uint | queue_length |
Friends | |
class | CheckTimer |
class | DropTimer |
The main class implementing the module used to implement the interface between ns2/NS-Miracle and real acoustic modems.
UWMPhy_modem (as well as its possible derived classes) handles all the messages needed by NS-Miracle (e.g., cross-layer messages between MAC and PHY) and contains all the variables set by the tcl-user; furthermore, this module coordinates the interactions between UWMcodec and UWMdriver. This class replaces the physical layer of NS-Miracle and inherits from MPhy (see NS-Miracle documentation at http://telecom.dei.unipd.it/ns/miracle/doxygen/classMPhy.html).
Definition at line 86 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
UWMPhy_modem::UWMPhy_modem | ( | std::string | pToDevice_ | ) |
Class constructor.
pToDevice_ | the path to the device that must be connected with NS-Miracle (e.g., /dev/ttyUSB0 for a serial connection) |
Definition at line 39 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
UWMPhy_modem::~UWMPhy_modem | ( | ) |
Class destructor.
Definition at line 69 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
UWMPhy_modem::UWMPhy_modem | ( | std::string | ) |
Class constructor.
pToDevice_ | the path to the device that must be connected with NS-Miracle (e.g., /dev/ttyUSB0 for a serial connection) |
UWMPhy_modem::~UWMPhy_modem | ( | ) |
Class destructor.
|
protectedpure virtual |
Modem checker.
This method is at the core of the "check-modem" process. It is called periodically by the timer object linked to this UWMPhy_modem object (see UWMPhy_modem::checkTmr_); its due is to verify if something has been received or is going to be received from the channel.
Implemented in MS2C_Evo_lowlev.
|
protectedpure virtual |
Modem checker.
This method is at the core of the "check-modem" process. It is called periodically by the timer object linked to this UWMPhy_modem object (see UWMPhy_modem::checkTmr_); its due is to verify if something has been received or is going to be received from the channel.
Implemented in MS2C_Evo_lowlev.
|
virtual |
Method to map tcl commands into c++ methods.
argc | number of arguments in argv |
argv | array of arguments where argv[3] is the tcl command name and argv[4, 5, ...] are the parameters for the corresponding c++ method. |
|
virtual |
Method to map tcl commands into c++ methods.
argc | number of arguments in argv |
argv | array of arguments where argv[3] is the tcl command name and argv[4, 5, ...] are the parameters for the corresponding c++ method. |
Definition at line 74 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
protectedvirtual |
Method to end a packet reception.
This method is also in charge to send the received NS-Miracle packet (as recovered from the received acoustic packet) to the above layers of the simulator.
p | pointer to the last received packet. |
|
protectedvirtual |
Method to end a packet reception.
This method is also in charge to send the received NS-Miracle packet (as recovered from the received acoustic packet) to the above layers of the simulator.
p | pointer to the last received packet. |
Definition at line 229 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
protectedvirtual |
Method to end a packet transmission.
This method is also in charge to send a cross layer message Phy2MacEndTx(p) to notify the above layers of the simulator about the end of a transmission, see http://telecom.dei.unipd.it/ns/miracle/doxygen/classMPhy.html#c8c2f52d3833fed8ac736aca0ee52c98.
p | pointer to the last transmitted packet. |
|
protectedvirtual |
Method to end a packet transmission.
This method is also in charge to send a cross layer message Phy2MacEndTx(p) to notify the above layers of the simulator about the end of a transmission, see http://telecom.dei.unipd.it/ns/miracle/doxygen/classMPhy.html#c8c2f52d3833fed8ac736aca0ee52c98.
p | pointer to the last transmitted packet. |
Definition at line 211 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
inline |
Method to return the flag used to enable debug messages.
Definition at line 177 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the flag used to enable debug messages.
Definition at line 177 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inline |
Calculate the epoch of the event.
Used in sea-trial mode
Definition at line 209 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Calculate the epoch of the event.
Used in sea-trial mode
Definition at line 209 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the node ID.
Definition at line 137 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the node ID.
Definition at line 137 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the name of the file where to log messages.
Definition at line 187 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the name of the file where to log messages.
Definition at line 187 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the flag used to enable the printing of log messages in UWMPhy_modem::logFile.
Definition at line 199 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the flag used to enable the printing of log messages in UWMPhy_modem::logFile.
Definition at line 199 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inlineprotectedvirtual |
Method to get the modulation type used to transmit/receive a given packet.
NOTE: not implemented or used at the moment.
p | a pointer to the packet for which to return the modulation used. |
Definition at line 366 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inlineprotectedvirtual |
Method to get the modulation type used to transmit/receive a given packet.
NOTE: not implemented or used at the moment.
p | a pointer to the packet for which to return the modulation used. |
Definition at line 366 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the path to the device to be connect with the network simulator.
Definition at line 160 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the path to the device to be connect with the network simulator.
Definition at line 160 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the checking period of the modem (i.e., the time interval between two succesive checks on the modem buffer).
Definition at line 148 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Method to return the checking period of the modem (i.e., the time interval between two succesive checks on the modem buffer).
Definition at line 148 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inline |
Definition at line 166 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inline |
Definition at line 166 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
inlineprotectedvirtual |
Method to get the transmission duration for a given packet.
NOTE: not implemented or used at the moment.
p | a pointer to the packet for which to return the duration. |
Definition at line 353 of file DESERT_Addons/uwmphy_modem/uwmphy_modem.h.
|
inlineprotectedvirtual |
Method to get the transmission duration for a given packet.
NOTE: not implemented or used at the moment.
p | a pointer to the packet for which to return the duration. |
Definition at line 353 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Method to pop the oldest packet in the TX buffer or to delete after a tx or to drop it.
temp | pointer to the popped packet. |
|
protected |
Method to pop the oldest packet in the TX buffer or to delete after a tx or to drop it.
temp | pointer to the popped packet. |
Definition at line 248 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
virtual |
Method to handle the reception of packets arriving from the upper layers of the network simulator.
p | pointer to the packet that has been received from the simulator's upper layers. |
|
virtual |
Method to handle the reception of packets arriving from the upper layers of the network simulator.
p | pointer to the packet that has been received from the simulator's upper layers. |
Definition at line 106 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
pure virtual |
Implemented in MS2C_Evo_lowlev.
|
pure virtual |
Implemented in MS2C_Evo_lowlev.
|
protected |
Link connector.
This method must be used by any derived class D of UWMPhy_modem to link the members pcheckTmr, pmDriver and pmCodec to the corresponding derived objects contained in D;
[in] | pcheckTmr_ | pointer to a CheckTimer object |
[in] | pmDriver_ | pointer to an UWMdriver object |
[in] | pmCodec_ | pointer to an UWMcodec object |
[out] | pcheckTmr | (i.e., the member UWMPhy_modem::pcheckTmr) |
[out] | pmDriver | (i.e., the member UWMPhy_modem::pmDriver) |
[out] | pmCodec | (i.e., the member UWMPhy_modem::pmCodec) |
|
protected |
Link connector.
This method must be used by any derived class D of UWMPhy_modem to link the members pcheckTmr, pmDriver and pmCodec to the corresponding derived objects contained in D;
[in] | pcheckTmr_ | pointer to a CheckTimer object |
[in] | pmDriver_ | pointer to an UWMdriver object |
[in] | pmCodec_ | pointer to an UWMcodec object |
[out] | pcheckTmr | (i.e., the member UWMPhy_modem::pcheckTmr) |
[out] | pmDriver | (i.e., the member UWMPhy_modem::pmDriver) |
[out] | pmCodec | (i.e., the member UWMPhy_modem::pmCodec) |
Definition at line 158 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
protectedvirtual |
Connection starter.
This method starts the connection with the modem. It performs all the needed operations to open an host-modem connection (e.g., set up of the connection port's parameters, start of the "check-modem" process).
|
protectedvirtual |
Connection starter.
This method starts the connection with the modem. It performs all the needed operations to open an host-modem connection (e.g., set up of the connection port's parameters, start of the "check-modem" process).
Definition at line 167 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
protectedvirtual |
Method to start a packet reception.
This method is also in charge to send a cross layer message Phy2MacStartRx(p) to notify the above layers of the simulator about the start of a reception, see http://telecom.dei.unipd.it/ns/miracle/doxygen/classMPhy.html#a15cc91b98013e1c631ad85072867ab6.
p | pointer to the last received packet. |
|
protectedvirtual |
Method to start a packet reception.
This method is also in charge to send a cross layer message Phy2MacStartRx(p) to notify the above layers of the simulator about the start of a reception, see http://telecom.dei.unipd.it/ns/miracle/doxygen/classMPhy.html#a15cc91b98013e1c631ad85072867ab6.
p | pointer to the last received packet. |
Definition at line 220 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
protectedvirtual |
Method to send to an UWMdriver object the packet to be transmitted, see UWMdriver::modemTx().
p | pointer to the packet to be transmitted. |
|
protectedvirtual |
Method to send to an UWMdriver object the packet to be transmitted, see UWMdriver::modemTx().
p | pointer to the packet to be transmitted. |
Definition at line 202 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
protectedvirtual |
Connection stopper.
This method should be used before stopping the simulation. It closes and, if needed, resets all the opened files and ports.
|
protectedvirtual |
Connection stopper.
This method should be used before stopping the simulation. It closes and, if needed, resets all the opened files and ports.
Definition at line 195 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
void UWMPhy_modem::updatePktRx | ( | Packet * | ) |
Method to update the value of the pointer to the last received packet.
This method should be used by an object of the class UWMcodec.
[in] | p | pointer to the last received packet (recovered from the last received acoustic message) |
[out] | PktRx | (i.e., the member UWMPhy_modem::PktRx) |
void UWMPhy_modem::updatePktRx | ( | Packet * | p | ) |
Method to update the value of the pointer to the last received packet.
This method should be used by an object of the class UWMcodec.
[in] | p | pointer to the last received packet (recovered from the last received acoustic message) |
[out] | PktRx | (i.e., the member UWMPhy_modem::PktRx) |
Definition at line 100 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.cpp.
|
friend |
Friend class used to implement the timer handler.
Definition at line 93 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
friend |
Definition at line 95 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Flag to enable debug mode (i.e., printing of debug messages) if set to 1.
Definition at line 245 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
ID of the node.
NOTE: when the node transmits, this value must coincide with the source ID.
Definition at line 232 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Possibility to insert a log suffix.
Definition at line 251 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Name of the disk-file where to write the interface's log messages.
Definition at line 249 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Log level on file, from ERROR (0) to DEBUG (2) in UWMPhy_modem::logFile.
Definition at line 252 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Transmission buffer to store packets that cannot be sent immediately because the real acoustic modem is busy (receiving or transmitting).
Definition at line 235 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
output strem to print into a disk-file log messages.
Definition at line 247 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Pointer to an object to schedule the "check-modem" events.
Definition at line 226 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Definition at line 230 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Checking period of the modem's buffer.
Definition at line 234 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Transmission buffer's index; it must be in {-1, 0, 1, ..., _MTBL-1}.
Address of the last received packet.
Definition at line 241 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Pointer to an object to drive the modem operations.
Definition at line 228 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
A string containing the path to the device to be connected with the network simulator.
Definition at line 242 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Definition at line 256 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Flag to indicate if the interface has to force the modem to have the ID indicated in the tcl script.
Definition at line 254 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.
|
protected |
Definition at line 239 of file DESERT_Framework/DESERT/physical/uwmphy_modem/uwmphy_modem.h.