VoiceGuidance

    VoiceGuidance


    Article summary


    title: VoiceGuidance

    version: 0.15.0
    layout: default
    sdk: manage

    # VoiceGuidance Module

    Version VoiceGuidance 0.15.0

    Table of Contents

    Usage

    To use the VoiceGuidance module, you can import it into your project from the Firebolt SDK:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    

    Overview

    A module for managing voice-guidance Settings.

    Methods

    enabled

    Whether or not voice-guidance is enabled.

    To get the value of enabled call the method like this:

    function enabled(): Promise<boolean>
    

    Promise resolution:

    boolean
    

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:accessibility:voiceguidance

    Examples

    Default example #1

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.enabled()
        .then(enabled => {
            console.log(enabled)
        })
    

    Value of enabled:

    true
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.enabled",
    	"params": {}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": true
    }
    

    Default example #2

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.enabled()
        .then(enabled => {
            console.log(enabled)
        })
    

    Value of enabled:

    true
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.enabled",
    	"params": {}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": false
    }
    

    To set the value of enabled call the method like this:

    function enabled(value: boolean): Promise<void>
    

    Parameters:

    ParamTypeRequiredDescription
    valuebooleantrue

    Promise resolution:

    null
    

    Examples

    Default example #1

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.enabled(true)
        .then(result => {
            console.log(result)
        })
    

    Value of result:

    null
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.setEnabled",
    	"params": {
    		"value": true
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": null
    }
    

    Default example #2

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.enabled(false)
        .then(result => {
            console.log(result)
        })
    

    Value of result:

    null
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.setEnabled",
    	"params": {
    		"value": false
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": null
    }
    

    To subscribe to notifications when the value changes, call the method like this:

    function enabled(callback: (value) => boolean): Promise<number>
    

    Promise resolution:

    number
    

    Examples

    Default example #1

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    enabled(value => {
      console.log(value)
    }).then(listenerId => {
      console.log(listenerId)
    })
    

    Value of enabled:

    true
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.onEnabledChanged",
    	"params": {
    		"listen": true
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": true
    }
    

    Default example #2

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    enabled(value => {
      console.log(value)
    }).then(listenerId => {
      console.log(listenerId)
    })
    

    Value of enabled:

    true
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.onEnabledChanged",
    	"params": {
    		"listen": true
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": false
    }
    

    listen

    To listen to a specific event pass the event name as the first parameter:

    listen(event: string, callback: (data: any) => void): Promise<number>
    

    Parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event to listen for, see Events.
    callbackfunctionYesA function that will be invoked when the event occurs.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. VoiceGuidance.clear(id)

    Callback parameters:

    ParamTypeRequiredSummary
    dataanyYesThe event data, which depends on which event is firing, see Events.

    To listen to all events from this module pass only a callback, without specifying an event name:

    listen(callback: (event: string, data: any) => void): Promise<number>
    

    Parameters:

    ParamTypeRequiredSummary
    callbackfunctionYesA function that will be invoked when the event occurs. The event data depends on which event is firing, see Events.

    Callback parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event that has occured listen for, see Events.
    dataanyYesThe event data, which depends on which event is firing, see Events.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. VoiceGuidance.clear(id)

    See Listening for events for more information and examples.

    once

    To listen to a single instance of a specific event pass the event name as the first parameter:

    once(event: string, callback: (data: any) => void): Promise<number>
    

    The once method will only pass the next instance of this event, and then dicard the listener you provided.

    Parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event to listen for, see Events.
    callbackfunctionYesA function that will be invoked when the event occurs.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. VoiceGuidance.clear(id)

    Callback parameters:

    ParamTypeRequiredSummary
    dataanyYesThe event data, which depends on which event is firing, see Events.

    To listen to the next instance only of any events from this module pass only a callback, without specifying an event name:

    once(callback: (event: string, data: any) => void): Promise<number>
    

    Parameters:

    ParamTypeRequiredSummary
    callbackfunctionYesA function that will be invoked when the event occurs. The event data depends on which event is firing, see Events.

    Callback parameters:

    ParamTypeRequiredSummary
    eventstringYesThe event that has occured listen for, see Events.
    dataanyYesThe event data, which depends on which event is firing, see Events.

    Promise resolution:

    TypeDescription
    numberListener ID to clear the callback method and stop receiving the event, e.g. VoiceGuidance.clear(id)

    See Listening for events for more information and examples.

    speed

    The speed at which voice guidance speech will be read back to the user.

    To get the value of speed call the method like this:

    function speed(): Promise<VoiceSpeed>
    

    Promise resolution:

    VoiceSpeed

    Capabilities:

    RoleCapability
    usesxrn:firebolt:capability:accessibility:voiceguidance

    Examples

    Voice guidance speed to 1

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.speed()
        .then(speed => {
            console.log(speed)
        })
    

    Value of speed:

    1
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.speed",
    	"params": {}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": 1
    }
    

    Voice guidance speed to 2

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.speed()
        .then(speed => {
            console.log(speed)
        })
    

    Value of speed:

    1
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.speed",
    	"params": {}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": 2
    }
    

    To set the value of speed call the method like this:

    function speed(value: VoiceSpeed): Promise<void>
    

    Parameters:

    ParamTypeRequiredDescription
    valueVoiceSpeedtrue
    minumum: 0.5
    maximum: 2

    Promise resolution:

    null
    

    Examples

    Voice guidance speed to 1

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.speed(1)
        .then(result => {
            console.log(result)
        })
    

    Value of result:

    null
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.setSpeed",
    	"params": {
    		"value": 1
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": null
    }
    

    Voice guidance speed to 2

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    VoiceGuidance.speed(2)
        .then(result => {
            console.log(result)
        })
    

    Value of result:

    null
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.setSpeed",
    	"params": {
    		"value": 2
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": null
    }
    

    To subscribe to notifications when the value changes, call the method like this:

    function speed(callback: (value) => VoiceSpeed): Promise<number>
    

    Promise resolution:

    number
    

    Examples

    Voice guidance speed to 1

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    speed(value => {
      console.log(value)
    }).then(listenerId => {
      console.log(listenerId)
    })
    

    Value of speed:

    1
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.onSpeedChanged",
    	"params": {
    		"listen": true
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": 1
    }
    

    Voice guidance speed to 2

    JavaScript:

    import { VoiceGuidance } from '@firebolt-js/manage-sdk'
    
    speed(value => {
      console.log(value)
    }).then(listenerId => {
      console.log(listenerId)
    })
    

    Value of speed:

    1
    
    JSON-RPC:Request:
    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"method": "VoiceGuidance.onSpeedChanged",
    	"params": {
    		"listen": true
    	}
    }
    

    Response:

    {
    	"jsonrpc": "2.0",
    	"id": 1,
    	"result": 2
    }
    

    Events

    enabledChanged

    See: enabled

    speedChanged

    See: speed


    Was this article helpful?

    What's Next