Skip to main content
Version: 12 Dec 2024

MLResult

NameSpace: MagicLeap

Magic Leap API return value.

Public Fields

IsOk

Gets a value indicating whether the result code is MLResult.Code.Ok Note that in some cases the result can be different than MLResult.Code.Ok and still valid (e.g. MLResult.Code.Pending, MLResult.Code.Ok)


public bool IsOk { get; set; }


Public Methods

string CodeToString

Provides the string value for any MLResult.Code.

public static string CodeToString(
MLResult.Code resultCode
)

Parameters

TypeNameDescription
MLResult.CoderesultCodeThe code to convert into a string value.

Returns: The string value of the given MLResult.Code.


MLResult Create

Create a new MLResult or retrieve an already initialized MLResult with the result needed.

public static MLResult Create(
Code result,
string msg =null
)

Parameters

TypeNameDescription
CoderesultThe code to use for the created MLResult.
stringmsgThe message to use for the created MLResult.

Returns: A new or cached MLResult with the provided code and message.


bool DidNativeCallSucceed

public static bool DidNativeCallSucceed(
Code resultCode,
string functionName ="A native function",
Predicate< Code > successCase =null,
bool showError =true
)

Parameters

TypeNameDescription
CoderesultCodeIdentifier of Magic Leap API results
stringfunctionName
Predicate< Code >successCaseIdentifier of Magic Leap API results
boolshowError

override bool Equals

The equality check to be used for comparing another object to this one.

public override bool Equals(
object obj
)

Parameters

TypeNameDescription
objectobjThe object to compare to this one with.

Returns: True if the the provided object is of the MLResult type and has the same Result values.


override int GetHashCode

Gets the hash code to use from this.Result.

public override int GetHashCode()

Returns: The hash code returned by the this.Result field.


bool IsOK

Indicates whether the result code is Code.Ok Note that in some cases the result can be different than MLResult.Code.Ok and still be valid (e.g. MLResult.Code.Pending, MLResult.Code.Ok)

public static bool IsOK(
Code result
)

Parameters

TypeNameDescription
CoderesultThe code to determine if it is Ok.

Returns: True if the provided code is equivalent Code.Ok.


bool IsPending

Indicates whether the result code is one of the Pending results.

public static bool IsPending(
Code result
)

Parameters

TypeNameDescription
CoderesultThe code to determine if it is pending.

Returns: True if the provided code is equivalent Code.Pending.


override string ToString

Provides the string value of this.Result or the default message given to this MLResult.

public override string ToString()

Returns: the string value of this.Result or the default message given to this MLResult.


implicit operator Task< MLResult >

Enables asynchronous native calls to use the same interface as synchronous ones

public static implicit operator Task< MLResult >(
MLResult r
)

Parameters

TypeNameDescription
MLResultrMagic Leap API return value.

bool operator!=

The inequality check to be used for comparing two MLResult structs.

public static bool operator!=(
MLResult one,
MLResult.Code two
)

Parameters

TypeNameDescription
MLResultoneThe first struct to compare with the second struct.
MLResult.CodetwoThe second struct to compare with the first struct.

Returns: True if the two provided structs do not have the same Result value.


bool operator==

The equality check to be used for comparing two MLResult structs.

public static bool operator==(
MLResult one,
MLResult.Code two
)

Parameters

TypeNameDescription
MLResultoneThe first struct to compare with the second struct.
MLResult.CodetwoThe second struct to compare with the first struct.

Returns: True if the two provided structs have the same Result value.


Public Attributes

Result

The code of this MLResult. Indicates the result status.


public readonly Code Result;

TypeDescription
readonly CodeIdentifier of Magic Leap API results

Public Enums

Code

Identifier of Magic Leap API results

EnumeratorValueDescription
Ok(CodePrefix.MLResultGlobal << 16)Operation completed successfully.
PendingAsynchronous operation has not completed
TimeoutOperation has timed out.
LockedRequest to lock a shared resource that is already locked.
UnspecifiedFailureOperation failed due to an unspecified internal error.
InvalidParamOperation failed due to an invalid parameter being supplied.
AllocFailedOperation failed because memory failed to be allocated.
PermissionDeniedOperation failed because a required permission has not been granted.
NotImplementedOperation failed because it is not currently implemented.
ClientLimitExceededOperation failed because the client count exceeded the number of clients available.
PoseNotFoundOperation failed because the requested pose is not available.
IncompatibleSKUOperation failed because feature isn't supported on current device version.
PerceptionSystemNotStartedOperation failed because the Perception System was not started.
IllegalStateOperation failed because it has been invoked at the wrong time.
LicenseErrorOperation failed because of missing/incompatible license.
InvalidTimestampOperation failed because the timestamp parameter was outside the expected range.
AudioNotImplemented(CodePrefix.MLAudioResult << 16)Audio function not implemented.
AudioHandleNotFoundNot a valid MLHandle for a sound or input.
AudioInvalidSampleRateSample rate not supported.
AudioInvalidBitsPerSampleBits per sample not supported.
AudioInvalidValidBitsValid bits per sample not supported.
AudioInvalidSampleFormatSample format not supported.
AudioInvalidChannelCountChannel count not supported.
AudioInvalidBufferSizeBuffer size too small.
AudioBufferNotReadyBuffer not ready for read or write.
AudioFileNotFoundSpecified file not found.
AudioFileNotRecognizedSpecified file has unsupported format.
AudioResourceNotFoundSpecified resource is not on the list.
AudioResourceDiscardedData was unloaded or file was closed.
AudioOperationUnavailableRequested operation not possible for given item.
AudioInternalOperationNotReadyRequested operation has not yet been processed.
AudioInternalConfigErrorInternal configuration problem was detected.
InputServiceNotAvailable(CodePrefix.MLInputResult << 16)Operation failed because input service is not available.
InputPermissionDeniedOperation failed because a required permission has not been granted.
InputDeviceNotFoundOperation failed because a required device was not found.
InputIllegalStateOperation failed because the service was in an illegal state.
InputInternalErrorOperation failed because of an internal error.
InputSpeechDisabledOperation failed because a required speech feature is disabled in system settings.
MediaPlayerServerDied(CodePrefix.MLMediaPlayerResult << 16)Media errors (example: Codec not supported).
MediaPlayerNotValidForProgressivePlaybackRuntime errors.
MediaAlreadyConnected(CodePrefix.MLMediaResult << 16)Media already connected.
MediaNotConnectedMedia not connected.
MediaUnknownHostMedia had unknown host.
MediaCannotConnectMedia cannot connect.
MediaIOMedia IO.
MediaConnectionLostMedia connection was lost.
MediaLegacy1Deprecated error.
MediaMalformedMedia was malformed.
MediaOutOfRangeMedia was out of range.
MediaBufferTooSmallMedia buffer was too small.
MediaUnsupportedMedia not supported.
MediaEndOfStreamMedia end of stream.
MediaFormatChangedMedia format changed.
MediaDiscontinuityMedia discontinuity.
MediaOutputBuffersChangedMedia output buffers changed.
MediaPermissionRevokedMedia permission revoked.
MediaUnsupportedAudioFormatMedia had an unsupported audio format.
MediaHeartbeatTerminateRequestedMedia heartbeat requested to be terminated.
MediaUnknownResourceUnknown Media Codec Resource Request Error.
MediaInvalidResourceRequestInvalid Request on Media Codec Resources.
MediaOnlyHWResourceAvailableOnly Hardware Media Codec Resources are available. This error code is a result of requesting for Software Media Codec Resource that is not available.
MediaOnlySWResourceAvailableOnly Software Media Codec Resources are available. This error code is a result of requesting for Hardware Media Codec Resource that is not available.
MediaNoMoreResourcesNo more (Hardware or Software) Media Codec Resources available.
MediaNoMoreHWResourcesNo more Hardware Media Codec Resources available
MediaNoMoreSWResourcesNo more Software Media Codec Resources available.
MediaInvalidCodecParamMedia Codec Resource request made with Invalid Codec parameters. This error code could be a result of one of these cases (not limited to) 1) Requested video frame width or height is beyond the maximum resolution (width or height) supported. 2) Requested Framerate/Sample rate/Bitratre/Channel count is not supported.
MediaDRMUnknown(CodePrefix.MLMediaDRMResult << 16)Error code for undefined type.
MediaDRMNoLicenseError code for no DRM license.
MediaDRMLicenseExpiredError code for DRM license expired.
MediaDRMSessionNotOpenedError code for DRM session not expired.
MediaDRMDecryptUnitNotInitializedError code for DRM when decrypt unit is not initialized.
MediaDRMDecryptError code for DRM when failed to decrypt data.
MediaDRMCannotHandleError code for DRM can not handle the operation.
MediaDRMTamperDetectError code for DRM when data is tampered.
MediaDRMNotProvisionedError Code when an operation on a MLMediaDRM handle is attempted and the device does not have a certificate. The app should obtain and install a certificate using the MLMediaDRM provisioning methods then retry the operation.
MediaDRMDeviceRevokedError code for Device License Revoked.
MediaDRMResourceBusyError code if the MLMediaDRM operation fails when the required resources are in use.
MediaDRMInsufficientOutputProtectionError code for insufficient output protection.
MediaDRMLastUsedErrorCodeMediaDRMInsufficientOutputProtectionError code for insufficient output protection.
MediaDRMVendorMin(CodePrefix.MLMediaDRMResult << 16) + 500Range for vendor specific DRM errors.
MediaDRMVendorMax(CodePrefix.MLMediaDRMResult << 16) + 999Range for vendor specific DRM errors.
MediaGenericInvalidOperation(CodePrefix.MLMediaGenericResult << 16)Media invalid operation.
MediaGenericBadTypeMedia bad type.
MediaGenericNameNotFoundMedia name not found.
MediaGenericHandleNotFoundMedia handle not found.
MediaGenericNoInitMedia NoInit .
MediaGenericAlreadyExistsMedia already exists.
MediaGenericDeadObjectMedia dead object.
MediaGenericFailedTransactionMedia had a failed transaction.
MediaGenericBadIndexMedia had a bad index.
MediaGenericNotEnoughDataMedia not enough data.
MediaGenericWouldBlockMedia would block.
MediaGenericUnknownTransactionMedia had an unknown transaction.
MediaGenericFDSNotAllowedMedia FDS not allowed.
MediaGenericUnexpectedNullMedia unexpected null.
MediaGenericNotAvailableMedia not available.
SnapshotDerivativesNotCalculated(CodePrefix.MLSnapshotResult << 16)Derivatives not calculated for requested coordinate frame.
WebRTCInstanceNotCreated(CodePrefix.MLWebRTCResult << 16)Instance not created.
WebRTCMismatchingHandleMismatching handle.
WebRTCInvalidFrameFormatInvalid frame format.
WebRTCInvalidFramePlaneCountInvalid frame plane count.
WebRTCSendNativeFrameErrorNative Frame failed to be sent
WebRTCDataChannelIsClosedData channel is closed.
AnchorsMaxAnchorLimitReached(CodePrefix.MLAnchorsResult << 16)The maximum number of anchors for the current space has been reached.
AnchorsMinDistanceThresholdExceededThe minimum distance between anchors was not met
AnchorsInsufficientMappingThe space has not been sufficiently mapped to allow this operation.
AnchorsInvalidIdThe provided anchor id was not valid.
AnchorsInvalidExpirationTimestampThe provided expiration suggestion was not valid.
AnchorsNotLocalizedThe operation cannot be completed because the device has not yet localized.
AnchorsServerErrorThere was an error communicating with the server.
AnchorsServiceUnavailableThe operation failed because the underlying service is not yet available.
VoiceIntentDisabled(CodePrefix.MLVoiceResult << 16)Operation failed because a required voice intent feature is disabled in system settings.
WebViewZoomLimitReached(CodePrefix.MLWebViewResult << 16)Operation failed because zoom limit was reached.
SpacesServerError(CodePrefix.MLSpaceResult << 16)There was an error communicating with the server.
SpacesServiceUnavailableThe operation failed because the underlying service is not yet available, retry later.
UnavailableSpaceSpace is not available.
IncompatibleSpaceSpace is not compatible with the current OS version.
SpaceAlreadyExistsThe operation failed because the Space being imported already exists in the device.
HeadsetFitIssue(CodePrefix.MLFacialExpressionResult << 16)Unable to detect the eyes, check MLHeadsetFitStatus.
EyeExpressionDisabledOperation failed because enable_eye_expression in MLFacialExpressionSettings is disabled.
PowerManagerNotConnect(CodePrefix.MLPowerManager << 16)Indicates the component is not connected.
PowerManagerInvalidStateTransitionIndicates the component does not currently support transitioning to requested state.
PowerManagerStateTransitionsDisabledIndicates the component does not currently support transitioning to a different state.
PowerManagerUnsupportedStateIndicates the component does not support the requested power state.
APIDLLNotFoundint.MaxValue - 0APIDLLNotFound.
APISymbolsNotFoundint.MaxValue - 1APIDLLSymbolsNotFound.