DESERT 3.5.1
Loading...
Searching...
No Matches
uw-phy-WakeUp.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//
29
39#ifndef UW_WAKEUP_H
40#define UW_WAKEUP_H
41
42#include <mphy.h>
43#include <map>
44#include "wake-up-pkt-hdr.h"
45
46#define UW_WAKEUP_MODNAME "WKUP"
47#define DROP_REASON_BELOW_THRESHOLD "DBT"
48
52class MPhy_WakeUp : public MPhy
53{
54
55public:
63 virtual ~MPhy_WakeUp();
69 virtual int getModulationType(Packet *);
75 virtual double
76 getTxDuration(Packet *p)
77 {
78 return (ToneDuration_);
79 }
86 virtual double getPER(double snr, int nbits);
91 virtual int
106 virtual int command(int argc, const char *const *argv);
107
108protected:
113 virtual void startTx(Packet *p);
118 virtual void endTx(Packet *p);
123 virtual void startRx(Packet *p);
129 virtual void endRx(Packet *p);
135 virtual double getNoisePower(Packet *p);
142 virtual MSpectralMask *getTxSpectralMask(Packet *p);
147 virtual void dropPacket(Packet *p);
151 void
156
160 virtual void waitForUser();
161
162 Packet *PktRx;
164 static bool
166 static int modid;
168
169 /* input */
176 double MaxTxRange_;
180};
181
182#endif /* UW_WAKEUP_H */
Class that describes the WakeUp PHY layer for T-LOHI MAC protocol.
virtual double getTxDuration(Packet *p)
Returns the duration of the transmission for the specified packet.
virtual void endRx(Packet *p)
Notify to the MAC protocol that the reception is finished and send the packet to it.
virtual void endTx(Packet *p)
Notify to the MAC protocol that the transmission has been finished.
virtual ~MPhy_WakeUp()
Class destructor.
MPhy_WakeUp()
Class contructor.
Packet * PktRx
Pointer to the packeti in reception.
double MaxTxRange_
Maximum Transmission Range.
virtual void startRx(Packet *p)
Notify to the MAC protocol the start of a reception.
virtual double getPER(double snr, int nbits)
Returns the PER for a certain SNR and a dimension of packet.
virtual MSpectralMask * getTxSpectralMask(Packet *p)
Gets the Transmission Spectral Mask for the Packet p.
virtual void waitForUser()
Used for debug purposes.
void incrDroppedPktsTxPending()
Increases the number of packet dropped.
int droppedPktsTxPending
Total number of dropped pkts due to tx pending.
virtual double getNoisePower(Packet *p)
Returns the Power of the noise for a packet.
virtual int getDroppedPktsTxPending()
Gets the number of Tx Pending dropped packets.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
static bool initialized
used to register the modulation type only once
double ToneDuration_
predefined tone duration
virtual void startTx(Packet *p)
Starts to transmit a Packet.
virtual int getModulationType(Packet *)
Returns the Modulation type.
static int modid
modulation type id
double AcquisitionThreshold_dB_
How many dB over noise are required for a signal to trigger acquisition (i.e., a RX attempt)
virtual void dropPacket(Packet *p)
Drops a packet.
Provides the definition of the Wake Up Tone Packet Header.