AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
MockBluetoothDeviceConnectionRule.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_MOCKBLUETOOTHDEVICECONNECTIONRULE_H_
16 #define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_BLUETOOTH_MOCKBLUETOOTHDEVICECONNECTIONRULE_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 
32 public:
33  MockBluetoothDeviceConnectionRule(std::set<DeviceCategory> categories, std::set<std::string> profiles);
34  bool shouldExplicitlyConnect() override;
35  bool shouldExplicitlyDisconnect() override;
36  std::set<std::shared_ptr<BluetoothDeviceInterface>> devicesToDisconnect(
37  std::map<DeviceCategory, std::set<std::shared_ptr<BluetoothDeviceInterface>>> connectedDevices) override;
38  std::set<DeviceCategory> getDeviceCategories() override;
39  std::set<std::string> getDependentProfiles() override;
40 
46  void setExplicitlyConnect(bool explicitlyConnect);
47 
53  void setExplicitlyDisconnect(bool explicitlyDisconnect);
54 
60  void setDevicesToDisconnect(std::set<std::shared_ptr<BluetoothDeviceInterface>> devices);
61 
62 protected:
63  std::set<DeviceCategory> m_categories;
64 
65  std::set<std::string> m_profiles;
66 
68 
70 
71  std::set<std::shared_ptr<BluetoothDeviceInterface>> m_disconnectedDevices;
72 };
73 
75  std::set<DeviceCategory> categories,
76  std::set<std::string> profiles) :
77  m_categories{categories},
78  m_profiles{profiles},
79  m_explicitlyConnect{false},
80  m_explicitlyDisconnect{false} {
81 }
82 
84  return m_categories;
85 }
86 
88  return m_profiles;
89 }
90 
92  return m_explicitlyConnect;
93 }
94 
97 }
98 
99 std::set<std::shared_ptr<BluetoothDeviceInterface>> MockBluetoothDeviceConnectionRule::devicesToDisconnect(
100  std::map<DeviceCategory, std::set<std::shared_ptr<BluetoothDeviceInterface>>> connectedDevices) {
101  return m_disconnectedDevices;
102 }
103 
105  m_explicitlyConnect = explicitlyConnect;
106 }
107 
109  m_explicitlyDisconnect = explicitlyDisconnect;
110 }
111 
113  std::set<std::shared_ptr<BluetoothDeviceInterface>> devices) {
114  m_disconnectedDevices = devices;
115 }
116 
117 } // namespace test
118 } // namespace bluetooth
119 } // namespace sdkInterfaces
120 } // namespace avsCommon
121 } // namespace alexaClientSDK
122 
123 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_TEST_AVSCOMMON_SDKINTERFACES_BLUETOOTH_MOCKBLUETOOTHDEVICECONNECTIONRULE_H_
void setDevicesToDisconnect(std::set< std::shared_ptr< BluetoothDeviceInterface >> devices)
Definition: MockBluetoothDeviceConnectionRule.h:112
std::set< std::shared_ptr< BluetoothDeviceInterface > > m_disconnectedDevices
Definition: MockBluetoothDeviceConnectionRule.h:71
Definition: AmdMetricWrapperTest.cpp:24
std::set< DeviceCategory > getDeviceCategories() override
Definition: MockBluetoothDeviceConnectionRule.h:83
std::set< std::string > getDependentProfiles() override
Definition: MockBluetoothDeviceConnectionRule.h:87
void setExplicitlyDisconnect(bool explicitlyDisconnect)
Definition: MockBluetoothDeviceConnectionRule.h:108
set
Definition: gmock_class.py:44
DeviceCategory
Definition: DeviceCategory.h:24
bool shouldExplicitlyConnect() override
Definition: MockBluetoothDeviceConnectionRule.h:91
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::set< DeviceCategory > m_categories
Definition: MockBluetoothDeviceConnectionRule.h:63
std::set< std::string > m_profiles
Definition: MockBluetoothDeviceConnectionRule.h:65
MockBluetoothDeviceConnectionRule(std::set< DeviceCategory > categories, std::set< std::string > profiles)
Definition: MockBluetoothDeviceConnectionRule.h:74
std::set< std::shared_ptr< BluetoothDeviceInterface > > devicesToDisconnect(std::map< DeviceCategory, std::set< std::shared_ptr< BluetoothDeviceInterface >>> connectedDevices) override
Definition: MockBluetoothDeviceConnectionRule.h:99
bool shouldExplicitlyDisconnect() override
Definition: MockBluetoothDeviceConnectionRule.h:95
void setExplicitlyConnect(bool explicitlyConnect)
Definition: MockBluetoothDeviceConnectionRule.h:104

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