Getting Error -103 when calling makeJsonRequest

Hi,

when I call function makeJsonRequest I always get the Error -103 (BLE_UNKNOWN_SEND_ERROR) in function onReceive:

using Toybox.Communications as Comm;
...
Comm.makeJsonRequest("www.openligadb.de/.../1", {}, {}, method(:onReceive));
...


If I use the URL (http://www.openligadb.de/api/getmatchdata/bl1/2015/1) in a Browser and validate the JSON Return String with JSONLint (http://jsonlint.com/) it says it is valid. So what am I doing wrong?

Thanks,
Joerg
  • Is your Garmin device paired to a device running Garmin Connect Mobile when you initiate the request?
  • If you're getting this error immediately after calling makeJsonRequest(), then my guess is that Travis is correct in that you're not connected to GCM. If you go to the bluetooth settings on the watch, does it say it is connected, bonded but no GCM, or waiting for connection? Have you also tried this on the simulator? If so, do you get this same error?
  • Checking the device settings for "phoneConnected" is the way to go when making a makeJsonRequest(). I sometime see error even while doing that, as there is a place outside my house where my phone switches from a wifi net to the cell net for data in the middle of a request, but nothing can be done about that.
  • Thanks for your answers...

    So far all of my tries run on the simulator. I don't think it is a connection problem. If I call the WebService function http://www.openligadb.de/api/getcurrentgroup/bl1 that works perfect.

    I have no idea if the amount of data could be a problem. Have anybody of you checked the return set of the WebService http://www.openligadb.de/api/getmatchdata/bl1/2015/1 ? Is that too many data?

    Best regards,
    Jörg
  • It I think the response probably contains too much data, but it looks like you're right on the line. Brian explained it well over on this post:

    ...the memory limit for the application would make receiving a response [of 50K] almost theoretically impossible. Also, because the has to be converted into a MonkeyC object from the byte stream that is received, you will effectively need memory available in your app space about twice the size of your request to properly receive it.

    The transfer mechanism on the devices currently can't handle a JSON payload of more than about 16KB. I wouldn't personally try anything more than about 10KB because data over BLE just isn't very fast on these devices. I think the data comes across (at best) somewhere between 0.5 and 1KB/sec, so even if we could handle a 50KB payload, it would take over a minute to receive.