blob: 06eb7cbbdb34e76da4796e2de3af7ca27b7d3ff8 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module device.mojom;
import "sensor.mojom";
struct SensorInitParams {
// The shared memory handle used to fetch the sensor reading.
handle<shared_buffer> memory;
// The offset at which shared buffer must be mapped.
uint64 buffer_offset;
// The ReportingMode supported by the sensor.
ReportingMode mode;
// Default sensor configuration.
SensorConfiguration default_configuration;
// Each sensor's read buffer contains 4 tightly packed 64-bit floating
// point fields (please see sensor_reading.h) and a seqlock, so its size is
// 5 * 8 = 40 bytes.
const uint64 kReadBufferSizeForTests = 40;
};
interface SensorProvider {
// Gets the sensor interface by the given type.
//
// |type| type of the sensor.
//
// |sensor_request| the Sensor interface instance to be initialized.
//
// |init_params| on success will contain the SensorInitParams describing the
// sensor details,
// contains null on failure.
// |client_request| on success contains a request to be bound by the client,
// contains null on failure.
GetSensor(SensorType type, Sensor& sensor_request) => (
SensorInitParams? init_params,
SensorClient&? client_request);
};