summaryrefstree
path: root/vendor/etc/sensors/proto/sns_accel.proto
blob: 52550291de927bdc26246683ba3b6bb65dc92f13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// @file sns_accel.proto
//
// Defines the API for Accelerometer Sensors.
// All Accelerometer Sensor drivers are required to comply with this API.
// Any new functionality for Accelerometer Sensor can be defined in a
// device specific API file.
//
// Copyright (c) 2016-2018, 2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.

syntax = "proto2";
import "nanopb.proto";
import "sns_std_sensor.proto";
import "sns_physical_sensor_test.proto";
import "sns_std_event_gated_sensor.proto";
import "sns_cal.proto";

// Attribute requirements:
// The Accelerometer Sensor publishes:
// 1. SNS_STD_SENSOR_ATTRID_TYPE attribute value as "accel".
// 2. SNS_STD_SENSOR_ATTRID_RESOLUTIONS attribute values in (m/s2)/LSB unit.
// 3. SNS_STD_SENSOR_ATTRID_RANGES attribute values in +/-m/s2 unit.
// 4. See sns_std_sensor.proto for other attributes.

// Handling stream requests:
// 1. The Accelerometer Sensor handles the sns_std_sensor_config
//    message request with msgid SNS_STD_SENSOR_MSGID_SNS_STD_SENSOR_CONFIG
//    for all non-gated stream enable/update requests.
// 2. The Accelerometer Sensor handles the sns_std_sensor_config
//    message request with msgid SNS_STD_EVENT_GATED_SENSOR_MSGID_SNS_STD_SENSOR_CONFIG
//    for all gated stream enable/update requests.
//    a. Accelerometer stream is gated on the motion detection feature
//       available on most accel hardware. This feature is published via the
//       "motion_detect" Sensor by the same driver library as "accel" Sensor.
//    b. If "motion_detect" is not supported then the Sensor does not support
//       stream gating. Any gated client request is rejected in this case.
// 3. The Accelerometer Sensor uses batching_period item in
//    sns_std_request as the requested batching rate to determine
//    hardware FIFO watermark.

// Handling stream events:
// 1. The Accelerometer Sensor publishes acceleration data stream events
//    using the sns_std_sensor_event message.
// 2. Each stream event contains three output data fields where data is
//    in m/s2 units and is factory calibrated.
// 3. Data in the stream is adjusted to Android coordinate system relative to a
//    mobile device held with screen facing the user in it's natural orientation:
//    X-axis: parallel to the screen pointing to the right
//    Y-axis: parallel to the screen pointing to the top
//    Z-axis: perpendicular to the screen pointing towards the user
//    This conforms to the mobile device axes orientation as specified by the
//    Android Sensor API.
// 4. Data in the stream event is ordered as:
//    data[0] = X-axis
//    data[1] = Y-axis
//    data[2] = Z-axis
// 5. Each stream event publishes an accuracy field:
//    SNS_STD_SENSOR_SAMPLE_STATUS_UNRELIABLE to mark invalid samples when hardware is
//    yet to stabilize after the sensor is configured.
//    SNS_STD_SENSOR_SAMPLE_STATUS_ACCURACY_HIGH to mark samples when they are valid.
// 6. The Accelerometer Sensor publishes a configuration event using the
//    sns_std_sensor_physical_config_event message.
//    It publishes this event each time there is change in hardware config of the sensor
//    and contains current physical sensor config of the sensor.
// 7. The Accelerometer Sensor publishes a factory calibration event using the
//    sns_cal_event message. It uses bias and comp_matrix fields in this event.
//    It publishes this event each time there is change in it's factory calibration
//    data or when a client sends a new streaming request.
// 8. When all outstanding requests to the Sensor are gated requests and if the
//    "motion_detect" Sensor is enabled then the accel Sensor stops generating
//    output events.
//    a. When motion detect interrupt fires:
//       - All existing accel gated stream requests are converted to non-gated
//         stream requests.
//         The accel Sensor publishes an event with message ID
//         SNS_STD_EVENT_GATED_SENSOR_MSGID_GATED_REQ_CONVERTED_TO_NON_GATED to
//         to indicate this change to it's gated clients.
//       - The accel Sensor resumes generating output to all clients.
//       So in effect motion_detect Sensor and accel gated Sensor stream have
//       a one shot behavior.
//    b. The Sensor resumes generating output events if motion detect interrupt
//       is disabled potentially due to a new non-gated accel stream request or
//       the request to motion_detect Sensor is disabled.
// 9. When all outstanding requests to the Sensor are gated requests but if
//    "motion_detect" Sensor is not enabled then the Sensor continues to generate
//    output events.

// Handling self-test requests:
// 1. The Accelerometer Sensor implements SNS_PHYSICAL_SENSOR_TEST_TYPE_COM test
//    type using the physical sensor test API.
// 2. The Accelerometer Sensor implements SNS_PHYSICAL_SENSOR_TEST_TYPE_FACTORY test
//    type to determine factory calibration parameters using the physical
//    sensor test API.
// 3. The Accelerometer Sensor could implement other test types.

// Handling test events:
// 1. The Accelerometer Sensor uses sns_physical_sensor_test_event message to publish
//    a test completion event.
// 2. The test_passed field in sns_physical_sensor_test_event is used to output the
//    pass/fail result of self-test execution.
// 3. The test_data field in sns_physical_sensor_test_event could be used to output any
//    driver-specific error data.