Half duplex implementation of transducer object. More...
#include "uan-transducer-hd.h"
Public Member Functions | |
UanTransducerHd () | |
Constructor. More... | |
~UanTransducerHd () override | |
Dummy destructor, see DoDispose. More... | |
void | AddPhy (Ptr< UanPhy >) override |
Attach a physical network layer above this transducer. More... | |
double | ApplyRxGainDb (double rxPowerDb, UanTxMode mode) override |
Apply receiver gain in dB to the received power. More... | |
void | Clear () override |
Clears all pointer references. More... | |
const ArrivalList & | GetArrivalList () const override |
Get the list of overlapped (in time) packets at this transducer. More... | |
Ptr< UanChannel > | GetChannel () const override |
Get the attached channel. More... | |
const UanPhyList & | GetPhyList () const override |
Get the list of physical layer above this transducer. More... | |
double | GetRxGainDb () override |
Get the receiver gain added to signal at receiver in dB. More... | |
State | GetState () const override |
Get the transducer state. More... | |
bool | IsRx () const override |
Is the state receiving (or available for reception)? More... | |
bool | IsTx () const override |
Is the state transmitting? More... | |
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. More... | |
void | SetChannel (Ptr< UanChannel > chan) override |
Attach this transducer to a channel. More... | |
void | SetRxGainDb (double gainDb) override |
Set the receiver gain. More... | |
void | Transmit (Ptr< UanPhy > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txMode) override |
Transmit a packet from this transducer. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::UanTransducer | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Protected Member Functions | |
void | DoDispose () override |
Destructor implementation. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoInitialize () |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Member Functions | |
void | EndTx () |
Handle end of transmission event. More... | |
void | RemoveArrival (UanPacketArrival arrival) |
Remove an entry from the arrival list. More... | |
Private Attributes | |
ArrivalList | m_arrivalList |
List of arriving packets which overlap in time. More... | |
Ptr< UanChannel > | m_channel |
The attached channel. More... | |
bool | m_cleared |
Flab when we've been cleared. More... | |
EventId | m_endTxEvent |
Event scheduled for end of transmission. More... | |
Time | m_endTxTime |
Time at which transmission will be completed. More... | |
UanPhyList | m_phyList |
List of physical layers attached above this tranducer. More... | |
double | m_rxGainDb |
Receive gain in dB. More... | |
State | m_state |
Transducer state. More... | |
Additional Inherited Members | |
Public Types inherited from ns3::UanTransducer | |
typedef std::list< UanPacketArrival > | ArrivalList |
List of arriving packets overlapping in time. More... | |
enum | State { TX , RX } |
Transducer state. More... | |
typedef std::list< Ptr< UanPhy > > | UanPhyList |
List of UanPhy objects. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Half duplex implementation of transducer object.
This class will only allow attached Phy's to receive packets if not in TX mode.
Definition at line 38 of file uan-transducer-hd.h.
ns3::UanTransducerHd::UanTransducerHd | ( | ) |
Constructor.
Definition at line 38 of file uan-transducer-hd.cc.
|
override |
Dummy destructor, see DoDispose.
Definition at line 47 of file uan-transducer-hd.cc.
Attach a physical network layer above this transducer.
More than one physical layer may be attached.
phy | The physical layer. |
Implements ns3::UanTransducer.
Definition at line 233 of file uan-transducer-hd.cc.
References m_phyList, and third::phy.
|
overridevirtual |
Apply receiver gain in dB to the received power.
rxPowerDb | Signal power in dB of arriving packet. |
mode | Mode arriving packet is using. |
Implements ns3::UanTransducer.
Definition at line 143 of file uan-transducer-hd.cc.
References GetRxGainDb(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by Receive().
|
overridevirtual |
Clears all pointer references.
Implements ns3::UanTransducer.
Definition at line 52 of file uan-transducer-hd.cc.
References ns3::EventId::Cancel(), m_arrivalList, m_channel, m_cleared, m_endTxEvent, and m_phyList.
Referenced by DoDispose().
|
overrideprotectedvirtual |
Destructor implementation.
This method is called by Dispose() or by the Object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overridden version of this method and chain up to their parent's implementation once they are done. i.e, for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose() method.
It is safe to call GetObject() from within this method.
Reimplemented from ns3::Object.
Definition at line 85 of file uan-transducer-hd.cc.
References Clear(), and ns3::Object::DoDispose().
|
private |
Handle end of transmission event.
Definition at line 212 of file uan-transducer-hd.cc.
References m_endTxTime, m_state, NS_ASSERT, ns3::UanTransducer::RX, ns3::Seconds(), and ns3::UanTransducer::TX.
Referenced by Transmit().
|
overridevirtual |
Get the list of overlapped (in time) packets at this transducer.
Implements ns3::UanTransducer.
Definition at line 125 of file uan-transducer-hd.cc.
References m_arrivalList.
|
overridevirtual |
Get the attached channel.
Implements ns3::UanTransducer.
Definition at line 227 of file uan-transducer-hd.cc.
References m_channel.
|
overridevirtual |
Get the list of physical layer above this transducer.
Implements ns3::UanTransducer.
Definition at line 239 of file uan-transducer-hd.cc.
References m_phyList.
|
overridevirtual |
Get the receiver gain added to signal at receiver in dB.
Implements ns3::UanTransducer.
Definition at line 137 of file uan-transducer-hd.cc.
References m_rxGainDb.
Referenced by ApplyRxGainDb().
|
overridevirtual |
Get the transducer state.
Implements ns3::UanTransducer.
Definition at line 107 of file uan-transducer-hd.cc.
References m_state.
|
static |
Register this type.
Definition at line 92 of file uan-transducer-hd.cc.
References m_rxGainDb, ns3::MakeDoubleAccessor(), and ns3::TypeId::SetParent().
|
overridevirtual |
Is the state receiving (or available for reception)?
Implements ns3::UanTransducer.
Definition at line 113 of file uan-transducer-hd.cc.
References m_state, and ns3::UanTransducer::RX.
|
overridevirtual |
Is the state transmitting?
Implements ns3::UanTransducer.
Definition at line 119 of file uan-transducer-hd.cc.
References m_state, and ns3::UanTransducer::TX.
|
overridevirtual |
Notify this object that a new packet has arrived at this nodes location.
packet | Packet arriving. |
rxPowerDb | Signal power in dB of arriving packet. |
txMode | Mode arriving packet is using. |
pdp | PDP of arriving signal. |
Implements ns3::UanTransducer.
Definition at line 152 of file uan-transducer-hd.cc.
References ApplyRxGainDb(), ns3::UanTxMode::GetDataRateBps(), ns3::Packet::GetSize(), m_arrivalList, m_phyList, m_state, ns3::Now(), ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, RemoveArrival(), ns3::UanTransducer::RX, ns3::Time::S, ns3::Simulator::Schedule(), and ns3::Seconds().
|
private |
Remove an entry from the arrival list.
arrival | The packet arrival to remove. |
Definition at line 245 of file uan-transducer-hd.cc.
References ns3::UanPacketArrival::GetPacket(), m_arrivalList, and m_phyList.
Referenced by Receive().
|
overridevirtual |
Attach this transducer to a channel.
chan | The channel |
Implements ns3::UanTransducer.
Definition at line 220 of file uan-transducer-hd.cc.
References m_channel, and NS_LOG_DEBUG.
|
overridevirtual |
Set the receiver gain.
gainDb | Gain added at receiver, in dB. |
Implements ns3::UanTransducer.
Definition at line 131 of file uan-transducer-hd.cc.
References m_rxGainDb.
|
overridevirtual |
Transmit a packet from this transducer.
src | Source PHY. |
packet | Packet to transmit. |
txPowerDb | Outgoing Tx power of packet. |
txMode | Mode to transmit packet with. |
Implements ns3::UanTransducer.
Definition at line 177 of file uan-transducer-hd.cc.
References ns3::EventId::Cancel(), EndTx(), ns3::UanTxMode::GetDataRateBps(), ns3::Packet::GetSize(), m_channel, m_endTxEvent, m_endTxTime, m_phyList, m_state, max, ns3::UanPhy::NotifyTxEnd(), ns3::Simulator::Now(), NS_LOG_DEBUG, ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::UanTransducer::TX.
|
private |
List of arriving packets which overlap in time.
Definition at line 70 of file uan-transducer-hd.h.
Referenced by Clear(), GetArrivalList(), Receive(), and RemoveArrival().
|
private |
The attached channel.
Definition at line 72 of file uan-transducer-hd.h.
Referenced by Clear(), GetChannel(), SetChannel(), and Transmit().
|
private |
Flab when we've been cleared.
Definition at line 75 of file uan-transducer-hd.h.
Referenced by Clear().
|
private |
Event scheduled for end of transmission.
Definition at line 73 of file uan-transducer-hd.h.
Referenced by Clear(), and Transmit().
|
private |
Time at which transmission will be completed.
Definition at line 74 of file uan-transducer-hd.h.
Referenced by EndTx(), and Transmit().
|
private |
List of physical layers attached above this tranducer.
Definition at line 71 of file uan-transducer-hd.h.
Referenced by AddPhy(), Clear(), GetPhyList(), Receive(), RemoveArrival(), and Transmit().
|
private |
Receive gain in dB.
Definition at line 76 of file uan-transducer-hd.h.
Referenced by GetRxGainDb(), GetTypeId(), and SetRxGainDb().
|
private |
Transducer state.
Definition at line 69 of file uan-transducer-hd.h.
Referenced by EndTx(), GetState(), IsRx(), IsTx(), Receive(), and Transmit().