AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
BlueZHostController.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 
16 #ifndef ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_BLUEZHOSTCONTROLLER_H_
17 #define ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_BLUEZHOSTCONTROLLER_H_
18 
19 #include <string>
20 #include <memory>
21 #include <mutex>
22 
23 #include <gio/gio.h>
24 
28 #include "BlueZ/BlueZUtils.h"
30 
31 namespace alexaClientSDK {
32 namespace bluetoothImplementations {
33 namespace blueZ {
34 
37 public:
40  virtual ~BlueZHostController() = default;
41 
42  std::string getMac() const override;
43  std::string getFriendlyName() const override;
44 
45  bool isDiscoverable() const override;
46  std::future<bool> enterDiscoverableMode() override;
47  std::future<bool> exitDiscoverableMode() override;
48 
49  bool isScanning() const override;
50  std::future<bool> startScan() override;
51  std::future<bool> stopScan() override;
53 
60  static std::unique_ptr<BlueZHostController> create(const std::string& adapterObjectPath);
61 
68  void onPropertyChanged(const GVariantMapReader& changesMap);
69 
70 private:
76  BlueZHostController(const std::string& adapterObjectPath);
77 
83  bool init();
84 
94  std::future<bool> setDiscoverable(bool discoverable);
95 
106  std::future<bool> changeScanState(bool scanning);
107 
109  std::string m_adapterObjectPath;
110 
112  std::unique_ptr<avsCommon::utils::MacAddressString> m_mac;
113 
119  mutable std::mutex m_adapterMutex;
120 
122  std::string m_friendlyName;
123 
125  std::shared_ptr<DBusPropertiesProxy> m_adapterProperties;
126 
128  std::shared_ptr<DBusProxy> m_adapter;
129 };
130 
131 } // namespace blueZ
132 } // namespace bluetoothImplementations
133 } // namespace alexaClientSDK
134 
135 #endif // ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_BLUEZHOSTCONTROLLER_H_
void onPropertyChanged(const GVariantMapReader &changesMap)
::std::string string
Definition: gtest-port.h:1097
An implementation of the BluetoothHostControllerInterface using BlueZ.
Definition: BlueZHostController.h:36
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::unique_ptr< BlueZHostController > create(const std::string &adapterObjectPath)

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