Exemplo 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;
 }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="usbParam"></param>
 /// <param name="rxCRC"></param>
 /// <param name="tcCRC"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public virtual int Init(CUSBPortParam usbParam, CCOMM_CRC rxCRC, CCOMM_CRC txCRC, RichTextBox msg = null)
 {
     return(-1);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 初始化USB参数
 /// </summary>
 /// <param name="uSBParam"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public virtual int Init(CUSBPortParam usbParam, RichTextBox msg = null)
 {
     return(-1);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 打开指定参数的USB端口
 /// </summary>
 /// <param name="argSerialParam"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public virtual int OpenDevice(CUSBPortParam argUSBParam, RichTextBox msg = null)
 {
     return(-1);
 }
Exemplo n.º 6
0
 /// <summary>
 /// 初始化USB参数
 /// </summary>
 /// <param name="uSBParam"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public override int Init(CUSBPortParam uSBParam, RichTextBox msg = null)
 {
     return(-1);
 }