Generic communication interface between the wireless board (mote) and the sensor board. Any kind of sensor board can be connected to the mote using this specification given it provides a SPI peripheral, one input pin with interrupt capability and one digital output. The sensor board must implement a special register set from which all required information can be retrieved. Protocol: http://is.gd/wuQorh Github: http://is.gd/ySj1L9

Dependencies:   mbed-src

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sens_itf.h Source File

sens_itf.h

Go to the documentation of this file.
00001 /** @file */
00002 
00003 #ifndef __SENS_ITF_H__
00004 #define __SENS_ITF_H__
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 #define SENS_ITF_LATEST_VERSION     0
00011 #define SENS_ITF_MAX_FRAME_SIZE   128
00012 #define SENS_ITF_DSP_MSG_MAX_SIZE  24
00013 #define SENS_ITF_MAX_POINTS        32
00014 #define SENS_ITF_SERVER_ADDR_SIZE  16
00015 #define SENS_ITF_MODEL_NAME_SIZE    8
00016 #define SENS_ITF_MANUF_NAME_SIZE    8
00017 #define SENS_ITF_POINT_NAME_SIZE    8
00018 
00019 /** Sensor interface standard datatypes */
00020 enum sens_itf_datatypes_e
00021 {
00022     SENS_ITF_DT_U8     = 0x00, /**< 8 bits unsigned */
00023     SENS_ITF_DT_S8     = 0x01, /**< 8 bits signed */
00024     SENS_ITF_DT_U16    = 0x02, /**< 16 bits unsigned */
00025     SENS_ITF_DT_S16    = 0x03, /**< 16 bits signed */
00026     SENS_ITF_DT_U32    = 0x04, /**< 32 bits unsigned */
00027     SENS_ITF_DT_S32    = 0x05, /**< 32 bits signed */
00028     SENS_ITF_DT_U64    = 0x06, /**< 64 bits unsigned */
00029     SENS_ITF_DT_S64    = 0x07, /**< 64 bits signed */
00030     SENS_ITF_DT_FLOAT  = 0x08, /**< IEEE 754 single precision */
00031     SENS_ITF_DT_DOUBLE = 0x09, /**< IEEE 754 double precision */
00032 };
00033 
00034 /** Sensor interface register map */
00035 enum sens_itf_register_map_e 
00036 {
00037     SENS_ITF_REGMAP_ITF_VERSION      = 0x00, /**< Sensor Board Interface Version */
00038     SENS_ITF_REGMAP_BRD_ID           = 0x01, /**< Sensor Board Identification */
00039     SENS_ITF_REGMAP_BRD_STATUS       = 0x02, /**< Sensor Board Status */
00040     SENS_ITF_REGMAP_BRD_CMD          = 0x03, /**< Sensor Board Command */
00041     SENS_ITF_REGMAP_READ_BAT_STATUS  = 0x04, /**< Read battery status */
00042     SENS_ITF_REGMAP_WRITE_BAT_STATUS = 0x05, /**< Write battery status */
00043     SENS_ITF_REGMAP_READ_BAT_CHARGE  = 0x06, /**< Read battery charge(0 - 100 % ) */
00044     SENS_ITF_REGMAP_WRITE_BAT_CHARGE = 0x07, /**< Write Battery charge(0 - 100 % ) */
00045     SENS_ITF_REGMAP_WPAN_STATUS      = 0x08, /**< Wireless network status */
00046     SENS_ITF_REGMAP_WPAN_STRENGTH    = 0x09, /**< Wireless network strength(RSSI, 0 to 100 % ) */
00047     SENS_ITF_REGMAP_DSP_WRITE        = 0x0A, /**< Write display (when display is available) */
00048     SENS_ITF_REGMAP_SVR_MAIN_ADDR    = 0x0B, /**< Main server address(IPv6) */
00049     SENS_ITF_REGMAP_SVR_SEC_ADDR     = 0x0C, /**< Secondary server address(IPv6) */
00050 
00051     /*0x0D to 0x0F - Reserved(Should not be answered) */
00052 
00053     SENS_ITF_REGMAP_POINT_DESC_1  = 0x10, /**< Sensor Point Description 1 */
00054     SENS_ITF_REGMAP_POINT_DESC_2  = 0x11, /**< Sensor Point Description 2 */
00055     SENS_ITF_REGMAP_POINT_DESC_3  = 0x12, /**< Sensor Point Description 3 */
00056     SENS_ITF_REGMAP_POINT_DESC_4  = 0x13, /**< Sensor Point Description 4 */
00057     SENS_ITF_REGMAP_POINT_DESC_5  = 0x14, /**< Sensor Point Description 5 */
00058     SENS_ITF_REGMAP_POINT_DESC_6  = 0x15, /**< Sensor Point Description 6 */
00059     SENS_ITF_REGMAP_POINT_DESC_7  = 0x16, /**< Sensor Point Description 7 */
00060     SENS_ITF_REGMAP_POINT_DESC_8  = 0x17, /**< Sensor Point Description 8 */
00061     SENS_ITF_REGMAP_POINT_DESC_9  = 0x18, /**< Sensor Point Description 9 */
00062     SENS_ITF_REGMAP_POINT_DESC_10 = 0x19, /**< Sensor Point Description 10 */
00063     SENS_ITF_REGMAP_POINT_DESC_11 = 0x1A, /**< Sensor Point Description 11 */
00064     SENS_ITF_REGMAP_POINT_DESC_12 = 0x1B, /**< Sensor Point Description 12 */
00065     SENS_ITF_REGMAP_POINT_DESC_13 = 0x1C, /**< Sensor Point Description 13 */
00066     SENS_ITF_REGMAP_POINT_DESC_14 = 0x1D, /**< Sensor Point Description 14 */
00067     SENS_ITF_REGMAP_POINT_DESC_15 = 0x1E, /**< Sensor Point Description 15 */
00068     SENS_ITF_REGMAP_POINT_DESC_16 = 0x1F, /**< Sensor Point Description 16 */
00069     SENS_ITF_REGMAP_POINT_DESC_17 = 0x20, /**< Sensor Point Description 17 */
00070     SENS_ITF_REGMAP_POINT_DESC_18 = 0x21, /**< Sensor Point Description 18 */
00071     SENS_ITF_REGMAP_POINT_DESC_19 = 0x22, /**< Sensor Point Description 19 */
00072     SENS_ITF_REGMAP_POINT_DESC_20 = 0x23, /**< Sensor Point Description 20 */
00073     SENS_ITF_REGMAP_POINT_DESC_21 = 0x24, /**< Sensor Point Description 21 */
00074     SENS_ITF_REGMAP_POINT_DESC_22 = 0x25, /**< Sensor Point Description 22 */
00075     SENS_ITF_REGMAP_POINT_DESC_23 = 0x26, /**< Sensor Point Description 23 */
00076     SENS_ITF_REGMAP_POINT_DESC_24 = 0x27, /**< Sensor Point Description 24 */
00077     SENS_ITF_REGMAP_POINT_DESC_25 = 0x28, /**< Sensor Point Description 25 */
00078     SENS_ITF_REGMAP_POINT_DESC_26 = 0x29, /**< Sensor Point Description 26 */
00079     SENS_ITF_REGMAP_POINT_DESC_27 = 0x2A, /**< Sensor Point Description 27 */
00080     SENS_ITF_REGMAP_POINT_DESC_28 = 0x2B, /**< Sensor Point Description 28 */
00081     SENS_ITF_REGMAP_POINT_DESC_29 = 0x2C, /**< Sensor Point Description 29 */
00082     SENS_ITF_REGMAP_POINT_DESC_30 = 0x2D, /**< Sensor Point Description 30 */
00083     SENS_ITF_REGMAP_POINT_DESC_31 = 0x2E, /**< Sensor Point Description 31 */
00084     SENS_ITF_REGMAP_POINT_DESC_32 = 0x2F, /**< Sensor Point Description 32 */
00085 
00086     SENS_ITF_REGMAP_READ_POINT_DATA_1 = 0x30, /**< Read Sensor Point Data 1 */
00087     SENS_ITF_REGMAP_READ_POINT_DATA_2 = 0x31, /**< Read Sensor Point Data 2 */
00088     SENS_ITF_REGMAP_READ_POINT_DATA_3 = 0x32, /**< Read Sensor Point Data 3 */
00089     SENS_ITF_REGMAP_READ_POINT_DATA_4 = 0x33, /**< Read Sensor Point Data 4 */
00090     SENS_ITF_REGMAP_READ_POINT_DATA_5 = 0x34, /**< Read Sensor Point Data 5 */
00091     SENS_ITF_REGMAP_READ_POINT_DATA_6 = 0x35, /**< Read Sensor Point Data 6 */
00092     SENS_ITF_REGMAP_READ_POINT_DATA_7 = 0x36, /**< Read Sensor Point Data 7 */
00093     SENS_ITF_REGMAP_READ_POINT_DATA_8 = 0x37, /**< Read Sensor Point Data 8 */
00094     SENS_ITF_REGMAP_READ_POINT_DATA_9 = 0x38, /**< Read Sensor Point Data 9 */
00095     SENS_ITF_REGMAP_READ_POINT_DATA_10 = 0x39, /**< Read Sensor Point Data 10 */
00096     SENS_ITF_REGMAP_READ_POINT_DATA_11 = 0x3A, /**< Read Sensor Point Data 11 */
00097     SENS_ITF_REGMAP_READ_POINT_DATA_12 = 0x3B, /**< Read Sensor Point Data 12 */
00098     SENS_ITF_REGMAP_READ_POINT_DATA_13 = 0x3C, /**< Read Sensor Point Data 13 */
00099     SENS_ITF_REGMAP_READ_POINT_DATA_14 = 0x3D, /**< Read Sensor Point Data 14 */
00100     SENS_ITF_REGMAP_READ_POINT_DATA_15 = 0x3E, /**< Read Sensor Point Data 15 */
00101     SENS_ITF_REGMAP_READ_POINT_DATA_16 = 0x3F, /**< Read Sensor Point Data 16 */
00102     SENS_ITF_REGMAP_READ_POINT_DATA_17 = 0x40, /**< Read Sensor Point Data 17 */
00103     SENS_ITF_REGMAP_READ_POINT_DATA_18 = 0x41, /**< Read Sensor Point Data 18 */
00104     SENS_ITF_REGMAP_READ_POINT_DATA_19 = 0x42, /**< Read Sensor Point Data 19 */
00105     SENS_ITF_REGMAP_READ_POINT_DATA_20 = 0x43, /**< Read Sensor Point Data 20 */
00106     SENS_ITF_REGMAP_READ_POINT_DATA_21 = 0x44, /**< Read Sensor Point Data 21 */
00107     SENS_ITF_REGMAP_READ_POINT_DATA_22 = 0x45, /**< Read Sensor Point Data 22 */
00108     SENS_ITF_REGMAP_READ_POINT_DATA_23 = 0x46, /**< Read Sensor Point Data 23 */
00109     SENS_ITF_REGMAP_READ_POINT_DATA_24 = 0x47, /**< Read Sensor Point Data 24 */
00110     SENS_ITF_REGMAP_READ_POINT_DATA_25 = 0x48, /**< Read Sensor Point Data 25 */
00111     SENS_ITF_REGMAP_READ_POINT_DATA_26 = 0x49, /**< Read Sensor Point Data 26 */
00112     SENS_ITF_REGMAP_READ_POINT_DATA_27 = 0x4A, /**< Read Sensor Point Data 27 */
00113     SENS_ITF_REGMAP_READ_POINT_DATA_28 = 0x4B, /**< Read Sensor Point Data 28 */
00114     SENS_ITF_REGMAP_READ_POINT_DATA_29 = 0x4C, /**< Read Sensor Point Data 29 */
00115     SENS_ITF_REGMAP_READ_POINT_DATA_30 = 0x4D, /**< Read Sensor Point Data 30 */
00116     SENS_ITF_REGMAP_READ_POINT_DATA_31 = 0x4E, /**< Read Sensor Point Data 31 */
00117     SENS_ITF_REGMAP_READ_POINT_DATA_32 = 0x4F, /**< Read Sensor Point Data 32 */
00118 
00119     SENS_ITF_REGMAP_WRITE_POINT_DATA_1 = 0x50, /**< Write Sensor Point Data 1 */
00120     SENS_ITF_REGMAP_WRITE_POINT_DATA_2 = 0x51, /**< Write Sensor Point Data 2 */
00121     SENS_ITF_REGMAP_WRITE_POINT_DATA_3 = 0x52, /**< Write Sensor Point Data 3 */
00122     SENS_ITF_REGMAP_WRITE_POINT_DATA_4 = 0x53, /**< Write Sensor Point Data 4 */
00123     SENS_ITF_REGMAP_WRITE_POINT_DATA_5 = 0x54, /**< Write Sensor Point Data 5 */
00124     SENS_ITF_REGMAP_WRITE_POINT_DATA_6 = 0x55, /**< Write Sensor Point Data 6 */
00125     SENS_ITF_REGMAP_WRITE_POINT_DATA_7 = 0x56, /**< Write Sensor Point Data 7 */
00126     SENS_ITF_REGMAP_WRITE_POINT_DATA_8 = 0x57, /**< Write Sensor Point Data 8 */
00127     SENS_ITF_REGMAP_WRITE_POINT_DATA_9 = 0x58, /**< Write Sensor Point Data 9 */
00128     SENS_ITF_REGMAP_WRITE_POINT_DATA_10 = 0x59, /**< Write Sensor Point Data 10 */
00129     SENS_ITF_REGMAP_WRITE_POINT_DATA_11 = 0x5A, /**< Write Sensor Point Data 11 */
00130     SENS_ITF_REGMAP_WRITE_POINT_DATA_12 = 0x5B, /**< Write Sensor Point Data 12 */
00131     SENS_ITF_REGMAP_WRITE_POINT_DATA_13 = 0x5C, /**< Write Sensor Point Data 13 */
00132     SENS_ITF_REGMAP_WRITE_POINT_DATA_14 = 0x5D, /**< Write Sensor Point Data 14 */
00133     SENS_ITF_REGMAP_WRITE_POINT_DATA_15 = 0x5E, /**< Write Sensor Point Data 15 */
00134     SENS_ITF_REGMAP_WRITE_POINT_DATA_16 = 0x5F, /**< Write Sensor Point Data 16 */
00135     SENS_ITF_REGMAP_WRITE_POINT_DATA_17 = 0x60, /**< Write Sensor Point Data 17 */
00136     SENS_ITF_REGMAP_WRITE_POINT_DATA_18 = 0x61, /**< Write Sensor Point Data 18 */
00137     SENS_ITF_REGMAP_WRITE_POINT_DATA_19 = 0x62, /**< Write Sensor Point Data 19 */
00138     SENS_ITF_REGMAP_WRITE_POINT_DATA_20 = 0x63, /**< Write Sensor Point Data 20 */
00139     SENS_ITF_REGMAP_WRITE_POINT_DATA_21 = 0x64, /**< Write Sensor Point Data 21 */
00140     SENS_ITF_REGMAP_WRITE_POINT_DATA_22 = 0x65, /**< Write Sensor Point Data 22 */
00141     SENS_ITF_REGMAP_WRITE_POINT_DATA_23 = 0x66, /**< Write Sensor Point Data 23 */
00142     SENS_ITF_REGMAP_WRITE_POINT_DATA_24 = 0x67, /**< Write Sensor Point Data 24 */
00143     SENS_ITF_REGMAP_WRITE_POINT_DATA_25 = 0x68, /**< Write Sensor Point Data 25 */
00144     SENS_ITF_REGMAP_WRITE_POINT_DATA_26 = 0x69, /**< Write Sensor Point Data 26 */
00145     SENS_ITF_REGMAP_WRITE_POINT_DATA_27 = 0x6A, /**< Write Sensor Point Data 27 */
00146     SENS_ITF_REGMAP_WRITE_POINT_DATA_28 = 0x6B, /**< Write Sensor Point Data 28 */
00147     SENS_ITF_REGMAP_WRITE_POINT_DATA_29 = 0x6C, /**< Write Sensor Point Data 29 */
00148     SENS_ITF_REGMAP_WRITE_POINT_DATA_30 = 0x6D, /**< Write Sensor Point Data 30 */
00149     SENS_ITF_REGMAP_WRITE_POINT_DATA_31 = 0x6E, /**< Write Sensor Point Data 31 */
00150     SENS_ITF_REGMAP_WRITE_POINT_DATA_32 = 0x6F, /**< Write Sensor Point Data 32 */
00151 
00152     /* 0x70 to 0xFF - Reserved */
00153 };
00154 
00155 enum sens_itf_sensor_status_e
00156 {
00157     SENS_ITF_SENSOR_STATUS_OK = 0,
00158     SENS_ITF_SENSOR_STATUS_POINT_1 = 1,
00159     SENS_ITF_SENSOR_STATUS_POINT_2 = 2,
00160     SENS_ITF_SENSOR_STATUS_POINT_3 = 3,
00161     SENS_ITF_SENSOR_STATUS_POINT_4 = 4,
00162     SENS_ITF_SENSOR_STATUS_POINT_5 = 5,
00163     SENS_ITF_SENSOR_STATUS_POINT_6 = 6,
00164     SENS_ITF_SENSOR_STATUS_POINT_7 = 7,
00165     SENS_ITF_SENSOR_STATUS_POINT_8 = 8,
00166     SENS_ITF_SENSOR_STATUS_POINT_9 = 9,
00167     SENS_ITF_SENSOR_STATUS_POINT_10 = 10,
00168     SENS_ITF_SENSOR_STATUS_POINT_11 = 11,
00169     SENS_ITF_SENSOR_STATUS_POINT_12 = 12,
00170     SENS_ITF_SENSOR_STATUS_POINT_13 = 13,
00171     SENS_ITF_SENSOR_STATUS_POINT_14 = 14,
00172     SENS_ITF_SENSOR_STATUS_POINT_15 = 15,
00173     SENS_ITF_SENSOR_STATUS_POINT_16 = 16,
00174     SENS_ITF_SENSOR_STATUS_POINT_17 = 17,
00175     SENS_ITF_SENSOR_STATUS_POINT_18 = 18,
00176     SENS_ITF_SENSOR_STATUS_POINT_19 = 19,
00177     SENS_ITF_SENSOR_STATUS_POINT_20 = 20,
00178     SENS_ITF_SENSOR_STATUS_POINT_21 = 21,
00179     SENS_ITF_SENSOR_STATUS_POINT_22 = 22,
00180     SENS_ITF_SENSOR_STATUS_POINT_23 = 23,
00181     SENS_ITF_SENSOR_STATUS_POINT_24 = 24,
00182     SENS_ITF_SENSOR_STATUS_POINT_25 = 25,
00183     SENS_ITF_SENSOR_STATUS_POINT_26 = 26,
00184     SENS_ITF_SENSOR_STATUS_POINT_27 = 27,
00185     SENS_ITF_SENSOR_STATUS_POINT_28 = 28,
00186     SENS_ITF_SENSOR_STATUS_POINT_29 = 29,
00187     SENS_ITF_SENSOR_STATUS_POINT_30 = 30,
00188     SENS_ITF_SENSOR_STATUS_POINT_31 = 31,
00189     SENS_ITF_SENSOR_STATUS_POINT_32 = 32,
00190     /* 33 to 127 - reserved */
00191     SENS_ITF_SENSOR_STATUS_GENERAL_SENSOR_FAILURE = 128,
00192     /* 129 to 255 - reserved */
00193 };
00194 
00195 enum sens_itf_sensor_cmds_e
00196 {
00197     SENS_ITF_SENSOR_CMD_RESET = 0,
00198 };
00199 
00200 enum sens_itf_ans_status_e
00201 {
00202     SENS_ITF_ANS_OK = 0,
00203     SENS_ITF_ANS_ERROR = 1,
00204     SENS_ITF_ANS_CRC_ERROR = 2,
00205     SENS_ITF_ANS_READY_ONLY = 3,
00206     SENS_ITF_ANS_WRITE_ONLY = 4,
00207     SENS_ITF_ANS_REGISTER_NOT_IMPLEMENTED = 5,
00208 };
00209 
00210 enum sens_itf_access_rights_e
00211 {
00212     SENS_ITF_ACCESS_READ_ONLY = 0x01,
00213     SENS_ITF_ACCESS_WRITE_ONLY = 0x02,
00214     SENS_ITF_ACCESS_READ_WRITE = 0x03,
00215 };
00216 
00217 enum sens_itf_sensor_capabilities_e
00218 {
00219     SENS_ITF_CAPABILITIES_BATTERY = 0x01,
00220     SENS_ITF_CAPABILITIES_DISPLAY = 0x02,
00221     SENS_ITF_CAPABILITIES_WPAN_STATUS = 0x04,
00222     SENS_ITF_CAPABILITIES_BATTERY_STATUS = 0x08,
00223 };
00224 
00225 enum sens_itf_bat_status_e
00226 {
00227     SENS_ITF_BAT_STATUS_CHARGED = 0x00,
00228     SENS_ITF_BAT_STATUS_CHARGING = 0x01,
00229     SENS_ITF_BAT_STATUS_DISCHARGING = 0x02,
00230     SENS_ITF_BAT_STATUS_FAILURE = 0x03,
00231 };
00232 
00233 enum sens_itf_wpan_status_e
00234 {
00235     SENS_ITF_WPAN_STATUS_CONNECTED = 0x00,
00236     SENS_ITF_WPAN_STATUS_DISCONNECTED = 0x01,
00237     SENS_ITF_WPAN_STATUS_CONNECTING = 0x02,
00238 };
00239 
00240 union sens_itf_point_data_u
00241 {
00242     uint8_t  u8;
00243     int8_t   s8;
00244     uint16_t u16;
00245     int16_t  s16;
00246     uint32_t u32;
00247     int32_t  s32;
00248     uint64_t u64;
00249     int64_t  s64;
00250     float    fp32;
00251     double   fp64;
00252 };
00253 
00254 typedef struct sens_itf_cmd_bat_status_s
00255 {
00256     uint8_t status;
00257 } sens_itf_cmd_bat_status_t;
00258 
00259 typedef struct sens_itf_cmd_bat_charge_s
00260 {
00261     uint8_t charge;
00262 } sens_itf_cmd_bat_charge_t;
00263 
00264 typedef struct sens_itf_cmd_command_s
00265 {
00266     uint8_t cmd;
00267 } sens_itf_cmd_command_t;
00268 
00269 typedef struct sens_itf_cmd_command_res_s
00270 {
00271     uint8_t status;
00272 } sens_itf_cmd_command_res_t;
00273 
00274 typedef struct sens_itf_cmd_wpan_status_s
00275 {
00276     uint8_t status;
00277 } sens_itf_cmd_wpan_status_t;
00278 
00279 typedef struct sens_itf_cmd_wpan_strenght_s
00280 {
00281     uint8_t strenght;
00282 } sens_itf_cmd_wpan_strenght_t;
00283 
00284 typedef struct sens_itf_cmd_write_display_s
00285 {
00286     uint8_t line;
00287     uint8_t msg[SENS_ITF_DSP_MSG_MAX_SIZE];
00288 } sens_itf_cmd_write_display_t;
00289 
00290 typedef struct sens_itf_cmd_svr_addr_s
00291 {
00292     uint8_t addr[SENS_ITF_SERVER_ADDR_SIZE];
00293 } sens_itf_cmd_svr_addr_t;
00294 
00295 typedef struct sens_itf_cmd_itf_version_s
00296 {
00297     uint8_t version;
00298 } sens_itf_cmd_itf_version_t;
00299 
00300 typedef struct sens_itf_cmd_brd_id_s
00301 {
00302     uint8_t model[SENS_ITF_MODEL_NAME_SIZE];
00303     uint8_t manufactor[SENS_ITF_MANUF_NAME_SIZE];
00304     uint32_t sensor_id;
00305     uint8_t hardware_revision;
00306     uint8_t num_of_points;
00307     uint8_t cabalities;
00308 } sens_itf_cmd_brd_id_t;
00309 
00310 typedef struct sens_itf_cmd_brd_status_s
00311 {
00312     uint8_t status;
00313 } sens_itf_cmd_brd_status_t;
00314 
00315 typedef struct sens_itf_cmd_point_desc_s
00316 {
00317     uint8_t name[SENS_ITF_POINT_NAME_SIZE];
00318     uint8_t type;
00319     uint8_t unit;
00320     uint8_t access_rights;
00321     uint32_t sampling_time_x250ms;
00322 } sens_itf_cmd_point_desc_t;
00323 
00324 typedef struct sens_itf_cmd_point_s
00325 {
00326     union sens_itf_point_data_u value;
00327     uint8_t type;
00328 } sens_itf_cmd_point_t;
00329 
00330 typedef struct sens_itf_point_ctrl_s
00331 {
00332     uint8_t num_of_points;
00333     struct {
00334         sens_itf_cmd_point_desc_t desc;
00335         sens_itf_cmd_point_t value;
00336     } points[SENS_ITF_MAX_POINTS];
00337 } sens_itf_point_ctrl_t;
00338 
00339 union sens_itf_cmds_u
00340 {
00341     sens_itf_cmd_bat_status_t bat_status_cmd;
00342     sens_itf_cmd_bat_charge_t bat_charge_cmd;
00343     sens_itf_cmd_command_t command_cmd;
00344     sens_itf_cmd_command_res_t command_res_cmd;
00345     sens_itf_cmd_wpan_status_t wpan_status_cmd;
00346     sens_itf_cmd_wpan_strenght_t wpan_strength_cmd;
00347     sens_itf_cmd_write_display_t write_display_cmd;
00348     sens_itf_cmd_svr_addr_t svr_addr_cmd;
00349     sens_itf_cmd_itf_version_t itf_version_cmd;
00350     sens_itf_cmd_brd_id_t brd_id_cmd;
00351     sens_itf_cmd_brd_status_t brd_status_cmd;
00352     sens_itf_cmd_point_desc_t point_desc_cmd;
00353     sens_itf_cmd_point_t point_value_cmd;
00354 };
00355 
00356 typedef struct sens_itf_cmd_req_hdr_s
00357 {
00358     uint8_t size;
00359     uint8_t addr;
00360 } sens_itf_cmd_req_hdr_t;
00361 
00362 typedef struct sens_itf_cmd_res_hdr_s
00363 {
00364     uint8_t size;
00365     uint8_t status;
00366     uint8_t addr;
00367 } sens_itf_cmd_res_hdr_t;
00368 
00369 typedef struct sens_itf_cmd_req_s
00370 {
00371     sens_itf_cmd_req_hdr_t hdr;
00372     union sens_itf_cmds_u payload;
00373     uint16_t crc;
00374 } sens_itf_cmd_req_t;
00375 
00376 typedef struct sens_itf_cmd_res_s
00377 {
00378     sens_itf_cmd_res_hdr_t hdr;
00379     union sens_itf_cmds_u payload;
00380     uint16_t crc;
00381 } sens_itf_cmd_res_t;
00382 
00383 
00384 //extern uint8_t sens_itf_send_cmd(sens_itf_cmd_req_t * cmd, sens_itf_cmd_res_t * ans);
00385 //extern int sens_itf_send_cmd_async(const sens_itf_cmd_req_t * const cmd, const sens_itf_cmd_res_t * ans);
00386 
00387 extern uint8_t sens_itf_mote_init(void);
00388 extern uint8_t sens_itf_sensor_init(void);
00389 extern void sens_itf_mote_main(void);
00390 
00391 extern uint8_t sens_itf_unpack_point_value(sens_itf_cmd_point_t *point, uint8_t *buf);
00392 extern uint8_t sens_itf_pack_point_value(const sens_itf_cmd_point_t *point, uint8_t *buf);
00393 
00394 extern uint8_t sens_itf_unpack_cmd_res(sens_itf_cmd_res_t *cmd, uint8_t *frame, uint8_t frame_size);
00395 extern uint8_t sens_itf_unpack_cmd_req(sens_itf_cmd_req_t *cmd, uint8_t *frame, uint8_t frame_size);
00396 extern uint8_t sens_itf_pack_cmd_res  (sens_itf_cmd_res_t *cmd, uint8_t *frame);
00397 extern uint8_t sens_itf_pack_cmd_req  (sens_itf_cmd_req_t *cmd, uint8_t *frame);
00398 
00399 #ifdef __cplusplus
00400 }
00401 #endif
00402 
00403 #endif /* __SENS_ITF_H__ */