Forward session state to server

Closes #395
This commit is contained in:
Sapphire
2025-07-05 15:41:22 +02:00
committed by xytovl
parent 8e2719ff30
commit 5bfc9ed942
6 changed files with 90 additions and 12 deletions
+23 -4
View File
@@ -76,7 +76,7 @@ wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx,
.supported = {
.orientation_tracking = true,
.position_tracking = true,
.presence = info.presence,
.presence = true,
.battery_status = true,
},
.update_inputs = [](xrt_device *) { return XRT_SUCCESS; },
@@ -232,9 +232,28 @@ void wivrn_hmd::update_visibility_mask(const from_headset::visibility_mask_chang
m->at(mask.view_index) = mask.data;
}
void wivrn_hmd::update_presence(bool presence)
bool wivrn_hmd::update_presence(bool new_presence, bool real)
{
U_LOG_I("Updating user presence to %s", presence ? "true" : "false");
this->presence = presence;
// if this presence change comes from headset, always honor it,
// otherwise try to keep it in sync with the real presence,
// while still changing presence to false when session is not
// visible
if (real || new_presence == this->real_presence || !new_presence)
{
if (real && this->real_presence != new_presence)
{
U_LOG_I("Updating real user presence: %s -> %s", real_presence ? "true" : "false", new_presence ? "true" : "false");
this->real_presence = new_presence;
}
if (this->presence == new_presence)
return false;
U_LOG_I("Updating user presence: %s -> %s", this->presence ? "true" : "false", new_presence ? "true" : "false");
this->presence = new_presence;
return true;
}
return false;
}
} // namespace wivrn