54 : TclClass(
"Module/UW/ROV")
77 , last_sn_confirmed(0)
81 , drop_old_waypoints(0)
85 , ackPolicy(ACK_PIGGYBACK)
92 bind(
"log_flag_", (
int *) &
log_flag);
95 cerr << NOW <<
" Invalide ACK timout < 0, timeout set to 10 by defaults"
104 Tcl &tcl = Tcl::instance();
107 if (strcasecmp(argv[1],
"getROVMonheadersize") == 0) {
111 }
else if (strcasecmp(argv[1],
"getROVctrheadersize") == 0) {
115 }
else if (strcasecmp(argv[1],
"getX") == 0) {
119 }
else if (strcasecmp(argv[1],
"getY") == 0) {
123 }
else if (strcasecmp(argv[1],
"getZ") == 0) {
127 }
else if (strcasecmp(argv[1],
"getAckNotPgbk") == 0) {
132 }
else if (argc == 3) {
133 if (strcasecmp(argv[1],
"setPosition") == 0) {
138 tcl.resultf(
"%s",
"Position set\n");
143 tcl.result(
"Position error\n");
147 if (strcasecmp(argv[1],
"setAckPolicy") == 0) {
148 if (atof(argv[2]) == 1) {
152 if (atof(argv[2]) == 2) {
156 if (atof(argv[2]) == 3) {
161 if (strcasecmp(argv[1],
"setAckTimeout") == 0) {
166 if (strcasecmp(argv[1],
"setAckPriority") == 0) {
171 }
else if (argc == 5) {
172 if (strcasecmp(argv[1],
"setdest") == 0) {
173 posit->
setdest(atof(argv[2]), atof(argv[3]), atof(argv[4]));
177 }
else if (argc == 6) {
178 if (strcasecmp(argv[1],
"setdest") == 0) {
179 posit->
setdest(atof(argv[2]), atof(argv[3]), atof(argv[4]), atof(argv[5]));
202 std::cout << NOW <<
" UwROVModule::initPkt(Packet *p) ROV current "
203 <<
"position: X = " << uwROVh->
x() <<
", Y = " << uwROVh->
y()
204 <<
", Z = " << uwROVh->
z() << std::endl;
211 std::cout << NOW <<
" UwROVModule::sending packet with priority "
212 << (int) uwcbrh->
priority() << std::endl;
232 std::cout << NOW <<
" UwROVModule::old waypoint with sn "
233 << uwROVh->
sn() <<
" dropped " << std::endl;
247 <<
", positions ROV: x = " <<
posit->
getX()
256 <<
" UwROVModule::recv(Packet *p) ROV received new "
258 << uwROVh->
x() <<
", Y = " << uwROVh->
y()
259 <<
", Z = " << uwROVh->
z() << std::endl;
270 cout << NOW <<
" ACK sent immediately with standard priority "
276 cout << NOW <<
" ACK sent immediately with high priority "
295 cout << NOW <<
" ACK timeout expired, ACK sent with standard "
296 <<
"priority " << std::endl;
301 cout << NOW <<
" ACK timeout expired, ACK sent with high priority "
virtual double getY() override
Get the current projection on y-axis of the node postion If necessary (updating time expired),...
virtual double getX() override
Get the current projection on x-axis of the node postion If necessary (updating time expired),...
virtual void setdest(double x_dest, double y_dest, double z_dest, double speed)
virtual double getZ() override
Get the current projection on z-axis of the node postion If necessary (updating time expired),...
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.
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
int debug_
Flag to enable several levels of debug.
char priority_
Priority of the data packets.
virtual void recv(Packet *) override
Performs the reception of packets from upper and lower layers.
virtual void sendPktHighPriority()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
virtual void sendPkt()
Allocates, initialize and sends a packet with the default priority flag set from tcl.
Class that represents the binding with the tcl configuration script.
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.
int drop_old_waypoints
< Number of ACK not sent in piggyback when ackPolicy = 2.
int ack
If not zero, contains the ACK to the last command packet 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
< Flag set to 1 to drop waypoints with sequence number lower or equal than last_sn_confirmed.
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 recv(Packet *) override
Performs the reception of packets from upper and lower layers.
UwROVSendAckTimer ackTimer_
Timer to schedule ACK transmission.
int ackPriority
Flag to give higher priority to ACK or not.
virtual void initPkt(Packet *p) override
Initializes a monitoring data packet passed as argument with the default values.
int last_sn_confirmed
Sequence number of the last command packet received.
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
int log_flag
Flag to enable log file writing.
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)