/*
 * Command_defs.h
 *
 * Created: 8.3.2016 21:33:06
 *  Author: Chenda
 */ 


#ifndef COMMAND_DEFS_H_
#define COMMAND_DEFS_H_

#define NO_COMMAND				0
/* core commands */
#define CORE_IDN_QRY			1
#define CORE_STAT_CLR			2
#define CORE_RESET				3
/* SYSTem commands */
#define BEEP					16
#define ERROR_QRY				17
#define VER_QRY					18
#define LOC_CTRL				19
#define REM_CTRL				20
#define RW_LOCK					21
/* DISPlay commands */
#define DISP_STAT				32
#define DISP_STAT_QRY			33
#define DISP_TEXT				34
#define DISP_TEXT_QRY			35
#define DISP_CLR				36
/* INSTrument commands */
#define INST_SEL				48
#define INST_SEL_QRY			49
#define INST_CONN				50
#define INST_CONN_QRY			51
#define INST_SEL_PAR_QRY		52
/* SOURce commands */
#define SRC_IMM_CURR			64
#define SRC_IMM_CURR_QRY		65
#define SRC_IMM_VOLT			66
#define SRC_IMM_VOLT_QRY		67
/* MEASure commands */
#define MEAS_CURR_QRY			80
#define MEAS_VOLT_QRY			81
/* OUTput commands */
#define OUT_STAT				96
#define OUT_STAT_QRY			97
#define OUT_STAT_ALL			98

/* Non SCPI commands */
#define	NONSCPI_PING_QRY		128
#define	NONSCPI_ERROR_QRY		129		// not used

/* Internal - self commands */

#define CHECK_CONNECTED_DEV		225

/************************************************************************/
/* Command phases                                                       */
/************************************************************************/
#define DEF_CMD_START_PHASE			0
#define DEF_CMD_RESP_WAIT_PHASE		1
#define DEF_CMD_RESP_DONE_PHASE		2
#define DEF_CMD_SEND_WAIT_PHASE		3
#define DEF_CMD_SEND_DONE_PHASE		4
#define DEF_CMD_EXEC_PHASE_1		5
#define DEF_CMD_EXEC_PHASE_2		6
#define DEF_CMD_EXEC_PHASE_3		7
#define DEF_CMD_EXEC_PHASE_4		8

#define DEF_CMD_PASS_TO_TRG			250
#define DEF_CMD_PASS_WAIT_TRG_RESP	251
#define DEF_CMD_PASS_TO_SRC			252
#define DEF_CMD_SEND_NACK_TO_SRC	253
#define DEF_CMD_LAST_PHASE			255

/************************************************************************/
/* Application error number                                             */
/************************************************************************/
#define APP_E_NO_ERROR			0

// Communication errors
#define APP_E_RESP_TOUT			48
#define APP_E_U_MASB_RESP_NACK	49
#define APP_E_REC_UNEXP_DATA	50		// received unexpected slave data
#define APP_E_BAD_CMD_DATA_LEN	51


#define APP_E_DEVICE_NOT_FOUND	78

#define APP_E_INTERN			128
#define APP_E_DEVICE_BUSY		129
#define APP_E_UNKNOWN_CMD		130
#define APP_E_UNEXPECTED_RESP	131






#endif /* COMMAND_DEFS_H_ */