#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "services/device/generic_sensor/platform_sensor_fusion.h"
#include <limits>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "services/device/generic_sensor/platform_sensor_fusion_algorithm.h"
#include "services/device/generic_sensor/platform_sensor_provider.h"
#include "services/device/generic_sensor/platform_sensor_util.h"
namespace device {
class PlatformSensorFusion::Factory : public base::RefCounted<Factory> { … };
void PlatformSensorFusion::Create(
base::WeakPtr<PlatformSensorProvider> provider,
std::unique_ptr<PlatformSensorFusionAlgorithm> fusion_algorithm,
PlatformSensorProvider::CreateSensorCallback callback) { … }
PlatformSensorFusion::PlatformSensorFusion(
SensorReadingSharedBuffer* reading_buffer,
base::WeakPtr<PlatformSensorProvider> provider,
std::unique_ptr<PlatformSensorFusionAlgorithm> fusion_algorithm,
PlatformSensorFusion::SourcesMap sources)
: … { … }
PlatformSensorFusion::~PlatformSensorFusion() { … }
mojom::ReportingMode PlatformSensorFusion::GetReportingMode() { … }
PlatformSensorConfiguration PlatformSensorFusion::GetDefaultConfiguration() { … }
bool PlatformSensorFusion::StartSensor(
const PlatformSensorConfiguration& configuration) { … }
void PlatformSensorFusion::StopSensor() { … }
bool PlatformSensorFusion::CheckSensorConfiguration(
const PlatformSensorConfiguration& configuration) { … }
double PlatformSensorFusion::GetMaximumSupportedFrequency() { … }
double PlatformSensorFusion::GetMinimumSupportedFrequency() { … }
void PlatformSensorFusion::OnSensorReadingChanged(mojom::SensorType type) { … }
void PlatformSensorFusion::OnSensorError() { … }
bool PlatformSensorFusion::IsSuspended() { … }
bool PlatformSensorFusion::GetSourceReading(mojom::SensorType type,
SensorReading* result) { … }
bool PlatformSensorFusion::IsSignificantlyDifferent(
const SensorReading& reading1,
const SensorReading& reading2,
mojom::SensorType) { … }
}