/****************************************************************************/
/* Copyright 1991 - 2003 MBARI												*/
/****************************************************************************/
/* Summary	: User command definitions for OASIS3 mooring controller		*/
/* Filename : usrcmds.h														*/
/* Author	: Robert Herlien (rah)											*/
/* Project	: OASIS3 Mooring												*/
/* $Revision: 1.1 $															*/
/* Created	: 02/03/2003 rah												*/
/*																			*/
/* MBARI provides this documentation and code "as is", with no warranty,	*/
/* express or implied, of its quality or consistency. It is provided without*/
/* support and without obligation on the part of the Monterey Bay Aquarium	*/
/* Research Institute to assist in its use, correction, modification, or	*/
/* enhancement. This information should not be published or distributed to	*/
/* third parties without specific written permission from MBARI.			*/
/*																			*/
/****************************************************************************/
/* Modification History:													*/
/* 03feb2003 rah - created from OASIS usrcmds.h								*/
/****************************************************************************/

#ifndef INCusrcmdsh
#define INCusrcmdsh		1

#define NPARMS	4				/* Max number of parms for user function*/

typedef struct					/****************************************/
{								/* Structure for function table			*/
  char	*fe_cs;					/* Command string						*/
  char	*fe_info;				/* Information for help screen			*/
  Int16 (*fe_cmd)();			/* Pointer to function to impl. command */
  Nat16 fe_parmtype[NPARMS];	/* Parameter types						*/
} FuncEntry;					/****************************************/
								/* Parameter types						*/
#define NOPARM	0				/* No corresponding parameter			*/
#define STRING	1				/* String, until next delimiter			*/
#define ALL		2				/* Parameter is rest command string		*/
#define DEC		3				/* Number, default radix is decimal		*/
#define HEX		4				/* Number, default radix is hexadecimal */
								/****************************************/

typedef enum					/****************************************/
{								/* Protocol to use for telemetry		*/
	TELEM_UUENCODE = 0,			/* Send in UUencode format				*/
	TELEM_ASCII,				/* Send ASCII							*/
	TELEM_BINARY				/* Send binary data						*/
} TelemType;					/****************************************/

#define MAX_RECS		30

typedef struct func_node FuncNode; /* One node in function linked list	*/

struct func_node				/****************************************/
{								/* Structure for function table			*/
  FuncNode		*func_next;		/* For linked list						*/
  FuncNode		*func_prev;		/* For linked list						*/
  char			*fn_cs;			/* Command string						*/
  char			*fn_info;		/* Information for help screen			*/
  Int16			(*fn_cmd)();	/* Pointer to function to impl. command */
  Nat16			fn_parmtype[NPARMS]; /* Parameter types					*/
};								/****************************************/

#define FN_NULL ((FuncNode *)0)


/****************************************/
/* Function Declarations				*/
/****************************************/

Int16	analog(Nat16 pmask, Parm_t port);
Int16	quit(Void);
//Int16 reset(Nat16 pmask, char *s);
Int16	reset(Nat16 pmask, char *s, char *unused1, char *unused2,
			  char *unused3, char *cmdline);
Int16	usr_power(Nat16, Parm_t);
Errno	usrSemWait(SemID sem);
Int16	connect(Nat16, char *, Parm_t, Parm_t, Parm_t, Byte *);
Int16	usr_time(Nat16 pmask, char *s);
Int16	tnc_cmd(Nat16, char *, Parm_t, Parm_t, Parm_t, Byte *);
Int16	display(Nat16, Parm_t, Parm_t);
Int16	set(Nat16, Byte *);
Int16	getlog(Nat16 pmask, Parm_t, Parm_t);
Int16	getylog(Nat16 pmask, Parm_t, Parm_t);
Int16	dump(Nat16, Parm_t, Parm_t);
Int16	checkLog(Nat16 pmask, Parm_t blk, Parm_t nblks);
Int16	getdata(Nat16 pmask, Parm_t maxRecs);
Int16	getydata(Nat16 pmask, Parm_t maxRecs);
Int16	getlognmbrs(Void);
Void	initUsrLog(LogRecNum firstRcd);
Int16	aux(Nat16, char *, Parm_t, Parm_t);
Int16	init(Nat16, char *, Parm_t, Parm_t);
Int16	sync(Nat16, char *, Parm_t, Parm_t);
MBool	getparm(Nat32 *result, Nat16 radix, Byte *buffer);
Int16	drvparms(Nat16, char *, Parm_t, Parm_t, Parm_t, Byte *);
Int16	drvadd(Nat16, char *, char *, Parm_t, Parm_t, Byte *);
Int16	drvdel(Nat16, char *);
Int16	sample(Nat16, char *);
Int16	lsample(Nat16, char *);
Int16	usrKill(Nat16, char *);
Int16	checkStack(Void);
Int16	version(Nat16 pmask, char *arg);
Int16	usrWakeBits(Nat16 pmask, Parm_t bits);
Int16	usrGetnum(Nat16 pmask, Parm_t radix, char *s);
Int16	usrSysLog(Nat16 pmask, char *fmt, Parm_t parm1,
				  Parm_t parm2, Parm_t parm3);
#ifdef TNC
Int16	radiomsg(Nat16, char *);
#endif

#endif /* INCusrcmdsh */
