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

Parents
  • 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? 
Comment
  • 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? 
Children
No Data