56 for (
int i = 0; i <
_MTBL; i++) {
76 Tcl &tcl = Tcl::instance();
79 if (!strcmp(argv[1],
"start")) {
83 if (!strcmp(argv[1],
"stop")) {
87 }
else if (argc == 3) {
88 if (!strcmp(argv[1],
"setLogSuffix")) {
89 string tmp_ = (
char *) argv[2];
96 return Module::command(argc, argv);
110 LOG_LEVEL_INFO,
"UWMPHY_MODEM",
"RECV::RECV_PKT_FROM_UPPER_LAYER");
118 "NO_SPACE_LEFT_ON_MODEM_QUEUE");
125 "MODEM_QUEUE_INDEX_OUT_OF_BOUNDS");
142 "RX_PACKET_NOT_DELIVERED_CONCURRENT_PACKET");
147 std::string payload_string;
169 std::stringstream str(
"");
179 std::cout <<
"WARNING: Opening error ( " << strerror(errno)
180 <<
" ). It was not possible to create " <<
logFile.c_str()
233 unsigned char *buf = (
unsigned char *) str.c_str();
234 Packet *p_rx = Packet::alloc();
252 for (
int i = 0; i <
t; i++) {
#define MIN_MODEM_QUEUE_LENGTH
#define MAX_MODEM_QUEUE_LENGTH
#define _MTBL
Defintion of the maximum length of the transmission buffer to store \ packets at the interface level.
Header of the main class that implements the general interface between ns2/NS-Miracle and real acoust...
The class used by UwModem to handle simulator's event expirations; it is exploited to schedule the re...
UwModem * pmModem
Pointer to an UwModem object.
virtual void expire(Event *e)
Method to handle the expiration of a given event.
virtual void expire(Event *e)
Packet * popTxBuff()
Method to pop the oldest packet in the TX buffer or to delete after a tx or to drop it.
unsigned long int getEpoch()
Calculate the epoch of the event.
virtual void startRx(Packet *)
Method to start a packet reception.
std::ofstream outLog
output strem to print into a disk-file log messages.
int debug_
Flag to enable debug mode (i.e., printing of debug messages) if set to 1.
char * log_suffix
Possibility to insert a log suffix.
CheckTimer * pcheckTmr
Pointer to an object to schedule the "check-modem" events.
virtual void stop()
Connection stopper.
UWMdriver * pmDriver
Pointer to an object to drive the modem operations.
virtual modem_state_t check_modem()=0
Modem checker.
UWMPhy_modem(std::string)
Class constructor.
virtual void recv(Packet *)
Method to handle the reception of packets arriving from the upper layers of the network simulator.
double period
Checking period of the modem's buffer.
virtual int command(int, const char *const *)
Method to map tcl commands into c++ methods.
~UWMPhy_modem()
Class destructor.
int SetModemID
Flag to indicate if the interface has to force the modem to have the ID indicated in the tcl script.
Packet * modemTxBuff[_MTBL]
Transmission buffer to store packets that cannot be sent immediately because the real acoustic modem ...
Packet * PktRx
Transmission buffer's index; it must be in {-1, 0, 1, ..., _MTBL-1}.
virtual void start()
Connection starter.
virtual void endRx(Packet *)
Method to end a packet reception.
std::string logFile
Name of the disk-file where to write the interface's log messages.
int loglevel_
Log level on file, from ERROR (0) to DEBUG (2) in UWMPhy_modem::logFile.
std::string pToDevice
A string containing the path to the device to be connected with the network simulator.
virtual void startTx(Packet *)
Method to send to an UWMdriver object the packet to be transmitted, see UWMdriver::modemTx().
virtual void endTx(Packet *)
Method to end a packet transmission.
void setConnections(CheckTimer *, UWMdriver *, DropTimer *)
Link connector.
void updatePktRx(Packet *)
Method to update the value of the pointer to the last received packet.
The class needed by UWMPhy_modem to handle the different transmissions cases and corresponding protoc...
void updateTx(int, std::string)
Method to update the values of both UWMdriver::payload_tx and UWMdriver::dest.
modem_state_t getStatus()
Method to return the modem's status.
virtual void stop()=0
Driver stopper.
void printOnLog(log_level_t log_level, std::string module, std::string message)
virtual void modemTx()=0
Method to notify to the driver that there is a packet to be sent via modem.
virtual void start()=0
Driver starter.
void setResetModemQueue(bool reset_m_queue)
void setModemID(bool set)
void resetModemStatus()
Method to reset the modem status.
std::string getRxPayload()
Method to access to the payload of the last packet acoustically received.
void setID(int ID_)
Method to change the modem ID.
hdr_uwal describes the packet header used by Uwal objects.
char * binPkt()
Return to the binPkt_ array pointer.
uint32_t & binPktLength()
Reference to the binPktLength_ variable.