6 Overview of API Functions¶
6.1 Get Version Info¶
UPvr_GetUnitySDKVersion¶
Name
- public static string UPvr_GetUnitySDKVersion ()
Functionality
- Acquire SDK version number
Parameters
- None
Return Value
- SDK Version Number
Call Method
- Pvr_UnitySDKAPI.System.UPvr_GetUnitySDKVersion()
6.2 Sensor Tracking¶
UPvr_StartSensor¶
Name
- public static int UPvr_StartSensor(int index)
Functionality
- Enable sensor tracking
Parameters
- Index: 0, main sensor; 1, subsidiary sensor.
- Main sensor is the HMD sensor of Pico Neo DK/DKS, Pico Neo and Goblin, namely the head tracking sensor;
- subsidiary sensor is the sensor of DK/DKS game controller, which is the hand tracking sensor, the same below.
Return Value
- 0: Call succeeded; 1: Call failed
Call Method
- Pvr_UnitySDKAPI.Sensor.UPvr_StartSensor(index)
UPvr_ResetSensor¶
Name
- public static int UPvr_ResetSensor(int index)
Functionality
- Reset sensor tracking
Parameters
- Index: 0, main sensor; 1, subsidiary sensor
Return Value
- 0: Call succeeded; 1: Call failed
Call Method
- Pvr_UnitySDKAPI.Sensor.UPvr_ResetSensor(index)
UPvr_StopSensor¶
Name
- public static int UPvr_StopSensor(int index)
Functionality
- Close sensor tracking
Parameters
- Index: 0, main sensor; 1, subsidiary sensor.
Return Value
- 0: Call succeeded; 1: Call failed
Call Method
- Pvr_UnitySDKAPI.Sensor.UPvr_StopSensor(index)
6.4 Battery, Volume, Brightness Services¶
UPvr_InitBatteryVolClass¶
Name
- public bool UPvr_InitBatteryVolClass()
Functionality
- Initialize battery, volume and brightness services
- (Please call this interface for initialization before using battery, volume and brightness services)
Parameters
- None
Return Value
- Initialization succeeded or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_InitBatteryVolClass()
UPvr_StartAudioReceiver¶
Name
- public bool UPvr_StartAudioReceiver ()
Functionality
- Start audio service
Parameters
- None
Return Value
- Whether it’s started successfully or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StartAudioReceiver()
UPvr_SetAudio¶
Name
- public void UPvr_SetAudio(string s)
Functionality
- Notify Unity of the value of current volume when the volume changes
Parameters
- The value of the volume after change
Return Value
- None
Call Method
- This interface is a low-level Android call and unity doesn’t need to call it. If you need to perform any operations when volume changes, write the related logics in this method.
UPvr_StopAudioReceiver¶
Name
- public bool UPvr_StopAudioReceiver ()
Functionality
- Stop volume service
Parameters
- None
Return Value
- Whether it’s stopped or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StopAudioReceiver()
UPvr_StartBatteryReceiver¶
Name
- public bool UPvr_StartBatteryReceiver ()
Functionality
- Start battery service
Parameters
- None
Return Value
- Whether it’s started or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StartBatteryReceiver()
UPvr_SetBattery¶
Name
- public void UPvr_SetBattery(string s)
Functionality
- Notify Unity of the current battery level when battery level changes
Parameters
- The battery level after change (in 0.00~1.00)
Return Value
- None
Call Method
- This interface is a low-level Android call and unity doesn’t need to call it. If you need to perform any operations when battery level changes, write the related logics in this method.
UPvr_StopBatteryReceiver¶
Name
- public bool UPvr_StopBatteryReceiver ()
Functionality
- Stop battery service
Parameters
- None
Return Value
- Whether it’s stopped or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_StopBatteryReceiver()
UPvr_VolumeUp¶
Name
- public bool UPvr_VolumeUp ()
Functionality
- Tune up the volume
Parameters
- None
Return Value
- Whether it succeeded or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_VolumeUp()
UPvr_VolumeDown¶
Name
- public bool UPvr_VolumeDown ()
Functionality
- Tune down the volume
Parameters
- None
Return Value
- Whether it succeeded or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_VolumeDown()
UPvr_SetBrightness¶
Name
- public bool UPvr_SetBrightness(int brightness)
Functionality
- Set brightness (available to regular mobile phone versions, not applicable for Pico Neo)
Parameters
- The value of the brightness (the value is between 0 and 255)
Return Value
- Whether it succeeded or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_SetBrightness(bn)
UPvr_GetScreenBrightnessLevel¶
Name
- public static int[] UPvr_GetScreenBrightnessLevel()
Functionality
- Get current screen brightness level (applicable for Goblin only)
Parameters
- None
Return Value
- int array. The first digit is the total brightness level supported, the second is the current brightness level and from the third to the end is the brightness interval values.
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_GetScreenBrightnessLevel()
UPvr_SetScreenBrightnessLevel¶
Name
- public static void UPvr_SetScreenBrightnessLevel(int vrBrightness, int level)
Functionality
- Set screen brightness (applicable for Goblin only)
Parameters
- vrBrightness:brightness mode; level: brightness value (value of the brightness level)
- if vrBrightness passes 1, level should pass the brightness level; if vrBrightness passes 0, representing the system default brightness mode, then level can be set to any value in 1~255.
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_SetScreenBrightnessLevel(vrBrightness,level)
UPvr_IsHmdExist¶
Name
- public bool UPvr_IsHmdExist()
Functionality
- Check if it’s an HMD headset
Parameters
- None
Return Value
- If true, it is HMD; false, not HMD
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_IsHmdExist()
UPvr_GetHmdScreenBrightness¶
Name
- public int UPvr_GetHmdScreenBrightness()
Functionality
- Get current brightness value of current HMD device (applicable for Pico Neo only)
Parameters
- None
Return Value
- Int, current brightness value (in 0~255)
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_GetHmdScreenBrightness()
UPvr_SetHmdScreenBrightness¶
Name
- public bool UPvr_SetHmdScreenBrightness(int brightness)
Functionality
- Set the brightness value of HMD device (applicable for PicoNeo only)
Parameters
- Brightness value (in 0~255)
Return Value
- Whether it’s successfully set or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_SetHmdScreenBrightness(brightness)
UPvr_GetCommonBrightness¶
Name
- public int UPvr_GetCommonBrightness()
Functionality
- Get the current brightness value of common devices (applicable for Pico Neo and other regular mobile phones)
Parameters
- None
Return Value
- Current brightness value (in 0~255)
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_GetCommonBrightness()
UPvr_SetCommonBrightness¶
Name
- public bool UPvr_SetCommonBrightness(int brightness)
Functionality
- Set brightness for common devices (applicable for Pico Neo and other regular mobile phones)
Parameters
- Current brightness value (in 0~255)
Return Value
- Whether it’s successfully set or not
Call Method
- Pvr_UnitySDKAPI.VolumePowerBrightness.UPvr_SetCommonBrightness(brightness)
6.5 Setting Surround Stereo Sound (Applicable for PicoNeo DK/DKS Only)¶
UPvr_OpenEffects¶
Name
- public void UPvr_OpenEffects()
Functionality
- Open effects library
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_OpenEffects()
UPvr_CloseEffects¶
Name
- public void UPvr_CloseEffects()
Functionality
- Close effects library
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_CloseEffects()
UPvr_EnableSurround¶
Name
- public void UPvr_EnableSurround()
Functionality
- Enable surround sound
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_EnableSurround()
UPvr_SetSurroundroomType¶
Name
- public void UPvr_SetSurroundroomType(int type)
Functionality
- Set the size of the surround sound mock room
Parameters
- Value of type: 1 - small room, 2 - medium, 3 - large (Surround sound must be enabled first)
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_SetSurroundroomType()
UPvr_OpenRoomcharacteristics¶
Name
- public void UPvr_OpenRoomcharacteristics()
Functionality
- Turn on the sound reflection from the mock room wall material when damped (surround sound must be enabled first)
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_OpenRoomcharacteristics()
UPvr_CloseRoomcharacteristics¶
Name
- public void UPvr_CloseRoomcharacteristics()
Functionality
- Turn off sound reflection from the mock room wall material when damped
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_CloseRoomcharacteristics()
UPvr_EnableReverb¶
Name
- public void UPvr_EnableReverb()
Functionality
- Algorithm to enable echo
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_EnableReverb()
6.6 Audio Play¶
UPvr_StartAudioEffect¶
Name
- public void UPvr_StartAudioEffect(String audioFile,bool isSdcard)
Functionality
- Set the absolute path of audio file to play
Parameters
- audioFile, the absolute path that audio files in Pico Android devices.
- For example: string audioFile = “/sdcard/ test.mp3”;
- string audioFile = ” /system/newdir/GuitarLoop.wav”;
- where “isSdcardis” a reserved interface that can be set to true
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_StartAudioEffect(audioFile,isSdcard)
UPvr_StopAudioEffect¶
Name
- public void UPvr_StopAudioEffect()
Functionality
- Stop playing audio
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.UPvr_StopAudioEffect()
UPvr_ReleaseAudioEffect¶
Name
- public void UPvr_ReleaseAudioEffect()
Functionality
- Release audio
- (cannot reload audio when it’s called. We recommend to invoke it upon exit)
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.Audio3D.releaseAudioEffect()
6.7 Head-mounted Distance Sensor¶
UPvr_InitPsensor¶
Name
- public static void UPvr_InitPsensor()
Functionality
- Initialize distance sensor
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI. Sensor. UPvr_InitPsensor ()
UPvr_GetPsensorState¶
Name
- public static int UPvr_GetPsensorState()
Functionality
- Get the state of head-mounted distance sensor
Parameters
- None
Return Value
- Return 0 when it’s worn on head, return 1 when it’s away
Call Method
- Pvr_UnitySDKAPI. Sensor. UPvr_GetPsensorState()
- Note: UPvr_InitPsensor should be called for initialization before getting Psensor’s state
UPvr_UnregisterPsensor¶
Name
- public static void UPvr_UnregisterPsensor ()
Functionality
- Release distance sensor
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI. Sensor. UPvr_UnregisterPsensor ()
6.8 Motor Vibration (Available to PicoNeo DK/DKS only)¶
UPvr_HasControllerVibrator¶
Name
- public static bool UPvr_HasControllerVibrator()
Functionality
- Check whether motor vibration is supported
Parameters
- None
Return Value
- Whether motor vibration is supported
Call Method
- Pvr_UnitySDKAPI. Haptics. UPvr_HasControllerVibrator ()
UPvr_SetControllerVibrateMode¶
Name
- public static void UPvr_SetControllerVibrateMode(int[] pattern, int length, int repeat)
Functionality
- Set intermittent vibration mode
Parameters
- int[] pattern =new int[5] { vibrationDuration,silienceDuration,repeat_times, vibrationStrength, whichHaptic }
- vibrationDuration: vibration duration in ms
- silienceDuration: silent duration in ms
- repeat_times: times to repeat
- vibrationStrength: vibration strength (in 0—127)
- whichHaptic: specify the motor: 1 – left, 2 – right, 3 – left and right
- length: pattern length, must be 5
- repeat: set to 1
Return Value
- None
Call Method
- Pvr_UnitySDKAPI. Haptics. UPvr_SetControllerVibrateMode(pattern, length, repeat)
UPvr_SetControllerVibrateTime¶
Name
- public static void UPvr_SetControllerVibrateTime(int milliseconds)
Functionality
- Set continued vibration
Parameters
- Vibration time
Return Value
- None
Call Method
- Pvr_UnitySDKAPI. Haptics. UPvr_SetControllerVibrateTime (milliseconds)
UPvr_CancelControllerVibrate¶
Name
- public static void UPvr_CancelControllerVibrate()
Functionality
- Cancel controller vibration
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI. Haptics. UPvr_CancelControllerVibrate ()
6.9 Hardware Devices¶
UPvr_GetDeviceMode¶
Name
- public static DeviceMode UPvr_GetDeviceMode ()
Functionality
- Get device type
Parameters
- enum DeviceMode, including Pico NeoDKS, Pico NeoDK, Goblin, Pico Neo, Other
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.System.UPvr_GetDeviceMode ()
UPvr_GetDeviceSN¶
Name
- public static string UPvr_GetDeviceSN ()
Functionality
- Get device SN number
Parameters
- None
Return Value
- Get device SN number
Call Method
- Pvr_UnitySDKAPI.System.UPvr_GetDeviceSN ()
UPvr_ShutDown¶
Name
- public static void UPvr_ShutDown()
Functionality
- Shut down
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.System.UPvr_ShutDown ()
UPvr_Reboot¶
Name
- public static void UPvr_Reboot ()
Functionality
- Reboot
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI.System.UPvr_Reboot ()
UPvr_Sleep¶
Name
- public static void UPvr_Sleep ()
Functionality
- Turn off screen
Parameters
- None
Return Value
- None
Call Method
- Pvr_UnitySDKAPI. System. UPvr_Sleep ()
Note: When usingUPvr_ShutDown, UPvr_Reboot, UPvr_Sleepinterfaces, it’s necessary to add the following permissions to AndroidManifest and get system Name:
android:sharedUserId="android.uid.system"
<uses-permission android:name="android.permission.DEVICE_POWER" />