7 API Interface Function List¶
7.1 Unity related¶
Please find APIs provided by UnityXR plugins at https://docs.unity3d.com/Manual/VRReference.html
Currently supported modules:
XRDisplaySubsystem :https://docs.unity3d.com/Manual/xrsdk-display.html
XRInputSubsystem :https://docs.unity3d.com/Manual/xrsdk-input.html
XRNodeState :https://docs.unity3d.com/ScriptReference/XR.XRNodeState.html
XRSettings:https://docs.unity3d.com/ScriptReference/XR.XRSettings.html
XRStats:https://docs.unity3d.com/ScriptReference/XR.XRStats.html
7.2 Controller related¶
PXR_input:Class that define controller related APIs.
Fig 7.1 Input script
IsControllerConnected¶
Function name: public static bool IsControllerConnected(Controller controller)
Functions: Get the connection status of controller
Parameter:
- Controller controller: controller enum for left and right hand
public enum Controller
{
LeftController, // left controller
RightController, // right controller
}
Return value: True - connected, false - not connected
Method of calling: PXR_Input.IsControllerConnected (controller)
SetControllerVibration¶
Function name: public static void SetControllerVibration(float strength, int time, Controller controller)
Functions: Vibrate the controller. To stop the vibration in the middle, call the interface again and pass strength=0.
Parameter:
- float strength: vibration strength: 0-1
- int time: time of duration (unit: ms); 0-65535ms
- Controller controller: controller enum for left and right hand
public enum Controller
{
LeftController, // left controller
RightController, // right controller
}
Return value: None
Method of calling: PXR_Input.SetControllerVibration (strength, time, controller)
GetControllerPredictPosition¶
Function name: public static Vector3 GetControllerPredictPosition(Controller controller, float predictTime)
Functions: Acquire predicted position of controller
Parameter:
- Controller controller: controller enum for left and right hand
public enum Controller
{
LeftController, // left controller
RightController, // right controller
}
- double predictTime: time to predict (in milliseconds)
Return value: Predicted position value
Method of calling: PXR_Input.GetControllerPredictPosition(controller, predictTime)
GetControllerPredictRotation¶
Functions: public static Quaternion GetControllerPredictRotation(Controller controller, float predictTime)
Functions: Acquire predicted rotation of controller
Parameter:
- Controller controller: controller enum for left and right hand
public enum Controller
{
LeftController, // left controller
RightController, // right controller
}
- double predictTime: time to predict (in milliseconds)
Return value: Predicted position value
Method of calling: PXR_Input.GetControllerPredictRotation(controller, predictTime)
SetControllerOriginOffset¶
Function name: public static void SetControllerOriginOffset(Controller controller, Vector3 offset)
Functions: Add an offset to controller origin
Parameter:
- Controller controller: controller enum for left and right hand
public enum Controller
{
LeftController, // left controller
RightController, // right controller
}
- Vector3 offset:positional offset (in meters)
Return value: None
Method of calling: PXR_Input.SetControllerOriginOffset(controller, offset)
7.3 Eye tracking related¶
The interfaces in this chapter are only applicable for Neo3 Pro Eye which support eye tracking function.
GetCombineEyeGazePoint¶
Function name: public static bool GetCombineEyeGazePoint(out Vector3 point)
Functions: Get the position of the combined gaze point
Parameter:
- out Vector3 point: Receive vector 3 returned by the result
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetCombineEyeGazePoint()
GetCombineEyeGazeVector¶
Function name: public static bool GetCombineEyeGazeVector(out Vector3 vector)
Functions: Get the direction of the combined gaze point
Parameter:
- out Vector3 vector: Receive vector 3 returned by the result
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetCombineEyeGazeVector(out Vector3 vector)
GetLeftEyeGazeOpenness¶
Function name: public static bool GetLeftEyeGazeOpenness (out float openness)
Functions: Get the openness/closeness of left eye
Parameter:
- out float openness: Receive the float returned by the result; 0 - complete closeness, 1 - openness
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetLeftEyeGazeOpenness(out float openness)
GetRightEyeGazeOpenness¶
Function name: public static bool GetRightEyeGazeOpenness (out float openness)
Functions: Get the openness/closeness of right eye
Parameter:
- out float openness: Receive the float returned by the result; 0- complete closeness, 1- complete openness
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetRightEyeGazeOpenness(out float openness)
GetLeftEyePoseStatus¶
Function name: public static bool GetLeftEyePoseStatus(out uint status)
Functions: Get whether the data of the current left eye is available
Parameter:
- out uint status: Receive the int returned by the result; 0- not available, 1-available
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetLeftEyePoseStatus (out uint status)
GetRightEyePoseStatus¶
Function name: public static bool GetRightEyePoseStatus (out uint status)
Functions: Get whether the data of the current right eye is available
Parameter:
- out uint status: Receive the int returned by the result; 0- not available, 1-available
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetRightEyePoseStatus (out uint status)
GetCombinedEyePoseStatus¶
Function name: public static bool GetCombinedEyePoseStatus(out uint status)
Functions: Get whether the data of the combined eye is available
Parameter:
- out uint status: Receive the int returned by the result; 0- not available, 1-available
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetCombinedEyePoseStatus (out uint status)
Sample code:
private enum pvrEyePoseStatus
{
gazePointValid = (1 << 0),
gazeVectorValid = (1 << 1),
eyeOpennessValid = (1 << 2),
eyePupilDilationValid = (1 << 3),
eyePositionGuideValid = (1 << 4)
};
private void GetEyeTrackingGazeRay(ref EyeTrackingGazeRay gazeRay)
{
PXR_EyeTracking.GetCombinedEyePoseStatus(out combinedStatus);
PXR_EyeTracking.GetCombineEyeGazeVector(out combinedGazeVector);
PXR_EyeTracking.GetCombineEyeGazePoint(out combinedGazePoint);
gazeRay.isValid = (combinedStatus & (int)pvrEyePoseStatus.gazePointValid) != 0 && (combinedStatus & (int)pvrEyePoseStatus.gazeVectorValid) != 0;
if (gazeRay.isValid)
{
gazeRay.direction = combinedGazeVector;
gazeRay.origin = combinedGazePoint;
gazeRay.origin = Matrix.MultiplyPoint(gazeRay.origin);
gazeRay.direction = Matrix.MultiplyVector(gazeRay.direction);
}
}
GetLeftEyePositionGuide¶
Function name: public static bool GetLeftEyePositionGuide (out Vector3 position)
Functions: Get the position guide of left eye. A coordinate system is generated with the upper right position of the sensor as the origin (0, 0), where the lower left coordinate is (1, 1), the value is the position of the eye in this coordinate system.
Parameter:
- out Vector3 position: Receive the vector 3 returned by the result
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetLeftEyePositionGuide (out Vector3 position)
GetRightEyePositionGuide¶
Function name: public static bool GetRightEyePositionGuide (out Vector3 position)
Functions: Get the position guide of right eye. A coordinate system is generated with the upper right position of the sensor as the origin (0, 0), where the lower left coordinate is (1, 1), the value is the position of the eye in this coordinate system.
Parameter:
- out Vector3 position: Receive the vector 3 returned by the result
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetRightEyePositionGuide (out Vector3 position)
GetFoveatedGazeDirection¶
Function name: public static bool GetFoveatedGazeDirection(out Vector3 position)
Functions: Get the foveated gaze direction. Refer to Chapter 8.4 for the detailed instruction of FFR.
Parameter:
- out Vector3 position: Receive the vector 3 returned by the result
Return value: True - succeed, false - failed
Method of calling: PXR_EyeTracking.GetFoveatedGazeDirection (out Vector3 position)
7.4 Foveated rendering related¶
PXR_FoveationRendering:Class that define foveated rendering related APIs.
Fig 7.2 File path of PXR_FoveationRendering.cs
GetFoveationLevel¶
Function name: public static FoveationLevel GetFoveationLevel()
Functions: Get current foveated rendering level
Parameter: None
Return value: Current foveated rendering level
public enum FoveationLevel
{
None = -1, // disable
Low,
Med,
High,
TopHigh
}
Method of calling: PXR_FoveationRendering.GetFoveationLevel()
SetFoveationLevel¶
Function name: public static void SetFoveationLevel (FoveationLevel level)
Functions: Set foveated rendering level
Parameter: Targeted foveated rendering level with 4 levels: None, Low, Med, and High. None means “disabled”.
Return value: None
public enum FoveationLevel
{
None = -1, // disable
Low,
Med,
High,
TopHigh
}
Method of calling: PXR_FoveationRendering.SetFoveationLevel(level)
SetFoveationParameters¶
Function name: public static void SetFoveationParameters(foveationGainX, foveationGainY, foveationArea, foveationMinimum)
Functions: Set current foveated rendering parameters
Parameter: Target foveated rendering parameters
- float foveationGainX/Y: Ratio of peripheral pixel scaling down in X/Y direction, larger value indicates more ratio scaling down. Range: 1.0-10.0
- float foveationArea: The resolution of the area around the gazing point with the ffrAreaValue as radius will stay the same. Range: 0.0-4.0
- float foveationMinimum: Default minimum pixel density, actual pixel density will be greater than or equal to foveationMinimum. Recommend to set to 1/32, 1/16, 1/8, 1/4 or 1/2.
SDK provides four levels:
Level | foveationGain | foveationArea | foveationMinimum |
---|---|---|---|
Low | (3.0f,3.0f) | 1.0f | 0.125f |
Med | (4.0f,4.0f) | 1.0f | 0.125f |
High | (6.0f,6.0f) | 1.0f | 0.0625f |
Top High | (7.0f,7.0f) | 0.0f | 0.0625f |
Return value: None
Method of calling: PXR_FoveationRendering.SetFoveatedRenderingParameters(foveationGainX, foveationGainY, foveationArea, foveationMinimum)
7.5 Safety Boundary related¶
PXR_Boundary:Class that define boundary related APIs.
Fig 7.3 File path of PXR_Boundary.cs
GetEnabled¶
Function name: public static bool GetEnabled ()
Functions:Get the enabling status of safety zone protection system
Parameter: None
Return value:True - enabled, false - not enabled
Method of calling: PXR_Boundary.GetEnabled ()
GetConfigured¶
Function name: public static bool GetConfigured()
Function:Return result of Safety Boundary configuring
Parameter: None
Return value:true: Success false: Failure
Method of calling: PXR_Boundary.GetConfigured()
SetVisible¶
Function name: public static void SetVisible(bool value)
Functions:Force to set whether Safety Boundary is visible (Note: Safety Boundary activation and user configuration in system settings will overwrite this interface’s action)
Parameter: value: whether the Safety Boundary is visible or not
Return value:None
Method of calling: PXR_Boundary.SetVisible(value)
GetVisible¶
Function name:public static bool GetVisible()
Functions:Get whether the safety boundary is visible or not
Parameter: None
Return Value:Whether the safety area is visible or not
Method of calling: PXR_Boundary.GetVisible()
TestNode¶
Function name: public static PxrBoundaryTriggerInfo TestNode(BoundaryTrackingNode node, BoundaryType boundaryType)
Functions:Return testing results of tracking nodes to specific boundary types
Parameter:
- BoundaryTrackingNode node: tracking node
public enum BoundaryTrackingNode
{
HandLeft, // left controller
HandRight, // right controller
Head // HMD
}
- BoundaryType boundaryType: boundary type
public enum BoundaryType
{
OuterBoundary, // Safety zone
PlayArea // Customize the maximum inner rectangle of the safe zone boundary (no such rectangle for in-situ fast safe zones)
}
Return value:PxrBoundaryTriggerInfo which is a struct of boundary test result
public struct PxrBoundaryTriggerInfo
{
public bool IsTriggering; // If boundary is triggered
public float ClosestDistance; // Minimum distance of tracking nodes and boundary
public Vector3 ClosestPoint; // Closest point of tracking nodes and boundary
public Vector3 ClosestPointNormal; // Normal of closest point
public bool valid // If the result is valid
}
Method of calling: PXR_Boundary.TestNode(node, boundaryType);
TestPoint¶
Function name:public static PxrBoundaryTriggerInfo TestPoint(Vector3 point, BoundaryType boundaryType)
Functions:Return testing results of a 3-dimensional point coordinate to a specific boundary type
Parameters:
- PxrVector3f point:coordinate of point
- BoundaryType boundaryType: boundary type
public enum BoundaryType
{
OuterBoundary, // Safety zone
PlayArea // Customize the maximum inner rectangle of the safe zone boundary (no such rectangle for in-situ fast safe zones)
}
Return Value:PxrBoundaryTriggerInfo which is a struct of boundary test result
public struct PxrBoundaryTriggerInfo
{
public bool IsTriggering; // If boundary is triggered
public float ClosestDistance; // Minimum distance of tracking nodes and boundary
public Vector3 ClosestPoint; // Closest point of tracking nodes and boundary
public Vector3 ClosestPointNormal; // Normal of closest point
public bool valid // If the result is valid
}
Method of calling: PXR_Boundary .TestPoint(point, boundaryType);
GetGeometry¶
Function name:public static Vector3[]GetGeometry(BoundaryType boundaryType)
Functions:Return the collection of boundary points
- Parameter:
- BoundaryType boundaryType: boundary type
public enum BoundaryType
{
OuterBoundary, // Safety zone
PlayArea // Customize the maximum inner rectangle of the safe zone boundary (no such rectangle for in-situ fast safe zones)
}
Return Value:Vector3[]: Collection of safety boundary points
Method of calling: PXR_Boundary.GetGeometry(boundaryType);
GetDimensions¶
Function name: public static Vector3 GetDimensions (BoundaryType boundaryType)
Functions:Get the size of the custom security boundary PlayArea
Parameter:
- BoundaryType boundaryType: boundary type
public enum BoundaryType
{
OuterBoundary, // Safety zone
PlayArea // Customize the maximum inner rectangle of the safe zone boundary (no such rectangle for in-situ fast safe zones)
}
Return value:Vector3, x: long side of PlayArea, y: 1, z: short side of PlayArea; If the current place is within security boundary, the value of V3 is (0, 0, 0)
Method of calling: PXR_Boundary.GetDimensions (boundaryType);
GetDialogState¶
Function name: public static int GetDialogState ()
Functions:Get the boundary dialog state
Parameter: None
Return value:NothingDialog = -1,GobackDialog = 0,ToofarDialog = 1,LostDialog = 2,LostNoReason = 3,LostCamera = 4, LostHighLight = 5,LostLowLight = 6,LostLowFeatureCount = 7,LostReLocation = 8
Method of calling: PXR_Boundary.GetDialogState();
7.6 SeeThrough Camera related¶
EnableSeeThroughManual¶
Function name: public static void EnableSeeThroughManual(bool value)
Functions:Get the camera picture of Neo 3 device and use it as the environmental background
- bool value:Open or not SeeThrough,True on, false off
Return Value: None
Method of calling: PXR_Boundary.EnablssSeeThroughManual (value);
Preconditions of calling:
- The clear flags of the camera is set to solid color
- The background color of the camera is set to 0 for the alpha channel
- PassThroughSystem
Functions:Get camera image of devices
Method of calling: Refer to section 8.9 PassThrough
7.7 Device related¶
Note: please call the interface InitAudioDevice to initialize before using services such as power, volume and brightness
InitAudioDevice¶
Function name: public bool InitAudioDevice()
Functions: Initialize the volume device
Parameters: True: success false: failure
Method of calling: PXR_System.InitAudioDevice()
StartAudioReceiver¶
Function name: public bool StartAudioReceiver(string objName)
Functions: Turn on the volume service
Parameters:
- string objName: Gameobject name to turn on the volume
Return value:
- True: success
- false: failure
Method of calling: PXR_System.StartAudioReceiver(objName)
setAudio¶
Function name: public void setAudio(string s)
Functions: Callback when volume changes
Parameters:
- string s: Current volume
Return value: None
Method of calling: You can add logic directly in this method or use delegate to call it
StopAudioReceiver¶
Function name: public bool StopAudioReceiver()
Functions: Turn off the volume service
Parameters: None
Return value: True: success false: failure
Method of calling: PXR_System.StopAudioReceiver()
StartBatteryReceiver¶
Function name: public bool StartBatteryReceiver(string objName)
Functions: Turn on the power service
- Parameters:
- string objName: Gameobject name to turn on the power
Return value: True: success false: failure
Method of calling: PXR_System.StartBatteryReceiver(objName)
setBattery¶
Function name: public void setBattery(string s)
Functions: Callback when battery changes
Parameters:
- string s: Current power (range: 0.00~1.00)
Return value: None
Method of calling: You can add logic directly in this method or use delegate to call it
StopBatteryReceiver¶
Function name: public bool StopBatteryReceiver()
Functions: Turn off the power service
Parameters: None
Return value: True: success false: failure
Method of calling: PXR_System.StopBatteryReceiver()
GetMaxVolumeNumber¶
Function name: public int GetMaxVolumeNumber()
Functions: Get the maximum volume (need to initialize the volume device)
Parameters: None
Return value: Maximum volume
Method of calling: PXR_System.GetMaxVolumeNumber()
GetCurrentVolumeNumber¶
Function name: public static int GetCurrentVolumeNumber()
Functions: Get the current volume (need to initialize the volume device)
Parameters: None
Return value: Current volume value (range: 0~15)
Method of calling: PXR_System.GetCurrentVolumeNumber()
VolumeUp¶
Function name: public static bool VolumeUp()
Functions: Increase the volume (need to initialize the volume device)
Parameters: None
Return value: True: success false: failure
Method of calling: PXR_System.VolumeUp()
VolumeDown¶
Function name: public static bool VolumeDown()
Functions: decrease the volume (need to initialize the volume device)
Parameters: None
Return value: True: success false: failure
Method of calling: PXR_System.VolumeDown()
SetVolumeNum¶
Function name: public static bool SetVolumeNum(int volume)
Functions: Set the volume (need to initialize the volume device)
Parameters:
- int volume: Set the volume value (the range of volume value is 0~15)
Return value: True: success false: failure
Method of calling: PXR_System.SetVolumeNum(volume)
GetCommonBrightness¶
Function name: public static int GetCommonBrightness()
Functions: Acquire that brightness value of the current general equipment
Parameters: None
Return value: Current brightness value (the range of brightness value is 0~255)
Method of calling: PXR_System.GetCommonBrightness()
SetCommonBrightness¶
Function name: public static bool SetCommonBrightness(int brightness)
Functions: Set brightness value of current general equipment
Parameters:
- int brightness: Brightness value (the range of brightness value is 0~255)
Return value: True: success, false: failure
Method of calling: PXR_System.SetCommonBrightness(brightness)
SetExtraLatencyMode¶
Function name: public static bool SetExtraLatencyMode(ExtraLatencyMode mode)
Functions: Set current ExtraLatencyMode (Only call this once)
Parameter:
public enum ExtraLatencyMode
{
ExtraLatencyModeOff = 0, // Disable ExtraLatencyMode mode. This option will display the latest rendered frame for display.
ExtraLatencyModeOn = 1, // Enable ExtraLatencyMode mode. This option will display one frame prior to the latest rendered frame.
ExtraLatencyModeDynamic = 2 // Use system default setup.
}
Return value: true: Success,false: Failure
Method of calling: PXR_System.SetExtraLatencyMode(mode);
Note: This interface is temporarily unavailable.
GetPredictedDisplayTime¶
Function name: public static float GetPredictedDisplayTime()
Functions: Get predicted display time delay (the interval between time of frame rendering end and time of actual display)
Parameter: None
Return value: Delay time (miliseconds)
Method of calling: PXR_System.GetPredictedDisplayTime()
GetSensorStatus¶
Function name:public static int GetSensorStatus()
Functions:Get the 6dof status
Parameter:None
Return value:0: null, 1: 3dof, 3: 6dof
Method of calling: PXR_System.GetSensorStatus()
7.8 System related¶
Through the relevant interfaces of System edition, developers can obtain and set some system configurations on Pico enterprise edition devices
Supported equipments:
Neo 3 Pro series
Please initialize System Service before using the interfaces in this chapter. Detailed description as follow: Initializing and bind Service, the objectname refers to name of the object which is used to receive callback.
private void Awake()
{
PXR_System.InitSystemService(objectName);
PXR_System.BindSystemService();
}
Unbind the Service
private void OnDestory()
{
PXR_Plugin.System.UnBindSystemService();
}
Add 4 callback methods to allow corresponding callback can be received.
private void BoolCallback(string value)
{
if (PXR_Plugin.System.BoolCallback != null) PXR_Plugin.System.BoolCallback(bool.Parse(value));
PXR_Plugin.System.BoolCallback = null;
}
private void IntCallback(string value)
{
if (PXR_Plugin.System.IntCallback != null) PXR_Plugin.System.IntCallback(int.Parse(value));
PXR_Plugin.System.IntCallback = null;
}
private void LongCallback(string value)
{
if (PXR_Plugin.System.LongCallback != null) PXR_Plugin.System.LongCallback(int.Parse(value));
PXR_Plugin.System.LongCallback = null;
}
private void StringCallback(string value)
{
if (PXR_Plugin.System.StringCallback != null) PXR_Plugin.System.StringCallback(value);
PXR_Plugin.System.StringCallback = null;
}
Make sure Service is bound successfully before calling the interface. For callback of Service binding success, please add the following code to the initialization script. After Service binding success, this method will be called.
public void toBServiceBind(string s)
{
Debug.Log("Bind success.");
}
7.8.1 Common interfaces¶
Fig 7.4 system script
StateGetDeviceInfo¶
Function name: public static string UPxr_StateGetDeviceInfo(SystemInfoEnum type)
Functions: Get device info
Parameter: type - get the device info type
public enum SystemInfoEnum
{
ELECTRIC_QUANTITY, // Battery Power
PUI_VERSION, // PUI Version
EQUIPMENT_MODEL, // Device Model
EQUIPMENT_SN, // Device SN code
CUSTOMER_SN, // Customer SN code
INTERNAL_STORAGE_SPACE_OF_THE_DEVICE, // Device Storage
DEVICE_BLUETOOTH_STATUS, // Bluetooth Status
BLUETOOTH_NAME_CONNECTED, // Bluetooth Name
BLUETOOTH_MAC_ADDRESS, // Bluetooth MAC Address
DEVICE_WIFI_STATUS, // Wi-Fi connection status
WIFI_NAME_CONNECTED, // Connected Wi-Fi ID
WLAN_MAC_ADDRESS, // WLAN MAC Adress
DEVICE_IP, // Device IP Address
CHARGING_STATUS // Device charging status(**Return value**: 2-charging 3-not charging)
}
Return value: string - device info
Method of calling: PXR_System.StateGetDeviceInfo(SystemInfoEnum.PUI_VERSION);
ControlSetAutoConnectWIFI¶
Function name: public static void ControlSetAutoConnectWIFI(string ssid, string pwd,Action<bool> callback)
Functions: Connect to the specified WiFi
Parameter:
- ssid: WiFi name,
- pwd: WiFi password,
- Action<bool> callback: successful/failed connection
Return value: None
Method of calling: PXR_System.ControlSetAutoConnectWIFI(ssid, pwd,callback);
ControlClearAutoConnectWIFI¶
Function name: public static void ControlClearAutoConnectWIFI(Action<bool> callback)
Functions: Clear the specified WiFi
Parameter:
- Action<bool> callback: successful/failed clearance
Return value: None
Method of calling: PXR_System.ControlClearAutoConnectWIFI(callback);
PropertySetHomeKey¶
Function name: public static void PropertySetHomeKey(HomeEventEnum eventEnum, HomeFunctionEnum function, Action<bool> callback)
Functions: Set Home key. It will redefine Home key and affect the function of Home key defined by the system. Please use this function with discretion.
Parameter:
- HomeEventEnum eventEnum
public enum HomeEventEnum
{
SINGLE_CLICK, // single click
DOUBLE_CLICK // double click
}
- HomeFunctionEnum function
public enum HomeFunctionEnum
{
VALUE_HOME_GO_TO_SETTING = 0, // Go to settings
VALUE_HOME_RECENTER = 2, // Recenter
VALUE_HOME_DISABLE = 4, // Disable the event of Home key
VALUE_HOME_GO_TO_HOME = 5 // Go to Home
}
- Action<bool> callback: successful/failed
Return value: None
Method of calling: PXR_System.PropertySetHomeKey(eventEnum,function,callback);
PropertySetHomeKeyAll¶
Function name: public static void PropertySetHomeKeyAll(HomeEventEnum eventEnum, HomeFunctionEnum function, int timesetup, string pkg, string className, Action<bool> callback)
Functions: Extended settings for Home key
Parameter:
- HomeEventEnum eventEnum
public enum HomeEventEnum
{
SINGLE_CLICK, // single click
DOUBLE_CLICK // double click
}
- HomeFunctionEnum function
public enum HomeFunctionEnum
{
VALUE_HOME_GO_TO_SETTING = 0, // Go to settings
VALUE_HOME_RECENTER = 2, // Recenter
VALUE_HOME_DISABLE = 4, // Disable the event of Home key
VALUE_HOME_GO_TO_HOME = 5 // Go to Home
}
- int timesetup: The interval of key pressing is set only if there are events when double clicking or long pressing event. When short pressed, it will return 0.
- string pkg: When Function is HOME_FUNCTION_OPEN_APP, input specified package name; other situations input null.
- string className: When Function is HOME_FUNCTION_OPEN_APP, input specified class name; other situations input null.
- Action<bool> callback: successful/failed
Return value: None
Method of calling: PXR_System.PropertySetHomeKeyAll(eventEnum,function, timesetup, pkg, className, callback);
PropertyDisablePowerKey¶
Function name: public static void PropertyDisablePowerKey(bool isSingleTap, bool enable,Action<int> callback)
Functions: Set power key
Parameter:
- bool isSingleTap: single click event [true], long press event [false],
- bool enable: key enabling status;
- Action<int> callback: successful/failed setting
Return value: None
Method of calling: PXR_System.PropertyDisablePowerKey(isSingleTap, enable,callback);
PropertySetScreenOffDelay¶
Function name: public static void PropertySetScreenOffDelay(ScreenOffDelayTimeEnum timeEnum,Action<int> callback)
Functions: Set screen off delay
Parameter:
- ScreenOffDelayTimeEnum timeEnum: screen off delay,please note that screen off timeout should not be larger than system sleep timeout
public enum ScreenOffDelayTimeEnum
{
THREE = 3, // 3 seconds
TEN = 10, // 10 seconds
THIRTY = 30, // 30 seconds
SIXTY = 60, // 60 seconds
THREE_HUNDRED = 300, // 5 minutes
SIX_HUNDRED = 600, // 10 minutes
NEVER = -1 // Never
}
- Action<int> callback: successful/failed setting
Return value: None
Method of calling: PXR_System.PropertySetScreenOffDelay(timeEnum,callback);
PropertySetSleepDelay¶
Function name: public static void PropertySetSleepDelay(SleepDelayTimeEnum timeEnum)
Functions: Set sleep delay
Parameter:
- SleepDelayTimeEnum timeEnum: system sleep delay
public enum ScreenOffDelayTimeEnum
{
THREE = 3, // 3 seconds
TEN = 10, // 10 seconds
THIRTY = 30, // 30 seconds
SIXTY = 60, // 60 seconds
THREE_HUNDRED = 300, // 5 minutes
SIX_HUNDRED = 600, // 10 minutes
NEVER = -1 // Never
}
Return value: None
Method of calling: PXR_System.PropertySetSleepDelay(timeEnum);
SwitchSystemFunction¶
Function name: public static void SwitchSystemFunction(SystemFunctionSwitchEnum systemFunction, SwitchEnum switchEnum)
Functions: Set switch system funtion
Parameter:
- SystemFunctionSwitchEnum system Function: type of function, switchEnum: switch value
public enum SystemFunctionSwitchEnum
{
SFS_USB, // USB Debugging
SFS_AUTOSLEEP, // Auto Sleep
SFS_SCREENON_CHARGING, // Screen-On Charging
SFS_OTG_CHARGING, // OTG Charging
SFS_RETURN_MENU_IN_2DMODE, // Return Button In 2D Mode
SFS_COMBINATION_KEY, // Key Combination
SFS_CALIBRATION_WITH_POWER_ON, // Recenter/Re-Calibration On Device Boot
SFS_SYSTEM_UPDATE, // System Update
SFS_CAST_SERVICE, // Casting Service (This Property is not valid when using Pico Enterprise Solution)
SFS_EYE_PROTECTION, // Eye-Protection Mode
SFS_SECURITY_ZONE_PERMANENTLY, // Disable 6Dof Safety Boundary Permanently
SFS_Auto_Calibration, // Auto Recenter/Re-Calibrate
SFS_USB_BOOT, // USB Plug-in Boot
SFS_VOLUME_UI, // Global volume UI
SFS_CONTROLLER_UI, // Global Controller connected UI
SFS_NAVGATION_SWITCH, // Navigation Bar
SFS_SHORTCUT_SHOW_RECORD_UI, // Screen recording button UI
SFS_SHORTCUT_SHOW_FIT_UI, // Pico Fit UI
SFS_SHORTCUT_SHOW_CAST_UI, // Screencast button UI
SFS_SHORTCUT_SHOW_CAPTURE_UI, // Screenshot button UI
SFS_STOP_MEM_INFO_SERVICE, // Kill 2D application
SFS_USB_FORCE_HOST // Set Neo3 device as host device Set Neo3 device as host device
}
- SwitchEnum switchEnum: switch value
public enum SwitchEnum
{
S_ON, // enable
S_OFF // disable
}
Method of calling: PXR_System.SwitchSystemFunction(systemFunction,switchEnum);
SwitchSetUsbConfigurationOption¶
Function name: public static void SwitchSetUsbConfigurationOption(USBConfigModeEnum uSBConfigModeEnum)
Functions: Set USB configuration (MTP, charging )
Parameter:
- USBConfigModeEnum uSBConfigModeEnum
public enum USBConfigModeEnum
{
MTP, // MTP Mode
CHARGE // Charging Mode
}
Return value: None
Method of calling: PXR_System.SwitchSetUsbConfigurationOption(uSBConfigModeEnum);
EnableEnterKey¶
Function name: public static void EnableEnterKey()
Functions: Enable Confirm key
Parameters: None
Return value: None
Method of calling: PXR_System.EnableEnterKey();
DisableEnterKey¶
Function name: public static void DisableEnterKey()
Functions: Disable Confirm key
Parameters: None
Return value: None
Method of calling: PXR_System.DisableEnterKey();
EnableVolumeKey¶
Function name: public static void EnableVolumeKey()
Functions: Enable Volume key
Parameters: None
Return value: None
Method of calling: PXR_System.EnableVolumeKey();
DisableVolumeKey¶
Function name: public static void DisableVolumeKey()
Functions: Disable Volume key
Parameters: None
Return value: None
Method of calling: PXR_System.DisableVolumeKey();
EnableBackKey¶
Function name: public static void EnableBackKey()
Functions: Enable Back key
Parameters: None
Return value: None
Method of calling: PXR_System.EnableBackKey();
DisableBackKey¶
Function name: public static void DisableBackKey()
Functions: Disable Back key
Parameters: None
Return value: None
Method of calling: PXR_System.DisableBackKey();
WriteConfigFileToDataLocal¶
Function name: public static void WriteConfigFileToDataLocal(string path, string content, Action<bool> callback)
Functions: Write configuration file to Data/local/tmp
Parameters:
- string path: configure file path (“/data/local/tmp/config.txt”)
- string content: configure file content
- Action<bool> callback: whether the configuration file has been successfully written
Return value: None
Method of calling: PXR_System.WriteConfigFileToDataLocal(string path, string content, Action<bool> callback);
ResetAllKeyToDefault¶
Function name: public static void ResetAllKeyToDefault (Action<bool> callback)
Functions: Reset all keys to default
Parameters: callback: whether all keys have been successfully reset to default
Return value: None
Method of calling: PXR_System. ResetAllKeyToDefault (Action<bool> callback);
OpenMiracast¶
Function name: public static void OpenMiracast()
Functions: Turn on the screencast function.
Parameter: None
Return value: None
Method of calling: PXR_System. OpenMiracast();
IsMiracastOn¶
Function name: public static void IsMiracastOn()
Functions: Get the status of the screencast.
Parameter: None
Return value: true: on; false: off
Method of calling: PXR_System.IsMiracastOn();
CloseMiracast¶
Function name: public static void CloseMiracast()
Function: Turn off the screencast function.
Parameter: None
Return value: None
Method of callilng: PXR_System. CloseMiracast();
StartScan¶
Function name: public static void StartScan()
Functions: Start scanning for devices that can be screened.
Parameter: None
Return value: None
Method of calling: PXR_System. StartScan();
StopScan¶
Function name: public static void StopScan()
Functions: Stop scanning for devices that can be screened.
Parameter: None
Return value: None
Method of calling: PXR_System. StopScan();
SetWDJsonCallback¶
Function name: public static void SetWDJsonCallback()
Function: Set callback of scanning result, return a string in json format, including devices connected and scanned before. StringCallBack can be called only after this interface is executed.
Parameter: None
Return value: None
Method of calling: PXR_System. SetWDJsonCallback();
ConnectWifiDisplay¶
Function name: public static void ConnectWifiDisplay(string modelJson)
Functions: Project to the specified device.
Parameter:
- string modelJson
{
"deviceAddress": "e2:37:bf:76:33:c6",
"deviceName": "\u5BA2\u5385\u7684\u5C0F\u7C73\u7535\u89C6",
"isAvailable": "true",
"canConnect": "true",
"isRemembered": "false",
"statusCode": "-1",
"status": "",
"description": ""
}
Return value: None
Method of calling: PXR_System. ConnectWifiDisplay(modelJson);
DisConnectWifiDisplay¶
Function name: public static void DisConnectWifiDisplay()
Functions: Disconnected for screencast.
Parameter: None
Return value: None
Method of calling: PXR_System. DisConnectWifiDisplay();
ForgetWifiDisplay¶
Function name: public static void ForgetWifiDisplay(string address)
Functions: Forget the devices that have been connected.
Parameter: address: the adress of the device.
Return value: None
Method of calling: PXR_System. ForgetWifiDisplay(address);
RenameWifiDisplay¶
Function name: public static void RenameWifiDisplay (string address, string newName)
Functions: Modify the name of the connected device (only the name for local storage)
Parameter:
- string address: the MAC address of the device;
- string newName: target name of the device.
Return value: None
Method of calling: PXR_System. RenameWifiDisplay (address, newName);
UpdateWifiDisplays¶
Function name: public static void UpdateWifiDisplays(Action<string>callback)
Functions: Manually update the list.
Parameter:
- Action<string> callback: the result of the SetWDJsonCallback.
Return value: None
Method of calling: PXR_System. UpdateWifiDisplays(callback);
GetConnectedWD¶
Function name: public static string GetConnectedWD()
Functions: Get the information of the currently connected device.
Parameter: None
Return value: Return the currently connected device information.
Method of calling: PXR_System. GetConnectedWD();
7.8.2 Protected interfaces¶
Note: To call the following interfaces, it is required to add this label in the manifest. If this label is added, the app will not be available in the Pico Store.
<meta-data android:name="pico_advance_interface" android:value="0"/>
ControlSetDeviceAction¶
Function name: public static void ControlSetDeviceAction(DeviceControlEnum deviceControl,Action<int> callback)
Functions:Make the device to shut down or reboot
Parameter:
- DeviceControlEnum deviceControl: Make the device shut down or reboot
public enum DeviceControlEnum
{
DEVICE_CONTROL_REBOOT, // Reboot
DEVICE_CONTROL_SHUTDOWN // Shut down
}
- Action<int> callback: callback interface, successful/failed shut down/ reboot
Return value: None
Method of calling: PXR_System.ControlSetDeviceAction(DeviceControlEnum.DEVICE_CONTROL_SHUTDOWN,callback);
ControlAPPManger¶
Function name: public static void ControlAPPManger(PackageControlEnum packageControl, string path, Action<int> callback)
Functions:Silently install or uninstall app
Parameter:
- PackageControlEnum packageControl
public enum PackageControlEnum
{
PACKAGE_SILENCE_INSTALL, // silence install
PACKAGE_SILENCE_UNINSTALL // silence uninstall
}
- string path: The path to the installation package for the silent installation or the name of the app package when silently uninstalled;
- Action<int> callback: callback interface, successful/ failed installation/ uninstallation
Return value: None
Method of calling: PXR_System.ControlAPPManger(PackageControlEnum.PACKAGE_SILENCE_UNINSTALL, “com.xxx.xxx”,callback);
ScreenOn¶
Function name: public static void ScreenOn()
Functions:Turn screen on
Parameter: None
Return value: None
Method of calling: PXR_System.ScreenOn();
ScreenOff¶
Function name: public static void ScreenOff()
Functions:Turn screen off
Parameter: None
Return value: None
Method of calling: PXR_System. ScreenOff()
KillAppsByPidOrPackageName¶
Function name: public static void KillAppsByPidOrPackageName(int[] pids, string[] packageNames)
Functions:Kill the application by passing in the application pid or package name.
Parameter:
- int[] pids: an array of application pid,
- string[] packageNames: an array of package names.
Return value: None
Method of calling: PXR_System. KillAppsByPidOrPackageName(pids, packageNames);
KillBackgroundAppsWithWhiteList¶
Function name: public static void KillBackgroundAppsWithWhiteList(string[] packageNames)
Functions:Kill background applications, the package names array passed in is used as a white list, the corresponding apps will not be Killed.
Parameter:
- string[] packageNames: An array of package names as a whitelist.
Return value: None
Method of calling:PXR_System.KillBackgroundAppsWithWhiteList(packageNames);
7.9 Achievement system related¶
7.9.1 Preparations¶
Developers can go to the Create Application stage from the Management Center, click Create Application, and then enter the corresponding platform to complete the information about the application.
To access the Achievement system, developers need to create the application on Pico Developer Platform and obtain APP ID. Steps:
- Log on to Pico Developer Platform (https://developer.pico-interactive.com/) and sign up for a Pico membership
- Apply to be a developer
- Create Applications
- Create Achievement
Click “View” for more operations. Creating first if you don’t have any App. After successful creation, the platform will assign an unique APP ID automatically.
In the Platform Services menu, find and click Achievements option.
Fig 7.9.1 Pico Developer Platform
On the Achievement page you can find all the achievements you have created. If you don’t have any achievements yet, click Create.
Complete the achievement follow the required information. The API name (i.e. API Name) must be the same as the one in the code.
- Achievement types:
(1). Simple: Unlock by completing a single event or target without achievement progress
(2). Counter: Unlock when the specified number of targets is reached (e.g. reach 5 targets to unlock, Target = 5)
(3). Bitfield: Unlock when the specified number of targets in the specified range is reached (e.g. reach 3 out of 7 targets to unlock, Target = 3, Bitfield Length = 7)
- Configure App ID in Platform settings
Configure APP ID in the project Platform Settings:
Fig 7.9.2 Platform Settings panel
See Chapter 9.1.4 for detailed AndroidManifest configuration.
7.9.2 Calling interfaces¶
Notes:
(1). Please log in to the device with Pico account first, and then use the achievement interface and functions
(2). To avoid errors in achievement data caused by account switching and logout, please call initialization again in App Resume() to ensure that the App gets the correct user login information.
(3). At the development and debugging phase, the following method can be adopted to debug and test
- Logcat
- View data from the Developer Platform - Apps - Achievements info page
Init¶
Function name: public static PXR_Request<PXR_AchievementUpdate> Init()
Functions: Achievement system initialization
Parameters: None
Return value: Returns a message of type PXR_Request<PXR_AchievementUpdate>
Method of calling: PXR_Achievement.Init()
GetAllDefinitions¶
Function name: public static PXR_Request<PXR_AchievementDefinitionList> GetAllDefinitions()
Functions: Get all definitions of achievements
Parameters: None
Return value: Returns a message of type PXR_Request<PXR_AchievementDefinitionList>
Method of calling: PXR_Achievement. GetAllDefinitions ()
GetAllProgress¶
Function name: public static PXR_Request<PXR_AchievementProgressList> GetAllProgress()
Functions: Get progress of all modified achievements
Parameters: None
Return value: Returns a message of type PXR_Request<PXR_AchievementProgressList>
Method of calling: PXR_Achievement. GetAllProgress ()
GetDefinitionsByName¶
Function name: public static PXR_Request<PXR_AchievementDefinitionList> GetDefinitionsByName(string[] names)
Functions: Get definitions by name
Parameters:
- string[] names: get the achievement apiname for obtaining definitions
Return value: Returns a message of type PXR_Request<PXR_AchievementDefinitionList>
Method of calling: PXR_Achievement. GetDefinitionsByName (names)
GetProgressByName¶
Function name: public static PXR_Request<PXR_AchievementProgressList> GetProgressByName(string[] names)
Functions: Get achievement progress by name
Parameters:
- string[] names: the achievement apiname for obtaining definitions
Return value: Returns a message of type PXR_Request<PXR_AchievementProgressList>
Method of calling: PXR_Achievement. GetProgressByName (names)
AddCount¶
Function name: public static PXR_Request<PXR_AchievementUpdate> AddCount(string name, long count)
Functions: Add count achievements
Parameters:
- string name: achievement apiname
- string count: additions
Return value: Returns a message of type PXR_Request<PXR_AchievementUpdate>
Method of calling: PXR_Achievement. AddCount (name,count)
AddFields¶
Function name: public static PXR_Request<PXR_AchievementUpdate> AddFields(string name, string fields)
Functions: Add bitfield achievements
Parameters:
- string name: achievement apiname
- string fields: additions
Return value: Returns a message of type PXR_Request<PXR_AchievementUpdate>
Method of calling: PXR_Achievement. AddFields (name,bitfield)
Unlock¶
Function name: public static PXR_Request<PXR_AchievementUpdate> Unlock(string name)
Functions: Unlock achievement according to apiname
Parameters:
- string name: achievement apiname
Return value: Returns a message of type PXR_Request<PXR_AchievementUpdate>
Method of calling: PXR_Achievement. Unlock (name)
GetNextAchievementDefinitionListPage¶
Function name: public static PXR_Request<PXR_AchievementDefinitionList> GetNextAchievementDefinitionListPage(PXR_AchievementDefinitionList list)
Functions: When getting all the achievement definitions, if there are multiple pages, get the next page
Parameters:
- PXR_AchievementDefinitionList lis: list of achievements
Return value: Returns a message of type PXR_Request<PXR_AchievementDefinitionList>
Method of calling: PXR_Achievement. GetNextAchievementDefinitionListPage(achievementDefinitionList)
GetNextAchievementProgressListPage¶
Function name: public static PXR_Request<PXR_AchievementProgressList> GetNextAchievementProgressListPage(PXR_AchievementProgressList list)
Functions: When getting all modified achievement progress information, if there are multiple pages, get the next page
Parameters: None
Return value: Result of calling
Method of calling: PXR_Achievement. GetNextAchievementProgressListPage(achievementProgressList)
7.10 Advanced guardian related¶
The advanced guardian feature is designed for LBE use cases. To use its functions, please attach the PXR_LargeSpaceServes script to the XR Rig. And call the following method: PXR_Plugin.System.UPxr_SetLargeSpaceEnable(true) to make the current app running in LBE mode.
Note:
- Please initialize system service before using the advanced guardian related interfaces. For details, please refer to chapter 7.8 system related.
- The advanced guardian feature requires the device system software version to be c000_rf01_bv1.0.1_sv1.192_20211116_b346 and above. Software version can be found in device menu Settings - General.
Fig7.10.1 Attach the PXR_LargeSpaceServes script
SetLargeSpaceEnable¶
Function name:public static void UPxr_SetLargeSpaceEnable(bool value)
Functions:Set whether the current application run in advanced guardian mode
Parameters:
- bool value: true-support false-not support
Return value:None
Method of calling:PXR_Plugin.System.UPxr_SetLargeSpaceEnable(bool)
SwitchLargeSpaceScene¶
Function name:public static void UPxr_SwitchLargeSpaceScene(bool open, Action<bool> callback)
Functions:Enable/disable advanced guardian mode at system level.
Parameters:
- bool open: true-enable,false-disable
- Action<bool> callback: true-success,false-fail
Return value:None
Method of calling:PXR_System.SwitchLargeSpaceScene(true,Action);
Note:When creating the safe zone, it is suggested to move around in the play area for several minutes to ensure enough feature points are captured.
GetSwitchLargeSpaceStatus¶
Function name:public static void UPxr_GetSwitchLargeSpaceStatus(Action<string> callback)
Functions:Get the current advanced guardian status
Parameters:
- Action<bool> callback:”0”-close “1”-open
Return value:None
Method of calling:PXR_System.GetSwitchLargeSpaceStatus(Action)
SaveLargeSpaceMaps¶
Function name:public static bool UPxr_SaveLargeSpaceMaps()
Functions:Save Advanced Guardian maps
Parameters:None
Return value:true-success,false-failure
Method of calling:PXR_Plugin.System.UPxr_SaveLargeSpaceMaps()
ExportMaps¶
Function name:public static void UPxr_ExportMaps(Action<bool> callback)
Functions:Export the map file, the exported file is stored in path: internal storage /maps/export
Parameters:
- Action<bool> callback: true-success,false-fail
Return value:None
Method of calling:PXR_System.UPxr_ExportMaps(Action)
ImportMaps¶
Function name:public static void UPxr_ImportMaps(Action<bool> callback)
Functions:To import a map file, the file should be copied to the path: internal storage/maps/ beforehand, and then execute the import method.
Parameters:
- Action<bool> callback: true-success,false-fail
Return value:None
Method of calling:PXR_System.UPxr_ImportMaps(Action)
GetPredictedMainSensorStateNew¶
Function name:public static int UPxr_GetPredictedMainSensorStateNew(ref PxrSensorState2 sensorState, ref int sensorFrameIndex)
Functions:Get the posture data of the device in a fixed coordinate system
Parameters:
- ref PxrSensorState2 sensorState
public struct PxrSensorState2
{
public int status; // 0:pose/globalPose data is not available.
// 1: pose/globalPose rotation data is available.
// 3:pose/globalPose position and rotation are available.
public PxrPosef pose; // position and rotation of HMD
public PxrPosef globalPose; // HMD position and pose relative to Boundary
public PxrVector3f angularVelocity; // angular velocity
public PxrVector3f linearVelocity; // Linear angular velocity
public PxrVector3f angularAcceleration; // Angular acceleration
public PxrVector3f linearAcceleration; // Linear angular acceleration
public UInt64 poseTimeStampNs; // Time to obtain the above data (nanoseconds)
}
- ref int sensorFrameIndex:Index of the Sensor data corresponding to the current frame
Return value:
Returned value | Instructions |
---|---|
0 | Success |
-1 | Other errors |
-4 | The pointer cannot be null |
-5 | Session not created |
Method of calling:PXR_Plugin.System.UPxr_GetPredictedMainSensorStateNew(ref sensorState, ref sensorFrameIndex)