summaryrefstree
path: root/vendor/etc/sensors/proto/sns_formatter.proto
blob: 51885589416b2d5f0a76864495255398e024da1c (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// @file sns_formatter.proto
//
// Defines standard message types for the Offset/Formatter sensor
//
// Copyright (c) 2018, 2020, 2022 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
syntax = "proto2";
import "nanopb.proto";
import "sns_std_type.proto";
import "sns_std_sensor.proto";

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

  SNS_FORMATTER_MSGID_SNS_FORMATTER_REQUEST                = 512;
  SNS_FORMATTER_MSGID_SNS_FORMATTER_METRIC_DATA_REQUEST    = 513;
  SNS_FORMATTER_MSGID_SNS_FORMATTER_BROADCAST_DATA_REQUEST = 514;

  SNS_FORMATTER_MSGID_SNS_FORMATTER_OUTPUT_EVENT           = 1024;
  SNS_FORMATTER_MSGID_SNS_FORMATTER_ACK_EVENT              = 1025;
  SNS_FORMATTER_MSGID_SNS_FORMATTER_OUTPUT_GOAL_EVENT      = 1026;
  SNS_FORMATTER_MSGID_SNS_FORMATTER_OUTPUT_THRESHOLD_EVENT = 1027;
 }

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

  SNS_FORMATTER_REQUEST_INVALID  = 0;
  // Creates a new instance of a metric with given id.
  SNS_FORMATTER_REQUEST_CREATE   = 1;
  // Starts or resumes the update of the metric instances.
  SNS_FORMATTER_REQUEST_START    = 2;
  // Stops the update of the metric instances.
  SNS_FORMATTER_REQUEST_STOP     = 3;
  // Resets metric instance state.
  SNS_FORMATTER_REQUEST_RESET    = 4;
  // Destroys the metric instance. Release the resources for that instance.
  SNS_FORMATTER_REQUEST_DESTROY  = 5;
  // Set the config data based on the group name.
  SNS_FORMATTER_REQUEST_CONFIG_SET   = 6;
  // fetch the config data based on the group name.
  SNS_FORMATTER_REQUEST_CONFIG_GET   = 7;
  // Updates the batch period at the client manager.
  SNS_FORMATTER_REQUEST_BATCH        = 8;
  // Pauses the update of the metric instances
  SNS_FORMATTER_REQUEST_PAUSE     = 9;
}

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

  SNS_FORMATTER_STATUS_FAILURE        = 0;
  SNS_FORMATTER_STATUS_INVALID_PARAM  = 1;
  SNS_FORMATTER_STATUS_SUCCESS        = 2;
}

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

  SNS_FORMATTER_CLIENT_BG   = 0;
  SNS_FORMATTER_CLIENT_APPS = 1;
}

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

  SNS_FORMATTER_OUTPUT_DATA_EVENT     = 0;
  SNS_FORMATTER_OUTPUT_BUFFER_EVENT   = 1;
  SNS_FORMATTER_CONFIG_DATA_EVENT     = 2;
}

// "UNUSED" is filled by clients for strings which are
// not applicable for a given sns_formatter-request_values id.
message sns_formatter_config_payload {
  optional sns_std_suid            metric_sensor_suid = 1;
  required sns_std_suid            formatter_suid    = 2;
  required float                   sample_rate       = 3;
  required string                  format_input_str  = 4;
  required string                  metric_name       = 5;
  required string                  group_name        = 7;
  required string                  sensor_config_data = 8;
}

message sns_formatter_output_event_payload
{
  required bytes                        data       = 1;
  required sns_std_sensor_sample_status status     = 2;
  required sns_formatter_event_type     event_type = 3;
}

// Formatter config message
// Used by clients to configure the formatter for various metrics
message sns_formatter_request
{
  required sns_formatter_request_values msg_id                = 1;
  required fixed32                      metric_id             = 2;
  required sns_formatter_client_id client_id                  = 3;
  optional sns_formatter_config_payload payload               = 4;
  optional sns_formatter_output_event_payload  event_payload  = 5;
}

message sns_formatter_metric_data_request
{
  required fixed32     metric_id    = 1;
  required bytes       metric_data  = 2;
}

message sns_formatter_broadcast_data_request
{
  required bytes broadcast_data = 1;
}

// Formatter output event
// This event contains the formatted string output corresponding to the
// metric requested by the client.
message sns_formatter_output_event
{
  required fixed32                      metric_id         = 1;
  required string                       formatted_output  = 2;
  required sns_formatter_output_event_payload  event_payload     = 3;
}

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

  SNS_FORMATTER_GOAL_VALUE   = 1;
  SNS_FORMATTER_GOAL_DURATION = 2;
}


message sns_formatter_output_goal_event
{
  required fixed32                      metric_id         = 1;
  required sns_formatter_goal_type      goal_type         = 2;
  oneof goal_data
  {
     fixed32 int_data   =3;     // Data can be goal value or duration. Goal_type is used to identify type of data.
     float   float_data   =4;    // This is for goal value of float type. Ex: Algos like distance may set float values
  }
}

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

  SNS_FORMATTER_HIGH_THRESHOLD_ACHIEVED =1;
  SNS_FORMATTER_LOW_THRESHOLD_ACHIEVED=2;
}

message sns_formatter_output_threshold_event
{
  required fixed32                         metric_id         = 1;
  required sns_formatter_threshold_type    th_type           = 2;
}

// Formatter acknowledge event
// This event contains the status for the request sent from the client.
// Status indicates if the requested format string was valid or not.
message sns_formatter_ack_event
{
  required fixed32                     metric_id  = 1;
  required sns_formatter_status_values status     = 2;
}