177f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen/****************************************************************************** 277f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * 377f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * Copyright (C) 2016 Google, Inc. 477f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * 577f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * Licensed under the Apache License, Version 2.0 (the "License"); 677f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * you may not use this file except in compliance with the License. 777f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * You may obtain a copy of the License at: 877f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * 977f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * http://www.apache.org/licenses/LICENSE-2.0 1077f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * 1177f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * Unless required by applicable law or agreed to in writing, software 1277f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * distributed under the License is distributed on an "AS IS" BASIS, 1377f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1477f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * See the License for the specific language governing permissions and 1577f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * limitations under the License. 1677f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen * 1777f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen ******************************************************************************/ 1877f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen 1977f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen#pragma once 2077f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen 2177f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen#include <stdint.h> 22f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He#include <memory> 23f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He#include <string> 24f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 25f3175629208a64b190dde4dcf5f92cacef70d3e9Jack Henamespace system_bt_osi { 26f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 27f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He// Typedefs to hide protobuf definition to the rest of stack 2877f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen 2977f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssentypedef enum { 3077f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen DEVICE_TYPE_UNKNOWN, 3177f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen DEVICE_TYPE_BREDR, 3277f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen DEVICE_TYPE_LE, 3377f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen DEVICE_TYPE_DUMO, 3477f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen} device_type_t; 3577f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen 3677f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssentypedef enum { 3777f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen WAKE_EVENT_UNKNOWN, 3877f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen WAKE_EVENT_ACQUIRED, 3977f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen WAKE_EVENT_RELEASED, 4077f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen} wake_event_type_t; 4177f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen 4277f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssentypedef enum { 4377f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen SCAN_TYPE_UNKNOWN, 4477f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen SCAN_TECH_TYPE_LE, 4577f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen SCAN_TECH_TYPE_BREDR, 4677f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen SCAN_TECH_TYPE_BOTH, 4777f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen} scan_tech_t; 4877f579f8258ffe6c31c987e9b2d018c853f2af88Marie Janssen 49f3175629208a64b190dde4dcf5f92cacef70d3e9Jack Hetypedef enum { 50f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He CONNECTION_TECHNOLOGY_TYPE_UNKNOWN, 51f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He CONNECTION_TECHNOLOGY_TYPE_LE, 52f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He CONNECTION_TECHNOLOGY_TYPE_BREDR, 53f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He} connection_tech_t; 54f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 55a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack Hetypedef enum { 56a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He DISCONNECT_REASON_UNKNOWN, 57a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He DISCONNECT_REASON_METRICS_DUMP, 58a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He DISCONNECT_REASON_NEXT_START_WITHOUT_END_PREVIOUS, 59a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He} disconnect_reason_t; 60a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He 61f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He/* Values of A2DP metrics that we care about 62f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 63f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * audio_duration_ms : sum of audio duration (in milliseconds). 64f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * device_class: device class of the paired device. 65f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * media_timer_min_ms : minimum scheduled time (in milliseconds) 66f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * of the media timer. 67f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * media_timer_max_ms: maximum scheduled time (in milliseconds) 68f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * of the media timer. 69f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * media_timer_avg_ms: average scheduled time (in milliseconds) 70f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * of the media timer. 71f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * buffer_overruns_max_count: TODO - not clear what this is. 72f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * buffer_overruns_total : number of times the media buffer with 73f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * audio data has overrun 74f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * buffer_underruns_average: TODO - not clear what this is. 75f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * buffer_underruns_count: number of times there was no enough 76f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * audio data to add to the media buffer. 77f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * NOTE: Negative values are invalid 78f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He*/ 79f3175629208a64b190dde4dcf5f92cacef70d3e9Jack Heclass A2dpSessionMetrics { 80f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He public: 81f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He A2dpSessionMetrics() {} 82f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 83f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 84f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Update the metrics value in the current metrics object using the metrics 85f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * objects supplied 86f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 87f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void Update(const A2dpSessionMetrics& metrics); 88f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 89f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 90f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Compare whether two metrics objects are equal 91f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 92f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He bool operator==(const A2dpSessionMetrics& rhs) const; 93f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 94f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 95f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Initialize all values to -1 which is invalid in order to make a distinction 96f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * between 0 and invalid values 97f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 98f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int64_t audio_duration_ms = -1; 99f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int32_t media_timer_min_ms = -1; 100f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int32_t media_timer_max_ms = -1; 101f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int32_t media_timer_avg_ms = -1; 102f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int64_t total_scheduling_count = -1; 103f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int32_t buffer_overruns_max_count = -1; 104f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int32_t buffer_overruns_total = -1; 105f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He float buffer_underruns_average = -1; 106f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He int32_t buffer_underruns_count = -1; 107f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He}; 108f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 109f3175629208a64b190dde4dcf5f92cacef70d3e9Jack Heclass BluetoothMetricsLogger { 110f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He public: 111f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He static BluetoothMetricsLogger* GetInstance() { 112f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He static BluetoothMetricsLogger* instance = new BluetoothMetricsLogger(); 113f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He return instance; 114f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He } 115f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 116f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 117f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Record a pairing event 118f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 119f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Parameters: 120f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * timestamp_ms: Unix epoch time in milliseconds 121f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * device_class: class of remote device 122f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * device_type: type of remote device 123f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * disconnect_reason: HCI reason for pairing disconnection. 124f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * See: stack/include/hcidefs.h 125f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 126f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void LogPairEvent(uint32_t disconnect_reason, uint64_t timestamp_ms, 127f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He uint32_t device_class, device_type_t device_type); 128f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 129f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 130f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Record a wake event 131f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 132f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Parameters: 133f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * timestamp_ms: Unix epoch time in milliseconds 134f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * type: whether it was acquired or released 135f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * requestor: if provided is the service requesting the wake lock 136f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * name: the name of the wake lock held 137f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 138f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void LogWakeEvent(wake_event_type_t type, const std::string& requestor, 139f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He const std::string& name, uint64_t timestamp_ms); 140f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 141f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 142f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Record a scan event 143f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 144f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Parameters 145f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * timestamp_ms : Unix epoch time in milliseconds 146f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * start : true if this is the beginning of the scan 147f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * initiator: a unique ID identifying the app starting the scan 148f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * type: whether the scan reports BR/EDR, LE, or both. 149f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * results: number of results to be reported. 150f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 151f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void LogScanEvent(bool start, const std::string& initator, scan_tech_t type, 152f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He uint32_t results, uint64_t timestamp_ms); 153f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 154f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 155f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Start logging a Bluetooth session 156f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 157f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * A Bluetooth session is defined a a connection between this device and 158f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * another remote device which may include multiple profiles and protocols 159f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 160f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Only one Bluetooth session can exist at one time. Calling this method twice 161f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * without LogBluetoothSessionEnd will result in logging a premature end of 162f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * current Bluetooth session 163f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 164f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Parameters: 165f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * connection_tech_type : type of connection technology 166f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * timestamp_ms : the timestamp for session start, 0 means now 167f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 168f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 169f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void LogBluetoothSessionStart(connection_tech_t connection_tech_type, 170f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He uint64_t timestamp_ms); 171f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 172f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 173f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Stop logging a Bluetooth session and pushes it to the log queue 174f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 175f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * If no Bluetooth session exist, this method exits immediately 176f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 177f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Parameters: 178f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * disconnect_reason : A string representation of disconnect reason 179f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * timestamp_ms : the timestamp of session end, 0 means now 180f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 181f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 182a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He void LogBluetoothSessionEnd(disconnect_reason_t disconnect_reason, 183f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He uint64_t timestamp_ms); 184f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 185f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 186f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Log information about remote device in a current Bluetooth session 187f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 188f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * If a Bluetooth session does not exist, create one with default parameter 189f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * and timestamp now 190f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 191f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Parameters: 192f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * device_class : device_class defined in btm_api_types.h 193f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * device_type : type of remote device 194f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 195f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void LogBluetoothSessionDeviceInfo(uint32_t device_class, 196f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He device_type_t device_type); 197f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 198f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 199f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Log A2DP Audio Session Information 200f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 201f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * - Repeated calls to this method will override previous metrics if in the 202f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * same Bluetooth connection 203f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * - If a Bluetooth session does not exist, create one with default parameter 204f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * and timestamp now 205f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 206f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Parameters: 207f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * a2dp_session_metrics - pointer to struct holding a2dp stats 208f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * 209f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 210f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void LogA2dpSession(const A2dpSessionMetrics& a2dp_session_metrics); 211f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 212f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 213f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Writes the metrics, in base64 protobuf format, into the descriptor FD 214f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * If CLEAR is true, metrics events are cleared afterwards. 215f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 216f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void WriteBase64(int fd, bool clear); 217f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void WriteBase64String(std::string* serialized, bool clear); 218f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void WriteString(std::string* serialized, bool clear); 219f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 220f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 221f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Reset the metrics logger by cleaning up its staging queues and existing 222f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * protobuf objects. 223f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 224f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void Reset(); 225f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 226a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He /* 227a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He * Maximum number of log entries for each session or event 228a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He */ 229a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He static const size_t kMaxNumBluetoothSession = 50; 230a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He static const size_t kMaxNumPairEvent = 50; 231a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He static const size_t kMaxNumWakeEvent = 1000; 232a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He static const size_t kMaxNumScanEvent = 50; 233a3f831cc746cec746c25c1b45d9528aa3fc926e7Jack He 234f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He private: 235f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He BluetoothMetricsLogger(); 236f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 237f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 238f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * When a Bluetooth session is on and the user initiates a metrics dump, we 239f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * need to be able to upload whatever we have first. This method breaks the 240f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * ongoing Bluetooth session into two sessions with the previous one labeled 241f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * as "METRICS_DUMP" for the disconnect reason. 242f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 243f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void CutoffSession(); 244f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 245f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 246f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Build the internal metrics object using information gathered 247f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 248f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void Build(); 249f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 250f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 251f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Reset objects related to current Bluetooth session 252f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 253f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void ResetSession(); 254f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 255f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 256f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * Reset the underlining BluetoothLog object 257f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 258f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He void ResetLog(); 259f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He 260f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He /* 261f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He * PIMPL style implementation to hide internal dependencies 262f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He */ 263f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He struct impl; 264f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He std::unique_ptr<impl> const pimpl_; 265f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He}; 266f3175629208a64b190dde4dcf5f92cacef70d3e9Jack He} 267