73 TclObject*
create(
int,
const char*
const*) {
84 , last_sn_confirmed(0)
86 , ackPolicy(ACK_PIGGYBACK)
91 , drop_old_waypoints(0)
100 bind(
"log_flag_", (
int*) &
log_flag );
102 cerr << NOW <<
" Invalide ACK timout < 0, timeout set to 10 by defaults"
111 , last_sn_confirmed(0)
113 , ackPolicy(ACK_PIGGYBACK)
118 , drop_old_waypoints(0)
126 bind(
"log_flag_", (
int*) &
log_flag );
128 cerr << NOW <<
" Invalide ACK timout < 0, timeout set to 10 by defaults"
143 Tcl& tcl = Tcl::instance();
145 if (strcasecmp(argv[1],
"getROVMonheadersize") == 0) {
149 else if(strcasecmp(argv[1],
"getROVctrheadersize") == 0) {
153 else if(strcasecmp(argv[1],
"getX") == 0) {
157 else if(strcasecmp(argv[1],
"getY") == 0) {
161 else if(strcasecmp(argv[1],
"getZ") == 0) {
165 else if(strcasecmp(argv[1],
"getAckNotPgbk") == 0) {
171 if (strcasecmp(argv[1],
"setPosition") == 0) {
174 tcl.resultf(
"%s",
"position Setted\n");
177 if (strcasecmp(argv[1],
"setAckPolicy") == 0) {
178 if (atof(argv[2]) == 1) {
182 if (atof(argv[2]) == 2) {
186 if (atof(argv[2]) == 3) {
191 if (strcasecmp(argv[1],
"setAckTimeout") == 0) {
195 if (strcasecmp(argv[1],
"setAckPriority") == 0) {
201 if (strcasecmp(argv[1],
"setdest") == 0) {
202 posit->
setdest(atof(argv[2]),atof(argv[3]),atof(argv[4]));
207 if (strcasecmp(argv[1],
"setdest") == 0) {
208 posit->
setdest(atof(argv[2]),atof(argv[3]),atof(argv[4]),atof(argv[5]));
226 std::cout << NOW <<
" UwROVModule::initPkt(Packet *p) ROV current "
227 <<
"position: X = " << uwROVh->
x() <<
", Y = " << uwROVh->
y()
228 <<
", Z = " << uwROVh->
z()<< std::endl;
232 std::cout << NOW <<
" UwROVModule::sending packet with priority "
233 << (int)uwcbrh->
priority() << std::endl;
248 std::cout << NOW <<
" UwROVModule::old waypoint with sn "
249 << uwROVh->
sn() <<
" dropped " << std::endl;
262 out_file_stats << left <<
"time: " << NOW <<
", positions ROV: x = "
264 <<
", z = " <<
posit->
getZ() << std::endl;
270 std::cout << NOW <<
" UwROVModule::recv(Packet *p) ROV received new "
271 "way point: X = " << uwROVh->
x() <<
", Y = " << uwROVh->
y()
272 <<
", Z = " << uwROVh->
z()<< std::endl;
280 cout << NOW <<
" ACK sent immediately with standard priority "
285 cout << NOW <<
" ACK sent immediately with high priority "
300 cout << NOW <<
" ACK timeout expired, ACK sent with standard "
301 <<
"priority " << std::endl;
305 cout << NOW <<
" ACK timeout expired, ACK sent with high priority "
virtual double getY()
Method that return the current projection of the node on the y-axis.
virtual double getX()
Method that return the current projection of the node on the x-axis.
virtual double getZ()
Method that return the current projection of the node on the z-axis.
virtual void setdest(double x_dest, double y_dest, double z_dest, double spead)
UwCbrModule class is used to manage UWCBR packets and to collect statistics about them.
virtual void initPkt(Packet *p)
Initializes a data packet passed as argument with the default values.
int debug_
Flag to enable several levels of debug.
char priority_
Priority of the data packets.
virtual void sendPktHighPriority()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
virtual void recv(Packet *)
Performs the reception of packets from upper and lower layers.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual void sendPkt()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
Adds the header for hdr_uwROV packets in ns2.
TclObject * create(int, const char *const *)
Creates the TCL object needed for the tcl language interpretation.
UwROVModuleClass()
Constructor of the class.
UwROVModule class is used to manage UWROV packets and to collect statistics about them.
virtual void recv(Packet *)
Performs the reception of packets from upper and lower layers.
virtual void setPosition(UWSMPosition *p)
Sets the position of the ROV.
int drop_old_waypoints
< Number of ACK not sent in piggyback when ackPolicy = 2.
virtual ~UwROVModule()
Destructor of UwROVModule class.
int ackNotPgbk
< Flag to give higher priority to ACK or not.
int ack
If not zero, contains the ACK to the last command Packete received.
virtual void sendAck()
Sends ACK if ackTimeout expire;.
UwROVModule()
Default Constructor of UwROVModule class.
static int getROVMonHeaderSize()
Returns the size in byte of a hdr_uwROV_monitoring packet header.
int ackTimeout
Timeout after which ACK is sent if ackPolicy = ACK_PGBK_OR_TO.
UWSMPosition * posit
ROV position.
UWROV_ACK_POLICY ackPolicy
Flag to set the policy for ACK transimission, ACK_PIGGYBACK: ACK is always sent in piggyback,...
std::ofstream out_file_stats
Output stream for the textual file of debug.
virtual void initPkt(Packet *p)
Initializes a monitoring data packet passed as argument with the default values.
UwROVSendAckTimer ackTimer_
Timer to schedule ACK transmission.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
int last_sn_confirmed
Sequence number of the last command Packete received.
int log_flag
< Flag set to 1 to drop waypoints with sequence number lower or equal than last_sn_confirmed.
static int getROVCTRHeaderSize()
Returns the size in byte of a hdr_uwROV_ctr packet header.
virtual void expire(Event *e)
hdr_uwROV_ctr describes UWROV_ctr packets for controlling the ROV.
static int offset_
Required by the PacketHeaderManager.
hdr_uwROV_monitoring describes UWROV_monitoring packets sent by the ROV to the base station for monit...
static int offset_
Required by the PacketHeaderManager.
hdr_uwcbr describes UWCBR packets.
char & priority()
Reference to the priority_ variable.
UwROVModuleClass class_module_uwROV
Provides the definition of the class UWROV.
#define HDR_UWROV_MONITORING(p)