public void Consume(DCSBIOSControl dcsbiosControl) { _controlId = dcsbiosControl.identifier; _controlDescription = dcsbiosControl.description; _controlType = dcsbiosControl.physical_variant; try { _address = dcsbiosControl.outputs[0].address; _mask = dcsbiosControl.outputs[0].mask; _maxValue = dcsbiosControl.outputs[0].max_value; _shiftvalue = dcsbiosControl.outputs[0].shift_by; if (dcsbiosControl.outputs[0].type.Equals("string")) { _dcsBiosOutputType = DCSBiosOutputType.STRING_TYPE; } else if (dcsbiosControl.outputs[0].type.Equals("integer")) { _dcsBiosOutputType = DCSBiosOutputType.INTEGER_TYPE; } //TODO Denna borde göras så att förutom _address så är mottagarens unika ID med så slipper alla lyssna eller ..? (prestanda) DCSBIOSProtocolParser.RegisterAddressToBroadCast(_address); } catch (Exception) { throw new Exception("Failed to copy control " + _controlId + ". Control output is missing." + Environment.NewLine); } }
public void Consume(DCSBIOSControl dcsbiosControl) { _controlId = dcsbiosControl.identifier; _controlDescription = dcsbiosControl.description; _controlType = dcsbiosControl.physical_variant; try { foreach (var dcsbiosControlInput in dcsbiosControl.inputs) { var inputObject = new DCSBIOSInputObject(); inputObject.Consume(_controlId, dcsbiosControlInput); _dcsbiosInputObjects.Add(inputObject); } } catch (Exception) { throw new Exception("Failed to copy control " + _controlId + ". Control input is missing." + Environment.NewLine); } }