#include <rfid_reader_app.hpp>
Inheritance diagram for RfidReaderApp:
Public Types | |
typedef boost::shared_ptr< RfidReaderApp > | RfidReaderAppPtr |
Smart pointer that clients should use. | |
typedef multimap< t_uint, ReadTagData >::const_iterator | TagIterator |
The iterator for tag data which we are storing. | |
Public Member Functions | |
virtual | ~RfidReaderApp () |
A destructor. | |
virtual RfidReaderAppPtr | thisRfidReaderApp () |
Gives this pointer as a RfidReaderApp object. | |
virtual ApplicationLayerPtr | thisApplicationLayer () |
Gives this pointer as a ApplicationLayer object. | |
virtual SimulationEndListenerPtr | thisSimulationEndListener () |
Gives this pointer as a SimulationEndListener object. | |
void | startHandler () |
Function to execute when the application is started. | |
void | stopHandler () |
Function to execute when the application is stopped. | |
virtual void | simulationEndHandler () |
The function called when the simulation ends. | |
void | setReadPeriod (SimTime readPeriod) |
Set the period with which the read command will be issued. | |
void | setDoRepeatedReads (bool doRepeatedReads) |
Set whether or not reads are repeated or one-shot. | |
void | setDoReset (bool doReset) |
Set whether or not a reset packet is send before beginning the read process. | |
SimTime | getNextReadTime () const |
Get the next (absolute) time in a cycle that the read command is issued. | |
SimTime | getReadPeriod () const |
The period with which the reads are being done. | |
bool | getDoRepeatedReads () const |
Whether the application is doing repeated, cyclic reads or one-shot. | |
bool | getDoReset () const |
Whether the application is sends a reset packet before the read process. | |
void | setNumPowerControlLevels (t_uint numPowerControlLevels) |
Set the number of power control levels that the application will use for its reads. | |
t_uint | getNumPowerControlLevels () const |
Get the number of power control levels that the application will use for its reads. | |
void | signalReadEnd () |
The handler for when the MAC layer finishes a read request send by the application. | |
Static Public Member Functions | |
static RfidReaderAppPtr | create (NodePtr node, PhysicalLayerPtr physicalLayer) |
A factory method to ensure that all objects are created via new since we are using smart pointers. | |
Protected Member Functions | |
RfidReaderApp (NodePtr node, PhysicalLayerPtr physicalLayer) | |
A constructor. | |
bool | handleRecvdPacket (PacketPtr packet, t_uint sendingLayerIdx) |
Handle a received packet. | |
virtual void | doReadProcess () |
Do the read process for the application. | |
Protected Attributes | |
SimTime | m_firstReadSentTime |
The first time a read packet was sent. | |
SimTime | m_previousReadSentTime |
The previous time a read packet was sent. | |
multimap< t_uint, ReadTagData > | m_readTags |
The data for the tags we read, indexed by the power level at which it was read. | |
pair< t_uint, ReadTagData > | m_lastTagRead |
Keep track of the last tag that was read. | |
set< NodeId > | m_readTagIds |
A hash to keep track of whether an ID has been seen already. | |
Static Protected Attributes | |
static const string | m_TAGS_READ_COUNT_STRING = "tagsReadCount" |
String for the stats file output. | |
static const string | m_TAGS_READ_AT_POWER_COUNT_STRING = "tagsReadCountAtLevel_" |
String for the stats file output. | |
static const string | m_TAGS_READ_AVG_LATENCY_STRING = "avgTagReadLatency" |
String for the stats file output. | |
static const string | m_TAGS_READ_PROCESS_AVG_LATENCY_STRING = "avgTagReadProcessLatency" |
String for the stats file output. | |
static const string | m_LAST_TAG_READ_LATENCY_STRING = "lastTagReadLatency" |
String for the stats file output. | |
static const string | m_TAG_READ_PROCESS_LATENCY_STRING = "tagReadProcessLatency" |
String for the stats file output. | |
static const string | m_TAG_READ_LATENCY_STRING = "tagReadLatency" |
String for the stats file output. | |
static const string | m_TAG_READ_ID_STRING = "tagReadId" |
String for the stats file output. | |
static const string | m_TAG_READ_LEVEL_STRING = "tagReadPowerLevel" |
String for the stats file output. | |
static const string | m_TAG_READ_TIME_STRING = "tagReadTime" |
String for the stats file output. | |
Friends | |
class | RfidReaderAppReadEvent |
Definition at line 85 of file rfid_reader_app.hpp.
RfidReaderApp::RfidReaderApp | ( | NodePtr | node, | |
PhysicalLayerPtr | physicalLayer | |||
) | [protected] |
A constructor.
Allows readers to request that tags reset their state and send a read request to all tags within range.
Definition at line 29 of file rfid_reader_app.cpp.
Referenced by create().
bool RfidReaderApp::getDoRepeatedReads | ( | ) | const [inline] |
Whether the application is doing repeated, cyclic reads or one-shot.
Definition at line 455 of file rfid_reader_app.hpp.
bool RfidReaderApp::getDoReset | ( | ) | const [inline] |
Whether the application is sends a reset packet before the read process.
Definition at line 460 of file rfid_reader_app.hpp.
SimTime RfidReaderApp::getNextReadTime | ( | ) | const [inline] |
Get the next (absolute) time in a cycle that the read command is issued.
Definition at line 440 of file rfid_reader_app.hpp.
References Simulator::currentTime(), and Simulator::instance().
t_uint RfidReaderApp::getNumPowerControlLevels | ( | ) | const [inline] |
Get the number of power control levels that the application will use for its reads.
Definition at line 472 of file rfid_reader_app.hpp.
SimTime RfidReaderApp::getReadPeriod | ( | ) | const [inline] |
The period with which the reads are being done.
Definition at line 450 of file rfid_reader_app.hpp.
bool RfidReaderApp::handleRecvdPacket | ( | PacketPtr | packet, | |
t_uint | sendingLayerIdx | |||
) | [protected, virtual] |
Handle a received packet.
packet | a pointer to the received packet. | |
sendingLayerIdx | the index of the layer that sent the packet. |
Implements ApplicationLayer.
Definition at line 160 of file rfid_reader_app.cpp.
References Simulator::currentTime(), Packet::DataTypes_Application, Simulator::instance(), ApplicationLayer::m_isRunning, m_lastTagRead, m_previousReadSentTime, m_readTagIds, and m_readTags.
void RfidReaderApp::setDoRepeatedReads | ( | bool | doRepeatedReads | ) | [inline] |
Set whether or not reads are repeated or one-shot.
doRepeatedReads | true if repeated read commands are to be issued. |
Definition at line 430 of file rfid_reader_app.hpp.
void RfidReaderApp::setDoReset | ( | bool | doReset | ) | [inline] |
Set whether or not a reset packet is send before beginning the read process.
doReset | true if a reset packet should be sent. |
Definition at line 435 of file rfid_reader_app.hpp.
void RfidReaderApp::setNumPowerControlLevels | ( | t_uint | numPowerControlLevels | ) | [inline] |
Set the number of power control levels that the application will use for its reads.
The reader will start with the lowest transmit power level and continue increasing it on each successive read command until it reaches the initial power save level of the physical layer. The increments of the power level increase are uniformly spaced.
numPowerControlLevels | the number of transmit power levels to be used (must be greater than 0). |
Definition at line 465 of file rfid_reader_app.hpp.
void RfidReaderApp::setReadPeriod | ( | SimTime | readPeriod | ) | [inline] |
Set the period with which the read command will be issued.
readPeriod | the period of the read time if repeted reads are done. |
Definition at line 425 of file rfid_reader_app.hpp.
void RfidReaderApp::signalReadEnd | ( | ) |
The handler for when the MAC layer finishes a read request send by the application.
This is required when power control is used so that the application adjusts the power level to the appropriate level at the appropriate time.
Definition at line 203 of file rfid_reader_app.cpp.
ApplicationLayerPtr RfidReaderApp::thisApplicationLayer | ( | ) | [inline, virtual] |
Gives this
pointer as a ApplicationLayer
object.
This is used to deal with shared_ptr's
, this
, and inheritance.
this
object. Implements ApplicationLayer.
Definition at line 414 of file rfid_reader_app.hpp.
RfidReaderAppPtr RfidReaderApp::thisRfidReaderApp | ( | ) | [inline, virtual] |
Gives this
pointer as a RfidReaderApp
object.
This is used to deal with shared_ptr's
, this
, and inheritance.
this
object. Definition at line 408 of file rfid_reader_app.hpp.
SimulationEndListenerPtr RfidReaderApp::thisSimulationEndListener | ( | ) | [inline, virtual] |
Gives this
pointer as a SimulationEndListener
object.
This is used to deal with shared_ptr's
, this
, and inheritance.
this
object. Implements CommunicationLayer.
Definition at line 420 of file rfid_reader_app.hpp.