A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::BleApplication Class Reference

Implementation of basic application layer This is used to check basic LinkLayer scheduling procedures. More...

#include "ble-application.h"

+ Inheritance diagram for ns3::BleApplication:
+ Collaboration diagram for ns3::BleApplication:

Public Types

enum  BleApplicationState { CONNECTION_SLAVE, CONNECTION_MASTER, ADVERTISE, SCANNING }
 

Public Member Functions

 BleApplication (void)
 Default Constructor. More...
 
virtual ~BleApplication (void)
 
void ChangeState (BleApplicationState s)
 Change state of application. More...
 
Ptr< PacketCreateResponsePacket (Ptr< Packet > p)
 Create response packet to LinkLayer. More...
 
Ptr< BleLinkLayerGetLinkLayer (void) const
 Get LinkLayer. More...
 
Ptr< NodeGetNode () const
 
void RxFromLinkLayer (Ptr< Packet > p, uint8_t int1, uint8_t int2)
 Received packet from LinkLayer. More...
 
void SendRequestPacket (bool b)
 Send request packet to LinkLayer. More...
 
void SetAdvString (char data[31])
 Set Advertising data. More...
 
void SetConnString (char data[100])
 Set Connection data. More...
 
void SetLinkLayer (Ptr< BleLinkLayer > ll)
 Set LinkLayer. More...
 
void SetNode (Ptr< Node > node)
 
void SetStartTime (Time start)
 
- Public Member Functions inherited from ns3::Application
 Application ()
 
virtual ~Application ()
 
Ptr< NodeGetNode () const
 
void SetNode (Ptr< Node > node)
 
void SetStartTime (Time start)
 Specify application start time. More...
 
void SetStopTime (Time stop)
 Specify application stop time. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Implement the GetInstanceTypeId method defined in ObjectBase. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) 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 erros. 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 (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Application
static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

virtual void StartApplication (void)
 Call to start application by starting a advertisement. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void NotifyNewAggregate (void)
 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 (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Member Functions

virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 

Private Attributes

uint8_t m_advData [31]
 Advertising data to be sent during advertisement. More...
 
uint8_t m_connData [100]
 Connection data to be sent during connections. More...
 
Ptr< BleLinkLayerm_linkLayer
 LinkLayer connected to this application. More...
 
Ptr< Nodem_node
 The node that this application is installed on. More...
 
Ptr< Packetm_pkt
 Packet to be sent or received. More...
 
EventId m_startEvent
 The event that will fire at m_startTime to start the application. More...
 
Time m_startTime
 The simulation time that the application will start. More...
 
BleApplicationState m_state
 Current state of Application. More...
 
EventId m_stopEvent
 The event that will fire at m_stopTime to end the application. More...
 
Time m_stopTime
 The simulation time that the application will end. More...
 

Additional Inherited Members

- Protected Attributes inherited from ns3::Application
Ptr< Nodem_node
 The node that this application is installed on. More...
 
EventId m_startEvent
 The event that will fire at m_startTime to start the application. More...
 
Time m_startTime
 The simulation time that the application will start. More...
 
EventId m_stopEvent
 The event that will fire at m_stopTime to end the application. More...
 
Time m_stopTime
 The simulation time that the application will end. More...
 

Detailed Description

Implementation of basic application layer This is used to check basic LinkLayer scheduling procedures.

Definition at line 37 of file ble-application.h.

Member Enumeration Documentation

Enumerator
CONNECTION_SLAVE 
CONNECTION_MASTER 
ADVERTISE 
SCANNING 

Definition at line 41 of file ble-application.h.

Constructor & Destructor Documentation

ns3::BleApplication::BleApplication ( void  )

Default Constructor.

Definition at line 43 of file ble-application.cc.

References NS_LOG_FUNCTION.

ns3::BleApplication::~BleApplication ( void  )
virtual

Definition at line 48 of file ble-application.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

void ns3::BleApplication::ChangeState ( BleApplicationState  s)

Change state of application.

Parameters
snew state of application

Definition at line 85 of file ble-application.cc.

References m_state, and NS_LOG_FUNCTION.

Ptr< Packet > ns3::BleApplication::CreateResponsePacket ( Ptr< Packet p)

Create response packet to LinkLayer.

Parameters
pinput packet to create response

This particular method will shift string packet p towards right.

Definition at line 225 of file ble-application.cc.

References ns3::Packet::CopyData(), data, ns3::Packet::GetSize(), and NS_LOG_FUNCTION.

Referenced by RxFromLinkLayer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::BleApplication::DoDispose ( void  )
privatevirtual

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 overriden 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::Application.

Definition at line 270 of file ble-application.cc.

References ns3::EventId::Cancel(), ns3::Object::DoDispose(), m_linkLayer, m_node, m_startEvent, m_stopEvent, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

void ns3::BleApplication::DoInitialize ( void  )
privatevirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Application.

Definition at line 262 of file ble-application.cc.

References ns3::Object::DoInitialize(), m_startEvent, m_startTime, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), and StartApplication().

+ Here is the call graph for this function:

Ptr< BleLinkLayer > ns3::BleApplication::GetLinkLayer ( void  ) const

Get LinkLayer.

Returns
Pointer to BleLinkLayer

Definition at line 78 of file ble-application.cc.

References m_linkLayer, and NS_LOG_FUNCTION.

Ptr<Node> ns3::BleApplication::GetNode ( ) const
TypeId ns3::BleApplication::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 30 of file ble-application.cc.

References m_startTime, ns3::MakeTimeAccessor(), ns3::MakeTimeChecker(), ns3::Seconds(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

void ns3::BleApplication::RxFromLinkLayer ( Ptr< Packet p,
uint8_t  int1,
uint8_t  int2 
)

Received packet from LinkLayer.

Parameters
pReceived packet
int1Integer parameter 1
int2Integer parameter 2

When Application is in SCANNING mode, int1 = 0 => Connection request not Allowed int1 = 1 => Conenction request allowed int1 = 2 => Only Connection request is allowed

int2 = 0 => Scan Request not allowed int2 = 1 => Scan Request allowed

When Application is in ADVERTISE mode, int2 = 0 => Received packet is Connection Request int2 = 1 => Received packet is Scan Request

When Application is in CONNECTION_SLAVE mode, int1 = int2 = 1 => Connection is closed. Change state to Advertise

When Application is in CONNECTION_MASTER mode, int1 = int2 = 1 => Connection closed int1 = 1 and int2 = 0 => ConnectionEvent restart

Definition at line 100 of file ble-application.cc.

References ADVERTISE, ns3::BleLinkLayer::BleLLChangeState(), ns3::BleLinkLayer::CONN_REQ, ns3::BleLinkLayer::CONN_SLAVE, CONNECTION_MASTER, CONNECTION_SLAVE, ns3::Packet::CopyData(), ns3::BleLinkLayer::CreateConnection(), CreateResponsePacket(), data, ns3::Packet::GetSize(), ns3::Packet::GetUid(), ns3::BleLinkLayer::LL_ADV_RX_ON, ns3::BleLinkLayer::LL_CONN_RX_ON, m_advData, m_linkLayer, m_state, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::BleLinkLayer::SCANNER_REQ, ns3::BleLinkLayer::SCANNER_RESP, SCANNING, ns3::Simulator::Schedule(), ns3::Simulator::ScheduleNow(), SendRequestPacket(), and ns3::BleLinkLayer::TxToPhy().

Referenced by SetLinkLayer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::BleApplication::SendRequestPacket ( bool  b)

Send request packet to LinkLayer.

Parameters
bWhether it is first request of connection

Definition at line 210 of file ble-application.cc.

References CONNECTION_MASTER, m_connData, m_linkLayer, m_pkt, m_state, NS_ASSERT, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), and ns3::BleLinkLayer::TxToPhy().

Referenced by RxFromLinkLayer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::BleApplication::SetAdvString ( char  data[31])

Set Advertising data.

Parameters
dataData to transmit in each ADV packets

Definition at line 62 of file ble-application.cc.

References m_advData, and NS_LOG_FUNCTION.

void ns3::BleApplication::SetConnString ( char  data[100])

Set Connection data.

Parameters
data100 byte data to transmit during connection

Definition at line 54 of file ble-application.cc.

References m_connData, and NS_LOG_FUNCTION.

void ns3::BleApplication::SetLinkLayer ( Ptr< BleLinkLayer ll)

Set LinkLayer.

Parameters
llPointer to BleLinkLayer

Definition at line 70 of file ble-application.cc.

References m_linkLayer, ns3::MakeCallback(), NS_LOG_FUNCTION, RxFromLinkLayer(), and ns3::ObjectBase::TraceConnectWithoutContext().

+ Here is the call graph for this function:

void ns3::BleApplication::SetNode ( Ptr< Node node)
void ns3::BleApplication::SetStartTime ( Time  start)

Definition at line 92 of file ble-application.cc.

References m_startEvent, m_startTime, NS_LOG_FUNCTION, ns3::Simulator::Schedule(), visualizer.core::start(), and StartApplication().

+ Here is the call graph for this function:

void ns3::BleApplication::StartApplication ( void  )
protectedvirtual

Call to start application by starting a advertisement.

Reimplemented from ns3::Application.

Definition at line 245 of file ble-application.cc.

References ADVERTISE, ns3::BleLinkLayer::ADVERTISER, ns3::BleLinkLayer::LL_ADV_RX_ON, m_advData, m_linkLayer, m_pkt, m_state, NS_LOG_FUNCTION, SCANNING, ns3::Simulator::ScheduleNow(), and ns3::BleLinkLayer::TxToPhy().

Referenced by DoInitialize(), and SetStartTime().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint8_t ns3::BleApplication::m_advData[31]
private

Advertising data to be sent during advertisement.

Definition at line 156 of file ble-application.h.

Referenced by RxFromLinkLayer(), SetAdvString(), and StartApplication().

uint8_t ns3::BleApplication::m_connData[100]
private

Connection data to be sent during connections.

Definition at line 152 of file ble-application.h.

Referenced by SendRequestPacket(), and SetConnString().

Ptr<BleLinkLayer> ns3::BleApplication::m_linkLayer
private

LinkLayer connected to this application.

Definition at line 148 of file ble-application.h.

Referenced by DoDispose(), GetLinkLayer(), RxFromLinkLayer(), SendRequestPacket(), SetLinkLayer(), and StartApplication().

Ptr<Node> ns3::BleApplication::m_node
private

The node that this application is installed on.

Definition at line 162 of file ble-application.h.

Referenced by DoDispose().

Ptr<Packet> ns3::BleApplication::m_pkt
private

Packet to be sent or received.

Definition at line 140 of file ble-application.h.

Referenced by SendRequestPacket(), and StartApplication().

EventId ns3::BleApplication::m_startEvent
private

The event that will fire at m_startTime to start the application.

Definition at line 165 of file ble-application.h.

Referenced by DoDispose(), DoInitialize(), and SetStartTime().

Time ns3::BleApplication::m_startTime
private

The simulation time that the application will start.

Definition at line 163 of file ble-application.h.

Referenced by DoInitialize(), GetTypeId(), and SetStartTime().

BleApplicationState ns3::BleApplication::m_state
private

Current state of Application.

Definition at line 144 of file ble-application.h.

Referenced by ChangeState(), RxFromLinkLayer(), SendRequestPacket(), and StartApplication().

EventId ns3::BleApplication::m_stopEvent
private

The event that will fire at m_stopTime to end the application.

Definition at line 166 of file ble-application.h.

Referenced by DoDispose().

Time ns3::BleApplication::m_stopTime
private

The simulation time that the application will end.

Definition at line 164 of file ble-application.h.


The documentation for this class was generated from the following files: