Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
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;
}
Ejemplo n.º 4
0
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;
}