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