xref: /aosp_15_r20/hardware/interfaces/sensors/1.0/types.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package [email protected];
18
19/**
20 * Please see the Sensors section of source.android.com for an
21 * introduction to and detailed descriptions of Android sensor types:
22 * http://source.android.com/devices/sensors/index.html
23 */
24
25/** Type enumerating various result codes returned from ISensors methods */
26enum Result : int32_t {
27    OK,
28    PERMISSION_DENIED                   = -1,
29    NO_MEMORY                           = -12,
30    BAD_VALUE                           = -22,
31    INVALID_OPERATION                   = -38,
32};
33
34/**
35 * Sensor HAL modes used in setOperationMode method
36 */
37@export(name="", value_prefix="SENSOR_HAL_", value_suffix="_MODE")
38enum OperationMode : int32_t {
39    NORMAL                          = 0,
40    DATA_INJECTION                  = 1,
41};
42
43/**
44 * Sensor type
45 *
46 * Each sensor has a type which defines what this sensor measures and how
47 * measures are reported. See the Base sensors and Composite sensors lists
48 * for complete descriptions:
49 * http://source.android.com/devices/sensors/base_triggers.html
50 * http://source.android.com/devices/sensors/composite_sensors.html
51 *
52 * Device manufacturers (OEMs) can define their own sensor types, for
53 * their private use by applications or services provided by them. Such
54 * sensor types are specific to an OEM and can't be exposed in the SDK.
55 * These types must start at SensorType::DEVICE_PRIVATE_BASE.
56 *
57 * All sensors defined outside of the device private range must correspond to
58 * a type defined in this file, and must satisfy the characteristics listed in
59 * the description of the sensor type.
60 *
61 * Each sensor also has a "typeAsString".
62 *  - string type of sensors defined in this file is overridden by Android to
63 *    values defined in Android API with "android.sensor." prefix.
64 *    Example: for an accelerometer,
65 *      type = SensorType::Acclerometer
66 *      typeAsString = "" (will be replace by "android.sensor.accelerometer" by
67 *                         Android frameowrk)
68 *  - string type of sensors inside of the device private range MUST be prefixed
69 *    by the sensor provider's or OEM reverse domain name. In particular, they
70 *    cannot use the "android.sensor." prefix.
71 *
72 * When android introduces a new sensor type that can replace an OEM-defined
73 * sensor type, the OEM must use the official sensor type and stringType on
74 * versions of the HAL that support this new official sensor type.
75 *
76 * Example (made up): Suppose Google's Glass team wants to surface a sensor
77 * detecting that Glass is on a head.
78 *  - Such a sensor is not officially supported in android KitKat
79 *  - Glass devices launching on KitKat can implement a sensor with
80 *      type = 0x10001
81 *      typeAsString = "com.google.glass.onheaddetector"
82 *  - In L android release, if android decides to define
83 *    SensorType::ON_HEAD_DETECTOR and STRING_SensorType::ON_HEAD_DETECTOR,
84 *    those types should replace the Glass-team-specific types in all future
85 *    launches.
86 *  - When launching Glass on the L release, Google should now use the official
87 *    type (SensorType::ON_HEAD_DETECTOR) and stringType.
88 *  - This way, all applications can now use this sensor.
89 */
90
91/**
92 * Wake up sensors.
93 * Each sensor may have either or both a wake-up and a non-wake variant.
94 * When registered in batch mode, wake-up sensors will wake up the AP when
95 * their FIFOs are full or when the batch timeout expires. A separate FIFO has
96 * to be maintained for wake up sensors and non wake up sensors. The non
97 * wake-up sensors need to overwrite their FIFOs when they are full till the AP
98 * wakes up and the wake-up sensors will wake-up the AP when their FIFOs are
99 * full or when the batch timeout expires without losing events.
100 * Wake-up and non wake-up variants of each sensor can be activated at
101 * different rates independently of each other.
102 *
103 * Note: Proximity sensor and significant motion sensor which were defined in
104 * previous releases are also wake-up sensors and must be treated as such.
105 * Wake-up one-shot sensors like SIGNIFICANT_MOTION cannot be batched, hence
106 * the text about batch above doesn't apply to them. See the definitions of
107 * SensorType::PROXIMITY and SensorType::SIGNIFICANT_MOTION for more info.
108 *
109 * Set SENSOR_FLAG_WAKE_UP flag for all wake-up sensors.
110 *
111 * For example, A device can have two sensors both of SensorType::ACCELEROMETER
112 * and one of them can be a wake_up sensor (with SENSOR_FLAG_WAKE_UP flag set)
113 * and the other can be a regular non wake_up sensor. Both of these sensors
114 * must be activated/deactivated independently of the other.
115 */
116
117@export(name="", value_prefix="SENSOR_TYPE_")
118enum SensorType : int32_t {
119    /**
120     * META_DATA is a special event type used to populate the MetaData
121     * structure. It doesn't correspond to a physical sensor. Events of this
122     * type exist only inside the HAL, their primary purpose is to signal the
123     * completion of a flush request.
124     */
125    META_DATA                       = 0,
126
127    /**
128     * ACCELEROMETER
129     * reporting-mode: continuous
130     *
131     * All values are in SI units (m/s^2) and measure the acceleration of the
132     * device minus the acceleration due to gravity.
133     *
134     * Implement the non-wake-up version of this sensor and implement the
135     * wake-up version if the system possesses a wake up fifo.
136     */
137    ACCELEROMETER                   = 1,
138
139    /**
140     * MAGNETIC_FIELD
141     * reporting-mode: continuous
142     *
143     * All values are in micro-Tesla (uT) and measure the geomagnetic
144     * field in the X, Y and Z axis.
145     *
146     * Implement the non-wake-up version of this sensor and implement the
147     * wake-up version if the system possesses a wake up fifo.
148     */
149    MAGNETIC_FIELD                  = 2,
150
151    /**
152     * ORIENTATION
153     * reporting-mode: continuous
154     *
155     * All values are angles in degrees.
156     *
157     * Orientation sensors return sensor events for all 3 axes at a constant
158     * rate defined by setDelay().
159     *
160     * Implement the non-wake-up version of this sensor and implement the
161     * wake-up version if the system possesses a wake up fifo.
162     */
163    ORIENTATION                     = 3,
164
165    /**
166     * GYROSCOPE
167     * reporting-mode: continuous
168     *
169     * All values are in radians/second and measure the rate of rotation
170     * around the X, Y and Z axis.
171     *
172     * Implement the non-wake-up version of this sensor and implement the
173     * wake-up version if the system possesses a wake up fifo.
174     */
175    GYROSCOPE                       = 4,
176
177    /**
178     * LIGHT
179     * reporting-mode: on-change
180     *
181     * The light sensor value is returned in SI lux units.
182     *
183     * Both wake-up and non wake-up versions are useful.
184     */
185    LIGHT                           = 5,
186
187    /**
188     * PRESSURE
189     * reporting-mode: continuous
190     *
191     * The pressure sensor return the athmospheric pressure in hectopascal (hPa)
192     *
193     * Implement the non-wake-up version of this sensor and implement the
194     * wake-up version if the system possesses a wake up fifo.
195     */
196    PRESSURE                        = 6,
197
198    /** TEMPERATURE is deprecated in the HAL */
199    TEMPERATURE                     = 7,
200
201    /**
202     * PROXIMITY
203     * reporting-mode: on-change
204     *
205     * The proximity sensor which turns the screen off and back on during calls
206     * is the wake-up proximity sensor. Implement wake-up proximity sensor
207     * before implementing a non wake-up proximity sensor. For the wake-up
208     * proximity sensor set the flag SENSOR_FLAG_WAKE_UP.
209     * The value corresponds to the distance to the nearest object in
210     * centimeters.
211     */
212    PROXIMITY                       = 8,
213
214    /**
215     * GRAVITY
216     * reporting-mode: continuous
217     *
218     * A gravity output indicates the direction of and magnitude of gravity in
219     * the devices's coordinates.
220     *
221     * Implement the non-wake-up version of this sensor and implement the
222     * wake-up version if the system possesses a wake up fifo.
223     */
224    GRAVITY                         = 9,
225
226    /**
227     * LINEAR_ACCELERATION
228     * reporting-mode: continuous
229     *
230     * Indicates the linear acceleration of the device in device coordinates,
231     * not including gravity.
232     *
233     * Implement the non-wake-up version of this sensor and implement the
234     * wake-up version if the system possesses a wake up fifo.
235     */
236    LINEAR_ACCELERATION             = 10,
237
238    /**
239     * ROTATION_VECTOR
240     * reporting-mode: continuous
241     *
242     * The rotation vector symbolizes the orientation of the device relative to
243     * the East-North-Up coordinates frame.
244     *
245     * Implement the non-wake-up version of this sensor and implement the
246     * wake-up version if the system possesses a wake up fifo.
247     */
248    ROTATION_VECTOR                 = 11,
249
250    /**
251     * RELATIVE_HUMIDITY
252     * reporting-mode: on-change
253     *
254     * A relative humidity sensor measures relative ambient air humidity and
255     * returns a value in percent.
256     *
257     * Both wake-up and non wake-up versions are useful.
258     */
259    RELATIVE_HUMIDITY               = 12,
260
261    /**
262     * AMBIENT_TEMPERATURE
263     * reporting-mode: on-change
264     *
265     * The ambient (room) temperature in degree Celsius.
266     *
267     * Both wake-up and non wake-up versions are useful.
268     */
269    AMBIENT_TEMPERATURE             = 13,
270
271    /**
272     * MAGNETIC_FIELD_UNCALIBRATED
273     * reporting-mode: continuous
274     *
275     * Similar to MAGNETIC_FIELD, but the hard iron calibration is
276     * reported separately instead of being included in the measurement.
277     *
278     * Implement the non-wake-up version of this sensor and implement the
279     * wake-up version if the system possesses a wake up fifo.
280     */
281    MAGNETIC_FIELD_UNCALIBRATED     = 14,
282
283    /**
284     * GAME_ROTATION_VECTOR
285     * reporting-mode: continuous
286     *
287     * Similar to ROTATION_VECTOR, but not using the geomagnetic
288     * field.
289     *
290     * Implement the non-wake-up version of this sensor and implement the
291     * wake-up version if the system possesses a wake up fifo.
292     */
293    GAME_ROTATION_VECTOR            = 15,
294
295    /**
296     * GYROSCOPE_UNCALIBRATED
297     * reporting-mode: continuous
298     *
299     * All values are in radians/second and measure the rate of rotation
300     * around the X, Y and Z axis.
301     *
302     * Implement the non-wake-up version of this sensor and implement the
303     * wake-up version if the system possesses a wake up fifo.
304     */
305    GYROSCOPE_UNCALIBRATED          = 16,
306
307    /**
308     * SIGNIFICANT_MOTION
309     * reporting-mode: one-shot
310     *
311     * A sensor of this type triggers an event each time significant motion
312     * is detected and automatically disables itself.
313     * For Significant Motion sensor to be useful, it must be defined as a
314     * wake-up sensor. (set SENSOR_FLAG_WAKE_UP). Implement the wake-up
315     * significant motion sensor. A non wake-up version is not useful.
316     * The only allowed value to return is 1.0.
317     */
318    SIGNIFICANT_MOTION              = 17,
319
320    /**
321     * STEP_DETECTOR
322     * reporting-mode: special
323     *
324     * A sensor of this type triggers an event each time a step is taken
325     * by the user. The only allowed value to return is 1.0 and an event
326     * is generated for each step.
327     *
328     * Both wake-up and non wake-up versions are useful.
329     */
330    STEP_DETECTOR                   = 18,
331
332    /**
333     * STEP_COUNTER
334     * reporting-mode: on-change
335     *
336     * A sensor of this type returns the number of steps taken by the user since
337     * the last reboot while activated. The value is returned as a uint64_t and
338     * is reset to zero only on a system / android reboot.
339     *
340     * Implement the non-wake-up version of this sensor and implement the
341     * wake-up version if the system possesses a wake up fifo.
342     */
343    STEP_COUNTER                    = 19,
344
345    /**
346     * GEOMAGNETIC_ROTATION_VECTOR
347     * reporting-mode: continuous
348     *
349     *  Similar to ROTATION_VECTOR, but using a magnetometer instead
350     *  of using a gyroscope.
351     *
352     * Implement the non-wake-up version of this sensor and implement the
353     * wake-up version if the system possesses a wake up fifo.
354     */
355    GEOMAGNETIC_ROTATION_VECTOR     = 20,
356
357    /**
358     * HEART_RATE
359     * reporting-mode: on-change
360     *
361     *  A sensor of this type returns the current heart rate.
362     *  The events contain the current heart rate in beats per minute (BPM) and
363     *  the status of the sensor during the measurement. See "HeartRate" below
364     *  for more details.
365     *
366     *  Because this sensor is on-change, events must be generated when and only
367     *  when heart_rate.bpm or heart_rate.status have changed since the last
368     *  event. In particular, upon the first activation, unless the device is
369     *  known to not be on the body, the status field of the first event must be
370     *  set to SensorStatus::UNRELIABLE. The event should be generated no faster
371     *  than every period_ns passed to setDelay() or to batch().
372     *  See the definition of the on-change reporting mode for more information.
373     *
374     *  SensorInfo.requiredPermission must be set to
375     *  SENSOR_PERMISSION_BODY_SENSORS.
376     *
377     *  Both wake-up and non wake-up versions are useful.
378     */
379    HEART_RATE                      = 21,
380
381    /**
382     * WAKE_UP_TILT_DETECTOR
383     * reporting-mode: special (setDelay has no impact)
384     *
385     * A sensor of this type generates an event each time a tilt event is
386     * detected. A tilt event must be generated if the direction of the
387     * 2-seconds window average gravity changed by at least 35 degrees since the
388     * activation or the last trigger of the sensor.
389     *
390     *  reference_estimated_gravity = average of accelerometer measurements over
391     *  the first 1 second after activation or the estimated gravity at the last
392     *  trigger.
393     *
394     *  current_estimated_gravity = average of accelerometer measurements over
395     *  the last 2 seconds.
396     *
397     *  trigger when
398     *     angle(reference_estimated_gravity, current_estimated_gravity)
399     *       > 35 degrees
400     *
401     * Large accelerations without a change in phone orientation must not
402     * trigger a tilt event.
403     * For example, a sharp turn or strong acceleration while driving a car
404     * must not trigger a tilt event, even though the angle of the average
405     * acceleration might vary by more than 35 degrees.
406     *
407     * Typically, this sensor is implemented with the help of only an
408     * accelerometer. Other sensors can be used as well if they do not increase
409     * the power consumption significantly. This is a low power sensor that
410     * must allow the AP to go into suspend mode. Do not emulate this sensor
411     * in the HAL.
412     * Like other wake up sensors, the driver is expected to a hold a wake_lock
413     * with a timeout of 200 ms while reporting this event. The only allowed
414     * return value is 1.0.
415     *
416     * Implement only the wake-up version of this sensor.
417     */
418    TILT_DETECTOR                   = 22,
419
420    /**
421     * WAKE_GESTURE
422     * reporting-mode: one-shot
423     *
424     * A sensor enabling waking up the device based on a device specific motion.
425     *
426     * When this sensor triggers, the device behaves as if the power button was
427     * pressed, turning the screen on. This behavior (turning on the screen when
428     * this sensor triggers) might be deactivated by the user in the device
429     * settings. Changes in settings do not impact the behavior of the sensor:
430     * only whether the framework turns the screen on when it triggers.
431     *
432     * The actual gesture to be detected is not specified, and can be chosen by
433     * the manufacturer of the device.
434     * This sensor must be low power, as it is likely to be activated 24/7.
435     * The only allowed value to return is 1.0.
436     *
437     * Implement only the wake-up version of this sensor.
438     */
439    WAKE_GESTURE                    = 23,
440
441    /**
442     * GLANCE_GESTURE
443     * reporting-mode: one-shot
444     *
445     * A sensor enabling briefly turning the screen on to enable the user to
446     * glance content on screen based on a specific motion.  The device must
447     * turn the screen off after a few moments.
448     *
449     * When this sensor triggers, the device turns the screen on momentarily
450     * to allow the user to glance notifications or other content while the
451     * device remains locked in a non-interactive state (dozing). This behavior
452     * (briefly turning on the screen when this sensor triggers) might be
453     * deactivated by the user in the device settings.
454     * Changes in settings do not impact the behavior of the sensor: only
455     * whether the framework briefly turns the screen on when it triggers.
456     *
457     * The actual gesture to be detected is not specified, and can be chosen by
458     * the manufacturer of the device.
459     * This sensor must be low power, as it is likely to be activated 24/7.
460     * The only allowed value to return is 1.0.
461     *
462     * Implement only the wake-up version of this sensor.
463     */
464    GLANCE_GESTURE                  = 24,
465
466    /**
467     * PICK_UP_GESTURE
468     * reporting-mode: one-shot
469     *
470     * A sensor of this type triggers when the device is picked up regardless of
471     * wherever is was before (desk, pocket, bag). The only allowed return value
472     * is 1.0. This sensor de-activates itself immediately after it triggers.
473     *
474     * Implement only the wake-up version of this sensor.
475     */
476    PICK_UP_GESTURE                 = 25,
477
478    /**
479     * WRIST_TILT_GESTURE
480     * trigger-mode: special
481     * wake-up sensor: yes
482     *
483     * A sensor of this type triggers an event each time a tilt of the
484     * wrist-worn device is detected.
485     *
486     * This sensor must be low power, as it is likely to be activated 24/7.
487     * The only allowed value to return is 1.0.
488     *
489     * Implement only the wake-up version of this sensor.
490     */
491    WRIST_TILT_GESTURE              = 26,
492
493    /**
494     * DEVICE_ORIENTATION
495     * reporting-mode: on-change
496     *
497     * The current orientation of the device. The value is reported in
498     * the "scalar" element of the EventPayload in Event. The
499     * only values that can be reported are (please refer to Android Sensor
500     * Coordinate System to understand the X and Y axis direction with respect
501     * to default orientation):
502     *  - 0: device is in default orientation (Y axis is vertical and points up)
503     *  - 1: device is rotated 90 degrees counter-clockwise from default
504     *       orientation (X axis is vertical and points up)
505     *  - 2: device is rotated 180 degrees from default orientation (Y axis is
506     *       vertical and points down)
507     *  - 3: device is rotated 90 degrees clockwise from default orientation
508     *       (X axis is vertical and points down)
509     *
510     * Moving the device to an orientation where the Z axis is vertical (either
511     * up or down) must not cause a new event to be reported.
512     *
513     * To improve the user experience of this sensor, it is recommended to
514     * implement some physical (i.e., rotation angle) and temporal (i.e., delay)
515     * hysteresis. In other words, minor or transient rotations must not cause
516     * a new event to be reported.
517     *
518     * This is a low power sensor that intended to reduce interrupts of
519     * application processor and thus allow it to go sleep. Use hardware
520     * implementation based on low power consumption sensors, such as
521     * accelerometer. Device must not emulate this sensor in the HAL.
522     *
523     * Both wake-up and non wake-up versions are useful.
524     */
525    DEVICE_ORIENTATION              = 27,
526
527    /**
528     * POSE_6DOF
529     * trigger-mode: continuous
530     *
531     * A sensor of this type returns the pose of the device.
532     * Pose of the device is defined as the orientation of the device from a
533     * Earth Centered Earth Fixed frame and the translation from an arbitrary
534     * point at subscription.
535     *
536     * This sensor can be high power. It can use any and all of the following
537     *           . Accelerometer
538     *           . Gyroscope
539     *           . Camera
540     *           . Depth Camera
541     *
542     */
543    POSE_6DOF                       = 28,
544
545    /**
546     * STATIONARY_DETECT
547     * trigger mode: one shot
548     *
549     * A sensor of this type returns an event if the device is still/stationary
550     * for a while. The period of time to monitor for stationarity must be
551     * greater than 5 seconds. The latency must be less than 10 seconds.
552     *
553     * Stationarity here refers to absolute stationarity. eg: device on desk.
554     *
555     * The only allowed value to return is 1.0.
556     */
557    STATIONARY_DETECT               = 29,
558
559    /**
560     * MOTION_DETECT
561     * trigger mode: one shot
562     *
563     * A sensor of this type returns an event if the device is not still for
564     * for a while. The period of time to monitor for stationarity must be
565     * greater than 5 seconds. The latency must be less than 10 seconds.
566     *
567     * Motion here refers to any mechanism in which the device is causes to be
568     * moved in its inertial frame. eg: Pickin up the device and walking with it
569     * to a nearby room may trigger motion wherewas keeping the device on a
570     * table on a smooth train moving at constant velocity may not trigger
571     * motion.
572     *
573     * The only allowed value to return is 1.0.
574     */
575    MOTION_DETECT                   = 30,
576
577    /**
578     * HEART_BEAT
579     * trigger mode: continuous
580     *
581     * A sensor of this type returns an event everytime a hear beat peak is
582     * detected.
583     *
584     * Peak here ideally corresponds to the positive peak in the QRS complex of
585     * and ECG signal.
586     *
587     * The sensor is not expected to be optimized for latency. As a guide, a
588     * latency of up to 10 seconds is acceptable. However, the timestamp attached
589     * to the event must be accuratly correspond to the time the peak occured.
590     *
591     * The sensor event contains a parameter for the confidence in the detection
592     * of the peak where 0.0 represent no information at all, and 1.0 represents
593     * certainty.
594     */
595    HEART_BEAT                      = 31,
596
597    /**
598     * DYNAMIC_SENSOR_META
599     * trigger-mode: special
600     * wake-up sensor: yes
601     *
602     * A sensor event of this type is received when a dynamic sensor is added to
603     * or removed from the system. At most one sensor of this type can be
604     * present in one sensor HAL implementation and presence of a sensor of this
605     * type in sensor HAL implementation indicates that this sensor HAL supports
606     * dynamic sensor feature. Operations, such as batch, activate and setDelay,
607     * to this special purpose sensor must be treated as no-op and return
608     * successful; flush() also has to generate flush complete event as if this
609     * is a sensor that does not support batching.
610     *
611     * A dynamic sensor connection indicates connection of a physical device or
612     * instantiation of a virtual sensor backed by algorithm; and a dynamic
613     * sensor disconnection indicates the the opposite. A sensor event of
614     * DYNAMIC_SENSOR_META type should be delivered regardless of
615     * the activation status of the sensor in the event of dynamic sensor
616     * connection and disconnection. In the sensor event, besides the common
617     * data entries, "dynamic_sensor_meta", which includes fields for connection
618     * status, handle of the sensor involved, pointer to sensor_t structure and
619     * a uuid field, must be populated.
620     *
621     * At a dynamic sensor connection event, fields of sensor_t structure
622     * referenced by a pointer in dynamic_sensor_meta must be filled as if it
623     * was regular sensors. Sensor HAL is responsible for recovery of memory if
624     * the corresponding data is dynamicially allocated. However, the the
625     * pointer must be valid until the first activate call to the sensor
626     * reported in this connection event. At a dynamic sensor disconnection,
627     * the sensor_t pointer must be NULL.
628     *
629     * The sensor handle assigned to dynamic sensors must never be the same as
630     * that of any regular static sensors, and must be unique until next boot.
631     * In another word, if a handle h is used for a dynamic sensor A, that same
632     * number cannot be used for the same dynamic sensor A or another dynamic
633     * sensor B even after disconnection of A until reboot.
634     *
635     * The UUID field will be used for identifying the sensor in addition to
636     * name, vendor and version and type. For physical sensors of the same
637     * model, all sensors will have the same values in sensor_t, but the UUID
638     * must be unique and persistent for each individual unit. An all zero
639     * UUID indicates it is not possible to differentiate individual sensor
640     * unit.
641     *
642     */
643    DYNAMIC_SENSOR_META             = 32,
644
645    /**
646     * ADDITIONAL_INFO
647     * reporting-mode: N/A
648     *
649     * This sensor type is for delivering additional sensor information aside
650     * from sensor event data.
651     * Additional information may include sensor front-end group delay, internal
652     * calibration parameters, noise level metrics, device internal temperature,
653     * etc.
654     *
655     * This type will never bind to a sensor. In other words, no sensor in the
656     * sensor list can have the type SENSOR_TYPE_ADDITIONAL_INFO. If a
657     * sensor HAL supports sensor additional information feature, it reports
658     * sensor_event_t with "sensor" field set to handle of the reporting sensor
659     * and "type" field set to ADDITIONAL_INFO. Delivery of
660     * additional information events is triggered under two conditions: an
661     * enable activate() call or a flush() call to the corresponding sensor.
662     * Besides, time varying parameters can update infrequently without being
663     * triggered. Device is responsible to control update rate. The recommend
664     * update rate is less than 1/1000 of sensor event rate or less than once
665     * per minute in average.
666     *
667     * A single additional information report consists of multiple frames.
668     * Sequences of these frames are ordered using timestamps, which means the
669     * timestamps of sequential frames have to be at least 1 nanosecond apart
670     * from each other. Each frame is a sensor_event_t delivered through the HAL
671     * interface, with related data stored in the "additional_info" field, which
672     * is of type additional_info_event_t.
673     * The "type" field of additional_info_event_t denotes the nature of the
674     * payload data (see additional_info_type_t).
675     * The "serial" field is used to keep the sequence of payload data that
676     * spans multiple frames. The first frame of the entire report is always of
677     * type AINFO_BEGIN, and the last frame is always AINFO_END.
678     *
679     * If flush() was triggering the report, all additional information frames
680     * must be delivered after flush complete event.
681     */
682    ADDITIONAL_INFO                 = 33,
683
684    /**
685     * LOW_LATENCY_OFFBODY_DETECT
686     * trigger-mode: on-change
687     * wake-up sensor: yes
688     *
689     * A sensor of this type is defined for devices that are supposed to be worn
690     * by the user in the normal use case (such as a watch, wristband, etc) and
691     * is not yet defined for other device.
692     *
693     * A sensor of this type triggers an event each time the wearable device
694     * is removed from the body and each time it's put back onto the body.
695     * It must be low-latency and be able to detect the on-body to off-body
696     * transition within one second (event delivery time included),
697     * and 3-second latency to determine the off-body to on-body transition
698     * (event delivery time included).
699     *
700     * There are only two valid event values for the sensor to return :
701     *    0.0 for off-body
702     *    1.0 for on-body
703     *
704     */
705    LOW_LATENCY_OFFBODY_DETECT      = 34,
706
707    /**
708     * ACCELEROMETER_UNCALIBRATED
709     * reporting-mode: continuous
710     *
711     * All values are in SI units (m/s^2) and measure the acceleration of the
712     * device minus the acceleration due to gravity.
713     *
714     * Implement the non-wake-up version of this sensor and implement the
715     * wake-up version if the system possesses a wake up fifo.
716     */
717    ACCELEROMETER_UNCALIBRATED      = 35,
718
719    /**
720     * Base for device manufacturers private sensor types.
721     * These sensor types can't be exposed in the SDK.
722     */
723    DEVICE_PRIVATE_BASE             = 0x10000
724};
725
726@export(name="", value_prefix="SENSOR_FLAG_")
727enum SensorFlagBits : uint32_t {
728    /**
729     * Whether this sensor wakes up the AP from suspend mode when data is
730     * available.  Whenever sensor events are delivered from a wake_up sensor,
731     * the driver needs to hold a wake_lock till the events are read by the
732     * SensorService i.e till ISensors::poll() is called the next time.
733     * Once poll is called again it means events have been read by the
734     * SensorService, the driver can safely release the wake_lock. SensorService
735     * will continue to hold a wake_lock till the app actually reads the events.
736     */
737    WAKE_UP                     = 1,
738
739    /**
740     * Reporting modes for various sensors. Each sensor will have exactly one of
741     * these modes set.
742     * The least significant 2nd, 3rd and 4th bits are used to represent four
743     * possible reporting modes.
744     */
745    CONTINUOUS_MODE             = 0,
746    ON_CHANGE_MODE              = 2,
747    ONE_SHOT_MODE               = 4,
748    SPECIAL_REPORTING_MODE      = 6,
749
750    /**
751     * Set this flag if the sensor supports data_injection mode and allows data
752     * to be injected from the SensorService. When in data_injection ONLY
753     * sensors with this flag set are injected sensor data and only sensors with
754     * this flag set are activated. Eg: Accelerometer and Step Counter sensors
755     * can be set with this flag and SensorService will inject accelerometer
756     * data and read the corresponding step counts.
757     */
758    DATA_INJECTION              = 0x10,
759
760    /**
761     * Set this flag if the sensor is a dynamically connected sensor. See
762     * DynamicSensorInfo and DYNAMIC_SENSOR_META for details.
763     */
764    DYNAMIC_SENSOR              = 0x20,
765
766    /**
767     * Set this flag if sensor additional information is supported.
768     * See ADDITIONAL_INFO and AdditionalInfo for details.
769     */
770    ADDITIONAL_INFO             = 0x40,
771
772    /**
773     * Set this flag if sensor suppor direct channel backed by ashmem.
774     * See SharedMemType and registerDirectChannel for more details.
775     */
776    DIRECT_CHANNEL_ASHMEM       = 0x400,
777
778    /**
779     * Set this flag if sensor suppor direct channel backed by gralloc HAL memory.
780     * See SharedMemType and registerDirectChannel for more details.
781     */
782    DIRECT_CHANNEL_GRALLOC      = 0x800,
783
784    /**
785     * Flags mask for reporting mode of sensor.
786     */
787    MASK_REPORTING_MODE         = 0xE,
788
789    /**
790     * Flags mask for direct report maximum rate level support.
791     * See RateLevel.
792     */
793    MASK_DIRECT_REPORT          = 0x380,
794
795    /**
796     * Flags mask for all direct channel support bits.
797     * See SharedMemType.
798     */
799    MASK_DIRECT_CHANNEL         = 0xC00,
800};
801
802@export(name="sensor_flag_shift_t", value_prefix="SENSOR_FLAG_SHIFT_")
803enum SensorFlagShift : uint8_t {
804    REPORTING_MODE              = 1,
805    DATA_INJECTION              = 4,
806    DYNAMIC_SENSOR              = 5,
807    ADDITIONAL_INFO             = 6,
808    DIRECT_REPORT               = 7,
809    DIRECT_CHANNEL              = 10,
810};
811
812struct SensorInfo {
813    /**
814     * handle that identifies this sensors. This handle is used to reference
815     * this sensor throughout the HAL API.
816     */
817    int32_t sensorHandle;
818
819    /**
820     * Name of this sensor.
821     * All sensors of the same "type" must have a different "name".
822     */
823    string name;
824
825    /** vendor of the hardware part */
826    string vendor;
827
828    /**
829     * version of the hardware part + driver. The value of this field
830     * must increase when the driver is updated in a way that changes the
831     * output of this sensor. This is important for fused sensors when the
832     * fusion algorithm is updated.
833     */
834    int32_t version;
835
836    /** this sensor's type. */
837    SensorType type;
838
839    /**
840     * type of this sensor as a string.
841     *
842     * When defining an OEM specific sensor or sensor manufacturer specific
843     * sensor, use your reserve domain name as a prefix.
844     * e.g. com.google.glass.onheaddetector
845     *
846     * For sensors of known type defined in SensorType (value <
847     * SensorType::DEVICE_PRIVATE_BASE), this can be an empty string.
848     */
849    string typeAsString;
850
851    /** maximum range of this sensor's value in SI units */
852    float maxRange;
853
854    /** smallest difference between two values reported by this sensor */
855    float resolution;
856
857    /** rough estimate of this sensor's power consumption in mA */
858    float power;
859
860    /**
861     * this value depends on the reporting mode:
862     *
863     *   continuous: minimum sample period allowed in microseconds
864     *   on-change : 0
865     *   one-shot  :-1
866     *   special   : 0, unless otherwise noted
867     */
868    int32_t minDelay;
869
870    /**
871     * number of events reserved for this sensor in the batch mode FIFO.
872     * If there is a dedicated FIFO for this sensor, then this is the
873     * size of this FIFO. If the FIFO is shared with other sensors,
874     * this is the size reserved for that sensor and it can be zero.
875     */
876    uint32_t fifoReservedEventCount;
877
878    /**
879     * maximum number of events of this sensor that could be batched.
880     * This is especially relevant when the FIFO is shared between
881     * several sensors; this value is then set to the size of that FIFO.
882     */
883    uint32_t fifoMaxEventCount;
884
885    /**
886     * permission required to see this sensor, register to it and receive data.
887     * Set to "" if no permission is required. Some sensor types like the
888     * heart rate monitor have a mandatory require_permission.
889     * For sensors that always require a specific permission, like the heart
890     * rate monitor, the android framework might overwrite this string
891     * automatically.
892     */
893    string requiredPermission;
894
895    /**
896     * This value is defined only for continuous mode and on-change sensors.
897     * It is the delay between two sensor events corresponding to the lowest
898     * frequency that this sensor supports. When lower frequencies are requested
899     * through batch()/setDelay() the events will be generated at this frequency
900     * instead.
901     * It can be used by the framework or applications to estimate when the
902     * batch FIFO may be full.
903     *
904     * NOTE: periodNs is in nanoseconds where as maxDelay/minDelay are in
905     *       microseconds.
906     *
907     *       continuous, on-change: maximum sampling period allowed in
908     *                              microseconds.
909     *
910     *          one-shot, special : 0
911     */
912    int32_t maxDelay;
913
914    /** Bitmask of SensorFlagBits */
915    bitfield<SensorFlagBits> flags;
916};
917
918@export(name="", value_prefix="SENSOR_STATUS_")
919enum SensorStatus : int8_t {
920    NO_CONTACT          = -1,
921    UNRELIABLE          = 0,
922    ACCURACY_LOW        = 1,
923    ACCURACY_MEDIUM     = 2,
924    ACCURACY_HIGH       = 3,
925};
926
927struct Vec3 {
928    float x;
929    float y;
930    float z;
931    SensorStatus status;
932};
933
934struct Vec4 {
935    float x;
936    float y;
937    float z;
938    float w;
939};
940
941struct Uncal {
942    float x;
943    float y;
944    float z;
945    float x_bias;
946    float y_bias;
947    float z_bias;
948};
949
950struct HeartRate {
951    /**
952     * Heart rate in beats per minute.
953     * Set to 0 when status is SensorStatus::UNRELIABLE or
954     * SensorStatus::NO_CONTACT
955     */
956    float bpm;
957
958    /** Status of the heart rate sensor for this reading. */
959    SensorStatus status;
960};
961
962@export(name="")
963enum MetaDataEventType : uint32_t {
964    META_DATA_FLUSH_COMPLETE = 1,
965};
966
967struct MetaData {
968    MetaDataEventType what;
969};
970
971struct DynamicSensorInfo {
972    bool connected;
973    int32_t sensorHandle;
974
975    /**
976     * UUID of a dynamic sensor (using RFC 4122 byte order)
977     * For UUID 12345678-90AB-CDEF-1122-334455667788 the uuid field is
978     * initialized as:
979     *   {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF, 0x11, ...}
980     */
981    uint8_t[16] uuid;
982};
983
984@export(name="additional_info_type_t")
985enum AdditionalInfoType : uint32_t {
986    /** Marks the beginning of additional information frames */
987    AINFO_BEGIN                       = 0,
988
989    /** Marks the end of additional information frames */
990    AINFO_END                         = 1,
991
992    /**
993     * Estimation of the delay that is not tracked by sensor timestamps. This
994     * includes delay introduced by sensor front-end filtering, data transport,
995     * etc.
996     * float[2]: delay in seconds, standard deviation of estimated value
997     */
998    AINFO_UNTRACKED_DELAY             = 0x10000,
999
1000    /** float: Celsius temperature */
1001    AINFO_INTERNAL_TEMPERATURE,
1002
1003    /**
1004     * First three rows of a homogeneous matrix, which represents calibration to
1005     * a three-element vector raw sensor reading.
1006     * float[12]: 3x4 matrix in row major order
1007     */
1008    AINFO_VEC3_CALIBRATION,
1009
1010    /**
1011     * Provides the orientation and location of the sensor element in terms of
1012     * the Android coordinate system. This data is given as a 3x4 matrix
1013     * consisting of a 3x3 rotation matrix (R) concatenated with a 3x1 location
1014     * vector (t). The rotation matrix provides the orientation of the Android
1015     * device coordinate frame relative to the local coordinate frame of the
1016     * sensor. Note that assuming the axes conventions of the sensor are the
1017     * same as Android, this is the inverse of the matrix applied to raw
1018     * samples read from the sensor to convert them into the Android
1019     * representation. The location vector represents the translation from the
1020     * origin of the Android sensor coordinate system to the geometric center
1021     * of the sensor, specified in millimeters (mm).
1022     *
1023     * float[12]: 3x4 matrix in row major order [R; t]
1024     *
1025     * Example:
1026     *     This raw buffer: {0, 1, 0, 0, -1, 0, 0, 10, 0, 0, 1, -2.5}
1027     *     Corresponds to this 3x4 matrix:
1028     *         0 1 0    0
1029     *        -1 0 0   10
1030     *         0 0 1 -2.5
1031     *     The sensor is oriented such that:
1032     *         - the device X axis corresponds to the sensor's local -Y axis
1033     *         - the device Y axis corresponds to the sensor's local X axis
1034     *         - the device Z axis and sensor's local Z axis are equivalent
1035     *     In other words, if viewing the origin of the Android coordinate
1036     *     system from the positive Z direction, the device coordinate frame is
1037     *     to be rotated 90 degrees counter-clockwise about the Z axis to align
1038     *     with the sensor's local coordinate frame. Equivalently, a vector in
1039     *     the Android coordinate frame may be multiplied with R to rotate it
1040     *     90 degrees clockwise (270 degrees counter-clockwise), yielding its
1041     *     representation in the sensor's coordinate frame.
1042     *     Relative to the origin of the Android coordinate system, the physical
1043     *     center of the sensor is located 10mm in the positive Y direction, and
1044     *     2.5mm in the negative Z direction.
1045     */
1046    AINFO_SENSOR_PLACEMENT,
1047
1048    /**
1049     * float[2]: raw sample period in seconds,
1050     *           standard deviation of sampling period
1051     */
1052    AINFO_SAMPLING,
1053
1054    // Sampling channel modeling information section
1055
1056    /**
1057     * int32_t: noise type
1058     * float[n]: parameters
1059     */
1060    AINFO_CHANNEL_NOISE               = 0x20000,
1061
1062    /**
1063     * float[3]: sample period, standard deviation of sample period,
1064     * quantization unit
1065     */
1066    AINFO_CHANNEL_SAMPLER,
1067
1068    /**
1069     * Represents a filter:
1070     *   \sum_j a_j y[n-j] == \sum_i b_i x[n-i]
1071     *
1072     * int32_t[3]: number of feedforward coeffients M,
1073     *             number of feedback coefficients N (for FIR filter, N = 1).
1074     *             bit mask that represents which element the filter is applied
1075     *             to. (bit 0==1 means this filter applies to vector element 0).
1076     * float[M+N]: filter coefficients (b0, b1, ..., b_{M-1}), then
1077     *             (a0, a1, ..., a_{N-1}), a0 is always 1.
1078     *
1079     * Multiple frames may be needed for higher number of taps.
1080     */
1081    AINFO_CHANNEL_FILTER,
1082
1083    /**
1084     * int32_t[2]: size in (row, column) ... 1st frame
1085     * float[n]: matrix element values in row major order.
1086     */
1087    AINFO_CHANNEL_LINEAR_TRANSFORM,
1088
1089    /**
1090     * int32_t[2]: extrapolate method, interpolate method
1091     * float[n]: mapping key points in pairs, (in, out)...
1092     *           (may be used to model saturation).
1093     */
1094    AINFO_CHANNEL_NONLINEAR_MAP,
1095
1096    /**
1097     * int32_t: resample method (0-th order, 1st order...)
1098     * float[1]: resample ratio (upsampling if < 1.0, downsampling if > 1.0).
1099     */
1100    AINFO_CHANNEL_RESAMPLER,
1101
1102    /**
1103     * Operation environment parameters section
1104     * Types in the following section is sent down (instead of reported from)
1105     * device as additional information to aid sensor operation. Data is sent
1106     * via injectSensorData() function to sensor handle -1 denoting all sensors
1107     * in device.
1108     */
1109
1110    /**
1111     * Local geomagnetic field information based on device geo location. This
1112     * type is primarily for for magnetic field calibration and rotation vector
1113     * sensor fusion.
1114     * float[3]: strength (uT), declination and inclination angle (rad).
1115     */
1116    AINFO_LOCAL_GEOMAGNETIC_FIELD     = 0x30000,
1117
1118    /**
1119     * Local gravitational acceleration strength at device geo location.
1120     * float: gravitational acceleration norm in m/s^2.
1121     */
1122    AINFO_LOCAL_GRAVITY,
1123
1124    /**
1125     * Device dock state.
1126     * int32_t: dock state following Android API Intent.EXTRA_DOCK_STATE
1127     * definition, undefined value is ignored.
1128     */
1129    AINFO_DOCK_STATE,
1130
1131    /**
1132     * High performance mode hint. Device is able to use up more power and take
1133     * more resources to improve throughput and latency in high performance mode.
1134     * One possible use case is virtual reality, when sensor latency need to be
1135     * carefully controlled.
1136     * int32_t: 1 or 0, denote if device is in/out of high performance mode,
1137     *          other values is ignored.
1138     */
1139    AINFO_HIGH_PERFORMANCE_MODE,
1140
1141    /**
1142     * Magnetic field calibration hint. Device is notified when manually
1143     * triggered magnetic field calibration procedure is started or stopped. The
1144     * calibration procedure is assumed timed out after 1 minute from start,
1145     * even if an explicit stop is not received.
1146     *
1147     * int32_t: 1 for start, 0 for stop, other value is ignored.
1148     */
1149    AINFO_MAGNETIC_FIELD_CALIBRATION,
1150
1151    /** Custom information */
1152    AINFO_CUSTOM_START                = 0x10000000,
1153
1154    /** Debugging */
1155    AINFO_DEBUGGING_START             = 0x40000000,
1156};
1157
1158struct AdditionalInfo {
1159    /** type of payload data, see AdditionalInfoType */
1160    AdditionalInfoType type;
1161
1162    /** sequence number of this frame for this type */
1163    int32_t serial;
1164
1165    union Payload {
1166        int32_t[14] data_int32;
1167        float[14] data_float;
1168    } u;
1169};
1170
1171/* acceleration values are in meter per second per second (m/s^2)
1172 * magnetic vector values are in micro-Tesla (uT)
1173 * orientation values are in degrees
1174 * gyroscope values are in rad/s
1175 * temperature is in degrees centigrade (Celsius)
1176 * distance in centimeters
1177 * light in SI lux units
1178 * pressure in hectopascal (hPa)
1179 * relative humidity in percent
1180 */
1181union EventPayload {
1182    /**
1183     * SensorType::ACCELEROMETER, SensorType::MAGNETIC_FIELD,
1184     * SensorType::ORIENTATION, SensorType::GYROSCOPE, SensorType::GRAVITY,
1185     * SensorType::LINEAR_ACCELERATION
1186     */
1187    Vec3 vec3;
1188
1189    /**
1190     * SensorType::GAME_ROTATION_VECTOR
1191     */
1192    Vec4 vec4;
1193
1194    /**
1195     * SensorType::MAGNETIC_FIELD_UNCALIBRATED,
1196     * SensorType::GYROSCOPE_UNCALIBRATED
1197     * SensorType::ACCELEROMETER_UNCALIBRATED
1198     */
1199    Uncal uncal;
1200
1201    /** SensorType::META_DATA */
1202    MetaData meta;
1203
1204    /**
1205     * SensorType::DEVICE_ORIENTATION, SensorType::LIGHT, SensorType::PRESSURE,
1206     * SensorType::TEMPERATURE, SensorType::PROXIMITY,
1207     * SensorType::RELATIVE_HUMIDITY, SensorType::AMBIENT_TEMPERATURE,
1208     * SensorType::SIGNIFICANT_MOTION, SensorType::STEP_DETECTOR,
1209     * SensorType::TILT_DETECTOR, SensorType::WAKE_GESTURE,
1210     * SensorType::GLANCE_GESTURE, SensorType::PICK_UP_GESTURE,
1211     * SensorType::WRIST_TILT_GESTURE, SensorType::STATIONARY_DETECT,
1212     * SensorType::MOTION_DETECT, SensorType::HEART_BEAT,
1213     * SensorType::LOW_LATENCY_OFFBODY_DETECT
1214     */
1215    float scalar;
1216
1217    /** SensorType::STEP_COUNTER */
1218    uint64_t stepCount;
1219
1220    /** SensorType::HEART_RATE */
1221    HeartRate heartRate;
1222
1223    /** SensorType::POSE_6DOF */
1224    float[15] pose6DOF;
1225
1226    /** SensorType::DYNAMIC_SENSOR_META */
1227    DynamicSensorInfo dynamic;
1228
1229    /** SensorType::ADDITIONAL_INFO */
1230    AdditionalInfo additional;
1231
1232    /**
1233     * The following sensors should use the data field:
1234     * - Undefined/custom sensor type >= SensorType::DEVICE_PRIVATE_BASE
1235     * - SensorType::ROTATION_VECTOR, SensorType::GEOMAGNETIC_ROTATION_VECTOR:
1236     *   - These are Vec4 types with an additional float accuracy field,
1237     *     where data[4] is the estimated heading accuracy in radians
1238     *     (-1 if unavailable, and invalid if not in the range (0, 2 * pi]).
1239     */
1240    float[16] data;
1241};
1242
1243struct Event {
1244    /** Time measured in nanoseconds, in "elapsedRealtimeNano()'s" timebase. */
1245    int64_t timestamp;
1246
1247    /** sensor identifier */
1248    int32_t sensorHandle;
1249
1250    SensorType sensorType;
1251
1252    /** Union discriminated on sensorType */
1253    EventPayload u;
1254};
1255
1256/**
1257 * Direct report rate level definition. Except for SENSOR_DIRECT_RATE_STOP, each
1258 * rate level covers the range (55%, 220%] * nominal report rate. For example,
1259 * if config direct report specify a rate level SENSOR_DIRECT_RATE_FAST, it is
1260 * legal for sensor hardware to report event at a rate greater than 110Hz, and
1261 * less or equal to 440Hz. Note that rate has to remain steady without variation
1262 * before new rate level is configured, i.e. if a sensor is configured to
1263 * SENSOR_DIRECT_RATE_FAST and starts to report event at 256Hz, it cannot
1264 * change rate to 128Hz after a few seconds of running even if 128Hz is also in
1265 * the legal range of SENSOR_DIRECT_RATE_FAST. Thus, it is recommended to
1266 * associate report rate with RateLvel statically for single sensor.
1267 */
1268@export(name="direct_rate_level_t", value_prefix="SENSOR_DIRECT_RATE_")
1269enum RateLevel : int32_t {
1270    STOP,            // stop
1271    NORMAL,          // nominal 50Hz
1272    FAST,            // nominal 200Hz
1273    VERY_FAST,       // nominal 800Hz
1274};
1275
1276/**
1277 * Direct channel shared memory types. See struct SharedMemInfo.
1278 */
1279@export(name="direct_mem_type_t", value_prefix="SENSOR_DIRECT_MEM_TYPE_")
1280enum SharedMemType : int32_t {
1281    // handle contains 1 fd (ashmem handle) and 0 int.
1282    ASHMEM = 1,
1283    // handle definition matches gralloc HAL.
1284    GRALLOC
1285};
1286
1287
1288/**
1289 * Direct channel lock-free queue format, this defines how the shared memory is
1290 * interpreted by both sensor hardware and application.
1291 *
1292 * @see SharedMemInfo.
1293 */
1294@export(name="direct_format_t", value_prefix="SENSOR_DIRECT_FMT_")
1295enum SharedMemFormat : int32_t {
1296    SENSORS_EVENT = 1,  // shared memory is formated as an array of data
1297                        // elements. See SensorsEventFormatOffset for details.
1298                        // Upon return of channel registration call, the
1299                        // shared memory space must be formated to all 0 by HAL.
1300};
1301
1302enum SensorsEventFormatOffset : uint16_t {
1303    // offset   type        name
1304    //-----------------------------------
1305    // 0x0000   int32_t     size (always 104)
1306    // 0x0004   int32_t     sensor report token
1307    // 0x0008   int32_t     type (see SensorType)
1308    // 0x000C   uint32_t    atomic counter
1309    // 0x0010   int64_t     timestamp (see Event)
1310    // 0x0018   float[16]/  data
1311    //          int64_t[8]
1312    // 0x0058   int32_t[4]  reserved (set to zero)
1313    SIZE_FIELD      = 0x0,
1314    REPORT_TOKEN    = 0x4,
1315    SENSOR_TYPE     = 0x8,
1316    ATOMIC_COUNTER  = 0xC,
1317    TIMESTAMP       = 0x10,
1318    DATA            = 0x18,
1319    RESERVED        = 0x58,
1320    TOTAL_LENGTH    = 0x68
1321};
1322
1323/**
1324 * Shared memory information for a direct channel
1325 */
1326struct SharedMemInfo {
1327    SharedMemType type;         // shared memory type
1328    SharedMemFormat format;
1329    uint32_t size;              // size of the memory region, in bytes
1330    handle memoryHandle;        // shared memory handle, it is interpreted
1331                                // depending on type field, see SharedMemType.
1332};
1333