application_layer.cpp

00001 
00002 #include "application_layer.hpp"
00003 #include "simulator.hpp"
00004 
00005 ApplicationLayer::ApplicationLayer(NodePtr node)
00006    : CommunicationLayer(node), m_isRunning(false)
00007 {
00008 
00009 }
00010 
00011 ApplicationLayer::~ApplicationLayer()
00012 {
00013 
00014 }
00015 
00016 void ApplicationLayer::start(const SimTime& startTime)
00017 {
00018    AppEpochEventPtr startEvent = AppEpochEvent::create(
00019       AppEpochEvent::Epochs_Start, thisApplicationLayer());
00020    SimTime scheduledTime = startTime - 
00021       Simulator::instance()->currentTime();
00022    assert(scheduledTime >= 0.0);
00023    Simulator::instance()->scheduleEvent(startEvent, scheduledTime);
00024 }
00025 
00026 void ApplicationLayer::stop(const SimTime& stopTime)
00027 {
00028    AppEpochEventPtr stopEvent = AppEpochEvent::create(
00029       AppEpochEvent::Epochs_Stop, thisApplicationLayer());
00030    SimTime scheduledTime = stopTime - 
00031       Simulator::instance()->currentTime();
00032    assert(scheduledTime >= 0.0);
00033    Simulator::instance()->scheduleEvent(stopEvent, scheduledTime);
00034 }
00035 
00036 bool ApplicationLayer::recvFromLayer(
00037    CommunicationLayer::Directions direction,
00038    PacketPtr packet, t_uint recvLayerIdx)
00039 {
00040    // The app layer should not have an upper communication
00041    // layer from which to receive.
00042    assert(direction == CommunicationLayer::Directions_Lower);
00043    return handleRecvdPacket(packet, recvLayerIdx);
00044 
00045 }
00046 
00047 

Generated on Tue Dec 12 17:04:37 2006 for rfidsim by  doxygen 1.4.7