/// <summary> /// Get the auto answer commands for the host Qbox. /// </summary> private List <string> GetAutoAnswerCommandsForHost() { var commandsToCombine = new List <string>(); var separateCommands = new List <string>(); // Host qbox switch (_mini.State) { case MiniState.HardReset: break; case MiniState.Waiting: // Host metertype commandsToCombine.Add(Mini.WriteMeterType(_mini.MeterType)); if (_mini.SecondaryMeterType != DeviceMeterType.None) { commandsToCombine.Add(Command.Encode((byte)DeviceSettingType.SecondaryMeterType, (byte)_mini.SecondaryMeterType)); } if (_mini.MeterType != DeviceMeterType.NO_Meter) { // Last known meter settings send to qbox var meterSettings = _mini.MeterSettings; // Default metersettings in case no last meter settings are found if (String.IsNullOrEmpty(meterSettings)) { meterSettings = Command.DefaultMeterSettings(_mini.MeterType, QboxClient.None); } // Since the meter settings may contain commands that can not be safely combined with other commands, // for example set meter type to led + set led channel, we put the meter settings in separate command. if (!String.IsNullOrEmpty(meterSettings)) { separateCommands.Add(meterSettings); } } foreach (var client in _mini.Clients) { commandsToCombine.Add(Command.Encode((byte)ClientActivityRequest.RequestToRestartClientWithFactoryDefaults, client.ClientId)); } break; case MiniState.ValidImage: break; case MiniState.InvalidImage: commandsToCombine.Add(Command.Encode(Command.RequestUpgradeFirmware)); break; } var commands = new List <string>(); if (commandsToCombine.Count > 0) { commands.Add(String.Join(String.Empty, commandsToCombine)); } if (separateCommands.Count > 0) { commands.AddRange(separateCommands); } return(commands); }