コード例 #1
0
        public EposDeviceManager(MasterSettings settings, SyncCloudAgent cloudAgent)
            : base(cloudAgent)
        {
            _deviceScanner = new DeviceScanner(settings);

            RegisterEvents();
        }
コード例 #2
0
        public MasterChannelControllerAdapter(SyncCloudAgent agent, string channelId)
            : base(agent.Url, channelId, agent.Identity, agent.UpdateInterval, agent.Timeout)
        {
            _executeCommandCache = new ExecuteCommandCache();

            _agent = agent;

            WsChannelName = "Master";
            WsChannelId   = $"{channelId}_Master";
        }
コード例 #3
0
ファイル: DeviceVcs.cs プロジェクト: eltra-ch/eltra-sdk
        internal DeviceVcs(SyncCloudAgent masterAgent, EltraDevice deviceNode, uint updateInterval, uint timeout)
        {
            if (deviceNode != null)
            {
                _deviceNode = deviceNode;

                Timeout = DefaultTimeout;

                Agent = new DeviceAgent(masterAgent, deviceNode, updateInterval, timeout);

                Agent.ParameterValueChanged += OnParameterValueChanged;

                _deviceNode.CloudConnector = Agent;
            }
        }
コード例 #4
0
        public UserCloudAgent(SyncCloudAgent masterAgent, EltraDevice deviceNode, uint updateInterval, uint timeout)
        {
            _status   = AgentStatus.Undefined;
            _identity = masterAgent.Identity;
            _channel  = new Channel()
            {
                Status = ChannelStatus.Offline
            };
            _executedCommands = new List <DeviceCommand>();

            _channelAdapter = new SlaveChannelControllerAdapter(masterAgent.Url, deviceNode.ChannelId, masterAgent.Identity, updateInterval, timeout)
            {
                ConnectionManager = masterAgent.ConnectionManager
            };

            Initialize(masterAgent, deviceNode);
        }
コード例 #5
0
        internal bool StartCounting(SyncCloudAgent agent, string source, int step, int delay)
        {
            Console.WriteLine($"start counting (node id = {Device.NodeId}), step = {step}, delay = {delay}");

            StopCounting();

            _countingTask = Task.Run(async() => {
                var stopWatch = new Stopwatch();
                const double maxRunTimeInMs = 60000;

                _countingRunning = true;
                _counterValue    = 0;

                agent.RemoteChannelStatusChanged += (a, o) =>
                {
                    if (o.Id == source && o.Status == ChannelStatus.Offline)
                    {
                        _countingRunning = false;
                    }
                };

                stopWatch.Start();

                do
                {
                    _counterValue = _counterValue + step;

                    if (!_counterParameter.SetValue(_counterValue))
                    {
                        MsgLogger.WriteError($"{GetType().Name} - DummyDeviceCommunication", "set counter parameter value failed!");
                    }

                    await Task.Delay(delay);
                }while (_countingRunning && stopWatch.ElapsedMilliseconds < maxRunTimeInMs);
            });

            return(true);
        }
コード例 #6
0
 public MasterDeviceManager(SyncCloudAgent cloudAgent)
 {
     CloudAgent = cloudAgent;
 }
コード例 #7
0
 /// <summary>
 /// MasterVcs
 /// </summary>
 /// <param name="masterAgent"></param>
 /// <param name="device"></param>
 /// <param name="updateInterval"></param>
 /// <param name="timeout"></param>
 public MasterVcs(SyncCloudAgent masterAgent, EltraDevice device, uint updateInterval, uint timeout)
     : base(masterAgent.Url, device.ChannelId, masterAgent.Identity, updateInterval, timeout)
 {
     Device = device;
 }
コード例 #8
0
ファイル: DeviceAgent.cs プロジェクト: eltra-ch/eltra-sdk
 internal DeviceAgent(SyncCloudAgent masterAgent, EltraDevice device, uint updateInterval, uint timeout)
     : base(masterAgent, device, updateInterval, timeout)
 {
 }