Exemplo n.º 1
0
        //20090318 志忠~~觸發Timer
        private void TKMSGTIMER_Tick(object sender, EventArgs e)
        {
            int iSDDEStatus = 0;

            //20090318 志忠~~取得MMI和TK的連線狀態
            iSDDEStatus = SDDE.GetSingleton().GetSDDEStatus();

            if (iSDDEStatus != 1)
            {
                //20090318 志忠~~MMI和TK連線
                SDDE.GetSingleton().Connect();
            }

            //20090318 志忠~~用來接收TK傳過來的Message
            StringBuilder szReturnChar = new StringBuilder();

            while (SDDE.GetSingleton().GetMessageFromTK(szReturnChar) == 0)
            {
                if (szReturnChar[0] == 'A' && szReturnChar[1] == '0' && szReturnChar[2] == '2' && szReturnChar[3] == '3')
                {
                    //發Alarm Message
                    Common.GlobalValue.AlarmQueue.Enqueue(szReturnChar.ToString());
                }
                else if (szReturnChar[0] == 'R' || szReturnChar[0] == 'E' || szReturnChar[0] == 'A' || szReturnChar[0] == 'X')
                {
                    //20090323 志忠~~呼叫比對DearErrorCode的函式
                    InitDearErrorCode.strcmpDearErrorCode(szReturnChar);
                }
                else
                {
                    //發Alarm Message
                    Common.GlobalValue.AlarmQueue.Enqueue(szReturnChar.ToString());
                }
            }
        }
Exemplo n.º 2
0
        // 設定目前警示狀態, Running, Alarm, Error......
        public int TowerSet_ChangeSignal(int p_iStatus)
        {
            int iOldStatus = -1;
            int iNewStatus = -1;

            string strNewCmd;

            m_iTowerStatus = p_iStatus;

            switch (m_iTowerStatus)
            {
            case _TOWER_STATUS_DEFAULT_:
            case _TOWER_STATUS_RUNNING_:
                g_objCurrentSignalTable = g_objSignalMode[p_iStatus].objSignalTable;
                if (iNewStatus != p_iStatus)
                {
                    iOldStatus = iNewStatus;
                    iNewStatus = p_iStatus;
                }
                break;

            case _TOWER_STATUS_ALARM_:
            case _TOWER_STATUS_DOWN_:
            case _TOWER_STATUS_MAINTENANCE_:
            case _TOWER_STATUS_IDLE_:
            case _TOWER_STATUS_MANUAL_:
            case _TOWER_STATUS_HOST_OFF_:
            case _TOWER_STATUS_LOCAL_IN_:
            case _TOWER_STATUS_PREPARATION_:
                g_objCurrentSignalTable = g_objSignalMode[p_iStatus].objSignalTable;
                break;

            case _TOWER_STATUS_PREVIOUS_:
                g_objCurrentSignalTable = g_objSignalMode[iNewStatus].objSignalTable;
                break;

            default:
                g_objCurrentSignalTable = g_objSignalMode[_TOWER_STATUS_DOWN_].objSignalTable;
                break;
            }

            strNewCmd = "C998," + g_objCurrentSignalTable.aiType[_TOWER_OBJ_BUZZER1_] + ","
                        + g_objCurrentSignalTable.aiType[_TOWER_OBJ_BUZZER2_] + ","
                        + g_objCurrentSignalTable.aiType[_TOWER_OBJ_RED_] + ","
                        + g_objCurrentSignalTable.aiType[_TOWER_OBJ_YELLOW_] + ","
                        + g_objCurrentSignalTable.aiType[_TOWER_OBJ_GREEN_] + ","
                        + g_objCurrentSignalTable.aiType[_TOWER_OBJ_BLUE_] + ","
                        + g_objCurrentSignalTable.aiType[_TOWER_OBJ_OP1_];

            // 避免重複送出相同訊息,雖然it is OK.
            if (g_strOldCmd == null || g_strOldCmd.CompareTo(strNewCmd) != 0)
            {
                SDDE.GetSingleton().SendMessageToTK(strNewCmd);
                g_strOldCmd = strNewCmd;
            }

            return(0);
        }
Exemplo n.º 3
0
        private void DDEMsg_Click(object sender, EventArgs e)
        {
            //int a;
            //StringBuilder pBuffer = new StringBuilder();
            //SDDE.GetSingleton().createObject();
            SDDE.GetSingleton().SDDE_Display();

            //SDDE.GetSingleton().GetMessageFromTK(pBuffer);
            //20090318 志忠~~MMI和TK連線
            //SDDE.GetSingleton().Connect();

            //a = SDDE.GetSingleton().GetSDDEStatus();
        }
Exemplo n.º 4
0
        private void LensRadioButton_Click(object sender, EventArgs e)
        {
            if (m_Info._08_LensEnable)
            {
                RadioButton ClickButton = (RadioButton)sender;
                //if (Common.CTAPSetup.EnableTK)
                {
                    for (int iCount = 0; iCount < m_Info._00_LensCount; iCount++)
                    {
                        if (m_aiLenControl[iCount] == ClickButton)
                        {
                            switch (m_Info._03_LensTriggerType)
                            {
                            case enumLensTriggerType.DIO:
                                //TK.CCTKform.TK_DIO.CCDioModule_SetDO(m_Info._04_LensTriggerDIO[iCount], m_Info._06_LensTriggerIOValue[iCount]);
                                break;

                            case enumLensTriggerType.VIO:
                                //TK.CCTKform.TK_VIO.CCVioModule_SetVIO(m_Info._05_LensTriggerVIO[iCount], m_Info._06_LensTriggerIOValue[iCount]);
                                break;

                            case enumLensTriggerType.Command:
                                SDDE.GetSingleton().SendMessageToTK(m_Info._07_LensTriggerCmd[iCount].ToString());
                                break;
                            }

                            // ¬ö¿ý Len ½s¸¹
                            Common.GlobalValue.Lens = iCount;

                            // ¸ÉÀv Len ¤Á´«¶ZÂ÷
                            int[] aiOffset = { 0, 0, 0 };
                            Common.GlobalValue.GetLensOffset(ref aiOffset[0], ref aiOffset[1], ref aiOffset[2]);
                            SDDE.GetSingleton().SendMessageToTK(string.Format("C401,{0:d},{1:d},{1:d},1000,300,300,0", aiOffset[0], aiOffset[1]));

                            // ³]©wZ¶b¦ì¸m
                            ContrelModule.ZMotion.ZMAbsMove((double)aiOffset[2]);
                        }
                    }
                }
            }
        }