CBOR (Concise Binary Object Representation) & CoAP (Constrained Application Protocol) Support



I have just started meddling with Zerynth Studio and I am really liking it. However, I wish to ask if there are Support Libraries in the Pipeline for CoAP and CBOR.

Both of these are Open Standards by IETF and if one goes through the Implementations section, there will plenty of available libraries and code available for both of them in Python and other Languages. I guess these will become vital to the Zerynth Team and Developers since these standards are essentially a part of IoT.

I have a decent knowledge of Python, and there are already pip modules available for the above mentioned standards. Is there any way I could use the codes in Zerynth? For Instance, using something like

  import cbor


within Zerynth Studio if the cbor module is stored globally via pip? (I guess not! but how do I use these libraries?)



Hello @des,

Many thanks for your feedback! Regarding your questions let me give the short and easy answers first: yes, both coap and cbor are in the pipeline  :wink:

As for the actual implementation and pip compatibility, that needs a longer answer.
In principle it could be possible to adapt any pure Python module (the ones that do not rely on a system/external library) to work in Zerynth. Some work may be required to rewrite code that uses language features not yet available in Zerynth (for example, generators).

However, the problem I see with this approach is the difference in philosophy between the normal Python (as well as any other high level language) programming mindset and the embedded programming constraints: many Python modules are indeed correctly written with code readability, computational performance and reusability in mind. These features are very desiderable but often bring about an increase in resource usage that is negligible in server side code, but takes its toll on a microcontroller.

Therefore, while a single pure Python module may be ported from time to time, the strategy I chose for Zerynth is to create Python modules that are wrappers around well tested, performant and mantained C libraries (thanks to Zerynth C/Python easy interface). For example, on this line, in the next release the json library that was pure Python will be substituted with a wrapper around the awesome and tiny (and malloc free) parser JSMN. The same will happen for coap and cbor.


Hello @Giacomo

The python/C Interface looks like a good place to begin with. I will try working on creating something with this help you have mentioned.