application_layer.cpp
来自「RFID reader 语 tag 模拟器」· C++ 代码 · 共 47 行
CPP
47 行
#include "application_layer.hpp" #include "simulator.hpp" ApplicationLayer::ApplicationLayer(NodePtr node) : CommunicationLayer(node), m_isRunning(false) { } ApplicationLayer::~ApplicationLayer() { } void ApplicationLayer::start(const SimTime& startTime) { AppEpochEventPtr startEvent = AppEpochEvent::create( AppEpochEvent::Epochs_Start, thisApplicationLayer()); SimTime scheduledTime = startTime - Simulator::instance()->currentTime(); assert(scheduledTime >= 0.0); Simulator::instance()->scheduleEvent(startEvent, scheduledTime); } void ApplicationLayer::stop(const SimTime& stopTime) { AppEpochEventPtr stopEvent = AppEpochEvent::create( AppEpochEvent::Epochs_Stop, thisApplicationLayer()); SimTime scheduledTime = stopTime - Simulator::instance()->currentTime(); assert(scheduledTime >= 0.0); Simulator::instance()->scheduleEvent(stopEvent, scheduledTime); } bool ApplicationLayer::recvFromLayer( CommunicationLayer::Directions direction, PacketPtr packet, t_uint recvLayerIdx) { // The app layer should not have an upper communication // layer from which to receive. assert(direction == CommunicationLayer::Directions_Lower); return handleRecvdPacket(packet, recvLayerIdx); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?