| // Copyright 2024 The Fuchsia Authors. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.hardware.sensors; |
| |
| using fuchsia.sensors.types as types; |
| |
| /// A playback configuration which will emit events from the provided list. |
| /// |
| /// The list of SensorEvents will be sorted into separate lists by SensorId and |
| /// then played back according to each sensor's configured sample rate and max |
| /// reporting latency. Thus the ordering of the entire list is only guaranteed |
| /// to hold if all the SensorEvents are from the same sensor. Any timestamps or |
| /// sequence numbers in the provided SensorEvents are ignored and overwritten. |
| /// |
| /// There must be at least one event for every sensor in the sensor_list and |
| /// there must not be any events for sensors that aren't in the sensor_list. |
| type FixedValuesPlaybackConfig = table { |
| /// Sensors that will be advertised through the Driver protocol. |
| /// |
| /// Required. |
| 1: sensor_list vector<types.SensorInfo>:MAX; |
| |
| /// SensorsEvents which will be played back through the Driver protocol. |
| /// |
| /// Required. |
| 2: sensor_events vector<types.SensorEvent>:MAX; |
| }; |
| |
| /// Multiple types of playback are supported. Which type is used depends on |
| /// which configuration is provided to Playback::ConfigurePlayback. |
| type PlaybackSourceConfig = flexible union { |
| /// Configure for fixed values playback. See FixedValuesPlaybackConfig. |
| 1: fixed_values_config FixedValuesPlaybackConfig; |
| }; |
| |
| /// Errors that may be returned by ConfigurePlayback. |
| type ConfigurePlaybackError = flexible enum : uint32 { |
| /// The type of the PlaybackSourceConfig union isn't recognized/supported. |
| INVALID_CONFIG_TYPE = 1; |
| |
| /// Some part of the provided playback config is missing fields. |
| CONFIG_MISSING_FIELDS = 2; |
| |
| /// A provided SensorInfo has a duplicate SensorId. |
| DUPLICATE_SENSOR_INFO = 3; |
| |
| /// No SensorEvents were given for a provided SensorInfo. |
| NO_EVENTS_FOR_SENSOR = 4; |
| |
| /// A SensorEvent was seen with a SensorId for which no SensorInfo was |
| /// provided. |
| EVENT_FROM_UNKNOWN_SENSOR = 5; |
| |
| /// A SensorEvent was seen with a SensorType that does not match the |
| /// corresponding SensorInfo. |
| EVENT_SENSOR_TYPE_MISMATCH = 6; |
| |
| /// A SensorEvent was seen with an EventPayload that doesn't match its |
| /// SensorType. |
| EVENT_PAYLOAD_TYPE_MISMATCH = 7; |
| }; |
| |
| /// Implemented by components which pretend to be a sensor driver but instead |
| /// emit prerecorded or pregenerated data. Those components will also implement |
| /// the fuchsia.hardware.sensors.Driver protocol which will be used to actually |
| /// control the playback of data. This protocol is used to set up the playback |
| /// data source ana playback specific parameters. |
| @discoverable |
| protocol Playback { |
| ConfigurePlayback(struct { |
| source_config PlaybackSourceConfig; |
| }) -> () error ConfigurePlaybackError; |
| }; |