1 /* 2 * Copyright 2019 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 "common/callback.h" 20 #include "hci/hci_packets.h" 21 #include "os/utils.h" 22 23 namespace bluetooth { 24 namespace hci { 25 26 class SecurityInterface { 27 public: 28 SecurityInterface() = default; 29 virtual ~SecurityInterface() = default; 30 DISALLOW_COPY_AND_ASSIGN(SecurityInterface); 31 32 virtual void EnqueueCommand(std::unique_ptr<SecurityCommandBuilder> command, 33 common::OnceCallback<void(CommandCompleteView)> on_complete, os::Handler* handler) = 0; 34 35 virtual void EnqueueCommand(std::unique_ptr<SecurityCommandBuilder> command, 36 common::OnceCallback<void(CommandStatusView)> on_status, os::Handler* handler) = 0; 37 38 static constexpr hci::EventCode SecurityEvents[] = { 39 hci::EventCode::CHANGE_CONNECTION_LINK_KEY_COMPLETE, 40 hci::EventCode::MASTER_LINK_KEY_COMPLETE, 41 hci::EventCode::RETURN_LINK_KEYS, 42 hci::EventCode::PIN_CODE_REQUEST, 43 hci::EventCode::LINK_KEY_REQUEST, 44 hci::EventCode::LINK_KEY_NOTIFICATION, 45 hci::EventCode::ENCRYPTION_KEY_REFRESH_COMPLETE, 46 hci::EventCode::IO_CAPABILITY_REQUEST, 47 hci::EventCode::IO_CAPABILITY_RESPONSE, 48 hci::EventCode::REMOTE_OOB_DATA_REQUEST, 49 hci::EventCode::SIMPLE_PAIRING_COMPLETE, 50 hci::EventCode::USER_PASSKEY_NOTIFICATION, 51 hci::EventCode::KEYPRESS_NOTIFICATION, 52 hci::EventCode::USER_CONFIRMATION_REQUEST, 53 hci::EventCode::USER_PASSKEY_REQUEST, 54 hci::EventCode::REMOTE_HOST_SUPPORTED_FEATURES_NOTIFICATION, 55 }; 56 }; 57 } // namespace hci 58 } // namespace bluetooth 59