?? paraq-timers.cc~
字號:
/* * ParaQ W-LAN Energy Model Timers * * by Fabio A. Favia [faz(at)lugbari.org] * * Dipartimento di Elettrotecnica ed Elettronica, Politecnico di Bari * Via Orabona,4 - 70125 BARI, Italy * July, 2004 * * * Copyright (c) 2004 Politecnico di Bari, Italy. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code and binary code must contain * the above copyright notice, this list of conditions and the following * disclaimer. * * 2. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed at Politecnico di Bari, Italy * * 3. The name of the University may not be used to endorse or promote * products derived from this software without specific prior written * permission. * POLITECNICO DI BARI, ITALY, MAKES NO REPRESENTATIONS * CONCERNING EITHER THE MERCHANTABILITY OF THIS SOFTWARE OR THE * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software * is provided "as is" without express or implied warranty of any kind. * */#include <cstdlib>#include <stdlib.h>#include <stdio.h>#include <assert.h>#include "config.h"#include "trace.h"#include "rng.h" #include "energy-model.h"//#include "paraq-timers.h"#include "mac.h"#include "mac-802_11.h"//#include "mac-timers.h"void ParaqWakeUPT::handle(Event *){ busy_ = 0; paused_ = 0; stime = 0.0; rtime = 0.0; int node_sleep = nid_->sleep(); if (node_sleep) { /* if node is sleeping turn on the node*/ nid_->set_node_sleep(0); printf("Node %d wakes up at time %2.9f \n",mac->index_,Scheduler::instance().clock()); printf("Node %d status: %d \n",mac->index_,nid_->sleep()); } else { printf("Node %d was already up at time %2.9f \n",mac->index_,Scheduler::instance().clock()); }}void ParaqGoSleepT::handle(Event *) { busy_ = 0; paused_ = 0; stime = 0.0; rtime = 0.0; //printf("ParaqGoSleepT expires at %2.9f \n",Scheduler::instance().clock()); int node_sleep = nid_->sleep(); if (!node_sleep) { if (Scheduler::instance().clock() > (mac->TBTT_ - mac->pifs_)) { printf("No need to turn node %d in sleep mode...\n",mac->index_); return; } if (mac->ParaqPreSleep()) { nid_->set_node_sleep(1); printf("Putting Node %d in sleep mode at time %2.9f \n",mac->index_,Scheduler::instance().clock()); printf("Node %d status: %d \n",mac->index_,nid_->sleep()); } }}void ParaqWakeUPatBeacon::handle(Event *){ busy_ = 0; paused_ = 0; stime = 0.0; rtime = 0.0; //printf("ParaqWakeUPatBeacon EXPIRES at time %2.9f\n",Scheduler::instance().clock()); int node_sleep=nid_->sleep(); if (node_sleep) { nid_->set_node_sleep(0); //printf("Wake up node %d for BEACON in time %2.9f \n",mac->index_,Scheduler::instance().clock()); //printf("Node %d status: %d \n",mac->index_,nid_->sleep()); }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -