File: ssc-common.proto

package info (click to toggle)
libssc 0.3.0-1
  • links: PTS
  • area: main
  • in suites: experimental
  • size: 1,840 kB
  • sloc: ansic: 3,551; python: 647; sh: 15; makefile: 11
file content (165 lines) | stat: -rw-r--r-- 4,174 bytes parent folder | download
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
 * libssc: Library to expose Qualcomm Sensor Core sensors
 * Copyright (C) 2022-2025 Dylan Van Assche
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
syntax = "proto2";

/*
 * Each message has a sensor UID to specify which sensor 
 * should receive the message. UIDs are 128bit, but ProtoBuf 
 * is limited to 64bit values, thus they are split into uid_low
 * and uid_high.
 */
message SscUid {
	required fixed64 low = 1;
	required fixed64 high = 2;
}

/* 
 * Client configuration 
 * @processor: a value from the SscProcessorType enum. Default APPS (1).
 * @suspend_mode: a value from the SscSuspendType enum. Default WAKEUP (0).
 * @no_wakeup_msg_ids: list of messages that do not cause a wakeup.
 */
message SscClientConfig {
        required int32 processor = 1 [default = 1];
        required int32 suspend_mode = 2 [default = 0]; 
}

/*
 * Client request body
 * @unknown: optional
 * @msg: the actual sensor request, specific for each sensor.
 * @is_passive: request is passive or not. Active triggers sensor activation.
 */
message SscClientRequestBody {
	optional bytes unknown = 1;
	optional bytes msg = 2;
	optional bool is_passive = 3 [default = false];
}

/*
 * Client request
 * @uid: UID of the sensor.
 * @msg_id: ID of the message.
 * @config: configuration for the wakeups of the client.
 * @request: request for the sensor
 */
message SscClientRequest {
	required SscUid uid = 1;
	required fixed32 msg_id = 2;
	required SscClientConfig config = 3;
	required SscClientRequestBody request = 4;
}

/*
 * Client response body
 * @msg_id: ID of the message.
 * @timestamp: DSP internal timer, 19.2 MHz.
 * @msg: the actual response of the sensor, sensor specific.
 */
message SscClientResponseBody {
	required fixed32 msg_id = 1;
	required fixed64 timestamp = 2;
	required bytes msg = 3;
}

/*
 * Client response
 * @uid: UID of the sensor.
 * @response: list of responses.
 */
message SscClientResponse {
	required SscUid uid = 1;
	repeated SscClientResponseBody response = 2;
}

/*
 * Sensor attribute request
 * @enable_updates: setting this property to true will enable updates for attributes.
 */
message SscAttrRequest {
	optional bool enable_updates = 2;
}

/*
 * Sensor attribute value array
 * @element: element of the attribute value array.
 */
message SscAttrValueArray {
	repeated SscAttrValue element = 1;
}

/*
 * Sensor attribute value
 * Depending on the attribute one of the optional values will be included.
 * @a: attribute value array data.
 * @s: string value data.
 * @f: floating point value data.
 * @i: integer value data.
 * @b: boolean value data.
 */
message SscAttrValue {
	optional SscAttrValueArray a = 1;
	optional string s = 2;
	optional float f = 3;
	optional fixed64 i = 4;
	optional bool b = 5;
}

/*
 * Sensor attribute value array
 * @v: element of the value array
 */
message SscAttrArrayValue {
	repeated SscAttrValue v = 1;
}

/*
 * Sensor attribute
 * @id: Attribute ID.
 * @value: Attribute value.
 */
message SscAttr {
	required int32 id = 1;
	required SscAttrArrayValue value_array = 2;
}

/*
 * Sensor attribute response
 * @attr: list of attributes for a sensor.
 */
message SscAttrResponse {
	repeated SscAttr attr = 1;
}

/*
 * Sensor enable config request
 * @sample_rate: requested sample rate in Hz.
 */
message SscEnableConfigRequest {
	required float sample_rate = 1;
}

/*
 * Sensor config response
 * @sample_rate: actual sample rate in Hz.
 * @mode: the sensor's operation mode.
 */
message SscConfigResponse {
	optional float sample_rate = 1;
	optional string mode = 5;
}