示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BControlController"/> class.
 /// </summary>
 /// <param name="bcontrol">The BControl instance.</param>
 /// <param name="options">The application options.</param>
 /// <param name="logger">The application logger.</param>
 public BControlController(IBControl bcontrol,
                           IOptions <AppSettings> options,
                           ILogger <BControlController> logger)
     : base(logger, options)
 {
     _bcontrol = bcontrol;
 }
示例#2
0
 /// <summary>
 /// Initializes an instance of the <see cref="BControlHub"/> class.
 /// </summary>
 /// <param name="bcontrol">The BControl instance.</param>
 /// <param name="logger">The application logger.</param>
 /// <param name="options">The application options.</param>
 public BControlHub(IBControl bcontrol,
                    ILogger <BControlHub> logger,
                    IOptions <AppSettings> options)
     : base(logger, options)
 {
     _bcontrol = bcontrol;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HealthCheck"/> class.
 /// </summary>
 /// <param name="bcontrol">The IBControl instance.</param>
 /// <param name="options">The application options.</param>
 /// <param name="logger">The application logger.</param>
 public HealthCheck(IBControl bcontrol,
                    IOptions <AppSettings> options,
                    ILogger <HealthCheck> logger)
     : base(logger, options)
 {
     _bcontrol = bcontrol;
 }
示例#4
0
 /// <summary>
 /// Initializes an instance of the <see cref="BControlMonitor"/> class.
 /// </summary>
 /// <param name="bcontrol">The BControl instance.</param>
 /// <param name="hub">The BControl data SignalR hub.</param>
 /// <param name="logger">The application logger.</param>
 /// <param name="options">The application options.</param>
 /// <param name="environment"></param>
 public BControlMonitor(IBControl bcontrol,
                        IHubContext <BControlHub> hub,
                        ILogger <BControlMonitor> logger,
                        IOptions <AppSettings> options,
                        IHostingEnvironment environment)
     : base(logger, options, environment)
 {
     _bcontrol = bcontrol;
     _hub      = hub;
 }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReadCommand"/> class.
        /// </summary>
        /// <param name="bcontrol">The BControl instance.</param>
        /// <param name="logger">The logger instance.</param>
        /// <param name="options">The setting options instance.</param>
        /// <param name="environment">The hosting environment instance.</param>
        public ReadCommand(IBControl bcontrol,
                           ILogger <InfoCommand> logger,
                           IOptions <AppSettings> options,
                           IHostingEnvironment environment)
            : base(logger, options, environment)
        {
            _logger?.LogDebug("ReadCommand()");

            // Setting the BControl instance.
            _bcontrol = bcontrol;
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestData"/> class.
        /// </summary>
        /// <param name="outputHelper"></param>
        public TestRead(BControlFixture fixture, ITestOutputHelper outputHelper)
        {
            // Set the default culture.
            CultureInfo.CurrentCulture = new CultureInfo("en-US");

            var loggerFactory = new LoggerFactory();

            loggerFactory.AddProvider(new XunitLoggerProvider(outputHelper));
            _logger = loggerFactory.CreateLogger <BControl>();

            _bcontrol = fixture.BControl;
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RootCommand"/> class.
        /// The RootCommand sets default values for some properties using the application settings.
        /// </summary>
        /// <param name="bcontrol">The BControl instance.</param>
        /// <param name="logger">The logger instance.</param>
        /// <param name="options">The setting options instance.</param>
        /// <param name="environment">The hosting environment instance.</param>
        public RootCommand(IBControl bcontrol,
                           ILogger <RootCommand> logger,
                           IOptions <AppSettings> options,
                           IHostingEnvironment environment)
            : base(logger, options, environment)
        {
            _logger?.LogDebug("RootCommand()");

            // Setting default options from appsettings.json file.
            Address = _settings.TcpSlave.Address;
            Port    = _settings.TcpSlave.Port;
            SlaveID = _settings.TcpSlave.ID;

            // Setting the BControl instance.
            _bcontrol = bcontrol;
        }
示例#8
0
        public BControlFixture()
        {
            // Set the default culture.
            CultureInfo.CurrentCulture = new CultureInfo("en-US");

            var loggerFactory = new LoggerFactory();
            var logger        = loggerFactory.CreateLogger <BControl>();

            BControl = new BControl(logger, new TcpClient()
            {
                TcpMaster = new TcpMasterData(),
                TcpSlave  = new TcpSlaveData()
                {
                    Address = "10.0.1.5"
                }
            });
            BControl.ReadAllAsync().Wait();
        }