Esempio n. 1
0
 /// <summary>
 /// If a derived class overrides ComSettings(), it must call this prior to returning the settings to
 /// the base class.
 /// </summary>
 /// <param name="s">Class containing the appropriate settings.</param>
 protected void Setup(CommLineSettings s)
 {
     RxBuffer     = new byte[s.rxStringBufferSize];
     RxTerm       = s.rxTerminator;
     RxFilter     = s.rxFilter;
     TransTimeout = (uint)s.transactTimeout;
     TxTerm       = s.txTerminator;
 }
        public MagellanProtoPhysicalLayer()
        {
            settings = new CommLineSettings();
            settings.rxStringBufferSize = 1024;
            settings.transactTimeout    = (int)transactTimeout;                                 // (ms)
            settings.rxTerminator       = ASCII.LF;

            Setup(settings);                    // we use only line-related portion of settings here
            log("MagellanProtoPhysicalLayer() buffer=" + RxBuffer.Length + " timeout=" + transactTimeout);
            base.Open();
        }
Esempio n. 3
0
 public CommPort(string portName, int baudRate, OnReceiveCallback onReceive, OnOpenCallback onOpen)
 {
     this.onReceive    = onReceive;
     this.onOpen       = onOpen;
     this.commSettings = new CommLineSettings()
     {
         port         = portName,
         baudRate     = baudRate,
         rxTerminator = ASCII.LF,
         txTerminator = new ASCII[1] {
             ASCII.LF
         },
     };
     this.Setup(this.commSettings);
 }
Esempio n. 4
0
 /// <summary>
 /// If a derived class overrides ComSettings(), it must call this prior to returning the settings to
 /// the base class.
 /// </summary>
 /// <param name="s">Class containing the appropriate settings.</param>
 protected void Setup(CommLineSettings s)
 {
     RxBuffer = new byte[s.rxStringBufferSize];
     RxTerm = s.rxTerminator;
     RxFilter = s.rxFilter;
     TransTimeout = (uint)s.transactTimeout;
     TxTerm = s.txTerminator;
 }