Rework wivrn_session to be a xrt_system_devices
This will allow changing roles dynamically, and fixes some object lifetime issues.
This commit is contained in:
@@ -532,6 +532,11 @@ void wivrn_controller::set_output(xrt_output_name name, const xrt_output_value *
|
||||
}
|
||||
}
|
||||
|
||||
bool wivrn_controller::set_interaction_profile(interaction_profile profile)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Functions
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
void update_tracking(const from_headset::tracking &, const clock_offset &);
|
||||
void update_hand_tracking(const from_headset::hand_tracking &, const clock_offset &);
|
||||
|
||||
// return true if changed
|
||||
bool set_interaction_profile(interaction_profile);
|
||||
|
||||
private:
|
||||
void set_inputs(device_id input_id, float value, int64_t last_change_time);
|
||||
};
|
||||
|
||||
@@ -312,6 +312,14 @@ void wivrn_session::operator()(from_headset::headset_info_packet &&)
|
||||
}
|
||||
void wivrn_session::operator()(from_headset::trackings && tracking)
|
||||
{
|
||||
bool changed = left_hand.set_interaction_profile(tracking.interaction_profiles[0]);
|
||||
changed |= right_hand.set_interaction_profile(tracking.interaction_profiles[1]);
|
||||
if (changed)
|
||||
{
|
||||
std::lock_guard lock(roles_mutex);
|
||||
++roles.generation_id;
|
||||
}
|
||||
|
||||
for (auto & item: tracking.items)
|
||||
(*this)(item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user