/*
 * $RCSfile: device.h,v $  $Revision: 1.1 $  $Name:  $
 * $Id: device.h,v 1.1 2007/02/20 22:42:48 bpaauwe Exp $
 * $Author: bpaauwe $
 * $Date: 2007/02/20 22:42:48 $
 * ----------------------------------------------------------------------------
 *
 *  Copyright (c) Bob Paauwe (2007)
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License as published by the Free
 *  Software Foundation; either version 2 of the License, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful, but WITHOUT
 *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 *  more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * ----------------------------------------------------------------------------
 *
 *  Description:
 *    structure definitions for devices and links.
 * ----------------------------------------------------------------------------
 */
#define MAX_LINKS 417

#define DEVICE_UNREACHABLE  0x01
#define DEVICE_OK           0x02
#define DEVICE_OUT_OF_SYNC  0x04
#define DEVICE_VERIFIED     0x08

typedef struct _link_record {
	unsigned char flags;
	unsigned char group_number;
	unsigned char device_id[3];
	unsigned char data1;
	unsigned char data2;
	unsigned char data3;
} link_record_t;

typedef struct _device_t {
	char *name;
	unsigned char status;
	short type;
	short version;
	unsigned char id[3];
	int link_cnt;
	link_record_t links[MAX_LINKS];
	link_record_t current_lt[MAX_LINKS];
	unsigned char local_on_level;
	unsigned char local_ramp_rate;
	struct _device_t *next;
} device_t;

typedef struct _device_list {
	device_t *device;
	link_record_t link;
	struct _device_list *next;
} device_list_t;

typedef struct _scene {
	char *name;
	int group;
	device_t *controller;
	int responders;
	device_list_t *responder_list;
	int index;
	struct _scene *next;
} scene_t;

