Getting errors calling makeJsonRequest on vivoactive

Former Member
Former Member
Hi,

when running my watch app on the simulator, then the makeJsonRequest() call executes fine
and i do get valid responses. Running the watch app on a vivoactive watch however does not
show the expected result. All i get is "Error: -2" and "Error: -101". These return codes show
up alternately.

Any help appreciated.

Thanks in advance,

Georg
  • Former Member
    Former Member over 10 years ago
    They are BLE errors. You can see the reference in the manual, under Communications. I don't know exactly what they mean, but I'm guessing you're trying to make too many requests at once.
  • You can find the BLE error definitions in the Connect IQ documentation for makeJsonRequest():

    http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/frames.html#!Toybox/Communications.html

    A "-2" is a timeout, and a "-101" indicates a full request queue (meaning you've made too many requests).
  • On the va, are you checking "phoneConnected" to make sure the va is talking to your phone? (you can't do this in the simulator, as today there is no way to change it - it's always false) . On the device, if phoneConnected is false, the makeJson call will give errors. (note! if you want to run on pre 2.60 FW on the VA, be sure to use "has" with phoneConnected, or the va will crash on the call!)

    What I do is in initialze(), I set a boolean:

    availableStatBT=(Sys.getDeviceSettings() has :phoneConnected ) ? true : false;

    and then have this around the makeJson call. if "phoneConnected" is available, use it, if not just go ahead with the call, and with the "inSim" variable, I can set it to run in the simulator for testing. (I also use "inSim" to show something on the display in an odd color so I can see if I side loaded a "simulator build" to the device by mistake.)

    if((availableStatBT && Sys.getDeviceSettings().phoneConnected)||inSim||!availableStatBT)

    As a second note, there is a bug in the current (1.1.1) simulator, that after any 10 makeJson calls, the simulator crashes. It's not your code!