Diff of /project/sparkplug™_mqtt_host_b9741afd/function_blocks_8ad6e219/fb_remoteedgeseqchecker_ea9a206b/fb_remoteedgeseqchecker_288a5f33/addelement_b8ac048c/b8ac048c081240b18d7127fa242e0cf9.object [000000] .. [707f6a]  Maximize  Restore

Switch to side-by-side view

--- a
+++ b/project/sparkplug™_mqtt_host_b9741afd/function_blocks_8ad6e219/fb_remoteedgeseqchecker_ea9a206b/fb_remoteedgeseqchecker_288a5f33/addelement_b8ac048c/b8ac048c081240b18d7127fa242e0cf9.object
@@ -0,0 +1 @@
+{"payload":{"meta":{"Graph":{"@Type":"81297157","@Value":{"Guid":"(Guid)b8ac048c-0812-40b1-8d71-27fa242e0cf9","ParentGuid":"(Guid)288a5f33-7901-49c1-b653-bad21aaf56a8","Name":"(string)AddElement","Properties":{"@Type":"2c41fa04:IDictionary","@Value":{}},"TypeGuid":"(Guid)f8a58466-d7f6-439f-bbb8-d4600e41d099","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}","Guid":"System.Guid","string":"System.String"}},"object":{"Graph":{"@Type":"f8a58466","@Value":{"Implementation":{"@Type":"3b83b776","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)// Decode the payload into the next available unsorted payload\n_aPayloads[ _unsortedIndex ]( xDecode := TRUE,\n                              protobufBlobSize := BlobSize,\n                              myProtobufBlob := blob,\n                              xDecodeDone =>,\n                              xDecodeBusy =>,\n                              xDecodeError =>,\n                              eDecodeError => );\n\nIF _aPayloads[ _unsortedIndex ].xDecodeDone THEN\n    _aPayloads[ _unsortedIndex ].readSeq( HasSeq => hasSeq, Seq => seq );\nELSE\n    // payload could not be decoded\n    _xPayloadCouldNotBeDecoded := TRUE;\nEND_IF\n\nCASE pTopicParser^.MessageType OF\n\n    SPstack.SparkplugMessageTypes.NBIRTH:\n        //Seq must be zero.\n        IF hasSeq AND ( Seq = 0 ) THEN\n            // OK\n            // Beware, the Birth has not been processed yet (it is still in this temporary storage) so set _nextSeqNumToProcess to zero\n            _nextSeqNumToProcess := 0;\n            _insertPosition := 0;\n            //store it\n            StoreMessage( InsertAt := _insertPosition, pTopicParser := pTopicParser, unsortedIndex := _unsortedIndex );\n\n        ELSE\n            // OH NO!        \n\n        END_IF\n\n    SPstack.SparkplugMessageTypes.NDEATH:\n        //TODO;\n        ReinitializeAfterRebirthRequest();\n        //put this message as the next to be processed. Set _nextSeqNumToProcess to 255, so once it is processed, we will be looking for seq 0 (NBIRTH)\n        _nextSeqNumToProcess := 255;\n        _insertPosition := 0;\n        //store it\n        StoreMessage( InsertAt := _insertPosition, pTopicParser := pTopicParser, unsortedIndex := _unsortedIndex );\n\n    SPstack.SparkplugMessageTypes.NDATA,\n        SPstack.SparkplugMessageTypes.DDATA,\n        SPstack.SparkplugMessageTypes.DBIRTH,\n        SPstack.SparkplugMessageTypes.DDEATH:\n\n        _seqDifference := ( 256 + ( seq - _nextSeqNumToProcess ) ) MOD 256;\n        seqDiffLessThanBufferSize := _seqDifference < bufferSize;\n        seqLessThanBufferSize := ( seq > 0 ) AND ( seq < bufferSize );\n\n        // Does the sequence difference fit into our buffer? \n        IF NOT hasSeq THEN\n            ReinitializeAfterRebirthRequest();\n            _xPayloadHadNoSeq := TRUE;\n\n        ELSIF seqDiffLessThanBufferSize THEN\n            //calculate insert position\n            _insertPosition := ( _arrayIndex + TO___UXINT( _seqDifference ) ) MOD bufferSize;\n            //store it\n            StoreMessage( InsertAt := _insertPosition, pTopicParser := pTopicParser, unsortedIndex := _unsortedIndex );\n\n        ELSIF seqLessThanBufferSize THEN\n            //we could have an out of order NBIRTH in the pipeline\n            ReinitializeAfterRebirthRequest();\n            _insertPosition := TO___UXINT( seq );\n            //store it\n            StoreMessage( InsertAt := _insertPosition, pTopicParser := pTopicParser, unsortedIndex := _unsortedIndex );\n\n        ELSE\n            ReinitializeAfterRebirthRequest();\n            _xMessageDidNotFitInBuffer := TRUE;\n        END_IF\n\nELSE\n    _xUnknownMessageOrTopicType := TRUE;\nEND_CASE\n\n// AddElement = TRUE if no error has occured\nAddElement := NOT ( _xPayloadCouldNotBeDecoded OR _xMessageDidNotFitInBuffer OR _xPayloadHadNoSeq OR _xUnknownMessageOrTopicType );\n\n//Check timeoutwindow\n_window( IN := OutOfOrder() );","LineInfoPersistence":"(string)b8ac048c-0812-40b1-8d71-27fa242e0cf9_Impl_LineIds"}}}},"Interface":{"@Type":"a9ed5b7e","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)// Adds a payload and topic to the queue by passing the blob and the unparsed topic\n// IF topic is NBIRTH - \n// IF topic is NDEATH - This should not be added to the processing queue\n// as it does not have a seq and is processed immediately\nMETHOD AddElement : BOOL\nVAR_IN_OUT\n    blob : ARRAY[ * ] OF BYTE;\nEND_VAR\nVAR_INPUT\n    BlobSize : DINT;\n    pTopicParser : POINTER TO FB_TopicParser;\nEND_VAR\nVAR\n    seq : ULINT;\n    hasSeq : BOOL;\n    seqDiffLessThanBufferSize : BOOL;\n    seqLessThanBufferSize : BOOL;\nEND_VAR","LineInfoPersistence":"(string)b8ac048c-0812-40b1-8d71-27fa242e0cf9_Decl_LineIds"}}}}}},"TypeInfos":{"3b83b776":"{3b83b776-fb25-43b8-99f2-3c507c9143fc}","a9ed5b7e":"{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}","f3878285":"{f3878285-8e4f-490b-bb1b-9acbb7eb04db}","f8a58466":"{f8a58466-d7f6-439f-bbb8-d4600e41d099}","string":"System.String"}}},"FormatVersion":"1.0"}
\ No newline at end of file