Acknowledged
CIQQA-3224

Bitmap.initialize / setBitmap docs do not specify which inputs are not supported on older devices; simulator does not reflect lack of support either

For example, afaict:

- For CIQ 3.1.* (e.g. fr935), it's not possible to pass in anything other than a resource ID to Bitmap.initialize / setBitmap(). (Then again, maybe it's possible that initialize / setBitmap() also accept a BitmapResource but not a BufferedBitmap. Sure wish there was a way to know for sure by looking at the docs!)

- For CIQ 3.4.* (e.g. fenix6pro), it's not possible to pass in a BufferedBitmap to Bitmap.initialize / setBitmap(). 

However:

- the docs absolutely do not make this clear

- For fenix6pro, if you pass in a BufferedBitmap to Bitmap.initialize / setBitmap, you will get a runtime error in the sim (and probably the real device) about getHeight / getWidth not existing on BufferedBitmap (at least this part is documented). However, if you "cheat" and subclass BufferedBitmap to add getHeight and getWidth, the sim will act like it works, but a real device will crash with an unexpected type error saying that either a Number or BitmapResource was expected. (Despite the lack of a stack trace, this almost certainly refers to setBitmap only supporting a res id / symbol or a bitmap resource.)

- if you pass in a BufferedBitmap (subclassed to add getHeight / getWidth) to Bitmap.initialize()'s :bitmap option on fr935, the simulator acts as if everything is fine and works as expected when you draw the bitmap. On a real device, it does not work properly. (It doesn't crash, but the bitmap isn't drawn either. I'm guessing the reason it doesn't crash in the same way as fenix6pro is because fr935 is so old it doesn't even know about the :bitmap option)

Expected behaviour:

- the docs specify which option keys/values/value types are valid for Bitmap.initialize / setBitmap, based on CIQ version. I have no idea which of the locX, locY, etc. options are valid for fenix6pro, for example [*]. I'm fairly sure that nothing besides rezId is valid for fr935, no thanks to the current docs tho.

[*] given that these options were added in System 4-6, when both CIQ 3 and CIQ 4 devices were supported, and clearly CIQ 4 devices have received at least one Bitmap feature that CIQ 3 devices did not get (the ability to create a Bitmap from a BufferedBitmap)

- the simulator doesn't simulate functionality related to Bitmap.initialize / setBitmap which isn't actually available on a real device

Reference:

https://forums.garmin.com/developer/connect-iq/f/discussion/411373/unexpectedtypeexception-expected-a-toybox-lang-number-or-watchui-bitmapresource

  • Can I pass in a BitmapResource as the :bitmap option in Bitmap.initialize() (or as the arg to setBitmap) for a simulated fr935? Will it appear to work in the sim but fail on a real device? I have no idea.

    Actually I'm fairly sure :bitmap will be ignored on fr935, and I'm guessing setBitmap would crash if you passed in anything other than a resource ID. But I shouldn't have to guess any of this stuff.

  • https://developer.garmin.com/connect-iq/api-docs/Toybox/WatchUi/Bitmap.html

    In contrast fr935 is on CIQ 3.1.6, and the SDK 3.1.6 docs say:

    (back then the SDK and CIQ versions were synced)

    So it seems to me that for a real fr935, only a resource ID is accepted as an input to Bitmap.initialize() / Bitmap.setBitmap.

    But based on what I've said above, there are ways to trick the simulated fr935 into accepting a BufferedBitmap subclass, which appears to work in the sim, but ofc not on a real device. Ofc it's very unusual for someone to sublcass a standard CIQ class in an attempt to "fix" certain API functionality that doesn't seem to work.

    More seriously, I can't be sure which of the other options will appear to work in the sim but not in the real device.

    Can I pass in a BitmapResource as the :bitmap option in Bitmap.initialize() (or as the arg to setBitmap) for a simulated fr935? Will it appear to work in the sim but fail on a real device? I have no idea.

    What about :locX, :locY, :width, :height, etc.? None of the options (other than :rezId and :bitmap) re even documented at all, let alone documented with information about availability on devices / CIQ versions.

    Knowing what I know now I wouldn't expect them to work on a real fr935, but idk if they would work in the sim, and I don't see how a new dev would know not to use them for old devices.