示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cid"></param>
        /// <returns></returns>
        public VsmdInfo createVsmdInfo(int cid)
        {
            VsmdInfo vsmdInfo = new VsmdInfo(cid);

            vsmdInfo.comPort = this.comPort;
            this.objList.Add(vsmdInfo);
            return(vsmdInfo);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        private void serialPortSendProcess()
        {
            int      index    = 0;
            VsmdInfo vsmdInfo = (VsmdInfo)null;

            while (this.isSerialPortThreadRunning)
            {
                if (this.objList.Count > 0 && !this.flgResWaiting)
                {
                    string str = (string)null;
                    if (this.objList[index].isOnline)
                    {
                        str = this.objList[index].sendCmdProcess();
                    }
                    if (str != null && this.comPort.IsOpen)
                    {
                        this.curCommand = str;
                        this.retryCnt   = 0;
                        vsmdInfo        = this.objList[index];
                        this.waitResTimer.start(500000L);
                        this.flgResWaiting = true;
                        this.comPort.Write(this.curCommand);
                    }
                    ++index;
                    if (index >= this.objList.Count)
                    {
                        index = 0;
                    }
                }
                else if (this.flgResWaiting && this.waitResTimer.isTimeout())
                {
                    ++this.retryCnt;
                    if (this.retryCnt >= 3)
                    {
                        this.flgResWaiting = false;
                        this.retryCnt      = 0;
                        vsmdInfo.isOnline  = false;
                    }
                    else
                    {
                        this.comPort.Write(this.curCommand);
                    }
                }
                Thread.Sleep(0);
            }
        }
示例#3
0
 /// <summary>remove VsmdInfo object</summary>
 /// <param name="info"></param>
 public void removeVsmdInfo(VsmdInfo info)
 {
     this.objList.Remove(info);
 }