⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asyncmaclayer.h

📁 基于omnet++开发的Mf框架下的802.11协议仿真。
💻 H
字号:
/* -*- mode:c++ -*- ********************************************************
 * file:        AsyncMacLayer.h
 *
 * author:      Yupeng.hu
 *
 * copyright:   (C) 2006 HUNAN Universtiy, ChangSha China
 *
 ***************************************************************************
 * part of:     Async Simulation
 * description: - Async Description
 *
 ***************************************************************************
 * changelog:   $Revision$
 *              last modified:   $Date: 2006-7-7 10:21 $
 *              by:              $Author: Yupeng.hu $
 ***************************************************************************/
 
#ifndef ASYNC_MAC_LAYER_H
#define ASYNC_MAC_LAYER_H

#include <BasicMacLayer.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <list>
#include <vector>
#include <string>
#include <deque>
#include <map>
#include <mysql.h>

#define e 2.718
#define IS_ACTIVE 0
#define IS_SLEEP 1

class AsyncMacLayer : public BasicMacLayer
{
	
	typedef std::vector<MacPkt*> cMacPktVector;
	typedef std::vector<MacPkt*>::iterator vc_iterator;
	
public:
    Module_Class_Members(AsyncMacLayer, BasicMacLayer, 0);
    virtual void initialize(int);
		virtual void finish();
		
	
protected:
    /** @brief Handle self messages such as timer... */
    virtual void handleSelfMsg(cMessage*);

    /** @brief Handle messages from upper layer */
    virtual void handleUpperMsg(MacPkt*);
    

    /** @brief Handle messages from lower layer */
    virtual void handleLowerMsg(MacPkt*);
    
    /** @brief Pointer to RadioState published on the Blackboard*/
  	BBItemRef bbRs;
  	
  	/** @brief start to pop up msg in data queue*/
  	void startPop();
  	
  	/**@brief handle messages time_out*/
    void timeOutA();
  	
  	void displayStatus(bool); 	    
    int status;
private:  
	 
   	/**@brief record the msg for send*/
    cQueue queue;
    /**@brief the backup for queue*/
    cMacPktVector backupVector; 
    cMacPktVector tempCount;    
    vc_iterator tempIterator;
    
	int resendCounter;
	int tempAddr;
  int i;//暂时使用,用作节点标记  int ackTap;
  double cycleTime;
    cMessage *sleepEvent;
    cMessage *activeEvent;    
    cMessage *popEvent;
    cMessage *iniEvent;
    cMessage *timeOut;
    cMessage *energe;
    

    //long numFramesDropped;
    //long numFramesCollision;
    
    double groupSize;
    double sleepTimestamp;
  //  int numBurstMessage;
        
    double wakeupTime;
   // double alfa;    
    double sleepTime;
    double roundTime;
    double activeTime;
    
    double rxEnergy;
    double txEnergy;
    double sleepEnergy;  
        	
   	
   	cTopology *topo;
   	
   	/** @brief distance of this node to the target node */
   	double distance;  
  
  	/**
   	* @brief energy consumption for communications-mW
   	**/
  	double energyConsumption;  
  
  	/**
   	* @brief the number of packet received
   	**/
  	int numPacketRcvd;
  
  	/**
   	* @brief the last time beginning to sleep 
   	**/
  	double sleepStartTimestamp;
  
   	
  // uncomment the following lines to use the blackboard
  /*
    virtual bool blackboardItemChanged( BBItemRef );
    virtual bool blackboardItemPublished( BBItemRef );
    virtual bool blackboardItemWithdrawn( BBItemRef );
  */
		
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -