MagicLeapNativeBindings
NameSpace: Native
Defines C# API interface to C-API layer.
Inherited by:
MagicLeap.OpenXR.LegacySupport.MLHeadTracking.NativeBindings,
MagicLeap.OpenXR.LegacySupport.MLInput.NativeBindings,
UnityEngine.XR.MagicLeap.InputSubsystem.Extensions.Controller.NativeBindings,
UnityEngine.XR.MagicLeap.MagicLeapXrProviderNativeBindings,
UnityEngine.XR.MagicLeap.MLAnchors.NativeBindings,
UnityEngine.XR.MagicLeap.MLAudioOutput.NativeBindings,
UnityEngine.XR.MagicLeap.MLAudioPlayback.NativeBindings,
UnityEngine.XR.MagicLeap.MLEyeCamera.NativeBindings,
UnityEngine.XR.MagicLeap.MLGazeRecognition.NativeBindings,
UnityEngine.XR.MagicLeap.MLMarkerTracker.NativeBindings,
UnityEngine.XR.MagicLeap.MLMediaRecorder.NativeBindings,
UnityEngine.XR.MagicLeap.MLPowerManager.NativeBindings,
UnityEngine.XR.MagicLeap.MLSpace.NativeBindings,
UnityEngine.XR.MagicLeap.MLTime.NativeBindings,
UnityEngine.XR.MagicLeap.MLVoice.NativeBindings,
UnityEngine.XR.MagicLeap.MLWorldCamera.NativeBindings,
UnityEngine.XR.MagicLeap.PlanesSubsystem.NativeBindings
Public Methods
string MLGetResultString
Returns an ASCII string for MLResultGlobal codes.
public static string MLGetResultString(
MLResult.Code result
)
Parameters
Type | Name | Description |
---|---|---|
MLResult.Code | result | The input MLResult enum from ML API methods. |
Returns: An ASCII string containing readable version of result code.
bool MLHandleIsValid
Checks if 64 bit handle is valid.
public static bool MLHandleIsValid(
ulong handle
)
Parameters
Type | Name | Description |
---|---|---|
ulong | handle | The handle to check. |
Returns: true , if handle is valid, false if invalid.
IntPtr MLInputGetResultString
Returns a pointer to an ASCII string representation for each result code. This call can return a pointer to the string for any of the MLInput related MLResult codes. Developers should use MLResult.CodeToString(MLResult.Code).
public IntPtr MLInputGetResultString(
MLResult.Code result
)
Parameters
Type | Name | Description |
---|---|---|
MLResult.Code | result | MLResult type to be converted to string. |
Returns: Returns a pointer to an ASCII string containing readable version of the result code.
MLResult.Code MLPerceptionGetPredictedSnapshot
Pulls in the state of all persistent transforms and all enabled trackers extrapolated to the provided timestamp. This timestamp typically comes from out_frame_info.predicted_display_time out parameter from the MLGraphicsBeginFrameEx function. Returns a MLSnapshot with this latest state. This snap should be used for the duration of the frame being constructed and then released with a call to MLPerceptionReleaseSnapshot().
public MLResult.Code MLPerceptionGetPredictedSnapshot(
ulong timestamp,
ref IntPtr out_snapshot
)
Parameters
Type | Name | Description |
---|---|---|
ulong | timestamp | Timestamp representing the time for which to predict poses. |
ref IntPtr | out_snapshot | Pointer to a pointer containing an MLSnapshot on success. |
Returns: MLResult.Result will be MLResult.Code.Ok if operation was successful. MLResult.Result will be MLResult.Code.InvalidTimestamp if Timestamp is either more than 100ms in the future or too old for cached state. MLResult.Result will be MLResult.Code.InvalidParam if Output parameter was not valid (null). MLResult.Result will be MLResult.Code.PerceptionSystemNotStartede if Perception System has not been started.
MLResult.Code MLPerceptionGetSnapshot
Pull in the latest state of all persistent transforms and all enabled trackers extrapolated to the next frame time. Returns an MLSnapshot with this latest state. This snap should be used for the duration of the frame being constructed and then released with a call to MLPerceptionReleaseSnapshot().
public MLResult.Code MLPerceptionGetSnapshot(
ref IntPtr snapshot
)
Parameters
Type | Name | Description |
---|---|---|
ref IntPtr | snapshot | Pointer to a pointer containing an MLSnapshot on success. |
Returns: MLResult.Result will be MLResult.Code.Ok if operation was successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error.
MLResult.Code MLPerceptionReleaseSnapshot
Pull in the latest state of all persistent transforms and all enabled trackers extrapolated to the next frame time. Return an MLSnapshot with this latest state. This snap should be used for the duration of the frame being constructed and then released with a call to MLPerceptionReleaseSnapshot().
public MLResult.Code MLPerceptionReleaseSnapshot(
IntPtr snap
)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | snap | Pointer to a pointer containing an MLSnapshot on success. |
Returns: MLResult.Result will be MLResult.Code.Ok if a Snapshot was created successfully successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if a Snapshot was not created successfully.
MLResult.Code MLPlatformGetAPILevel
Query the OS for which Platform API Level is supported.
public MLResult.Code MLPlatformGetAPILevel(
ref uint level
)
Parameters
Type | Name | Description |
---|---|---|
ref uint | level | Pointer to an integer that will store the API level. |
Returns: MLResult.Result will be MLResult.Code.Ok if operation was successful. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.InvalidParam if level was not valid (null).
MLResult.Code MLSnapshotGetPoseInBase
Get transform between coordinate frame 'base_id' and the coordinate frame `id' as well as any derivatives that have been calculated.
public MLResult.Code MLSnapshotGetPoseInBase(
IntPtr snap,
ref MLCoordinateFrameUID base_id,
ref MLCoordinateFrameUID id,
ref MLPose outPose
)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | snap | A snapshot of tracker state. Can be obtained with MLPerceptionGetSnapshot(). |
ref MLCoordinateFrameUID | base_id | The coordinate frame in which to locate 'id'. |
ref MLCoordinateFrameUID | id | The coordinate frame which needs to be located in the base_id coordinate frame. |
ref MLPose | outPose | Valid pointer to an MLPose. To be filled out with requested pose data. |
Returns: MLResult.Result will be MLResult.Code.InvalidParam if failed to obtain transform due to invalid parameter. MLResult.Result will be MLResult.Code.Ok if obtained transform successfully. MLResult.Result will be MLResult.Code.PoseNotFoundk if coordinate Frame is valid, but not found in the current pose snapshot. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed to obtain transform due to internal error.
IntPtr MLSnapshotGetResultString
Returns a pointer to an ASCII string representation for each result code. This call can return a pointer to the string for any of the MLSnapshot related MLResult codes. Developers should use MLResult.CodeToString(MLResult.Code).
public IntPtr MLSnapshotGetResultString(
MLResult.Code result
)
Parameters
Type | Name | Description |
---|---|---|
MLResult.Code | result | MLResult type to be converted to string. |
Returns: Returns a pointer to an ASCII string containing readable version of the result code.
MLResult.Code MLSnapshotGetStaticData
Get the static data pertaining to the snapshot system. Requires API level 30.
public MLResult.Code MLSnapshotGetStaticData(
ref MLSnapshotStaticData outStaticData
)
Parameters
Type | Name | Description |
---|---|---|
ref MLSnapshotStaticData | outStaticData | Valid pointer to an MLSnapshotStaticData. To be filled out with snapshot static data. |
Returns: MLResult.Result will be MLResult.Code.InvalidParam if failed to obtain static data due to invalid parameter. MLResult.Result will be MLResult.Code.Ok if obtained static data successfully. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed to obtain static data due to internal error.
MLResult.Code MLSnapshotGetTransform
Gets the transform between world origin and the coordinate frame `id'.
public MLResult.Code MLSnapshotGetTransform(
IntPtr snap,
ref MLCoordinateFrameUID id,
ref MLTransform outTransform
)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | snap | A snapshot of the tracker state. Can be obtained with MLPerceptionGetSnapshot(). |
ref MLCoordinateFrameUID | id | Look up the transform between the current origin and this coordinate frame id. |
ref MLTransform | outTransform | Valid pointer to an MLTransform. To be filled out with requested transform data. |
Returns: MLResult.Result will be MLResult.Code.Ok if the transform was obtained successfully. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed due to internal error. MLResult.Result will be MLResult.Code.InvalidParam if failed due to an invalid parameter. MLResult.Result will be MLResult.Code.PoseNotFound if the coordinate frame is valid, but not found in the current pose snapshot.
MLResult.Code MLUnitySdkGetMinApiLevel
Returns the minimum API level of the MLSDK used by Unity
public MLResult.Code MLUnitySdkGetMinApiLevel(
out uint minApiLevel
)
Parameters
Type | Name | Description |
---|---|---|
out uint | minApiLevel | Value containing the minimum API level. |
Returns: MLResult.Code.Ok : Minimum API level was retrieved successfully. MLResult.Code.NotImplemented : The ml_sdk_loader plugin was not compiled with knowledge of the minimum API level.
bool UnityMagicLeap_TryGetPose
Tries to get the pose for the given coordinate frame id.
public bool UnityMagicLeap_TryGetPose(
MLCoordinateFrameUID id,
out UnityEngine.Pose pose
)
Parameters
Type | Name | Description |
---|---|---|
MLCoordinateFrameUID | id | The coordinate frame id to get the pose of. |
out UnityEngine.Pose | pose | The object to initialize the found pose with. |
Returns: True if a pose was successfully found.
Protected Methods
MagicLeapNativeBindings
Initializes a new instance of the MagicLeapNativeBindings class.
protected MagicLeapNativeBindings()
Public Attributes
InvalidHandle
The 64 bit id for an invalid native handle.
public const ulong InvalidHandle = 0xFFFFFFFFFFFFFFFF;
MLPerceptionClientDll
Perception library name string.
public const string MLPerceptionClientDll = "perception.magicleap";
MLPlatformDll
Platform level library name string.
public const string MLPlatformDll = "platform.magicleap";
MLSdkLoaderDll
public const string MLSdkLoaderDll = "ml_sdk_loader";
UnityMagicLeapDll
Unity's XR provider library in com.unity.xr.magicleap
public const string UnityMagicLeapDll = "UnityMagicLeap";
Protected Attributes
AudioOutputPluginDLL
Internal DLL used to send unity audio buffers to MLAudio api.
protected const string AudioOutputPluginDLL = "MLAudioOutput";
AudioPlayerDLL
MLAudio library name.
protected const string AudioPlayerDLL = "audio.magicleap";
CUtilsDLL
Internal DLL used to get Java VM Pointer.
protected const string CUtilsDLL = "ml_c_utils";
MLCameraDll
The MLCamera library name.
protected const string MLCameraDll = "camera.magicleap";
MLCameraMetadataDll
Internal DLL used by the API.
protected const string MLCameraMetadataDll = "camera_metadata.magicleap";
MLGazeRecognitionDll
Internal DLL used by the API.
protected const string MLGazeRecognitionDll = "perception.magicleap";
MLInputDll
Internal DLL used by the Input API.
protected const string MLInputDll = "input.magicleap";
MLMediaCEA608DLL
Media CC parser library name
protected const string MLMediaCEA608DLL = "media_ccparser.magicleap";
MLMediaCEA708DLL
Media CEA-708 library name
protected const string MLMediaCEA708DLL = "media_cea708parser.magicleap";
MLMediaDRMDll
Internal DLL used by the API.
protected const string MLMediaDRMDll = "media_drm.magicleap";
MLMediaErrorDLL
MLMediaError library name.
protected const string MLMediaErrorDLL = "media_error.magicleap";
MLMediaFormatDll
Internal DLL used by the API.
protected const string MLMediaFormatDll = "media_format.magicleap";
MLMediaPlayerDll
Internal DLL used by the API.
protected const string MLMediaPlayerDll = "media_player.magicleap";
MLMediaRecorderDll
Internal DLL used by the API.
protected const string MLMediaRecorderDll = "media_recorder.magicleap";
MLNativeSurfaceDll
Internal DLL used by the API.
protected const string MLNativeSurfaceDll = "native_surface.magicleap";
MLNotificationsManagerDll
Internal DLL used by the Notifications API.
protected const string MLNotificationsManagerDll = "system_notification_manager.magicleap";
MLPowerManagerDll
Internal DLL used by the API.
protected const string MLPowerManagerDll = "power_manager.magicleap";
MLSpaceDll
Internal DLL used by the Space API.
protected const string MLSpaceDll = "space.magicleap";
MLVoiceDll
Internal DLL used by the API.
protected const string MLVoiceDll = "input.magicleap";
MLWebRTCDLL
Internal DLL used by the API.
protected const string MLWebRTCDLL = "webrtc.magicleap";
MLWebViewDll
Internal DLL used by the API.
protected const string MLWebViewDll = "webview.magicleap";
MLZIPermissionsDll
ZI permissions library name
protected const string MLZIPermissionsDll = "zi.magicleap";
MediaMuxerDll
Internal DLL used by the API.
protected const string MediaMuxerDll = "media_muxer.magicleap";
Public Enums
MLSensoryState
The current state of a given tracker.
Enumerator | Value | Description |
---|---|---|
Initializing | The tracker is not ready, don't use the data. | |
Ready | The tracker's data can be used. |