DESERT 3.5.1
Loading...
Searching...
No Matches
uwrovctr-module.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
46#ifndef UWROV_CTR_MODULE_H
47#define UWROV_CTR_MODULE_H
48#include <uwcbr-module.h>
49#include "uwrov-packet.h"
50#include "node-core.h"
51#include <queue>
52#define UWROV_DROP_REASON_UNKNOWN_TYPE "UKT"
53#define UWROV_DROP_REASON_OUT_OF_SEQUENCE "OOS"
54#define UWROV_DROP_REASON_DUPLICATED_PACKET "DPK"
55#define HDR_UWROV_MONITORING(p) (hdr_uwROV_monitoring::access(p))
56#define HDR_UWROV_CTR(p) (hdr_uwROV_ctr::access(p))
57using namespace std;
58class UwROVCtrModule;
59
64 public:
65
72};
73
78public:
79
84
88 UwROVCtrModule(Position p);
89
93 virtual ~UwROVCtrModule();
94
103 virtual int command(int argc, const char*const* argv);
104
110 virtual void initPkt(Packet* p) ;
111
115 inline void reset_retx() {p=NULL; sendTmr_.force_cancel();}
116
122 virtual void setPosition(Position p);
123
129 inline Position getPosition() { return posit;}
130
136 inline Position getMonitoredROVPosition() {
137 Position monitored_p_rov;
138 monitored_p_rov.setX(x_rov);
139 monitored_p_rov.setY(y_rov);
140 monitored_p_rov.setZ(z_rov);
141 return monitored_p_rov;
142 }
143
149 virtual void recv(Packet*);
150
157 virtual void recv(Packet* p, Handler* h);
158
164 virtual void transmit();
165
169 virtual void start();
170
176 static inline int getROVMonHeaderSize() { return sizeof(hdr_uwROV_monitoring); }
177
183 static inline int getROVCTRHeaderSize() { return sizeof(hdr_uwROV_ctr); }
184
185
186
187protected:
188
189 Position posit;
190 float x_rov;
191 float y_rov;
192 float z_rov;
193 float newX;
194 float newY;
195 float newZ;
196 float speed;
197 int sn;
198 Packet* p;
203};
204
205#endif // UWROVCtr_MODULE_H
UwCbrModule class is used to manage UWCBR packets and to collect statistics about them.
UwSendTimer sendTmr_
Timer which schedules packet transmissions.
UwROVCtrModule class is used to manage UWROVCtr packets and to collect statistics about them.
Position getMonitoredROVPosition()
Returns the last ROV position monitored.
float y_rov
Y of the last ROV position monitored.
Packet * p
Sequence number of the last control packet sent.
int adaptiveRTO
1 if an adaptive RTO is used, 0 if a constant RTO is used.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual ~UwROVCtrModule()
Destructor of UwROVCtrModule class.
float x_rov
X of the last ROV position monitored.
float newY
Y of the new position sent to the ROV.
virtual void start()
Start the controller.
double adaptiveRTO_parameter
Parameter for the adaptive RTO.
float newZ
Z of the new position sent to the ROV.
static int getROVCTRHeaderSize()
Returns the size in byte of a hdr_uwROV_ctr packet header.
float z_rov
Z of the last ROV position monitored.
float newX
X of the new position sent to the ROV.
void reset_retx()
Reset retransmissions.
virtual void initPkt(Packet *p)
Initializes a control data packet passed as argument with the default values.
virtual void recv(Packet *)
Performs the reception of packets from upper and lower layers.
Position posit
Controller position.
static int getROVMonHeaderSize()
Returns the size in byte of a hdr_uwROV_monitoring packet header.
virtual void setPosition(Position p)
Set the position of the ROVCtr.
virtual void transmit()
Creates and transmits a packet.
UwROVCtrModule()
Constructor of UwROVCtrModule class.
float speed
Moving speed sent to the ROV.
Position getPosition()
Returns the position of the ROVCtr.
UwSendTimer class is used to handle the scheduling period of UWROV packets.
UwROVCtrSendTimer(UwROVCtrModule *m)
Conscructor of UwSendTimer class.
UwSendTimer class is used to handle the scheduling period of UWCBR packets.
hdr_uwROV_ctr describes UWROV_ctr packets for controlling the ROV.
hdr_uwROV_monitoring describes UWROV_monitoring packets sent by the ROV to the base station for monit...
Provides the UWCBR packets header description and the definition of the class UWCBR.
Provides both UWROV monitoring and control packets header description.