AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MockBluetoothHostController.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
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  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_BLUETOOTH_MOCKBLUETOOTHHOSTCONTROLLER_H_
16 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_BLUETOOTH_MOCKBLUETOOTHHOSTCONTROLLER_H_
17 
18 #include <gmock/gmock.h>
19 
21 
22 namespace alexaClientSDK {
23 namespace avsCommon {
24 namespace sdkInterfaces {
25 namespace bluetooth {
26 namespace test {
27 
28 static const std::string MOCK_MAC_ADDRESS = "XX:XX:XX:XX";
29 static const std::string MOCK_FRIENDLY_NAME = "MockBluetoothHostControllerName";
30 
35 public:
36  std::string getMac() const override;
37  std::string getFriendlyName() const override;
38  bool isDiscoverable() const override;
39  bool isScanning() const override;
40  std::future<bool> startScan() override;
41  std::future<bool> stopScan() override;
42  std::future<bool> enterDiscoverableMode() override;
43  std::future<bool> exitDiscoverableMode() override;
44 
45 protected:
48 };
49 
50 inline std::future<bool> MockBluetoothHostController::startScan() {
51  std::promise<bool> scanPromise;
52  scanPromise.set_value(true);
53  m_isScanning = true;
54  return scanPromise.get_future();
55 }
56 
57 inline std::future<bool> MockBluetoothHostController::stopScan() {
58  std::promise<bool> scanPromise;
59  scanPromise.set_value(true);
60  m_isScanning = false;
61  return scanPromise.get_future();
62 }
63 
65  std::promise<bool> discoverPromise;
66  discoverPromise.set_value(true);
67  m_isDiscoverable = true;
68  return discoverPromise.get_future();
69 }
70 
72  std::promise<bool> discoverPromise;
73  discoverPromise.set_value(true);
74  m_isDiscoverable = false;
75  return discoverPromise.get_future();
76 }
77 
79  return m_isScanning;
80 }
81 
83  return m_isDiscoverable;
84 }
85 
87  return MOCK_MAC_ADDRESS;
88 }
89 
91  return MOCK_FRIENDLY_NAME;
92 }
93 
94 } // namespace test
95 } // namespace bluetooth
96 } // namespace sdkInterfaces
97 } // namespace avsCommon
98 } // namespace alexaClientSDK
99 
100 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_BLUETOOTH_MOCKBLUETOOTHHOSTCONTROLLER_H_
static const std::string MOCK_MAC_ADDRESS
Definition: MockBluetoothHostController.h:28
Definition: AmdMetricWrapperTest.cpp:24
::std::string string
Definition: gtest-port.h:1097
std::future< bool > exitDiscoverableMode() override
Definition: MockBluetoothHostController.h:71
bool isScanning() const override
Definition: MockBluetoothHostController.h:78
std::future< bool > startScan() override
Definition: MockBluetoothHostController.h:50
bool isDiscoverable() const override
Definition: MockBluetoothHostController.h:82
static const std::string MOCK_FRIENDLY_NAME
Definition: MockBluetoothHostController.h:29
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::future< bool > enterDiscoverableMode() override
Definition: MockBluetoothHostController.h:64
std::string getFriendlyName() const override
Definition: MockBluetoothHostController.h:90
std::string getMac() const override
Definition: MockBluetoothHostController.h:86
std::future< bool > stopScan() override
Definition: MockBluetoothHostController.h:57

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0