Gurux.DLMS.GXDLMSTranslatorStructure.AppendStartTag C# (CSharp) Method

AppendStartTag() public method

public AppendStartTag ( Command cmd, Enum type ) : void
cmd Command
type System.Enum
return void
        public void AppendStartTag(Command cmd, Enum type)
        {
            sb.Append(' ', 2 * offset);
            sb.Append("<");
            sb.Append(tags[(int)cmd << 8 | Convert.ToByte(type)]);
            sb.AppendLine(">");
            ++offset;
        }

Same methods

GXDLMSTranslatorStructure::AppendStartTag ( Enum cmd ) : void
GXDLMSTranslatorStructure::AppendStartTag ( Enum tag, string name, string value ) : void
GXDLMSTranslatorStructure::AppendStartTag ( int tag, string name, string value ) : void

Usage Example

        public static void HandleGetRequest(GXDLMSSettings settings, GXDLMSServer server, GXByteBuffer data, GXByteBuffer replyData, GXDLMSTranslatorStructure xml)
        {
            //Return error if connection is not established.
            if (xml == null && !settings.Connected)
            {
                replyData.Set(GXDLMSServer.GenerateConfirmedServiceError(ConfirmedServiceError.InitiateError,
                              ServiceError.Service, (byte)Service.Unsupported));
                return;
            }

            GetCommandType type = (GetCommandType)data.GetUInt8();
            // Get invoke ID and priority.
            byte invokeID = data.GetUInt8();
            if (xml != null)
            {
                xml.AppendStartTag(Command.GetRequest);
                xml.AppendStartTag(Command.GetRequest, type);
                xml.AppendLine(TranslatorTags.InvokeId, "Value", xml.IntegerToHex(invokeID, 2));
            }

            // GetRequest normal
            if (type == GetCommandType.Normal)
            {
                GetRequestNormal(settings, server, data, replyData, xml);
            }
            else if (type == GetCommandType.NextDataBlock)
            {
                // Get request for next data block
                GetRequestNextDataBlock(settings, server, data, replyData, xml);
            }
            else if (type == GetCommandType.WithList)
            {
                // Get request with a list.
                GetRequestWithList(settings, server, data, replyData, xml);
            }
            else
            {
                Debug.WriteLine("HandleGetRequest failed. Invalid command type.");
                settings.ResetBlockIndex();
                GXByteBuffer bb = new GXByteBuffer();
                // Access Error : Device reports a hardware fault.
                bb.SetUInt8((byte)ErrorCode.HardwareFault);
                GXDLMS.GetLNPdu(new GXDLMSLNParameters(settings, Command.GetResponse, (byte)type, null, bb, (byte)ErrorCode.Ok), replyData);
            }
            if (xml != null)
            {
                xml.AppendEndTag(Command.GetRequest, type);
                xml.AppendEndTag(Command.GetRequest);
            }
        }
All Usage Examples Of Gurux.DLMS.GXDLMSTranslatorStructure::AppendStartTag