Hi all. I have what I suspect is a simple question, and I’m probably just overlooking something obvious. I am using C with the Notecard libraries and trying to retrieve values from environment variables set up on Notehub.
When I send the query to the Notecard, I can see the response scroll on console, and it has all of the information I’m wanting to get. The only problem is that when I try to extract those fields from the JSON response, I get zeros instead of the actual values.
Here’s a piece of code I’ve been testing. To simplify troubleshooting, right now I’m just trying to get it to correctly retrieve and print to log the value of one item (filter_rssi_min).
J *req = NoteNewRequest("env.get"); J *rsp = NoteRequestResponse(req); if (rsp) { int min_rssi = JGetInt(rsp, "filter_rssi_min"); LOG_ERR("RSSI MIN: %d\n",min_rssi); NoteDeleteResponse(rsp); }
If I run this code, though, I end up with a 0 in min_rssi.
But here is the response I see coming across, showing that the data I’m looking for is indeed there:
[INFO] {“time”:1726847351,“body”:{“_tri_mins”:“1440”,“filter_rssi_min”:“-128”,“heath_status_interval”:“30”,“uploader_sync_interval”:“3”,“_fw”:“gr3_Jun21$20240621202057.binpack”,“_fw_retry”:“1719003592”,“_fwc”:“notecard-6.2.3.16585$20240517112300.bin”,“_fwc_retry”:“1719001785”,“_sn”:“scott_desk”,“_tags”:“300 Dr\r\n\r\n75602\r\nDevice ID 6789546”,“reading_interval”:“600”}}
What am I doing wrong here? Do I need to somehow provide a “path” to the value I’m looking for, to specify it’s in the body sub-object?
Thanks!
Scott