1 | {"payload":{"meta":{"Graph":{"@Type":"81297157","@Value":{"Guid":"(Guid)c3ef471d-8975-43d7-9710-54e31eac006f","ParentGuid":"(Guid)0bdfb382-e83f-44ce-8b28-d26c6658b28d","Name":"(string)ConsumeDBIRTHMessage","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)//TODO: Check if edge is online (isQualityOK). If not OK, DO NOT process the DBIRTH, instead just send a NCMD/Rebirth\nMyDevice REF= pPrimaryHost^.GetDevice( GroupId := pTopicParser^.GroupId,\n EdgeId := pTopicParser^.EdgeId,\n DeviceId := pTopicParser^.DeviceId,\n eError => GetDeviceError );\n\nCASE GetDeviceError OF\n\n SPStack.ERROR.GroupIDNotFound: // ==> DETECTED NEW GROUP! must rebirth the edge\n\n ProcessDBIRTHerror := SPStack.ERROR.NotImplemented;\n xProcessDBIRTHError := TRUE;\n WriteHostLog( CmpLog.LogClass.LOG_WARNING,\n 'DBIRTH Received with no existing groupID, but haven$'t implemented NCMD Rebirth yet %s',\n '' );\n\n SPStack.ERROR.EdgeIDNotFound: // ==> DETECTED NEW EDGE! must rebirth the edge\n\n ProcessDBIRTHerror := SPStack.ERROR.NotImplemented;\n xProcessDBIRTHError := TRUE;\n WriteHostLog( CmpLog.LogClass.LOG_WARNING,\n 'DBIRTH Received with no existing edge, but haven$'t implemented NCMD Rebirth yet %s',\n '' );\n\n SPStack.ERROR.DeviceIDNotFound: // ==> DETECTED NEW DEVICE!\n\n MyEdge REF= pPrimaryHost^.GetEdge( GroupId := pTopicParser^.GroupId,\n EdgeId := pTopicParser^.EdgeId,\n eError => GetEdgeError );\n\n IF GetEdgeError = SPStack.ERROR.NO_ERROR THEN\n MyDevice REF= pPrimaryHost^.allocDevicetoEdge( DeviceName := pTopicParser^.DeviceId,\n itfEdge := MyEdge.itfRemoteEoN,\n eError => allocDevicetoEdge );\n\n WriteHostLog( CmpLog.LogClass.LOG_INFO, 'Host registered new Remote Device: %s', TO_STRING( pTopicParser^.DeviceId ) );\n\n IF allocDevicetoEdge = SPStack.ERROR.NO_ERROR THEN\n MyDevice.ProcessDBIRTH( itfPrimaryHost := pPrimaryHost^,\n NodeName := pTopicParser^.EdgeId,\n GroupId := pTopicParser^.GroupId,\n DeviceName := pTopicParser^.DeviceId,\n pMessage := RecvMesg,\n xError => xProcessDBIRTHError,\n eError => ProcessDBIRTHerror );\n\n ELSE\n xProcessDBIRTHError := TRUE;\n //eError := eError;\n END_IF\n\n ELSE\n xProcessDBIRTHError := TRUE;\n //eError := eError;\n END_IF\n\n SPStack.ERROR.NO_ERROR: // ==> UPDATE EXISTING DEVICE\n\n MyDevice.ProcessDBIRTH( itfPrimaryHost := pPrimaryHost^,\n NodeName := pTopicParser^.EdgeId,\n GroupId := pTopicParser^.GroupId,\n DeviceName := pTopicParser^.DeviceId,\n pMessage := RecvMesg,\n xError => xProcessDBIRTHError,\n eError => ProcessDBIRTHerror );\n\nELSE\n ; //{info 'TODO: maybe some sort of error??'}\nEND_CASE","LineInfoPersistence":"(string)c3ef471d-8975-43d7-9710-54e31eac006f_Impl_LineIds"}}}},"Interface":{"@Type":"a9ed5b7e","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)METHOD PRIVATE ConsumeDBIRTHMessage\nVAR_INPUT\n pPrimaryHost : POINTER TO FB_PrimaryHost;\n pTopicParser : POINTER TO FB_TopicParser; \nEND_VAR\nVAR\n RecvMesg : REFERENCE TO SPStack.FB_Payload;\n RecvTopic : WSTRING( SPStack.GC_Sparkplug.supported_string_lengths );\n TopicParser : FB_TopicParser; \n MyDevice : REFERENCE TO FB_RemoteDevice; \n MyEdge : REFERENCE TO FB_RemoteEdge;\nEND_VAR\nVAR_OUTPUT\n GetDeviceError : SPStack.ERROR; // an error that will be given back by a function, but we can handle the error.\n GetEdgeError : SPStack.ERROR; // an error that will be given back by a function, but we can handle the error.\n allocDevicetoEdge : SPStack.ERROR; // an error that will be given back by a function, but we can handle the error.\n ProcessDBIRTHerror : SPStack.ERROR; // an error that will be given back by a function, but we can handle the error\n xProcessDBIRTHError : BOOL;\nEND_VAR\n","LineInfoPersistence":"(string)c3ef471d-8975-43d7-9710-54e31eac006f_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"} |