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