1 /*
2  * Copyright 2024 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 "bta/include/bta_sec_api.h"
20 #include "hci/address.h"
21 #include "hci/hci_packets.h"
22 #include "os/metrics.h"
23 #include "stack/include/btm_status.h"
24 #include "stack/include/hci_error_code.h"
25 #include "types/raw_address.h"
26 
27 namespace bluetooth {
28 namespace metrics {
29 
30 void LogIncomingAclStartEvent(const hci::Address& address);
31 
32 void LogAclCompletionEvent(const hci::Address& address, hci::ErrorCode reason,
33                            bool is_locally_initiated);
34 
35 void LogLeAclCompletionEvent(const hci::Address& address, hci::ErrorCode reason,
36                              bool is_locally_initiated);
37 
38 void LogRemoteNameRequestCompletion(const RawAddress& raw_address, tHCI_STATUS hci_status);
39 
40 void LogAclDisconnectionEvent(const hci::Address& address, hci::ErrorCode reason,
41                               bool is_locally_initiated);
42 
43 void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status);
44 
45 void LogAuthenticationComplete(const RawAddress& raw_address, tHCI_STATUS hci_status);
46 
47 void LogSDPComplete(const RawAddress& raw_address, tBTA_STATUS status);
48 
49 void LogLePairingFail(const RawAddress& raw_address, uint8_t failure_reason, bool is_outgoing);
50 
51 android::bluetooth::State MapErrorCodeToState(hci::ErrorCode reason);
52 
53 }  // namespace metrics
54 }  // namespace bluetooth
55