// error How to transfer lmc to lab pc
        public void loadLMC(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 3)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error    = new RunTimeError();
            string       fileName = System.IO.Path.GetFileName(stringRequestInfo.GetFirstParam());
            const String dirName  = "/RecviFile/";

            fileName = Environment.CurrentDirectory + dirName + fileName;
            if (!System.IO.File.Exists(fileName))
            {
                AppSession.sendNoNewLine(string.Format("Load LMC fail, The special LMC file: {0} is not exist on server local PC",
                                                       System.IO.Path.GetFileName(stringRequestInfo.GetFirstParam())));
                return;
            }
            string CpriPort  = getParameter(stringRequestInfo, 1);
            string IsRestart = getParameter(stringRequestInfo, 2);

            if (!tCAControl.loadLMC(error, fileName, CpriPort, IsRestart))
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
            }
        }
Ejemplo n.º 2
0
        private void tryEnterRuCommandsMode(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (!connectedfSMData.ruSerialPort.isOpen)
            {
                RunTimeError runTimeError = new RunTimeError();
                if ((stringRequestInfo.GetFirstParam().Length == 0 && connectedfSMData.comPortName == null) ||
                    !SerialPort.GetPortNames().ToList().Contains(connectedfSMData.comPortName))
                {
                    printHelp();
                    return;
                }
                else if (stringRequestInfo.GetFirstParam().Length > 0 && !connectedfSMData.ruSerialPort.openComport(stringRequestInfo.GetFirstParam(), runTimeError))
                {
                    AppSession.sendWithAppendPropmt(string.Format("open serial port:{0} fail: " + runTimeError.Errordescription, stringRequestInfo.GetFirstParam()));
                    return;
                }
                else if (stringRequestInfo.GetFirstParam().Length == 0 && SerialPort.GetPortNames().ToList().Contains(connectedfSMData.comPortName))
                {
                    if (!connectedfSMData.ruSerialPort.openComport(connectedfSMData.comPortName, runTimeError))
                    {
                        AppSession.sendWithAppendPropmt(string.Format("open serial port:{0} fail: " + runTimeError.Errordescription, connectedfSMData.comPortName));
                        return;
                    }
                }
                else if (stringRequestInfo.GetFirstParam().Equals("Portlist"))
                {
                    foreach (var item in RuSerialPort.getSerialPortList())
                    {
                        AppSession.Send(item);
                    }
                    AppSession.sendPropmt();
                    return;
                }
                this.connectedfSMData.elevator.Fire(Events.RuCommand);
            }
            this.connectedfSMData.elevator.Fire(Events.RuCommand);

            void printHelp()
            {
                AppSession.sendWithAppendPropmt("RuCommand [ Portlist | serial name[COM3]]");
            }
        }
        public void stopTCA(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            RunTimeError error = new RunTimeError();

            tCAControl.stopTCA(error);
            tCAIsOpen = false;
            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
                return;
            }
        }
        public void restartRuToSlot(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 3)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            if (!tCAControl.restartRuToSlot(error, getParameter(stringRequestInfo, 0), getParameter(stringRequestInfo, 1), getParameter(stringRequestInfo, 2)))
            {
                AppSession.sendWithAppendPropmt("restartRuToSlot fail " + error.Errordescription);
            }
        }
        public void DeleteAllCarriers(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 2)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            tCAControl.DeleteAllCarriers(error, getParameter(stringRequestInfo, 0), getParameter(stringRequestInfo, 1));
            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
            }
        }
        public void SetCPCfile(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 2)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            string[] paramMeter = stringRequestInfo.Parameters;
            tCAControl.SetCPCfile(error, paramMeter[0], paramMeter[1]);
            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
                return;
            }
        }
        public void CpcListFiles(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 1)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            string[] paramMeter = stringRequestInfo.Parameters;
            string   data       = tCAControl.CpcListFiles(error, paramMeter[0]);

            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
                return;
            }
        }
        public void CpriGetFsInfo_RX(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 2)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            string[] paramMeter = stringRequestInfo.Parameters;
            string   getdata    = tCAControl.CpriGetFsInfo_RX(error, paramMeter[0], paramMeter[1]);

            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
                return;
            }
            AppSession.sendNoNewLine(getdata);
        }
        public void getHwSn(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 0)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            string[] hwSn = tCAControl.getHwSn(error);
            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
                return;
            }
            foreach (var item in hwSn)
            {
                AppSession.Send(item);
            }
        }
Ejemplo n.º 10
0
        public void SetCarrierConfig(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 13)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            string[] paramMeter = stringRequestInfo.Parameters;
            tCAControl.SetCarrierConfig(error, paramMeter[0], paramMeter[1],
                                        paramMeter[2], paramMeter[3], paramMeter[4], paramMeter[5], paramMeter[6],
                                        paramMeter[7], paramMeter[8], paramMeter[9], paramMeter[10],
                                        paramMeter[11], paramMeter[12]);
            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
                return;
            }
        }
Ejemplo n.º 11
0
        public void IQFilesGetList(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
        {
            if (getParameterNumber(stringRequestInfo) != 1)
            {
                sendParameterError(AppSession);
                return;
            }
            RunTimeError error = new RunTimeError();

            string[] paramMeter = stringRequestInfo.Parameters;
            string[] data       = tCAControl.IQFilesGetList(error, paramMeter[0]);
            if (error.IsError)
            {
                AppSession.sendWithAppendPropmt(error.Errordescription);
                return;
            }
            foreach (var item in data)
            {
                AppSession.Send(item);
            }
        }
Ejemplo n.º 12
0
 private void startTCAProgramm(TelnetAppSession AppSession, StringRequestInfo stringRequestInfo)
 {
     if (!tCAIsOpen)
     {
         RunTimeError runTimeError = new RunTimeError();
         if (tslPath.Length == 0)
         {
             AppSession.sendNoNewLine("please set the Lab PC TCA(TSL.exe) path");
             return;
         }
         if (!TCAControler.startTCA(runTimeError, "localhost", tslPath))
         {
             AppSession.sendWithAppendPropmt("open TCA fail:" + runTimeError.Errordescription);
             tCAIsOpen = false;
             return;
         }
         tCAIsOpen = true;
     }
     else
     {
         AppSession.Send("TCA instance is started, not need start again!");
     }
 }
Ejemplo n.º 13
0
 private static void sendParameterError(TelnetAppSession AppSession)
 {
     AppSession.sendWithAppendPropmt("parameter number error");
 }