/// <summary> /// инициализирует новый экземпляр класса /// </summary> public Serial(Repository reposit) { t_mutex = new Mutex(); answerWaiter = new ManualResetEvent(true); timer = new Timer(TimerElapsed, null, Timeout.Infinite, timerPerion); //static_list = new List<Packet>(); s_mutex = new Mutex(); port = new SerialPort(); passive_mutex = new Mutex(); calculator = new CalculaterCRC(); translater = new Translater(TranslaterFunction); input = new List <byte>(); output = new List <byte>(); opt_slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); attemptsToRead = 1; attemptsCycled = 128; waitTimeout = 20; repository = reposit; is_primary_done = false; is_secondary_done = false; is_slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }
protected TypePort t_port = TypePort.Primary; // тип порта #endregion Fields #region Constructors /// <summary> /// инициализирует новый экземпляр класса /// </summary> public Serial(Repository reposit) { t_mutex = new Mutex(); answerWaiter = new ManualResetEvent(true); timer = new Timer(TimerElapsed, null, Timeout.Infinite, timerPerion); //static_list = new List<Packet>(); s_mutex = new Mutex(); port = new SerialPort(); passive_mutex = new Mutex(); calculator = new CalculaterCRC(); translater = new Translater(TranslaterFunction); input = new List<byte>(); output = new List<byte>(); opt_slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); attemptsToRead = 1; attemptsCycled = 128; waitTimeout = 20; repository = reposit; is_primary_done = false; is_secondary_done = false; is_slim = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); }
/// <summary> /// инициализировать считальщика CRC /// </summary> private void InitializeCalculator() { switch (app.TypeCRC) { case TypeCRC.Cycled: if (calculator is CalculatorOneByte) { return; } else { calculator = new CalculatorOneByte(); } break; case TypeCRC.CycledTwo: if (calculator is CalculateTwoByte) { return; } else { calculator = new CalculateTwoByte(); } break; case TypeCRC.CRC16: if (calculator is CalculateCRC16) { return; } else { calculator = new CalculateCRC16(); } break; } }
/// <summary> /// инициализировать считальщика CRC /// </summary> private void InitializeCalculator() { switch (app.TypeCRC) { case TypeCRC.Cycled: if (calculator is CalculatorOneByte) { return; } else calculator = new CalculatorOneByte(); break; case TypeCRC.CycledTwo: if (calculator is CalculateTwoByte) { return; } else calculator = new CalculateTwoByte(); break; case TypeCRC.CRC16: if (calculator is CalculateCRC16) { return; } else calculator = new CalculateCRC16(); break; } }