Code Search for Developers
 
 
  

mote.h from EmStar at Krugle


Show mote.h syntax highlighted

/*
 *
 * Copyright (c) 2003 The Regents of the University of California.  All 
 * rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 * - Neither the name of the University nor the names of its
 *   contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
 

/*
 * Interfaces for talking "directly" to a mote.
 *
 * Note: For plain old data transport, you probably don't want to use
 * these interfaces; use the generic link interface instead.  (See the
 * README file)
 *
 * $Id: mote.h,v 1.31 2005/08/14 00:49:51 girod Exp $
 */

#ifndef __MOTE_H__
#define __MOTE_H__

#include <libmisc/misc.h>
#include <libdev/packet_client.h>
#include "host_mote.h"

#define MN_MAX_RECV_PKT_SIZE    4096  // 4k bytes
#define MOTE_ACK_TIMEOUT        150 

/* low-level mote device types */
#define MOTE_HOSTMOTE_DEV "/dev/mote/%d/hostmote"
#define MOTE_STATUS_DEV   "/dev/mote/%d/status"
#define MOTE_COMMAND_DEV  "/dev/mote/%d/command"
#define MOTE_DEBUG_DEV    "/dev/mote/%d/debug"
#define MOTE_PROG_DEV     "/dev/mote/%d/program"
#define MOTE_PROG_LOG_DEV "/dev/mote/%d/prog_log"

/* from mote_name.c */
char *mote_name(int mote_index, char *mote_type);
int update_mote_id(int *mote_index, char *mote_index_arg);

/* used rarely, for ceiling mode support */
char *mote_name_nosim(int mote_index, char *mote_type);

/***** client library for reading hostmote packets from hostmoted *****/

typedef struct mote_context mote_context_t;

typedef struct _hm_ext_hdr {
    struct timeval recvtime;
    char next_hdr[0];
} hm_ext_hdr_t;

/* receiver callback prototype for HOSTMOTE packets (not motenic) */
typedef int (*mote_pkt_receive_cb_t)(hostmote_header *hdr, ssize_t data_len,
				     mote_context_t *mote, 
                                     struct timeval *recvtime);


/* options struct for opening a mote */
typedef struct mote_opts {
  int index;			/* mote number to open */
  uint8_t opnum;		/* type of hostmote packets desired */
  pd_queue_opts_t q_opts;	/* queue lengths */
  mote_pkt_receive_cb_t receive; /* receiver callback */

  void *data;			/* user-defined pointers */
  void *data2;
} mote_opts_t;

/* mote_user.c */
gint mote_open(mote_opts_t *opts, mote_context_t **ref);
gint mote_send(mote_context_t *mote, hostmote_header *hdr, ssize_t data_len);
gint mote_ioctl(mote_context_t *link, int cmd, ...);
mote_opts_t *mote_opts(mote_context_t *mote);


/********** ceiling array configuration ************/

#define CEILING_STATUS_DEVNAME "/dev/mote/ceiling"

typedef struct ceiling_mote {
  int port;
  int cable;
  int present;
  loc_t loc;
  int dead;
  int in_use;
} ceiling_mote_t;

typedef struct {
  uint8_t conf_type;
  uint8_t version;
  uint8_t mtu;
  uint16_t saddr;
  uint8_t reset_count;
  uint8_t pot;
  uint8_t lpl_tx;
  uint8_t lpl_rx;
  uint32_t serialCrcErrors;
  uint32_t pktCrcErrors;
  uint32_t pcCrcErrors;
  uint32_t txBytes;
  uint32_t txPkts;
  uint32_t rxBytes;
  uint32_t rxPkts;
  uint32_t txErrors;
  uint32_t rxDrops;
  uint32_t lenErrors;
  uint32_t retx;
  uint32_t ctrlPkts;
  uint8_t numNeighb;
  uint8_t numSched;
  uint8_t macState;
  uint8_t radioState;
  uint16_t sleepErrors;
  uint16_t macTxErrors;
  uint16_t pkts_queued;
  uint8_t max_queue_size;
} __attribute__ ((packed)) mote_report;  


#endif /* __MOTE_H__ */




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
  SMACMsg.h
  config.h
  debug_log.h
  emtos.h
  mote.h
  mote.run
  smac.h
  smac_linkstats.h