tossim.h

来自「tinyos-2.0源代码!转载而已!要的尽管拿!」· C头文件 代码 · 共 135 行

H
135
字号
/* * "Copyright (c) 2005 Stanford University. All rights reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose, without fee, and without written * agreement is hereby granted, provided that the above copyright * notice, the following two paragraphs and the author appear in all * copies of this software. *  * IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE TO ANY PARTY FOR * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN * IF STANFORD UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. *  * STANFORD UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE * PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND STANFORD UNIVERSITY * HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, * ENHANCEMENTS, OR MODIFICATIONS." *//** * Declaration of C++ objects representing TOSSIM abstractions. * Used to generate Python objects. * * @author Philip Levis * @date   Nov 22 2005 */// $Id: tossim.h,v 1.1.2.8 2006/03/07 02:35:48 scipio Exp $#ifndef TOSSIM_H_INCLUDED#define TOSSIM_H_INCLUDED//#include <stdint.h>#include <memory.h>#include <tos.h>#include <mac.h>#include <radio.h>#include <packet.h>typedef struct variable_string {  char* type;  char* ptr;  int len;  int isArray;} variable_string_t;typedef struct nesc_app {  int numVariables;  char** variableNames;  char** variableTypes;  int* variableArray;} nesc_app_t;class Variable { public:  Variable(char* name, char* format, int array, int mote);  ~Variable();  variable_string_t getData();   private:  char* name;  char* realName;  char* format;  int mote;  void* ptr;  char* data;  size_t len;  int isArray;  variable_string_t str;};class Mote { public:  Mote(nesc_app_t* app);  ~Mote();  unsigned long id();    long long int euid();  void setEuid(long long int id);  long long int bootTime();  void bootAtTime(long long int time);  bool isOn();  void turnOff();  void turnOn();  void setID(unsigned long id);    Variable* getVariable(char* name);   private:  unsigned long nodeID;  nesc_app_t* app;};class Tossim { public:  Tossim(nesc_app_t* app);  ~Tossim();    void init();    long long int time();  long long int ticksPerSecond();  char* timeStr();  void setTime(long long int time);    Mote* currentNode();  Mote* getNode(unsigned long nodeID);  void setCurrentNode(unsigned long nodeID);  void addChannel(char* channel, FILE* file);  bool removeChannel(char* channel, FILE* file);    bool runNextEvent();  MAC* mac();  Radio* radio();  Packet* newPacket(); private:  char timeBuf[256];  nesc_app_t* app;  Mote** motes;};#endif // TOSSIM_H_INCLUDED

⌨️ 快捷键说明

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