applications: Add state trace source to OnOffApplication
This commit is contained in:
@@ -18,6 +18,7 @@ This file is a best-effort approach to solving this issue; we will do our best b
|
|||||||
|
|
||||||
* (applications) Added two new base classes for source and sink applications, `SourceApplication` and `SinkApplication`, respectively.
|
* (applications) Added two new base classes for source and sink applications, `SourceApplication` and `SinkApplication`, respectively.
|
||||||
* (wifi) Changes have been made to the `WifiRemoteStationManager` interface for what concerns the update of the frame retry count of the MPDUs and the decision of dropping MPDUs (possibly based on the max retry limit). The `NeedRetransmission` method has been replaced by the `GetMpdusToDropOnTxFailure` method and the `DoNeedRetransmission` method has been replaced by the `DoGetMpdusToDropOnTxFailure` method. Also, the `DoIncrementRetryCountOnTxFailure` method has been added to implement custom policies for the update of the frame retry count of MPDUs upon transmission failure.
|
* (wifi) Changes have been made to the `WifiRemoteStationManager` interface for what concerns the update of the frame retry count of the MPDUs and the decision of dropping MPDUs (possibly based on the max retry limit). The `NeedRetransmission` method has been replaced by the `GetMpdusToDropOnTxFailure` method and the `DoNeedRetransmission` method has been replaced by the `DoGetMpdusToDropOnTxFailure` method. Also, the `DoIncrementRetryCountOnTxFailure` method has been added to implement custom policies for the update of the frame retry count of MPDUs upon transmission failure.
|
||||||
|
* (applications) Added an `OnOffState` trace source to `OnOffApplication`, to track whether the application is transmitting or not.
|
||||||
|
|
||||||
### Changes to existing API
|
### Changes to existing API
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,11 @@ OnOffApplication::GetTypeId()
|
|||||||
.AddTraceSource("TxWithSeqTsSize",
|
.AddTraceSource("TxWithSeqTsSize",
|
||||||
"A new packet is created with SeqTsSizeHeader",
|
"A new packet is created with SeqTsSizeHeader",
|
||||||
MakeTraceSourceAccessor(&OnOffApplication::m_txTraceWithSeqTsSize),
|
MakeTraceSourceAccessor(&OnOffApplication::m_txTraceWithSeqTsSize),
|
||||||
"ns3::PacketSink::SeqTsSizeCallback");
|
"ns3::PacketSink::SeqTsSizeCallback")
|
||||||
|
.AddTraceSource("OnOffState",
|
||||||
|
"Application state (0-OFF, 1-ON)",
|
||||||
|
MakeTraceSourceAccessor(&OnOffApplication::m_state),
|
||||||
|
"ns3::TracedValueCallback::Bool");
|
||||||
return tid;
|
return tid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,6 +272,7 @@ OnOffApplication::StartSending()
|
|||||||
m_lastStartTime = Simulator::Now();
|
m_lastStartTime = Simulator::Now();
|
||||||
ScheduleNextTx(); // Schedule the send packet event
|
ScheduleNextTx(); // Schedule the send packet event
|
||||||
ScheduleStopEvent();
|
ScheduleStopEvent();
|
||||||
|
m_state = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -275,8 +280,8 @@ OnOffApplication::StopSending()
|
|||||||
{
|
{
|
||||||
NS_LOG_FUNCTION(this);
|
NS_LOG_FUNCTION(this);
|
||||||
CancelEvents();
|
CancelEvents();
|
||||||
|
|
||||||
ScheduleStartEvent();
|
ScheduleStartEvent();
|
||||||
|
m_state = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private helpers
|
// Private helpers
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "ns3/event-id.h"
|
#include "ns3/event-id.h"
|
||||||
#include "ns3/ptr.h"
|
#include "ns3/ptr.h"
|
||||||
#include "ns3/traced-callback.h"
|
#include "ns3/traced-callback.h"
|
||||||
|
#include "ns3/traced-value.h"
|
||||||
|
|
||||||
namespace ns3
|
namespace ns3
|
||||||
{
|
{
|
||||||
@@ -189,6 +190,8 @@ class OnOffApplication : public SourceApplication
|
|||||||
* @param socket the not connected socket
|
* @param socket the not connected socket
|
||||||
*/
|
*/
|
||||||
void ConnectionFailed(Ptr<Socket> socket);
|
void ConnectionFailed(Ptr<Socket> socket);
|
||||||
|
|
||||||
|
TracedValue<bool> m_state; //!< State of application (0-OFF, 1-ON)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ns3
|
} // namespace ns3
|
||||||
|
|||||||
Reference in New Issue
Block a user