16 #ifndef ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_BLUEZBLUETOOTHDEVICE_H_ 17 #define ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_BLUEZBLUETOOTHDEVICE_H_ 24 #include <unordered_map> 25 #include <unordered_set> 35 namespace bluetoothImplementations {
38 class BlueZDeviceManager;
43 ,
public std::enable_shared_from_this<BlueZBluetoothDevice> {
76 std::future<bool>
pair()
override;
77 std::future<bool>
unpair()
override;
80 std::future<bool>
connect()
override;
85 std::vector<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::services::SDPRecordInterface>>
87 std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface> getService(
92 std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface> service)
override;
103 static std::shared_ptr<BlueZBluetoothDevice>
create(
106 std::shared_ptr<BlueZDeviceManager> deviceManager);
129 std::shared_ptr<BlueZDeviceManager> deviceManager);
143 bool updateFriendlyName();
150 std::unordered_set<std::string> getServiceUuids();
159 std::unordered_set<std::string> getServiceUuids(GVariant* array);
166 bool initializeServices(
const std::unordered_set<std::string>& uuids);
181 bool executeUnpair();
188 bool executeConnect();
195 bool executeDisconnect();
203 bool executeIsPaired();
211 bool executeIsConnected();
219 bool executeToggleServiceConnection(
221 std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface> service);
230 bool queryDeviceProperty(
const std::string& name,
bool* value);
262 bool executeIsConnectedToRelevantServices();
279 std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface> service);
287 template <
typename ServiceType>
288 std::shared_ptr<ServiceType> getService();
296 template <
typename BlueZServiceType>
297 bool initializeService();
300 std::shared_ptr<DBusProxy> m_deviceProxy;
303 std::shared_ptr<DBusPropertiesProxy> m_propertiesProxy;
315 std::mutex m_servicesMapMutex;
320 std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface>>
327 std::unique_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface::MetaData> m_metaData;
330 std::shared_ptr<BlueZDeviceManager> m_deviceManager;
353 return "DISCONNECTED";
357 return "CONNECTION_FAILED";
379 #endif // ALEXA_CLIENT_SDK_BLUETOOTHIMPLEMENTATIONS_BLUEZ_INCLUDE_BLUEZ_BLUEZBLUETOOTHDEVICE_H_ std::vector< std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::services::SDPRecordInterface > > getSupportedServices() override
std::ostream & operator<<(std::ostream &stream, const BlueZBluetoothDevice::BlueZDeviceState &state)
Definition: BlueZBluetoothDevice.h:371
bool setPairingPin(const std::string &pin) override
MetaData getDeviceMetaData() override
~BlueZBluetoothDevice() override
::std::string string
Definition: gtest-port.h:1097
A device has been discovered.
MediaStreamingState
An Enum representing the current state of the stream.
Definition: MediaStreamingState.h:25
Single-thread executor implementation.
Definition: Executor.h:45
A BlueZ implementation of the BluetoothDeviceInterface.
Definition: BlueZBluetoothDevice.h:41
A device that has successfully connected.
std::string getObjectPath() const
std::future< bool > disconnect() override
Definition: GVariantMapReader.h:36
bool toggleServiceConnection(bool enabled, std::shared_ptr< avsCommon::sdkInterfaces::bluetooth::services::BluetoothServiceInterface > service) override
Represents a Bluetooth Device.
Definition: BluetoothDeviceInterface.h:100
std::string getFriendlyName() const override
void onPropertyChanged(const GVariantMapReader &changesMap)
BlueZDeviceState
Definition: BlueZBluetoothDevice.h:45
[Transitional] The device has successfully paired.
bool isConnected() override
std::future< bool > pair() override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
DeviceState
Definition: BluetoothDeviceInterface.h:48
avsCommon::sdkInterfaces::bluetooth::DeviceState getDeviceState() override
[Transitional] The device has been unpaired.
static std::shared_ptr< BlueZBluetoothDevice > create(const std::string &mac, const std::string &objectPath, std::shared_ptr< BlueZDeviceManager > deviceManager)
[Transitional] A device has successfully disconnected.
std::string getMac() const override
std::future< bool > connect() override
std::future< bool > unpair() override
std::string deviceStateToString(BlueZBluetoothDevice::BlueZDeviceState state)
Definition: BlueZBluetoothDevice.h:342
avsCommon::utils::bluetooth::MediaStreamingState getStreamingState() override