1 /* 2 * Copyright 2020 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 <cstdint> 20 #include <memory> 21 #include "hci/hci_packets.h" 22 23 namespace bluetooth { 24 namespace hci { 25 namespace acl_manager { 26 27 class ConnectionManagementCallbacks { 28 public: 29 virtual ~ConnectionManagementCallbacks() = default; 30 // Invoked when controller sends Connection Packet Type Changed event with Success error code 31 virtual void OnConnectionPacketTypeChanged(uint16_t packet_type) = 0; 32 // Invoked when controller sends Authentication Complete event with Success error code 33 virtual void OnAuthenticationComplete(hci::ErrorCode hci_status) = 0; 34 // Invoked when controller sends Encryption Change event with Success error code 35 virtual void OnEncryptionChange(EncryptionEnabled enabled) = 0; 36 // Invoked when controller sends Change Connection Link Key Complete event with Success error code 37 virtual void OnChangeConnectionLinkKeyComplete() = 0; 38 // Invoked when controller sends Read Clock Offset Complete event with Success error code 39 virtual void OnReadClockOffsetComplete(uint16_t clock_offset) = 0; 40 // Invoked when controller sends Mode Change event with Success error code 41 virtual void OnModeChange(ErrorCode status, Mode current_mode, uint16_t interval) = 0; 42 // Invoked when controller sends Sniff Subrating event with Success error code 43 virtual void OnSniffSubrating( 44 hci::ErrorCode hci_status, 45 uint16_t maximum_transmit_latency, 46 uint16_t maximum_receive_latency, 47 uint16_t minimum_remote_timeout, 48 uint16_t minimum_local_timeout) = 0; 49 // Invoked when controller sends QoS Setup Complete event with Success error code 50 virtual void OnQosSetupComplete(ServiceType service_type, uint32_t token_rate, uint32_t peak_bandwidth, 51 uint32_t latency, uint32_t delay_variation) = 0; 52 // Invoked when controller sends Flow Specification Complete event with Success error code 53 virtual void OnFlowSpecificationComplete(FlowDirection flow_direction, ServiceType service_type, uint32_t token_rate, 54 uint32_t token_bucket_size, uint32_t peak_bandwidth, 55 uint32_t access_latency) = 0; 56 // Invoked when controller sends Flush Occurred event 57 virtual void OnFlushOccurred() = 0; 58 // Invoked when controller sends Command Complete event for Role Discovery command with Success error code 59 virtual void OnRoleDiscoveryComplete(Role current_role) = 0; 60 // Invoked when controller sends Command Complete event for Read Link Policy Settings command with Success error code 61 virtual void OnReadLinkPolicySettingsComplete(uint16_t link_policy_settings) = 0; 62 // Invoked when controller sends Command Complete event for Read Automatic Flush Timeout command with Success error 63 // code 64 virtual void OnReadAutomaticFlushTimeoutComplete(uint16_t flush_timeout) = 0; 65 // Invoked when controller sends Command Complete event for Read Transmit Power Level command with Success error code 66 virtual void OnReadTransmitPowerLevelComplete(uint8_t transmit_power_level) = 0; 67 // Invoked when controller sends Command Complete event for Read Link Supervision Time out command with Success error 68 // code 69 virtual void OnReadLinkSupervisionTimeoutComplete(uint16_t link_supervision_timeout) = 0; 70 // Invoked when controller sends Command Complete event for Read Failed Contact Counter command with Success error 71 // code 72 virtual void OnReadFailedContactCounterComplete(uint16_t failed_contact_counter) = 0; 73 // Invoked when controller sends Command Complete event for Read Link Quality command with Success error code 74 virtual void OnReadLinkQualityComplete(uint8_t link_quality) = 0; 75 // Invoked when controller sends Command Complete event for Read AFH Channel Map command with Success error code 76 virtual void OnReadAfhChannelMapComplete(AfhMode afh_mode, std::array<uint8_t, 10> afh_channel_map) = 0; 77 // Invoked when controller sends Command Complete event for Read RSSI command with Success error code 78 virtual void OnReadRssiComplete(uint8_t rssi) = 0; 79 // Invoked when controller sends Command Complete event for Read Clock command with Success error code 80 virtual void OnReadClockComplete(uint32_t clock, uint16_t accuracy) = 0; 81 // Invoked when controller sends Central Link Key Complete event 82 virtual void OnCentralLinkKeyComplete(KeyFlag key_flag) = 0; 83 // Invoked when controller sends Role Change event 84 virtual void OnRoleChange(hci::ErrorCode hci_status, Role new_role) = 0; 85 // Invoked when controller sends DisconnectComplete 86 virtual void OnDisconnection(ErrorCode reason) = 0; 87 // Invoked when controller sends Read Remote Version Information Complete 88 virtual void OnReadRemoteVersionInformationComplete( 89 hci::ErrorCode hci_status, uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version) = 0; 90 // Invoked when controller sends Read Remote Supported Features Complete 91 virtual void OnReadRemoteSupportedFeaturesComplete(uint64_t features) = 0; 92 // Invoked when controller sends Read Remote Extended Features Complete 93 virtual void OnReadRemoteExtendedFeaturesComplete( 94 uint8_t page_number, uint8_t max_page_number, uint64_t features) = 0; 95 }; 96 97 } // namespace acl_manager 98 } // namespace hci 99 } // namespace bluetooth 100