本文整理汇总了C++中PacketPtr::addData方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketPtr::addData方法的具体用法?C++ PacketPtr::addData怎么用?C++ PacketPtr::addData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketPtr
的用法示例。
在下文中一共展示了PacketPtr::addData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addGenericHeader
void RfidReaderMac::addGenericHeader(PacketPtr packet,
NodeId receiverId) const
{
RfidReaderMacDataPtr macData = RfidReaderMacData::create();
macData->setType(RfidReaderMacData::Types_Generic);
macData->setSenderId(getNode()->getNodeId());
macData->setReceiverId(receiverId);
packet->addData(Packet::DataTypes_Link, *macData);
}
示例2: addSelectHeader
void RfidReaderMac::addSelectHeader(PacketPtr packet,
NodeId receiverId) const
{
RfidReaderMacDataPtr macData = RfidReaderMacData::create();
macData->setType(RfidReaderMacData::Types_Select);
macData->setSenderId(getNode()->getNodeId());
macData->setReceiverId(receiverId);
packet->setDoMaxTxPower(true);
packet->addData(Packet::DataTypes_Link, *macData);
}
示例3: createAckPacket
PacketPtr RfidReaderMac::createAckPacket(NodeId destination) const
{
RfidReaderMacDataPtr macData = RfidReaderMacData::create();
macData->setType(RfidReaderMacData::Types_Ack);
macData->setSenderId(getNode()->getNodeId());
macData->setReceiverId(destination);
PacketPtr packet = Packet::create();
packet->setDoMaxTxPower(true);
packet->addData(Packet::DataTypes_Link, *macData);
return packet;
}
示例4: createRequestPacket
PacketPtr RfidReaderMac::createRequestPacket() const
{
RfidReaderMacDataPtr macData = RfidReaderMacData::create();
macData->setType(RfidReaderMacData::Types_Request);
macData->setSenderId(getNode()->getNodeId());
macData->setReceiverId(NodeId::broadcastDestination());
// We must have at least: (1) a contention slot,
// (2) a slot for the SELECT to be sent by the ready,
// (3) a slot for the tag to reply with an app packet,
// (4) a slot for the reader to reply with an ACK.
assert(m_nextCycleNumberOfSlots >= 4);
macData->setNumberOfSlots(m_nextCycleNumberOfSlots);
PacketPtr packet = Packet::create();
assert(m_currentAppReadPacket.get() != 0);
packet->setTxPower(m_currentAppReadPacket->getTxPower());
packet->addData(Packet::DataTypes_Link, *macData);
return packet;
}