Skip to main content
Version: 21 Aug 2024

Platform

APIs for information regarding the platform. More...

Classes

Name
structMLVersion

Types

Name
typedef uint64_tMLHandle
Integer handle type used to reference many things returned by the API, instead of returning pointers directly. Use MLHandleIsValid() to check if a handle is valid or not.
typedef struct MLVersionMLVersion
typedef int32_tMLResult

Enums

Name
enumAnonymous Enum 0
{
ML_INVALID_HANDLE = 0xFFFFFFFFFFFFFFFF
}
enumAnonymous Enum 1
{
MLVersion_BuildIdMaxLength = 128
}
enumAnonymous Enum 2
{
MLResultAPIPrefix_Global = ( 0 << 16)
}
enumMLResultGlobal
{
MLResult_Ok = MLResultAPIPrefix_Global,
MLResult_Pending,
MLResult_Timeout,
MLResult_Locked,
MLResult_UnspecifiedFailure,
MLResult_InvalidParam,
MLResult_AllocFailed,
MLResult_PermissionDenied,
MLResult_NotImplemented,
MLResult_ClientLimitExceeded,
MLResult_PoseNotFound,
MLResult_IncompatibleSKU,
MLResult_PerceptionSystemNotStarted,
MLResult_IllegalState,
MLResult_LicenseError,
MLResult_InvalidTimestamp,
MLResult_Unauthenticated,
MLResult_Ensure32Bits = 0x7FFFFFFF
}

Functions

Name
const char *MLGetResultString(MLResult result_code)
Returns an ASCII string for MLResultGlobal codes.
const char *MLGlobalGetResultString(MLResult result_code)
Returns an ASCII string for MLResult codes.
boolMLHandleIsValid(MLHandle handle)
Check if a handle is valid.
const char *MLGetVersionName()
Get SDK version as c-style string.
MLVersionMLGetVersion()
Get SDK version as a struct with major, minor, revision, and build_id.
MLResultMLPlatformGetAPILevel(uint32_t * out_api_level)
Query the OS for which Platform API Level is supported.

Defines

Name
MLRESULT_PREFIX(val)
ML_PLATFORM_API_LEVEL

Detailed Description

APIs for information regarding the platform.

Shared Object:

  • capi.magicleap*

Shared Object:

  • platform.magicleap*

Enums Documentation

Anonymous Enum 0

EnumeratorValueDescription
ML_INVALID_HANDLE0xFFFFFFFFFFFFFFFFValue of an invalid handle. To test if a handle is invalid use MLHandleIsValid().

Anonymous Enum 1

EnumeratorValueDescription
MLVersion_BuildIdMaxLength128Maximum character length of MLVersion build ID.

Anonymous Enum 2

EnumeratorValueDescription
MLResultAPIPrefix_Global( 0 << 16)Defines the prefix for global MLResult codes.

MLResultGlobal

EnumeratorValueDescription
MLResult_OkMLResultAPIPrefix_GlobalOperation completed successfully.
MLResult_PendingAsynchronous operation has not completed.
MLResult_TimeoutOperation has timed out.
MLResult_LockedRequest to lock a shared resource that is already locked.
MLResult_UnspecifiedFailureOperation failed due to an unspecified internal error.
MLResult_InvalidParamOperation failed due to an invalid parameter being supplied.
MLResult_AllocFailedOperation failed because memory failed to be allocated.
MLResult_PermissionDeniedOperation failed because a required permission has not been granted.
MLResult_NotImplementedOperation failed because it is not currently implemented.
MLResult_ClientLimitExceededOperation failed because the client count exceeded the number of clients available.
MLResult_PoseNotFoundOperation failed because the requested pose is not available.
MLResult_IncompatibleSKUOperation failed because feature isn't supported on current device version.
MLResult_PerceptionSystemNotStartedOperation failed because the Perception System was not started.
MLResult_IllegalStateOperation failed because it has been invoked at the wrong time.
MLResult_LicenseErrorOperation failed because of missing/incompatible license.
MLResult_InvalidTimestampOperation failed because the timestamp parameter was outside the expected range.
MLResult_UnauthenticatedOperation failed because the user authentication did not pass.
MLResult_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Global MLResult codes that any API can optionally return.


Types Documentation

MLHandle

typedef uint64_t MLHandle;

Integer handle type used to reference many things returned by the API, instead of returning pointers directly. Use MLHandleIsValid() to check if a handle is valid or not.


MLVersion

typedef struct MLVersion MLVersion;

SDK version: '[major].[minor].[revision].[build_id]'.

More Info


MLResult

typedef int32_t MLResult;

MLResult type that all functions in the APIs return.


Functions Documentation

MLGetResultString

static inline const char * MLGetResultString(
MLResult result_code
)

Returns an ASCII string for MLResultGlobal codes.

Parameters

MLResultresult_codeThe input MLResult enum from ML API functions.

Required Permissions:

  • None

Return: ASCII string containing readable version of result code.


MLGlobalGetResultString

const char * MLGlobalGetResultString(
MLResult result_code
)

Returns an ASCII string for MLResult codes.

Parameters

MLResultresult_codeThe input MLResult enum from ML API functions.

Required Permissions:

  • None

Return: ASCII string containing readable version of result code.

API Level:

  • 20

MLHandleIsValid

static inline bool MLHandleIsValid(
MLHandle handle
)

Check if a handle is valid.

Parameters

MLHandlehandleThe handle to check.

Required Permissions:

  • None

Return: true if the handle is valid.


MLGetVersionName

static inline const char * MLGetVersionName()

Get SDK version as c-style string.

Required Permissions:

  • None

Return: SDK version as c-style string.


MLGetVersion

static inline MLVersion MLGetVersion()

Get SDK version as a struct with major, minor, revision, and build_id.

Required Permissions:

  • None

Return: SDK version as a struct.


MLPlatformGetAPILevel

MLResult MLPlatformGetAPILevel(
uint32_t * out_api_level
)

Query the OS for which Platform API Level is supported.

Parameters

uint32_t *out_api_levelPointer to an integer that will store the API level.

Returns

MLResultMLResult_OkOperation completed successfully.
MLResultMLResult_InvalidParamout_platform_level was not valid (null).
MLResultMLResult_UnspecifiedErrorOperation failed.

Required Permissions:

  • None

Macros Documentation

MLRESULT_PREFIX

#define MLRESULT_PREFIX(
val
)
(val << 16)

Parameters

val

Macro to set a the prefix bytes of an API specific MLResult code.


ML_PLATFORM_API_LEVEL

#define ML_PLATFORM_API_LEVEL 33

Current API Level supported by this Magic Leap SDK.