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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
// @file sns_std.proto
//
// Defines standard messages used across multiple Sensor API definitions
//
// Copyright (c) 2016-2020 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
syntax = "proto2";
import "nanopb.proto";
import public "sns_std_type.proto";
// Framework-defined message IDs:
enum sns_std_msgid {
option (nanopb_enumopt).long_names = false;
// Query a Sensor for all attributes
// @event sns_std_error_event
SNS_STD_MSGID_SNS_STD_ATTR_REQ = 1;
// Flush a Sensor.
// When a sensor receives a flush request it publishes any unpublished
// samples. The sensor always publishes a SNS_STD_MSGID_SNS_STD_FLUSH_EVENT
// event to indicate completion of a flush request.
// All Sensors handle this flush request message. See special case handling below
// Empty Message
// @event sns_pb_flush_event
SNS_STD_MSGID_SNS_STD_FLUSH_REQ = 2;
// NOTE: 10 - 20 Are reserved for Client Manager
// NOTE: 120-127 Are reserved
// All published attributes for a Sensor
SNS_STD_MSGID_SNS_STD_ATTR_EVENT = 128;
// Indicates no further events will be generated in response to a flush req.
// Empty Message
SNS_STD_MSGID_SNS_STD_FLUSH_EVENT = 129;
// Indicates an error has occurred
SNS_STD_MSGID_SNS_STD_ERROR_EVENT = 130;
// NOTE: 250-255 Are reserved
}
// Special case handling for flush request
// 1. No prior instance has been created, and a flush request is received, i.e. flush request is sent before an enable req
// Unexpected sequence, driver can ignore the flush request, and set_client_request returns NULL
// 2. When enable request is sent and while that is still ongoing ( phy cfg event not published yet) and a flush request is received, expected sequence below:
// a) sensor driver gets sns_std_sensor_config
// b) sensor driver gets sns_std_flush_req
// c) sensor driver sends sns_std_sensor_physical_config_event
// d) sensor driver sends sns_std_flush_event
// 3. When a previous flush request is still ongoing and another flush request comes
// a) sensor driver receives sns_std_flush_req
// b) sensor driver receives another sns_std_flush_req while first flush request is being handled, but no flush event is sent yet
// c) sensor driver can ignore the 2nd flush request
// d) sensor driver finishes processing the first flush request and sends sns_std_flush_event
// #1 and # 3 applies to algorithm as well.
// Base message payload, from which all other Request payloads must extend
// The message will be delivered decoded within the Sensor API
message sns_std_request {
message batch_spec {
// Logically a timer will be registered for this many microseconds.
// All events generated since the last timer expiration will be saved
// until the next timer has fired. This period is interpreted as a maximum
// period specified by the client; events may be delivered to client at a
// faster rate (smaller batch period).
// A batch period of 0 indicates that no batching shall occur.
required uint32 batch_period = 1;
// Sensor supporting Data Acquisition Engine shall support flush_period.
// Sensor shall not drop data that is more recent than flush_period.
// Sensor may drop data that is older than the flush_period.
// Effective flush period may be smaller due to system constraints,
// or larger in the case of a concurrent client with a larger value.
// flush_period, if set, should be greater than or equal to batch_period.
// flush_period value defaults to UINT32_MAX; units in microseconds.
// If batch_period > 0 and flush period not specified,
// then flush_period = batch_period.
optional uint32 flush_period = 2;
// If flush_only = true, the sensor should only send data to the client
// on receiving a flush request or if the sensor cannot accumulate flush
// period worth of data.
optional bool flush_only = 3 [default = false];
// If max_batch = true for all requests, the sensor should operate at
// maximum batching capacity. If a request has both max_batch = true
// and flush_only = true, flush_only takes precedence.
optional bool max_batch = 4 [default = false];
}
// Batching is disabled by default
optional batch_spec batching = 1;
// Dynamic length payload, containing the actual data/configuration request
// This payload will need to be decoded separately, using the Sensor-specific
// header file. If the request does not contain any message body then this
// field is not present.
optional bytes payload = 2;
// Set to true if a client intends to be a passive client. Else it is an
// active client request. Absence of this field shall be treated as an active
// request.
// If all requests to the sensor are passive then it shall be in off
// state and stop streaming.
// If the sensor has at least one active request then it shall be enabled
// and configured according to all active and passive requests.
// When all active clients are flush_only then passive clients are also treated
// as flush_only.
// When all active clients are event gated then passive clients are also treated
// as event gated.
// delivery_type field in passive requests shall be configured as
// SNS_CLIENT_DELIVERY_NO_WAKEUP.
// Actively enabling one sensor shall not lead to enabling of another
// sensor having only passive requests. For example: enabling gyro shall not
// lead to enabling of sensor_temperature, and vice versa.
optional bool is_passive = 3 [default = false];
}
// Query a Sensor for its list of attributes
message sns_std_attr_req {
// Register for updates when the attributes of a Sensor change
// This option is not presently supported
optional bool register_updates = 2;
}
// Contains all Sensor attributes; sent in response to an sns_std_attr_req,
// or upon an attribute change to a registered Sensor
message sns_std_attr_event {
repeated sns_std_attr attributes = 1;
}
// An Error Event generated by a Sensor/Instance or the Framework
message sns_std_error_event {
// SNS_STD_ERROR_NOT_AVAILABLE - Transitory error in the Sensor; some data
// may have been lost or dropped, but streaming should resume.
// SNS_STD_ERROR_INVALID_STATE - Catastrophic error in the Sensor; do not
// expect any further data. Client may try sending enable-request again.
// SNS_STD_ERROR_NOT_SUPPORTED - Sensor received an unsupported request; or a
// supported request at an unexpected time. Client may not expect any
// further data and may try sending valid request.
required sns_std_error error = 1;
}
|