Skip to main content
Version: 14 Oct 2024

NativeBindings

See ml_eye_camera.h for additional comments.

Inherits from:
MagicLeapNativeBindings

Public Methods

MLResult.Code MLEyeCameraConnect

Brief connect to eye camera(s).

public MLResult.Code MLEyeCameraConnect(
ref MLEyeCameraSettings setting,
ref ulong outHandle
)

Parameters

TypeNameDescription
ref MLEyeCameraSettingssettingA pointer to MLEyeCameraSettings structure.
ref ulongoutHandleA pointer to camera handle to be used in later APIs.

Details*

apilevel 26. permissions android.permission.EYE_CAMERA (protection level: dangerous)

Returns: MLResult.Result will be MLResult.Code.Ok if connected to camera device(s) successfully. MLResult.Result will be MLResult.Code.LicenseError if necessary license is missing. MLResult.Result will be MLResult.Code.InvalidParam if one of the parameters is invalid. MLResult.Result will be MLResult.Code.PermissionDenied if the necessary permission is missing. MLResult.Result will be MLResult.Code.UnspecifiedFailure if the operation failed with an unspecified error.


MLResult.Code MLEyeCameraDisconnect

Disconnect from eye camera(s). This will disconnect from all the eye camera(s) currently connected.

public MLResult.Code MLEyeCameraDisconnect(
ulong handle
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLEyeCameraConnect.

Details*

apilevel 26. permissions None.

Returns: MLResult.Result will be MLResult.Code.Ok if disconnected camera(s) successfully. MLResult.Result will be MLResult.Code.InvalidParam if invalid context. MLResult.Result will be MLResult.Code.UnspecifiedFailure if failed to disconnect camera(s).


MLResult.Code MLEyeCameraGetLatestCameraData

Poll for Frames. Returns MLEyeCameraData with this latest data when available. The memory is owned by the system. Application should copy the data it needs to cache and release the memory by calling MLEyeCameraReleaseCameraData. This is a blocking call. API is not thread safe. If there are no new camera frames within the timeout_ms duration then the API will return MLResult_Timeout.

public MLResult.Code MLEyeCameraGetLatestCameraData(
ulong handle,
UInt64 timeoutMS,
ref MLEyeCameraData outData
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLEyeCameraConnect.
UInt64timeoutMSTimeout in milliseconds.
ref MLEyeCameraDataoutDataEye camera data. Will be set to NULL if no valid data is available at this time.

Details*

apilevel 26. permissions None.

Returns: MLResult.Result will be MLResult.Code.Ok if camera frames fetched successfully. MLResult.Result will be MLResult.Code.Timeout returned because no new frame available at this time. MLResult.Result will be MLResult.Code.InvalidParam if one of the parameters is invalid. MLResult.Result will be MLResult.Code.UnspecifiedFailure if the operation failed due to an internal error.


MLResult.Code MLEyeCameraReleaseCameraData

Releases specified #MLEyeCameraData object. This function should be called exactly once for each call to #MLEyeCameraGetLatestCameraData. MLEyeCameraData will be over-written when new data is available.

public MLResult.Code MLEyeCameraReleaseCameraData(
ulong handle,
ref MLEyeCameraData eyeCameraData
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLEyeCameraConnect.
ref MLEyeCameraDataeyeCameraDataPointer to a valid MLEyeCameraData object.

Details*

permissions None.

Returns: MLResult.Result will be MLResult.Code.Ok if successfully released eye camera data. MLResult.Result will be MLResult.Code.InvalidParam if eyeCameraData parameter was not valid (NULL). MLResult.Result will be MLResult.Code.UnspecifiedFailure if the operation failed due to an internal error.


MLResult.Code MLEyeCameraUpdateSettings

Update the eye camera settings.

public MLResult.Code MLEyeCameraUpdateSettings(
ulong handle,
ref MLEyeCameraSettings settings
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLEyeCameraConnect.
ref MLEyeCameraSettingssettingsPointer to MLEyeCameraSettings.

Returns: MLResult.Result will be MLResult.Code.Ok if the settings updated successfully. MLResult.Result will be MLResult.Code.InvalidParam if one of the parameters is invalid. MLResult.Result will be MLResult.Code.UnspecifiedFailure if the operation failed due to an internal error.