summaryrefstree
path: root/vendor/etc/sensors/proto/sns_direct_channel.proto
blob: 5601bb3abaa7725aa08881dd7d8e57c9b4cadcf4 (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
// @file sns_direct_channel.proto
//
// Defines the Sensors Direct Channel interface that can be used by clients to get sensor data via direct channel
//
// Copyright (c) 2020 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.proto";

// To activate a stream on a channel
// " get Channel first by sending sns_direct_channel_create_msg -> then send sns_direct_channel_set_ts_offset  -> send sns_direct_channel_set_client_req for sns_direct_channel_stream_id"

// To activate another stream on existing channel
// "Send sns_direct_channel_set_client_req on existing Channel for new sns_direct_channel_stream_id"

// To update the existing request on the channel
// "Send updated sns_direct_channel_set_client_req on existing Channel with already added sns_direct_channel_stream_id"

// To remove existing request on the channel
// "Send sns_direct_channel_remove_client_req on existing Channel for any added sns_direct_channel_stream_id"

// To update time stamp offset on channel.
// "Send sns_direct_channel_set_ts_offset on existing Channel with ts_offset"


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

  // Sensor data from multiple streams can be multiplexed in one channel
  // Samples are compatible to sensors_event_t format defined by Android Spec
  // ref: SensorsEventFormatOffset( a.k.a sensors_event_t) at hardware/interfaces/sensors/1.0/types.hal
   DIRECT_CHANNEL_TYPE_STRUCTURED_MUX_CHANNEL = 0;

  // Sensors Data format expected in Raw bytes only.
  // Sensors data format is not mandated in the API.
  // This channel type can be used by clients who know how to interpret the sensor data from respective sensor source.
   DIRECT_CHANNEL_TYPE_GENERIC_CHANNEL = 1;
}

// stream id for different direct channel streams
message sns_direct_channel_stream_id {
  // sensor responsible for data
  required sns_std_suid suid  = 1;
  // if set to true,  auto calibrated data is generated
  // if set to false, factory calibrated data is generated
  optional bool calibrated    = 2 [default = true];
  // if set to true,  resampled data is generated at rate which is at most twice the requested rate
  // if set to false, data is generated at native rate supported by driver, advertised with attributes - SNS_STD_SENSOR_ATTRID_RATES and SNS_STD_SENSOR_ATTRID_ADDITIONAL_LOW_LATENCY_RATES
  optional bool resampled     = 3 [ default = true];
}


// Direct channel Creation Request Message
message sns_direct_channel_create_msg {
  // ION fd, size to get Virtual address that can be used by Q6
  message shared_buffer_config {
    required fixed32 fd   = 1;
    required fixed32 size = 2;
  }

  required shared_buffer_config     buffer_config  = 1;
 
  // Each channel can be either DIRECT_CHANNEL_TYPE_STRUCTURED_MUX_CHANNEL or DIRECT_CHANNEL_TYPE_GENERIC_CHANNEL
  // e.g Android Direct Report Channel for DIRECT_CHANNEL_TYPE_STRUCTURED_MUX_CHANNEL
  required direct_channel_type      channel_type   = 2 ;

  // Processor hosting the sensor data client
  // Default processor is Application Processor
  optional sns_std_client_processor client_proc    = 3 [ default = SNS_STD_CLIENT_PROCESSOR_APSS];
}


// Client request on Direct Channel
message sns_direct_channel_set_client_req {
  // msg id for sns_std_request, see sns_std.proto for more information.
  required fixed32                                  msg_id     = 1;

  // unique id for each stream on the channel
  required sns_direct_channel_stream_id             stream_id  = 2;

  // generic sns_std_request
  required sns_std_request                          request    = 3;

  // required attributes for DIRECT_CHANNEL_TYPE_STRUCTURED_MUX_CHANNEL
  message structured_mux_channel_stream_attributes {
    // Unique handle per sensor, client has to supply for mapping in sensor hub to "sensor_event_t::sensor" variable
    required fixed32 sensor_handle = 1;
    // Corresponds to android sensor type, client has to supply for mapping in sensor hub to "sensor_event_t::type" variable
    required fixed32   sensor_type = 2;
  }

  optional structured_mux_channel_stream_attributes attributes = 4;
}


// Direct Channel remove client request message
message sns_direct_channel_remove_client_req {
  required sns_direct_channel_stream_id stream_id = 1;
}


// Clients interested in Client Time Domain Time Stamp has to supply offset value
// direct channel in sensor hub adds this value to its own time domain time stamp to generate Client Time Domain Time Stamp
message sns_direct_channel_set_ts_offset {
  required fixed64 ts_offset = 1;
}


// Direct Channel Configuration Message
message sns_direct_channel_config_msg {

  oneof channel_config_msg_payload
  {
    sns_direct_channel_set_client_req     set_client_req      = 100;

    sns_direct_channel_remove_client_req  remove_client_req   = 101;

    sns_direct_channel_set_ts_offset      set_ts_offset       = 102;
  }
}