[bf04e8]: / project / sparkplug™_mqtt_edge_and_host-stack_b9741afd / function_blocks_8ad6e219 / fb_payload_ad205903 / fb_payloaddataset_cb85d452 / cb85d452c2ee40f3b06011e03362e219.object  Maximize  Restore  History

Download this file

1 lines (1 with data), 13.9 kB

1
{"payload":{"meta":{"Graph":{"@Type":"81297157","@Value":{"Guid":"(Guid)cb85d452-c2ee-40f3-b060-11e03362e219","ParentGuid":"(Guid)00000000-0000-0000-0000-000000000000","Name":"(string)FB_PayloadDataSet","Properties":{"@Type":"2c41fa04:IDictionary","@Value":[{"@Key":"(Guid)829a18f2-c514-4f6e-9634-1df173429203","@Value":{"@Type":"829a18f2","@Value":{"ParentObjects":{"@Type":"fa2ee218:IDictionary","@Value":[{"@Key":"(Guid)21af5390-2942-461a-bf89-951aaf6999f1","@Value":"(Guid)ad205903-8508-4926-9d55-99ed8855a066"}]}}}}]},"TypeGuid":"(Guid)6f9dac99-8de1-4efc-8465-68ac443b7d08","EmbeddedTypeGuids":{"@Type":"[Guid]","@Value":["(Guid)a9ed5b7e-75c5-4651-af16-d2c27e98cb94","(Guid)3b83b776-fb25-43b8-99f2-3c507c9143fc"]}}},"TypeInfos":{"2c41fa04":"{2c41fa04-1834-41c1-816e-303c7aa2c05b}","81297157":"{81297157-7ec9-45ce-845e-84cab2b88ade}","829a18f2":"{829a18f2-c514-4f6e-9634-1df173429203}","fa2ee218":"{fa2ee218-a39b-4b6d-b249-49dbddbd168a}","Guid":"System.Guid","string":"System.String"}},"object":{"Graph":{"@Type":"6f9dac99","@Value":{"SpecialFunc":{"@Type":"0db3d7bb:Enum","@Value":"None"},"Implementation":{"@Type":"3b83b776","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)//This IF statement\nIF xDecode AND xEncode THEN //ERROR\n    xDecodeDone := FALSE;\n    xDecodeBusy := FALSE;\n    xDecodeError := TRUE;\n    eDecodeError := ERROR.PayloadYouCantDoBothAtOnce;\n    xEncodeDone := FALSE;\n    xEncodeBusy := FALSE;\n    xEncodeError := TRUE;\n    eEncodeError := ERROR.PayloadYouCantDoBothAtOnce;\nELSIF NOT xDecode AND NOT xEncode THEN //DO NOTHING, ALL OUTPUTS OFF\n    xDecodeDone := FALSE;\n    xDecodeBusy := FALSE;\n    xDecodeError := FALSE;\n    eDecodeError := ERROR.NO_ERROR;\n    xEncodeDone := FALSE;\n    xEncodeBusy := FALSE;\n    xEncodeError := FALSE;\n    eEncodeError := ERROR.NO_ERROR;\nELSIF xDecode AND NOT xEncode THEN //Decode\n    xDecodeDone := FALSE;\n    xDecodeBusy := TRUE;\n    xDecodeError := FALSE;\n    eDecodeError := ERROR.NO_ERROR;\n    xEncodeDone := FALSE;\n    xEncodeBusy := FALSE;\n    xEncodeError := FALSE;\n    eEncodeError := ERROR.NO_ERROR;\nELSIF NOT xDecode AND xEncode THEN //Encode\n    xDecodeDone := FALSE;\n    xDecodeBusy := FALSE;\n    xDecodeError := FALSE;\n    eDecodeError := ERROR.NO_ERROR;\n    xEncodeDone := FALSE;\n    xEncodeBusy := TRUE;\n    xEncodeError := FALSE;\n    eEncodeError := ERROR.NO_ERROR;\nEND_IF\n\nIF xDecodeBusy THEN\n    InitializeStructure();\n    eDecodeState := PayloadDecodeStates.object_getlength;\n    //decode length\n    dviTemp := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint\n    lengthOfObject := dviTemp.int32;\n    finalByteIndex := ProtobufBlobIndex + lengthOfObject;\n    ProtobufBlobIndex := ProtobufBlobIndex + 1;\n    eDecodeState := PayloadDecodeStates.object_getmember;\n\n    //for i to i + length - 1\n    FOR ProtobufBlobIndex := ProtobufBlobIndex TO finalByteIndex DO\n        CASE eDecodeState OF\n            PayloadDecodeStates.object_getmember:\n                CASE myProtobufBlob[ProtobufBlobIndex] OF\n                    16#00: //end of data? padding byte? ERROR\n                        xDecodeError := TRUE;\n                        eDecodeError := ERROR.PayloadFound00;\n                        ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR\n                    ProtobufedId.DataSet_num_of_columns:\n                        eDecodeState := PayloadDecodeStates.object_getnum_of_columns;\n                    ProtobufedId.DataSet_columns:\n                        eDecodeState := PayloadDecodeStates.object_getcolumns;\n                    ProtobufedId.DataSet_types:\n                        eDecodeState := PayloadDecodeStates.object_gettype;\n                    ProtobufedId.DataSet_rows:\n                        eDecodeState := PayloadDecodeStates.object_getrows;\n                ELSE //extension... error\n                    xDecodeError := TRUE;\n                    eDecodeError := ERROR.PayloadFoundExtensions;\n                    ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR\n                END_CASE\n            PayloadDecodeStates.object_getnum_of_columns:\n                _xHasNum_of_columns := TRUE;\n                dviTemp := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint\n                _num_of_columns := dviTemp.UInt64;\n                eDecodeState := PayloadDecodeStates.object_getmember;\n            PayloadDecodeStates.object_getcolumns:\n                wsTemp := OwnerPayload.DecodeNextString();\n                eDecodeError := THIS^.AddColumn(ColumnName := wsTemp,\n                    OwnerPayload := OwnerPayload);\n\n                IF eDecodeError = ERROR.NO_ERROR THEN\n                    eDecodeState := PayloadDecodeStates.object_getmember;\n                ELSE\n                    xDecodeError := TRUE;\n                    ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR\n                END_IF\n            PayloadDecodeStates.object_gettype:\n                dviTemp := OwnerPayload.DecodeNextVarInt(); //updates i to end of the varint\n                eDecodeError := THIS^.AddType_SetType(OwnerPayload := OwnerPayload,\n                    dataType := dviTemp.UInt32);\n\n                IF eDecodeError = ERROR.NO_ERROR THEN\n                    eDecodeState := PayloadDecodeStates.object_getmember;\n                ELSE\n                    xDecodeError := TRUE;\n                    ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR\n                END_IF\n            PayloadDecodeStates.object_getrows:\n                recentlyClaimedRow REF= AddRowBlank(OwnerPayload := OwnerPayload,\n                    eError => eDecodeError);\n\n                IF eDecodeError = ERROR.NO_ERROR THEN\n                    //i starts off now pointing to the first byte of the object\n                    THIS^.recentlyClaimedRow(xDecode := TRUE,\n                        xEncode := FALSE,\n                        protobufBlobMaxIndex := protobufBlobMaxIndex,\n                        OwnerPayload := OwnerPayload,\n                        ProtobufBlobIndex := ProtobufBlobIndex,\n                        myProtobufBlob := myProtobufBlob,\n                        xDecodeDone =>,\n                        xDecodeBusy =>,\n                        xDecodeError => xDecodeError,\n                        eDecodeError => eDecodeError);\n\n                    IF recentlyClaimedRow.xDecodeDone THEN\n                        //SUCCESS! the latest object has now been decoded\n                        //i is now pointing to the very last byte of the object\n                        eDecodeState := PayloadDecodeStates.object_getmember;\n                    ELSE\n                        ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR\n                    END_IF\n                ELSE\n                    xDecodeError := TRUE;\n                    //eDecodeError := ERROR.Can't Claim Metric;\n                    ProtobufBlobIndex := protobufBlobMaxIndex; //break out of FOR\n                END_IF;\n        END_CASE\n    END_FOR\n\n    IF NOT xDecodeError THEN\n        ProtobufBlobIndex := ProtobufBlobIndex - 1; //i is now final byte index.\t\n    END_IF\n\n    eDecodeState := PayloadDecodeStates.idle;\n    xDecodeDone := NOT xDecodeError;\n    xDecodeBusy := FALSE;\nEND_IF;\n\nIF xEncodeBusy THEN\n    //NOTE: BLOB Data will not be initialized to 00.\n    //But we will start with a 0 byte payload.\n    //store the starting byte, because we need it right at the end\n    startingByteOfEncodedData := ProtobufBlobIndex;\n    //Encode num_of_columns\n    IF eEncodeError = ERROR.NO_ERROR AND _xHasNum_of_columns THEN\n        //{info 'todo: i-campbell Make these field numbers a GVL'}\n        dviTemp.Uint64 := _num_of_columns;\n        eEncodeError := OwnerPayload.EncodeNextVarInt(ValueToEncode := dviTemp,\n            ProtobufFieldNumber := 1);\n\n        xEncodeError := eEncodeError <> ERROR.NO_ERROR;\n    END_IF;\n\n    //Enocde All Columns\n    _Columns.ItterateRestart(HasNext => _COL_HasNext);\n    WHILE _COL_HasNext AND (eEncodeError = ERROR.NO_ERROR) DO\n        _Columns.ItterateNext(itfElement => _COL_Element,\n            HasNext => _COL_HasNext);\n\n        IF __QUERYPOINTER(_COL_Element,\n            nextColumnToEncode) THEN\n            eEncodeError := OwnerPayload.EncodeNextString(ProtobufFieldNumber := 2,\n                ValueToEncode := nextColumnToEncode^.WStringValue);\n\n            xEncodeError := eEncodeError <> ERROR.NO_ERROR;\n        END_IF;\n    END_WHILE;\n\n    //Enocde All Types\n    _Types.ItterateRestart(HasNext => _COL_HasNext);\n    WHILE _COL_HasNext AND (eEncodeError = ERROR.NO_ERROR) DO\n        _Types.ItterateNext(itfElement => _COL_Element,\n            HasNext => _COL_HasNext);\n\n        IF __QUERYPOINTER(_COL_Element,\n            nextTypeToEncode) THEN\n            nextTypeToEncode^.ReadType(dataType => udiTemp);\n            dviTemp.UInt32 := udiTemp;\n            eEncodeError := OwnerPayload.EncodeNextVarInt(ValueToEncode := dviTemp,\n                ProtobufFieldNumber := 3);\n\n            xEncodeError := eEncodeError <> ERROR.NO_ERROR;\n        END_IF;\n    END_WHILE;\n\n    //Encode All Rows\n    _Rows.ItterateRestart(HasNext => _COL_HasNext);\n\n    WHILE _COL_HasNext AND (eEncodeError = ERROR.NO_ERROR) DO\n        _Rows.ItterateNext(itfElement => _COL_Element,\n            HasNext => _COL_HasNext);\n\n        IF __QUERYPOINTER(_COL_Element,\n            nextRowToEncode) THEN\n            nextRowToEncode^(xDecode := FALSE,\n                xEncode := TRUE,\n                protobufBlobMaxIndex := protobufBlobMaxIndex,\n                OwnerPayload := OwnerPayload,\n                ProtobufBlobIndex := ProtobufBlobIndex,\n                myProtobufBlob := myProtobufBlob,\n                xDecodeDone =>,\n                xDecodeBusy =>,\n                xDecodeError =>,\n                eDecodeError =>,\n                xEncodeDone =>,\n                xEncodeBusy =>,\n                xEncodeError => xEncodeError,\n                eEncodeError => eEncodeError);\n        END_IF;\n    END_WHILE\n\n    //Field number and length and we're done!\n    IF eEncodeError = ERROR.NO_ERROR THEN\n        //{info 'todo: i-campbell Make these field numbers a GVL'}\n        eEncodeError := OwnerPayload.ReencodeLengthDelimited(ProtobufFieldNumber := 17,\n            startingByteOfEncodedData := startingByteOfEncodedData);\n\n        xEncodeError := eEncodeError <> ERROR.NO_ERROR;\n    END_IF;\n\n    //DONE :)\n    xEncodeDone := NOT xEncodeError;\n    xEncodeBusy := FALSE;\nEND_IF;","LineInfoPersistence":"(string)cb85d452-c2ee-40f3-b060-11e03362e219_Impl_LineIds"}}}},"Interface":{"@Type":"a9ed5b7e","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string){attribute 'hide'}\nFUNCTION_BLOCK FB_PayloadDataSet IMPLEMENTS LinkedList.IElement\nVAR_INPUT\n    (*Trigers for conversion*)\n    xDecode : BOOL;\n    xEncode : BOOL;\n    protobufBlobMaxIndex : DINT;\n    PoolManager : IPoolManager;\nEND_VAR\nVAR_IN_OUT\n    OwnerPayload : FB_Payload; //He manages the assigning of Pool Objects\n    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\n    myProtobufBlob : ARRAY[*] OF BYTE; //array of bytes containing the protobuf payload.  If the array is the whole\nEND_VAR\nVAR_OUTPUT\n    xDecodeDone, xDecodeBusy, xDecodeError : BOOL;\n    eDecodeError : ERROR;\n    xEncodeDone, xEncodeBusy, xEncodeError : BOOL;\n    eEncodeError : ERROR;\nEND_VAR\nVAR\n    (*Internal variables*)\n    dviTemp : DecodedVarInt;\n    wsTemp : WSTRING(GC_Sparkplug.supported_string_lengths);\n    udiTemp : UDINT;\n    startingByteOfEncodedData : DINT;\n    eDecodeState : PayloadDecodeStates;\n    lengthOfObject : DINT;\n    finalByteIndex : DINT;\n    nextTypeToEncode : POINTER TO FB_PayloadDataSetType;\n    nextColumnToEncode : POINTER TO LinkedListWStringElement;\n    recentlyClaimedRow : REFERENCE TO FB_PayloadRow;\n    nextRowToEncode : POINTER TO FB_PayloadRow;\n    //\t    optional uint64   num_of_columns    = 1;\n    _xHasNum_of_columns : BOOL;\n    _num_of_columns : ULINT;\n    //        repeated string   columns           = 2;\n    _Columns : LinkedList.List; // OF  STRING; // payload contains names of columns\n    //         repeated uint32   types             = 3;\n    _Types : LinkedList.List; // OF FB_PayloadDataSetType // payload contains type definition of columns\n    //         repeated Row      rows              = 4;\n    _Rows : LinkedList.List; // OF FB_PayloadRow // payload contains Rows of Elements\n    //         extensions                          5 to max;   // For third party extensions\n    // NO EXTENSIONS IMPLEMENTED\n    _COL_HasNext : BOOL;\n    _COL_Element : LinkedList.IElement;\n\n    // LinkedList.IElement\n    _itfPrev : LinkedList.IElement;\n    _itfNext : LinkedList.IElement;\n    _itfList : LinkedList.IList;\nEND_VAR","LineInfoPersistence":"(string)cb85d452-c2ee-40f3-b060-11e03362e219_Decl_LineIds"}}}},"UniqueIdGenerator":"(string)2578","POULevel":{"@Type":"8e575c5b:Enum","@Value":"Standard"},"ChildObjectGuids":{"@Type":"ArrayList:IList","@Value":[]},"AddAttributeSubsequent":"(bool)False"}},"TypeInfos":{"0db3d7bb":"{0db3d7bb-cde0-4416-9a7b-ce49a0124323}","3b83b776":"{3b83b776-fb25-43b8-99f2-3c507c9143fc}","6f9dac99":"{6f9dac99-8de1-4efc-8465-68ac443b7d08}","8e575c5b":"{8e575c5b-1d37-49c6-941b-5c0ec7874787}","a9ed5b7e":"{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}","ArrayList":"System.Collections.ArrayList","bool":"System.Boolean","f3878285":"{f3878285-8e4f-490b-bb1b-9acbb7eb04db}","string":"System.String"}}},"FormatVersion":"1.0"}