The open source OpenXR runtime

ipc: Add support for xrt_device::is_form_factor_available

authored by

Jarvis Huang and committed by
Jakob Bornecrantz
693641b7 b93d1ea8

+38
+13
src/xrt/ipc/client/ipc_client_hmd.c
··· 139 139 } 140 140 } 141 141 142 + static bool 143 + ipc_client_hmd_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor) 144 + { 145 + struct ipc_client_hmd *ich = ipc_client_hmd(xdev); 146 + bool available = false; 147 + xrt_result_t r = ipc_call_device_is_form_factor_available(ich->ipc_c, ich->device_id, form_factor, &available); 148 + if (r != XRT_SUCCESS) { 149 + IPC_ERROR(ich->ipc_c, "Error calling is available!"); 150 + } 151 + return available; 152 + } 142 153 143 154 /*! 144 155 * @public @memberof ipc_client_hmd ··· 159 170 ich->base.get_tracked_pose = ipc_client_hmd_get_tracked_pose; 160 171 ich->base.get_view_poses = ipc_client_hmd_get_view_poses; 161 172 ich->base.destroy = ipc_client_hmd_destroy; 173 + ich->base.is_form_factor_available = ipc_client_hmd_is_form_factor_available; 162 174 163 175 // Start copying the information from the isdev. 164 176 ich->base.tracking_origin = xtrack; ··· 213 225 ich->base.device_type = isdev->device_type; 214 226 ich->base.hand_tracking_supported = isdev->hand_tracking_supported; 215 227 ich->base.force_feedback_supported = isdev->force_feedback_supported; 228 + ich->base.form_factor_check_supported = isdev->form_factor_check_supported; 216 229 217 230 return &ich->base; 218 231 }
+13
src/xrt/ipc/server/ipc_server_handler.c
··· 1155 1155 1156 1156 return XRT_SUCCESS; 1157 1157 } 1158 + 1159 + xrt_result_t 1160 + ipc_handle_device_is_form_factor_available(volatile struct ipc_client_state *ics, 1161 + uint32_t id, 1162 + enum xrt_form_factor form_factor, 1163 + bool *out_available) 1164 + { 1165 + // To make the code a bit more readable. 1166 + uint32_t device_id = id; 1167 + struct xrt_device *xdev = get_xdev(ics, device_id); 1168 + *out_available = xrt_device_is_form_factor_available(xdev, form_factor); 1169 + return XRT_SUCCESS; 1170 + }
+1
src/xrt/ipc/server/ipc_server_process.c
··· 288 288 isdev->device_type = xdev->device_type; 289 289 isdev->hand_tracking_supported = xdev->hand_tracking_supported; 290 290 isdev->force_feedback_supported = xdev->force_feedback_supported; 291 + isdev->form_factor_check_supported = xdev->form_factor_check_supported; 291 292 292 293 // Is this a HMD? 293 294 if (xdev->hmd != NULL) {
+1
src/xrt/ipc/shared/ipc_protocol.h
··· 125 125 bool position_tracking_supported; 126 126 bool hand_tracking_supported; 127 127 bool force_feedback_supported; 128 + bool form_factor_check_supported; 128 129 }; 129 130 130 131 /*!
+10
src/xrt/ipc/shared/proto.json
··· 252 252 {"name": "name", "type": "enum xrt_output_name"}, 253 253 {"name": "value", "type": "union xrt_output_value"} 254 254 ] 255 + }, 256 + 257 + "device_is_form_factor_available": { 258 + "in": [ 259 + {"name": "id", "type": "uint32_t"}, 260 + {"name": "form_factor", "type": "enum xrt_form_factor"} 261 + ], 262 + "out": [ 263 + {"name": "available", "type": "bool"} 264 + ] 255 265 } 256 266 }