1// Copyright 2014 Google Inc. All Rights Reserved.
2// Author: pkanwar@google.com (Pankaj Kanwar)
3// Protos for uploading bluetooth metrics.
4
5syntax = "proto2";
6
7package com.android.bluetooth.btservice;
8
9option java_package = "com.android.bluetooth.btservice";
10option java_outer_classname = "BluetoothProto";
11//option (datapol.file_vetting_status) = "latest";
12
13// import "storage/datapol/annotations/proto/semantic_annotations.proto";
14
15message BluetoothLog {
16
17  // Session information that gets logged for every BT connection.
18  repeated BluetoothSession session = 1;
19
20  // Session information that gets logged for every Pair event.
21  repeated PairEvent pair_event = 2;
22
23  // Information for Wake locks.
24  repeated WakeEvent wake_event = 3;
25
26  // Scan event information.
27  repeated ScanEvent scan_event = 4;
28}
29
30// The information about the device.
31message DeviceInfo {
32
33  // Device type.
34  enum DeviceType {
35
36     // Type is unknown.
37     DEVICE_TYPE_UNKNOWN = 0;
38
39     DEVICE_TYPE_BREDR = 1;
40
41     DEVICE_TYPE_LE = 2;
42
43     DEVICE_TYPE_DUMO = 3;
44  }
45
46  // Device class
47  // https://cs.corp.google.com/#android/system/bt/stack/include/btm_api.h&q=major_computer.
48  optional int32 device_class = 1;
49
50  // Device type.
51  optional DeviceType device_type = 2;
52}
53
54// Information that gets logged for every Bluetooth connection.
55message BluetoothSession {
56
57  // Type of technology used in the connection.
58  enum ConnectionTechnologyType {
59
60     CONNECTION_TECHNOLOGY_TYPE_UNKNOWN = 0;
61
62     CONNECTION_TECHNOLOGY_TYPE_LE = 1;
63
64     CONNECTION_TECHNOLOGY_TYPE_BREDR = 2;
65  }
66
67  // Duration of the session.
68  optional int64 session_duration_sec = 2;
69
70  // Technology type.
71  optional ConnectionTechnologyType connection_technology_type = 3;
72
73  // Reason for disconnecting.
74  optional string disconnect_reason = 4;
75
76  // The information about the device which it is connected to.
77  optional DeviceInfo device_connected_to = 5;
78
79  // The information about the RFComm session.
80  optional RFCommSession rfcomm_session = 6;
81
82  // The information about the A2DP session.
83  optional A2DPSession a2dp_session = 7;
84}
85
86message RFCommSession {
87
88  // bytes transmitted.
89  optional int32 rx_bytes = 1;
90
91  // bytes transmitted.
92  optional int32 tx_bytes = 2;
93}
94
95// Session information that gets logged for every A2DP session.
96message A2DPSession {
97
98  // Media timer in milliseconds.
99  optional int32 media_timer_min_millis = 1;
100
101  // Media timer in milliseconds.
102  optional int32 media_timer_max_millis = 2;
103
104  // Media timer in milliseconds.
105  optional int32 media_timer_avg_millis = 3;
106
107  // Buffer overruns count.
108  optional int32 buffer_overruns_max_count = 4;
109
110  // Buffer overruns total.
111  optional int32 buffer_overruns_total = 5;
112
113  // Buffer underruns average.
114  optional float buffer_underruns_average = 6;
115
116  // Buffer underruns count.
117  optional int32 buffer_underruns_count = 7;
118}
119
120message PairEvent {
121
122  // The reason for disconnecting
123  // https://cs.corp.google.com/#android/system/bt/stack/include/hcidefs.h&q=failed_establish.
124  optional int32 disconnect_reason = 1;
125
126  // Pair event time
127  optional int64 event_time_millis = 2; // [(datapol.semantic_type) = ST_TIMESTAMP];
128
129  // The information about the device which it is paired to.
130  optional DeviceInfo device_paired_with = 3;
131}
132
133message WakeEvent {
134
135  // Information about the wake event type.
136  enum WakeEventType {
137
138     // Type is unknown.
139     UNKNOWN = 0;
140
141     // WakeLock was acquired.
142     ACQUIRED = 1;
143
144     // WakeLock was released.
145     RELEASED = 2;
146  }
147
148  // Information about the wake event type.
149  optional WakeEventType wake_event_type = 1;
150
151  // Initiator of the scan. Only the first three names will be stored.
152  // e.g. com.google.gms.
153  optional string requestor = 2;
154
155  // Name of the wakelock (e.g. bluedroid_timer).
156  optional string name = 3;
157
158  // Time of the event.
159  optional int64 event_time_millis = 4; // [(datapol.semantic_type) = ST_TIMESTAMP];
160}
161
162message ScanEvent {
163
164  // Scan type.
165  enum ScanTechnologyType {
166
167     // Scan Type is unknown.
168     SCAN_TYPE_UNKNOWN = 0;
169
170     SCAN_TECH_TYPE_LE = 1;
171
172     SCAN_TECH_TYPE_BREDR = 2;
173
174     SCAN_TECH_TYPE_BOTH = 3;
175  }
176
177  // Scan event type.
178  enum ScanEventType {
179
180     // Scan started.
181     SCAN_EVENT_START = 0;
182
183     // Scan stopped.
184     SCAN_EVENT_STOP = 1;
185  }
186
187  // Scan event type.
188  optional ScanEventType scan_event_type = 1;
189
190  // Initiator of the scan. Only the first three names will be stored.
191  // e.g. com.google.gms.
192  optional string initiator = 2;
193
194  // Technology used for scanning.
195  optional ScanTechnologyType scan_technology_type = 3;
196
197  // Number of results returned.
198  optional int32 number_results = 4;
199
200  // Time of the event.
201  optional int64 event_time_millis = 5; // [(datapol.semantic_type) = ST_TIMESTAMP];
202}
203