コード例 #1
0
ファイル: MasterThread.cs プロジェクト: Vlbager/Nandaka
        public static MasterThread Create(IReadOnlyCollection <NandakaDevice> slaveDevices, IProtocol protocol, IDeviceUpdatePolicy updatePolicy, ILog log)
        {
            var threadLog  = new PrefixLog(log, "[Master]");
            var dispatcher = MasterDeviceDispatcher.Create(slaveDevices, updatePolicy, threadLog);

            return(new MasterThread(dispatcher, protocol, threadLog));
        }
コード例 #2
0
ファイル: MasterSession.cs プロジェクト: Vlbager/Nandaka
 public MasterSession(IProtocol protocol, NandakaDevice slaveDevice, MasterDeviceDispatcher dispatcher, ILog log)
 {
     _log                   = new PrefixLog(log, $"[{slaveDevice.Name} Session]");
     _protocol              = protocol;
     _slaveDevice           = slaveDevice;
     _registersUpdatePolicy = slaveDevice.UpdatePolicy;
     _dispatcher            = dispatcher;
 }
コード例 #3
0
ファイル: MasterThread.cs プロジェクト: Vlbager/Nandaka
        private MasterThread(MasterDeviceDispatcher dispatcher, IProtocol protocol, ILog log)
        {
            _dispatcher     = dispatcher;
            _log            = log;
            _deviceSessions = dispatcher.SlaveDevices.ToDictionary(device => device.Address,
                                                                   device => new MasterSession(protocol, device, dispatcher, _log));

            _thread = new Thread(Routine)
            {
                IsBackground = true
            };
        }