/* $Revision: 1.1 $ $Author: hjt $ $Date: 1997/04/20 23:00:30 $ */

/****************************************************************************
 *
 * PROJECT: Carnegie-Mellon Whatever
 *
 * MODULE: sick laser driver
 *
 * FILE: sickDefs.h
 *
 * DESCRIPTION:  constants for sick scanner
 *
 * EXPORTS:      
 *
 * NOTES:        
 *
 * REVISION HISTORY:
 * $Log: sickDefs.h,v $
 * Revision 1.1  1997/04/20 23:00:30  hjt
 * sick driver code initial checkin
 *
 * (c) Copyright 1994 Carnegie Mellon University. All rights reserved.
 ***************************************************************************/
#ifndef _sickDefs_h
#define _sickDefs_h

/*number of sick sensors we support*/
#define N_SICK (1)

/*messages from the scanner have the address offset by 0x80*/
#define SICK_OFFSET (0x80)
#define SICK_BCAST  (0x00)

/*status bit definitions*/
#define SICK_STATUS_MASK (0x07)
#define SICK_NO_ERROR (0x0)
#define SICK_INFO     (0x1)
#define SICK_WARN     (0x2)
#define SICK_ERROR    (0x3)
#define SICK_FATAL    (0x4)

/*reponse message status constants*/
#define RESP_ERROR_STATUS (0x00)
#define RESP_SUCCESS_STATUS (0x01)
#define RESP_CONFIRM_STATUS (0x02)

/*protocol constants*/
#define STX (0x02)
#define ACK (0x06)
#define DLE (0x10)
#define NAK (0x15)

/*telegrams from host to sensor*/
#define INIT_TGM (0x10)  /*reset and initialize the scanner*/

#define BM_TGM   (0x20)  /*select or change operating mode*/
#define PROTECT_MODE (0x00) /*mode code protect field setup*/
#define CALIB_MODE (0x01) /*calibration mode for PLS*/
#define RESET_PASSWD_MODE (0x02) /*reset password*/
#define DIAG_MODE (0x10) /*diagnostic mode*/
#define MONITOR_MODE0 (0x20) /*monitor mode w/ min. meas. values*/
#define MONITOR_MODE1 (0x21) /*monitor mode w/ meas. values for object in WF*/
#define MONITOR_MODE2 (0x22)
#define MONITOR_MODE3 (0x23)
#define MONITOR_MODE4 (0x24)
#define MONITOR_MODE5 (0x25)
#define SETUP_PASSWD_TST_MODE (0x30)
#define SUPER_PASSWD_TST_MODE (0x31)
#define MAINT_PASSWD_TST_MODE (0x32)
#define B38400_CONF_MODE (0x40)
#define B19200_CONF_MODE (0x41)
#define B9600_CONF_MODE (0x42)
#define B55555_CONF_MODE (0x43)
#define B111111_CONF_MODE (0x44)
#define B200000_CONF_MODE (0x45)
#define B250000_CONF_MODE (0x46)
#define B333333_CONF_MODE (0x47)

#define MWANF_TGM (0x30) /*measured value request*/
#define MIN_VALUE_PER_SEG_MODE (0x00) /*send minimum measured value per seg*/
#define ALL_VALUE_PER_SCAN_MODE (0x01)
#define MIN_VERT_DIST_MODE (0x02)
#define TAUGHT_DATA_MODE (0x03)
#define VERIF_DATA_MODE (0x04)
#define MIN_VALUE_PER_DEF_SEG_MODE (0x05)

#define SSANF_TGM (0x31) /*sensor status request*/
#define ERRANF_TGM (0x32) /*error telegram request*/
#define TSTANF_TGM (0x33) /*test in diagnostic request*/
#define MEMANF_TGM (0x34) /*memory dump in diagnostic mode request*/
#define MMWANF_TGM (0x36) /*averaged measured values request*/
#define MWPANF_TGM (0x37) /*measured value partial range request*/
#define BSFKFG_TGM (0x40) /*configure the bumper protection field*/

#define BSFCONF_TGM (0x41) /*confim the configured bumper protection field*/
#define BSF_NOTOK (0x00)
#define BSF_OK (0x01)
#define BSF_EOV (0x02) /*end of verification*/

#define PWCHG_TGM (0x42) /*change the password*/
#define NEW_PASSWD_STATUS (0x00) /*new password*/
#define CFRM_PASSWD_STATUS (0x01) /*confirm password*/
#define SICK_SERV_PW_TYPE (0x00) /*password for SICK service and customer*/
#define MAINT_PW_TYPE (0x01) /*maintenance password*/

#define KSFKFG_TGM (0x43) /*configure the collision protection field*/

#define WANL_TGM (0x44) /*define the start behavior*/
#define RESTART_BTN_MODE (0x00) /*restart after restart button hit (def)*/
#define N_SEC_MODE (0x01) /*restart after N seconds*/
#define RESTART_NDIS_MODE (0x02) /*restart not disabled*/

#define SFANF_TGM (0x45) /*configure protection field request*/
#define SAFE_FIELD_TYPE (0x00) /*safe protection field type*/
#define WARN_FIELD_TYPE (0x01) /*warning field type*/

#define LMOD_TGM (0x46) /*teach mode*/
#define START_TEACH_ACTION (0x00) /*start teach mode*/
#define TEACH_END_ACTION (0x01) /*regular teach mode end*/
#define TEACH_ABORT_ACTION (0x02) /*abort teach mode*/

#define WANLCFRM_TGM (0x47) /*configure the restart behavior*/

#define AGL_TGM (0x50) /*perform calibration*/
#define REF_MEAS_CAL_MODE (0x00) /*reference measurement calibration*/
#define DIRT_EVAL_CAL_MODE (0x01) /*dirt evaluation calibration*/
#define PROD_CODE_ENTER_MODE (0x02) /*enter production code*/

#define ANLDEF_TGM (0x60) /*define startup test*/
#define NO_STARTUP_TEST_MODE (0x00) /*no startup test*/
#define STARTUP_TEST_MODE (0x01) /*startup test*/

#define ANLCFRM_TGM (0x61) /*confirm the startup test definition*/

#define OUTPUTDEF_TGM (0x62) /*define the third switching output*/
#define WF_VIO_DIRT_MODE (0x00) /*output switches both with dirt and WF viol.*/
#define WF_VIO_ONLY_MODE (0x01) /*output switch only with SF viol.*/
#define DIRT_MODE (0x02) /*output switches with dirt or error*/

#define RSPTIMEDEF_TGM (0x63) /*define the number of multiple evaluations*/

#define RSPTIMECFRM_TGM (0x64) /*confirm multiple evaluations definitions*/

#define WSFTYPDEF_TGM (0x65) /*define the WF type*/
#define WF_VOLATILE_TYPE (0x00) /*WF present in volatile storage*/
#define WF_NON_VOLATILE_TYPE (0x01) /*wf present in non-volatile storage*/

#define BRPPERMDEF_TGM (0x66) /*define the permanent baud rate for power on*/
#define PWR_ON_B9600 (0x00) /*power on baud rate is 9600*/
#define PWR_ON_BCONF (0x01) /*configured baud rate set after power-on*/

#define ADRDEF_TGM (0x67) /*define the sensor address*/

/*telegrams from sensor to host*/
#define PON_TGM (0x90) /*message after power on*/
#define INIT_ACK_TGM (0x91) /*confirm the software reset telegram*/
#define NACK_TGM (0x92) /*not acknowledge telegram*/

#define BMACK_TGM (0xa0) /*response to operating mode change*/
#define SUCCESS_STATUS (0x00) /*mode change successful*/
#define FAIL_PW_STATUS (0x01) /*passwd incorrect*/
#define FAIL_SENSOR_FAULT_STATUS (0x02) /*sensor fault*/

#define MW_TGM (0xb0) /*response to measuremed value request*/

#define SS_TGM (0xb1) /*response to sensor status*/

#define ERR_TGM (0xb2) /*error message/test message*/

#define MEMRD_TGM (0xb4) /*memory dump*/

#define MMW_TGM (0xb6) /*measurement averaged values*/
#define MWP_TGM (0xb7) /*measurement, measure value partial range*/

#define BSFACK_TGM (0xc0) /*response to SW configuration*/
#define BSF_RECT_SF_MODE (0x00) /*rectangular SF*/
#define BSF_RADIAL_SF_MODE (0x01) /*radial SF*/
#define BSF_SEGMENT_SF_MODE (0x02) /*segmented SF*/

#define BSFCFRM_TGM (0xc1) /*response to SF confirmation*/
#define BSF_VERIF_ACTIVE_STATUS (0x03) /*verification is active*/
#define BSF_BAD_FIELD_STATUS (0x04)

#define PWACK_TGM (0xc2) /*confirm to new password*/
#define KSFACK_TGM (0xc3) /*response to WF configuration*/

#define WANLACK_TGM (0xc4) /*response to restart definition*/

#define SFDAT_TGM (0xc5) /*configure data for protection fields*/

#define LMODACK_TGM (0xc6) /*response in teach mode*/
#define AGLACK_TGM (0xd0) /*response to performance of calibration*/

#define ANLACK_TGM (0xe0) /*response to startup test definition*/
#define OUTPUTACK_TGM (0xe2) /*response to initial definition*/
#define RSPTIMEACK_TGM (0xe4) /*response to WF definition*/
#define WSFTYPACK_TGM (0xe5) /*response to WF type definition*/
#define BRPERMACK_TGM (0xe6) /*response to perm. baud rate definition*/
#define ADRACK_TGM (0xe7) /*response to sensor address definition*/

#endif /*_sickDefs_h*/
