|
DESERT 4.0.0
|
#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).
| 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) |
References debug_, ID, loglevel_, modemTxBuff, pcheckTmr, pDropTimer, period, PktRx, pmDriver, pToDevice, queue_length, SetModemID, and t.
| UWMPhy_modem::~UWMPhy_modem | ( | ) |
Class destructor.
| 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.
Referenced by recv().
|
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. |
References log_suffix, start(), and stop().

|
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. |
References hdr_uwal::binPkt(), hdr_uwal::binPktLength(), UWMdriver::getRxPayload(), LOG_LEVEL_DEBUG, PktRx, pmDriver, UWMdriver::printOnLog(), UWMdriver::resetModemStatus(), and updatePktRx().
Referenced by MS2C_Evo_lowlev::check_modem().

|
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. |
References LOG_LEVEL_DEBUG, pmDriver, and UWMdriver::printOnLog().
Referenced by MS2C_Evo_lowlev::check_modem(), and recv().

|
inline |
Method to return the flag used to enable debug messages.
References debug_.
|
inline |
Method to return the flag used to enable debug messages.
References debug_.
Referenced by UWMdriver::UWMdriver().
|
inline |
Calculate the epoch of the event. Used in sea-trial mode
|
inline |
Calculate the epoch of the event. Used in sea-trial mode
Referenced by start().
|
inline |
|
inline |
Method to return the node ID.
References ID.
Referenced by UWMdriver::UWMdriver().
|
inline |
Method to return the name of the file where to log messages.
References logFile.
|
inline |
Method to return the name of the file where to log messages.
References logFile.
Referenced by UWMdriver::getLogFile().
|
inline |
Method to return the flag used to enable the printing of log messages in UWMPhy_modem::logFile.
References loglevel_.
|
inline |
Method to return the flag used to enable the printing of log messages in UWMPhy_modem::logFile.
References loglevel_.
Referenced by UWMdriver::getLogLevel().
|
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. |
|
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. |
|
inline |
Method to return the path to the device to be connect with the network simulator.
References pToDevice.
|
inline |
Method to return the path to the device to be connect with the network simulator.
References pToDevice.
|
inline |
Method to return the checking period of the modem (i.e., the time interval between two succesive checks on the modem buffer).
References period.
|
inline |
Method to return the checking period of the modem (i.e., the time interval between two succesive checks on the modem buffer).
References period.
|
inline |
References queue_length.
|
inline |
References queue_length.
Referenced by UWMdriver::setConnections().
|
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. |
|
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. |
|
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. |
References modemTxBuff, and t.
Referenced by MS2C_Evo_lowlev::check_modem(), and recv().
|
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. |
References hdr_uwal::binPkt(), hdr_uwal::binPktLength(), check_modem(), endTx(), UWMdriver::getStatus(), LOG_LEVEL_ERROR, LOG_LEVEL_INFO, MODEM_CFG, MODEM_IDLE, MODEM_IDLE_RX, MODEM_RESET, MODEM_RX, MODEM_TX, modemTxBuff, PktRx, pmDriver, popTxBuff(), UWMdriver::printOnLog(), UWMdriver::resetModemStatus(), startTx(), t, and UWMdriver::updateTx().

|
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) |
References pcheckTmr, pDropTimer, and pmDriver.
Referenced by MS2C_Evo_lowlev::MS2C_Evo_lowlev().
|
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).
References getEpoch(), ID, log_suffix, logFile, outLog, pcheckTmr, period, pmDriver, UWMdriver::setID(), UWMdriver::setModemID(), SetModemID, and UWMdriver::start().
Referenced by command().

|
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. |
References LOG_LEVEL_DEBUG, pmDriver, and UWMdriver::printOnLog().
Referenced by MS2C_Evo_lowlev::check_modem().

|
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. |
References LOG_LEVEL_DEBUG, UWMdriver::modemTx(), pmDriver, and UWMdriver::printOnLog().
Referenced by recv().

|
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.
References pcheckTmr, pmDriver, and UWMdriver::stop().
Referenced by command().

| 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) |
References PktRx.
Referenced by endRx().
|
friend |
Friend class used to implement the timer handler.
|
friend |
|
protected |
Flag to enable debug mode (i.e., printing of debug messages) if set to 1.
Referenced by getDebug(), and UWMPhy_modem().
|
protected |
ID of the node. NOTE: when the node transmits, this value must coincide with the source ID.
Referenced by getID(), start(), and UWMPhy_modem().
|
protected |
|
protected |
Name of the disk-file where to write the interface's log messages.
Referenced by getLogFile(), and start().
|
protected |
Log level on file, from ERROR (0) to DEBUG (2) in UWMPhy_modem::logFile.
Referenced by getLogLevel(), and UWMPhy_modem().
|
protected |
Transmission buffer to store packets that cannot be sent immediately because the real acoustic modem is busy (receiving or transmitting).
Referenced by popTxBuff(), recv(), and UWMPhy_modem().
|
protected |
output strem to print into a disk-file log messages. See UWMPhy_modem::logFile.
Referenced by start().
|
protected |
Pointer to an object to schedule the "check-modem" events.
Referenced by setConnections(), start(), stop(), and UWMPhy_modem().
|
protected |
Referenced by setConnections(), and UWMPhy_modem().
|
protected |
Checking period of the modem's buffer.
Referenced by getPeriod(), start(), and UWMPhy_modem().
|
protected |
Transmission buffer's index; it must be in {-1, 0, 1, ..., _MTBL-1}. Address of the last received packet.
Referenced by MS2C_Evo_lowlev::check_modem(), endRx(), recv(), updatePktRx(), and UWMPhy_modem().
|
protected |
Pointer to an object to drive the modem operations.
Referenced by MS2C_Evo_lowlev::check_modem(), endRx(), endTx(), DropTimer::expire(), recv(), setConnections(), start(), startRx(), startTx(), stop(), and UWMPhy_modem().
|
protected |
A string containing the path to the device to be connected with the network simulator.
Referenced by getPathToDevice(), and UWMPhy_modem().
|
protected |
Referenced by getQueueLength(), and UWMPhy_modem().
|
protected |
Flag to indicate if the interface has to force the modem to have the ID indicated in the tcl script
Referenced by start(), and UWMPhy_modem().
|
protected |
Referenced by popTxBuff(), recv(), and UWMPhy_modem().