generateOutputCmd method
Implementation
OutputCmd generateOutputCmd(DeviceOutputCommand command) {
ClientDeviceFeatureOutput newCommand = ClientDeviceFeatureOutput();
// Make sure the requested feature is valid
_isOutputValid(command.outputType);
var type = command.outputType;
if (type == OutputType.hwPositionWithDuration) {
if (command.duration == null) {
throw "hwPositionWithDuration requires position defined";
}
newCommand.duration = command.duration;
}
var p = command.value;
if (p.percent == null) {
// TODO Check step limits here
newCommand.value = command.value.steps;
} else {
newCommand.value = (feature.output![type]!.value![1] * p.percent!).ceil();
}
var msg = OutputCmd();
msg.command[type] = newCommand;
msg.deviceIndex = deviceIndex;
msg.featureIndex = feature.featureIndex;
return msg;
}