// Start =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// General information section.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// $Author:yongkiang$ User who last changed the file
// $Date:1/2/2013 12:17:06 PM$ Date and time of last check in
// $Revision:1.0$ Visual SourceSafe version number
// $Workfile::   commondef.h                                           $ Filename
// End =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#if !defined __COMMONDEF_H__
#define __COMMONDEF_H__

#include "windef.h"

// common evt def
#define STOP_FLAG       "Stop Flag"
#define EOL_FLAG        "EOL Flag"
#define SYS_JOG_MODE    "System in Jog Mode"

#define     ON          1
#define     OFF         0
#define     ACTIVATE    1
#define     DEACTIVATE  0
#define     OPEN        0
#define     CLOSE       1
#define     HIGH        1
#define     LOW         0

const COLORREF WHITE       = RGB(255, 255, 255);
const COLORREF BLACK       = RGB(1, 1, 1);
const COLORREF BROWN       = RGB(128, 0, 0);
const COLORREF PINK        = RGB(255, 0, 255);
const COLORREF BLUE        = RGB(0, 0, 255);
const COLORREF DARKBLUE    = RGB(0, 0, 128);
const COLORREF LTBLUE      = RGB(40, 78, 255);
const COLORREF LIGHTBLUE   = RGB(200, 251, 252);
const COLORREF CLOUDBLUE   = RGB(172, 224, 250);
const COLORREF DIRTYBLUE   = RGB(0, 22, 128);
const COLORREF GRAY        = RGB(128, 128, 128);
const COLORREF LIGHTGRAY   = RGB(192, 192, 192);
const COLORREF DARKGRAY    = RGB(128, 128, 128);
const COLORREF MIDGRAY     = RGB(176, 176, 176);
const COLORREF LTGRAY      = RGB(210, 220, 220);
const COLORREF GREEN       = RGB(0, 255, 0);
const COLORREF LIGHTGREEN  = RGB(128, 255, 128);
const COLORREF DARKGREEN   = RGB(0, 128, 0);
const COLORREF DIRTYGREEN  = RGB(0, 200, 0);
const COLORREF YELLOW      = RGB(255, 255, 0);
const COLORREF LIGHTYELLOW = RGB(0xFF, 0xFF, 0xE0);
const COLORREF DARKYELLOW  = RGB(128, 128, 0);
const COLORREF RED         = RGB(200, 0, 0);
const COLORREF DARKRED     = RGB(128, 0, 0);
const COLORREF LTRED       = RGB(255, 115, 115);
const COLORREF CYAN        = RGB(0, 255, 255);
const COLORREF LTCYAN      = RGB(200, 255, 255);
const COLORREF DARKCYAN    = RGB(0, 128, 128);
const COLORREF MAGENTA     = RGB(255, 0, 255);
const COLORREF LTMAGENTA   = RGB(255, 128, 255);
const COLORREF DARKMAGENTA = RGB(128, 0, 128);
const COLORREF PURPLE      = RGB(138, 19, 126);
const COLORREF LTPURPLE    = RGB(231, 78, 216);

// SecsGem Text Color
const COLORREF RED_TEXT_COLOR   = RGB(255, 0, 0);
const COLORREF GREEN_TEXT_COLOR = RGB(0, 150, 0);

#define VK_A    0x41
#define VK_B    0x42
#define VK_C    0x43
#define VK_D    0x44
#define VK_E    0x45
#define VK_F    0x46
#define VK_G    0x47
#define VK_H    0x48
#define VK_I    0x49
#define VK_J    0x4A
#define VK_K    0x4B
#define VK_L    0x4C
#define VK_M    0x4D
#define VK_N    0x4E
#define VK_O    0x4F
#define VK_P    0x50
#define VK_Q    0x51
#define VK_R    0x52
#define VK_S    0x53
#define VK_T    0x54
#define VK_U    0x55
#define VK_V    0x56
#define VK_W    0x57
#define VK_X    0x58
#define VK_Y    0x59
#define VK_Z    0x5A

// security level
enum LOGIN_USER
{
    LOGIN_OPERATOR,
    LOGIN_TECHNICIAN,
    LOGIN_ENGINEER,
    LOGIN_SUPERUSER,
    LOGIN_MAX_USER_LEVEL,
};

// individual module's state
enum RunState {
    RS_BEGIN,
    RS_INITIALIZING,
    RS_INITIALIZED,
    RS_RUNNING,
    RS_STOP,
    RS_JAM,
    RS_END,
};

// whole machine's state
enum {
    MC_BEGIN,
    MC_INITIALIZING,
    MC_INITIALIZED,
    MC_RUNNING,
    MC_STOP_INIT,
    MC_STOP_RUN,
    MC_INIT_ERR,
    MC_RUN_JAM,
    MC_WARNING,
    MC_MAINTENANCE,
    NUM_MC_STATE,
    MC_STOPPING, // intermidiate state
};

enum COMMON_SWITCH
{
    SWITCH_START,
    SWITCH_STOP,
    SWITCH_RESET,
    SWITCH_DOOR,
    SWITCH_ESTOP,
    SWITCH_VACUUM,
    SWITCH_AIR,
    SWITCH_CURTAIN,
    SWITCH_ENGINEERING,
    // gary 24Jul09, add 10 customized switch
    SWITCH_CUSTOM1,
    SWITCH_CUSTOM2,
    SWITCH_CUSTOM3,
    SWITCH_CUSTOM4,
    SWITCH_CUSTOM5,
    SWITCH_CUSTOM6,
    SWITCH_CUSTOM7,
    SWITCH_CUSTOM8,
    SWITCH_CUSTOM9,
    SWITCH_CUSTOM10,
    SWITCH_SYSTEM,
    SWITCH_DOOR_LOCK,
};

enum COMMON_SYSTEM_OUTPUT
{
    OUTPUT_SYSTEM_DOOR,
    OUTPUT_CURTAIN_SENSOR_RESET,
};

enum COMMON_INDICATOR
{
    INDICATOR_START_BUTTON,
    INDICATOR_STOP_BUTTON,
    INDICATOR_RESET_BUTTON,
    INDICATOR_BUZZER,
    INDICATOR_RED,
    INDICATOR_AMBER,
    INDICATOR_GREEN,
};

enum EMS_INPUT
{
    EMS_STATUS,
};

enum EMS_OUTPUT
{
    EMS_COUNT,
};

// Follow the same order as in Resource.h
enum MainToolbarButton
{
    MainJobsButton,
    MainMaintenanceButton,
    MainRecipesButton,
    MainSetupButton,
    MainDatalogButton,
    MainAlarmButton,
    MainHelpButton,
    MainMaxButton,
    RunStart,
    RunStop,
    RunReset,
};

// report type used in Datalog Printing
enum REPORT_TYPE
{
    LOT_REPORT,
    MSG_REPORT,
    PKG_REPORT,
};
const CString MainToolbarButtonName[MainMaxButton] =
{
    "Jobs",
    "Maintenance",
    "Recipes",
    "Setup",
    "Datalog",
    "Alarm",
    "Help",
};

static const char *MAINT_COM_SETTINGS  = "Maintenance Com Settings";
static const char *MAINT_COM_BAUD_RATE = "Baud Rate";
static const char *MAINT_COM_DATA_BITS = "Data Bits";
static const char *MAINT_COM_PARITY    = "Parity";
static const char *MAINT_STOP_BITS     = "Stop Bits";
static const char *MAINT_FLOW_CTRL     = "Flow Control";
static const char *MAINT_COM_PORT      = "Com port";
static const char *MAINT_SEND_MSG      = "Send Msg";
static const char *MAINT_ACK_MSG       = "Ack Msg";

static const char *MAINT_SOCKET_SETTINGS = "Maintenance Socket Settings";
static const char *MAINT_IP_ADDRESS      = "IP Address";
static const char *MAINT_PORT_NUM        = "Port No";

#define ITEMHEIGHT          25

///////////////////////////////////////////////////////////
// Light and Buzzer Config
#define LightState(state)   (state == LIGHT_BLINK ? m_bBlink : \
                             (state == int(LIGHT_ON) ? ON : OFF))

#define     LIGHT_ON        1
#define     LIGHT_OFF       0
#define     LIGHT_BLINK     2

#define     LIGHT_RED       0
#define     LIGHT_AMBER     1
#define     LIGHT_GREEN     2
#define     LIGHT_BUZZER    3
// phyu add in 17June2013
enum E10_STATUS
{
    E10_PRODUCTIVE,
    E10_STANDBY,
    E10_ENGINEERING,
    E10_SCHEDULED_DOWN,
    E10_UNSCHEDULED_DOWN,
    E10_NONSCHEDULED,
    E10_MAX_STATUS,
};

// phyu add in 17June2013
enum MAINMODE
{
    NOMATERIAL_MODE,
    PRODUCTION_MODE,
    ENGINEERING_MODE,
    SCHEDULED_MODE,
    NON_SCHEDULED_MODE,
    MAINMODE_MAX,
};

#endif // !defined __COMMONDEF_H__
