Code Search for Developers
 
 
  

sim_sensor_nims.h from EmStar at Krugle


Show sim_sensor_nims.h syntax highlighted

#ifndef __SENSOR_NIMS_H__
#define __SENSOR_NIMS_H__

#include "libdev/sensor_dev.h"
#include "sim_motor_nims.h"
#include <libdev/status_client.h>
#include <stdio.h>

#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <getopt.h>
#undef _GNU_SOURCE

#define DEF_SAMPL_SZ	1000
//#undef  ADD_SENSOR_DEVICE
#define ADD_SENSOR_DEVICE 
#define SENSORDEV	"nimsSensorDev"
#define INVALID_SENSOR_DATA     -100000

#define  LOG_SAMPLES

typedef struct sensor_replay_dev {
    sdev_context_t* sdev;
    int   startSample;
    motor_nims_state_t  *mns;
    char  * sensor_data_fname;
    void  * data;
    g_event_t *timer;
} sensor_replay_dev_t; 

typedef float  NimsSensorDataType;

typedef struct replay_Opts {
    size_t size;
    size_t sampleSz;
    float sampleRate;
    float pushRate;  //x:  push 1 sample every x milli second
    char  * sensor_data_fname;
} replay_Opts_t;

// Utility functions
int sdevNonisoWrite(void *data, int interval, g_event_t *event);

int sdev_sim_open(sdev_context_t* sdev);

int sdev_sim_close(sdev_context_t* sdev);

void sdev_sim_destroy(void* data, g_event_t* event);

int sdev_sim_usage(buf_t* buf);

int parse_sensor_options(int argc, char *argv[],replay_Opts_t* rbO);
void sensor_dev_usage(const char *s,buf_t *buf);

/*
typedef struct Nims_sensor_state {
  char *cmd_name;
  char *devicename;
  status_client_context_t* ctx;
  uint8_t watch:1;
  uint8_t crashproof:1;
  uint8_t binary:1;
  uint8_t printHdr:1;
  int    ready;
  float  sample_val;  // the most recent sample
} Nims_sensor_state_t;
*/

//int print_bin_output(sensor_client_ctx_t * sc, void *new_buffer, size_t size);
//int print_ascii_output(sensor_client_ctx_t * sc, void *new_buffer, size_t size);

int handle_crash(void *data, g_event_t *event);

void  destroy_private_data(void *data, g_event_t *event);

int  sensor_dev_init(int argc, char *argv[], motor_nims_state_t *mcs);
int  retrieve_sample_value (void *arg, sc_sample_t * one_sample);
#endif




See more files for this project here

EmStar

EmStar is a software system for developing and deploying wireless sensor networks involving Linux-based platforms. As the wireless sensor network community has attempted to deploy more complex designs---large-scale, long-lived systems that need self-organization and adaptivity---a number of difficult software design issues have arisen. Advances in software design have not kept pace with the capabilities of hardware. This is because designing for an adaptive, efficient, and useful sensor network has turned out to be surprisingly complex and difficult. EmStar is a Linux-based software framework, whose goal is to dramatically reduce this complexity, enabling work to be shared and reused, and simplifying and speeding the design of new sensor network applications.

Project homepage: http://cvs.cens.ucla.edu/emstar/
Programming language(s): C,Shell Script
License: other

  README
  data_replay.c
  data_replay_misc.cc
  mote_packet.c
  motor_command.c
  motor_sensor_dev.c
  sim_motor_nims.h
  sim_sensor_nims.h