You can use the function sprintf for example to generate a Json-String: static uint8_t buf[20]; static int buf_length; static int counter=0; while (1) { k_msleep(1000); buf_length= sprintf(buf, "{\"Counter: %d ", counter\"}); counter++; }
What if the end device is using a different application layers such as MQTT-SN and the border router is using a different application layer such as COAP? will this work? Also what if client uses MQTT-SN and server uses COAP?
Only same protocols can communicate with each other. The layer doesn't matter. CoAP with CoAP, MQTT with MQTT, TCP with TCP,... If your server doesn't know MQTT, it won't understand the message. However, forwarding to an MQTT server or client is already possible, since IPv6 is used for this. In theory, you can also implement a CoAP server or MQTT server on your BorderRouter. But that has nothing to do with the BorderRouter functionality. BorderRouter only connects the Thread network to another IP network, generally your LAN.
@@wsniot If you have end devices from different vendors using different application layer protocols, it can be a challenge for the border router to understand the messages being sent between these devices. In this scenario, the border router may need to support all protocols used by the end devices in order to effectively communicate with them. This lack of standardization can prevent devices from being able to communicate with each other and can limit interoperability. Isn't it?