#ifndef COMMANDS_DEFINED
#define COMMANDS_DEFINED	7F04

//  General command parser
//  The commands which the parser understands are defined by a structure
//  which is inited in the commands.c file.  Those commands are defined
//  below.  The parse routine looks for a string which matches the prototype,
//  then calls a routine using a pointer from the structure array to actually
//  implement the command.  All implmentations are defined to take a character
//  pointer to any remaining arguments (even if there are none) and to return
//  an integer.  If the returned integer is negative, there was an error, and
//  the error message has already been printed; 0, all went OK; positive, there
//  was an error and the returned number should be used as an index into the
//  error string array defined in commands.c
int command_parse (char* string);

//	general system commands
#define		NOOP						0
#define		CMD_HELP					1
#define		CMD_QUIT					2
#define		CMD_SUSPEND_LOGGER			3
#define		CMD_START_LOGGER			4
#define		CMD_SHOW_SETUP_DATA			5
#define		CMD_SAVE_SETUP				6
#define		CMD_TEST					7
#define		CMD_SENSOR_POWER			8
#define		CMD_PRINT_VERSION			9
#define		CMD_SHOW_STATUS				10
#define		CMD_SET_CLOCK				50
int cmd_help (char* args);
int cmd_quit (char* args);
int cmd_show_setup_data (char* args);
int cmd_suspend_logger (char* args);
int cmd_start_logger (char* args);
int cmd_save_setup (char* args);
int cmd_test (char* args);
int cmd_sensor_power (char* args);
int cmd_print_version (char* args);
int cmd_show_status (char* args);
int cmd_set_clock (char* args);


//  commands which control the science data logger
#define		CMD_SET_SCIENCE_GAIN		101
#define		CMD_SET_SCIENCE_RATE		102
#define		CMD_SET_STA_TIME			103
#define		CMD_SET_LTA_TIME			104
#define		CMD_SET_TRIGGER_LEVEL		105
#define		CMD_READ_SCIENCE			106
#define		CMD_SET_SCIENCE_CHANNELS	107
#define		CMD_SET_PRE_EVENT_TIME		108
#define		CMD_SET_POST_EVENT_TIME     109
#define		CMD_READ_BINARY_SCIENCE		110
#define		CMD_SET_SCIENCE_AVERAGING	111
int cmd_set_science_gain (char* args);
int cmd_set_science_rate (char* args);
int cmd_set_STA_time (char* args);
int cmd_set_LTA_time (char* args);
int cmd_set_trigger_level (char* args);
int cmd_set_pre_event_time (char* args);
int cmd_set_post_event_time (char* args);
int cmd_read_science (char* args);
int cmd_set_science_channels (char* args);
int cmd_suspend_science (char* args);
int cmd_read_binary_science (char* args);
int cmd_set_science_averaging (char* args);

//  commands which control the engineering data logger
#define		CMD_SET_ENGINEERING_RATE	201
#define		CMD_READ_ENGINEERING		202
int cmd_set_eng_rate (char* args);
int cmd_read_eng (char* args);

//  commands which set/get the time
#define		CMD_SET_TIME				301
#define		CMD_SYNC_SET_TIME			302
#define		CMD_PRINT_TIME				303
#define		CMD_SYNC_PRINT_TIME			304
#define		CMD_SYNC_PRINT_TIME_ERROR	305
int cmd_set_time (char* args);
int cmd_sync_set_time (char* args);
int cmd_print_time (char* args);
int cmd_sync_print_time (char* args);
int cmd_sync_print_time_error (char* args);


//  commands which interact with the disk
#define		CMD_DISK_DIR				401
#define		CMD_DISK_PRINT				402
#define		CMD_DISK_CD					403
#define		CMD_DISK_PWD				404
int cmd_disk_dir (char* args);
int cmd_disk_print (char* args);
int cmd_disk_cd (char* args);
int cmd_disk_pwd (char* args);


//  These values must match up with the character array defined in
//  the commands.c file.
#define		OK						0
#define		ILLEGAL_CHANNEL_NUMBER	1
#define		ILLEGAL_GAIN			2
#define		BAD_SYNTAX				3
#define		ILLEGAL_TIME			4
#define		ILLEGAL_RATE			5
#define		OUT_OF_MEMORY			6
#define		ILLEGAL_TRIGGER			7
#define		ILLEGAL_AVERAGING		8

extern char* science_error_msgs[32];


#define		CHAR_BACKSPACE		0x08

#endif
