Esempio n. 1
0
        public List <string> GetSerialPortNames()
        {
            List <string> portNames = SerialPort.GetPortNames().ToList();

            foreach (string portName in portNames)
            {
                if (!ComPortConfigurationsDictionary.ContainsKey(portName))
                {
                    ComPortConfigurationsDictionary.Add(portName,
                                                        _comPortConfigurationFactory.CreateComPortConfiguration());
                }
            }

            return(portNames);
        }
Esempio n. 2
0
        public ModBusRtuConnection(IComConnectionManager connectionManager,
                                   IUnityContainer container) : base()
        {
            _connectionManager = connectionManager;
            _container         = container;

            ComPortConfiguration = _comPortConfigurationFactory.CreateComPortConfiguration();
        }
Esempio n. 3
0
        public ModBusRtuConnection(IComConnectionManager connectionManager, ITypesContainer container, ILocalizerService localizerService,
                                   IComPortConfigurationFactory comPortConfigurationFactory, IQueryResultFactory queryResultFactory) : base(queryResultFactory)
        {
            _connectionManager           = connectionManager;
            _container                   = container;
            _localizerService            = localizerService;
            _comPortConfigurationFactory = comPortConfigurationFactory;

            ComPortConfiguration = _comPortConfigurationFactory?.CreateComPortConfiguration();
            if (_container == null)
            {
                _connectionManager           = StaticContainer.Container.Resolve <IComConnectionManager>();
                _container                   = StaticContainer.Container.Resolve <ITypesContainer>();
                _localizerService            = StaticContainer.Container.Resolve <ILocalizerService>();
                _comPortConfigurationFactory = StaticContainer.Container.Resolve <IComPortConfigurationFactory>();
            }
        }