Ticket Created
over 2 years ago

WERETECH-12673

Improve documentation: Add api levels and system levels to Device Reference

Please add information about the possible system level and api level each device can have to:

https://developer.garmin.com/connect-iq/reference-guides/devices-reference/

For example:

Fenix 6:

min system: 4

max system: 5

min api: 3.2.0

max api: 3.3.*

(maybe the max values should only be set when Garmin has decided that a certain device will not get further updates)

The use case is that it can help developers to decide which devices they support. When they decided it can help optimizing code by excluding code that is "too new" for a device. For example there's no need for the following code on system 1 devices with max api level < 2.4.0, because they can never have Properties:

function setConfig(key as Application.PropertyKeyType, val as Application.PropertyValueType) {
    if (App has :Properties) {
        App.Properties.setValue(key, val);
    } else {
        App.AppBase.setProperty(key, val);
    }
}

By knowing this we can save some precious bytes in the memory if we use:

(:system2)
function setConfig(key as Application.PropertyKeyType, val as Application.PropertyValueType) {
    App.AppBase.setProperty(key, val);
}
(:system3)
function setConfig(key as Application.PropertyKeyType, val as Application.PropertyValueType) {
    if (App has :Properties) {
        App.Properties.setValue(key, val);
    } else {
        App.AppBase.setProperty(key, val);
    }
}

  • Sorry to comment on a very old bug report, but since it was linked in a recent post:

    > But how can I know the minimum api of each device? 

    As discussed previously, you can know the minimum API of each device, from the perspective of any given build of a CIQ app. The store will refuse to install your app if it doesn't have (at a minimum) the connectIQVersion specified in compiler.json for your device and part number. Therefore, that build of your app will never see any CIQ version lower than the one in compiler.json (at the time of the build).

    For all practical purposes, this is effectively indistinguishable from knowing the minimum API level of a device. For example, if I build a new app or update an existing app for fr955 today, fr955's compiler.json specifies that the minimum CIQ version is effectively 5.0.0. It doesn't matter that it used to be 4.2.x in compiler.json, or that some fr955s in the wild may still have 4.2.x (and perhaps their owners have no intention of upgrading.) Those fr955s with CIQ < 5.0.0 basically don't exist as far as that build of your app is concerned, because that build cannot be installed on those devices (unless the devices receive the requisite firmware upgrade).

    Details:

    In the compiler.json file for any given device, each partNumber entry has a key called connectIQVersion, which is a string containing a CIQ version (such as "5.0.1"). It also has a corresponding firmwareVersion, which should be the (minimum) firmware version which supports the aforementioned CIQ version.

    When you build and export a CIQ app, for each supported part number, connectIQversion and firmwareVersion are baked into the manifest file.

    When a user tries to install that build of your app, the store will check your device to ensure it has the minimum required firmware version (and hence, the minimum required CIQ version). If it doesn't, the user will get a message stating they need to upgrade their device.

  • Here's an example to demonstrate the limitations of the knowledge we currently can get. In this tool (https://forums.garmin.com/developer/connect-iq/f/showcase/298405/garmin-dev-tools) the scripts extract the data from compiler.json in the Devices folder. For example partNumbers[].connectIQVersion The problem with this is that today I updated many devices in the SDK Manager, and Montana 7xx was changed from 3.1.6 to 3.2.1 so when I generated the csv files now it "looks" as montana7xx devices only have CIQ 3.2.1 while in reality at least some of them are probably still using 3.1.6.

    I guess the only way to get the real minConnectIQVersion would be if Garmin provided it somehow...

    Garmin, can you maybe add a new field in compiler.json? For example in each partNumber add minimumConnectIQVersion next to connectIQVersion.

  • The problem is this: in https://developer.garmin.com/connect-iq/api-docs/Toybox/Lang/Array.html#add-instance_function you see that Array.add was added in 1.3.0, so in the 1 place I want to use that I now have this code:

        (:no_api1_3, :no_api2, :inline)
        hidden function arrayAdd(array as Array, item as Object) as Array {
            var size = array.size();
            var newArray = new[size + 1];
            var i;
            for (i = 0; i < size; i++) {
                newArray[i] = array[i];
            }
            newArray[i] = item;
            return newArray;
        }
        (:api1_3, :inline)
        hidden function arrayAdd(array as Array, item as Object) as Array {
            return array.add(item);
        }
    
        // and use it in 1 place:
        // arr.add(sensor); // this doesn't work on old devices
        arr = arrayAdd(arr, newItem);

    But from the documentation I could find: https://developer.garmin.com/connect-iq/compatible-devices/ it's impossible to find out the MINIMUM api each device has. I need to know the minimum api in order to put the devices that can have CIQ less than 1.3 to the monkey.jungle file:

    base.excludeAnnotations = base;no_api1_3;no_api2;memory16K;black_and_white

    # API 1.2.0, memory16K
    epix.excludeAnnotations = base;api1_3;api2;memory32K

    # API 1.3.0, memory16K
    d2bravo_titanium.excludeAnnotations = base;no_api1_3;api2;memory32K
    d2bravo.excludeAnnotations = base;no_api1_3;api2;memory32K
    fenix3_hr.excludeAnnotations = base;no_api1_3;api2;memory32K
    fenix3.excludeAnnotations = base;no_api1_3;api2;memory32K
    fr230.excludeAnnotations = base;no_api1_3;api2;memory32K
    fr235.excludeAnnotations = base;no_api1_3;api2;memory32K
    fr630.excludeAnnotations = base;no_api1_3;api2;memory32K
    fr920xt.excludeAnnotations = base;no_api1_3;api2;memory32K
    vivoactive.excludeAnnotations = base;no_api1_3;api2;memory32K

    However I just discovered by looking at the compatible-devices list again that it was updated recently, and for example Fenix 6 now has api 3.3.0 which "unfortunately" clarifies that the apis listed on that page are not the minimum but the maximum api a device can have. But how can I know the minimum api of each device? 
  • Yeah, but not having "double" code saves some precious bytes, that makes it possible to shrink the code enough to almost fit into 16K with some jungle magic.