예제 #1
0
 public bool SetDevices(string CommPort, ref SL_Comm_Util Comm, string IntruAddr)
 {
     this.CommAddr   = CommPort;
     this.ElecsComm  = Comm;
     this.InstruAddr = IntruAddr;
     return(true);
 }
예제 #2
0
        public bool ComSetting(string CommAddr, ref SL_Comm_Util Comm)
        {
            bool ret = false;

            ElecsComm = new SL_Comm_Util(CommAddr, "115200", "8", "None", "1");
            if (ElecsComm.CommOpen())
            {
                Comm = ElecsComm; ret = true;
            }
            return(ret);
        }
예제 #3
0
 public bool Open(string CommAddr, string Baudrate, string Parity, string DataBit, string StopBit)
 {
     ElecsComm = new SL_Comm_Util(CommAddr, Baudrate, DataBit, Parity, StopBit);
     if (ElecsComm.CommOpen())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #4
0
 public bool Open(string CommAddr)
 {
     ElecsComm = new SL_Comm_Util(CommAddr, "115200", "8", "None", "1");  //20170724
     if (ElecsComm.CommOpen())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #5
0
        private bool DealWithSystem(string SystemCmd, byte ElecsType, ref string RdStr)
        {
            int Times = 0;

            if (ElecsType == (byte)CmdType.Write)
            {
                string[] Parameter = SystemCmd.Split(DelimiterChars);
                if (ElecsComm != null && Parameter[0].CompareTo("elecs.close") == 0)
                {
                    ElecsComm.CommClose(); ElecsComm = null;
                }
                if (Parameter[0].CompareTo("system") == 0)
                {
                    RdStr = SystemInfo();
                }
                if (Parameter[0].CompareTo("pause") == 0)
                {
                    RdStr = "Pause";
                }
                if (Parameter[0].CompareTo("sleep") == 0)
                {
                    if (Parameter.Length > 1 && int.TryParse(Parameter[1], out Times))
                    {
                        Thread.Sleep(Times);
                    }
                }
                if (Parameter[0].CompareTo("load") == 0)
                {
                    if (Parameter.Length > 1)
                    {
                        ExeScriptFile(Parameter[1], ref RdStr);
                    }
                }
            }
            return(true);
        }
예제 #6
0
 public bool Close()
 {
     ElecsComm.CommClose();
     ElecsComm = null;
     return(true);
 }
예제 #7
0
 public bool SetCommDevice(ref SL_Comm_Util Comm)
 {
     this.ElecsComm = Comm;
     return(true);
 }