7 API Interface Function List¶
7.1 Get version information¶
UPvr_GetUnitySDKVersion¶
Function name: public static string UPvr_GetUnitySDKVersion()
Functions: Get SDK version number
Parameter: none
Return value: SDK version number
Method of calling: Pvr_UnitySDKAPI.System.UPvr_GetUnitySDKVersion()
7.2 Sensor tracking related¶
UPvr_StartSensor¶
Function name: public static int UPvr_StartSensor(int index)
Functions: Open sensor tracking
Parameter: 0
Return value: 0: Call success; 1: Call failure
Method of calling: Pvr_UnitySDKAPI. Sensor. UPvr_StartSensor(index)
UPvr_ResetSensor¶
Function name: public static int UPvr_ResetSensor (int index)
Functions: Reset sensor tracking, the direction is determined by the system, and the horizontal and vertical directions are reset by default
Parameter: 0
Return value: 0: Call success; 1: Call failure
Method of calling: Pvr_UnitySDKAPI. Sensor. UPvr_ResetSensor (index)
UPvr_OptionalResetSensor¶
Function name: public static int UPvr_OptionalResetSensor (int index, int resetRot, int resetPos)
Functions: Reset sensor orientation and position
Parameter: index: 0 resetRot: Orientation resetPos: Position 0: Not reset 1: Reset
Return value: 0: Call success; 1: Call failure
Method of calling: Pvr_UnitySDKAPI. Sensor. UPvr_OptionalResetSensor (0,1,1)
7.3 Controller related¶
UPvr_GetControllerPower¶
Function name: public static int UPvr_GetControllerPower(int hand)
Functions: Get controller power
For G2 and G2 4K, please enter 0; for neo2 ,0 represents the left controller and 1 represents the right controller)
Return value: 1 to 5
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetControllerPower(int hand)
changeMainControllerCallback¶
Function name: public static void changeMainControllerCallback (string index)
Functions: Callback of Master Hand Change
Parameter: 0/1 represents which the current master control controller is changed (the main control controller is a controller for enabling ray to participate in UI interaction, which has no specific relationship with the index number of the controller)
Return value: none
Method of calling: Pvr_ControllerManager.ChangeMainControllerCallBackEvent += XXXXX
UPvr_GetControllerAbility¶
Function name: public static int UPvr_GetControllerAbility(int hand)
Functions: Gets whether the current Neo2 controller supports 3Dof or 6Dof.
Parameter: 0/1
Return value: -1 is call failure, 0/2 is 6Dof, and 1 is 3Dof
Method of calling: Pvr_UnitySDKAPI.Controller. UPvr_GetControllerAbility(int hand)
setControllerStateChanged¶
Function name: public static void setControllerStateChanged (string state)
Functions: Callback of change in connection status of Neo2 controller
Parameter: The format is (x,x). The first number is the serial number of the controller, and the second number is the connection status of the controller. For example, in 0,0, 0 means the controller 0 is disconnected, 1 means controller 0 is connected
Return value: none
Method of calling: Pvr_ControllerManager.SetControllerStateChangedEvent += XXXXX
UPvr_GetControllerState¶
Function name: public static ControllerState UPvr_GetControllerState(int hand)
Functions: Get the connection status of Controller
Parameter: For G2 and G2 4K, please enter 0; For Neo2, it corresponds to the corresponding controller 0/1.
Return value: Connection status (Note: For Pico Neo using one controller, it is recommended to call twice to determine the connection status because the index of the current controller is inconvenient to be determined)
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetControllerState(hand)
ResetController¶
Function name: public static void ResetController(int num)
Functions: Reset controller orientation(This interface is not available for Neo2)
Parameter: For G2 and G2 4K, please enter 0.
Return value: none
Method of calling: Pvr_ControllerManager.ResetController(num)
StartUpgrade¶
Function name: public static bool StartUpgrade ()
Functions: Start upgrading the controller
Parameter: none
Return value: true: true false: false
Method of calling: Pvr_ControllerManager.StartUpgrade()
GetBLEVersion¶
Function name: public static bool StartUpgrade ()
Functions: Get the BLE version
Parameter: none
Return value: BLE version(Not applicable to G2/G2 4K)
Method of calling: Pvr_ControllerManager.GetBLEVersion()
setupdateFailed¶
Function name: public static void setupdateFailed()
Functions: Callback of failed upgrading
Parameter: none
Return value: none
Method of calling: You can either add logic directly within this method or use delegate to call
setupdateSuccess¶
Function name: public static bool setupdateSuccess()
Functions: Callback of successful upgrading
Parameter: none
Return value: none (Not applicable to G2/G2 4K)
Method of calling: You can either add logic directly within this method or use delegate to call
setupdateProgress¶
Function name: public static void setupdateProgress (string progress)
Functions: Callback of upgrading schedule
Parameter: Schedule 0-100
Return value: none
Method of calling: You can either add logic directly within this method or use delegate to call
UPvr_GetControllerQUA¶
Function name: public static Quaternion UPvr_GetControllerQUA (int hand)
Functions: Get controller orientation
Parameter: For G2 and G2 4K, please enter 0; For Neo2, it corresponds to the corresponding controller 0/1.
Return value: Quaternion, controller orientation
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetControllerQUA(hand)
UPvr_GetControllerPOS¶
Function name: public static Vector3 UPvr_GetControllerPOS (int hand)
Functions: Get controller position
Parameter: For G2 and G2 4K, please enter 0; For Neo2, it corresponds to the corresponding controller 0/1.
Return value: 3 dimensional vector, controller position
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetControllerPOS(hand)
UPvr_GetMainHandNess¶
Function name: public static int UPvr_GetMainHandNess()
Functions: Get the current master control controller index
Parameter: none
Return value: 0/1 (Note: this is exclusive for Neo2 and the correct value can be returned only after the bind controller service is successful. Our SDK will bind the controller service when the application starts, and it is recommended that developers use the Bind callback function to judge whether the bind is successful)
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetMainHandNess()
UPvr_SetMainHandNess¶
Function name: public static void UPvr_SetMainHandNess(int hand)
Functions: Set the current master control controller
Parameter: 0/1
Return value: none
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_SetMainHandNess(hand)
UPvr_GetKey¶
Function name: public static bool UPvr_GetKey (int hand, Pvr_KeyCode key)
Functions: Judging whether the key is pressed or not
Parameter: 0/1, Pvr_KeyCode
Return value: true: Press false: Fail to press
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetKey (hand, key)
UPvr_GetKeyDown¶
Function name: public static bool UPvr_GetKeyDown (int hand, Pvr_KeyCode key)
Functions: Checking whether the key is pressed or not
Parameter: 0/1,Pvr_KeyCode
Return value: true: Press once false : Fail to press
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetKeyDown (hand , key)
UPvr_GetKeyUp¶
Function name: public static bool UPvr_GetKeyUp (int hand, Pvr_KeyCode key)
Functions: Checking whether the key is lifted or not
Parameter: 0/1, Pvr_KeyCode
Return value: true: Lift once false: Fail to lift
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetKeyUp (hand , key)
UPvr_GetKeyLongPressed¶
Function name: public static bool UPvr_GetKeyLongPressed (int hand, Pvr_KeyCode key)
Functions: Checking whether the key is pressed for a long time
Parameter: 0/1, Pvr_KeyCode
Return value: true: Long press the key for more than 0.5 seconds false: Fail to reach the long press time
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetKeyLongPressed (hand , key)
UPvr_GetKeyClick¶
Function name: public static bool UPvr_GetKeyLongPressed (int hand, Pvr_KeyCode key)
Functions: Checking whether the key is pressed as a short click
Parameter: 0/1, Pvr_KeyCode
Return value: true: Long press the key for less than 0.5 seconds false: Time out
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetKeyClick(hand , key)
UPvr_IsTouching¶
Function name: public static bool UPvr_IsTouching (int hand)
Functions: Checking whether the touchpad is touched or not(This interface is not available for Neo2)
Parameter: 0/1
Return value: true: Touching false: Not touching
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_IsTouching(hand)
UPvr_GetSwipeDirection¶
Function name: public static SwipeDirection UPvr_GetSwipeDirection(int hand)
Functions: Get the state of a sliding gesture.
Parameter: 0/1
Return value: SwipeDirection
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetSwipeDirection(hand)
UPvr_GetTouchPadPosition (Discarded. It is recommended to use the UPvr_GetAxis2D interface uniformly.)¶
Function name: public static Vector2 UPvr_GetTouchPadPosition (int hand)
Functions: Get the touch value of the touchpad
Parameter: 0/1
Return value: The touch value of the touchpad.
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetTouchPadPosition(hand)
UPvr_GetAxis2D¶
Function name: public static Vector2 UPvr_GetAxis2D(int hand)
Functions: Get the joystick value
Parameter: 0/1
Return value: Range from -1 to 1
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetAxis2D (hand)
UPvr_GetTouchPadClick¶
Function name: public static TouchPadClick UPvr_GetTouchPadClick(int hand)
Functions: The simulation clicking function of the touchpad (divide the touchpad into 4 pieces to simulate the up and down and left and right functions of the game controller)(This interface is not available for Neo2)
Parameter: 0/1
Return value: TouchPadClick
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetTouchPadClick (hand)
UPvr_GetControllerTriggerValue¶
Function name: public static int UPvr_GetControllerTriggerValue(int hand)
Functions: Get the input value of the trigger
Parameter: 0/1
Return value: 0-255 (applicable to G2 and Neo2 Controller)
Method of calling: Pvr_UnitySDKAPI.Controller.UPvr_GetControllerTriggerValue(hand)
UPvr_VibrateNeo2Controller¶
Function name: public void UPvr_VibrateNeo2Controller(float strength, int time, int hand)
Functions: Vibration interface of Neo2 controller
Parameter: hand: 0,1 Vibration strength: 0-1 time:0-65535(millisecond)
Return value: none
Method of calling: Pvr_UnitySDKAPI.Controller. UPvr_VibrateNeo2Controller (float strength, int time, int hand)
UPvr_GetDeviceType¶
Function name: public static int UPvr_GetDeviceType ()
Functions: Get the connected controller type
Parameter: none
Return value: 0: No connection 3: G2, G2 4K 4: Neo2(If the return value is 0, the lower controller connection status needs to be called at the same time, and the two values cooperate to decide whether to enable the head control)
Method of calling: Pvr_UnitySDKAPI.Controller. UPvr_GetDeviceType ();
UPvr_GetControllerBindingState¶
Function name: public static int UPvr_GetControllerBindingState(int id)
Functions: get controller binding state
Parameter:int id
Return value: -1:Error 0: Unbound 1:bind
Method of calling: Pvr_UnitySDKAPI.Controller. UPvr_GetControllerBindingState(int id)
UPvr_GetAngularVelocity¶
Function name: public static Vector3 UPvr_GetAngularVelocity (int id)
Functions: get controller angular velocity
Parameter:int id (Controller ID)
Return value: angular velocity in rad/s
Method of calling: Pvr_UnitySDKAPI.Controller. UPvr_GetAngularVelocity (int id)
UPvr_GetAcceleration¶
Function name: public static Vector3 UPvr_GetAcceleration (int id)
Functions: get controller acceleration
Parameter:int id (Controller ID)
Return value: acceleration in mm/s^2
Method of calling: Pvr_UnitySDKAPI.Controller. UPvr_GetAcceleration (int id)
UPvr_GetVelocity¶
Function name: public static Vector3 UPvr_GetVelocity (int id)
Functions: get controller velocity
Parameter:int id (Controller ID)
Return value: velocity in mm/s
Method of calling: Pvr_UnitySDKAPI.Controller. UPvr_GetVelocity (int id)
7.4 Power, volume and brightness service-related¶
UPvr_InitBatteryVolClass¶
Function name: public bool UPvr_InitBatteryVolClass()
Functions: Initialize power, volume and brightness service
Parameter: none
Return value: true: Successful false: Failure (Please call this interface to initialize before using services such as power, volume, brightness, etc.)
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_InitBatteryVolClass()
UPvr_StartAudioReceiver¶
Function name: public bool UPvr_StartAudioReceiver (string startreceiver)
Functions: Turn on volume service
Parameter: The name of gameobject that starts Audio Receiver
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StartAudioReceiver (string startreceiver)
UPvr_SetAudio¶
Function name: public void UPvr_SetAudio(string s)
Functions: Callback when volume changes
Parameter: Current volume
Return value: none
Method of calling: You can either add logic directly within this method or use delegate to call
UPvr_StopAudioReceiver¶
Function name: public bool UPvr_StopAudioReceiver ()
Functions: Turn off volume service
Parameter: none
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StopAudioReceiver()
UPvr_StartBatteryReceiver¶
Function name: public bool UPvr_StartBatteryReceiver (string startreceiver)
Functions: Turn on power service
Parameter: The name of gameobject that starts Battery Receiver
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StartBatteryReceiver(string startreceiver)
UPvr_SetBattery¶
Function name: public void UPvr_SetBattery(string s)
Functions: Callback when volume changes
Parameter: Current electric quantity (range: 0.00-1.00)
Return value: none
Method of calling: You can either add logic directly within this method or use delegate to call
UPvr_StopBatteryReceiver¶
Function name: public bool UPvr_StopBatteryReceiver ()
Functions: Turn off power service
Parameter: none
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StopBatteryReceiver()
UPvr_GetMaxVolumeNumber¶
Function name: public int UPvr_GetMaxVolumeNumber ()
Functions: Get maximum volume
Parameter: none
Return value: Maximum volume
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_GetMaxVolumeNumber ()
UPvr_GetCurrentVolumeNumber¶
Function name: public int UPvr_GetCurrentVolumeNumber ()
Functions: Get the current volume
Parameter: none
Return value: Current volume value (range is 0-15)
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_GetCurrentVolumeNumber ()
UPvr_VolumeUp¶
Function name: public bool UPvr_VolumeUp ()
Functions: Increase volume
Parameter: none
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_VolumeUp ()
UPvr_VolumeDown¶
Function name: public bool UPvr_VolumeDown ()
Functions: Decrease volume
Parameter: none
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_VolumeDown ()
UPvr_SetVolumeNum¶
Function name: public bool UPvr_SetVolumeNum(int volume)
Functions: Set volume
Parameter: Set volume value (volume value range is 0-15)
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness. UPvr_SetVolumeNum(volume)
UPvr_GetScreenBrightnessLevel¶
Function name: public int[] UPvr_GetScreenBrightnessLevel ()
Functions: Gets the brightness level of the current screen
Parameter: none
Return value: int array. The first bit is the total brightness level supported, the second bit is the current brightness level, and it is the interval value of the brightness level from the third bit to the end bit
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_GetScreenBrightnessLevel()
UPvr_SetScreenBrightnessLevel¶
Function name: public bool UPvr_SetScreenBrightnessLevel (int vrBrightness, int level)
Functions: Set the brightness of the screen
Parameter: vrBrightness: Brightness mode; level: Brightness value (brightness level value). If vrBrightness passes in 1, level passes in brightness level; if vrBrightness passes in 0, it means that the system default brightness setting mode is adopted. Level can be set to a value between 1 and 255.
Return value: none
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_SetScreenBrightnessLevel (vrBrightness,level)
UPvr_GetCommonBrightness¶
Function name: public int UPvr_GetCommonBrightness ()
Functions: Get the brightness value of the current general device
Parameter: none
Return value: Current brightness value (brightness value range: 0-255)
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_GetCommonBrightness()
UPvr_SetCommonBrightness¶
Function name: public bool UPvr_SetCommonBrightness(int brightness)
Functions: Set the brightness value of the current general device
Parameter: Brightness value (brightness value range is 0-255)
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_SetCommonBrightness (brightness)
UPvr_GetHmdBatteryLevel(deprecated)¶
7.5 Head-mounted distance sensor related¶
UPvr_InitPsensor¶
Function name: public static void UPvr_InitPsensor()
Functions: Initialize the distance sensor
Parameter: none
Return value: none
Method of calling: Pvr_UnitySDKAPI. Sensor. UPvr_InitPsensor ()
UPvr_GetPsensorState¶
Function name: public static int UPvr_GetPsensorState()
Functions: Get the status of the head-mounted distance sensor
Parameter: none
Return value: The return value is 0 when wearing a headset and it is 1 when walking away.
Method of calling: Pvr_UnitySDKAPI. Sensor. UPvr_GetPsensorState() (Note: UPvr_InitPsensor needs to be called for initialization (initialization for only once) before getting the status of Psensor)
UPvr_UnregisterPsensor¶
Function name: public static void UPvr_UnregisterPsensor ()
Functions: Release distance sensor
Parameter: none
Return value: none
Method of calling: Pvr_UnitySDKAPI. Sensor. UPvr_UnregisterPsensor ()
7.6 Hardware device related¶
UPvr_GetDeviceMode¶
Function name: public static string UPvr_GetDeviceMode ()
Functions: Get device type
Parameter: none
Return value: SystemInfo.deviceModel
Method of calling: Pvr_UnitySDKAPI. System. UPvr_GetDeviceMode ()
UPvr_GetDeviceSN¶
Function name: public static string UPvr_GetDeviceSN ()
Functions: Get SN serial number of device
Parameter: none
Return value: Serial number SN of device
Method of calling: Pvr_UnitySDKAPI. System. UPvr_GetDeviceSN ()
UPvr_ShutDown(deprecated)¶
UPvr_Reboot(deprecated)¶
UPvr_Sleep¶
Function name: public static void UPvr_Sleep()
Functions: Screen off
Parameter: none
Return value: none
Method of calling: Pvr_UnitySDKAPI. System. UPvr_Sleep ()
Note: When using the UPvr_Sleep interface, it is required to add the following permissions to AndroidManifest and the system signature is required:
android:sharedUserId="android.uid.system"
<uses-permission android:name="android.permission.DEVICE_POWER" />
7.7 Eye Tracking related¶
UPvr_getEyeTrackingPos¶
Function name: public static Vector3 UPvr_getEyeTrackingPos ()
Functions: Get Eye Tracking Position(Only applicable on Neo2 Eye)
Parameter: none
Return value: Current Eye Tracking Position
Method of calling: Pvr_UnitySDKAPI. System. UPvr_getEyeTrackingPos ()
UPvr_getEyeTrackingData¶
Function name: public static bool UPvr_getEyeTrackingData(ref EyeTrackingData trackingData)
Functions: Get Eye Tracking Data,include Openness and PupilDilation etc.(Only applicable on Neo2 Eye)
Parameter: Struct variable for receiving result
Return value: The return value is true when succeed and it is false when failed.
Method of calling: Pvr_UnitySDKAPI. System. UPvr_getEyeTrackingData(ref trackingData)
Note: Acquired eye-tracking data is expressed in world coordinate. If position data is desired to be transformed in front of camera, a matrix transform is required. Please refer to following example code for implementation:
bool result = Pvr_UnitySDKAPI.System.UPvr_getEyeTrackingData(ref eyePoseData);
bool dataValid = (eyePoseData.combinedEyePoseStatus & (int)pvrEyePoseStatus.kGazeVectorValid) != 0;
if (result && dataValid)
{
//Init Matrix
Transform target = Pvr_UnitySDKEyeManager.Instance.transform;
Matrix4x4 mat = Matrix4x4.TRS(target.position, target.rotation, Vector3.one);
//Transform origin
eyePoseData.combinedEyeGazePoint = mat.MultiplyPoint(eyePoseData.combinedEyeGazePoint);
//Transform vector
eyePoseData.combinedEyeGazeVector = mat.MultiplyVector(eyePoseData.combinedEyeGazeVector);
}
Notes:
Definition of variables in the EyeTrackingData struct variable:
leftEyePoseStatus: confirm the pose status of the left eye
rightEyePoseStatus: confirm the pose status of the right eye
combinedEyePoseStatus: confirm the pose status of both eyes
leftEyeGazePoint: the gaze point of the left eye
rightEyeGazePoint: the gaze point of the right eye
combinedEyeGazePoint: the combined gaze point
leftEyeOpenness: openness/closeness of the left eye
rightEyeOpenness: openness/closeness of the right eye
leftEyePositionGuide: guide to the left eye position
rightEyePositionGuide: guide to the right eye position
combinedEyeGazeVector: the direction of combined gaze point
UPvr_getEyeTrackingGazeRay¶
Function name: public static bool UPvr_getEyeTrackingGazeRay(ref EyeTrackingGazeRay gazeRay)
Functions: Get Eye Tracking Origin and Eyesight direction (Only applicable on Neo2 Eye)
Parameter: EyeTrackingGazeRay struct
Return value: true: Successful false: Failure
Method of calling: Pvr_UnitySDKAPI.System.UPvr_getEyeTrackingGazeRay(ref gazeRay)
Note: Returned eyesight data is calibrated on headset sensor. If eyesight needs to be in front of the camera when Pvr_UnitySDK moves, a Matrix transform is required. Please refer to following example code for implementation:
Pvr_UnitySDKAPI.System.UPvr_getEyeTrackingGazeRay(ref gazeRay);
if(gazeRay.IsValid)
{
//Init Matrix
Transform target = Pvr_UnitySDKManager.SDK.transform;
Matrix4x4 mat = Matrix4x4.TRS(target.position, target.rotation, Vector3.one);
//Transform ray origin
gazeRay.Origin = mat.MultiplyPoint(gazeRay.Origin);
//Transform ray direction
gazeRay.Direction = mat.MultiplyVector(gazeRay.Direction);
}
7.8 Foveated rendering related¶
GetFoveatedRenderingLevel¶
Function name: public static EFoveationLevel GetFoveatedRenderingLevel()
Functions: Get current foveated rendering level
Parameter: None
Return value: Current foveated rendering level
Method of calling: Pvr_UnitySDKAPI.Render.GetFoveatedRenderingLevel ()
SetFoveatedRenderingLevel¶
Function name: public static void SetFoveatedRenderingLevel(EFoveationLevel level)
Functions: Set foveated rendering level
Parameter: Targeted foveated rendering level with 4 levels (Low, Med, High and Top High)
Return value: None
Method of calling: Pvr_UnitySDKAPI.Render.SetFoveatedRenderingLevel(level)
SetFoveatedRenderingParameters¶
Function name: public static void SetFoveatedRenderingParameters(Vector2 ffrGainValue, float ffrAreaValue, float ffrMinimumValue)
Functions: Set current foveated rendering parameters
Parameter: Target foveated rendering parameters
ffrGainValue:Ratio of peripheral pixel scaling down in X/Y direction, larger value indicates more ratio scaling down.
ffrAreaValue: The resolution of the area around the gazing point will stay the same, and the higher the value is, the larger the clear center area gets.
ffrMinimumValue: The minimum pixels per inch by default, and the pixel per inch is equal to or bigger than ffrMinimumValue.
There are four levels provided by SDK:
Level |
ffrGainValue |
ffrAreaValue |
ffrMinimumValue |
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: Pvr_UnitySDKAPI. Render. SetFoveatedRenderingParameters (ffrGainValue, ffrAreaValue, ffrMinimumValue) The original interface mode has been changed. See 8.10 for the new mode.
7.9 User entitlement check related¶
Usage of user entitlement check has been changed. See section 8.10 for the new method.
7.10 Safety Boundary related¶
UPvr_BoundaryGetConfigured¶
Function name: public static bool UPvr_BoundaryGetConfigured()
Functions: Return result of Safety Boundary configuring
Parameter: None
Return value: True: Succes; False: Failure
Method of calling: Pvr_UnitySDKAPI.BoundarySystem.UPvr_BoundaryGetConfigured()
UPvr_BoundaryGetEnabled¶
Function name: public static bool UPvr_BoundaryGetEnabled()
Functions: Return result of whether Safety Boundary is enabled
Parameter: None
Return value: True: Success; False: Failure
Method of calling: Pvr_UnitySDKAPI.BoundarySystem.UPvr_BoundaryGetEnabled()
UPvr_BoundarySetVisible¶
Function name: public static void UPvr_BoundarySetVisible(bool value)
Functions: Force to set Safety Boundary visible even when player stays within boundary (Note: when Safety Boundary is activated or when user configuration in system settings will overwrite this interface’s action)
Parameter: true: visible; false: invisible
Return value: None
Method of calling: Pvr_UnitySDKAPI.BoundarySystem.UPvr_BoundarySetVisible(bool)
UPvr_BoundaryGetVisible¶
Function name:public static bool UPvr BoundaryGetVisible()
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: Pvr UnitySDKAPI. BoundarySystem. UPvr BoundaryGetVisible()
UPvr BoundaryGetDimensions¶
Function name: public static Vector 3 UPvr BoundaryGetDimensions(BoundaryType boundaryType)
Functions: Get the size of self-defined safety boundary PlayArea
Parameter: boundaryType: current boundary type, OuterBoundary or PlayArea
Return Value: Vector3, x: length of PlayArea, y:1, z: width of PlayArea. If it is the in situ safety area, V3 is (0,0,0).
Method of calling: Pvr UnitySDKAPI.BoundarySystem. UPvr_BoundaryGetDimensions(boundaryType);
UPvr_BoundaryTestNode¶
Function name:public static BoundaryTestResult UPvr_BoundaryTestNode(BoundaryTrackingNode node, BoundaryType boundaryType)
Functions: Return testing results of tracking nodes to specific boundary type. Tracking node includes HMD and controllers. And the returned results include status of boundary triggering, closest distance of tracking nodes and boundary, closest point of tracking nodes and boundary, normal of closest point
Parameter:node:tracking nodes,boundaryType:type of boundary
Return Value:BoundaryTestResult which is a struct of boundary test result
public struct BoundaryTestResult
{
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
}
Method of calling: Pvr_UnitySDKAPI.BoundarySystem.UPvr_BoundaryTestNode(node, boundaryType);
UPvr_BoundaryTestPoint¶
Function name:public static BoundaryTestResult UPvr_BoundaryTestPoint(Vector3 point, BoundaryType boundaryType)
Functions:Return testing results of a tracking point to a specific boundary type. And the returned results include status of boundary triggering, closest distance of tracking nodes and boundary, closest point of tracking nodes and boundary, normal of closest point
Parameters:point:coordinate of tracking point,boundaryType:type of boundary
Return Value:BoundaryTestResult which is a struct of boundary test result
public struct BoundaryTestResult
{
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
}
Method of calling: Pvr_UnitySDKAPI.BoundarySystem.UPvr_BoundaryTestPoint(point, boundaryType)
UPvr_BoundaryGetGeometry¶
Function name:public static Vector3[] UPvr_BoundaryGetGeometry(BoundaryType boundaryType)
Functions: Return the collection of boundary points
Parameter:boundaryType:type of safety boundary
Return Value:Vector3[]: Collection of safety boundary points
Method of Calling: Pvr_UnitySDKAPI. BoundarySystem.UPvr_BoundaryGetGeometry(boundaryType)
7.11 SeeThrough Camera related¶
UPvr_BoundaryGetSeeThroughData¶
Function name: public static void UPvr_BoundaryGetSeeThroughData(int cameraIndex, RenderTexture renderTexture)
Functions:Get the camera imaging of Neo 2
Parameter: cameraIndex:camera id, 0 left camera, 1 right camera; renderTexture:texture rendered for camera imaging(Texture size640*640)
Return Value: None
Method of Calling: Pvr_UnitySDKAPI.BoundarySystem.UPvr_BoundaryGetSeeThroughData(0, renderTexture)
UPvr_BoundarySetCameraImageRect¶
Function name:public static void UPvr_BoundarySetCameraImageRect (int width,int height)
Functions:Set the width and height of Camera image.
Parameter:width, height.
Return Value: None
Method of Calling: Pvr_UnitySDKAPI.BoundarySystem. UPvr_BoundarySetCameraImageRect (width, height)
UPvr_EnableSeeThroughManual¶
Function name: public static void UPvr_EnableSeeThroughManual(bool value)
Functions: Get the camera image of Neo 2 and set it as the environmental background
Parameter: value: whether SeeThrough is enabled or not, true enabled, false disenabled
Return Value: None
Method of Calling: Pvr_UnitySDKAPI.BoundarySystem. UPvr_EnableSeeThroughManual(true)
Others:
Select clear flags for solid color of the prefab’s Camera (LeftEye and RightEye)
Select 0 for the background color alpha channel of the prefab’s Camera (LeftEye and RightEye)
UPvr_BoundarySetSeeThroughVisible(deprecated)¶
7.12 System related¶
Developers can get and set some configurations with these interfaces related to the system. These interfaces can be used based on the actual needs of developers.
Requirements:
Device Type |
PUI Version |
4K series |
3.11.3 + |
Neo2 series |
3.13.1 + |
Note: Known issue: the interface for this chapter does not work properly on Unity2019.2.X**.
Please refer to the Pvr_ToBService.cs script in the TobService.unity scene for initialization or mount the script directly into your scene before using the interface in this section.
Make sure that the ToBService has been successfully bound before calling the interface. Add the following code to the Pvr_ToBService.cs script for a callback to bind ToBService. This method will be called when the ToBService binding is successful.
public void setHbControllerConnectState(string s)
{
Debug.Log("Bind success.");
}
7.12.1 General Interfaces¶
UPvr_StateGetDeviceInfo¶
Function name: public static string UPvr_StateGetDeviceInfo(PBS_SystemInfoEnum type)
Function: Get device information
Parameter: type: Get information type of the device
PBS_SystemInfoEnum.ELECTRIC_QUANTITY: Electric quantity
PBS_SystemInfoEnum.PUI_VERSION: PUI version
PBS_SystemInfoEnum.EQUIPMENT_MODEL: Equipment model
PBS_SystemInfoEnum.EQUIPMENT_SN: Equipment SN
PBS_SystemInfoEnum.CUSTOMER_SN: Customer SN
PBS_SystemInfoEnum.INTERNAL_STORAGE_SPACE_OF_THE_DEVICE: Internal storage space of the device
PBS_SystemInfoEnum.DEVICE_BLUETOOTH_STATUS: Bluetooth status
PBS_SystemInfoEnum.BLUETOOTH_NAME_CONNECTED: Name of the bluetooth connected
PBS_SystemInfoEnum.BLUETOOTH_MAC_ADDRESS: Bluetooth Mac address
PBS_SystemInfoEnum.DEVICE_WIFI_STATUS: Status of Wi-Fi connection
PBS_SystemInfoEnum.WIFI_NAME_CONNECTED: Name of Wi-Fi connected
PBS_SystemInfoEnum.WLAN_MAC_ADDRESS: Wlan Mac address
PBS_SystemInfoEnum.DEVICE_IP: Device IP
Return value: string: device information
Method of calling: Pvr_UnitySDKAPI.ToBService.UPvr_StateGetDeviceInfo(PBS_SystemInfoEnum.PUI_VERSION)
UPvr_ControlSetAutoConnectWIFI¶
Function name: public static void UPvr_ControlSetAutoConnectWIFI(string ssid, string pwd,Action<bool> callback)
Function: Enable Auto-Connect to the specific WiFi on boot
Parameter:
ssid: wifi name
pwd: wifi password
callback: whether WiFi is connected
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService. UPvr_ControlSetAutoConnectWIFI(ssid, pwd, callback)
UPvr_ControlClearAutoConnectWIFI¶
Function name: public static void UPvr_ControlClearAutoConnectWIFI(Action<bool> callback)
Function: Disable Auto-Connect to specific WiFi on boot
Parameter: callback: whether the connection is cleared
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService. UPvr_ControlClearAutoConnectWIFI(callback)
UPvr_PropertySetHomeKey¶
Function name: public static void UPvr_PropertySetHomeKey(PBS_HomeEventEnum eventEnum, PBS_HomeFunctionEnum function, Action<bool> callback)
Function: Set Home button press events. It will redefine the Home button and affect the system definition of it. Please use this function with discretion.
Parameter:
eventEnum: single click, double click or long press events
PBS_HomeEventEnum.SINGLE_CLICK: Single-click
PBS_HomeEventEnum.DOUBLE_CLICK: Double-click
PBS_HomeEventEnum.LONG_PRESS: Long press
function: launch setting application, return, calibration, etc..
PBS_HomeFunctionEnum.VALUE_HOME_GO_TO_SETTING: Go to Settings
PBS_HomeFunctionEnum.VALUE_HOME_BACK: Back
PBS_HomeFunctionEnum.VALUE_HOME_RECENTER: Re-center
PBS_HomeFunctionEnum.VALUE_HOME_OPEN_APP: Open certain apps
PBS_HomeFunctionEnum.VALUE_HOME_DISABLE: Disable Home button
PBS_HomeFunctionEnum.VALUE_HOME_GO_TO_HOME: Go to Launcher
PBS_HomeFunctionEnum.VALUE_HOME_SEND_BROADCAST: Send Home button to tap broadcast
PBS_HomeFunctionEnum.VALUE_HOME_CLEAN_MEMORY: Clean memory
callback: whether the setting is successful
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService. UPvr_PropertySetHomeKey(eventEnum,function,callback)
UPvr_PropertySetHomeKeyAll¶
Function name: public static void UPvr_PropertySetHomeKeyAll(PBS_HomeEventEnum eventEnum, PBS_HomeFunctionEnum function, int timesetup, string pkg, string className, Action<bool> callback)
Function: Extended settings for Home button press
Parameter:
eventEnum: single click, double click and long press events
PBS_HomeEventEnum.SINGLE_CLICK: Single-click
PBS_HomeEventEnum.DOUBLE_CLICK: Double-click
PBS_HomeEventEnum.LONG_PRESS: Long press
function: start up the setting application, return, calibrate, etc..
PBS_HomeFunctionEnum.VALUE_HOME_GO_TO_SETTING: Go to settings
PBS_HomeFunctionEnum.VALUE_HOME_BACK: Back
PBS_HomeFunctionEnum.VALUE_HOME_RECENTER: Re-center
PBS_HomeFunctionEnum.VALUE_HOME_OPEN_APP: Open certain apps
PBS_HomeFunctionEnum.VALUE_HOME_DISABLE: Disable Home button
PBS_HomeFunctionEnum.VALUE_HOME_GO_TO_HOME: Go to launcher
PBS_HomeFunctionEnum.VALUE_HOME_SEND_BROADCAST: Send Home button to tap broadcast
PBS_HomeFunctionEnum.VALUE_HOME_CLEAN_MEMORY: Clean memory
Timesetup: only double click and long press events need to set interval between button presses; enter 0 for short press
Pkg: when function is HOME_FUNCTION_OPEN_APP: enter the specific package name; enter null for other cases
className: when function is HOME_FUNCTION_OPEN_APP: enter the specific class name; enter null for other cases
callback: whether the setting is called back successfully
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService. UPvr_PropertySetHomeKeyAll(eventEnum,function, timesetup, pkg, className, callback)
UPvr_PropertyDisablePowerKey¶
Function name: public static void UPvr_PropertyDisablePowerKey(bool isSingleTap, bool enable,Action<int> callback)
Function: Set Power button press events
Parameter:
isSingleTap : single click event [true], long press event [false]
enable: the usage state of the button press
callback: Whether the callback setting is successful
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService. UPvr_PropertyDisablePowerKey(isSingleTap, enable,callback)
UPvr_PropertySetScreenOffDelay¶
Function name: public static void UPvr_PropertySetScreenOffDelay(PBS_ScreenOffDelayTimeEnum timeEnum,Action<int> callback)
Function: Set the screen off delay
Parameter:
timeEnum: delayed time for screen off, cannot be longer than screen sleep delay
PBS_ScreenOffDelayTimeEnum.THREE: 3 s
PBS_ScreenOffDelayTimeEnum.TEN: 10 s
PBS_ScreenOffDelayTimeEnum.THIRTY: 30 s
PBS_ScreenOffDelayTimeEnum.SIXTY: 60 s
PBS_ScreenOffDelayTimeEnum.THREE_HUNDRED: 5 mins
PBS_ScreenOffDelayTimeEnum.SIX_HUNDRED: 10 mins
PBS_ScreenOffDelayTimeEnum.NEVER: Never
callback: whether the setting is successful
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService. UPvr_PropertySetScreenOffDelay(timeEnum,callback)
UPvr_PropertySetSleepDelay¶
Function name: public static void UPvr_PropertySetSleepDelay(PBS_SleepDelayTimeEnum timeEnum)
Function: Set the system sleep delay
Parameter: timeEnum: system sleep time delay
PBS_SleepDelayTimeEnum.FIFTEEN: 15 s
PBS_SleepDelayTimeEnum.THIRTY: 30 s
PBS_SleepDelayTimeEnum.SIXTY: 60 s
PBS_SleepDelayTimeEnum.THREE_HUNDRED: 5 mins
PBS_SleepDelayTimeEnum.SIX_HUNDRED: 10 mins
PBS_SleepDelayTimeEnum.ONE_THOUSAND_AND_EIGHT_HUNDRED: 30 mins
PBS_SleepDelayTimeEnum.NEVER: Never
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService. UPvr_PropertySetSleepDelay(timeEnum)
UPvr_SwitchSystemFunction¶
Function name: public static void UPvr_SwitchSystemFunction(PBS_SystemFunctionSwitchEnum systemFunction, PBS_SwitchEnum switchEnum)
Function: set configurations in system settings
Prameter:
systemFunction: type of function
PBS_SystemFunctionSwitchEnum.SFS_USB: USB debugging switch
PBS_SystemFunctionSwitchEnum.SFS_AUTOSLEEP: Autosleep switch
PBS_SystemFunctionSwitchEnum.SFS_SCREENON_CHARGING: Switch of screen on while charging
PBS_SystemFunctionSwitchEnum.SFS_OTG_CHARGING: OTG charging switch
PBS_SystemFunctionSwitchEnum.SFS_RETURN_MENU_IN_2DMODE: Switch of returning icon display in 2D mode
PBS_SystemFunctionSwitchEnum.SFS_COMBINATION_KEY: Shortcut switch
PBS_SystemFunctionSwitchEnum.SFS_CALIBRATION_WITH_POWER_ON: Startup calibration switch
PBS_SystemFunctionSwitchEnum.SFS_SYSTEM_UPDATE: System updating switch
PBS_SystemFunctionSwitchEnum.SFS_CAST_SERVICE: Mobile phone casting switch (The switch is off when professional service for business is on)
PBS_SystemFunctionSwitchEnum.SFS_EYE_PROTECTION: Eye protection switch
PBS_SystemFunctionSwitchEnum.SFS_SECURITY_ZONE_PERMANENTLY: Switch of 6 Dof security zone permanently off of Neo 2
PBS_SystemFunctionSwitchEnum.SFS_GLOBAL_CALIBRATION: Global calibration switch (only available for G2)
PBS_SystemFunctionSwitchEnum.SFS_Auto_Calibration: Auto calibration switch
PBS_SystemFunctionSwitchEnum.SFS_USB_BOOT: USB plug-in boot switch
switchEnum: value of switch
PBS_SwitchEnum.S_ON: On
PBS_SwitchEnum.S_OFF: Off
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService.UPvr_SwitchSystemFunction(systemFunction,switchEnum)
UPvr_SwitchSetUsbConfigurationOption¶
Function name: public static void UPvr_SwitchSetUsbConfigurationOption(PBS_USBConfigModeEnum uSBConfigModeEnum)
Function: Set USB configuration mode (MTP, charging)
Parameter: uSBConfigModeEnum: MTP, charging
PBS_USBConfigModeEnum.MTP: MTP mode
PBS_USBConfigModeEnum.CHARGE: Charging mode
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService.UPvr_SwitchSetUsbConfigurationOption(uSBConfigModeEnum)
7.12.2 Protected interfaces¶
Note: To secure system steadiness and user experiences, application which uses following interfaces are not allowed to publish on Pico Store. It’s required to add the label to AndroidManifest as below to use these interfaces:
<meta-data android:name="pico_advance_interface" android:value="0"/>
UPvr_ControlSetDeviceAction¶
Function name: Pvr_UnitySDKAPI.ToBService. UPvr_ControlSetDeviceAction(PBS_DeviceControlEnum deviceControl,Action<int> callback)
Function: Control the device to power off or reboot
Parameter:
deviceControl: control the device to power off or reboot
PBS_DeviceControlEnum.DEVICE_CONTROL_REBOOT: Reboot
PBS_DeviceControlEnum.DEVICE_CONTROL_SHUTDOWN: Shutdown
callback: callback interface, whether power off/reboot is successful
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService.UPvr_ControlSetDeviceAction(PBS_DeviceControlEnum.DEVICE_CONTROL_SHUTDOWN,callback)
UPvr_ControlAPPManger¶
Function name: public static void UPvr_ControlAPPManger(PBS_PackageControlEnum packageControl, string path, Action<int> callback)
Function: Silent install/uninstall application
Parameter:
packageControl: Silent install/uninstall application
PBS_PackageControlEnum.PACKAGE_SILENCE_INSTALL: Install
PBS_PackageControlEnum.PACKAGE_SILENCE_UNINSTALL: Uninstall
path: apk path of the application to install/package name of the application to uninstall
callback: calling back interfaces, whether the install/uninstall is successful
Return value: None
Method of calling: Pvr_UnitySDKAPI.ToBService.UPvr_ControlAPPManger(PBS_PackageControlEnum.PACKAGE_SILENCE_UNINSTALL, “com.xxx.xxx”,callback)