Hi all, and a Happy New Year. So, I’ve been making some progress with this topic, and thanks to @rickkas7’s code and @eberseth’s suggestions, I’ve been able to interface my Tracker One with Google Sheets. However, I’m having some trouble with parsing the JSON response. Here’s what’s happening:
My JSON response is coming in as a multi-part message. I’ve adapted @rickkas7’s DeviceNotesHelper library to read in this message, but jp.parse() in hookresponsehelper is returning 1 at strange times. Serial log output below. I added Log messages to the devicenoteshelper.hookresponsehandler()
After publish #1:
0003808811 [app] INFO: received response index 2
0003808812 [app] INFO: parse returned 0
0003808831 [app] INFO: received response index 3
0003808832 [app] INFO: parse returned 0
0003808922 [app] INFO: received response index 0
0003808923 [app] INFO: parse returned 0
0003808994 [app] INFO: received response index 1
0003808997 [app] INFO: parse returned 0
After publish #2:
0003889144 [app] INFO: received response index 0
0003889145 [app] INFO: parse returned 0
0003889234 [app] INFO: received response index 1
0003889236 [app] INFO: parse returned 0
0003889237 [app] INFO: received response index 3
0003889238 [app] INFO: parse returned 1
0003889239 [app] INFO: size of zone list: 7 <---- this is a message from my app callback
0003889359 [app] INFO: received response index 2
0003889361 [app] INFO: parse returned 0
In Publish #1, you can see that jp.parse() does not return a 1 even after the 4-part message has been received, while in Publish #2 parse() returns true at the wrong time, after the third packet. I’m using JSONParserGeneratorRK v0.1.4 and deviceNotesHelperRK v.0.0.1.
Any advice/suggestions/thoughts?
Thanks.
Also, in deviceNotesHelper, the hasValidData flag is set to true when parse() returns true, but it never gets reset to false. Is this intentional? Shouldn’t it be reset before the next publish?