Myles Watson | 07c86d3 | 2019-08-20 15:17:00 -0700 | [diff] [blame] | 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::ENCRYPTION_CHANGE, hci::EventCode::CHANGE_CONNECTION_LINK_KEY_COMPLETE, |
| 40 | hci::EventCode::MASTER_LINK_KEY_COMPLETE, hci::EventCode::RETURN_LINK_KEYS, |
| 41 | hci::EventCode::PIN_CODE_REQUEST, hci::EventCode::LINK_KEY_REQUEST, |
| 42 | hci::EventCode::LINK_KEY_NOTIFICATION, hci::EventCode::ENCRYPTION_KEY_REFRESH_COMPLETE, |
| 43 | hci::EventCode::IO_CAPABILITY_REQUEST, hci::EventCode::IO_CAPABILITY_RESPONSE, |
| 44 | hci::EventCode::REMOTE_OOB_DATA_REQUEST, hci::EventCode::SIMPLE_PAIRING_COMPLETE, |
| 45 | hci::EventCode::USER_PASSKEY_NOTIFICATION, hci::EventCode::KEYPRESS_NOTIFICATION, |
Martin Brabham | 2e76f9a | 2019-11-21 09:16:24 -0800 | [diff] [blame^] | 46 | hci::EventCode::USER_CONFIRMATION_REQUEST, hci::EventCode::USER_PASSKEY_REQUEST, |
Myles Watson | 07c86d3 | 2019-08-20 15:17:00 -0700 | [diff] [blame] | 47 | }; |
| 48 | }; |
| 49 | } // namespace hci |
| 50 | } // namespace bluetooth |