Code Search for Developers
 
 
  

pp_client.h from EmStar at Krugle


Show pp_client.h syntax highlighted

/* preprocessor client */
#ifndef _PP_CLIENT_H_
#define _PP_CLIENT_H_

/* Standard libraries */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdlib.h>
#include <time.h>

/* Emstar libraries */
#include <libmisc/misc.h>
#include "libmisc/misc_ringbuff.h"
#include "libdev/sensor_client.h"
#include "libdev/status_dev.h"
#include "link/link.h"
#include "emrun/emrun.h"
#include "libdev/glib_extras.h"
#include "libdev/include/query_dev.h"
#include "libdev/include/sensor_dev.h"

/* macros */
#define DEFAULT_GAIN 6
#define DEFAULT_RATE 1
#define DEFAULT_SAMPLE_SIZE 4
#define DEFAULT_RING_SIZE 100
#define DEFAULT_OUTPUT_LEVEL 0

/* global information */
typedef struct pp_status {
	status_context_t *status_ref;  /* a reference to the status device */
	query_context_t *query_ref; /* a reference to the query device */
	sdev_context_t *sensor_ref; /* a reference to the sensor device */
	char server_ip[50]; /* server's IP address */
	int server_port; /* port number */
	char configuration_file[50]; /* message to send */
	int sd; /* socket descriptor */
	int binary_mode; /* binary mode flag */
	
	char file_name[100]; /* log file name */
	char type[50];

	int channel_number; /* channel number */
	int rate; /* # seconds between samples */
	int gain; /* gain of channel */
	int output_level; /* output level of digital out channel */
	int id; /* ID of preprocessor */
	char data[100]; /* most recent reading */

	int rx_packets; /* # incoming messages */
	int tx_packets; /* # outgoing messages */

	float data_f;	/* latest reading */
	int ring_size; /* size of ring buffer */
	int sample_size; /* size of each piece of data (in bytes) */
} pp_status_t;

/* send packets in socket identified by sd 
return # bytes actually sent, or negative value */
int write_socket(void *data);

/* initiate a local TCP connection, return socket_id or negative value if error */
int open_socket(void *data);

/* acception handler */
int read_socket(void *data, int fd, int cond, g_event_t *event);

/* intialize global information upon startup of the client */
void init_vars(pp_status_t* pps);

#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

  pp_client.h
  sensor_access.h