#pragma once #include #include #include #include #include namespace sauna { /** * @brief Class to access and expose raw IMU data * * This class provides access to raw IMU data from tracked devices, * especially when optical tracking is lost. */ class IMUDataProvider { public: IMUDataProvider(); ~IMUDataProvider(); /** * @brief Initialize the IMU data provider * * @return true if initialization was successful * @return false if initialization failed */ bool Initialize(); /** * @brief Shutdown the IMU data provider */ void Shutdown(); /** * @brief Get the latest IMU sample for a specific device * * @param unDeviceIndex The device index to get IMU data for * @param pSample Pointer to store the IMU sample * @return true if IMU data was available * @return false if no IMU data was available */ bool GetLatestIMUSample(uint32_t unDeviceIndex, vr::ImuSample_t *pSample); /** * @brief Register a device for IMU data access * * @param unDeviceIndex The device index to register */ void RegisterDevice(uint32_t unDeviceIndex); /** * @brief Check if IMU data is available for a device * * @param unDeviceIndex The device index to check * @return true if IMU data is available * @return false if no IMU data is available */ bool IsIMUDataAvailable(uint32_t unDeviceIndex); /** * @brief Add an IMU sample for a device * * @param unDeviceIndex The device index to add the sample for * @param sample The IMU sample to add */ void AddIMUSample(uint32_t unDeviceIndex, const vr::ImuSample_t &sample); private: std::map> m_imuSamples; std::mutex m_imuSamplesMutex; bool m_bInitialized; }; } // namespace sauna