DESERT 3.5.1
Loading...
Searching...
No Matches
uwphy-clmsg.h
Go to the documentation of this file.
1//
2// Copyright (c) 2015 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
38#ifndef UWPHY_CLMSG_H
39#define UWPHY_CLMSG_H
40
41#include <clmessage.h>
42#include <packet.h>
43
44#define CLMSG_UWPHY_VERBOSITY (3)
45
46#define CLMSG_UWPHY_NOT_VALID (-1)
47
48#define CLMSG_UWPHY_TIME_NOT_VALID (-1)
49
50#define CLMSG_UWPHY_STACK_ID_NOT_VALID (-1)
51
52extern ClMessage_t CLMSG_UWPHY_TX_POWER;
53extern ClMessage_t CLMSG_UWPHY_B_RATE;
54extern ClMessage_t CLMSG_UWPHY_THRESH;
55extern ClMessage_t CLMSG_UWPHY_LOSTPKT;
56extern ClMessage_t CLMSG_UWPHY_TX_BUSY;
57
62class ClMsgUwPhy : public ClMessage
63{
64public:
65
74
78 ClMsgUwPhy(ClMessage_t type);
79
85 ClMsgUwPhy(int stack_id, int dest_module_id, ClMessage_t type);
86
91 ClMsgUwPhy(const ClMsgUwPhy& msg);
92
96 virtual ~ClMsgUwPhy();
97
104 virtual ClMsgUwPhy* copy();
105
110 void setReqType(ReqType type);
111
117
118
119protected:
120
121 // receiver stack id (valid only for broadcast request)
122 int stack_id; /* <id of the stack */
123 ReqType req_type; /*< request type: either get, set, request or reply */
124
125};
126
127
135{
136public:
137
142
148 ClMsgUwPhyTxPwr(int stack_id, int dest_module_id);
149
155
159 virtual ~ClMsgUwPhyTxPwr();
160
165 double getPower();
166
171 void setPower(double powr);
172
173private:
174
175 double tx_power; /* < Transmission power. Its definition (W, dB, dB re uPa, ...) depends on the specific phy.*/
176
177};
178
179
188{
189public:
190
195
201 ClMsgUwPhyBRate(int stack_id, int dest_module_id);
202
208
209
213 virtual ~ClMsgUwPhyBRate();
214
219 double getBRate();
220
225 void setBRate(double rate);
226
227
228private:
229
230 double b_rate; /* < Communication threshold. Can be either the baud or the bit rate.*/
231
232};
233
234
242{
243public:
244
249
255 ClMsgUwPhyThresh(int stack_id, int dest_module_id);
256
262
263
267 virtual ~ClMsgUwPhyThresh();
268
273 double getThresh();
274
279 void setThresh(double thresh);
280
281
282private:
283
284 double threshold; /* < Receiving threshold. Can be either the rx_power or the SNR.*/
285
286};
287
294{
295public:
296
303 ClMsgUwPhyGetLostPkts(bool control = false);
304
312 ClMsgUwPhyGetLostPkts(int stack_id, int dest_module_id, bool control = false);
313
319
320
325
330 uint getLostPkts();
331
336 void setLostPkts(uint lost_pkt);
337
338 inline bool isControl() {return is_control;}
339
340
341private:
342
343 uint lost_packets; /* < Number of packets lost by the phy.*/
345
346};
347
355{
356public:
357
362
368 ClMsgUwPhyTxBusy(int stack_id, int dest_module_id);
369
375
380
385 int getTxBusy();
386
391 void setTxBusy(int powr);
392
397 int getGetOp();
398
403 void setGetOp(int);
404
405private:
406
407int tx_busy; /* < Transmission power. Its definition (W, dB, dB re uPa, ...) depends on the specific phy.*/
408int getop; // To signal if mac just wants to read the value
409
410};
411
412#endif /* UWPHY_CLMSG_H */
ClMsgUwPhyBRate should be and used to ask either to set or get the communication rate (can be bitrate...
void setBRate(double rate)
method to set the transmitting rate
double getBRate()
method to return the transmitting rate
virtual ~ClMsgUwPhyBRate()
Destructor of the ClMsgUwPhyTxPwr class.
ClMsgUwPhyBRate()
Broadcast constructor of the ClMsgUwPhyBRate class.
ClMsgUwPhyGetLostPkts should be used by a layer to ask the phy how many packets it discarded from the...
void setLostPkts(uint lost_pkt)
method to set the number of packets lost by the phy.
uint getLostPkts()
method to return the number of packets lost by the phy.
~ClMsgUwPhyGetLostPkts()
Destructor of the ClMsgUwPhyGetLostPkts class.
ClMsgUwPhyThresh should be and used to ask either to set or get the receiving threshold (can be SNR o...
ClMsgUwPhyThresh()
Broadcast constructor of the ClMsgUwPhyBRate class.
void setThresh(double thresh)
method to set the rx threshold
double getThresh()
method to return the rx threshold
virtual ~ClMsgUwPhyThresh()
Destructor of the ClMsgUwPhyThresh class.
ClMsgUwPhyTxBusy should be and used to ask either to set or get the transmitting busy variable of a s...
void setGetOp(int)
method to return the transmitting power
~ClMsgUwPhyTxBusy()
Destructor of the class.
ClMsgUwPhyTxBusy()
Broadcast constructor of the ClMsgUwPhyTxBusy class.
void setTxBusy(int powr)
method to set the transmitting busy variable
int getGetOp()
method to return the transmitting power
int getTxBusy()
method to return the transmitting power
ClMsgUwPhyTxPwr should be and used to ask either to set or get the transmitting power of a specific p...
void setPower(double powr)
method to set the transmitting power
double getPower()
method to return the transmitting power
virtual ~ClMsgUwPhyTxPwr()
Destructor of the ClMsgUwPhyTxPwr class.
ClMsgUwPhyTxPwr()
Broadcast constructor of the ClMsgUwPhyTxPwr class.
ClMsgUwPhy should be extended and used to ask to set or get a parameter of a specific phy.
Definition uwphy-clmsg.h:63
ReqType req_type
virtual ClMsgUwPhy * copy()
Copy method of the ClMsgUwPhy class, the specialization of the return value is intentional and it is ...
void setReqType(ReqType type)
method to set the request type
virtual ~ClMsgUwPhy()
Destructor of the ClMsgUwPhy class.
ReqType getReqType()
method to return the request type