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

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

// Attribute requirements:
// The Hall Sensor publishes:
// 1. SNS_STD_SENSOR_ATTRID_TYPE attribute value as "hall".
// 2. SNS_STD_SENSOR_ATTRID_RESOLUTIONS attribute is not applicable since this is an event
//    sensor.
// 3. SNS_STD_SENSOR_ATTRID_RANGES attribute values as 0 and 1.
// 4. See sns_std_sensor.proto for other attributes.

// Handling stream requests:
// 1. The Hall Sensor handles the SNS_STD_SENSOR_MSGID_SNS_STD_ON_CHANGE_CONFIG
//    message ID for all stream enable/update requests.
// 2. The Hall Sensor operates in on-change mode and report
//    samples only for magnet NEAR/FAR transitions.

// Message IDs for hall Sensor
enum sns_hall_msgid {
  option (nanopb_enumopt).long_names = false;

  // Uses message: sns_hall_event
  // Purpose: An output data event from the hall sensor to it's client.
  SNS_HALL_MSGID_SNS_HALL_EVENT  = 770;
}

enum sns_hall_event_type {
  option (nanopb_enumopt).long_names = false;

  SNS_HALL_EVENT_TYPE_FAR = 0;
  SNS_HALL_EVENT_TYPE_NEAR  = 1;
}

// Events types from hall Sensor
message sns_hall_event
{
  // Hall NEAR/FAR output event
  required sns_hall_event_type hall_event_type = 1 [default = SNS_HALL_EVENT_TYPE_FAR];

  // Hall sensor sample status
  required sns_std_sensor_sample_status status = 2 [default = SNS_STD_SENSOR_SAMPLE_STATUS_UNRELIABLE];
}

// Handling stream events:
// 1. The Hall Sensor publishes magnetic field proximity data stream
//    events using the sns_hall_event message.
// 2. 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.
// 3. The Hall Sensor publishes a configuration event using the
//    sns_std_sensor_physical_config_event message.
//    It publishes this event each time there is change in hardware config of the sensor
//    and contains current physical sensor config of the sensor.

// Handling self-test requests:
// 1. The Hall Sensor implements SNS_PHYSICAL_SENSOR_TEST_TYPE_COM test
//    type using the physical sensor test API.
// 2. The Hall Sensor could implement other test types.

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