Beispiel #1
0
        /// <summary>
        /// 开启由对应开关组的串口指令指定的开关
        /// </summary>
        /// <param name="switchNum">要写入的byte[]数组</param>
        /// <param name="errMsg">异常信息</param>
        /// <returns></returns>
        public bool Open(byte[] switchNum, ref string errMsg)
        {
            byte[] writeBytes = SwitchUtil.GetMcuFormatBytes(switchNum);
            SpConnect();
            ErrMsg ret = WriteData(writeBytes);

            errMsg = ret.Msg;
            return(ret.Result);
        }
Beispiel #2
0
        /// <summary>
        /// 开启开关矩阵配置中的指定行或列的开关,由构造函数来决定打开一行或一列
        /// </summary>
        /// <param name="switchIndex">行/列索引</param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public bool Open(int switchIndex, ref string errMsg)
        {
            // CloseAll(ref errMsg);
            byte[] writeBytes = SwitchUtil.GetMcuFormatBytes(this._switchArrays, switchIndex);
            SpConnect();
            ErrMsg ret = WriteData(writeBytes);

            errMsg = ret.Msg;
            return(ret.Result);
        }
Beispiel #3
0
        /// <summary>
        /// 开启由对应开关组的串口指令指定的开关
        /// </summary>
        /// <param name="switchNum">要写入的byte[]数组</param>
        /// <param name="errMsg">异常信息</param>
        /// <returns></returns>
        public bool Open(byte[] switchNum, ref string errMsg)
        {
            byte[] writeBytes = SwitchUtil.GetMcuFormatBytes(switchNum);
            ErrMsg retErrMsg  = VisaSerial.WriteData(writeBytes, _visaAddress);

            errMsg = retErrMsg.Msg + retErrMsg.ErrorCode;
            if (retErrMsg.Result)
            {
                Thread.Sleep(_responseTime);
            }
            return(retErrMsg.Result);
        }
Beispiel #4
0
        /// <summary>
        /// 开启开关矩阵配置中的指定行或列的开关,由构造函数来决定打开一行或一列
        /// </summary>
        /// <param name="switchIndex">行/列索引</param>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public bool Open(int switchIndex, ref string errMsg)
        {
            // CloseAll(ref errMsg);
            byte[] writeBytes = SwitchUtil.GetMcuFormatBytes(this._switchArrays, switchIndex);
            ErrMsg retErrMsg  = VisaSerial.WriteData(writeBytes, _visaAddress);

            errMsg = retErrMsg.Msg + retErrMsg.ErrorCode;
            if (retErrMsg.Result)
            {
                Thread.Sleep(_responseTime);
            }
            return(retErrMsg.Result);
        }