1 /* 2 * Copyright 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> 20 #include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> 21 22 #include <cstdint> 23 24 #include "hci/address.h" 25 #include "hci/hci_packets.h" 26 #include "types/raw_address.h" 27 28 void log_classic_pairing_event(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, 29 uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code, 30 int64_t event_value); 31 32 void log_link_layer_connection_event(const RawAddress* address, uint32_t connection_handle, 33 android::bluetooth::DirectionEnum direction, 34 uint16_t link_type, uint32_t hci_cmd, uint16_t hci_event, 35 uint16_t hci_ble_event, uint16_t cmd_status, 36 uint16_t reason_code); 37 38 void log_smp_pairing_event(const RawAddress& address, uint16_t smp_cmd, 39 android::bluetooth::DirectionEnum direction, uint16_t smp_fail_reason); 40 41 void log_sdp_attribute(const RawAddress& address, uint16_t protocol_uuid, uint16_t attribute_id, 42 size_t attribute_size, const char* attribute_value); 43 44 void log_manufacturer_info(const RawAddress& address, 45 android::bluetooth::AddressTypeEnum address_type, 46 android::bluetooth::DeviceInfoSrcEnum source_type, 47 const std::string& source_name, const std::string& manufacturer, 48 const std::string& model, const std::string& hardware_version, 49 const std::string& software_version); 50 51 void log_counter_metrics(android::bluetooth::CodePathCounterKeyEnum key, int64_t value); 52 53 void log_hfp_audio_packet_loss_stats(const RawAddress& address, int num_decoded_frames, 54 double packet_loss_ratio, uint16_t codec_type); 55 56 void log_mmc_transcode_rtt_stats(int maximum_rtt, double mean_rtt, int num_requests, 57 int codec_type); 58 59 void log_le_pairing_fail(const RawAddress& raw_address, uint8_t failure_reason, bool is_outgoing); 60 61 void log_le_connection_status(bluetooth::hci::Address address, bool is_connect, 62 bluetooth::hci::ErrorCode reason); 63 64 void log_le_device_in_accept_list(bluetooth::hci::Address address, bool is_add); 65 66 void log_le_connection_lifecycle(bluetooth::hci::Address address, bool is_connect, bool is_direct); 67