Gurux.DLMS.GXDLMS.HandleMethodResponse C# (CSharp) Method

HandleMethodResponse() static private method

Handle method response and get data from block and/or update error status.
static private HandleMethodResponse ( GXDLMSSettings settings, GXReplyData data ) : void
settings GXDLMSSettings DLMS settings.
data GXReplyData Received data from the client.
return void
        static void HandleMethodResponse(GXDLMSSettings settings,
                                         GXReplyData data)
        {
            // Get type.
            ActionResponseType type = (ActionResponseType)data.Data.GetUInt8();
            // Get invoke ID and priority.
            byte invoke = data.Data.GetUInt8();
            if (data.Xml != null)
            {
                data.Xml.AppendStartTag(Command.MethodResponse);
                data.Xml.AppendStartTag(Command.MethodResponse, type);
                //InvokeIdAndPriority
                data.Xml.AppendLine(TranslatorTags.InvokeId, "Value",
                                    data.Xml.IntegerToHex(invoke, 2));
            }
            //Action-Response-Normal
            if (type == ActionResponseType.Normal)
            {
                HandleActionResponseNormal(settings, data);
            }
            //Action-Response-With-Pblock
            else if (type == ActionResponseType.WithFirstBlock)
            {
                throw new ArgumentException("Invalid Command.");
            }
            // Action-Response-With-List.
            else if (type == ActionResponseType.WithList)
            {
                throw new ArgumentException("Invalid Command.");
            }
            //Action-Response-Next-Pblock
            else if (type == ActionResponseType.WithBlock)
            {
                throw new ArgumentException("Invalid Command.");
            }
            else
            {
                throw new ArgumentException("Invalid Command.");
            }
            if (data.Xml != null)
            {
                data.Xml.AppendEndTag(Command.MethodResponse, type);
                data.Xml.AppendEndTag(Command.MethodResponse);
            }
        }