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 <memory>
20 
21 #include "hci/address.h"
22 #include "hci/hci_packets.h"
23 
24 namespace bluetooth {
25 namespace l2cap {
26 namespace classic {
27 
28 /**
29  * This is the listener interface for link property callbacks.
30  */
31 class LinkPropertyListener {
32  public:
33   virtual ~LinkPropertyListener() = default;
34 
35   /**
36    * Invoked when an ACL link is connected.
37    */
OnLinkConnected(hci::Address remote,uint16_t handle)38   virtual void OnLinkConnected(hci::Address remote, uint16_t handle) {}
39 
40   /**
41    * Invoked when an ACL link is disconnected.
42    */
OnLinkDisconnected(hci::Address remote)43   virtual void OnLinkDisconnected(hci::Address remote) {}
44 
45   /**
46    * Invoked when received remote version information for a given link
47    */
OnReadRemoteVersionInformation(hci::ErrorCode hci_status,hci::Address remote,uint8_t lmp_version,uint16_t manufacturer_name,uint16_t sub_version)48   virtual void OnReadRemoteVersionInformation(
49       hci::ErrorCode hci_status,
50       hci::Address remote,
51       uint8_t lmp_version,
52       uint16_t manufacturer_name,
53       uint16_t sub_version) {}
54 
55   /**
56    * Invoked when received remote features and remote supported features for a given link
57    */
OnReadRemoteSupportedFeatures(hci::Address remote,uint64_t features)58   virtual void OnReadRemoteSupportedFeatures(hci::Address remote, uint64_t features) {}
59 
60   /**
61    * Invoked when received remote features and remote extended features for a given link
62    */
OnReadRemoteExtendedFeatures(hci::Address remote,uint8_t page_number,uint8_t max_page_number,uint64_t features)63   virtual void OnReadRemoteExtendedFeatures(
64       hci::Address remote, uint8_t page_number, uint8_t max_page_number, uint64_t features) {}
65 
66   /**
67    * Invoked when received role change
68    */
OnRoleChange(hci::ErrorCode hci_status,hci::Address remote,hci::Role role)69   virtual void OnRoleChange(hci::ErrorCode hci_status, hci::Address remote, hci::Role role) {}
70 
71   /**
72    * Invoked when received clock offset
73    */
OnReadClockOffset(hci::Address remote,uint16_t clock_offset)74   virtual void OnReadClockOffset(hci::Address remote, uint16_t clock_offset) {}
75 
76   /**
77    * Invoked when received mode change
78    */
OnModeChange(hci::ErrorCode hci_status,hci::Address remote,hci::Mode mode,uint16_t interval)79   virtual void OnModeChange(hci::ErrorCode hci_status, hci::Address remote, hci::Mode mode, uint16_t interval) {}
80 
81   /**
82    * Invoked when received sniff subrating
83    */
OnSniffSubrating(hci::ErrorCode hci_status,hci::Address remote,uint16_t max_tx_lat,uint16_t max_rx_lat,uint16_t min_remote_timeout,uint16_t min_local_timeout)84   virtual void OnSniffSubrating(
85       hci::ErrorCode hci_status,
86       hci::Address remote,
87       uint16_t max_tx_lat,
88       uint16_t max_rx_lat,
89       uint16_t min_remote_timeout,
90       uint16_t min_local_timeout) {}
91 };
92 
93 }  // namespace classic
94 }  // namespace l2cap
95 }  // namespace bluetooth
96