44#include <condition_variable>
74 virtual void recv(Packet *p);
102 virtual int command(
int argc,
const char *
const *argv);
110 virtual void startTx(Packet *p);
118 virtual void startRx(Packet *p);
125 virtual void endRx(Packet *p);
131 virtual void start();
153 virtual std::string
findCommand(std::vector<char>::iterator beg_it,
154 std::vector<char>::iterator end_it,
155 std::vector<char>::iterator &cmd_b,
156 std::vector<char>::iterator &cmd_e);
161 virtual bool parseCommand(std::vector<char>::iterator cmd_b,
162 std::vector<char>::iterator cmd_e, std::string &
rx_payload);
167 virtual std::string
buildSend(
const std::string &payload,
int dest);
virtual void endRx(Packet *p)
Method that ends a packet reception.
std::string rx_payload
String that is updated witn each new received messsage.
virtual void startRx(Packet *p)
Method that starts a packet reception.
ModemState status
Variable holding the current status of the modem.
virtual bool parseCommand(std::vector< char >::iterator cmd_b, std::vector< char >::iterator cmd_e, std::string &rx_payload)
Method that parses the command to obtain the recquired informations.
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)
Method that finds the position of a command in a buffer.
static const size_t MAX_TX_STATUS_POLL
maximum number of time to poll the modem transmission status before to discard the transmitted packet
virtual void recv(Packet *p)
Method that handles the reception of packets arriving from upper layers of the network simulator.
std::condition_variable status_cv
Condition variable to wait for ModemState::AVAILABLE.
virtual int command(int argc, const char *const *argv)
Tcl command interpreter: Method that maps Tcl commands into C++ methods.
virtual void receivingData()
Method that detach a thread devoted to receiving data from the connector.
std::atomic< bool > transmitting
Atomic boolean variable that controls the transmitting looping thread.
virtual void start()
Method that starts the driver operations.
virtual void stop()
Method that stops the driver operations.
void startRealRx(const std::string &cmd)
Method that updates the status of the modem State Machine: state change is triggered by reception of ...
virtual std::string buildSend(const std::string &payload, int dest)
static const std::chrono::milliseconds MODEM_TIMEOUT
Maximum time to wait for modem to become ModemState::AVAILABLE.
virtual int recvSyncClMsg(ClMessage *m)
Cross-Layer messages synchronous interpreter.
std::condition_variable tx_queue_cv
Condition variable that is linked with the transmitting queue.
virtual double getTxDuration(Packet *p)
Method that returns the duration of a given transmitted packet.
std::mutex tx_queue_m
Mutex associated with the transmission queue.
std::atomic< bool > receiving
Atomic boolean variable that controls the receiving looping thread.
virtual void transmittingData()
Method that detach a thread devoted to sending packets found in tx_queue.
void createRxPacket(Packet *p)
std::thread tx_thread
Object with the tx thread.
std::thread rx_thread
Object with the rx thread.
std::unique_ptr< UwConnector > p_connector
Pointer to Connector object that interfaces with the device.
virtual ~UwModemCSA()
Destructor of the UwModemCSA class.
virtual void startTx(Packet *p)
Method that triggers the transmission of a packet through a specified modem.
std::mutex status_m
Mutex associated with the state machine of the modem.
static const double EPSILON_S
minimum time to wait before to schedule a new event in seconds
UwModemCSA()
Constructor of the UwModemCSA class.
Class that implements the interface to DESERT, as used through Tcl scripts.
Generic class that provides a method to interface with the devices. Will be specialized for,...
ModemState
Enum containing the possible statuses of the driver.
Header of the main class that implements the general interface between DESERT and real acoustic modem...