I am using the CODESYS IIoT Libraries SL MQTT Publish. Does this publish block only support publishing STRINGS as a readable format?
I can publish ENUM, STRUCT, BOOL; however, MQTT Explorer will only display strings. When I use Wireshark, I can see that it is publishing something, but it looks to be publishing a serialized version which is a bunch of 0s or random text.
If so, is there any way to deserialize this information back into a readable format? See pictures, where I have a BOOL TRUE that gets published as 001. Then see where I publish a STRUCT and it's an incomprehensible combination of 0s - only the string variable is displayed.
Or, is it expected that you convert everything to a string before publishing?
pbPayload is a pointer, which it expects to point at a STRING. If you point it at an address holding a different data type, it will just assume those bytes are part of a string and likely trundle along memory until it finds a null byte (0x00) that would normally signify the end of a string
PublishMessage := BOOL_TO_STRING(boolVariable);
Last edit: Rampage_Rick 2024-06-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am using the CODESYS IIoT Libraries SL MQTT Publish. Does this publish block only support publishing STRINGS as a readable format?
I can publish ENUM, STRUCT, BOOL; however, MQTT Explorer will only display strings. When I use Wireshark, I can see that it is publishing something, but it looks to be publishing a serialized version which is a bunch of 0s or random text.
If so, is there any way to deserialize this information back into a readable format? See pictures, where I have a BOOL TRUE that gets published as 001. Then see where I publish a STRUCT and it's an incomprehensible combination of 0s - only the string variable is displayed.
Or, is it expected that you convert everything to a string before publishing?
Any help is greatly appreciated! :)
Did you get any Luck? I am on same boat. Can you please share your latest Snip.
Thank you
pbPayload is a pointer, which it expects to point at a STRING. If you point it at an address holding a different data type, it will just assume those bytes are part of a string and likely trundle along memory until it finds a null byte (0x00) that would normally signify the end of a string
PublishMessage := BOOL_TO_STRING(boolVariable);
Last edit: Rampage_Rick 2024-06-05