A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
uan-transducer-hd.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 University of Washington
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Leonard Tracy <lentracy@gmail.com>
7 */
8
9#ifndef UAN_TRANSDUCER_HD_H
10#define UAN_TRANSDUCER_HD_H
11
12#include "uan-transducer.h"
13
14#include "ns3/simulator.h"
15
16namespace ns3
17{
18
19/**
20 * \ingroup uan
21 *
22 * Half duplex implementation of transducer object
23 *
24 * This class will only allow attached Phy's to receive packets
25 * if not in TX mode.
26 */
28{
29 public:
30 /** Constructor */
32 /** Dummy destructor, see DoDispose */
33 ~UanTransducerHd() override;
34
35 /**
36 * Register this type.
37 * \return The object TypeId.
38 */
39 static TypeId GetTypeId();
40
41 // inherited methods
42 State GetState() const override;
43 bool IsRx() const override;
44 bool IsTx() const override;
45 const ArrivalList& GetArrivalList() const override;
46 double ApplyRxGainDb(double rxPowerDb, UanTxMode mode) override;
47 void SetRxGainDb(double gainDb) override;
48 double GetRxGainDb() override;
49 void Receive(Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) override;
50 void Transmit(Ptr<UanPhy> src, Ptr<Packet> packet, double txPowerDb, UanTxMode txMode) override;
51 void SetChannel(Ptr<UanChannel> chan) override;
52 Ptr<UanChannel> GetChannel() const override;
53 void AddPhy(Ptr<UanPhy>) override;
54 const UanPhyList& GetPhyList() const override;
55 void Clear() override;
56
57 private:
58 State m_state; //!< Transducer state.
59 ArrivalList m_arrivalList; //!< List of arriving packets which overlap in time.
60 UanPhyList m_phyList; //!< List of physical layers attached above this tranducer.
61 Ptr<UanChannel> m_channel; //!< The attached channel.
62 EventId m_endTxEvent; //!< Event scheduled for end of transmission.
63 Time m_endTxTime; //!< Time at which transmission will be completed.
64 bool m_cleared; //!< Flab when we've been cleared.
65 double m_rxGainDb; //!< Receive gain in dB.
66
67 /**
68 * Remove an entry from the arrival list.
69 *
70 * \param arrival The packet arrival to remove.
71 */
72 void RemoveArrival(UanPacketArrival arrival);
73 /** Handle end of transmission event. */
74 void EndTx();
75
76 protected:
77 void DoDispose() override;
78
79}; // class UanTransducerHd
80
81} // namespace ns3
82
83#endif /* UAN_TRANSDUCER_HD_H */
An identifier for simulation events.
Definition event-id.h:45
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Class consisting of packet arrival information (Time, RxPower, mode, PDP).
The power delay profile returned by propagation models.
Half duplex implementation of transducer object.
void EndTx()
Handle end of transmission event.
State GetState() const override
Get the transducer state.
void SetChannel(Ptr< UanChannel > chan) override
Attach this transducer to a channel.
void Clear() override
Clears all pointer references.
bool IsTx() const override
Is the state transmitting?
Ptr< UanChannel > GetChannel() const override
Get the attached channel.
State m_state
Transducer state.
bool m_cleared
Flab when we've been cleared.
static TypeId GetTypeId()
Register this type.
void Transmit(Ptr< UanPhy > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txMode) override
Transmit a packet from this transducer.
double m_rxGainDb
Receive gain in dB.
Ptr< UanChannel > m_channel
The attached channel.
const UanPhyList & GetPhyList() const override
Get the list of physical layer above this transducer.
ArrivalList m_arrivalList
List of arriving packets which overlap in time.
~UanTransducerHd() override
Dummy destructor, see DoDispose.
void RemoveArrival(UanPacketArrival arrival)
Remove an entry from the arrival list.
void SetRxGainDb(double gainDb) override
Set the receiver gain.
bool IsRx() const override
Is the state receiving (or available for reception)?
EventId m_endTxEvent
Event scheduled for end of transmission.
void AddPhy(Ptr< UanPhy >) override
Attach a physical network layer above this transducer.
double GetRxGainDb() override
Get the receiver gain added to signal at receiver in dB.
double ApplyRxGainDb(double rxPowerDb, UanTxMode mode) override
Apply receiver gain in dB to the received power.
UanTransducerHd()
Constructor.
void Receive(Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp) override
Notify this object that a new packet has arrived at this nodes location.
Time m_endTxTime
Time at which transmission will be completed.
void DoDispose() override
Destructor implementation.
const ArrivalList & GetArrivalList() const override
Get the list of overlapped (in time) packets at this transducer.
UanPhyList m_phyList
List of physical layers attached above this tranducer.
Virtual base for Transducer objects.
State
Transducer state.
std::list< Ptr< UanPhy > > UanPhyList
List of UanPhy objects.
std::list< UanPacketArrival > ArrivalList
List of arriving packets overlapping in time.
Abstraction of packet modulation information.
Definition uan-tx-mode.h:32
Every class exported by the ns3 library is enclosed in the ns3 namespace.