static void HandleSetResponse(GXDLMSSettings settings, GXReplyData data)
{
SetResponseType type = (SetResponseType)data.Data.GetUInt8();
//Invoke ID and priority.
byte invokeId = data.Data.GetUInt8();
if (data.Xml != null)
{
data.Xml.AppendStartTag(Command.SetResponse);
data.Xml.AppendStartTag(Command.SetResponse, type);
//InvokeIdAndPriority
data.Xml.AppendLine(TranslatorTags.InvokeId, "Value", data.Xml.IntegerToHex(invokeId, 2));
}
//SetResponseNormal
if (type == SetResponseType.Normal)
{
data.Error = data.Data.GetUInt8();
if (data.Xml != null)
{
// Result start tag.
data.Xml.AppendLine(TranslatorTags.Result, "Value",
GXDLMSTranslator.ErrorCodeToString(
data.Xml.OutputType,
(ErrorCode)data.Error));
}
}
else if (type == SetResponseType.DataBlock)
{
data.Data.GetUInt32();
}
else
{
throw new ArgumentException("Invalid data type.");
}
if (data.Xml != null)
{
data.Xml.AppendEndTag(Command.SetResponse, type);
data.Xml.AppendEndTag(Command.SetResponse);
}
}