mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-26 17:37:34 +00:00
t/libmonado: add tracking-related device properties
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2313>
This commit is contained in:
parent
235cc78e6a
commit
6db9d570d8
|
@ -306,9 +306,15 @@ mnd_root_get_device_info_bool(mnd_root_t *root, uint32_t device_index, mnd_prope
|
|||
return MND_ERROR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
PE("Is not a valid boolean property (%u)", prop);
|
||||
const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index];
|
||||
|
||||
return MND_ERROR_INVALID_PROPERTY;
|
||||
switch (prop) {
|
||||
case MND_PROPERTY_SUPPORTS_POSITION_BOOL: *out_bool = shared_device->position_tracking_supported; break;
|
||||
case MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL: *out_bool = shared_device->orientation_tracking_supported; break;
|
||||
default: PE("Is not a valid boolean property (%u)", prop); return MND_ERROR_INVALID_PROPERTY;
|
||||
}
|
||||
|
||||
return MND_SUCCESS;
|
||||
}
|
||||
|
||||
mnd_result_t
|
||||
|
@ -338,9 +344,14 @@ mnd_root_get_device_info_u32(mnd_root_t *root, uint32_t device_index, mnd_proper
|
|||
return MND_ERROR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
PE("Is not a valid u32 property (%u)", prop);
|
||||
const struct ipc_shared_device *shared_device = &root->ipc_c.ism->isdevs[device_index];
|
||||
|
||||
return MND_ERROR_INVALID_PROPERTY;
|
||||
switch (prop) {
|
||||
case MND_PROPERTY_TRACKING_ORIGIN_U32: *out_u32 = shared_device->tracking_origin_index; break;
|
||||
default: PE("Is not a valid u32 property (%u)", prop); return MND_ERROR_INVALID_PROPERTY;
|
||||
}
|
||||
|
||||
return MND_SUCCESS;
|
||||
}
|
||||
|
||||
mnd_result_t
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
//! Major version of the API.
|
||||
#define MND_API_VERSION_MAJOR 1
|
||||
//! Minor version of the API.
|
||||
#define MND_API_VERSION_MINOR 3
|
||||
#define MND_API_VERSION_MINOR 4
|
||||
//! Patch version of the API.
|
||||
#define MND_API_VERSION_PATCH 0
|
||||
|
||||
|
@ -72,6 +72,12 @@ typedef enum mnd_property
|
|||
MND_PROPERTY_NAME_STRING = 0,
|
||||
//! Supported in version 1.2 and above.
|
||||
MND_PROPERTY_SERIAL_STRING = 1,
|
||||
//! Supported in version 1.4.0 and above.
|
||||
MND_PROPERTY_TRACKING_ORIGIN_U32 = 2,
|
||||
//! Supported in version 1.4.0 and above.
|
||||
MND_PROPERTY_SUPPORTS_POSITION_BOOL = 3,
|
||||
//! Supported in version 1.4.0 and above.
|
||||
MND_PROPERTY_SUPPORTS_ORIENTATION_BOOL = 4,
|
||||
} mnd_property_t;
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in a new issue