Skip to main content
Version: 21 Aug 2024

ml_headset_fit.h

Classes

Name
structMLHeadsetFitState
Headset fit state.

Types

Name
typedef struct MLHeadsetFitStateMLHeadsetFitState
Headset fit state.

Enums

Name
enumMLHeadsetFitStatus
{
MLHeadsetFitStatus_Unknown = 0,
MLHeadsetFitStatus_NotWorn,
MLHeadsetFitStatus_GoodFit,
MLHeadsetFitStatus_BadFit,
MLHeadsetFitStatus_Ensure32Bits = 0x7FFFFFFF
}
Represents the different fit status that the system can report.

Functions

Name
voidMLHeadsetFitStateInit(MLHeadsetFitState * inout_state)
Initialize MLHeadsetFitState.
MLResultMLHeadsetFitCreateClient(MLHandle * out_handle)
Creates a headset fit client.
MLResultMLHeadsetFitDestroyClient(MLHandle handle)
Destroys headset fit client.
MLResultMLHeadsetFitGetState(MLHandle handle, MLHeadsetFitState * out_state)
Gets information about the user's current headset fit.

Enums Documentation

MLHeadsetFitStatus

EnumeratorValueDescription
MLHeadsetFitStatus_Unknown0Headset fit status not available for unknown reason.
MLHeadsetFitStatus_NotWornHeadset not worn.
MLHeadsetFitStatus_GoodFitGood fit.
MLHeadsetFitStatus_BadFitBad fit.
MLHeadsetFitStatus_Ensure32Bits0x7FFFFFFFEnsure enum is represented as 32 bits.

Represents the different fit status that the system can report.

If status is neither NotWorn nor Unknown, then headset is being worn.

Deprecated

Deprecated since 1.6.0. Scheduled for removal.

API Level:

  • 20

Types Documentation

MLHeadsetFitState

typedef struct MLHeadsetFitState MLHeadsetFitState;

Headset fit state.

More Info

Deprecated

Deprecated since 1.6.0. Scheduled for removal.

API Level:

  • 20

Functions Documentation

MLHeadsetFitStateInit

static inline void MLHeadsetFitStateInit(
MLHeadsetFitState * inout_state
)

Initialize MLHeadsetFitState.

Parameters

MLHeadsetFitState *inout_stateSet up the version for inout_state and zero all other fields.
Deprecated

Deprecated since 1.6.0. Scheduled for removal.

API Level:

  • 20

MLHeadsetFitCreateClient

MLResult MLHeadsetFitCreateClient(
MLHandle * out_handle
)

Creates a headset fit client.

Parameters

MLHandle *out_handleA pointer to an MLHandle to the newly created headset fit client.

Returns

MLResultMLResult_InvalidParamFailed to create headset fit client due to an invalid input parameter.
MLResultMLResult_OkSuccessfully created headset fit client.
MLResultMLResult_UnspecifiedFailureFailed to create headset fit client due to an unknown failure.

Required Permissions:

  • None
Deprecated

Deprecated since 1.6.0. Scheduled for removal.

API Level:

  • 20

MLHeadsetFitDestroyClient

MLResult MLHeadsetFitDestroyClient(
MLHandle handle
)

Destroys headset fit client.

Parameters

MLHandlehandleMLHandle to the headset fit client created by MLHeadsetFitCreateClient.

Returns

MLResultMLResult_OkSuccessfully destroyed headset fit client.
MLResultMLResult_InvalidParamMLHandle is invalid.
MLResultMLResult_UnspecifiedFailureFailed to destroy headset fit client due to an unknown failure.

Required Permissions:

  • None
Deprecated

Deprecated since 1.6.0. Scheduled for removal.

API Level:

  • 20

MLHeadsetFitGetState

MLResult MLHeadsetFitGetState(
MLHandle handle,
MLHeadsetFitState * out_state
)

Gets information about the user's current headset fit.

Parameters

MLHandlehandleHandle to the headset fit information created by MLHeadsetFitCreateClient.
MLHeadsetFitState *out_stateInformation about headset fit state.

Returns

MLResultMLResult_InvalidParamFailed to receive headset fit state due to an invalid input parameter.
MLResultMLResult_OkSuccessfully returned headset fit state.
MLResultMLResult_UnspecifiedFailureFailed to receive headset fit state due to an unknown failure.

Required Permissions:

  • None
Deprecated

Deprecated since 1.6.0. Scheduled for removal.

API Level:

  • 20

Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2022 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_api.h"
#include "ml_types.h"

#include <string.h>

ML_EXTERN_C_BEGIN

typedef enum MLHeadsetFitStatus {
MLHeadsetFitStatus_Unknown = 0,
MLHeadsetFitStatus_NotWorn,
MLHeadsetFitStatus_GoodFit,
MLHeadsetFitStatus_BadFit,
MLHeadsetFitStatus_Ensure32Bits = 0x7FFFFFFF
} MLHeadsetFitStatus;

typedef ML_DEPRECATED_MSG("Use XR_ML_user_calibration OpenXR extention.") struct MLHeadsetFitState {
uint32_t version;
MLHeadsetFitStatus fit_status;
int64_t epoch_timestamp_us;
} MLHeadsetFitState;

ML_DEPRECATED_MSG("Use XR_ML_user_calibration OpenXR extention.")
ML_STATIC_INLINE void MLHeadsetFitStateInit(MLHeadsetFitState *inout_state) {
if(inout_state) {
memset(inout_state, 0, sizeof(MLHeadsetFitState));
inout_state->version = 1;
}
}

ML_DEPRECATED_MSG("Use XR_ML_user_calibration OpenXR extention.")
ML_API MLResult ML_CALL MLHeadsetFitCreateClient(MLHandle *out_handle);

ML_DEPRECATED_MSG("Use XR_ML_user_calibration OpenXR extention.")
ML_API MLResult ML_CALL MLHeadsetFitDestroyClient(MLHandle handle);

ML_DEPRECATED_MSG("Use XR_ML_user_calibration OpenXR extention.")
ML_API MLResult ML_CALL MLHeadsetFitGetState(MLHandle handle, MLHeadsetFitState *out_state);

ML_EXTERN_C_END