1 /*
2  *
3  *  Copyright 2019 The Android Open Source Project
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  */
18 
19 #pragma once
20 
21 #include "common/callback.h"
22 #include "hci/acl_manager.h"
23 #include "security/pairing_failure.h"
24 
25 namespace bluetooth {
26 namespace security {
27 
28 /**
29  * Callback interface from SecurityManager.
30  */
31 class ISecurityManagerListener {
32  public:
33   virtual ~ISecurityManagerListener() = 0;
34 
35   /**
36    * Called when a device is successfully bonded.
37    *
38    * @param address of the newly bonded device
39    */
40   virtual void OnDeviceBonded(bluetooth::hci::AddressWithType device) = 0;
41 
42   /**
43    * Called when a device is successfully un-bonded.
44    *
45    * @param address of device that is no longer bonded
46    */
47   virtual void OnDeviceUnbonded(bluetooth::hci::AddressWithType device) = 0;
48 
49   /**
50    * Called as a result of a failure during the bonding process.
51    *
52    * @param address of the device that failed to bond
53    */
54   virtual void OnDeviceBondFailed(bluetooth::hci::AddressWithType device, PairingFailure status) = 0;
55 
56   /**
57    * Called as a result of a failure during the bonding process.
58    *
59    * @param address of the device that failed to bond
60    */
61   virtual void OnEncryptionStateChanged(hci::EncryptionChangeView encryption_change_view) = 0;
62 };
63 
64 }  // namespace security
65 }  // namespace bluetooth
66