public void TurnAllOff() { foreach (var module in mf.GetAllModules()) { var comm = new LedCommunicator(module.Ip); comm.TurnOff(); } }
public ExtendedModule(Module module, IEnumerable <Feature> currentFeatures, bool isLocal, ILogger logger) { Module = module; leds = new LedCommunicator(module.Ip); sensor = new SensorCommunicator(Module.Ip); logRepo = new LogRepository(); mf = new ModuleFactory(); Features = currentFeatures.ToList(); IsLocal = isLocal; this.logger = logger; }
public void Activate(Dictionary <Module, LedValue[]> values) { foreach (var valuesForModule in values) { var communicator = new LedCommunicator(valuesForModule.Key.Ip); var maxIndex = valuesForModule.Value.Max(x => x.Index) + 1; var data = new byte[maxIndex * 4]; foreach (var ledValue in valuesForModule.Value) { Buffer.BlockCopy(ledValue.Color.ToRGBB(), 0, data, ledValue.Index * 4, 4); } communicator.SetRGBB(data); } }