Exemplo n.º 1
0
        public void InitController(IBedControllerConfig config)
        {
            if (!(config is FakeBedControllerConfig localParms))
            {
                throw new ArgumentException();
            }

            _config = localParms;
            Init();
        }
Exemplo n.º 2
0
        public void InitController([NotNull] IBedControllerConfig initParams)
        {
            if (initParams == null)
            {
                throw new ArgumentNullException(nameof(initParams));
            }
            var udpControllerInitParams = initParams as BedUdpControllerConfig;

            _config         = udpControllerInitParams ?? throw new InvalidOperationException($"Необходимо передать объект типа {typeof(BedUdpControllerConfig)}");
            _sessionInfo    = new BedSessionInfo(_config.MaxAngleX);
            _registerValues = new BedRegisterValues();
        }
Exemplo n.º 3
0
 public SessionParams(
     short cycleCount,
     TimeSpan updateDataPeriod,
     IBedControllerConfig bedControllerConfig,
     IMonitorControllerConfig monitorControllerConfig,
     short pumpingNumberOfAttemptsOnStartAndFinish,
     short pumpingNumberOfAttemptsOnProcessing)
 {
     CycleCount              = cycleCount;
     UpdateDataPeriod        = updateDataPeriod;
     BedControllerConfig     = bedControllerConfig;
     MonitorControllerConfig = monitorControllerConfig;
     PumpingNumberOfAttemptsOnStartAndFinish = pumpingNumberOfAttemptsOnStartAndFinish;
     PumpingNumberOfAttemptsOnProcessing     = pumpingNumberOfAttemptsOnProcessing;
 }
Exemplo n.º 4
0
        public string Build(IBedControllerConfig config)
        {
            if (!(config is BedUdpControllerConfig typedConfig))
            {
                throw new ArgumentException(nameof(config));
            }

            var innerConfig = new InternalBedUdpControllerConfig
            {
                BedIpEndpoint                  = typedConfig.BedIpEndpoint,
                UpdateDataPeriodMs             = typedConfig.UpdateDataPeriod.TotalMilliseconds,
                TimeoutMs                      = typedConfig.Timeout.TotalMilliseconds,
                DeviceReconnectionTimeoutMs    = typedConfig.DeviceReconnectionTimeout?.TotalMilliseconds,
                DeviceReconectionsRetriesCount = typedConfig.DeviceReconectionsRetriesCount
            };

            return(JsonConvert.SerializeObject(innerConfig));
        }
        public string Build(IBedControllerConfig config)
        {
            if (!(config is FakeBedControllerConfig fakeConfig))
            {
                throw new ArgumentException(nameof(config));
            }

            var innerConfig = new JsonConfig
            {
                UpdateDataPeriodMs             = fakeConfig.UpdateDataPeriod.TotalMilliseconds,
                ConnectDelayMs                 = fakeConfig.ConnectDelay.TotalMilliseconds,
                CycleWithMaxAngleDurationMs    = fakeConfig.CycleWithMaxAngleDuration.TotalMilliseconds,
                DefaultDelayMs                 = fakeConfig.DefaultDelay.TotalMilliseconds,
                DeviceReconnectionTimeoutMs    = fakeConfig.DeviceReconnectionTimeout?.TotalMilliseconds,
                DeviceReconectionsRetriesCount = fakeConfig.DeviceReconectionsRetriesCount,
                DisconnectDelayMs              = fakeConfig.DisconnectDelay.TotalMilliseconds,
                TimeoutMs = fakeConfig.Timeout.TotalMilliseconds
            };

            return(JsonConvert.SerializeObject(innerConfig));
        }