C Facchini
unread,Sep 28, 2009, 8:40:12 AM9/28/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-users
Dear list,
I've defined two new trace sources, belonging to the DcaTxop Object,
to trace contention window and datarate.
I've defined the two variables in the dca-txop.h file:
private:
TracedValue<uint32_t> m_cw;
TracedValue<uint32_t> m_dataRate;
Next step, I've modified dca-txop.cc the following way:
TypeId
DcaTxop::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::DcaTxop")
.SetParent<Object> ()
.AddConstructor<DcaTxop> ()
.AddTraceSource ("Cw",
"Contention window.",
MakeTraceSourceAccessor (&DcaTxop::m_cw))
.AddTraceSource ("Datarate",
"Transmission data rate.",
MakeTraceSourceAccessor (&DcaTxop::m_dataRate))
;
return tid;
}
Then, down the file, when there is a transmission (for instance in the
DcaTxop::NotifyAccessGranted function) I updated the variables:
m_cw = m_dcf->GetCw (); // this should trigger the callback...
NS_LOG_INFO(m_low->GetAddress () << " Cw updated (NoNeedFrag) " <<
m_cw);
Low ()->StartTransmission (m_currentPacket, &m_currentHdr,
params, m_transmissionListener);
if (m_currentHdr.IsData ())
{
WifiMacTrailer fcs;
uint32_t size = m_currentPacket->GetSize () + m_currentHdr.GetSize
() + fcs.GetSerializedSize ();
WifiRemoteStation *station = GetStation (m_currentHdr.GetAddr1
());
m_dataRate = station->GetDataMode (m_currentPacket,
size).GetDataRate (); // this should trigger the callback...
NS_LOG_INFO(m_low->GetAddress () << " DataRate updated
(NoNeedFrag) " << m_dataRate);
}
Finally I wrote a couple of simple callbacks, which however, never get
triggered.
I have to say that logging, by means of NS_LOG_INFO, works.
Did I go wrong in defining the trace sources?
Regards,
Christian