Skip to main content
Version: 14 Oct 2024

NativeBindings

Inherits from:
MagicLeapNativeBindings

Public Methods

MLResult.Code MLDepthCameraConnect

Connect to depth camera.

public MLResult.Code MLDepthCameraConnect(
in MLDepthCameraSettings settings,
out ulong handle
)

Parameters

TypeNameDescription
in MLDepthCameraSettingssettingsA pointer to MLDepthCameraSettings structure.
out ulonghandleA pointer to camera handle to be used in later APIs.

Details*

apilevel: 29

permissions: com.magicleap.permission.DEPTH_CAMERA (protection level: dangerous)

Returns: MLResult_InvalidParam : One of the parameters is invalid.

MLResult_LicenseError : Necessary license is missing.

MLResult_Ok : Connected to camera device(s) successfully.

MLResult_PermissionDenied : Necessary permission is missing.

MLResult_UnspecifiedFailure : The operation failed with an unspecified error.


MLResult.Code MLDepthCameraDisconnect

Disconnect from depth camera. This will disconnect from the depth camera.

public MLResult.Code MLDepthCameraDisconnect(
ulong handle
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLDepthCameraConnect.

Details*

apilevel: 29

permissions: None

Returns: MLResult_InvalidParam : Invalid handle.

MLResult_Ok : Disconnected camera successfully.

MLResult_UnspecifiedFailure : Failed to disconnect camera.


MLResult.Code MLDepthCameraGetCapabilities

Query the depth camera stream capabilities. Retrieves the capabilities supported by the depth camera based on the provided filter. After each call, a corresponding call to MLDepthCameraReleaseCapabilities should be made to release allocated resources.

public MLResult.Code MLDepthCameraGetCapabilities(
ulong handle,
ref MLDepthCameraCapabilityFilter filter,
out MLDepthCameraCapabilityList outCaps
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLDepthCameraConnect.
ref MLDepthCameraCapabilityFilterfilterPointer to initialized MLDepthCameraCapabilityFilter structure. Used for filtering.
out MLDepthCameraCapabilityListoutCapsPointer to initialized MLDepthCameraCapabilityList structure.

Details*

apilevel: 29

permissions: None

Returns: MLResult_InvalidParam : One of the parameters is invalid.

MLResult_Ok : API call completed successfully.


MLResult.Code MLDepthCameraGetLatestDepthData

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

public MLResult.Code MLDepthCameraGetLatestDepthData(
ulong handle,
ulong timeoutMs,
out MLDepthCameraData data
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLDepthCameraConnect.
ulongtimeoutMsTimeout in milliseconds.
out MLDepthCameraDatadataDepth camera data. Should be an initialized MLDepthCameraData object.

Details*

apilevel: 29

permissions: None

Returns: MLResult_InvalidParam : Invalid handle.

MLResult_Ok : Depth camera data fetched successfully.

MLResult_Timeout : Returned because no new frame available at this time.

MLResult_UnspecifiedFailure : Failed due to internal error.


MLResult.Code MLDepthCameraReleaseCapabilities

Release resources allocated with MLDepthCameraGetCapabilities.

public MLResult.Code MLDepthCameraReleaseCapabilities(
ulong handle,
ref MLDepthCameraCapabilityList outCaps
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLDepthCameraConnect.
ref MLDepthCameraCapabilityListoutCapsPointer to MLDepthCameraCapabilityList filled by the call to MLDepthCameraGetCapabilities.

Details*

apilevel: 29

permissions: None

Returns: MLResult_InvalidParam : One of the parameters is invalid.

MLResult_Ok : API call completed successfully.


MLResult.Code MLDepthCameraReleaseDepthData

Releases specified MLDepthCameraData object. This function should be called exactly once for each successfull call to MLDepthCameraGetLatestCameraData.

public MLResult.Code MLDepthCameraReleaseDepthData(
ulong handle,
ref MLDepthCameraData data
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLDepthCameraConnect.
ref MLDepthCameraDatadataPointer to a valid MLDepthCameraData object.

Details*

apilevel: 29

permissions: None

Returns: MLResult_Ok : Successfully released depth camera data.

MLResult_InvalidParam : data parameter was not valid (null).

MLResult_UnspecifiedFailure : Failed due to internal error.


MLResult.Code MLDepthCameraUpdateSettings

Update the depth camera settings.

public MLResult.Code MLDepthCameraUpdateSettings(
ulong handle,
in MLDepthCameraSettings settings
)

Parameters

TypeNameDescription
ulonghandleCamera handle obtained from MLDepthCameraConnect.
in MLDepthCameraSettingssettingsPointer to MLDepthCameraSettings.

Details*

apilevel: 29

permissions: None

Returns: MLResult_InvalidParam : Invalid handle.

MLResult_Ok : Settings updated successfully.

MLResult_UnspecifiedFailure : Failed due to internal error.