Is there a way to know which devices have Attention.ToneProfile?

I know I can use Attention has :ToneProfile in the CODE, but I'd rather spare the unfunctional parts fro the user by not displaying the relevant SETTINGS for devices that don't have it. For this I'd need a way to generate the monkey.jungle either : 

<device>.resourcePath=${<device>.resourcePath};features/no_tone_profile
or
<device>.resourcePath=${<device>.resourcePath};features/tone_profile
Is there a way to get his information using some script (from the SDK's device folder)? Or only by manually copying it from the documentation?
  • Each device folder has a file called {device id}.debug.xml, which contains the text "ToneProfile" if and only if the device supports Attention.ToneProfile.

    From the SDK Devices folder (in macOS terminal, linux shell, or Windows WSL shell), you can run the following *nix shell commands (bash or zsh should work):

    (Skip to the lines starting with White check mark if you're only interested in the commands you need for the end result, as opposed to "background info" stuff.)

    - Determine the number of files named "*.debug.xml" (there's one for each device):

    # find . -name "*.debug.xml" | wc -l

         136

    - List the path of each "*.debug.xml" file, in sorted order

    # find . -name "*.debug.xml" | sort

    ./approachs60/approachs60.api.debug.xml
    ./approachs62/approachs62.api.debug.xml
    ./approachs7042mm/approachs7042mm.api.debug.xml
    ./approachs7047mm/approachs7047mm.api.debug.xml
    ...

    - List the number of "*.debug.xml" files which contain the text "ToneProfile":

    # grep -R ToneProfile -l --include="*.debug.xml" | wc -l
         110

    - List the number of "*.debug.xml" files which do not contain the text "ToneProfile":

    # grep -R ToneProfile -l --include="*.debug.xml" -L | wc -l
          26

    - List the path of each file containing the text "ToneProfile":

    # grep -R ToneProfile -l --include="*.debug.xml" | sort

    ./approachs7042mm/approachs7042mm.api.debug.xml
    ./approachs7047mm/approachs7047mm.api.debug.xml
    ./d2airx10/d2airx10.api.debug.xml
    ...

    White check mark List each device ID with ToneProfile support:

    # grep -R ToneProfile -l --include="*.debug.xml" | sort | cut -d/ -f2

    approachs7042mm
    approachs7047mm
    d2airx10
    ...

    White check mark List each device ID without ToneProfile support:

    # grep -R ToneProfile -l --include="*.debug.xml" -L | sort | cut -d/ -f2

    approachs60
    approachs62
    d2air
    legacyherocaptainmarvel
    legacyherofirstavenger
    legacysagadarthvader
    legacysagarey
    venu
    venu2
    venu2s
    venu2system6preview
    venud
    venusq
    venusq2
    venusq2m
    venusqm
    vivoactive
    vivoactive3
    vivoactive3d
    vivoactive3m
    vivoactive3mlte
    vivoactive4
    vivoactive4s
    vivoactive5
    vivoactive_hr
    vivolife

    You should be able to pass the lists generated by the latter two commands to your script/program which generates monkey.jungle (or incorporate those commands in your script.)

  • Thanks!

    Here's my customized version:

    #!/usr/bin/env bash
    METHOD="$1"
    EXCLUDE_ANNOTATION="${2:-$1}"
    
    if [ x"${METHOD}" == x"" ]; then
        echo "Usage: $0 <methodName>" [<excludeAnnotation>]
        exit 1
    fi
    
    DEVICES_DIR="${CIQ_SDK_HOME}/Devices"
    
    (cd "${DEVICES_DIR}" ; grep -R "${METHOD}" -l --include="*.debug.xml" | sort | cut -d/ -f2 | sed -e "s#\$#:no_${EXCLUDE_ANNOTATION}#" ; \
    grep -R "${METHOD}" -l --include="*.debug.xml" -L | sort | cut -d/ -f2 | sed -e "s#\$#:${EXCLUDE_ANNOTATION}#") | sort
    

  • This is the example from the SDK documentation:

    // Play a predefined tone
    if (Attention has :playTone) {
       Attention.playTone(Attention.TONE_LOUD_BEEP);
    }
    
    // Use an array of ToneProfile objects to build and play a custom tone
    if (Attention has :ToneProfile) {
        var toneProfile =
        [
            new Attention.ToneProfile( 2500, 250),
            new Attention.ToneProfile( 5000, 250),
            new Attention.ToneProfile(10000, 250),
            new Attention.ToneProfile( 5000, 250),
            new Attention.ToneProfile( 2500, 250),
        ];
        Attention.playTone({:toneProfile=>toneProfile});
       }
    

    It's not clear if we need to check for both playTone and ToneProfile or one of then is sufficient.

    Based on the debug.xml-s either one of them should be enough, because either both are defined or both aren't.