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);
    }
}

  • 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.

  • With my apps, I usually use a min API level of 1.2, and based on which target devices I enable, can exclude some things - Like Garmin weather.  I don't even have targets that won't be 3.2.x or greater.  And even then, use "has" where needed  (if (Toybox has :Weather) {}), as that handles things like APAC devices that might not have something "today" but will next week, and I don't have to change anything.  The app adjusts without me worrying about the APAC FW releases....

    I think you're worrying about things you don't need to worry about with proper coding.