ipc: add battery status query

Co-authored-by: Gabriele Musco <gabmus@disroot.org>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2292>
This commit is contained in:
Torge Matthies 2024-07-30 16:13:35 +02:00 committed by Marge Bot
parent 81d9d1ee91
commit f5b9ed31c5
6 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1 @@
all: Add device battery status query.

View file

@ -377,6 +377,7 @@ ipc_client_hmd_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin *
ich->base.force_feedback_supported = isdev->force_feedback_supported;
ich->base.form_factor_check_supported = isdev->form_factor_check_supported;
ich->base.stage_supported = isdev->stage_supported;
ich->base.battery_status_supported = isdev->battery_status_supported;
return &ich->base;
}

View file

@ -2140,3 +2140,11 @@ ipc_handle_device_get_body_joints(volatile struct ipc_client_state *ics,
struct xrt_device *xdev = get_xdev(ics, id);
return xrt_device_get_body_joints(xdev, body_tracking_type, desired_timestamp_ns, out_value);
}
xrt_result_t
ipc_handle_device_get_battery_status(
volatile struct ipc_client_state *ics, uint32_t id, bool *out_present, bool *out_charging, float *out_charge)
{
struct xrt_device *xdev = get_xdev(ics, id);
return xrt_device_get_battery_status(xdev, out_present, out_charging, out_charge);
}

View file

@ -356,6 +356,7 @@ init_shm(struct ipc_server *s)
isdev->face_tracking_supported = xdev->face_tracking_supported;
isdev->body_tracking_supported = xdev->body_tracking_supported;
isdev->stage_supported = xdev->stage_supported;
isdev->battery_status_supported = xdev->battery_status_supported;
// Is this a HMD?
if (xdev->hmd != NULL) {

View file

@ -137,6 +137,7 @@ struct ipc_shared_device
bool force_feedback_supported;
bool form_factor_check_supported;
bool stage_supported;
bool battery_status_supported;
};
/*!

View file

@ -512,6 +512,17 @@
"out": [
{"name": "value", "type": "struct xrt_body_joint_set"}
]
},
"device_get_battery_status": {
"in": [
{"name": "id", "type": "uint32_t"}
],
"out": [
{"name": "present", "type": "bool"},
{"name": "charging", "type": "bool"},
{"name": "charge", "type": "float"}
]
}
}