Hello,
here is the code in my class MyTag:
TypeId
MyTag::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::MyTag")
.SetParent<Tag> ()
.AddConstructor<MyTag> ()
.AddAttribute ("SimpleValue",
"A simple value",
EmptyAttributeValue (),
MakeUintegerAccessor (&MyTag::GetSimpleValue),
MakeUintegerChecker<uint16_t> ())
;
return tid;
}
TypeId
MyTag::GetInstanceTypeId (void) const
{
return GetTypeId ();
}
uint32_t
MyTag::GetSerializedSize (void) const
{
return 2;
}
void
MyTag::Serialize (TagBuffer i) const
{
i.WriteU16 (m_simpleValue);
}
void
MyTag::Deserialize (TagBuffer i)
{
m_simpleValue = i.ReadU16 ();
}
void
MyTag::Print (std::ostream &os) const
{
os << "v=" << (uint32_t)m_simpleValue;
}
void
MyTag::SetSimpleValue (uint16_t value)
{
m_simpleValue = value;
}
uint16_t
MyTag::GetSimpleValue (void) const
{
return m_simpleValue;
}
and that is how i use it
MyTag tag2;
tag2.SetSimpleValue((uint16_t)txNodeId);
packet->AddPacketTag(tag2);
I actually understood the problem for the different numbering. Before, I used a uint8_t variable to store the id, or a uint8_t can only store 255 values, which is why I had different values after NodeList, and at the sender. I switched to uint16_t, and I have the same values now.
By cons I do not always understand the formation time of a packet from the application layer to the physical layer increases and then decreases with time, I really need an explanation please.
Best regards.
Le lundi 27 avril 2015 09:35:36 UTC+2, Kevin Tewouda a écrit :