Own communication layer

We are using our own cloud system with the particle hardware and we already have a working code but now we want to move all the network & cloud logic (mqtt, cloud connect etc.) to the system thread to keep the device responsive during reconnects (we will use the firmware in threaded mode).

We struggle to figure out how to implement our own communication layer (all the files in the “communication” folder). Our goal is to replace the coap particle cloud code with our own mqtt server implementation.

Has anybody ideas how to get started?
Which changes must be made and where?

Thank you very much in advance!

That is a really difficult way to do things, and will require that you build a custom system firmware build and periodically merge in the changes from newer versions of system firmware.

Unless you are very short on flash in your application, a much easier way to do this is to create your own thread in addition to the Particle system thread to run your communication code in that. You’ll have three threads: loop thread running the UI, the Particle system thread doing the low-level communication, and your own communication thread, allowing your higher level communication to be independent from the UI.

3 Likes

That sounds like a good plan! Didn’t know that threads are that easy to implement.
Thank you very much for your help!