···10101111#include "xrt/xrt_space.h"
1212#include "xrt/xrt_device.h"
1313+#include "xrt/xrt_session.h"
1314#include "xrt/xrt_tracking.h"
14151516#include "os/os_time.h"
···89909091 //! Tracks usage of reference spaces.
9192 struct xrt_reference ref_space_use[XRT_SPACE_REFERENCE_TYPE_COUNT];
9393+9494+ //! Event sink to broadcast events to all sessions.
9595+ struct xrt_session_event_sink *broadcast;
92969397 /*!
9498 * Can we do a recenter of the local and local_floor spaces, protected
···544548recenter_local_spaces(struct xrt_space_overseer *xso)
545549{
546550 struct u_space_overseer *uso = u_space_overseer(xso);
551551+ xrt_result_t xret;
547552548553 // Take the full lock from the start.
549554 pthread_rwlock_wrlock(&uso->lock);
···617622 update_offset_write_locked(ulocal, &local_offset);
618623 update_offset_write_locked(ulocal_floor, &local_floor_offset);
619624625625+ // Push the events.
626626+ union xrt_session_event xse = XRT_STRUCT_INIT;
627627+628628+ // Basics
629629+ xse.ref_change.event_type = XRT_SESSION_EVENT_REFERENCE_SPACE_CHANGE_PENDING;
630630+ xse.ref_change.pose_valid = false;
631631+ xse.ref_change.pose_in_previous_space = (struct xrt_pose)XRT_POSE_IDENTITY;
632632+ xse.ref_change.timestamp_ns = os_monotonic_get_ns();
633633+634634+ // Event for local space.
635635+ xse.ref_change.ref_type = XRT_SPACE_REFERENCE_TYPE_LOCAL;
636636+ xret = xrt_session_event_sink_push(uso->broadcast, &xse);
637637+ if (xret != XRT_SUCCESS) {
638638+ U_LOG_E("Failed to push event for LOCAL!");
639639+ }
640640+641641+ // Event for local floor space.
642642+ xse.ref_change.ref_type = XRT_SPACE_REFERENCE_TYPE_LOCAL_FLOOR;
643643+ xret = xrt_session_event_sink_push(uso->broadcast, &xse);
644644+ if (xret != XRT_SUCCESS) {
645645+ U_LOG_E("Failed to push event LOCAL_FLOOR!");
646646+ }
647647+620648 pthread_rwlock_unlock(&uso->lock);
621649622650 return XRT_SUCCESS;
···656684 */
657685658686struct u_space_overseer *
659659-u_space_overseer_create(void)
687687+u_space_overseer_create(struct xrt_session_event_sink *broadcast)
660688{
661689 struct u_space_overseer *uso = U_TYPED_CALLOC(struct u_space_overseer);
662690 uso->base.create_offset_space = create_offset_space;
···667695 uso->base.ref_space_dec = ref_space_dec;
668696 uso->base.recenter_local_spaces = recenter_local_spaces;
669697 uso->base.destroy = destroy;
698698+ uso->broadcast = broadcast;
670699671700 XRT_MAYBE_UNUSED int ret = 0;
672701
+3-1
src/xrt/auxiliary/util/u_space_overseer.h
···171718181919struct u_space_overseer;
2020+struct xrt_session_event_sink;
202121222223/*
···2829/*!
2930 * Create a default implementation of a space overseer.
3031 *
3232+ * @param[in] broadcast Event sink that broadcasts events to all sessions.
3133 * @ingroup aux_util
3234 */
3335struct u_space_overseer *
3434-u_space_overseer_create(void);
3636+u_space_overseer_create(struct xrt_session_event_sink *broadcast);
35373638/*!
3739 * Sets up the space overseer and all semantic spaces in a way that works with