DESERT 4.0.0
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//
47#ifndef UWROV_CTR_MODULE_H
48#define UWROV_CTR_MODULE_H
49
50#include "uwrov-packet.h"
51#include <node-core.h>
52#include <uwcbr-module.h>
53
54#define UWROV_DROP_REASON_UNKNOWN_TYPE \
55 "UKT"
56#define UWROV_DROP_REASON_OUT_OF_SEQUENCE \
57 "OOS"
58#define UWROV_DROP_REASON_DUPLICATED_PACKET \
59 "DPK"
60#define HDR_UWROV_MONITORING(p) (hdr_uwROV_monitoring::access(p))
61#define HDR_UWROV_CTR(p) (hdr_uwROV_ctr::access(p))
62
63class UwROVCtrModule;
64
70{
71public:
78};
79
85{
86public:
91
95 virtual ~UwROVCtrModule() = default;
96
107 virtual int command(int argc, const char *const *argv) override;
108
116 virtual void initPkt(Packet *p) override;
117
121 void
123 {
124 pkt = nullptr;
125 sendTmr_.force_cancel();
126 }
127
133 virtual void recv(Packet *) override;
134
141 virtual void recv(Packet *p, Handler *h) override;
142
148 virtual void transmit() override;
149
153 virtual void start() override;
154
160 static int
162 {
163 return sizeof(hdr_uwROV_monitoring);
164 }
165
171 static int
173 {
174 return sizeof(hdr_uwROV_ctr);
175 }
176
177protected:
178 int sn;
182 float x_rov;
183 float y_rov;
184 float z_rov;
185 float newX;
186 float newY;
187 float newZ;
188 float speed;
189 Position *posit;
190 Packet *pkt;
191};
192
193#endif // UWROVCtr_MODULE_H
Definition uwcbr-module.h:162
UwSendTimer sendTmr_
Definition uwcbr-module.h:286
Definition uwrovctr-module.h:85
float y_rov
Definition uwrovctr-module.h:183
int adaptiveRTO
Definition uwrovctr-module.h:179
float x_rov
Definition uwrovctr-module.h:182
Position * posit
Definition uwrovctr-module.h:189
virtual int command(int argc, const char *const *argv) override
Definition uwrovctr-module.cc:90
float newY
Definition uwrovctr-module.h:186
virtual void transmit() override
Definition uwrovctr-module.cc:173
virtual void initPkt(Packet *p) override
Definition uwrovctr-module.cc:196
double adaptiveRTO_parameter
Definition uwrovctr-module.h:181
float newZ
Definition uwrovctr-module.h:187
virtual void recv(Packet *) override
Definition uwrovctr-module.cc:248
static int getROVCTRHeaderSize()
Definition uwrovctr-module.h:172
int sn
Definition uwrovctr-module.h:178
float z_rov
Definition uwrovctr-module.h:184
float newX
Definition uwrovctr-module.h:185
void reset_retx()
Definition uwrovctr-module.h:122
Packet * pkt
Definition uwrovctr-module.h:190
virtual void start() override
Definition uwrovctr-module.cc:191
static int getROVMonHeaderSize()
Definition uwrovctr-module.h:161
virtual ~UwROVCtrModule()=default
UwROVCtrModule()
Definition uwrovctr-module.cc:68
float speed
Definition uwrovctr-module.h:188
Definition uwrovctr-module.h:70
UwROVCtrSendTimer(UwROVCtrModule *m)
Definition uwrovctr-module.h:76
Definition uwcbr-module.h:144
Definition uwrov-packet.h:51
Definition uwrov-packet.h:109
Provides the UWCBR packets header description and the definition of the class UWCBR.
Provides both UWROV monitoring and control packets header description.