/// <summary> /// Instantiates a new BICCPCommunicator. /// </summary> /// <param name="biccp">BICCP Manager.</param> /// <param name="conf">Configuration Manager.</param> /// <param name="log">Logger.</param> public BICCPCommunicator(IBICCPManager biccp, IConfManager conf, ILogger log) { if (biccp == null) { throw new ArgumentException("ConfManager : argument biccp cannot be null."); } else { Biccp = biccp; } if (conf == null) { throw new ArgumentException("ConfManager : argument conf cannot be null."); } else { Conf = conf; } if (log == null) { throw new ArgumentException("ConfManager : argument log cannot be null."); } else { Log = log; } Actions = new BlockingCollection <IICCAction>(); }
/// <summary> /// Instantiates a new instance of the Daemon Manager. /// </summary> /// <param name="biccp">BICCP Manager reference.</param> /// <param name="conf">Configuration Manager reference.</param> /// <param name="log">Log Manager reference.</param> public DaemonManager(IBICCPManager biccp, IConfManager conf, ILogger log) { if (biccp == null) { throw new ArgumentException("DaemonManager : argument biccp cannot be null."); } else { Biccp = biccp; } if (conf == null) { throw new ArgumentException("DaemonManager : argument conf cannot be null."); } else { Conf = conf; } if (log == null) { throw new ArgumentException("DaemonManager : argument log cannot be null."); } else { Log = log; } // Instantiates a new communicator to handle I2C communications Communicator = new BICCPCommunicator(Biccp, Conf, Log); Communicator.Start(); // Register to the Configuration Manager's BusRescanned event to get notification of every new bus scan, // so we can take appropriate actions on new modules instances Conf.BusRescanned += Conf_BusRescanned; // Call to RegisterModules() to get notification of each change to a module, so the corresponding // action can be stacked to the actions list RegisterModules(); }