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_with_type.h" 22 #include "hci/hci_packets.h" 23 24 namespace bluetooth { 25 namespace l2cap { 26 namespace le { 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::AddressWithType remote,uint16_t handle,hci::Role my_role)38 virtual void OnLinkConnected(hci::AddressWithType remote, uint16_t handle, hci::Role my_role) {} 39 40 /** 41 * Invoked when an ACL link is disconnected. 42 */ OnLinkDisconnected(hci::AddressWithType remote)43 virtual void OnLinkDisconnected(hci::AddressWithType remote) {} 44 45 /** 46 * Invoked when received remote version information for a given link 47 */ OnReadRemoteVersionInformation(hci::ErrorCode hci_status,hci::AddressWithType remote,uint8_t lmp_version,uint16_t manufacturer_name,uint16_t sub_version)48 virtual void OnReadRemoteVersionInformation( 49 hci::ErrorCode hci_status, 50 hci::AddressWithType remote, 51 uint8_t lmp_version, 52 uint16_t manufacturer_name, 53 uint16_t sub_version) {} 54 55 /** 56 * Invoked when received connection update for a given link 57 */ OnConnectionUpdate(hci::AddressWithType remote,uint16_t connection_interval,uint16_t connection_latency,uint16_t supervision_timeout)58 virtual void OnConnectionUpdate( 59 hci::AddressWithType remote, 60 uint16_t connection_interval, 61 uint16_t connection_latency, 62 uint16_t supervision_timeout) {} 63 64 /** 65 * Invoked when received PHY update for a given link 66 */ OnPhyUpdate(hci::AddressWithType remote,uint8_t tx_phy,uint8_t rx_phy)67 virtual void OnPhyUpdate(hci::AddressWithType remote, uint8_t tx_phy, uint8_t rx_phy) {} 68 69 /** 70 * Invoked when received data length exchange for a given link 71 */ OnDataLengthChange(hci::AddressWithType remote,uint16_t tx_octets,uint16_t tx_time,uint16_t rx_octets,uint16_t rx_time)72 virtual void OnDataLengthChange( 73 hci::AddressWithType remote, uint16_t tx_octets, uint16_t tx_time, uint16_t rx_octets, uint16_t rx_time) {} 74 }; 75 76 } // namespace le 77 } // namespace l2cap 78 } // namespace bluetooth 79