yodaRT. AppRuntime

new AppRuntime()

Members

shouldWelcome

  1. determines if welcome announcements are needed

shouldWelcome

reset should welcome so that welcome effect could be played on re-login

Methods

init() → {Promise.<void>}

Start AppRuntime

Returns:
Type:
Promise<void>

deinit()

Deinit runtime.

componentsInvoke(method, args)

Invokes method on each component if exists with args.

Parameters:
Name Type Description
method string

method name to be invoked.

args Array.<any>

arguments on invocation.

loadApps()

Load applications.

initiate()

Initiate/Re-initiate runtime configs

startDaemonApps()

Start the daemon apps.

handlePowerActivation()

Handle power button activation.

  • if not connected to network yet, disable bluetooth broadcast.
  • if there are apps actively running, terminates all apps.
  • otherwise set device actively pickup.

hasBeenDisabled(reasonopt) → {boolean}

Determines if runtime has been disabled for specific reason or just has been disabled.

Parameters:
Name Type Attributes Description
reason string <optional>
Returns:
Type:
boolean

getDisabledReasons() → {Array.<string>}

Get all reasons for disabling runtime.

Returns:
Type:
Array.<string>

disableRuntimeFor(reason) → {boolean}

Disable runtime for reason.

Effects:

  • Turen wake up engine would be disabled.
  • Network events would be ignored.
  • Battery events would be ignored.
  • Application could not be opened through dispatching.
Parameters:
Name Type Description
reason string
Returns:
Type:
boolean

if reason was successfully added to memo.

enableRuntimeFor(reason) → {boolean}

Remove previously disabling runtime reason. Would enable runtime if there is no reason remaining.

Parameters:
Name Type Description
reason string
Returns:
Type:
boolean

if reason was successfully removed from memo.

idle()

Put device into idle state. Terminates apps in stack (i.e. apps in active and paused).

Also clears apps' contexts.

hibernate()

Put device into hibernation state.

wakeup(optionsopt)

Wake up device from hibernation.

Parameters:
Name Type Attributes Description
options object <optional>
Name Type Attributes Default Description
shouldWelcome boolean <optional>
false

if welcoming is needed after re-logged in

playLongPressMic()

play longPressMic.js if long press mic is bigger than 2 second.

stopLongPressMicLight()

Stop light if long press between 2 and 7 second.

resetNetwork(optionsopt)

Reset network and start procedure of configuring network.

Parameters:
Name Type Attributes Description
options object <optional>
Name Type Attributes Description
removeAll boolean <optional>

remove local wifi config?

startMonologue(appId, options)

Start a session of monologue. In session of monologue, no other apps could preempt top of stack.

Note that monologues automatically ends on unexpected exit of apps.

Parameters:
Name Type Description
appId string
options object
Name Type Attributes Default Description
allowCut boolean <optional>
true

allows the cut skill.

stopMonologue(appId)

Stop a session of monologue started previously.

Parameters:
Name Type Description
appId string

openUrl(url, optionsopt) → {Promise.<boolean>}

Note: currently only yoda-skill: scheme is supported.

Parameters:
Name Type Attributes Description
url string
options object <optional>
Name Type Attributes Default Description
form 'cut' | 'scene' <optional>
'cut'
preemptive boolean <optional>
true
carrierId string <optional>
Returns:
Type:
Promise<boolean>

dispatchNotification(channel, params, optionsopt)

Dispatches a notification request to apps registered for the channel.

Parameters:
Name Type Attributes Description
channel string
params Array.<any>
options object <optional>
Name Type Attributes Default Description
filterOption 'active' | 'running' | 'all' <optional>
'all'

setForegroundById(appId, optionsopt)

Parameters:
Name Type Attributes Description
appId string
options object <optional>
Name Type Attributes Default Description
form 'cut' | 'scene' <optional>
'cut'

running form of the activity.

skillId string <optional>

update cloud skill stack if specified.

setMicMute(mute, optionsopt)

Parameters:
Name Type Attributes Description
mute boolean

set mic to mute, switch mute if not given.

options object <optional>
Name Type Attributes Description
silent boolean <optional>

resetServices(optionsopt)

Parameters:
Name Type Attributes Description
options object <optional>
Name Type Attributes Default Description
lightd boolean <optional>
true
ttsd boolean <optional>
true
multimediad boolean <optional>
true

exitAppById(appId, optionsopt)

Parameters:
Name Type Attributes Description
appId string
options object <optional>
Name Type Attributes Description
clearContext boolean <optional>

also clears contexts

ignoreKeptAlive boolean <optional>

ignore contextOptions.keepAlive

onForward(message)

handle mqtt forward message

Parameters:
Name Type Description
message string

string receive from mqtt

unBindDevice()

handle mqtt unbind topic

onResetSettings()

recover the default settings, it reboots when the request is done.

setStartupFlag()

Set a flag which informs startup service that it is time to boot other services.

isStartupFlagExists() → {boolean}

Determines if startup flag has been set. WARNING: This is a synchronous function.

Returns:
Type:
boolean