/* relais control program header file
 * Daniel Willmann <mhnalpha@gmx.net>
 * E-Mails (other than spam) welcome :-)
 *
 * adapted from relais example code by
 * Copyright (C) 2003	Joachim Schiele 
 *
 * 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.
 *
 */

#define PORT "/dev/ttyS1"
#define DEBUG
typedef unsigned char uchar;
#define BROADCAST 0

#define CMD_NOP		0
#define CMD_SETUP	1
#define CMD_GETPORT	2
#define CMD_SETPORT	3
#define CMD_GETOPT	4
#define CMD_SETOPT	5
#define CMD_INVALCSUM	255

#define EWRITEFAIL	1
#define EREADFAIL	2
#define ECSUMINVAL	3
#define ETRANSFAIL	4

//Constants for Relays
#define RELAYALL	255
#define RELAY1		1
#define RELAY2		2
#define RELAY3		4
#define RELAY4		8
#define RELAY5		16
#define RELAY6		32
#define RELAY7		64
#define RELAY8		128

//Operations / Status
#define ACTIVE	  	0
#define DEACTIVE 	1
#define TOGGLE		2

int sndcmd(uchar cmd, uchar addr, uchar data, int fd);
int init(int *fd, char *port);
