• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 HIMSA II K/S - www.himsa.dk.
3  * Represented by EHIMA - www.ehima.com
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #pragma once
18 
19 #include <gmock/gmock.h>
20 
21 #include "btm_api.h"
22 
23 namespace bluetooth {
24 namespace manager {
25 
26 class BtmApiInterface {
27  public:
28   virtual bool SetSecurityLevel(bool is_originator, const char* p_name,
29                                 uint8_t service_id, uint16_t sec_level,
30                                 uint16_t psm, uint32_t mx_proto_id,
31                                 uint32_t mx_chan_id) = 0;
32   virtual uint8_t acl_link_role(const RawAddress& remote_bd_addr,
33                                 tBT_TRANSPORT transport) = 0;
34   virtual ~BtmApiInterface() = default;
35 };
36 
37 class MockBtmApiInterface : public BtmApiInterface {
38  public:
39   MOCK_METHOD7(SetSecurityLevel,
40                bool(bool is_originator, const char* p_name, uint8_t service_id,
41                     uint16_t sec_level, uint16_t psm, uint32_t mx_proto_id,
42                     uint32_t mx_chan_id));
43   MOCK_METHOD2(acl_link_role, uint8_t(const RawAddress& remote_bd_addr,
44                                       tBT_TRANSPORT transport));
45 };
46 
47 /**
48  * Set the {@link MockBtmApiInterface} for testing
49  *
50  * @param mock_btm_api_interface pointer to mock btm interface, could be null
51  */
52 void SetMockBtmApiInterface(MockBtmApiInterface* mock_btm_interface);
53 
54 }  // namespace manager
55 }  // namespace bluetooth