Closed ericonetto closed 6 years ago
The expectXXX
helper functions in CBOR_parsing.h
will be useful for this. Have you looked at the example code?
@ssilverman I think Im close, but still my application isn't recognizing the returned CBOR. Could you have a look?: https://github.com/ericonetto/konker-esp8266-binary-msgs-tests-CBOR- The returned CBOR from my server is: a2 64 66 6c 61 67 f5 64 74 65 78 74 64 6f 69 6f 69 Tah means:
A2 # map(2) 64 # text(4) 666C6167 # "flag" F5 # primitive(21) 64 # text(4) 74657874 # "text" 64 # text(4) 6F696F69 # "oioi"
But I get this from my code (except it isnt an array... I will change the msg)
[HTTP] begin... [HTTP] POST... [HTTP] POST... code: 200 Not self describe Array 2 not found
It looks like you're directly using the example code, which expects a "self-describe tag" at the start of the stream. Your stream is missing this. Also, by the time the first "expectValue that is a tag" call fails, the stream has already advanced, and it has already consumed the "map(2)" data item, so now the stream is out of sync with the parsing code.
Totaly make sense. I was confused by the "self-describe tag", I thought it was something buit in CBOR messages, something that describe the message. Well I will remove the "self-describe tag" part then. But anyway I'm curius, could you explain what was this "kSelfDescribeTag" in the example? Thank you so much. I think your lib will be very helpful! After I finish this test code I've shown, you could refer it in the examples to help more people. By the way the GIT of the service is here https://github.com/KonkerLabs/konker-binary-services
See RFC7049, Section 2.4.5 for more info, but essentially they're a tag that indicates that the following data is CBOR data. Its value is "mostly" unique and so allows quick determination of the data type.
This code is for a msgbpack lib. I want to do the same with libCBOR
Could you help me?