Any fix for makeImageRequest on CIQ 4+ devices?

I have a function that calls makeImageRequest in the background, and updates the watch face with the image when it is received. This works perfectly in the sim for a "Captain Marvel" watch so I know that the code can and does work, but I get this on the Fenix 7x sim:

When using SDK 7:

Error: Exception occurred
Details: failed inside handle_image_callback
Exception: Class usage is not allowed for the current app type.

It seems to me that because calls to makeWebRequest work on every device I've tested and makeImageRequest works on some devices that this error message about class usage is a red herring.

With SDK 6 I get this instead:

Error: Out Of Memory Error
Details: failed inside handle_image_callback
Stack:

Is there any hope that this will be fixed?

  • No, but if you have one that you know works I'll give it a try. However, the response is coming from Garmin servers, not the original server of the image. Garmin is doing some magic apparently before it's forwarded to the watch.

  • The garmin server does a whole bunch, but if something is odd in the image they get, who knows. 

    Maybe the garmin server works differently for a device with a GPU..

    Someone here probably knows of one that works, as there are apps using them, I'm sure

  • Maybe the garmin server works differently for a device with a GPU..

    What I'm doing on my server works for CIQ 3, so maybe the server is doing something different for CIQ 4+. Or it's not when it should be.

    Someone here probably knows of one that works, as there are apps using them, I'm sure

    I've asked here before, but so far nobody knows or those who do know aren't saying. I've had Garmin folks pop in on my queries a time or two, maybe one of them can answer this.

  • remove :maxWidth, :maxHeight, and :packingFormat, from _cPic

    and if you save image in storage remember that each device (rather group of devices) has its own format (e.g. bitmaps from f6 cant be displayed and usually crash f7 - clear storage before using it with other device

  • remove :maxWidth, :maxHeight, and :packingFormat, from _cPic

    No effect, still broken. I've been trying the find the right combination of parameters for a while now, no combination appears to make any difference.

    each device (rather group of devices) has its own format

    Maybe true, but since the images are coming through and being processed by a Garmin server, I don't (and neither does anyone else) have any control over the internal binary format.

  • Create new app, not watch face, and try to get this picture in foreground and save into member and look into memory viewer. Maybe there is no enough memory in watch face's background.

  • In the foreground:

    2024-06-08 22:51:05 end onLayout, total memory 126912 used memory 50192 free memory 76720

    In the background:

    var l_mem = System.getSystemStats();
    logTime("rqCI total memory " + l_mem.totalMemory + " used memory " + l_mem.usedMemory + " free memory " + l_mem.freeMemory);
    Communications.makeImageRequest(v_httpURL, _httpParams, _cPic, method(:onReceiveCenterImage));

    Shows that it appears that there is enough memory:

    Background: 2024-06-08 22:55:35 rqCI total memory 61376 used memory 12720 free memory 48656

    I'm still not convinced it's memory constrained, unless the image that comes back is seriously huge.

  • No, no. Create watch app (or/and modify JSON for device - increase memory for foreground - give it 100mb :-)). Download bitmap in its foreground then in onrecive set

    MemberBmp = data;

    Look into memory viever too see the size of MemberBmp.

    Try it for device without graphic pool e.g. fenix 6.

  • Here's the really long explanation. All of these are using SDK 7.2.

    On a Captain Marvel, a CIQ 3 device with lots of memory, it works fine. Notice the 200 response code:

    2024-06-09 07:08:49 end onLayout, total memory 520000 used memory 134016 free memory 385984
    Background: 2024-06-09 07:12:42 rqCI getTimer 59888078
    Background: 2024-06-09 07:12:42 rqCI _cPic {symbol (8389660)=>[0, 5570560, 11141120, 16711680, 21760, 5592320, 11162880, 16733440, 43520, 5614080, 11184640, 16755200, 65280, 5635840, 11206400, 16776960, 85, 5570645, 11141205, 16711765, 21845, 5592405, 11162965, 16733525, 43605, 5614165, 11184725, 16755285, 65365, 5635925, 11206485, 16777045, 170, 5570730, 11141290, 16711850, 21930, 5592490, 11163050, 16733610, 43690, 5614250, 11184810, 16755370, 65450, 5636010, 11206570, 16777130, 255, 5570815, 11141375, 16711935, 22015, 5592575, 11163135, 16733695, 43775, 5614335, 11184895, 16755455, 65535, 5636095, 11206655, 16777215], symbol (8391907)=>0, symbol (8389694)=>2}
    Background: 2024-06-09 07:12:42 rqCI total memory 61376 used memory 14816 free memory 46560
    Background: 2024-06-09 07:12:44 onRCI response 200, getTimer 59889687
    
    
    

    On a Fenix 6 Pro, when there isn't enough memory, it returns with an "Out Of Memory" error:

    2024-06-09 09:40:11 end onLayout, total memory 110528 used memory 99016 free memory 11512
    Background: 2024-06-09 09:44:13 rqCI _cPic {symbol (8391907)=>0, symbol (8389694)=>2}
    Background: 2024-06-09 09:44:13 rqCI total memory 28608 used memory 14552 free memory 14056
    Background: 2024-06-09 09:44:15 onRCI response 200, getTimer 68980750
    
    Error: Out Of Memory Error
    Details: Failed invoking <symbol>
    Stack: 

    On the same Fenix 6 Pro, make the image smaller: Notice the 200 response code, but this time we get a palette error:

    2024-06-09 09:13:34 end onLayout, total memory 110528 used memory 99016 free memory 11512
    Background: 2024-06-09 09:13:55 rqCI _cPic {symbol (8391907)=>0, symbol (8389694)=>2}
    Background: 2024-06-09 09:13:55 rqCI total memory 28608 used memory 14552 free memory 14056
    Background: 2024-06-09 09:13:57 onRCI response 200, getTimer 67162640
    
    Error: Unhandled Exception
    Exception: Bitmap Palette cannot be larger than the target palette
    Stack: 
     

    Specifying a palette, it now works without error:

    2024-06-09 09:18:56 end onLayout, total memory 110528 used memory 99208 free memory 11320
    Background: 2024-06-09 09:18:58 rqCI _cPic {symbol (8389660)=>[0, 255, 43520, 43775, 65280, 5592405, 11141120, 11141375, 11184810, 16711680, 16711935, 16733440, 16755200, 16777215], symbol (8391907)=>0, symbol (8389694)=>2}
    Background: 2024-06-09 09:18:58 rqCI total memory 28608 used memory 14840 free memory 13768
    Background: 2024-06-09 09:18:59 onRCI response 200, getTimer 67464656
    
    

    On a Fenix 7X, requesting the same small image as the Fenix 6 Pro, there isn't an "Out Of Memory" error that we should expect to get if there was a memory issue. Instead we some internal error from makeImageRequest. As I posted earlier, the error was different with SDK 6.

    2024-06-09 09:21:45 end onLayout, total memory 126912 used memory 50296 free memory 76616
    Background: 2024-06-09 09:24:01 rqCI _cPic {symbol (8391907)=>0, symbol (8389694)=>2}
    Background: 2024-06-09 09:24:01 rqCI total memory 61376 used memory 12832 free memory 48544
    
    Error: Exception occurred
    Details: failed inside handle_image_callback
    Exception: Class usage is not allowed for the current app type.
    

    If it's a memory problem in CIQ 4+ then why wouldn't it say so when clearly it can?

  • You don't do what I ask... You have to know how big bitmap is, printing free memory is not enough.

    You have one code but for each device you get different bitmap because proxy change original respond according to type of device. You should specify palette to minimise differences in bitmaps (as I understand your server returns always the same bitmap independent of device).

    Problem with ciq4 device is graphic pool, nobody knows how big it is, how it runs, but system uses it always - e,g, you have free memory 500kb, bitmap 150kb but graphic pool is only 80 - system tries to put bitmap into pool and out of memory (but exception is thrown since 5.0 - OutOfGraphicsMemoryException).

    If you force proxy to return always the same bitmap you will check the size oft it on device without graphic pool and you will know how much memory you need.