# Algorithms

## Absolute Motion Detector (AMD)

AMD determines motion and stationary states. Motion detectors that derive from amd.proto must define their own SNS\_STD\_SENSOR\_ATTRID\_TYPE

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “amd”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_amd.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- SNS\_AMD\_MSGID\_SNS\_AMD\_EVENT: The [sns\_amd\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__amd__event) message is used to publish updated state
- AMD does not publish configuration events.

Enums

- enum sns\_amd\_msgid

    - Message IDs for AMD Sensor.

*Values:*

- enumerator SNS\_AMD\_MSGID\_SNS\_AMD\_EVENT

    -

- enum sns\_amd\_event\_type

    - States generated by AMD and derived sensors as its output.

*Values:*

- enumerator SNS\_AMD\_EVENT\_TYPE\_UNKNOWN

    - 

- enumerator SNS\_AMD\_EVENT\_TYPE\_STATIONARY

    - 

- enumerator SNS\_AMD\_EVENT\_TYPE\_MOTION

    -

- struct sns\_amd\_event

    - Public Members

- required sns\_amd\_event\_type state [default=SNS\_AMD\_EVENT\_TYPE\_UNKNOWN]

    - AMD motion state.

## Accelerometer calibration

The Accel Calibration Sensor determines the calibration parameters for accel sensor.

*Attributes Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “accel\_cal”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_accel\_cal.proto”
4. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type

    - The rigid body of accel whose cal is being measured

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG message ID is used to enable the sensor
- SNS\_CAL\_MSGID\_SNS\_CAL\_RESET message ID is used to reset the algorithm and any previously determined calibration parameters.

*Publishing Stream Events:*

- SNS\_CAL\_MSGID\_SNS\_CAL\_EVENT message ID is used to report calibration parameters to the client of the sensor. The [sns\_cal\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__cal__event) message as defined in sns\_cal.proto is used to report this data event where the units for the bias field in the message are in m / s ^2

## Activity recognition

Activity Recognition sensor determines user activity states.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “activity\_recognition”.
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE.
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_activity\_recognition.proto”.
4. SNS\_STD\_SENSOR\_ATTRID\_TECH\_USED: List of technologies used.

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor.
- Client shall pass list of permitted technologies in the request payload.
- Refer “sns\_std\_request :: permissions” in sns\_std.proto.

*Publishing Stream Events:*

- SNS\_ACTIVITY\_RECOGNITION\_MSGID\_SNS\_AR\_CONFIG\_EVENT: The configuration event is generated at least once in response to enable request.
- SNS\_ACTIVITY\_RECOGNITION\_MSGID\_SNS\_AR\_EVENT: The [sns\_ar\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__ar__event) message is used to publish updated state. A new event will be generated upon any state change.

Enums

- enum sns\_activity\_recognition\_msgid

    - Message IDs for Activity Recognition Sensor.

*Values:*

- enumerator SNS\_ACTIVITY\_RECOGNITION\_MSGID\_SNS\_AR\_EVENT

    - 

- enumerator SNS\_ACTIVITY\_RECOGNITION\_MSGID\_SNS\_AR\_CONFIG\_EVENT

    -

- enum sns\_ar\_motion\_state

    - User activity states.

*Values:*

- enumerator SNS\_AR\_UNKNOWN

    - Unknown is reported when the algorithm is unable to detect the current activity state.

- enumerator SNS\_AR\_STATIONARY

    - User is relatively stationary.

- enumerator SNS\_AR\_PED

    - User is classified as a pedestrian.

- enumerator SNS\_AR\_NMV

    - User is in a non-motorized vehicle.

- enumerator SNS\_AR\_MV

    - User is in a motorized vehicle.

- enumerator SNS\_AR\_WALK

    - User is walking.

- enumerator SNS\_AR\_RUN

    - User is running.

- enumerator SNS\_AR\_BICYCLE

    - User is on a bicycle.

- enumerator SNS\_AR\_CAR

    - User is in a car.

- enumerator SNS\_AR\_AIRPLANE

    - User is in an airplane.

- struct sns\_ar\_config\_event

    - Public Members

- repeated sns\_ar\_motion\_state states

    - List of supported motion states.

- struct sns\_ar\_event

    - Public Members

- repeated sns\_ar\_motion\_state states [4]

    - List of active states for this user. Multiple states may be reported concurrently. Any states not listed here are presumed to be inactive.

## Calibration

This file defined Standard message IDs supported by Physical Sensors as well as Dynamic Calibration Sensors such as “gyro\_cal”, “mag\_cal”.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE

*Processing Stream Requests:*

1. SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- The [sns\_cal\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__cal__event) message is used to publish the correction For Dynamic Calibration sensors the correction can be applied as follows :

    Convention :

    - Sc = Calibrated sensor sample
    - S = Sensor sample (Nx1 vector)
    - SF = Scaling factor to be applied to S
    - CM = compensation\_matrix
    - B = bias
    - ”\*” represents matrix multiplication
    - ”.\*” represents element-by-element multiplication

    if SF, B and CM are available,

Sc = CM * ((S .* SF) - B)
        Copy to clipboard

 if only B and CM are available, 
Sc = CM * (S - B)
        Copy to clipboard

 if only SF and B are available, 
Sc = ((S .* SF) - B)
        Copy to clipboard

 if only SF is available, 
Sc = S .* SF
        Copy to clipboard

 if only B is available, 
Sc = (S - B)
        Copy to clipboard

 if only CM is available 
Sc = CM * S
        Copy to clipboard

Enums

- enum sns\_cal\_msgid

    - Calibration Message IDs.

*Values:*

- enumerator SNS\_CAL\_MSGID\_SNS\_CAL\_RESET

    - Request to reset calibration parameters for a Sensor. Message: None.

- enumerator SNS\_CAL\_MSGID\_SNS\_CAL\_EVENT

    - Calibration Event.

Physical Sensors generate [sns\_cal\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__cal__event) to convey the factory calibration being applied. Dynamic Calibration Sensors generate this event to convey runtime estimated calibration parameters. Message: [sns\_cal\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__cal__event)

- struct sns\_cal\_event

    - A client receiving an [sns\_cal\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__cal__event) from a Dynamic Calibration Sensor can use it to correct sensor data received from the corresponding Physical Sensor.

Public Members

- repeated float bias

    - Bias (B) in units of the Sensor.

Nx1 zero bias vector where N is the number of axes of the Sensor. Bias is subtracted from the Sensor samples to get Calibrated samples.

- repeated float scale\_factor

    - Scaling Factor (SF)

Nx1 scale factor vector where N is the number of axes of the Sensor. Scaling Factor is applied before subtracting bias to get Calibrated samples.

- repeated float comp\_matrix

    - Compensation Matrix (CM)

NxN compensation matrix, where N is the number of axes of the Sensor, and represented in row-major order.

CM =  CM0  CM1  CM2
          CM3  CM4  CM5
          CM6  CM7  CM8
    Copy to clipboard

- required sns\_std\_sensor\_sample\_status status [default=SNS\_STD\_SENSOR\_SAMPLE\_STATUS\_UNRELIABLE]

    - Quality of the calibration.

- optional fixed32 cal\_id

    - Calibration ID, a unique identifier for the calibration set being used.

As an example, could be used when there are distinct calibration sets for a flip phone being open or closed.

## Delta Angle

Delta Angle calculates the angle from an anchor position. When the angle changes by more than the specified threshold, an event is sent and the anchor is reset. Internal sample rate of the Delta Angle sensor is pre-configured in the registry.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “delta\_angle”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_delta\_angle.proto”

*Processing Stream Requests:*

- SNS\_DELTA\_ANGLE\_MSGID\_SNS\_DELTA\_ANGLE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- SNS\_DELTA\_ANGLE\_MSGID\_SNS\_DELTA\_ANGLE\_EVENT is used to publish delta angle event

Enums

- enum sns\_delta\_angle\_msgid

    - Message IDs for Delta Angle Sensor.

*Values:*

- enumerator SNS\_DELTA\_ANGLE\_MSGID\_SNS\_DELTA\_ANGLE\_CONFIG

    - 

- enumerator SNS\_DELTA\_ANGLE\_MSGID\_SNS\_DELTA\_ANGLE\_EVENT

    -

- enum sns\_delta\_angle\_ori\_type

    - The orientation type defines which orientation of rotation the client is interested in.

*Values:*

- enumerator SNS\_DELTA\_ANGLE\_ORIENTATION\_PITCH

    - 

- enumerator SNS\_DELTA\_ANGLE\_ORIENTATION\_ROLL

    - 

- enumerator SNS\_DELTA\_ANGLE\_ORIENTATION\_HEADING

    - 

- enumerator SNS\_DELTA\_ANGLE\_ORIENTATION\_TOTAL

    -

- struct sns\_delta\_angle\_quat\_history

    - Public Members

- required uint64 quat\_ts

    - Timestamp of the historical quaternion.

- repeated float quat [4]

    - An array of x/y/z/w.

- struct sns\_delta\_angle\_config

    - Public Members

- required sns\_delta\_angle\_ori\_type ori\_type

    - The orientation type defines which orientation of rotation the client is interested in.

- required float radians

    - Absolute angle threshold for reporting events.

- required uint32 latency\_us

    - Will be used as batch\_period in request to underlying physical sensor requests. Note that it will not change the underlying sampling rate of the physical sensors.

- optional bool quat\_output\_enable

    - Optionally enable reporting the quaternion which caused the angle threshold to be met.

- optional bool quat\_history\_enable

    - Optionally enable reporting two historical quaternions from prior to the angle threshold being met.

- struct sns\_delta\_angle\_event

    - Public Members

- repeated float quat [4]

    - Quaternion output. Optionally enabled by the “quat\_output\_enable” field in the request An array of x/y/z/w.

- repeated sns\_delta\_angle\_quat\_history history [2]

    - The output event can optionally contain 2 historical quaternions from prior to the angle change being satisfied. This can be used (for example) to compute the device trajectory at the time the angle threshold is reached. Optionally enabled by the “quat\_history\_enable” field in the request.

- repeated float init\_quat [4]

    - Initial quaternion. Only updated when it changes.

## Device Mode

Clients can use this API to be notified of changes to the supported device modes.

*Attribute Requirements:*

*The Device Mode Sensor publishes:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “device\_mode”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_device\_mode.proto”
4. See sns\_std\_sensor.proto for other attributes.
5. Change SNS\_STD\_SENSOR\_ATTRID\_VENDOR to OEM, if OEM specific device mode(s) added

*Processing Stream Requests:*

1. The Device Mode sensor uses the SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG to enable the sensor.

*Publishing Stream Events:*

1. When one of the supported mode types change, the Device Mode Sensor publishes a [sns\_device\_mode\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__mode__event) with message ID SNS\_DEVICE\_MODE\_MSGID\_SNS\_DEVICE\_MODE\_EVENT containing the changed modes.
2. When a new client request is received, the [sns\_device\_mode\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__mode__event) is published with the full list of currently known modes.
3. The timestamp of the [sns\_device\_mode\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__mode__event) corresponds to when the Sensor sends the event.

Enums

- enum sns\_device\_mode\_msgid

    - Message IDs for DEVICE\_MODE Sensor.

*Values:*

- enumerator SNS\_DEVICE\_MODE\_MSGID\_SNS\_DEVICE\_MODE\_EVENT

    -

- enum sns\_device\_mode

    - The Detected Device Mode.

*Values:*

- enumerator SNS\_DEVICE\_MODE\_UNKNOWN

    - 

- enumerator SNS\_DEVICE\_MODE\_FLIP\_OPEN

    - 

- enumerator SNS\_DEVICE\_MODE\_LOCATION

    - 

- enumerator SNS\_DEVICE\_MODE\_AIRPLANE\_MODE

    - 

- enumerator SNS\_DEVICE\_MODE\_MICROPHONE

    - 

- enumerator SNS\_DEVICE\_MODE\_WIFI\_CONNECTIVITY

    - 

- enumerator SNS\_DEVICE\_MODE\_WIFI\_SCAN

    - 

- enumerator SNS\_DEVICE\_MODE\_BLUETOOTH\_CONNECTIVITY

    - 

- enumerator SNS\_DEVICE\_MODE\_BLUETOOTH\_SCAN

    - 

- enumerator SNS\_DEVICE\_MODE\_MAX

    - Qualcomm specific ENUMs expansion shall grow in ascending order i.e., from onwards of 9.

unspecified device mode entries are available for customer specific use-cases. Guidance: Customer specific ENUMs expansion shall grow downwards starting from 62. customer to include sensor/vendor names to a OEM specific ENUM string for easy identification by intended clients. Example: SNS\_DEVICE\_MODE\_OEM\_HOTSPOT = 62,

- enum sns\_device\_state

    - Device Mode State ID.

*Values:*

- enumerator SNS\_DEVICE\_STATE\_INACTIVE

    - 

- enumerator SNS\_DEVICE\_STATE\_ACTIVE

    - 

- enumerator SNS\_DEVICE\_STATE\_UNKNOWN

    -

- struct sns\_device\_mode\_event

    - - struct mode\_spec

    - Public Members

- required sns\_device\_mode mode

    - 

- required sns\_device\_state state

    -

Public Members

- repeated mode\_spec device\_mode

    - Device Mode.

## Device Orient

The device orientation sensor reports the current orientation of the device. It is typically used for Portrait/Landscape determination by the User Interface. Minor or transient rotations should not cause a new event to be reported, and this sensor should only be implemented with the help of an accelerometer. Moving the device to an orientation where the Z axis is vertical (either up or down) should not cause a new event to be reported.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “device\_orient”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_device\_orient.proto”

*Processing Stream Requests: SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG*

No configuration is available for this sensor.

*Publishing Stream Events: SNS\_DEVICE\_ORIENT\_MSGID\_SNS\_DEVICE\_ORIENT\_EVENT*

Enums

- enum sns\_device\_orient\_msgid

    - Message IDs for Device Orientation Sensor.

*Values:*

- enumerator SNS\_DEVICE\_ORIENT\_MSGID\_SNS\_DEVICE\_ORIENT\_EVENT

    -

- enum sns\_device\_orient\_event\_type

    - Event Types for Device Orient Sensor.

*Values:*

- enumerator SNS\_DEVICE\_ORIENT\_EVENT\_TYPE\_UNKNOWN

    - Device is in unknown orientation.

- enumerator SNS\_DEVICE\_ORIENT\_EVENT\_TYPE\_DEFAULT

    - Device is in default orientation (Y axis is vertical and points up)

- enumerator SNS\_DEVICE\_ORIENT\_EVENT\_TYPE\_POS\_1

    - Device is rotated 90 degrees counter-clockwise from default orientation (X axis is vertical and points up)

- enumerator SNS\_DEVICE\_ORIENT\_EVENT\_TYPE\_POS\_2

    - Device is rotated 180 degrees from default orientation (Y axis is vertical and points down)

- enumerator SNS\_DEVICE\_ORIENT\_EVENT\_TYPE\_POS\_3

    - Device is rotated 90 degrees clockwise from default orientation (X axis is vertical and points down)

- struct sns\_device\_orient\_event

    - Public Members

- required sns\_device\_orient\_event\_type state

    - Detected state.

## Device Position Classifier

The DPC Sensor provides device position information.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “device\_position\_classifier”.
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE.
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_dpc.proto”.

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor.

*Publishing Stream Events:*

- SNS\_DPC\_MSGID\_SNS\_DPC\_EVENT\_CONFIG: The configuration event is sent immediately to new client to inform the current device position.
- SNS\_DPC\_MSGID\_SNS\_DPC\_EVENT: A new event will be generated upon device position change.

Enums

- enum sns\_dpc\_msgid

    - Message IDs for DPC Sensor.

*Values:*

- enumerator SNS\_DPC\_MSGID\_SNS\_DPC\_EVENT\_CONFIG

    - 

- enumerator SNS\_DPC\_MSGID\_SNS\_DPC\_EVENT

    -

- enum sns\_dpc\_state

    - Device position states.

*Values:*

- enumerator SNS\_DPC\_UNINITIALIZED

    - 

- enumerator SNS\_DPC\_UNKNOWN

    - when algo cannot identify other states.

- enumerator SNS\_DPC\_FLAT\_STATIC

    - User keeps the device steady with display at an angle within +/-15 deg with respect to the horizontal plane.

- enumerator SNS\_DPC\_HIDDEN

    - Device is not in FLAT\_STATIC state and proximity sensor detects NEAR.

- enumerator SNS\_DPC\_IN\_HAND

    - User picks up the device.

- enumerator SNS\_DPC\_FACING

    - User keeps the device steady with display at an angle greater than +/-15 deg with respect to the horizontal plane.

- struct sns\_dpc\_event

    - Public Members

- required sns\_dpc\_state dpc\_state

    - current dpc state

- struct sns\_dpc\_event\_config

    - Public Members

- required sns\_dpc\_state dpc\_state

    - current dpc state

## Device context

Sensors may derive from this API. Sensor developers may choose to define Sensor-specific messages for any new/Sensor-specific functionality.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE

Enums

- enum sns\_device\_context\_msgid

    - Standard message IDs supported by Device Context Sensors. Note that Sensors may support additional message IDs as defined in their respective proto files.

*Values:*

- enumerator SNS\_DEVICE\_CONTEXT\_MSGID\_SNS\_DEVICE\_CONTEXT\_EVENT

    - A standard Device Context event with Device Context data. Note: Sensors may choose to implement their own data event message(s). Message: [sns\_device\_context\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__context__event).

- enum sns\_device\_context\_type

    - States generated by Device Context Sensors as their output.

*Values:*

- enumerator SNS\_DEVICE\_CONTEXT\_UNKNOWN

    - Device Context is “Unknown”.

- enumerator SNS\_DEVICE\_CONTEXT\_NOT\_DETECTED

    - Device Context is “Not Detected”.

- enumerator SNS\_DEVICE\_CONTEXT\_DETECTED

    - Device Context is “Detected”.

- struct sns\_device\_context\_data

    - Public Members

- optional fixed32 msg\_id

    - Message ID of the Device context data.

- optional bytes payload

    - Payload of the Device context data.

- struct sns\_device\_context\_event

    - Public Members

- optional sns\_device\_context\_type state

    - Detected event type ID.

- optional sns\_device\_context\_data data

    - Device context data.

## Filtered Magnetic Vector

FMV sensor reports the filtered magnetic vector *Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “fmv”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE as SNS\_STD\_SENSOR\_STREAM\_TYPE\_STREAMING.
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_fmv.proto”

*Processing Stream Requests:*

sns\_std\_sensor\_config::sample\_rate is used to specify the sampling rate (Hz) of the FMV sensor. Sensor will generate data events at this rate.

*Publishing Stream Events:*

1. Output of the FMV sensor will be populated in sns\_std\_sensor\_event
2. Each stream event contains three output data fields in µT (micro Tesla)
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
4. Data in the stream event is ordered as:

data[0] = X-axis
        data[1] = Y-axis
        data[2] = Z-axis
        Copy to clipboard
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. sns\_std\_sensor\_event::status specifies the reliability of the sample value, where value is of type sns\_std\_sensor\_sample\_status.

## Freefall Detect

The sensor determines if the device is Falling for Not Falling. Not in freefall shall include all scenarios when in freefall is not detected.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “freefall\_detect”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_freefall\_detect.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable this sensor.

*Publishing Stream Events:*

- SNS\_DEVICE\_CONTEXT\_MSGID\_SNS\_DEVICE\_CONTEXT\_EVENT:

    - The [sns\_device\_context\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__context__event) message is used to publish device context.
    - Sensors may choose to publish an additional [sns\_freefall\_detect\_data](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__freefall__detect__data) message to include information such as fall distance/duration.
    - The freefall duration may be computed by looking at the timestamp delta between the “Detected” & “Not Detected” events.

Enums

- enum sns\_freefall\_detect\_msgid

    - The message IDs supported by the freefall\_detect sensor.

*Values:*

- enumerator SNS\_FREEFALL\_DETECT\_MSGID\_SNS\_FREEFALL\_DETECT\_DATA

    - The message ID of the freefall detect data message note: Refer [sns\_device\_context\_data](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__context__data) message in the sns\_device\_context.proto Message: [sns\_freefall\_detect\_data](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__freefall__detect__data).

- struct sns\_freefall\_detect\_data

    - Public Members

- reserved to

    - Reserved fields for Qualcomm.

## Game Rotation Vector

A GameRV sensor reports the orientation of the device relative to an unspecified coordinate frame. This is typically implemented using accelerometer and gyroscope input (and without magnetometer).

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “game\_rv”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE as SNS\_STD\_SENSOR\_STREAM\_TYPE\_STREAMING.
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_game\_rv.proto”

*Processing Stream Requests:*

sns\_std\_sensor\_config::sample\_rate is used to specify the sampling rate (Hz) of the GameRV sensor. Sensor will generate data events at this rate.

*Publishing Stream Events:*

Output of the GameRV sensor will be populated in sns\_std\_sensor\_event

The orientation is represented by the rotation necessary to align the coordinate frame with the device’s coordinates. That is, applying the rotation to the world frame (X,Y,Z) would align them with the device coordinates (x,y,z).

The rotation can be seen as rotating the device by an angle theta around an axis rot\_axis to go from the reference device orientation to the current device orientation. The rotation is encoded as the four unitless x, y, z, w components of a unit quaternion:

sns_std_sensor_event::data[0] = rot_axis.x*sin(theta/2)
    sns_std_sensor_event::data[1] = rot_axis.y*sin(theta/2)
    sns_std_sensor_event::data[2] = rot_axis.z*sin(theta/2)
    sns_std_sensor_event::data[3] = cos(theta/2)
    Copy to clipboard

Where:

- the x, y and z fields of rot\_axis are the East-North-Up coordinates of a unit length vector representing the rotation axis
- theta is the rotation angle

sns\_std\_sensor\_event::status specifies the reliability of the sample value value is of type sns\_std\_sensor\_sample\_status. see sns\_std\_sensor.proto for details.

## Geomagnetic Rotation Vector

This Sensor is similar to Rotation Vector, but uses a magnetometer instead of a gyroscope. The GeoMagRV sensor reports the orientation of the device relative to the East-North-Up coordinates frame. It is obtained by integration of accelerometer and magnetometer readings.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “geomag\_rv”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE as SNS\_STD\_SENSOR\_STREAM\_TYPE\_STREAMING.
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_geomag\_rv.proto”

*Processing Stream Requests:*

sns\_std\_sensor\_config::sample\_rate is used to specify the sampling rate (Hz) of the GeoMagRV sensor. Sensor will generate data events at this rate.

*Publishing Stream Events:*

Output of the GeoMagRV sensor will be populated in sns\_std\_sensor\_event

The East-North-Up coordinate system is defined as a direct orthonormal basis where:

- X points east and is tangential to the ground.
- Y points north and is tangential to the ground.
- Z points towards the sky and is perpendicular to the ground.

The rotation can be seen as rotating the device by an angle theta around an axis rot\_axis to go from the reference device orientation to the current device orientation. The rotation is encoded as the four unitless x, y, z, w components of a unit quaternion:

sns_std_sensor_event::data[0] = rot_axis.x*sin(theta/2)
    sns_std_sensor_event::data[1] = rot_axis.y*sin(theta/2)
    sns_std_sensor_event::data[2] = rot_axis.z*sin(theta/2)
    sns_std_sensor_event::data[3] = cos(theta/2)
    Copy to clipboard

Where:

- The x, y and z fields of rot\_axis are the East-North-Up coordinates of a unit length vector representing the rotation axis
- theta is the rotation angle

sns\_std\_sensor\_event::status specifies the reliability of the sample value value is of type sns\_std\_sensor\_sample\_status. see sns\_std\_sensor.proto for details.

## Gravity

The Gravity Sensor provides the gravity vector *Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “gravity”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE as SNS\_STD\_SENSOR\_STREAM\_TYPE\_STREAMING.
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_gravity.proto”

*Processing Stream Requests:*

Used to either request for a certain configuration of the gravity sensor or alter an already existing configuration of the gravity sensor Uses sns\_std\_sensor\_config defined in sns\_std\_sensor.proto The message field definitions are as follows:

1. float sample\_rate containing the required sample rate of the gravity sensor in hertz

*Publishing Stream Events:*

Data event generated by the gravity. Uses sns\_std\_sensor\_event message defined in sns\_std\_sensor.proto The data field of the sns\_std\_sensor\_event message contains a float array of length 6 with the following definition

1. float data[0] to data[2] Representing the gravity values along x,y,z axes in m/s2. It is a 3D vector of length 1g.
2. float data[3] to data[5] Representing the linear acceleration values along x,y,z axes in m/s2. Determined as the delta between the accel and the gravity values along that axis.

## Gyroscope Calibration

The Gyro Calibration Sensor determines the calibration parameters for gyro sensor.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “gyro\_cal”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_gyro\_cal.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG message ID is used to enable the sensor
- SNS\_CAL\_MSGID\_SNS\_CAL\_RESET message ID is used to reset the algorithm and any previously determined calibration parameters.

*Publishing Stream Events:*

- SNS\_CAL\_MSGID\_SNS\_CAL\_EVENT message ID is used to report calibration parameters to the client of the sensor. The [sns\_cal\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__cal__event) message as defined in sns\_cal.proto is used to report this data event where the units for the bias field in the message are in rad / s

## Gyroscope Rotation Matrix

The GRM Sensor provides the gyro rotation vector *Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “gyro\_rot\_matrix”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE as SNS\_STD\_SENSOR\_STREAM\_TYPE\_STREAMING.
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_gyro\_rot\_matrix.proto”

*Processing Stream Requests:*

Used to either request for a certain configuration of the Gyro Rotation Matrix Sensor or alter an already existing configuration of the Simulation Sensor Uses sns\_std\_sensor\_config defined in sns\_std\_sensor.proto The message field definitions are as follows:

- float sample\_rate : containing the required sample rate of the Gyro Rotation Matrix sensor in hertz

*Publishing Stream Events:*

Data event generated by the gyro rotation matrix. Uses sns\_std\_sensor\_event message defined in sns\_std\_sensor.proto The data field of the sns\_std\_sensor\_event message contains a float array of length 10 with the following definition

1. float data[0] to data[8]:

    - 3 by 3 Gyro Rotation Matrix output Representing the rotation from previously sampled gyro values to the current one.
    - The matrix definition is as follows:

        `curr_gyro_XYZ[3X1] = gyro_rot_matrix[3X3] * prev_gyro_XYZ[3X1]`

data[0] = gyro_rot_matrix[0,0]
            data[1] = gyro_rot_matrix[0,1]
            data[2] = gyro_rot_matrix[0,2]
            data[3] = gyro_rot_matrix[1,0]
            data[4] = gyro_rot_matrix[1,1]
            data[5] = gyro_rot_matrix[1,2]
            data[6] = gyro_rot_matrix[2,0]
            data[7] = gyro_rot_matrix[2,1]
            data[8] = gyro_rot_matrix[2,2]
            Copy to clipboard
2. float data[9]: Gyro Norm of the currently sampled gyro data determined as the sum of squares of gyro on each of the axes data[9] = curr\_gyro\_X^2 + curr\_gyro\_Y^2 + curr\_gyro\_Z^2

Enums

- enum sns\_gyro\_rot\_matrix\_msgid

    - Message IDs for GRM Sensor.

*Values:*

- enumerator SNS\_GYRO\_ROT\_MATRIX\_MSGID\_SNS\_STD\_SENSOR\_EVENT

    -

## Hinge Angle

The Hinge Angle Sensor detects the angle between two rigid bodies connected by a hinge around which rotation can occur.

The reference position for Hinge Angle measurement constitutes the two rigid bodies being parallel to the ground, with surfaces in contact with each other and hinge connecting the left edges of the two rigid bodies. The rigid body that is located below is defined to be the primary rigid body. The rigid body which is located above is defined to be the secondary rigid body.

*Attribute Requirements:*

Hingle Angle Sensor must support the following attributes

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “hinge\_angle”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_RESOLUTIONS: the smallest hinge angle in degrees that can be detected by the sensor
4. SNS\_STD\_SENSOR\_ATTRID\_RANGES: the range of angles detected by the sensor, for example [0,360]
5. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_hinge\_angle.proto”

*Processing Stream Requests:*

A request message with message id SNS\_HINGE\_ANGLE\_MSGID\_SNS\_HINGE\_ANGLE\_CONFIG and payload [sns\_hinge\_angle\_config](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__hinge__angle__config) is used to enable the Hinge Angle Sensor

*Publishing Stream Events:*

Hinge Angle sensor generates an event with message id SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_SENSOR\_EVENT and payload sns\_std\_sensor\_event when hinge angle change is detected The Hinge Angle Sensor detects the angle going from the primary rigid body to the secondary rigid body, measured counter clockwise around the hinge. The maximum range of reported angles will be from 0 degrees to 360 degrees.

A Hinge Angle of 0 degrees is reported when the two rigid bodies have the same surfaces, as described in the reference position, in contact with each other.

A Hinge Angle of 360 degrees is reported when the two rigid bodies have the opposite surfaces, to those described in the reference position, in contact with each other.

A Hinge Angle of 180 degrees is reported when the two rigid bodies are coplanar.

Uses sns\_std\_sensor\_event message defined in sns\_std\_sensor.proto The data field of the sns\_std\_sensor\_event message contains a single floating point value representing the detected hinge angle in degrees. The status field of the sns\_std\_sensor\_event message indicates the accuracy of the detected hinge angle

Enums

- enum sns\_hinge\_angle\_msgid

    - Message IDs for HINGE\_ANGLE Sensor.

*Values:*

- enumerator SNS\_HINGE\_ANGLE\_MSGID\_SNS\_HINGE\_ANGLE\_CONFIG

    -

- struct sns\_hinge\_angle\_config

    - Public Members

- repeated int32 rigid\_body [2]

    - Ids of the primary and secondary rigid bodies between which hinge angle is to be measured. Ids must match the SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY attributes of the sensors used for measuring the hinge angle.

## Human Presence Detect

Human Presence Detect is a Fusion Sensor that detects and updates the state of Human Presence.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “human\_presence\_detect”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_human\_presence\_detect.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- The SNS\_PRESENCE\_MSGID\_SNS\_PRESENCE\_EVENT Reports Human Presence from HPD sensor to Client Event Types associated with SNS\_PRESENCE\_MSGID\_SNS\_PRESENCE\_EVENT:
- SNS\_PRESENCE\_UNKNOWN - Event type indicates unknown state of detection due to insufficient information
- SNS\_PRESENCE\_DETECTED - Event type indicates human presence is detected
- SNS\_PRESENCE\_NOT\_DETECTED - Event type indicates human presence is not detected

Enums

- enum sns\_human\_presence\_detect\_msgid

    - Message IDs for Human Presence Detect Sensor.

*Values:*

- enumerator SNS\_HUMAN\_PRESENCE\_DETECT\_MSGID\_SNS\_HUMAN\_PRESENCE\_DETECT\_CONFIG

    - To enable the Human Presence Detect sensor.

- struct sns\_human\_presence\_detect\_config

    - Public Members

- optional float distance\_threshold

    - Distance Threshold in meters. If measured distance &lt;= distance\_threshold, event type SNS\_PRESENCE\_DETECTED reported. Otherwise, Sensor reports event type SNS\_PRESENCE\_NOT\_DETECTED. Distance threshold support not guaranteed by HPD sensor. If distance based detection is not available, sensor reports an error SNS\_STD\_ERROR\_NOT\_SUPPORTED.

## Inbag Detect

The sensor determines if the device is In a Bag or Not in a Bag. Not in a Bag shall include all scenarios when In a Bag is not detected.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “inbag\_detect”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_inbag\_detect.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable this sensor.

*Publishing Stream Events:*

- SNS\_DEVICE\_CONTEXT\_MSGID\_SNS\_DEVICE\_CONTEXT\_EVENT:

    - The [sns\_device\_context\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__context__event) message is used to publish device context.

Enums

- enum sns\_inbag\_detect\_msgid

    - *Values:*

- enumerator SNS\_INBAG\_DETECT\_MSGID\_SNS\_INBAG\_DETECT\_DATA

    - The message ID of the Inbag detect data message note: Refer [sns\_device\_context\_data](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__context__data) message in the sns\_device\_context.proto Message: [sns\_inbag\_detect\_data](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__inbag__detect__data).

- struct sns\_inbag\_detect\_data

    - Public Members

- reserved to

    - Reserved fields for Qualcomm.

## Magnetometer Calibration

The Mag Calibration Sensor determines the calibration parameters for magnetometer sensor

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “mag\_cal”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_mag\_cal.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG message ID is used to enable the sensor
- SNS\_CAL\_MSGID\_SNS\_CAL\_RESET message ID is used to reset the algorithm and any previously determined calibration parameters.

*Publishing Stream Events:*

- SNS\_CAL\_MSGID\_SNS\_CAL\_EVENT message ID is used to report calibration parameters to the client of the sensor. The [sns\_cal\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__cal__event) message as defined in sns\_cal.proto is used to report this data event where the units for the bias field in the message are in micro Tesla.

## Motion Detect

All physical Sensor drivers that support Motion Detect Sensor are required to support the event messages as defined in this file.

Notes: A “source sensor” is an associated Sensor which supports gating based on motion detection. For example, many accel sensors support motion gating.

*Attribute Requirements:*

The Motion Detect Sensor publishes:

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE attribute value as “motion\_detect”.
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE as SNS\_STD\_SENSOR\_STREAM\_TYPE\_SINGLE\_OUTPUT.
3. The following attributes shall be the same as the source sensor: SNS\_STD\_SENSOR\_ATTRID\_VENDOR SNS\_STD\_SENSOR\_ATTRID\_HW\_ID SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY
4. See sns\_std\_sensor.proto for other attributes.

*Processing Stream Requests:*

1. A message with ID SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is an enable request to the motion\_detect Sensor.
2. A client deletes the data stream with motion\_detect Sensor to disable its original enable request.

*Publishing Stream Events:*

1. The Motion Detect Sensor publishes an event with msgid SNS\_MOTION\_DETECT\_MSGID\_SNS\_MOTION\_DETECT\_EVENT when the Motion Detect Sensor changes state, or when another on-change config request is received.
2. The SNS\_MOTION\_DETECT\_EVENT\_TYPE\_\* event types are used as follows: a. DISABLED is used when motion detect is disabled. This may be due to the Source Sensor having concurrent non-gated requests. b. ENABLED is used when all Source Sensor requests are enabled with the SNS\_STD\_EVENT\_GATED\_SENSOR\_MSGID\_SNS\_STD\_SENSOR\_CONFIG msgid. The Source Sensor sampling is paused, and the motion detect interrupt is armed. c. FIRED is used to indicate the motion detect interrupt has fired, and all SNS\_STD\_EVENT\_GATED\_SENSOR\_MSGID\_SNS\_STD\_SENSOR\_CONFIG Source Sensor requests have been changed to SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_SENSOR\_CONFIG requests. After sending a FIRED event, the Motion Detect Sensor will not re-arm the motion detect interrupt (and will not send more events) until another SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is received.

Enums

- enum sns\_motion\_detect\_msgid

    - Message IDs for motion\_detect Sensor.

*Values:*

- enumerator SNS\_MOTION\_DETECT\_MSGID\_SNS\_MOTION\_DETECT\_EVENT

    - An event indicating the current status of the motion Sensor Message: [sns\_motion\_detect\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__motion__detect__event).

- enum sns\_motion\_detect\_event\_type

    - Motion Detect Event Type.

*Values:*

- enumerator SNS\_MOTION\_DETECT\_EVENT\_TYPE\_DISABLED

    - Motion detect is disabled due to concurrent non-gated clients.

- enumerator SNS\_MOTION\_DETECT\_EVENT\_TYPE\_ENABLED

    - Motion detect interrupt is enabled, and all clients are gated.

- enumerator SNS\_MOTION\_DETECT\_EVENT\_TYPE\_FIRED

    - Motion detect interrupt has fired.

- struct sns\_motion\_detect\_event

    - Public Members

- required sns\_motion\_detect\_event\_type motion\_detect\_event\_type [default=SNS\_MOTION\_DETECT\_EVENT\_TYPE\_DISABLED]

    -

## OEM1

The oem1 sensor is a reference sensor for clients to develop virtual sensors.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “oem1”.
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE.
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_oem1.proto”.

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor.

*Publishing Stream Events:*

- SNS\_OEM1\_MSGID\_SNS\_OEM1\_DATA: The data event is generated when Accel z data value is changed from positive to negative or vice versa.

Enums

- enum sns\_oem1\_msgid

    - Message IDs for oem1 Sensor.

*Values:*

- enumerator SNS\_OEM1\_MSGID\_SNS\_OEM1\_DATA

    -

- struct sns\_oem1\_data

    - Public Members

- repeated float oem1 [3]

    - oem1 Vector along axis x,y,z in m/s2.

- required sns\_std\_sensor\_sample\_status accuracy

    - Accuracy of the data.

## Offbody Detection

An offbody detect sensor reports every time the device transitions from off-body to on-body and from on-body to off-body (e.g. a wearable device being removed from the wrist would trigger an event indicating an off-body transition).

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “offbody\_detect”.
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE.
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_offbody\_detect.proto”.

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor.

*Publishing Stream Events:*

SNS\_OFFBODY\_DETECT\_MSGID\_SNS\_OFFBODY\_DETECT\_EVENT

Enums

- enum sns\_offbody\_detect\_msgid

    - Message IDs for Offbody Detection Sensor.

*Values:*

- enumerator SNS\_OFFBODY\_DETECT\_MSGID\_SNS\_OFFBODY\_DETECT\_EVENT

    -

- enum sns\_offbody\_detect\_event\_type

    - Offbody event types.

*Values:*

- enumerator SNS\_OFFBODY\_DETECT\_EVENT\_TYPE\_UNKNOWN

    - Current state is unknown: not yet detected.

- enumerator SNS\_OFFBODY\_DETECT\_EVENT\_TYPE\_ON

    - Device has been detected to be on-body.

- enumerator SNS\_OFFBODY\_DETECT\_EVENT\_TYPE\_OFF

    - Device has been detected to be off-body.

- struct sns\_offbody\_detect\_event

    - Public Members

- required sns\_offbody\_detect\_event\_type state [default=SNS\_OFFBODY\_DETECT\_EVENT\_TYPE\_UNKNOWN]

    - Detected state.

- optional sns\_std\_sensor\_sample\_status status [default=SNS\_STD\_SENSOR\_SAMPLE\_STATUS\_UNRELIABLE]

    - Accuracy level of the state.

## Ontable Detect

The sensor determines if the device is On a Table or Not on a Table. Not on a Table shall include all scenarios when On Table is not detected.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “ontable\_detect”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_ontable\_detect.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable this sensor.

*Publishing Stream Events:*

- SNS\_DEVICE\_CONTEXT\_MSGID\_SNS\_DEVICE\_CONTEXT\_EVENT:

    - The [sns\_device\_context\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__context__event) message is used to publish device context.

Enums

- enum sns\_ontable\_detect\_msgid

    - The message IDs supported by the ontable\_detect sensor.

*Values:*

- enumerator SNS\_ONTABLE\_DETECT\_MSGID\_SNS\_ONTABLE\_DETECT\_DATA

    - The message ID of the ontable detect data message note: Refer [sns\_device\_context\_data](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__device__context__data) message in the sns\_device\_context.proto Message: [sns\_ontable\_detect\_data](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__ontable__detect__data).

- struct sns\_ontable\_detect\_data

    - Public Members

- reserved to

    - Reserved fields for Qualcomm.

## Pedometer

The Pedometer Sensor detects steps taken by the user

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “pedometer”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_pedometer.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- The [sns\_step\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__step__event) message is used to publish updated step count on every new step detected.
- The [sns\_step\_event\_config](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__step__event__config)

    message is used to publish current step count at the time of connection to the client.

    The Pedometer step event includes the latest step count accumulated since activation and is generated on every step detected. All clients to Pedometer get the same step event. The timestamp of the event indicates the time of the latest detected step.

Enums

- enum sns\_pedometer\_msgid

    - Message IDs for Pedometer Sensor.

*Values:*

- enumerator SNS\_PEDOMETER\_MSGID\_SNS\_STEP\_EVENT

    - 

- enumerator SNS\_PEDOMETER\_MSGID\_SNS\_STEP\_EVENT\_CONFIG

    -

- struct sns\_step\_event

    - Public Members

- required uint32 step\_count

    - an incrementing step count

- struct sns\_step\_event\_config

    - Public Members

- required uint32 step\_count

    - current step count

## Persist Motion Detect

The persistent motion detect sensor reports an event when the device has been in motion for at least 5 seconds.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “persist\_motion\_detect”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_SINGLE\_OUTPUT
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_persist\_motion\_detect.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- SNS\_PERSIST\_MOTION\_DETECT\_MSGID\_SNS\_PMD\_EVENT is used to publish PMD event.

Enums

- enum sns\_persist\_motion\_detect\_msgid

    - Message IDs for Persistent Motion Sensor.

*Values:*

- enumerator SNS\_PERSIST\_MOTION\_DETECT\_MSGID\_SNS\_PMD\_EVENT

    - Empty Event Indicates that persistent motion has been detected.

## Persist Stationary Detect

The persistent stationary detect sensor reports an event when the device has been stationary for at least 5 seconds.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “persist\_stationary\_detect”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_SINGLE\_OUTPUT
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_persist\_stationary\_detect.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- SNS\_PERSIST\_STATIONARY\_DETECT\_MSGID\_SNS\_PSD\_EVENT is used to publish PSD event.

Enums

- enum sns\_persist\_stationary\_detect\_msgid

    - Message IDs for Persistent Stationary Sensor.

*Values:*

- enumerator SNS\_PERSIST\_STATIONARY\_DETECT\_MSGID\_SNS\_PSD\_EVENT

    - Empty Event Indicates that persistent stationary has been detected.

## Physical Sensor Test

All physical Sensor drivers are required to use this API to support self-test. SNS\_PHYSICAL\_SENSOR\_TEST\_TYPE\_COM is a mandatory test type and must be implemented in all physical Sensor drivers. Any new or device-specific test type may be defined in the Sensor-specific API.

*Processing Stream Requests:*

1. The [sns\_physical\_sensor\_test\_config](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__physical__sensor__test__config) message starts the specified test. a. If the associated physical sensor has existing client requests, the Sensor shall:

    1. Pause the existing client requests
    2. Execute the self-test request to completion
    3. Resume the client requests b. If a test is running when a new client request is received, the Sensor shall:

    1. Reject the client request
    2. Continues executing the self-test request to completion

*Publishing Stream Events:*

1. The Sensor publishes a [sns\_physical\_sensor\_test\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__physical__sensor__test__event) upon completion of a test.

Enums

- enum sns\_physical\_sensor\_test\_msgid

    - Physical Sensor test Message IDs.

*Values:*

- enumerator SNS\_PHYSICAL\_SENSOR\_TEST\_MSGID\_SNS\_PHYSICAL\_SENSOR\_TEST\_CONFIG

    - Test config request to a physical Sensor Message: [sns\_physical\_sensor\_test\_config](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__physical__sensor__test__config).

- enumerator SNS\_PHYSICAL\_SENSOR\_TEST\_MSGID\_SNS\_PHYSICAL\_SENSOR\_TEST\_EVENT

    - Test event message from a physical Sensor Message: [sns\_physical\_sensor\_test\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__physical__sensor__test__event).

- enum sns\_physical\_sensor\_test\_type

    - Supported test types for physical sensors.

*Values:*

- enumerator SNS\_PHYSICAL\_SENSOR\_TEST\_TYPE\_SW

    - Software test.

- enumerator SNS\_PHYSICAL\_SENSOR\_TEST\_TYPE\_HW

    - Sensor Hardware test.

- enumerator SNS\_PHYSICAL\_SENSOR\_TEST\_TYPE\_FACTORY

    - Factory test used for Sensor calibration.

- enumerator SNS\_PHYSICAL\_SENSOR\_TEST\_TYPE\_COM

    - Communication bus test.

- struct sns\_physical\_sensor\_test\_config

    - Public Members

- required sns\_physical\_sensor\_test\_type test\_type

    - Requested test type.

- struct sns\_physical\_sensor\_test\_event

    - Public Members

- required bool test\_passed [default=true]

    - Result if the test execution was successful: true for success false for failure.

- required sns\_physical\_sensor\_test\_type test\_type [default=SNS\_PHYSICAL\_SENSOR\_TEST\_TYPE\_COM]

    - test\_type which was completed

- optional bytes test\_data

    - Driver specific test data. This field may be used to pass additional information (such as failure codes, debug data, etc).

## Rotation Vector

A ROTV sensor reports the orientation of the device relative to the East-North-Up coordinates frame. It is obtained by integration of accelerometer, gyroscope, and magnetometer readings.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE is “rotv”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE as SNS\_STD\_SENSOR\_STREAM\_TYPE\_STREAMING.
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_rotv.proto”

*Processing Stream Requests:*

sns\_std\_sensor\_config::sample\_rate is used to specify the sampling rate (Hz) of the ROTV sensor. Sensor will generate data events at this rate.

*Publishing Stream Events:*

Output of the ROTV sensor will be populated in sns\_std\_sensor\_event

The East-North-Up coordinate system is defined as a direct orthonormal basis where:

- X points east and is tangential to the ground.
- Y points north and is tangential to the ground.
- Z points towards the sky and is perpendicular to the ground.

The orientation is represented by the rotation necessary to align the East-North-Up coordinates with the device’s coordinates. That is, applying the rotation to the world frame (X,Y,Z) would align them with the device coordinates (x,y,z).

The rotation can be seen as rotating the device by an angle theta around an axis rot\_axis to go from the reference device orientation to the current device orientation. The rotation is encoded as the four unitless x, y, z, w components of a unit quaternion:

sns_std_sensor_event::data[0] = rot_axis.x*sin(theta/2)
    sns_std_sensor_event::data[1] = rot_axis.y*sin(theta/2)
    sns_std_sensor_event::data[2] = rot_axis.z*sin(theta/2)
    sns_std_sensor_event::data[3] = cos(theta/2)
    Copy to clipboard
Where:
- the x, y and z fields of rot\_axis are the East-North-Up coordinates of a unit length vector representing the rotation axis
- theta is the rotation angle

sns\_std\_sensor\_event::status specifies the reliability of the sample value value is of type sns\_std\_sensor\_sample\_status. see sns\_std\_sensor.proto for details.

## Significant Motion Detection (for Tracker)

Significant Motion detector detects significant motion and stationary states

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “smd\_tracker”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_smd\_tracker.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

Stream events are imported from sns\_amd.proto. smd\_tracker Sensor reports SNS\_AMD\_MSGID\_SNS\_AMD\_EVENT with event types: SNS\_AMD\_EVENT\_TYPE\_UNKNOWN: algorithm returns an unexpected state SNS\_AMD\_EVENT\_TYPE\_STATIONARY: device is in stationary state(&lt; 5 mph) SNS\_AMD\_EVENT\_TYPE\_MOTION: device is in motion state(&gt;= 5 mph)

## Step Detect

The Step Detect Sensor detects steps taken by the user The Step Detect event is generated when the user takes a step. All clients to Step Detect get the same step detect event. The timestamp of the event indicates the time of the latest detected step.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “step\_detect”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_step\_detect.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- An event with SNS\_STEP\_DETECT\_MSGID\_SNS\_STEP\_DETECT\_EVENT as the message id is used to publish a step detect event
- Step detect sensor does not publish configuration events

Enums

- enum sns\_step\_detect\_msgid

    - Message IDs for Step Detect Sensor.

*Values:*

- enumerator SNS\_STEP\_DETECT\_MSGID\_SNS\_STEP\_DETECT\_EVENT

    -

## Tilt

The Tilt Sensor looks for a change in the angle of a gravity vector from an anchor vector, as defined below.

The initial anchor vector is based on an average of one second of accel data after initial activation.

The gravity vector is calculated based on an average of two seconds of accel data.

The anchor vector is reset to the current gravity vector each time the Tilt event is generated. There is only one anchor vector shared amongst all clients.

The Tilt event is generated when the current gravity vector is 35 degrees or more from the anchor vector.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “tilt”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_tilt.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

A NULL message with message ID SNS\_TILT\_MSGID\_SNS\_TILT\_EVENT is used to publish tilt event

Tilt does not publish configuration events.

Enums

- enum sns\_tilt\_msgid

    - Message IDs for Tilt Sensor.

*Values:*

- enumerator SNS\_TILT\_MSGID\_SNS\_TILT\_EVENT

    -

## Tilt (for tracker)

The tilt\_tracker Sensor has 2 states, init\_gravity\_state and update\_gravity\_state. The tilt\_tracker Sensor looks for a change in angle of a current gravity vector from an initialization vector.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “tilt\_tracker”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API: “sns\_tilt\_tracker.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

1. [sns\_tilt\_tracker\_gravity\_init\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__tilt__tracker__gravity__init__event) is associated with the SNS\_TILT\_TRACKER\_MSGID\_SNS\_TILT\_TRACKER\_GRAVITY\_INIT\_EVENT message ID. It is generated when the algo finishes initialization successfully in init\_gravity\_state.
2. [sns\_tilt\_tracker\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__tilt__tracker__event) is associated with the SNS\_TILT\_TRACKER\_MSGID\_SNS\_TILT\_TRACKER\_EVENT message ID. It is generated when the current tilt angle is changed.

Enums

- enum sns\_tilt\_tracker\_msgid

    - Message IDs for tilt\_tracker Sensor.

*Values:*

- enumerator SNS\_TILT\_TRACKER\_MSGID\_SNS\_TILT\_TRACKER\_GRAVITY\_INIT\_EVENT

    - Used to indicate initialization vectors generated in algo initialization state.

- enumerator SNS\_TILT\_TRACKER\_MSGID\_SNS\_TILT\_TRACKER\_EVENT

    - The [sns\_tilt\_tracker\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__tilt__tracker__event) message is used to publish updated state.

- struct sns\_tilt\_tracker\_gravity\_init\_event

    - Public Members

- required bool gravity\_init\_success

    - Indicates gravity initialization success.

- required float gravity\_init\_vector\_x

    - Indicates gravity initialization vector.

- required float gravity\_init\_vector\_y

    - Indicates gravity initialization vector.

- required float gravity\_init\_vector\_z

    - Indicates gravity initialization vector.

- struct sns\_tilt\_tracker\_event

    - Public Members

- required float tilt\_angle

    - Angle of current gravity vector from initialization vector.

## Tilt to wake

The tilt\_to\_wake sensor detects substantial phone rotation (gesture) within limited period ending in a specific range of the pitch and roll angles. It uses proximity sensor to block the tilt event reporting in pocket or purse

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “tilt\_to\_wake”
2. SNS\_STD\_SENSOR\_ATTRID\_RIGID\_BODY: sns\_std\_sensor\_rigid\_body\_type
3. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
4. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_tilt\_to\_wake.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- A NULL message with message ID SNS\_TILT\_TO\_WAKE\_MSGID\_SNS\_TILT\_TO\_WAKE\_EVENT is used to publish tilt\_to\_wake event
- tilt\_to\_wake does not publish configuration events.

Enums

- enum sns\_tilt\_to\_wake\_msgid

    - Message IDs for tilt\_to\_wake Sensor.

*Values:*

- enumerator SNS\_TILT\_TO\_WAKE\_MSGID\_SNS\_TILT\_TO\_WAKE\_EVENT

    -

## Transport Post Processing Engine

The Transport PPE performs post processing tasks such as filtering of events from Transport drivers such as BLE.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “transport\_ppe”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_transport\_ppe.proto”

*Processing Stream Requests:*

- SNS\_TRANSPORT\_PPE\_MSGID\_SNS\_TRANSPORT\_PPE\_CONFIG is used to enable TPPE.

*Publishing Stream Events:*

- SNS\_TRANSPORT\_PPE\_MSGID\_SNS\_TRANSPORT\_PPE\_EVENT is the event generated by TPPE.

Enums

- enum sns\_transport\_ppe\_msgid

    - Message Ids for the Transport PPE Sensor. These are the only messages Transport PPE Sensor processes. Messages with all other Ids are passed through.

*Values:*

- enumerator SNS\_TRANSPORT\_PPE\_MSGID\_SNS\_TRANSPORT\_PPE\_CONFIG

    - 

- enumerator SNS\_TRANSPORT\_PPE\_MSGID\_SNS\_TRANSPORT\_PPE\_EVENT

    -

- enum sns\_transport\_ppe\_prop

    - The TPPE Property Count.

*Values:*

- enumerator SNS\_TRANSPORT\_PPE\_PROP\_COUNT

    -

- enum sns\_transport\_ppe\_threshold

    - ## Property Filters: Used to set a filter on properties associated with the Transport Event.

*Equal Threshold:*

The Transport Event property must be an exact byte match to the one specified by the value in the property filter for the trigger criteria to be met.

*Max Threshold:*

The Transport Event property must be &lt;= the value in the property filter for the trigger criteria to be met.

*Min Threshold:*

The Transport Event property must be &gt;= the value in the property filter for the trigger criteria to be met.

*Values:*

- enumerator SNS\_TRANSPORT\_PPE\_THRESHOLD\_UNINITIALIZED

    - 

- enumerator SNS\_TRANSPORT\_PPE\_THRESHOLD\_MIN

    - 

- enumerator SNS\_TRANSPORT\_PPE\_THRESHOLD\_MAX

    - 

- enumerator SNS\_TRANSPORT\_PPE\_THRESHOLD\_EQUAL

    -

- struct sns\_transport\_ppe\_id

    - Public Members

- required fixed64 id\_low

    - 

- required fixed64 id\_high

    -

- struct sns\_transport\_ppe\_data\_filter

    - Public Members

- required sns\_transport\_ppe\_id id

    - 

- required bytes mask

    - The mask specifies the location of the bits that need to be compared using the provided value. For any bit in the mask, set it to 1 if it needs to be compared, otherwise set it to 0 to ignore. Mask and Value must be of the same length.

- required bytes value

    -

- struct sns\_transport\_property

    - - union prop

    - Public Members

- bytes event\_type = 1[(nanopb).max\_size = 1, (nanopb).fixed\_length = true]

    - Event Type.

- bytes device\_addr\_type = 2[(nanopb).max\_size = 1, (nanopb).fixed\_length = true]

    - Device Address Type.

- bytes device\_addr = 3[(nanopb).max\_size = 6, (nanopb).fixed\_length = true]

    - Device Address.

- fixed64 timestamp

    - Timestamp in units of QTimer ticks.

- sint32 tx\_power

    - Tx Power in dBm.

- sint32 rssi

    - RSSI in dBm.

- bytes primary\_phy = 7[(nanopb).max\_size = 1, (nanopb).fixed\_length = true]

    - Primary PHY.

- bytes secondary\_phy = 8[(nanopb).max\_size = 1, (nanopb).fixed\_length = true]

    - Secondary PHY.

- bytes adv\_sid = 9[(nanopb).max\_size = 1, (nanopb).fixed\_length = true]

    - Advertising SID.

- uint32 periodic\_adv\_interval

    - Periodic Advertising Interval.

- bytes direct\_addr\_type = 11[(nanopb).max\_size = 1, (nanopb).fixed\_length = true]

    - Direct Address Type.

- bytes direct\_addr = 12[(nanopb).max\_size = 6, (nanopb).fixed\_length = true]

    - Direct Address.

- struct sns\_transport\_ppe\_prop\_filter

    - Public Members

- required sns\_transport\_property prop

    - 

- required sns\_transport\_ppe\_threshold threshold [default=SNS\_TRANSPORT\_PPE\_THRESHOLD\_EQUAL]

    - Conveys if value is a minimum, maximum or equal threshold.

- struct sns\_transport\_ppe\_filter

    - - union filter

    - Public Members

- [sns\_transport\_ppe\_prop\_filter](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#_CPPv429sns_transport_ppe_prop_filter) prop\_filter

    - 

- [sns\_transport\_ppe\_data\_filter](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#_CPPv429sns_transport_ppe_data_filter) service\_data\_filter

    - Service data filter is met if there exists atleast one service data in the Transport Event that matches the fields defined in service\_data\_filter.

- [sns\_transport\_ppe\_data\_filter](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#_CPPv429sns_transport_ppe_data_filter) manuf\_data\_filter

    - Manufacturer data filter is met if there exists atleast one manufacturer data in the Transport Event with the fields defined in manuf\_data\_filter.

- struct sns\_transport\_ppe\_dup\_detection

    - Public Members

- repeated sns\_transport\_ppe\_filter dup\_detect\_filters

    - Duplicate detection filters If specified, the events that satisfy ALL filters are considered for duplicate detection. If duplicate detection is requested without filters, all events will be considered for duplicate detection.

- optional uint32 dup\_detect\_period

    - Duplicate detection period If specified, first occurrence of the event in each period is delivered and duplicates within same period are dropped. Period starts from the time a request is received and repeats every ‘dup\_detect\_period’ seconds.

- struct sns\_transport\_ppe\_trigger

    - ## Triggers

A trigger is defined by an associated trigger id, set of wakeup filters and/or duplicate detection filters.

Duplicate Detection

If duplicate detection is enabled, first occurrence of the event is delivered All subsequent events with same data are considered duplicates and dropped.

If duplicate detection is enabled, wakeup filters are applied before duplicate detection.

After wakeup filtering and duplicate detection, the relevant events will be delivered to the end client as part of [sns\_transport\_ppe\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__transport__ppe__event) with the associated trigger id.

Public Members

- repeated sns\_transport\_ppe\_filter wakeup\_filters

    - Wakeup Filters If specified, the transport events will be delivered to the client if and only if the event satisfies ALL the filters.

- required uint32 trigger\_id

    - identifier associated with this trigger

- optional sns\_transport\_ppe\_dup\_detection dup\_detection

    - Duplicate detection feature is disabled by default. Specify dup\_detection to enable duplicate detection feature.

- struct sns\_transport\_ppe\_config

    - ## Transport PPE Configuration message

Uses Msg ID SNS\_TRANSPORT\_PPE\_MSGID\_SNS\_TRANSPORT\_PPE\_CONFIG

This must be the first message sent to the Transport PPE Sensor. All other messages are rejected with an error event until this message is received. Subsequent to receiving the Config message, all messages outside of the ones defined in sns\_transport\_ppe\_msgid are passed through.

The Config message must represent all of the required settings for the client on that connection. Any subsequent Config message overrides previous config settings

For every Transport Event that satisfies ATLEAST ONE of the triggers provided in [sns\_transport\_ppe\_config](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__transport__ppe__config), an event of type [sns\_transport\_ppe\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__transport__ppe__event) is sent to the client carrying the original event as payload and a list of all the trigger\_ids that were satisfied by the event.

If no triggers are provided in [sns\_transport\_ppe\_config](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__transport__ppe__config), for every event received from underlying transport layer, an event of type [sns\_transport\_ppe\_event](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__transport__ppe__event) is sent to the client carrying original event as payload with no trigger ids

Public Members

- repeated sns\_transport\_ppe\_trigger triggers

    - Trigger settings applied to all transport events.

- optional bytes custom\_config

    - Client specified custom configuration.

- struct sns\_transport\_ppe\_event

    - ## Transport PPE Event message

Uses Msg ID SNS\_TRANSPORT\_PPE\_MSGID\_SNS\_TRANSPORT\_PPE\_EVENT

Public Members

- required uint32 event\_msg\_id

    - Msg ID of the Event.

- optional bytes event

    - Transport Event Message.

- repeated uint32 trigger\_ids

    - List of trigger\_ids specified in [sns\_transport\_ppe\_config](https://docs.qualcomm.com/doc/80-P9361-100/topic/algorithm.html#structsns__transport__ppe__config) that were satisfied by this event.

## Wrist tilt gesture

The Tilt Sensor looks for a change in angle of a gravity vector from an anchor vector.

- The initial anchor vector is based on an average of one second of accel data after initial activation.
- The gravity vector is calculated based on an average of two seconds of accel data.
- The anchor vector is reset to the current gravity vector each time the Tilt event is generated.
- There is only one anchor vector shared amongst all clients.
- The Tilt event is generated when the current gravity vector is 35 degrees or more from the anchor vector.

*Attribute Requirements:*

1. SNS\_STD\_SENSOR\_ATTRID\_TYPE: “wrist\_tilt\_gesture”
2. SNS\_STD\_SENSOR\_ATTRID\_STREAM\_TYPE: SNS\_STD\_SENSOR\_STREAM\_TYPE\_ON\_CHANGE
3. SNS\_STD\_SENSOR\_ATTRID\_API attribute contains “sns\_wrist\_tilt\_gesture.proto”

*Processing Stream Requests:*

- SNS\_STD\_SENSOR\_MSGID\_SNS\_STD\_ON\_CHANGE\_CONFIG is used to enable the sensor

*Publishing Stream Events:*

- A NULL message with message ID SNS\_TILT\_MSGID\_SNS\_TILT\_EVENT is used to publish tilt event
- Tilt does not publish configuration events.

Enums

- enum sns\_wrist\_tilt\_gesture\_msgid

    - Message IDs for Wrist Tilt Gesture Sensor.

*Values:*

- enumerator SNS\_WRIST\_TILT\_GESTURE\_MSGID\_SNS\_TILT\_EVENT

    -

Last Published: Jul 14, 2025

[Previous Topic
Message](https://docs.qualcomm.com/bundle/publicresource/80-P9361-100/topics/index_message.md)