/*******************************************************************************
Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
NOTICE:All information contained herein is, and remains the property of
PICO Technology Co., Ltd. The intellectual and technical concepts
contained herein are proprietary to PICO Technology Co., Ltd. and may be
covered by patents, patents in process, and are protected by trade secret or
copyright law. Dissemination of this information or reproduction of this
material is strictly forbidden unless prior written permission is obtained from
PICO Technology Co., Ltd.
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
namespace Unity.XR.PXR
{
public class PXR_MotionTracking
{
#region Eye Tracking
//Eye Tracking
public const int PXR_EYE_TRACKING_API_VERSION = 1;
///
/// Wants eye tracking service for the current app.
///
/// Returns `0` for success and other values for failure.
[Obsolete("WantEyeTrackingService is not supported..", true)]
public static int WantEyeTrackingService()
{
return -1;
}
///
/// Gets whether the current device supports eye tracking.
///
///
/// Returns a bool indicating whether eye tracking is supported:
/// * `true`: supported
/// * `false`: not supported
///
///
/// Returns the number of eye tracking modes supported by the current device.
///
///
/// Returns the eye tracking modes supported by the current device.
///
/// Returns `0` for success and other values for failure.
public static int GetEyeTrackingSupported(ref bool supported, ref int supportedModesCount, ref EyeTrackingMode[] supportedModes)
{
return PXR_Plugin.MotionTracking.UPxr_GetEyeTrackingSupported(ref supported, ref supportedModesCount, ref supportedModes);
}
///
/// Starts eye tracking.
/// @note Only supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
///
/// Passes the information for starting eye tracking.
///
/// Returns `0` for success and other values for failure.
public static int StartEyeTracking(ref EyeTrackingStartInfo startInfo)
{
startInfo.SetVersion(PXR_EYE_TRACKING_API_VERSION);
return PXR_Plugin.MotionTracking.UPxr_StartEyeTracking1(ref startInfo);
}
///
/// Stops eye tracking.
/// @note Only supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
///
/// Passes the information for stopping eye tracking. Currently, you do not need to pass anything.
/// Returns `0` for success and other values for failure.
public static int StopEyeTracking(ref EyeTrackingStopInfo stopInfo)
{
stopInfo.SetVersion(PXR_EYE_TRACKING_API_VERSION);
return PXR_Plugin.MotionTracking.UPxr_StopEyeTracking1(ref stopInfo);
}
///
/// Gets the state of eye tracking.
/// @note Only supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
///
/// Returns a bool that indicates whether eye tracking is working:
/// * `true`: eye tracking is working
/// * `false`: eye tracking has been stopped
///
/// Returns the eye tracking state information, including the eye tracking mode and eye tracking state code.
/// Returns `0` for success and other values for failure.
public static int GetEyeTrackingState(ref bool isTracking, ref EyeTrackingState state)
{
state.SetVersion(PXR_EYE_TRACKING_API_VERSION);
return PXR_Plugin.MotionTracking.UPxr_GetEyeTrackingState(ref isTracking, ref state);
}
///
/// Gets eye tracking data.
/// @note Only supported by PICO Neo3 Pro Eye, PICO 4 Pro, and PICO 4 Enterprise.
///
/// Specifies the eye tracking data you want.
/// Returns the desired eye tracking data.
/// Returns `0` for success and other values for failure.
public static int GetEyeTrackingData(ref EyeTrackingDataGetInfo getInfo, ref EyeTrackingData data)
{
getInfo.SetVersion(PXR_EYE_TRACKING_API_VERSION);
data.SetVersion(PXR_EYE_TRACKING_API_VERSION);
return PXR_Plugin.MotionTracking.UPxr_GetEyeTrackingData1(ref getInfo, ref data);
}
//PICO4E
///
/// Gets the opennesses of the left and right eyes.
/// @note
/// - Only supported by PICO 4 Enterprise.
/// - To use this API, you need to add `` to the app's AndroidManifest.xml file.
///
/// The openness of the left eye, which is a float value ranges from `0.0` to `1.0`. `0.0` indicates completely closed, `1.0` indicates completely open.
/// The openness of the right eye, which is a float value ranges from `0.0` to `1.0`. `0.0` indicates completely closed, `1.0` indicates completely open.
/// Returns `0` for success and other values for failure.
public static int GetEyeOpenness(ref float leftEyeOpenness, ref float rightEyeOpenness)
{
return PXR_Plugin.MotionTracking.UPxr_GetEyeOpenness(ref leftEyeOpenness, ref rightEyeOpenness);
}
///
/// Gets the information about the pupils of both eyes.
/// @note
/// - Only supported by PICO 4 Enterprise.
/// - To use this API, you need to add `` to the app's AndroidManifest.xml file.
///
/// Returns the diameters and positions of both pupils.
/// Returns `0` for success and other values for failure.
public static int GetEyePupilInfo(ref EyePupilInfo eyePupilPosition)
{
return PXR_Plugin.MotionTracking.UPxr_GetEyePupilInfo(ref eyePupilPosition);
}
///
/// Gets the pose of the left and right eyes.
/// @note
/// - Only supported by PICO 4 Enterprise.
/// - To use this API, you need to add `` to the app's AndroidManifest.xml file.
///
/// Returns the timestamp (unit: nanosecond) of the eye pose information.
/// Returns the position and rotation of the left eye.
/// Returns the position and rotation of the right eye.
/// Returns `0` for success and other values for failure.
public static int GetPerEyePose(ref long timestamp, ref Posef leftEyePose, ref Posef rightPose)
{
return PXR_Plugin.MotionTracking.UPxr_GetPerEyePose(ref timestamp, ref leftEyePose, ref rightPose);
}
///
/// Gets whether the left and right eyes blinked.
/// @note
/// - Only supported by PICO 4 Enterprise.
/// - To use this API, you need to add `` to the app's AndroidManifest.xml file.
///
/// Returns the timestamp (in nanoseconds) of the eye blink information.
/// Returns whether the left eye blinked:
/// - `true`: blinked (the user's left eye is closed, which will usually open again immediately to generate a blink event)
/// - `false`: didn't blink (the user's left eye is open)
///
/// Returns whether the right eye blined:
/// - `true`: blinked (the user's right eye is closed, which will usually open again immediately to generate a blink event)
/// - `false`: didn't blink (the user's right eye is open)
///
/// Returns `0` for success and other values for failure.
public static int GetEyeBlink(ref long timestamp, ref bool isLeftBlink, ref bool isRightBlink)
{
return PXR_Plugin.MotionTracking.UPxr_GetEyeBlink(ref timestamp, ref isLeftBlink, ref isRightBlink);
}
#endregion
#region Face Tracking
//Face Tracking
public const int PXR_FACE_TRACKING_API_VERSION = 1;
///
/// Wants face tracking service for the current app.
///
/// Returns `0` for success and other values for failure.
[Obsolete("WantFaceTrackingService is not supported..", true)]
public static int WantFaceTrackingService()
{
return -1;
}
///
/// Gets whether the current device supports face tracking.
///
/// Indicates whether the device supports face tracking:
/// * `true`: support
/// * `false`: not support
///
/// Returns the total number of face tracking modes supported by the device.
/// Returns the specific face tracking modes supported by the device.
/// Returns `0` for success and other values for failure.
[Obsolete("GetFaceTrackingSupported is not supported..", true)]
public static unsafe int GetFaceTrackingSupported(ref bool supported, ref int supportedModesCount, ref FaceTrackingMode[] supportedModes)
{
// return PXR_Plugin.MotionTracking.UPxr_GetFaceTrackingSupported(ref supported, ref supportedModesCount, ref supportedModes);
return -1;
}
///
/// Starts face tracking.
/// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
///
/// Passes the information for starting face tracking.
/// Returns `0` for success and other values for failure.
[Obsolete("StartFaceTracking is not supported..", true)]
public static int StartFaceTracking(ref FaceTrackingStartInfo startInfo)
{
// startInfo.SetVersion(PXR_FACE_TRACKING_API_VERSION);
// return PXR_Plugin.MotionTracking.UPxr_StartFaceTracking(ref startInfo);
return -1;
}
///
/// Stops face tracking.
/// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
///
/// Passes the information for stopping face tracking.
/// Returns `0` for success and other values for failure.
[Obsolete("StopFaceTracking is not supported..", true)]
public static int StopFaceTracking(ref FaceTrackingStopInfo stopInfo)
{
// stopInfo.SetVersion(PXR_FACE_TRACKING_API_VERSION);
// return PXR_Plugin.MotionTracking.UPxr_StopFaceTracking(ref stopInfo);
return -1;
}
///
/// Gets the state of face tracking.
/// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
///
/// Returns a bool indicating whether face tracking is working:
/// * `true`: face tracking is working
/// * `false`: face tracking has been stopped
///
/// Returns the state of face tracking, including the face tracking mode and face tracking state code.
///
/// Returns `0` for success and other values for failure.
[Obsolete("GetFaceTrackingState is not supported..", true)]
public static int GetFaceTrackingState(ref bool isTracking, ref FaceTrackingState state)
{
// state.SetVersion(PXR_FACE_TRACKING_API_VERSION);
// return PXR_Plugin.MotionTracking.UPxr_GetFaceTrackingState(ref isTracking, ref state);
return -1;
}
///
/// Gets face tracking data.
/// @note Supported by PICO 4 Pro and PICO 4 Enterprise.
///
/// Specifies the face tracking data you want.
/// Returns the desired face tracking data.
/// Returns `0` for success and other values for failure.
[Obsolete("GetFaceTrackingData is not supported..", true)]
public static int GetFaceTrackingData(ref FaceTrackingDataGetInfo getInfo, ref FaceTrackingData data)
{
// getInfo.SetVersion(PXR_FACE_TRACKING_API_VERSION);
// data.SetVersion(PXR_FACE_TRACKING_API_VERSION);
// return PXR_Plugin.MotionTracking.UPxr_GetFaceTrackingData1(ref getInfo, ref data);
return -1;
}
#endregion
#region Body Tracking
///
/// A callback function that notifies calibration exceptions.
/// The user then needs to recalibrate with PICO Motion Tracker.
///
[Obsolete("BodyTrackingAbnormalCalibrationData is not supported..", true)]
public static Action BodyTrackingAbnormalCalibrationData;
/// You can use this callback function to receive the status code and error code for body tracking.
///
/// - `BodyTrackingStatusCode`: The status code.
/// - `BodyTrackingErrorCode`: The error code.
///
[Obsolete("BodyTrackingStateError is not supported..", true)]
public static Action BodyTrackingStateError;
/// You can use this callback function to get notified when the action status of a tracked bone node changes.
///
/// - `int`: Returns the bone No., and only `7` (`LEFT_ANKLE`) and `8` (`RIGHT_ANKLE`) are available currently. You can use the change of the status of the left and right ankles to get the foot-down action of the left and right feet.
/// - `BodyActionList`: Receiving the `PxrFootDownAction` event indicates that the left and/or right foot has stepped on the floor.
///
[Obsolete("BodyTrackingAction is not supported..", true)]
public static Action BodyTrackingAction;
/// Launches the PICO Motion Tracker app to perform calibration.
/// - For PICO Motion Tracker (Beta), the user needs to follow the instructions on the home of the PICO Motion Tracker app to complete calibration.
/// - For PICO Motion Tracker (Official), "single-glance calibration" will be performed. When a user has a glance at the PICO Motion Tracker on their lower legs, calibration is completed.
///
///
/// - `0`: success
/// - `1`: failure
///
public static int StartMotionTrackerCalibApp()
{
return PXR_Plugin.MotionTracking.UPxr_StartMotionTrackerCalibApp();
}
/// Gets whether the current device supports body tracking.
/// Returns whether the current device supports body tracking:
/// - `true`: support
/// - `false`: not support
///
///
/// - `0`: success
/// - `1`: failure
///
public static int GetBodyTrackingSupported(ref bool supported)
{
return PXR_Plugin.MotionTracking.UPxr_GetBodyTrackingSupported(ref supported);
}
/// Starts body tracking.
/// Specifies the body tracking mode (default or high-accuracy).
/// Specifies lengths (unit: cm) for the bones of the avatar, which is only available for the `BTM_FULL_BODY_HIGH` mode.
/// Bones that are not set lengths for will use the default values.
///
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Please use StartBodyTracking(BodyJointSet JointSet, BodyTrackingBoneLength boneLength)")]
public static int StartBodyTracking(BodyTrackingMode mode, BodyTrackingBoneLength boneLength)
{
return StartBodyTracking(BodyJointSet.BODY_JOINT_SET_BODY_FULL_START,boneLength);
}
///
/// >Starts body tracking.
///
/// Specifies the set of body joints to be tracked.
/// Specifies lengths (unit: cm) for the bones of the avatar. Bones that are not set lengths for will use the default values.
///
/// - `0`: success
/// - `1`: failure
///
public static int StartBodyTracking(BodyJointSet JointSet, BodyTrackingBoneLength boneLength)
{
return PXR_Plugin.MotionTracking.UPxr_StartBodyTracking(JointSet,boneLength);
}
/// Stops body tracking.
///
/// - `0`: success
/// - `1`: failure
///
public static int StopBodyTracking()
{
return PXR_Plugin.MotionTracking.UPxr_StopBodyTracking();
}
/// Gets the state of PICO Motion Tracker and, if any, the reason for an exception.
/// Indicates whether the PICO Motion Tracker is tracking normally:
/// - `true`: is tracking
/// - `false`: tracking lost
///
/// Returns the information about body tracking state.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Please use GetBodyTrackingState(ref bool isTracking, ref BodyTrackingStatus state)")]
public static int GetBodyTrackingState(ref bool isTracking, ref BodyTrackingState state)
{
BodyTrackingStatus bs2 = new BodyTrackingStatus();
int ret = GetBodyTrackingState(ref isTracking, ref bs2);
state.stateCode=bs2.stateCode;
state.errorCode=(BodyTrackingErrorCode)bs2.message;
return ret;
}
///
/// >Gets the state of body tracking.
///
/// Indicates whether the PICO Motion Tracker is tracking the body normally:
/// - `true`: is tracking
/// - `false`: tracking lost
///
/// Returns the current status of body tracking.
///
/// - `0`: success
/// - `1`: failure
///
public static int GetBodyTrackingState(ref bool isTracking, ref BodyTrackingStatus state)
{
return PXR_Plugin.MotionTracking.UPxr_GetBodyTrackingState(ref isTracking, ref state);
}
/// Gets body tracking data.
/// Specifies the display time and the data filtering flags.
/// For the display time, for example, when it is set to 0.1 second, it means predicting the pose of the tracked node 0.1 seconds ahead.
///
/// Returns the array of data for all tracked nodes.
///
/// - `0`: success
/// - `1`: failure
///
public static int GetBodyTrackingData(ref BodyTrackingGetDataInfo getInfo, ref BodyTrackingData data)
{
return PXR_Plugin.MotionTracking.UPxr_GetBodyTrackingData(ref getInfo, ref data);
}
#endregion
#region Motion Tracker
//Motion Tracker
///
/// You can use this callback function to get notified when the connection state of PICO Motion Tracker changes.
/// For connection status, `0` indicates "disconnected" and `1` indicates "connected".
///
[Obsolete("Deprecated",true)]
public static Action MotionTrackerNumberOfConnections;
///
/// You can use this callback function to get notified when the battery level of PICO Motion Tracker changes.
///
///
/// The ID and battery level of the PICO Motion Tracker.
/// - For PICO Motion Tracker (Beta), the value range of battery level is [0,5].
/// `0` indicates a low battery, which can affect the tracking accuracy.
///
[Obsolete("Deprecated",true)]
public static Action MotionTrackerBatteryLevel;
///
/// You can use this callback function to get the key actions of the motion tracker.
///
[Obsolete("Deprecated",true)]
public static Action MotionTrackerKeyAction;
///
/// You can use this callback function to get notified if the tracking mode changes.
/// - `0`: body tracking
/// - `1`: object tracking
///
[Obsolete("Deprecated",true)]
public static Action MotionTrackingModeChangedAction;
///
/// You can use the callback function to whether if PICO Motion Trackers are successfully connected to your PICO headset.
///
public static Action RequestMotionTrackerCompleteAction;
///
/// You can use this callback function to be notified when the connection state of PICO Motion Tracker changes.
///
public static Action MotionTrackerConnectionAction;
///
/// You can use this callback function to receive events for the Power key of PICO Motion Trackers.
///
public static Action MotionTrackerPowerKeyAction;
/// Gets the number of trackers currently connected and their serial numbers.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use MotionTrackerConnectionAction instead", true)]
public static int GetMotionTrackerConnectStateWithSN(ref MotionTrackerConnectState connectState)
{
return -1;
}
/// Gets the type of the PICO Motion Tracker connected.
/// The type of the motion tracker (beta or official).
[Obsolete("Deprecated",true)]
public static MotionTrackerType GetMotionTrackerDeviceType()
{
return MotionTrackerType.MT_2;
}
/// Checks whether the current tracking mode and the number of motion trackers connected are as wanted.
/// If not, a panel will appear to let the user switch the tracking mode and perform calibration accordingly.
/// Specifies the wanted tracking mode.
/// Specifies the expected number of motion trackers. Value range: [0,3].
/// - If you set `mode` to `BodyTracking`, you do not need to set this parameter as it will not work even if you set it.
/// - If you set `mode` to `MotionTracking`, the default value of this parameter will be 0, and you can select a value from range [0,3].
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use CheckMotionTrackerNumber instead")]
public static int CheckMotionTrackerModeAndNumber(MotionTrackerMode mode, MotionTrackerNum number = MotionTrackerNum.ONE)
{
return CheckMotionTrackerNumber(number);
}
///
/// Checks whether the current tracking mode and the number of motion trackers connected are as expected.
/// If not, a panel will appear to let the user switch the tracking mode and perform calibration accordingly.
///
/// Specifies the expected number of motion trackers. Value range: [0,3]. You can get the result from callback `RequestMotionTrackerCompleteAction`.
///
///
/// - `0`: success
/// - `1`: failure
///
public static int CheckMotionTrackerNumber(MotionTrackerNum number)
{
return PXR_Plugin.MotionTracking.UPxr_CheckMotionTrackerNumber((int)number);
}
/// Gets the current tracking mode of the PICO Motion Tracker connected.
/// The current tracking mode.
[Obsolete("Deprecated")]
public static MotionTrackerMode GetMotionTrackerMode()
{
return MotionTrackerMode.MotionTracking;
}
/// Gets the location of a PICO Motion Tracker which is set to the "motion tracking" mode.
/// Specifies the serial number of the motion tracker to get position for. You can pass only one serial number in one request.
/// Returns the location of the specified motion tracker.
/// Returns the confidence of the returned data.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use GetMotionTrackerLocation instead",true)]
public static int GetMotionTrackerLocations(TrackerSN trackerSN, ref MotionTrackerLocations locations, ref MotionTrackerConfidence confidence, double predictTime = 0)
{
return -1;
}
///
/// Gets the location of a PICO Motion Tracker which is set to the "motion tracking" mode.
///
/// Specifies the serial number of the motion tracker to get position for. You can pass only one serial number in one request.
/// Returns the location of the specified motion tracker.
/// Whether the returned pose data is valid:
/// - `true`: valid
/// - `false`: invalid
///
///
/// - `0`: success
/// - `1`: failure
///
public static int GetMotionTrackerLocation(long trackerid,ref MotionTrackerLocation location,ref bool isValidPose)
{
return PXR_Plugin.MotionTracking.UPxr_GetMotionTrackerLocation(trackerid, ref location, ref isValidPose);
}
///
/// Gets the battery of a PICO Motion Tracker.
///
/// Specifies the serial number of the motion tracker to get battery for.
/// Returns the battery of the motion tracker. Value range: [0,1]. The higher the value, the higher the current battery.
/// Returns the charging status of the motion tracker.
///
/// - `0`: success
/// - `1`: failure
///
public static int GetMotionTrackerBattery(long trackerid,ref float battery, ref XrBatteryChargingState charger)
{
return PXR_Plugin.MotionTracking.UPxr_GetMotionTrackerBatteryState(trackerid, ref battery, ref charger);
}
#endregion
#region Motion Tracker For External Device
/// You can use this callback function to get notified when the connection state of the external device changes.
/// The connection state of the external device.
[Obsolete("Deprecated.Please use ExpandDeviceConnectionAction instead",true)]
public static Action ExtDevConnectAction;
/// You can use this callback function to get notified when the battery level and charging status of the external device changes.
/// The current better level and charging status of the external device.
[Obsolete("Deprecated.Please use ExpandDeviceBatteryAction instead",true)]
public static Action ExtDevBatteryAction;
///
/// You need to listen for this event to call the `GetExtDevTrackerByPassData` API:
/// - When receiving `1`, it is necessary to call the `PXR_GetExtDevTrackerByPassData` API to obtain the data passed through.
/// - When receiving `0`, stop obtaining the data passed through.
///
public static Action ExtDevPassDataAction;
/// You can use this callback function to get notified when the state of the connection between the PICO Motion Tracker and an external device changes.
/// The series number of the motion tracker connected to the external device and the connection state (`0`: disconnected; `1`: connected).
public static Action ExpandDeviceConnectionAction;
/// You can use this callback function to get notified when the battery level and charging status of the external device changes.
/// The current better level and charging status of the external device.
public static Action ExpandDeviceBatteryAction;
/// Gets the connection state of the external device.
/// Returns the connection state of the external device.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use ExpandDeviceConnectionAction instead",true)]
public static int GetExtDevTrackerConnectState(ref ExtDevTrackerConnectState connectState)
{
return -1;
}
/// Sets vibration for the external device.
/// Specifies vibration settings.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use SetExpandDeviceVibrate instead",true)]
public static int SetExtDevTrackerMotorVibrate(ref ExtDevTrackerMotorVibrate motorVibrate)
{
return -1;
}
/// Sets the state for data passthrough-related APIs.
/// Specifies the state of data passthrough-related APIs according to actual needs:
/// Before calling `SetExpandDeviceCustomData` and `GetExpandDeviceCustomData`, set `state` to `true` to enable these APIs, or set `state` to `false` to disable these APIs.
///
///
/// - `0`: success
/// - `1`: failure
///
public static int SetExtDevTrackerPassDataState(bool state)
{
return PXR_Plugin.MotionTracking.UPxr_SetExpandDeviceCustomDataCapability(state);
}
/// Sets data passthrough for the external device. The protocol is defined by yourself according to your own hardware.
/// There is no correspondence between the `set` and `get`-related methods themselves.
/// When PICO SDK's APIs are unable to meet your needs, you can define custom protocols and place them in the `passData` parameter.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use SetExpandDeviceCustomData instead",true)]
public static int SetExtDevTrackerByPassData(ref ExtDevTrackerPassData passData)
{
return -1;
}
/// Gets the data passed through for an external device.
/// Returns the details of the data passed through.
/// Returns the number of `passData` arrays filled by the underlying layer.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use GetExpandDeviceCustomData instead",true)]
public static int GetExtDevTrackerByPassData(ref ExtDevTrackerPassDataArray passData, ref int realLength)
{
return -1;
}
/// Gets the battery level of the external device.
/// Specifies the serial number of the external device the get battery level for.
/// Returns the current battery level of the external device. Value range: [0,10].
/// Returns whether the external device is charging:
/// - `0`: not charging
/// - `1`: charging
///
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated.Please use GetExpandDeviceBattery instead",true)]
public static int GetExtDevTrackerBattery(ref TrackerSN trackerSN, ref int battery, ref int charger)
{
return -1;
}
/// Gets the key values of the external device.
/// Specifies the serial number of the external device to get key values for.
/// Returns the key values of the specified external device.
///
/// - `0`: success
/// - `1`: failure
///
[Obsolete("Deprecated",true)]
public static int GetExtDevTrackerKeyData(ref TrackerSN trackerSN, ref ExtDevTrackerKeyData keyData)
{
return -1;
}
///
/// Sets vibration for the external device. The vibration command is passed to the external device via the PICO Motion Tracker connected to it.
///
/// Specifies the serial number of the external device.
/// Specifies vibration settings.
///
/// - `0`: success
/// - `1`: failure
///
public static int SetExpandDeviceVibrate(long deviceid, ExpandDeviceVibrate motorVibrate)
{
return PXR_Plugin.MotionTracking.UPxr_SetExpandDeviceVibrate(deviceid, motorVibrate);
}
///
/// Gets the array of serial numbers of the external devices connected to PICO Motion Trackers.
///
/// Returns the array of serial numbers.
///
/// - `0`: success
/// - `1`: failure
///
public static int GetExpandDevice(out long[] deviceArray)
{
return PXR_Plugin.MotionTracking.UPxr_GetExpandDevice(out deviceArray);
}
///
/// Gets the battery level of the external device.
///
/// Specifies the serial number of the external device to get battery level for.
/// Returns the current battery level of the external device. Value range: [0,1]. The higher the value, the higher the battery.
/// Returns the charging status of the external device.
///
/// - `0`: success
/// - `1`: failure
///
public static int GetExpandDeviceBattery(long deviceid, ref float battery, ref XrBatteryChargingState charger)
{
return PXR_Plugin.MotionTracking.UPxr_GetExpandDeviceBattery(deviceid, ref battery, ref charger);
}
///
/// Gets the data passed from external devices.
///
/// Returns the array of data passed from external devices.
///
/// - `0`: success
/// - `1`: failure
///
public static int GetExpandDeviceCustomData(out List dataArray)
{
return PXR_Plugin.MotionTracking.UPxr_GetExpandDeviceCustomData(out dataArray);
}
///
/// Sets the data to be passed to external devices. The protocol is defined by yourself according to your own hardware.
///
/// Specifies the array of data to be passed to external devices.
///
/// - `0`: success
/// - `1`: failure
///
public static int SetExpandDeviceCustomData(ref ExpandDevicesCustomData[] dataArray)
{
return PXR_Plugin.MotionTracking.UPxr_SetExpandDeviceCustomData(ref dataArray);
}
#endregion
}
}