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