mica2.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <vector>
00028
00029
00030 #define DEFAULT_MICA2_PORT "/dev/ttyS0"
00031 #define DEFAULT_MICA2_RATE B57600
00032
00033
00034 class NodeCalibrationValues
00035 {
00036 public:
00037 unsigned int node_id;
00038 unsigned int group_id;
00039 int c_values[6];
00040 };
00041 typedef std::vector<NodeCalibrationValues> NCV;
00042
00043
00044 typedef struct
00045 {
00046 unsigned short vref;
00047 unsigned short thermistor;
00048 unsigned short light;
00049 unsigned short mic;
00050 unsigned short accelX;
00051 unsigned short accelY;
00052 unsigned short magX;
00053 unsigned short magY;
00054 } MTS310Data;
00055
00056
00057 typedef struct
00058 {
00059 unsigned short light;
00060 unsigned short accelX;
00061 unsigned short accelY;
00062 unsigned short sound[5];
00063 } MTS510Data;
00064
00065
00066
00067 typedef struct
00068 {
00069 unsigned char flags [2];
00070 unsigned char request[2];
00071 unsigned char type [2];
00072 unsigned char TID [16];
00073 unsigned char start [2];
00074 unsigned char length [2];
00075 unsigned char data [8];
00076 } M1miniCommand;
00077
00078
00079 typedef struct
00080 {
00081 unsigned char board_id;
00082 unsigned char packet_id;
00083 unsigned char node_id;
00084 unsigned char parent;
00085 unsigned short data[12];
00086 unsigned char terminator;
00087 } SensorPacket;
00088
00089
00090 typedef struct
00091 {
00092 unsigned short addr;
00093 unsigned char type;
00094 unsigned char group;
00095 unsigned char length;
00096 } __attribute__ ((packed)) TOSMsgHeader;
00097
00098
00099 typedef struct
00100 {
00101 unsigned short cmd;
00102 union
00103 {
00104 unsigned int new_rate;
00105 unsigned int node_id;
00106 unsigned char group;
00107 unsigned char rf_power;
00108 unsigned char rf_channel;
00109 struct
00110 {
00111 unsigned short device;
00112 unsigned short state;
00113 } actuate;
00114 } param;
00115 } __attribute__ ((packed)) XCommandOp;
00116
00117 typedef struct
00118 {
00119 TOSMsgHeader tos;
00120 unsigned short seq_no;
00121 unsigned short destination_id;
00122 XCommandOp inst[1];
00123 } __attribute__ ((packed)) XCommandMsg;
00124
00125
00126 typedef struct{
00127 TOSMsgHeader tos;
00128 unsigned char ptotal;
00129 unsigned char pi;
00130 unsigned short RID;
00131 unsigned short SG;
00132 unsigned char data[23];
00133 unsigned short crc;
00134 } __attribute__ ((packed)) RFIDMsg;
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
Last updated 12 September 2005 21:38:45
|