DESERT 4.0.0
uwmulti-stack-controller-phy-master.h
Go to the documentation of this file.
1//
2// Copyright (c) 2014 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
40#ifndef UWOPTICAL_ACOUSTIC_CONTROLLER_MASTER_H
41#define UWOPTICAL_ACOUSTIC_CONTROLLER_MASTER_H
42
44#include <mac.h>
45
46#include <limits>
47
49
54{
55
56public:
61
68
79 virtual int command(int, const char *const *);
80
90 virtual void recv(Packet *p, int idSrc);
91
92protected:
93 // Internal classes
94 class UwMultiStackSignalingTimer : public TimerHandler
95 {
96 public:
98 : TimerHandler()
99 {
100 module = m;
101 }
102
103 protected:
104 virtual void expire(Event *e);
106 };
107
108 // Variables
116 double alpha_;
132 virtual int getBestLayer(Packet *p);
133
139 virtual void checkAndSignal();
140
146 virtual void resetCheckAndSignal();
147
152 virtual int checkBestLayer();
153
158 virtual void signalsBestPhy();
159
174 int recvSyncClMsg(ClMessage *m);
175
183 virtual void updateMasterStatistics(Packet *p, int idSrc);
184
193 inline int
195 {
196 return (getId(getOrder(layer_id) + 1) ==
198 ? layer_id
199 : getId(getOrder(layer_id) + 1);
200 }
201
210 inline int
212 {
213 return (getId(getOrder(layer_id) - 1) ==
215 ? layer_id
216 : getId(getOrder(layer_id) - 1);
217 }
218
219private:
220 // Variables
221};
222
223#endif /* UWOPTICAL_ACOUSTIC_CONTROLLER_H */
Definition uwmulti-stack-controller-phy-master.h:95
virtual void expire(Event *e)
Definition uwmulti-stack-controller-phy-master.cc:113
UwMultiStackSignalingTimer(UwMultiStackControllerPhyMaster *m)
Definition uwmulti-stack-controller-phy-master.h:97
Definition uwmulti-stack-controller-phy-master.h:54
int getLongerRangeLayer(int layer_id)
Definition uwmulti-stack-controller-phy-master.h:211
int getShorterRangeLayer(int layer_id)
Definition uwmulti-stack-controller-phy-master.h:194
virtual void resetCheckAndSignal()
Definition uwmulti-stack-controller-phy-master.cc:160
double power_statistics_
Definition uwmulti-stack-controller-phy-master.h:112
virtual int checkBestLayer()
Definition uwmulti-stack-controller-phy-master.cc:174
virtual int getBestLayer(Packet *p)
Definition uwmulti-stack-controller-phy-master.cc:136
UwMultiStackSignalingTimer signaling_timer_
Definition uwmulti-stack-controller-phy-master.h:121
double alpha_
Definition uwmulti-stack-controller-phy-master.h:116
virtual ~UwMultiStackControllerPhyMaster()
Definition uwmulti-stack-controller-phy-master.h:65
int power_stat_node_
Definition uwmulti-stack-controller-phy-master.h:114
virtual void checkAndSignal()
Definition uwmulti-stack-controller-phy-master.cc:147
int last_layer_used_
Definition uwmulti-stack-controller-phy-master.h:111
virtual void signalsBestPhy()
Definition uwmulti-stack-controller-phy-master.cc:213
UwMultiStackControllerPhyMaster()
Definition uwmulti-stack-controller-phy-master.cc:67
virtual int command(int, const char *const *)
Definition uwmulti-stack-controller-phy-master.cc:84
int signaling_sent_
Definition uwmulti-stack-controller-phy-master.h:119
double signaling_period_
Definition uwmulti-stack-controller-phy-master.h:117
virtual void updateMasterStatistics(Packet *p, int idSrc)
Definition uwmulti-stack-controller-phy-master.cc:256
int recvSyncClMsg(ClMessage *m)
Definition uwmulti-stack-controller-phy-master.cc:239
virtual void recv(Packet *p, int idSrc)
Definition uwmulti-stack-controller-phy-master.cc:123
int signaling_active_
Definition uwmulti-stack-controller-phy-master.h:109
Definition uwmulti-stack-controller-phy.h:48
int getOrder(int layer_id)
Definition uwmulti-stack-controller.h:124
static int const layer_not_exist
Definition uwmulti-stack-controller.h:65
int getId(int layer_order)
Definition uwmulti-stack-controller.h:139
Definition of UwMultiStackControllerPhy class.