cbor orunpack ?



  • hello,

    I need to serialise many int data before I send to sigfox.
    i would like to know if i can use cbor with my sipy. If it's possible which is the best , cbor or unpack to serialise.
    the target is to put the maximum data in one message.
    And i heard i can send with json format, so do you have documentation about that ?

    thank you for all



  • @quentho cbor is not implemented in Micropython. If it is straight python, it may be possible to use it. But if you do not have any compatibility constraints, you can use ustruct.pack() and ustruct.unpack().
    You can also use the ujson.dumps() and ujson.loads() methods. But that is an ASCII format, which takes more space than a binary format.
    P.S.: I just looked into a cbor package from PyPi. It should be possible to port it to MicroPython, but it is quite a bunch of code.


Log in to reply
 

Pycom on Twitter