BaseApp

lumin. BaseApp

Base class for Lumin Runtime apps.

Methods

addNamed6DOFPoseAction(a_actionName) → {number}

Maps Control's 6DoF to a NamedInputEventData.

Parameters:
Name Type Description
a_actionName string

The name of the NamedInputEventData.

Returns:

The Id that can be used to identify this event when received in the eventListener

Type
number

addNamedButtonAction(a_actionName, a_keyCode, a_longPressopt) → {number}

Maps a Control button to a NamedInputEventData.

Parameters:
Name Type Attributes Default Description
a_actionName string

The name of the NamedInputEventData.

a_keyCode lumin.input.KeyCodes

The button's key code

a_longPress boolean <optional>
false

Whether the event should be emitted on long press (true) or short press (false)

Returns:

The Id that can be used to identify this event when received in the eventListener

Type
number

addNamedEyeTrackingAction(a_actionName) → {number}

Maps eye tracking events to a NamedInputEventData.

Parameters:
Name Type Description
a_actionName string

The name of the NamedInputEventData.

Returns:

The Id that can be used to identify this event when received in the eventListener

Type
number

addNamedHandGestureAction(a_actionName, a_handGesture, a_holdopt, a_onceopt, a_handIndexopt) → {number}

Maps the hand gesture to a NamedInputEventData.

Parameters:
Name Type Attributes Default Description
a_actionName string

The name of the NamedInputEventData.

a_handGesture lumin.input.GestureType

Hand gesture type.

a_hold boolean <optional>
false

Whether the event should be sent immediately (true), or send only if the
gesture is held for 1.5 seconds (false).

a_once boolean <optional>
true

Whether the event should be repeated (true), or send only once (false).

a_handIndex number <optional>
0xFFFFFFFF

Hand index that the event should be associated with
(Left = 0, Right = 1, Both = 0xFFFFFFFF).

Returns:

The Id that can be used to identify this event when received in the eventListener.

Type
number

addNamedTouchAction(a_actionName, a_touchGesture, a_touchDirectionopt) → {number}

Maps a Control gesture to a NamedInputEventData.

Parameters:
Name Type Attributes Default Description
a_actionName string

The name of the NamedInputEventData.

a_touchGesture lumin.input.GestureType

Touch gesture type.

a_touchDirection lumin.input.GestureDirection <optional>
input.GestureDirection.UNKNOWN

Gesture's direction (GestureDirection::UNKNOWN for all).

Returns:

The Id that can be used to identify this event when received in the eventListener

Type
number

checkPrivilege(privilegeId) → {lumin.PrivilegeResult}

Checks if a privilege is currently granted.

Parameters:
Name Type Description
privilegeId lumin.PrivilegeId

The privilege ID to check

Returns:

Granted or Denied

Type
lumin.PrivilegeResult

deInit() → {number}

Override this method to do one-time de-initialization before quitting.

Returns:
Type
number

deletePrism(prism)

Deletes the prism

Parameters:
Name Type Description
prism lumin.Prism

the Prism to delete

dismissAllNotifications()

Dismss all notifications from this application

dismissNotification(notification) → {boolean}

Dismiss the given notification

Parameters:
Name Type Description
notification lumin.Notification

the notification to dismiss

Returns:

true if the notification was dismissed, false otherwise

Type
boolean

eventListener(a_pEvent) → {boolean}

Override this method to react to incoming events

Note: This is triggered on the same thread as the clientUpdateThread

Parameters:
Name Type Description
a_pEvent lumin.ServerEvent

Server Events

Returns:

true = Event has been consumed

Type
boolean

getComponentName() → {string}

Returns the name of the component this application instance belongs to.

Returns:
Type
string

getCurrentLocaleHelper() → {lumin.utils.LocaleHelper}

Gets the LocaleHelper that's set to the current system locale

Returns:

the current system LocaleHelper

Type
lumin.utils.LocaleHelper

getFloorHeight() → {number}

Returns the height (y-value) of the floor, if known, in world coordinates.

Returns:

Returned floor height.

Type
number

getHeadposeConfidence() → {number}

Get the underlying system's confidence in the headpose values

Returns:

a value between 0.0 and 1.0 indicating the confidence

Type
number

getHeadposeError() → {lumin.headtracking.Error}

Get the current headpose error (if any)

Returns:

the current headpose error

Type
lumin.headtracking.Error

getHeadposeMode() → {lumin.headtracking.Mode}

Get the current headpose mode (6-DOF or 3-DOF)

Returns:

the current headpose mode

Type
lumin.headtracking.Mode

getHeadposeWorldForwardVector() → {vec3}

Get the Headpose forward vector in world space.

Returns:

the world space headpose forward vector.

Type
vec3

getHeadposeWorldPosition() → {vec3}

Get the Headpose position in world space.

Returns:

the world space headpose position.

Type
vec3

getHeadposeWorldUpVector() → {vec3}

Get the Headpose up vector in world space.

Returns:

the world space headpose up vector.

Type
vec3

getInput() → {lumin.InputHelper}

Get the input state tracking system (used to maintain the list of active input devices and track their input)

Returns:

a pointer to the input state tracking system

Type
lumin.InputHelper

getLocaleCode() → {string}

Get the system locale code

Returns:
Type
string

getNearestPCF(worldLocation) → {lumin.PCFId}

Returns the nearest Persistent Coordinate Frame to a given world location.
NOTE: This function can be slow, use sparingly.

Parameters:
Name Type Description
worldLocation vec3

Position to get the PCF from.

Returns:

The PCF. If it is INVALID_PCF, it is likely the world mesh hasn't been built up enough
to create the PCF data, or the app doesn't have the PcfRead privilege set.

Type
lumin.PCFId

getPackageName() → {string}

Returns the package name for this application.

Returns:
Type
string

getPackagePath() → {string}

Returns the application's path

Returns:
Type
string

getPCFCount() → {number}

Returns the number of Persistent Coordinate Frames the system knows about.

Returns:

The PCF count.

Type
number

getPCFData(pcf) → {lumin.PCFData}

Gets data associated with a given PCF.

Parameters:
Name Type Description
pcf lumin.PCFId

The PCF to fetch data for.

Returns:

PCF data. Check the state value of the returned data to verify that it is good.

Type
lumin.PCFData

getPCFs() → {Array.<lumin.PCFId>}

Returns a list of the Persistent Coordinate Frames the system knows about. It is suggested that
this function should only be called when getPCFCount() > 0 and has changed since the previous call.

Returns:

PCF list.

Type
Array.<lumin.PCFId>

getPreloadedResources() → {lumin.resources.Preloaded}

Get an object clients can use to find preloaded resources.

Returns:
Type
lumin.resources.Preloaded

getPrism(prismId) → {lumin.Prism}

Returns pointer to the Prism

Parameters:
Name Type Description
prismId BigInt

the Id of the Prism

Returns:

The prism

Type
lumin.Prism

getPrismPosition(a_prism) → {vec3}

Returns the position of a volume in world space

Parameters:
Name Type Description
a_prism lumin.Prism

the prism

Returns:
  • the prism position
Type
vec3

getPrismRotation(a_prism) → {quat}

Returns the rotation of a volume in world space

Parameters:
Name Type Description
a_prism lumin.Prism

the prism

Returns:
  • the prism orientation quaternion
Type
quat

getPrismTransform(a_prism) → {mat4}

Returns the transform of a volume in world space

Parameters:
Name Type Description
a_prism lumin.Prism

the prism

Returns:

The transform of the Prism in world space

Type
mat4

getTempPath() → {string}

Returns the application's path for temporary files

Returns:
Type
string

getVisibleName() → {string}

Returns the user-visible name for this application.

Returns:
Type
string

getWritablePath() → {string}

Returns the application's writable path.

This folder is accessible to the application when the user has logged in once,
even if the device is locked and not in use.
An application that needs to write data when running in the background
(e.g. a music app) should use this path. The same application can continue
using this path when the device is unlocked afterwards.

Returns:
Type
string

getWritablePathWhenUnlocked() → {string}

Returns the application's writable path while unlocked.

This folder is accessible to the application when the user has logged in and the
device is unlocked and being used.

Returns:
Type
string

isImageTrackingReady() → {boolean}

Returns if the image tracking system is ready to be used. Do not call any image tracking functions
until this function returns true.

Currently image tracking is only available for immersive apps.

Returns:

true if we can start tracking images.

Type
boolean

isInternetConnected() → {boolean}

Get Internet Connection status.
return True if there is a connection, otherwise false.

Returns:
Type
boolean

isShareableApp() → {boolean}

Returns if the app running is a Shareable app

Returns:
Type
boolean

isWiFiConnected() → {boolean}

Get WiFi Connected status.
return True if there is a connection, otherwise false.

Returns:
Type
boolean

isWiFiEnabled() → {boolean}

Get WiFi Enabled status.
return True if Wifi is enabled in settings, otherwise false.

Returns:
Type
boolean

lockCurrentLocaleHelperToLocale(localeCode)

Lock the LocaleHelper to the given locale. It will no longer change when the system locale is changed

Parameters:
Name Type Description
localeCode string

the lock that the LocaleHelper will be locked to

onAppPause()

The app should backup its data to disk and be prepared to be
killed if the system thinks it is necessary. It should also
stop drawing to the surface since it will not be rendered.

onAppResume()

The app can resume drawing to the surface and recover the
resources it stashed during onPause()

onAppStart(initArg)

Entry point for all application launch requests.

This method will be called right after init() on first application launch.
It will also be called whenever an attempt is made to launch the application
again (from launcher menu, or to open a file or URI).

Parameters:
Name Type Description
initArg lumin.InitArg

The initial application argument.

onAppUnloadResources()

The app should release resources that it is not actively using
to reduce the load on the system

onDeviceActive()

This indicates to the app that the device has transtioned to the active mode

onDeviceReality()

This indicates to the app that the device has transitioned to the reality mode

onDeviceStandby()

This indicates to the app that the device has transitioned to the standby mode

onSharingStart(sessionId, sceneGraphIDs)

Override this method to receive sharing start callback

Parameters:
Name Type Description
sessionId BigInt

Id associated with the sharing session that has just started

sceneGraphIDs Array.<BigInt>

Vector of SceneGraphIDs that are associated with an ongoing session

onSharingStop(sessionId)

Override this method to receive sharing stop callback

Parameters:
Name Type Description
sessionId BigInt

Id associated with the sharing session that has just stopped

orientPrism(a_prism, a_orientation)

Sets the Orientation of the Prism

Parameters:
Name Type Description
a_prism lumin.Prism

the prism

a_orientation quat

the new prism orientation quaternion

orientPrismRelativeToCamera(a_prism, a_orientation)

Sets the Orientation of the Prism relative to the Camera

Parameters:
Name Type Description
a_prism lumin.Prism

the prism

a_orientation quat

the new prism orientation quaternion

positionPrism(a_prism, a_position)

Sets the Prism Position

Parameters:
Name Type Description
a_prism lumin.Prism

the prism

a_position vec3

the new prism position

positionPrismRelativeToCamera(a_prism, a_position)

Sets the Prism Position relative to the camera

Parameters:
Name Type Description
a_prism lumin.Prism

the prism

a_position vec3

the new prism position, relative to the camera

postNotification(notification) → {boolean}

Post the given notification

Parameters:
Name Type Description
notification lumin.Notification

the notification to post

Returns:

true if the notification was posted successfully, false otherwise

Type
boolean

quit()

The application will terminate on the next update loop when this is called.

raycastNodes(a_prism, a_rayStart, a_rayEnd) → {lumin.RayCastResultLight}

Do a raycast in a prism and return the results.

Parameters:
Name Type Description
a_prism lumin.Prism

Prism to do the ray in.

a_rayStart vec3

Ray starting position, in volume coordinates.

a_rayEnd vec3

Ray end position, in volume coordinates.

Returns:

Hit data.

Type
lumin.RayCastResultLight

registerOnLocaleChangedCallback(callbackFunction) → {lumin.utils.CallbackID}

Register a callback for when the system locale is changed

Parameters:
Name Type