--- a/project/sparkplug™_mqtt_edge_b9741afd/function_blocks_d9bd2ff1/fb_device_309d3c13/fb_device_98658e3f/dcmd_30b11517/ondcmdmessage_ad92ffe1/ad92ffe15e424ca183019a5de5ce07bd.object +++ b/project/sparkplug™_mqtt_edge_b9741afd/function_blocks_d9bd2ff1/fb_device_309d3c13/fb_device_98658e3f/dcmd_30b11517/ondcmdmessage_ad92ffe1/ad92ffe15e424ca183019a5de5ce07bd.object @@ -1 +1 @@ -{"payload":{"meta":{"Graph":{"@Type":"81297157","@Value":{"Guid":"(Guid)ad92ffe1-5e42-4ca1-8301-9a5de5ce07bd","ParentGuid":"(Guid)98658e3f-2022-4201-ad82-e23b1cb5aaf1","Name":"(string)onDCMDMessage","Properties":{"@Type":"2c41fa04:IDictionary","@Value":[{"@Key":"(Guid)24568a24-c491-472c-a21f-ee5d33859fab","@Value":{"@Type":"24568a24","@Value":{"MemoryReserveForOnlineChange":"(int)0","ExcludeFromBuild":"(bool)False","External":"(bool)False","EnableSystemCall":"(bool)False","CompilerDefines":"(string)","LinkAlways":"(bool)False","Undefines":{"@Type":"[string]","@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)30b11517-09d1-42f8-b826-fe0a8a4c00e9"}]}}}}]},"TypeGuid":"(Guid)f8a58466-d7f6-439f-bbb8-d4600e41d099","EmbeddedTypeGuids":{"@Type":"[Guid]","@Value":["(Guid)a9ed5b7e-75c5-4651-af16-d2c27e98cb94","(Guid)3b83b776-fb25-43b8-99f2-3c507c9143fc"]}}},"TypeInfos":{"24568a24":"{24568a24-c491-472c-a21f-ee5d33859fab}","2c41fa04":"{2c41fa04-1834-41c1-816e-303c7aa2c05b}","81297157":"{81297157-7ec9-45ce-845e-84cab2b88ade}","829a18f2":"{829a18f2-c514-4f6e-9634-1df173429203}","bool":"System.Boolean","fa2ee218":"{fa2ee218-a39b-4b6d-b249-49dbddbd168a}","Guid":"System.Guid","int":"System.Int32","string":"System.String"}},"object":{"Graph":{"@Type":"f8a58466","@Value":{"Implementation":{"@Type":"3b83b776","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)//note: pMessage is already decoded\nonDCMDMessage := FALSE;\n\n// //get first metric\nPayloadMetric REF= pMessage.GetMetricFirst(ObjectValid => PayloadMetricIsValid, HasNext => HasNext);\nWHILE PayloadMetricIsValid DO\n\tPayloadMetric.ReadAlias(HasAlias=>hasNewAlias, Alias=> newAlias);\n\tPayloadMetric.ReadName (HasName=> , Name=> newName);\n \tGetMetric(hasAlias := hasNewAlias AND ItfEdge.UseAlias,\n\t\t\t Name := newName,\n\t\t\t Alias := newAlias,\n\t\t\t itfMetric => itfExistingMetric,\n\t\t\t xError => MetricNotExisting);\n\tIF MetricNotExisting THEN\n\t\tWriteEdgeLog(\n\t\t\tCmpLog.LogClass.LOG_WARNING,\n\t\t\t'Someone sent a DCMD with metric %s not in our DBIRTH. It was ignored',\n\t\t\tTO_STRING(newName));\n\tELSIF itfExistingMetric.Access = SPStack.AccessMode.ReadOnly THEN\n\t\titfExistingMetric.Notify := TRUE; // It Is readonly, so ignore it. We notify anyway (with the old value, so the host knows it didn't work)\n\tELSE\n\t\t// update one as it allready excists\n\t\titfExistingMetric.UpdateThisMetricFromPayload(Notify := TRUE, PayloadMetric := PayloadMetric);\n\tEND_IF\n\tPayloadMetric REF= pMessage.GetMetricNext(ObjectValid => PayloadMetricIsValid, HasNext => HasNext);\nEND_WHILE\n\nWriteEdgeLog(\n CmpLog.LogClass.LOG_DEBUG,\n 'EoN DCMD Received Topic: %s',\n WSTRING_TO_STRING(pTopic^));\n\nonDCMDMessage := TRUE;","LineInfoPersistence":"(string)ad92ffe1-5e42-4ca1-8301-9a5de5ce07bd_Impl_LineIds"}}}},"Interface":{"@Type":"a9ed5b7e","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)///\n/// Device Command (DCMD)\n/// \n/// DCMD messages are used by backend applications to write to device outputs and send Device Control commands\n/// to devices. Multiple metrics can be supplied in a single DCMD message.\n/// The following is a representation of a simple DCMD message on the topic:\n/// \n/// spBv1.0/Sparkplug™ B Devices/DCMD/Raspberry Pi/Pibrella\n/// \n/// • The ‘Group ID’ of this device is: Sparkplug™ B Devices\n/// • The host ‘EoN node ID’ of this device is: Raspberry Pi\n/// • The ‘Device ID’ is: Pibrella\n/// • This is an DCMD message from the device\n///\n/// Consider the following Sparkplug™ B payload in the DCMD message shown above:\n/// {\n/// \"timestamp\": 1486144502122,\n/// \"metrics\": [{\n/// \"name\": \"Outputs/LEDs/Green\",\n/// \"timestamp\": 1486144502122,\n/// \"dataType\": \"Boolean\",\n/// \"value\": true\n/// }, {\n/// \"name\": \"Outputs/LEDs/Yellow\",\n/// \"timestamp\": 1486144502122,\n/// \"dataType\": \"Boolean\",\n/// \"value\": true\n/// }]\n/// }\n/// \n/// The DCMD payload tells the EoN node to write true to the attached device’s green and yellow LEDs. As a result,\n/// the LEDs should turn on and result in a DDATA message back to the MQTT Server after the LEDs are successfully\n/// turned on.\n/// \n{attribute 'hide'}\nMETHOD onDCMDMessage : BOOL\nVAR_INPUT\n pTopic : POINTER TO WSTRING(SPStack.GC_sparkplug.supported_string_lengths); // resembles the topic under which the message is posted \nEND_VAR\nVAR_IN_OUT\n pMessage : SPStack.FB_Payload; //should already be decoded\nEND_VAR\nVAR_OUTPUT\n xError : BOOL;\n eError : SPStack.ERROR;\nEND_VAR\nVAR\n newName : WSTRING(SPStack.GC_sparkplug.supported_string_lengths);\n newAlias : ULINT;\n hasNewAlias : BOOL;\n itfExistingMetric : SPStack.IMetric;\n MetricNotExisting : BOOL;\n\t\n\tPayloadMetric : REFERENCE TO SPStack.FB_PayloadMetric;\n\tPayloadMetricIsValid : BOOL;\n\tHasNext : BOOL;\nEND_VAR","LineInfoPersistence":"(string)ad92ffe1-5e42-4ca1-8301-9a5de5ce07bd_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 +{"payload":{"meta":{"Graph":{"@Type":"81297157","@Value":{"Guid":"(Guid)ad92ffe1-5e42-4ca1-8301-9a5de5ce07bd","ParentGuid":"(Guid)98658e3f-2022-4201-ad82-e23b1cb5aaf1","Name":"(string)onDCMDMessage","Properties":{"@Type":"2c41fa04:IDictionary","@Value":[{"@Key":"(Guid)24568a24-c491-472c-a21f-ee5d33859fab","@Value":{"@Type":"24568a24","@Value":{"MemoryReserveForOnlineChange":"(int)0","ExcludeFromBuild":"(bool)False","External":"(bool)False","EnableSystemCall":"(bool)False","CompilerDefines":"(string)","LinkAlways":"(bool)False","Undefines":{"@Type":"[string]","@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)30b11517-09d1-42f8-b826-fe0a8a4c00e9"}]}}}}]},"TypeGuid":"(Guid)f8a58466-d7f6-439f-bbb8-d4600e41d099","EmbeddedTypeGuids":{"@Type":"[Guid]","@Value":["(Guid)a9ed5b7e-75c5-4651-af16-d2c27e98cb94","(Guid)3b83b776-fb25-43b8-99f2-3c507c9143fc"]}}},"TypeInfos":{"24568a24":"{24568a24-c491-472c-a21f-ee5d33859fab}","2c41fa04":"{2c41fa04-1834-41c1-816e-303c7aa2c05b}","81297157":"{81297157-7ec9-45ce-845e-84cab2b88ade}","829a18f2":"{829a18f2-c514-4f6e-9634-1df173429203}","bool":"System.Boolean","fa2ee218":"{fa2ee218-a39b-4b6d-b249-49dbddbd168a}","Guid":"System.Guid","int":"System.Int32","string":"System.String"}},"object":{"Graph":{"@Type":"f8a58466","@Value":{"Implementation":{"@Type":"3b83b776","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)//note: pMessage is already decoded\nonDCMDMessage := FALSE;\n\n// //get first metric\nPayloadMetric REF= pMessage.GetMetricFirst( ObjectValid => PayloadMetricIsValid, HasNext => HasNext );\n\nWHILE PayloadMetricIsValid DO\n PayloadMetric.ReadAlias( HasAlias => hasNewAlias, Alias => newAlias );\n PayloadMetric.ReadName( HasName =>, Name => newName );\n GetMetric( hasAlias := hasNewAlias AND ItfEdge.UseAlias,\n Name := newName,\n Alias := newAlias,\n itfMetric => itfExistingMetric,\n xError => MetricNotExisting );\n\n IF MetricNotExisting THEN\n WriteEdgeLog( CmpLog.LogClass.LOG_WARNING,\n 'Someone sent a DCMD with metric %s not in our DBIRTH. It was ignored',\n TO_STRING( newName ) );\n ELSIF itfExistingMetric.Access = SPStack.AccessMode.ReadOnly THEN\n itfExistingMetric.Notify := TRUE; // It Is readonly, so ignore it. We notify anyway (with the old value, so the host knows it didn't work)\n ELSE\n // update one as it allready excists\n itfExistingMetric.UpdateThisMetricFromPayload( Notify := TRUE, PayloadMetric := PayloadMetric );\n END_IF\n\n PayloadMetric REF= pMessage.GetMetricNext( ObjectValid => PayloadMetricIsValid, HasNext => HasNext );\nEND_WHILE\n\nWriteEdgeLog( CmpLog.LogClass.LOG_DEBUG,\n 'EoN DCMD Received Topic: %s',\n WSTRING_TO_STRING( pTopic^ ) );\n\nonDCMDMessage := TRUE;","LineInfoPersistence":"(string)ad92ffe1-5e42-4ca1-8301-9a5de5ce07bd_Impl_LineIds"}}}},"Interface":{"@Type":"a9ed5b7e","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)///\n/// Device Command (DCMD)\n/// \n/// DCMD messages are used by backend applications to write to device outputs and send Device Control commands\n/// to devices. Multiple metrics can be supplied in a single DCMD message.\n/// The following is a representation of a simple DCMD message on the topic:\n/// \n/// spBv1.0/Sparkplug™ B Devices/DCMD/Raspberry Pi/Pibrella\n/// \n/// • The ‘Group ID’ of this device is: Sparkplug™ B Devices\n/// • The host ‘EoN node ID’ of this device is: Raspberry Pi\n/// • The ‘Device ID’ is: Pibrella\n/// • This is an DCMD message from the device\n///\n/// Consider the following Sparkplug™ B payload in the DCMD message shown above:\n/// {\n/// \"timestamp\": 1486144502122,\n/// \"metrics\": [{\n/// \"name\": \"Outputs/LEDs/Green\",\n/// \"timestamp\": 1486144502122,\n/// \"dataType\": \"Boolean\",\n/// \"value\": true\n/// }, {\n/// \"name\": \"Outputs/LEDs/Yellow\",\n/// \"timestamp\": 1486144502122,\n/// \"dataType\": \"Boolean\",\n/// \"value\": true\n/// }]\n/// }\n/// \n/// The DCMD payload tells the EoN node to write true to the attached device’s green and yellow LEDs. As a result,\n/// the LEDs should turn on and result in a DDATA message back to the MQTT Server after the LEDs are successfully\n/// turned on.\n/// \n{attribute 'hide'}\nMETHOD onDCMDMessage : BOOL\nVAR_INPUT\n pTopic : POINTER TO WSTRING( SPStack.GC_sparkplug.supported_string_lengths ); // resembles the topic under which the message is posted \nEND_VAR\nVAR_IN_OUT\n pMessage : SPStack.FB_Payload; //should already be decoded\nEND_VAR\nVAR_OUTPUT\n xError : BOOL;\n eError : SPStack.ERROR;\nEND_VAR\nVAR\n newName : WSTRING( SPStack.GC_sparkplug.supported_string_lengths );\n newAlias : ULINT;\n hasNewAlias : BOOL;\n itfExistingMetric : SPStack.IMetric;\n MetricNotExisting : BOOL;\n\n PayloadMetric : REFERENCE TO SPStack.FB_PayloadMetric;\n PayloadMetricIsValid : BOOL;\n HasNext : BOOL;\nEND_VAR","LineInfoPersistence":"(string)ad92ffe1-5e42-4ca1-8301-9a5de5ce07bd_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