C++ Java Unity
C++ Reference
Device Class Referenceabstract

Detailed Description

Singleton representation of the device Vuforia is currently running on.

Vuforia supports many different hardware configurations, from mobile apps running on standard mobile or handheld hardware, VR enclosures for mobile phones, and dedicated VR and AR eyewear devices.

This class a provides management and configuration functions for the specific configuration (viewer) that Vuforia is currently running on.

Changes made here primarily affect how the RenderingPrimitives are created and structured.

Inheritance diagram for Device:
NonCopyable EyewearDevice

Public Types

enum  MODE {
  MODE_AR = 0,
  MODE_VR
}
 

Public Member Functions

virtual Type getType () const =0
 Get the Type of this instance (may be a subclass of Device). More...
 
virtual bool isOfType (Type type) const =0
 Get whether this Device instance's type equals or has been derived from the given type. More...
 
virtual bool setMode (MODE m)=0
 Set the rendering mode. More...
 
virtual MODE getMode () const =0
 Get the current rendering mode. More...
 
virtual void setViewerActive (bool active)=0
 Activate or deactivate the selected viewer. More...
 
virtual bool isViewerActive () const =0
 Returns true if a viewer is active, false otherwise. More...
 
virtual ViewerParametersListgetViewerList ()=0
 Get the list of ViewerParameters known to the system. More...
 
virtual bool selectViewer (const ViewerParameters &vp)=0
 Select the viewer to use. More...
 
virtual ViewerParameters getSelectedViewer () const =0
 Get the ViewerParameters for the currently selected viewer. More...
 
virtual void setConfigurationChanged ()=0
 Tell Vuforia that the configuration has changed, so new RenderingPrimitives need to be generated. More...
 
virtual const RenderingPrimitives getRenderingPrimitives ()=0
 Get a copy of the RenderingPrimitives for the current configuration. More...
 

Static Public Member Functions

static DevicegetInstance ()
 Get the singleton instance. More...
 
static Type getClassType ()
 Get the Type for class "Device". More...
 

Member Enumeration Documentation

enum MODE
Enumerator
MODE_AR 

Augmented Reality (AR) mode. Implies a video see-through mode (video background from a live camera feed), or an optical see-through mode (using see-through eyewear).

MODE_VR 

Virtual Reality (VR) mode. Implies a purely "virtual" experience, i.e. an experience without any visual representation of the user's physical environment.

Member Function Documentation

static Device& getInstance ( )
static

Get the singleton instance.

This function can be used immediately after Vuforia::init() has succeeded. See the "Lifecycle of a Vuforia app" section on the main Vuforia reference page for more information. Lifecycle of a Vuforia app

static Type getClassType ( )
static

Get the Type for class "Device".

virtual Type getType ( ) const
pure virtual

Get the Type of this instance (may be a subclass of Device).

virtual bool isOfType ( Type  type) const
pure virtual

Get whether this Device instance's type equals or has been derived from the given type.

virtual bool setMode ( MODE  m)
pure virtual

Set the rendering mode.

Note
It is not possible to set the mode to AR until a CameraDevice has been initialised.
Calling this method changes the RenderingPrimitives. If you have cached the result of a previous call to getRenderingPrimitives(), you will need to retrieve new RenderingPrimitives by calling getRenderingPrimitives() again.
Returns
true if the mode was set, otherwise false (check application logs for failure details).
virtual MODE getMode ( ) const
pure virtual

Get the current rendering mode.

virtual void setViewerActive ( bool  active)
pure virtual

Activate or deactivate the selected viewer.

The viewer to activate must first be selected with selectViewer().

Note
Calling this method changes the RenderingPrimitives. If you have cached the result of a previous call to getRenderingPrimitives(), you will need to retrieve new RenderingPrimitives by calling getRenderingPrimitives() again.
virtual bool isViewerActive ( ) const
pure virtual

Returns true if a viewer is active, false otherwise.

virtual ViewerParametersList& getViewerList ( )
pure virtual

Get the list of ViewerParameters known to the system.

virtual bool selectViewer ( const ViewerParameters vp)
pure virtual

Select the viewer to use.

Parameters
vpViewerParameters for the viewer, either one taken from getViewerList() or using CustomViewerParamaters .
Returns
true on success, otherwise false (check application logs for failure details).
virtual ViewerParameters getSelectedViewer ( ) const
pure virtual

Get the ViewerParameters for the currently selected viewer.

virtual void setConfigurationChanged ( )
pure virtual

Tell Vuforia that the configuration has changed, so new RenderingPrimitives need to be generated.

virtual const RenderingPrimitives getRenderingPrimitives ( )
pure virtual

Get a copy of the RenderingPrimitives for the current configuration.

The RenderingPrimitives returned from this function are immutable, and tailored to the current device environment.

RenderingPrimitives can be retrieved at the earliest after the first call to Vuforia::onSurfaceChanged().

New RenderingPrimitives will be created whenever the device environment changes in one of the following ways:

If you have cached a copy of the RenderingPrimitives and you make any of the above changes, you will need use this method to get an updated copy of the RenderingPrimitives that reflects the new device environment.

Note
Platform-specific lifecycle transitions (e.g. Pause/Resume) may also cause the configuration to change, so it is advisable to retrieve new RenderingPrimitives after those transitions.
If AR mode has been requested via setMode(), RenderingPrimitives will not be valid until a CameraDevice has been initialised.
This method returns a copy, which has an associated cost. Performant apps should avoid calling this method if the configuration has not changed.