--- a/branches/develop/mqttsparkplug/mqttsparkplug/Sparkplug™ MQTT edge and host/Function Blocks/FB_Payload_1/FB_PayloadPropertyValue/svnobj
+++ b/branches/develop/mqttsparkplug/mqttsparkplug/Sparkplug™ MQTT edge and host/Function Blocks/FB_Payload_1/FB_PayloadPropertyValue/svnobj
@@ -1,5 +1,5 @@
-Gx_l¸!0…jüo¢¶<ýI'°½2ÉSystem.StringL{6f9dac99-8de1-4efc-8465-68ac443b7d08}SpecialFuncL{0db3d7bb-cde0-4416-9a7b-ce49a0124323}NoneImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocument	L{f3878285-8e4f-490b-bb1b-9acbb7eb04db}
-TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}Id
longTagText^                            //This IF statementFIF xDecode AND xEncode THEN //ERROR4    xDecodeDone  := FALSE;4    xDecodeBusy  := FALSE;2    xDecodeError := TRUE;j    eDecodeError := ERROR.PayloadYouCantDoBothAtOnce;4    xEncodeDone  := FALSE;4    xEncodeBusy  := FALSE;2    xEncodeError := TRUE;j    eEncodeError := ERROR.PayloadYouCantDoBothAtOnce;ˆELSIF NOT xDecode AND NOT xEncode THEN //DO NOTHING, ALL OUTPUTS OFF4    xDecodeError := FALSE;F    eDecodeError := ERROR.NO_ERROR;4    xEncodeError := FALSE;F    eEncodeError := ERROR.NO_ERROR;VELSIF xDecode AND NOT xEncode THEN //Decode 2    xDecodeBusy  := TRUE;!VELSIF NOT xDecode AND xEncode THEN //Encode"2    xEncodeBusy  := TRUE;#END_IF$%&IF xDecodeBusy THEN&4    InitializeStructure();'r    eDecodeState := PayloadDecodeStates.object_getlength;(&    //decode length)´    dviTemp           := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint*N    lengthOfObject    := dviTemp.int32;+x    finalByteIndex    := ProtobufBlobIndex + lengthOfObject;,^    ProtobufBlobIndex := ProtobufBlobIndex + 1;-|    eDecodeState      := PayloadDecodeStates.object_getmember;.:    //for i to i + length - 1/†    FOR ProtobufBlobIndex := ProtobufBlobIndex TO finalByteIndex DO08        CASE eDecodeState OF1b            PayloadDecodeStates.object_getmember:2r                CASE myProtobufBlob[ProtobufBlobIndex] OF3z                    16#00: //end of data? padding byte? ERROR4d                        xDecodeError      := TRUE;5„                        eDecodeError      := ERROR.PayloadFound00;6ª                        ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR7h                    ProtobufedId.PropertyValue_type:8–                        eDecodeState := PayloadDecodeStates.object_gettype;9n                    ProtobufedId.PropertyValue_is_null::œ                        eDecodeState := PayloadDecodeStates.object_getis_null;;r                    ProtobufedId.PropertyValue_int_value:<                         eDecodeState := PayloadDecodeStates.object_getint_value;=t                    ProtobufedId.PropertyValue_long_value:>¢                        eDecodeState := PayloadDecodeStates.object_getlong_value;?v                    ProtobufedId.PropertyValue_float_value:@¤                        eDecodeState := PayloadDecodeStates.object_getfloat_value;Ax                    ProtobufedId.PropertyValue_double_value:B¦                        eDecodeState := PayloadDecodeStates.object_getdouble_value;Cz                    ProtobufedId.PropertyValue_boolean_value:D¨                        eDecodeState := PayloadDecodeStates.object_getboolean_value;Ex                    ProtobufedId.PropertyValue_string_value:F¦                        eDecodeState := PayloadDecodeStates.object_getstring_value;G‚                    ProtobufedId.PropertyValue_propertyset_value:H¢                        eDecodeState := PayloadDecodeStates.object_getProperties;I„                    ProtobufedId.PropertyValue_propertysets_value:J´                        eDecodeState := PayloadDecodeStates.object_getPropertyList_length;K~                    ProtobufedId.PropertyValue_extension_value:L”                        eDecodeError      := ERROR.PayloadFoundExtensions;M®                ELSE                                               //extension... errorN\                    xDecodeError      := TRUE;OŒ                    eDecodeError      := ERROR.PayloadFoundExtensions;P¢                    ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FORQ0                END_CASER^            PayloadDecodeStates.object_gettype:SJ                _xHasType    := TRUE;T                dviTemp      := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varintU^                _eType       := dviTemp.UInt32;VŠ                eDecodeState := PayloadDecodeStates.object_getmember;Wd            PayloadDecodeStates.object_getis_null:XJ                _xHasIs_null := TRUE;Y`                _xIs_null    := dviTemp.Boolean;Zh            PayloadDecodeStates.object_getint_value:[€                _eHasValue   := PropertyProtobufsType.int_value;\                _dzzValue    := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint]j            PayloadDecodeStates.object_getlong_value:^‚                _eHasValue   := PropertyProtobufsType.long_value;_l            PayloadDecodeStates.object_getfloat_value:`„                _eHasValue   := PropertyProtobufsType.float_value;aÀ                _rValue      := OwnerPayload.DecodeNextFloat(); //updates i to end of the varintbn            PayloadDecodeStates.object_getdouble_value:c†                _eHasValue   := PropertyProtobufsType.double_value;d                _lrValue     := OwnerPayload.DecodeNextDouble(); //updates i to end of the varintep            PayloadDecodeStates.object_getboolean_value:fˆ                _eHasValue   := PropertyProtobufsType.boolean_value;gn            PayloadDecodeStates.object_getstring_value:h†                _eHasValue   := PropertyProtobufsType.string_value;i                _sValue      := OwnerPayload.DecodeNextString(); //updates i to end of the stringjj            PayloadDecodeStates.object_getProperties:kŒ                _eHasValue := PropertyProtobufsType.propertyset_value;ll                THIS^._myPropertySet( xDecode := TRUE,mn                                      xEncode := FALSE,n¦                                      protobufBlobMaxIndex := protobufBlobMaxIndex,oz                                      ProtobufFieldNumber :=,p†                                      OwnerPayload := OwnerPayload,qš                                      ProtobufBlobIndex := ProtobufBlobIndex,rŽ                                      myProtobufBlob := myProtobufBlob,sj                                      xDecodeDone =>,tj                                      xDecodeBusy =>,u†                                      xDecodeError => xDecodeError,vŠ                                      eDecodeError => eDecodeError );wP                IF NOT xDecodeError THENx’                    eDecodeState := PayloadDecodeStates.object_getmember;y(                ELSEz,                END_IF{|            PayloadDecodeStates.object_getPropertyList_length:|b                SetValueToPropertySetListEmpty();}Þ                dviTemp                    := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint~                 _myPropertySetListendindex := dviTemp.Int32 + ProtobufBlobIndex;Œ                IF ProtobufBlobIndex < _myPropertySetListendindex THEN€¬                    eDecodeState := PayloadDecodeStates.object_getPropertyList_member;|            PayloadDecodeStates.object_getPropertyList_member:‚z                    ProtobufedId.PropertySetList_propertyset:ƒÂ                        eDecodeState := PayloadDecodeStates.object_getPropertyList_PropertiesSet;„R                ELSE //extension... error…Š            PayloadDecodeStates.object_getPropertyList_PropertiesSet:†Ð                recentlyClaimedPropertySet REF= AddPropertySetToListBlank( OwnerPayload := OwnerPayload,‡È                                                                           eError => eDecodeError );ˆj                IF eDecodeError = ERROR.NO_ERROR THEN‰ž                    //i starts off now pointing to the first byte of the objectŠŒ                    THIS^.recentlyClaimedPropertySet( xDecode := TRUE,‹Ž                                                      xEncode := FALSE,ŒÆ                                                      protobufBlobMaxIndex := protobufBlobMaxIndex,š                                                      ProtobufFieldNumber :=,Ž¦                                                      OwnerPayload := OwnerPayload,º                                                      ProtobufBlobIndex := ProtobufBlobIndex,®                                                      myProtobufBlob := myProtobufBlob,‘Š                                                      xDecodeDone =>,’Š                                                      xDecodeBusy =>,“¦                                                      xDecodeError => xDecodeError,”ª                                                      eDecodeError => eDecodeError );•„                    IF recentlyClaimedPropertySet.xDecodeDone THEN–’                        //SUCCESS! the latest object has now been decoded—ž                        //i is now pointing to the very last byte of the object˜œ                        IF ProtobufBlobIndex < _myPropertySetListendindex THEN™¼                            eDecodeState := PayloadDecodeStates.object_getPropertyList_member;š8                        ELSE›¢                            eDecodeState := PayloadDecodeStates.object_getmember;œ<                        END_IF0                    ELSEž4                    END_IFŸR                    xDecodeError := TRUE; ~                    //eDecodeError := ERROR.Can't Claim Metric;¡.                END_IF;¢         END_CASE£    END_FOR¤8    IF NOT xDecodeError THEN¥¢        ProtobufBlobIndex := ProtobufBlobIndex - 1; //i is now final byte index.	¦    END_IF§Z    eDecodeState := PayloadDecodeStates.idle;¨J    xDecodeDone  := NOT xDecodeError;©END_IF;ª&IF xEncodeBusy THEN«h    //NOTE: BLOB Data will not be initialized to 00.¬\    //But we will start with a 0 byte payload.­„    //store the starting byte, because we need it right at the end®f    startingByteOfEncodedData := ProtobufBlobIndex;¯*    //Encode DataType°n    IF eEncodeError = ERROR.NO_ERROR AND _xHasType THEN±„        //{info 'todo: i-campbell Make these field numbers a GVL'}²B        dviTemp.Uint32 := _eType;³¤        eEncodeError   := OwnerPayload.EncodeNextVarInt( ValueToEncode := dviTemp,´¨                                                         ProtobufFieldNumber := 1 );µn        xEncodeError := eEncodeError <> ERROR.NO_ERROR;¶    END_IF;·(    //Encode is_null¸t    IF eEncodeError = ERROR.NO_ERROR AND _xHasIs_null THEN¹J        dviTemp.Boolean := _xIs_null;º¦        eEncodeError    := OwnerPayload.EncodeNextVarInt( ValueToEncode := dviTemp,»ª                                                          ProtobufFieldNumber := 2 );¼$    //encode Value½R    IF eEncodeError = ERROR.NO_ERROR THEN¾4        CASE _eHasValue OF¿æ            PropertyProtobufsType.boolean_value, PropertyProtobufsType.int_value, PropertyProtobufsType.long_value:ÀØ                IF GVL_sparkplug.IWantBuggyUInt32s AND _xHasType AND (_eType = PropertyDataType.UInt32) THENÁ~                    // Supports Ignition with MQTT Engine 4.0.5¼                    eEncodeError := OwnerPayload.EncodeNextVarInt( ValueToEncode := _dzzValue,ò                                                                   ProtobufFieldNumber :=Äâ                                                                   TO_BYTE( PropertyProtobufsType.long_value ) );Åt                    // Follow the SparkplugB SpecificationÆä                                                                   ProtobufFieldNumber := TO_BYTE( _eHasValue ) );Ç~                xEncodeError := eEncodeError <> ERROR.NO_ERROR;È\            PropertyProtobufsType.float_value:É®                eEncodeError := OwnerPayload.EncodeNextFloat( ValueToEncode := _rValue,ÊÚ                                                              ProtobufFieldNumber := TO_BYTE( _eHasValue ) );Ë^            PropertyProtobufsType.double_value:̲                eEncodeError := OwnerPayload.EncodeNextDouble( ValueToEncode := _lrValue,ÍÜ                                                               ProtobufFieldNumber := TO_BYTE( _eHasValue ) );Î^            PropertyProtobufsType.string_value:Ï°                eEncodeError := OwnerPayload.EncodeNextString( ValueToEncode := _sValue,Ðh            PropertyProtobufsType.propertyset_value:Ñn                THIS^._myPropertySet( xDecode := FALSE,Òl                                      xEncode := TRUE,Ó~                                      ProtobufFieldNumber := 9,Ôl                                      xDecodeError =>,Õl                                      eDecodeError =>,Öj                                      xEncodeDone =>,×j                                      xEncodeBusy =>,؆                                      xEncodeError => xEncodeError,ÙŠ                                      eEncodeError => eEncodeError );Új            PropertyProtobufsType.propertysets_value:Ûè                // So this is actually an object called PropertySetList, which has a repeated element of PropertySetÜ„                _myPropertySetListstartindex := ProtobufBlobIndex;Ýb                // Encode each member of the listÞœ                _myPropertySetList.ItterateRestart( HasNext => _COL_HasNext );ß’                WHILE _COL_HasNext AND (eEncodeError = ERROR.NO_ERROR) DOà                     _myPropertySetList.ItterateNext( itfElement => _COL_Element,áž                                                     HasNext => _COL_HasNext );âh                    IF __QUERYPOINTER( _COL_Element,㊠                                      nextPropertySetToEncode ) THENä†                        nextPropertySetToEncode^( xDecode := FALSE,å„                                                  xEncode := TRUE,æ¾                                                  protobufBlobMaxIndex := protobufBlobMaxIndex,ç–                                                  ProtobufFieldNumber := 1,èž                                                  OwnerPayload := OwnerPayload,é²                                                  ProtobufBlobIndex := ProtobufBlobIndex,ê¦                                                  myProtobufBlob := myProtobufBlob,ë‚                                                  xDecodeDone =>,ì‚                                                  xDecodeBusy =>,í„                                                  xDecodeError =>,î„                                                  eDecodeError =>,ï‚                                                  xEncodeDone =>,ð‚                                                  xEncodeBusy =>,ñž                                                  xEncodeError => xEncodeError,ò¢                                                  eEncodeError => eEncodeError );ó6                    END_IF;ô4                END_WHILE;õ¶                // Now all the Property sets are encoded, shift it and add the Field Numberöj                IF eEncodeError = ERROR.NO_ERROR THEN÷È                    eEncodeError := OwnerPayload.ReencodeLengthDelimited( ProtobufFieldNumber := 10,øÌ                                                                          startingByteOfEncodedData :=ùÒ                                                                          _myPropertySetListstartindex );úd            PropertyProtobufsType.extension_value:ûz                eEncodeError := ERROR.PayloadFoundExtensions;üZ    //Field number and length and we're done!ý®        eEncodeError := OwnerPayload.ReencodeLengthDelimited( ProtobufFieldNumber := 2,þî                                                              startingByteOfEncodedData := startingByteOfEncodedData );ÿ    //DONE :)€H    xEncodeDone := NOT xEncodeError;2    xEncodeBusy := FALSE;‚InterfaceƒL{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}„${attribute 'hide'}…tFUNCTION_BLOCK FB_PayloadPropertyValue IMPLEMENTS IElement†VAR_INPUT‡<    (*Trigers for conversion*)ˆ@    xDecode              : BOOL;‰@    xEncode              : BOOL;Š@    protobufBlobMaxIndex : DINT;‹J	PoolManager          : IPoolManager;ŒEND_VARVAR_IN_OUTŽ¨    OwnerPayload      : FB_Payload;       //He manages the assigning of Pool Objects†    ProtobufBlobIndex : DINT;             //For decoding, starts where the start of the Metric is, ends on the last byte of the Metric.  For Encoding, starts where the first byte of the Metric should be written to, ends on the next free byte after this metricì    myProtobufBlob    : ARRAY[*] OF BYTE; //array of bytes containing the protobuf payload.  If the array is the whole‘VAR_OUTPUT’d    xDecodeDone, xDecodeBusy, xDecodeError : BOOL;“f    eDecodeError                           : ERROR;”d    xEncodeDone, xEncodeBusy, xEncodeError : BOOL;•f    eEncodeError                           : ERROR;–VAR—4    (*Internal variables*)˜^    dviTemp                    : DecodedVarInt;™L    startingByteOfEncodedData  : DINT;šj    eDecodeState               : PayloadDecodeStates;›L    lengthOfObject             : DINT;œL    finalByteIndex             : DINT;ˆ    recentlyClaimedPropertySet : REFERENCE TO FB_PayloadPropertySet;ž„    nextPropertySetToEncode    : POINTER TO FB_PayloadPropertySet;ŸF    // 	    message PropertyValue {     // ¡~    //         optional uint32     type                    = 1;¢*    _xHasType : BOOL;£B    _eType    : PropertyDataType;¤€    //         optional bool       is_null                 = 2; ¥0    _xHasIs_null : BOOL;¦0    _xIs_null    : BOOL;§8    //         oneof value {¨N    _eHasValue : PropertyProtobufsType;©~    //             uint32          int_value               = 3;ª~    //             uint64          long_value              = 4;«~    //             bool            boolean_value           = 7;¬<    _dzzValue : DecodedVarInt;­~    //             float           float_value             = 5;®&    _rValue : REAL;¯~    //             double          double_value            = 6;°*    _lrValue : LREAL;±~    //             string          string_value            = 8;²,    _sValue : WSTRING;³~    //             PropertySet     propertyset_value       = 9;´V    _myPropertySet : FB_PayloadPropertySet;µÀ    //             PropertySetList propertysets_value      = 10;      // List of Property Values¶ˆ    _myPropertySetList           : List; // OF FB_PayloadPropertySet·b    _myPropertySetListstartindex : DINT; //encode¸b    _myPropertySetListendindex   : DINT; //decode¹€    //             PropertyValueExtension extension_value  = 11;º     //         }»^    //         message PropertyValueExtension {¼†    //             extensions                             1 to max;½    //     }¾(    // NO EXTENSIONS¿0    _COL_HasNext : BOOL;À8    _COL_Element : IElement;Á	Â	// IElementÃ0    _itfPrev : IElement;Ä0    _itfNext : IElement;Å*    _itfList : IList;Æ"UniqueIdGeneratorÇ2839ÈPOULevelÉL{8e575c5b-1d37-49c6-941b-5c0ec7874787}ÊStandardË ChildObjectGuidsÌ8System.Collections.ArrayListÍ,AddAttributeSubsequentÎboolÐÐ-ÐÐ	E
+Gx_là¸!0…jüoV‘•Žeõb'#à/§System.StringL{6f9dac99-8de1-4efc-8465-68ac443b7d08}SpecialFuncL{0db3d7bb-cde0-4416-9a7b-ce49a0124323}NoneImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocument	L{f3878285-8e4f-490b-bb1b-9acbb7eb04db}
+TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}Id
longTagText^                            //This IF statementFIF xDecode AND xEncode THEN //ERROR4    xDecodeDone  := FALSE;4    xDecodeBusy  := FALSE;2    xDecodeError := TRUE;j    eDecodeError := ERROR.PayloadYouCantDoBothAtOnce;4    xEncodeDone  := FALSE;4    xEncodeBusy  := FALSE;2    xEncodeError := TRUE;j    eEncodeError := ERROR.PayloadYouCantDoBothAtOnce;ˆELSIF NOT xDecode AND NOT xEncode THEN //DO NOTHING, ALL OUTPUTS OFF4    xDecodeError := FALSE;F    eDecodeError := ERROR.NO_ERROR;4    xEncodeError := FALSE;F    eEncodeError := ERROR.NO_ERROR;VELSIF xDecode AND NOT xEncode THEN //Decode 2    xDecodeBusy  := TRUE;!VELSIF NOT xDecode AND xEncode THEN //Encode"2    xEncodeBusy  := TRUE;#END_IF$%&IF xDecodeBusy THEN&4    InitializeStructure();'r    eDecodeState := PayloadDecodeStates.object_getlength;(&    //decode length)´    dviTemp           := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint*N    lengthOfObject    := dviTemp.int32;+x    finalByteIndex    := ProtobufBlobIndex + lengthOfObject;,^    ProtobufBlobIndex := ProtobufBlobIndex + 1;-|    eDecodeState      := PayloadDecodeStates.object_getmember;.:    //for i to i + length - 1/†    FOR ProtobufBlobIndex := ProtobufBlobIndex TO finalByteIndex DO08        CASE eDecodeState OF1b            PayloadDecodeStates.object_getmember:2r                CASE myProtobufBlob[ProtobufBlobIndex] OF3z                    16#00: //end of data? padding byte? ERROR4d                        xDecodeError      := TRUE;5„                        eDecodeError      := ERROR.PayloadFound00;6ª                        ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR7h                    ProtobufedId.PropertyValue_type:8–                        eDecodeState := PayloadDecodeStates.object_gettype;9n                    ProtobufedId.PropertyValue_is_null::œ                        eDecodeState := PayloadDecodeStates.object_getis_null;;r                    ProtobufedId.PropertyValue_int_value:<                         eDecodeState := PayloadDecodeStates.object_getint_value;=t                    ProtobufedId.PropertyValue_long_value:>¢                        eDecodeState := PayloadDecodeStates.object_getlong_value;?v                    ProtobufedId.PropertyValue_float_value:@¤                        eDecodeState := PayloadDecodeStates.object_getfloat_value;Ax                    ProtobufedId.PropertyValue_double_value:B¦                        eDecodeState := PayloadDecodeStates.object_getdouble_value;Cz                    ProtobufedId.PropertyValue_boolean_value:D¨                        eDecodeState := PayloadDecodeStates.object_getboolean_value;Ex                    ProtobufedId.PropertyValue_string_value:F¦                        eDecodeState := PayloadDecodeStates.object_getstring_value;G‚                    ProtobufedId.PropertyValue_propertyset_value:H¢                        eDecodeState := PayloadDecodeStates.object_getProperties;I„                    ProtobufedId.PropertyValue_propertysets_value:J´                        eDecodeState := PayloadDecodeStates.object_getPropertyList_length;K~                    ProtobufedId.PropertyValue_extension_value:L”                        eDecodeError      := ERROR.PayloadFoundExtensions;M®                ELSE                                               //extension... errorN\                    xDecodeError      := TRUE;OŒ                    eDecodeError      := ERROR.PayloadFoundExtensions;P¢                    ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FORQ0                END_CASER^            PayloadDecodeStates.object_gettype:SJ                _xHasType    := TRUE;T                dviTemp      := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varintU^                _eType       := dviTemp.UInt32;VŠ                eDecodeState := PayloadDecodeStates.object_getmember;Wd            PayloadDecodeStates.object_getis_null:XJ                _xHasIs_null := TRUE;Y`                _xIs_null    := dviTemp.Boolean;Zh            PayloadDecodeStates.object_getint_value:[€                _eHasValue   := PropertyProtobufsType.int_value;\                _dzzValue    := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint]j            PayloadDecodeStates.object_getlong_value:^‚                _eHasValue   := PropertyProtobufsType.long_value;_l            PayloadDecodeStates.object_getfloat_value:`„                _eHasValue   := PropertyProtobufsType.float_value;aÀ                _rValue      := OwnerPayload.DecodeNextFloat(); //updates i to end of the varintbn            PayloadDecodeStates.object_getdouble_value:c†                _eHasValue   := PropertyProtobufsType.double_value;d                _lrValue     := OwnerPayload.DecodeNextDouble(); //updates i to end of the varintep            PayloadDecodeStates.object_getboolean_value:fˆ                _eHasValue   := PropertyProtobufsType.boolean_value;gn            PayloadDecodeStates.object_getstring_value:h†                _eHasValue   := PropertyProtobufsType.string_value;i                _sValue      := OwnerPayload.DecodeNextString(); //updates i to end of the stringjj            PayloadDecodeStates.object_getProperties:kŒ                _eHasValue := PropertyProtobufsType.propertyset_value;ll                THIS^._myPropertySet( xDecode := TRUE,mn                                      xEncode := FALSE,n¦                                      protobufBlobMaxIndex := protobufBlobMaxIndex,oz                                      ProtobufFieldNumber :=,p†                                      OwnerPayload := OwnerPayload,qš                                      ProtobufBlobIndex := ProtobufBlobIndex,rŽ                                      myProtobufBlob := myProtobufBlob,sj                                      xDecodeDone =>,tj                                      xDecodeBusy =>,u†                                      xDecodeError => xDecodeError,vŠ                                      eDecodeError => eDecodeError );wP                IF NOT xDecodeError THENx’                    eDecodeState := PayloadDecodeStates.object_getmember;y(                ELSEz,                END_IF{|            PayloadDecodeStates.object_getPropertyList_length:|b                SetValueToPropertySetListEmpty();}Þ                dviTemp                    := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint~                 _myPropertySetListendindex := dviTemp.Int32 + ProtobufBlobIndex;Œ                IF ProtobufBlobIndex < _myPropertySetListendindex THEN€¬                    eDecodeState := PayloadDecodeStates.object_getPropertyList_member;|            PayloadDecodeStates.object_getPropertyList_member:‚z                    ProtobufedId.PropertySetList_propertyset:ƒÂ                        eDecodeState := PayloadDecodeStates.object_getPropertyList_PropertiesSet;„R                ELSE //extension... error…Š            PayloadDecodeStates.object_getPropertyList_PropertiesSet:†Ð                recentlyClaimedPropertySet REF= AddPropertySetToListBlank( OwnerPayload := OwnerPayload,‡È                                                                           eError => eDecodeError );ˆj                IF eDecodeError = ERROR.NO_ERROR THEN‰ž                    //i starts off now pointing to the first byte of the objectŠŒ                    THIS^.recentlyClaimedPropertySet( xDecode := TRUE,‹Ž                                                      xEncode := FALSE,ŒÆ                                                      protobufBlobMaxIndex := protobufBlobMaxIndex,š                                                      ProtobufFieldNumber :=,Ž¦                                                      OwnerPayload := OwnerPayload,º                                                      ProtobufBlobIndex := ProtobufBlobIndex,®                                                      myProtobufBlob := myProtobufBlob,‘Š                                                      xDecodeDone =>,’Š                                                      xDecodeBusy =>,“¦                                                      xDecodeError => xDecodeError,”ª                                                      eDecodeError => eDecodeError );•„                    IF recentlyClaimedPropertySet.xDecodeDone THEN–’                        //SUCCESS! the latest object has now been decoded—ž                        //i is now pointing to the very last byte of the object˜œ                        IF ProtobufBlobIndex < _myPropertySetListendindex THEN™¼                            eDecodeState := PayloadDecodeStates.object_getPropertyList_member;š8                        ELSE›¢                            eDecodeState := PayloadDecodeStates.object_getmember;œ<                        END_IF0                    ELSEž4                    END_IFŸR                    xDecodeError := TRUE; ~                    //eDecodeError := ERROR.Can't Claim Metric;¡.                END_IF;¢         END_CASE£    END_FOR¤8    IF NOT xDecodeError THEN¥¢        ProtobufBlobIndex := ProtobufBlobIndex - 1; //i is now final byte index.	¦    END_IF§Z    eDecodeState := PayloadDecodeStates.idle;¨J    xDecodeDone  := NOT xDecodeError;©END_IF;ª&IF xEncodeBusy THEN«h    //NOTE: BLOB Data will not be initialized to 00.¬\    //But we will start with a 0 byte payload.­„    //store the starting byte, because we need it right at the end®f    startingByteOfEncodedData := ProtobufBlobIndex;¯*    //Encode DataType°n    IF eEncodeError = ERROR.NO_ERROR AND _xHasType THEN±„        //{info 'todo: i-campbell Make these field numbers a GVL'}²B        dviTemp.Uint32 := _eType;³¤        eEncodeError   := OwnerPayload.EncodeNextVarInt( ValueToEncode := dviTemp,´¨                                                         ProtobufFieldNumber := 1 );µn        xEncodeError := eEncodeError <> ERROR.NO_ERROR;¶    END_IF;·(    //Encode is_null¸t    IF eEncodeError = ERROR.NO_ERROR AND _xHasIs_null THEN¹J        dviTemp.Boolean := _xIs_null;º¦        eEncodeError    := OwnerPayload.EncodeNextVarInt( ValueToEncode := dviTemp,»ª                                                          ProtobufFieldNumber := 2 );¼$    //encode Value½R    IF eEncodeError = ERROR.NO_ERROR THEN¾4        CASE _eHasValue OF¿æ            PropertyProtobufsType.boolean_value, PropertyProtobufsType.int_value, PropertyProtobufsType.long_value:ÀØ                IF GVL_sparkplug.IWantBuggyUInt32s AND _xHasType AND (_eType = PropertyDataType.UInt32) THENÁ~                    // Supports Ignition with MQTT Engine 4.0.5¼                    eEncodeError := OwnerPayload.EncodeNextVarInt( ValueToEncode := _dzzValue,ò                                                                   ProtobufFieldNumber :=Äâ                                                                   TO_BYTE( PropertyProtobufsType.long_value ) );Åt                    // Follow the SparkplugB SpecificationÆä                                                                   ProtobufFieldNumber := TO_BYTE( _eHasValue ) );Ç~                xEncodeError := eEncodeError <> ERROR.NO_ERROR;È\            PropertyProtobufsType.float_value:É®                eEncodeError := OwnerPayload.EncodeNextFloat( ValueToEncode := _rValue,ÊÚ                                                              ProtobufFieldNumber := TO_BYTE( _eHasValue ) );Ë^            PropertyProtobufsType.double_value:̲                eEncodeError := OwnerPayload.EncodeNextDouble( ValueToEncode := _lrValue,ÍÜ                                                               ProtobufFieldNumber := TO_BYTE( _eHasValue ) );Î^            PropertyProtobufsType.string_value:Ï°                eEncodeError := OwnerPayload.EncodeNextString( ValueToEncode := _sValue,Ðh            PropertyProtobufsType.propertyset_value:Ñn                THIS^._myPropertySet( xDecode := FALSE,Òl                                      xEncode := TRUE,Ó~                                      ProtobufFieldNumber := 9,Ôl                                      xDecodeError =>,Õl                                      eDecodeError =>,Öj                                      xEncodeDone =>,×j                                      xEncodeBusy =>,؆                                      xEncodeError => xEncodeError,ÙŠ                                      eEncodeError => eEncodeError );Új            PropertyProtobufsType.propertysets_value:Ûè                // So this is actually an object called PropertySetList, which has a repeated element of PropertySetÜ„                _myPropertySetListstartindex := ProtobufBlobIndex;Ýb                // Encode each member of the listÞœ                _myPropertySetList.ItterateRestart( HasNext => _COL_HasNext );ß’                WHILE _COL_HasNext AND (eEncodeError = ERROR.NO_ERROR) DOà                     _myPropertySetList.ItterateNext( itfElement => _COL_Element,áž                                                     HasNext => _COL_HasNext );âh                    IF __QUERYPOINTER( _COL_Element,㊠                                      nextPropertySetToEncode ) THENä†                        nextPropertySetToEncode^( xDecode := FALSE,å„                                                  xEncode := TRUE,æ¾                                                  protobufBlobMaxIndex := protobufBlobMaxIndex,ç–                                                  ProtobufFieldNumber := 1,èž                                                  OwnerPayload := OwnerPayload,é²                                                  ProtobufBlobIndex := ProtobufBlobIndex,ê¦                                                  myProtobufBlob := myProtobufBlob,ë‚                                                  xDecodeDone =>,ì‚                                                  xDecodeBusy =>,í„                                                  xDecodeError =>,î„                                                  eDecodeError =>,ï‚                                                  xEncodeDone =>,ð‚                                                  xEncodeBusy =>,ñž                                                  xEncodeError => xEncodeError,ò¢                                                  eEncodeError => eEncodeError );ó6                    END_IF;ô4                END_WHILE;õ¶                // Now all the Property sets are encoded, shift it and add the Field Numberöj                IF eEncodeError = ERROR.NO_ERROR THEN÷È                    eEncodeError := OwnerPayload.ReencodeLengthDelimited( ProtobufFieldNumber := 10,øÌ                                                                          startingByteOfEncodedData :=ùÒ                                                                          _myPropertySetListstartindex );úd            PropertyProtobufsType.extension_value:ûz                eEncodeError := ERROR.PayloadFoundExtensions;üZ    //Field number and length and we're done!ý®        eEncodeError := OwnerPayload.ReencodeLengthDelimited( ProtobufFieldNumber := 2,þî                                                              startingByteOfEncodedData := startingByteOfEncodedData );ÿ    //DONE :)€H    xEncodeDone := NOT xEncodeError;2    xEncodeBusy := FALSE;‚InterfaceƒL{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}„${attribute 'hide'}…J{attribute 'enable_dynamic_creation'}†ÚFUNCTION_BLOCK FB_PayloadPropertyValue EXTENDS FBF.InstanceBase IMPLEMENTS IElement, __SYSTEM.IQueryInterface‡VAR_INPUTˆ<    (*Trigers for conversion*)‰@    xDecode              : BOOL;Š@    xEncode              : BOOL;‹@    protobufBlobMaxIndex : DINT;ŒJ	PoolManager          : IPoolManager;END_VARŽVAR_IN_OUT¨    OwnerPayload      : FB_Payload;       //He manages the assigning of Pool Objects†    ProtobufBlobIndex : DINT;             //For decoding, starts where the start of the Metric is, ends on the last byte of the Metric.  For Encoding, starts where the first byte of the Metric should be written to, ends on the next free byte after this metric‘ì    myProtobufBlob    : ARRAY[*] OF BYTE; //array of bytes containing the protobuf payload.  If the array is the whole’VAR_OUTPUT“d    xDecodeDone, xDecodeBusy, xDecodeError : BOOL;”f    eDecodeError                           : ERROR;•d    xEncodeDone, xEncodeBusy, xEncodeError : BOOL;–f    eEncodeError                           : ERROR;—VAR˜4    (*Internal variables*)™^    dviTemp                    : DecodedVarInt;šL    startingByteOfEncodedData  : DINT;›j    eDecodeState               : PayloadDecodeStates;œL    lengthOfObject             : DINT;L    finalByteIndex             : DINT;žˆ    recentlyClaimedPropertySet : REFERENCE TO FB_PayloadPropertySet;Ÿ„    nextPropertySetToEncode    : POINTER TO FB_PayloadPropertySet; F    // 	    message PropertyValue {¡    // ¢~    //         optional uint32     type                    = 1;£*    _xHasType : BOOL;¤B    _eType    : PropertyDataType;¥€    //         optional bool       is_null                 = 2; ¦0    _xHasIs_null : BOOL;§0    _xIs_null    : BOOL;¨8    //         oneof value {©N    _eHasValue : PropertyProtobufsType;ª~    //             uint32          int_value               = 3;«~    //             uint64          long_value              = 4;¬~    //             bool            boolean_value           = 7;­<    _dzzValue : DecodedVarInt;®~    //             float           float_value             = 5;¯&    _rValue : REAL;°~    //             double          double_value            = 6;±*    _lrValue : LREAL;²~    //             string          string_value            = 8;³,    _sValue : WSTRING;´~    //             PropertySet     propertyset_value       = 9;µV    _myPropertySet : FB_PayloadPropertySet;¶À    //             PropertySetList propertysets_value      = 10;      // List of Property Values·ˆ    _myPropertySetList           : List; // OF FB_PayloadPropertySet¸b    _myPropertySetListstartindex : DINT; //encode¹b    _myPropertySetListendindex   : DINT; //decodeº€    //             PropertyValueExtension extension_value  = 11;»     //         }¼^    //         message PropertyValueExtension {½†    //             extensions                             1 to max;¾    //     }¿(    // NO EXTENSIONSÀ0    _COL_HasNext : BOOL;Á8    _COL_Element : IElement;Â	Ã	// IElementÄ0    _itfPrev : IElement;Å0    _itfNext : IElement;Æ*    _itfList : IList;Ç"UniqueIdGeneratorÈ2840ÉPOULevelÊL{8e575c5b-1d37-49c6-941b-5c0ec7874787}ËStandardÌ ChildObjectGuidsÍ8System.Collections.ArrayListÎ,AddAttributeSubsequentÏboolÐÐ-ÐÐ	E
 ÏÐÐ
­·	ÚÐ-ÐÐ
­¸	ÚÐ-ÐÐ
­¹	ÚÐ-ÐÐ
­º	ÚÐ-ÐÐ
­»	ÚÐ-ÐÐ
­¼	ÚÐ-ÐÐ
­½	ÚÐ-ÐÐ
­¾	ÚÐ-ÐÐ
­¿	ÚÐ-ÐÐ
­À	ÚÐ-ÐÐ
­Á	ÚÐ-ÐÐ
­Â	ÚÐ-ÐÐ
­Ã	ÚÐ-ÐÐ
­Ä	ÚÐ-ÐÐ
­Å	ÚÐ-ÐÐ
­Æ	ÚÐ-ÐÐ
­Ç	ÚÐ-ÐÐ
­È	ÚÐ-ÐÐ
­É	ÚÐ-ÐÐ
­Ê	ÚÐ-ÐÐ
­Ë	ÚÐ-ÐÐ
­Ì	ÚÐ- ÐÐ
­Í	ÚÐ-ÐÐ
­Î	ÚÐ-ÐÐ
­Ï	ÚÐ-ÐÐ
­Ð	ÚÐ-ÐÐ
­Ñ	ÚÐ-ÐÐ
­Ò	ÚÐ-ÐÐ
­Ó	ÚÐ-!ÐÐ
­Ô	ÚÐ-ÐÐ
­Õ	ÚÐ-ÐÐ
­Ö	ÚÐ-ÐÐ
­×	ÚÐ-ÐÐ
­Ø	ÚÐ-ÐÐ
­Ù	ÚÐ-"ÐÐ
­Ú	ÚÐ-ÐÐ
­Û	ÚÐ-ÐÐ
­Ü	ÚÐ-#ÐÐ
­Ý	ÚÐ-$ÐÐ
­Þ	ÚÐ-%ÐÐ
­ß	ÚÐ-&ÐÐ
­à	ÚÐ-'ÐÐ
­á	ÚÐ-(ÐÐ
­â	ÚÐ-)ÐÐ
­ã	ÚÐ-*ÐÐ
­ä	ÚÐ-+ÐÐ
­å	ÚÐ-,ÐÐ
­æ	ÚÐ--ÐÐ
­ç	ÚÐ-.ÐÐ
­è	ÚÐ-/ÐÐ
­é	ÚÐ-0ÐÐ
­ê	ÚÐ-1ÐÐ
­ë	ÚÐ-2ÐÐ
­ì	ÚÐ-3ÐÐ
­í	ÚÐ-4ÐÐ
­î	ÚÐ-5ÐÐ
­ï	ÚÐ-6ÐÐ
­ð	ÚÐ-7ÐÐ
­ñ	ÚÐ-8ÐÐ
­ò	ÚÐ-9ÐÐ
­ó	ÚÐ-:ÐÐ
­ô	ÚÐ-;ÐÐ
­õ	ÚÐ-<ÐÐ
­ö	ÚÐ-=ÐÐ
­÷	ÚÐ->ÐÐ
­ø	ÚÐ-?ÐÐ
­ù	ÚÐ-@ÐÐ
­ú	ÚÐ-AÐÐ
­û	ÚÐ-BÐÐ
­ü	ÚÐ-CÐÐ
­ý	ÚÐ-DÐÐ
­þ	ÚÐ-EÐÐ
­ÿ	ÚÐ-FÐÐ
­
 ÚÐ-GÐÐ
­
 ÚÐ-HÐÐ
­
@@ -246,4 +246,4 @@
 ÚÐ-$ÐÐ
­ÿ
 ÚÐ-ÇÐÐ
­ÚÐ-úÐÐ
­ÚÐ-ûÐÐ
­ÚÐ-ÇÐÐ
­ÚÐ-¢ÐÐ
­ÚÐ-¶ÐÐ
­ÚÐ-$ÐÐ
­ÚÐ-üÐÐ
­ÚÐ-½ÐÐ
­ÚÐ-±ÐÐ
­	ÚÐ-ýÐÐ
­
 ÚÐ-þÐÐ
­ÚÐ-$ÐÐ
­ÚÐ-µÐÐ
­
ÚÐ-¶ÐÐ
­ÚÐ-$ÐÐ
­ÚÐ-ÿÐÐ
­ÚÐ-€ÐÐ
­ÚÐ-ÐÐ
­	ÚÐ-©ЂƒÐ	E
-HÐÐ
­l	ÚÐ-„ÐÐ
­m	ÚÐ-…ÐÐ
­n	ÚÐ-†ÐÐ
­o	ÚÐ-‡ÐÐ
­p	ÚÐ-ˆÐÐ
­q	ÚÐ-‰ÐÐ
­r	ÚÐ-ŠÐÐ
­ÚÐ-‹ÐÐ
­s	ÚÐ-ŒÐÐ
­t	ÚÐ-ÐÐ
­u	ÚÐ-ŽÐÐ
­v	ÚÐ-ÐÐ
­w	ÚÐ-ÐÐ
­‚	ÚÐ-ŒÐÐ
­ƒ	ÚÐ-‘ÐÐ
­„	ÚÐ-’ÐÐ
­…	ÚÐ-“ÐÐ
­†	ÚÐ-”ÐÐ
­‡	ÚÐ-•ÐÐ
­ˆ	ÚÐ-ŒÐÐ
­‰	ÚÐ-–ÐÐ
­Š	ÚÐ-—ÐÐ
­‹	ÚÐ-˜ÐÐ
­Œ	ÚÐ-™ÐÐ
­	ÚÐ-šÐÐ
­Ž	ÚÐ-›ÐÐ
­	ÚÐ-œÐÐ
­	ÚÐ-ÐÐ
­‘	ÚÐ-žÐÐ
­’	ÚÐ-ŸÐÐ
­“	ÚÐ- ÐÐ
­”	ÚÐ-¡ÐÐ
­•	ÚÐ-¢ÐÐ
­–	ÚÐ-£ÐÐ
­—	ÚÐ-¤ÐÐ
­˜	ÚÐ-¥ÐÐ
­™	ÚÐ-¦ÐÐ
­š	ÚÐ- ÐÐ
­›	ÚÐ-§ÐÐ
­œ	ÚÐ-¨ÐÐ
­	ÚÐ-©ÐÐ
­ž	ÚÐ-ªÐÐ
­Ÿ	ÚÐ-«ÐÐ
­ 	ÚÐ-¬ÐÐ
­¡	ÚÐ-­ÐÐ
­¢	ÚÐ-®ÐÐ
­£	ÚÐ-¯ÐÐ
­¤	ÚÐ-°ÐÐ
­¥	ÚÐ-±ÐÐ
­¦	ÚÐ-²ÐÐ
­§	ÚÐ-³ÐÐ
­¨	ÚÐ-´ÐÐ
­©	ÚÐ-µÐÐ
­ª	ÚÐ-¶ÐÐ
­«	ÚÐ-·ÐÐ
­¬	ÚÐ-¸ÐÐ
­­	ÚÐ-¹ÐÐ
­®	ÚÐ-ºÐÐ
­¯	ÚÐ- ÐÐ
­°	ÚÐ-»ÐÐ
­±	ÚÐ-¼ÐÐ
­²	ÚÐ-ºÐÐ
­³	ÚÐ-½ÐÐ
­´	ÚÐ-¾ÐÐ
­µ	ÚÐ-¿ÐÐ
­¶	ÚÐ-ÀÐÐ
­ÚÐ-ÁÐÐ
­ÚÐ-ÂÐÐ
­ÚÐ-ÃÐÐ
­ÚÐ-ÄÐÐ
­ÚÐ-ÅÐÐ
­ÚÐ-ŒÐÆ-ÇÐÈÉ-ÊËÌÐÍέ
\ No newline at end of file
+IÐÐ
­l	ÚÐ-„ÐÐ
­ÚÐ-…ÐÐ
­m	ÚÐ-†ÐÐ
­n	ÚÐ-‡ÐÐ
­o	ÚÐ-ˆÐÐ
­p	ÚÐ-‰ÐÐ
­q	ÚÐ-ŠÐÐ
­r	ÚÐ-‹ÐÐ
­ÚÐ-ŒÐÐ
­s	ÚÐ-ÐÐ
­t	ÚÐ-ŽÐÐ
­u	ÚÐ-ÐÐ
­v	ÚÐ-ÐÐ
­w	ÚÐ-‘ÐÐ
­‚	ÚÐ-ÐÐ
­ƒ	ÚÐ-’ÐÐ
­„	ÚÐ-“ÐÐ
­…	ÚÐ-”ÐÐ
­†	ÚÐ-•ÐÐ
­‡	ÚÐ-–ÐÐ
­ˆ	ÚÐ-ÐÐ
­‰	ÚÐ-—ÐÐ
­Š	ÚÐ-˜ÐÐ
­‹	ÚÐ-™ÐÐ
­Œ	ÚÐ-šÐÐ
­	ÚÐ-›ÐÐ
­Ž	ÚÐ-œÐÐ
­	ÚÐ-ÐÐ
­	ÚÐ-žÐÐ
­‘	ÚÐ-ŸÐÐ
­’	ÚÐ- ÐÐ
­“	ÚÐ-¡ÐÐ
­”	ÚÐ-¢ÐÐ
­•	ÚÐ-£ÐÐ
­–	ÚÐ-¤ÐÐ
­—	ÚÐ-¥ÐÐ
­˜	ÚÐ-¦ÐÐ
­™	ÚÐ-§ÐÐ
­š	ÚÐ-¡ÐÐ
­›	ÚÐ-¨ÐÐ
­œ	ÚÐ-©ÐÐ
­	ÚÐ-ªÐÐ
­ž	ÚÐ-«ÐÐ
­Ÿ	ÚÐ-¬ÐÐ
­ 	ÚÐ-­ÐÐ
­¡	ÚÐ-®ÐÐ
­¢	ÚÐ-¯ÐÐ
­£	ÚÐ-°ÐÐ
­¤	ÚÐ-±ÐÐ
­¥	ÚÐ-²ÐÐ
­¦	ÚÐ-³ÐÐ
­§	ÚÐ-´ÐÐ
­¨	ÚÐ-µÐÐ
­©	ÚÐ-¶ÐÐ
­ª	ÚÐ-·ÐÐ
­«	ÚÐ-¸ÐÐ
­¬	ÚÐ-¹ÐÐ
­­	ÚÐ-ºÐÐ
­®	ÚÐ-»ÐÐ
­¯	ÚÐ-¡ÐÐ
­°	ÚÐ-¼ÐÐ
­±	ÚÐ-½ÐÐ
­²	ÚÐ-»ÐÐ
­³	ÚÐ-¾ÐÐ
­´	ÚÐ-¿ÐÐ
­µ	ÚÐ-ÀÐÐ
­¶	ÚÐ-ÁÐÐ
­ÚÐ-ÂÐÐ
­ÚÐ-ÃÐÐ
­ÚÐ-ÄÐÐ
­ÚÐ-ÅÐÐ
­ÚÐ-ÆÐÐ
­ÚÐ-ÐÇ-ÈÐÉÊ-ËÌÍÐÎÏ­
\ No newline at end of file