Esempio n. 1
0
 /// <summary>
 /// 分析参数
 /// </summary>
 /// <param name="serialParam"></param>
 /// <param name="uSBParam"></param>
 public virtual void AnalyseParam(int perPackageSize, CSerialPortParam serialParam, CUSBPortParam usbParam, CCOMM_CRC rxCRC, CCOMM_CRC txCRC, bool isUpAddrID = false)
 {
     if ((serialParam != null) && (this.mSerialPortParam != null))
     {
         this.mSerialPortParam.mName     = serialParam.mName;
         this.mSerialPortParam.mBaudRate = serialParam.mBaudRate;
         this.mSerialPortParam.mStopBits = serialParam.mStopBits;
         this.mSerialPortParam.mDataBits = serialParam.mDataBits;
         this.mSerialPortParam.mParity   = serialParam.mParity;
         //---是否需要更新ID
         if ((isUpAddrID) && (this.mSerialPortParam.mAddrID != serialParam.mAddrID))
         {
             this.mSerialPortParam.mAddrID = serialParam.mAddrID;
         }
         this.mCOMMName = this.mSerialPortParam.mName;
     }
     if ((usbParam != null) && (this.mUSBPortParam != null))
     {
         this.mUSBPortParam.mVID = mUSBPortParam.mVID;
         this.mUSBPortParam.mPID = mUSBPortParam.mPID;
     }
     //---发送数据校验方式
     this.mSendData.mCRCMode = txCRC;
     //---接收数据校验方式
     this.mReceData.mCRCMode = rxCRC;
     this.mPerPackageMaxSize = perPackageSize;
 }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="argSerialParam"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public override int OpenDevice(CSerialPortParam argSerialParam, RichTextBox msg = null)
 {
     if (argSerialParam != null)
     {
         if (this.defaultSerialPortParam == null)
         {
             this.defaultSerialPortParam = new CSerialPortParam();
         }
         this.mCOMMName = argSerialParam.mName;
         this.defaultSerialPortParam.mBaudRate = argSerialParam.mBaudRate;
         this.defaultSerialPortParam.mParity   = argSerialParam.mParity;
         this.defaultSerialPortParam.mDataBits = argSerialParam.mDataBits;
         this.defaultSerialPortParam.mStopBits = argSerialParam.mStopBits;
         this.defaultSerialPortParam.mAddrID   = argSerialParam.mAddrID;
         return(this.OpenDevice(this.mCOMMName, msg));
     }
     else
     {
         return(-1);
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 分析参数
        /// </summary>
        /// <param name="serialParam"></param>
        /// <param name="uSBParam"></param>
        public virtual void  AnalyseParam(int perPackageSize, CSerialPortParam serialParam, CUSBPortParam usbParam, bool isUpAddrID = false)
        {
            if ((serialParam != null) && (this.mSerialPortParam != null))
            {
                this.mSerialPortParam.mName     = serialParam.mName;
                this.mSerialPortParam.mBaudRate = serialParam.mBaudRate;
                this.mSerialPortParam.mStopBits = serialParam.mStopBits;
                this.mSerialPortParam.mDataBits = serialParam.mDataBits;
                this.mSerialPortParam.mParity   = serialParam.mParity;
                //---是否需要更新ID
                if (isUpAddrID)
                {
                    this.mSerialPortParam.mAddrID = serialParam.mAddrID;
                }

                this.mCOMMName = this.mSerialPortParam.mName;
            }
            if ((usbParam != null) && (this.mUSBPortParam != null))
            {
                this.mUSBPortParam.mVID = mUSBPortParam.mVID;
                this.mUSBPortParam.mPID = mUSBPortParam.mPID;
            }
            this.mPerPackageMaxSize = perPackageSize;
        }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="serialParam"></param>
 /// <param name="rxCRC"></param>
 /// <param name="tcCRC"></param>
 /// <param name="msg"></param>
 public override int Init(CSerialPortParam serialParam, CCOMM_CRC rxCRC, CCOMM_CRC txCRC, RichTextBox msg = null)
 {
     return(-1);
 }
Esempio n. 5
0
 /// <summary>
 /// 初始化串口参数
 /// </summary>
 /// <param name="serialParam"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public override int Init(CSerialPortParam serialParam, RichTextBox msg = null)
 {
     return(-1);
 }
Esempio n. 6
0
 /// <summary>
 /// 初始化串口参数
 /// </summary>
 /// <param name="serialParam"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public virtual int Init(CSerialPortParam serialParam, RichTextBox msg = null)
 {
     return(-1);
 }
Esempio n. 7
0
 /// <summary>
 /// 打开指定参数的串行端口
 /// </summary>
 /// <param name="argSerialParam"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public virtual int OpenDevice(CSerialPortParam argSerialParam, RichTextBox msg = null)
 {
     return(-1);
 }