Skip to content

Commit

Permalink
Version 1.7.1 alexa-client-sdk
Browse files Browse the repository at this point in the history
Changes in this update:

Enhancements
* Added the Bluetooth interface, which manages the Bluetooth connection between Alexa-enabled products and peer devices. This release supports A2DP-SINK and AVRCP profiles. Note: Bluetooth is optional and is currently limited to Raspberry Pi and Linux platforms.
* Added new Bluetooth dependencies for Linux and Raspberry Pi.
* Device Capability Framework (DCF) renamed to Capabilities.
* Updated the non-CBL client ID error message to be more specific.
* Updated the sample app to enter a limited interaction mode after an unrecoverable error.

Bug Fixes
* Issue 597 - Fixed a bug where the sample app did not respond to locale change settings.

* Fixed issue where GStreamer 1.14 MediaPlayerTest failed on Windows.
* Fixed an issue where a segmentation fault was triggered after unrecoverable error handling.

Known Issues
* The ACL may encounter issues if audio attachments are received but not consumed.
* SpeechSynthesizerState currently uses GAINING_FOCUS and LOSING_FOCUS as a workaround for handling intermediate state. These states may be removed in a future release.
* The Alexa app doesn't always indicate when a device is successfully connected via Bluetooth.
* Connecting a product to streaming media via Bluetooth will sometimes stop media playback within the source application. Resuming playback through the source application or toggling next/previous will correct playback.
* When streaming silence via Bluetooth, the Alexa companion app will sometimes indicate that media content is streaming.
* The Bluetooth agent assumes that the Bluetooth adapter is always connected to a power source. Disconnecting from a power source during operation is not yet supported.
* On some products, interrupted Bluetooth playback may not resume if other content is locally streamed.
* When streaming content via Bluetooth, under certain conditions playback will fail to resume and the sample app hangs on exit. This is due to a conflict between the GStreamer pipeline and the Bluetooth agent.
* On Raspberry Pi, when streaming audio via Bluetooth, sometimes the audio stream stutters.
* On Raspberry Pi, BlueALSA must be terminated each time the device boots. See Raspberry Pi Quick Start Guide for more information.
  • Loading branch information
frozenberg committed May 4, 2018
1 parent 8bf0160 commit 32f85e2
Show file tree
Hide file tree
Showing 134 changed files with 12,705 additions and 709 deletions.
2 changes: 1 addition & 1 deletion AFML/include/AFML/AudioActivityTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class AudioActivityTracker
std::unordered_map<std::string, std::string> m_channelNamesInLowerCase;
/// @}

/// Set of capability configurations that will get published using DCF
/// Set of capability configurations that will get published using the Capabilities API
std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;

/**
Expand Down
2 changes: 1 addition & 1 deletion AFML/include/AFML/VisualActivityTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class VisualActivityTracker
Channel::State m_channelState;
/// @}

/// Set of capability configurations that will get published using DCF
/// Set of capability configurations that will get published using the Capabilities API
std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration>> m_capabilityConfigurations;

/**
Expand Down
62 changes: 62 additions & 0 deletions AVSCommon/AVS/include/AVSCommon/AVS/Requester.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

#ifndef ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_REQUESTER_H_
#define ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_REQUESTER_H_

namespace alexaClientSDK {
namespace avsCommon {
namespace avs {

/// An enum class indicating whether an operation originated from a Device or Cloud (AVS).
enum class Requester {
/// The request came from AVS as a result of a directive.
CLOUD,
/// The request came from the device. Can be from either the AVS device or a connected device.
DEVICE
};

/**
* Converts an @c Requester enum to a string.
*
* @param requester The @c Requester enum.
* @return The string representation of the enum.
*/
inline std::string requesterToString(Requester requester) {
switch (requester) {
case Requester::CLOUD:
return "CLOUD";
case Requester::DEVICE:
return "DEVICE";
}
return "UNKNOWN";
}

/**
* Write a @c Requester value to an @c ostream as a string.
*
* @param stream The stream to write the value to.
* @param requester The @c Requester value to write to the @c ostream as a string.
* @return The @c ostream that was passed in and written to.
*/
inline std::ostream& operator<<(std::ostream& stream, Requester requester) {
return stream << requesterToString(requester);
}

} // namespace avs
} // namespace avsCommon
} // namespace alexaClientSDK

#endif // ALEXA_CLIENT_SDK_AVSCOMMON_AVS_INCLUDE_AVSCOMMON_AVS_REQUESTER_H_
2 changes: 1 addition & 1 deletion AVSCommon/AVS/src/Attachment/InProcessAttachmentReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ std::size_t InProcessAttachmentReader::read(

} else if (0 == readResult) {
*readStatus = ReadStatus::CLOSED;
ACSDK_INFO(LX("readFailed").d("reason", "SDS is closed"));
ACSDK_DEBUG0(LX("readFailed").d("reason", "SDS is closed"));
} else {
bytesRead = static_cast<size_t>(readResult) * wordSize;
}
Expand Down
4 changes: 4 additions & 0 deletions AVSCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ add_library(AVSCommon SHARED
AVS/src/HandlerAndPolicy.cpp
AVS/src/MessageRequest.cpp
AVS/src/NamespaceAndName.cpp
Utils/src/Bluetooth/SDPRecords.cpp
Utils/src/BluetoothEventBus.cpp
Utils/src/Configuration/ConfigurationNode.cpp
Utils/src/DeviceInfo.cpp
Utils/src/Executor.cpp
Utils/src/FileUtils.cpp
Utils/src/FormattedAudioStreamAdapter.cpp
Utils/src/JSONUtils.cpp
Utils/src/LibcurlUtils/CallbackData.cpp
Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp
Expand All @@ -53,6 +56,7 @@ add_library(AVSCommon SHARED
Utils/src/Logger/LogStringFormatter.cpp
Utils/src/Logger/ModuleLogger.cpp
Utils/src/Logger/ThreadMoniker.cpp
Utils/src/MacAddressString.cpp
Utils/src/Metrics.cpp
Utils/src/Network/InternetConnectionMonitor.cpp
Utils/src/RequiresShutdown.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class AuthObserverInterface {
/// Client should slow down in the rate of requests polling for an access token.
SLOW_DOWN,
/// Internal error in client code.
INTERNAL_ERROR
INTERNAL_ERROR,
/// Client ID not valid for use with code based linking.
INVALID_CBL_CLIENT_ID
};

/**
Expand Down Expand Up @@ -145,6 +147,8 @@ inline std::ostream& operator<<(std::ostream& stream, const AuthObserverInterfac
return stream << "SLOW_DOWN";
case AuthObserverInterface::Error::INTERNAL_ERROR:
return stream << "INTERNAL_ERROR";
case AuthObserverInterface::Error::INVALID_CBL_CLIENT_ID:
return stream << "INVALID_CBL_CLIENT_ID";
}
return stream << "Unknown AuthObserverInterface::Error!: " << error;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
/*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

#ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEINTERFACE_H_
#define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEINTERFACE_H_

#include <future>
#include <memory>
#include <ostream>
#include <string>
#include <vector>

#include <AVSCommon/SDKInterfaces/Bluetooth/Services/A2DPSourceInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/AVRCPTargetInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/BluetoothServiceInterface.h>
#include <AVSCommon/SDKInterfaces/Bluetooth/Services/SDPRecordInterface.h>

namespace alexaClientSDK {
namespace avsCommon {
namespace sdkInterfaces {
namespace bluetooth {

/**
* clang-format off
* Represents the state of the device. The state diagram is as follows:
*
* +------UNPAIRED-------------+
* | |
* +------UNPAIRED---+ |
* V | |
* FOUND -> PAIRED -> IDLE -> CONNECTED
* ^ |
* +DISCONNECTED-+
* clang-format on
*/
enum class DeviceState {
// A device has been discovered.
FOUND,
// [Transitional] The device has been unpaired.
UNPAIRED,
// [Transitional] The device has successfully paired.
PAIRED,
// A paired device.
IDLE,
// [Transitional] A device has successfully disconnected.
DISCONNECTED,
// A device that has successfully connected.
CONNECTED
};

/**
* Converts the @c DeviceState enum to a string.
*
* @param The @c DeviceState to convert.
* @return A string representation of the @c DeviceState.
*/
inline std::string deviceStateToString(DeviceState state) {
switch (state) {
case DeviceState::FOUND:
return "FOUND";
case DeviceState::UNPAIRED:
return "UNPAIRED";
case DeviceState::PAIRED:
return "PAIRED";
case DeviceState::IDLE:
return "IDLE";
case DeviceState::DISCONNECTED:
return "DISCONNECTED";
case DeviceState::CONNECTED:
return "CONNECTED";
}

return "UNKNOWN";
}

/**
* Overload for the @c DeviceState enum. This will write the @c DeviceState as a string to the provided stream.
*
* @param An ostream to send the DeviceState as a string.
* @param The @c DeviceState to convert.
* @return The stream.
*/
inline std::ostream& operator<<(std::ostream& stream, const DeviceState state) {
return stream << deviceStateToString(state);
}

/// Represents a Bluetooth Device.
class BluetoothDeviceInterface {
public:
/// Destructor
virtual ~BluetoothDeviceInterface() = default;

/**
* Getter for the MAC address.
*
* @return The MAC address of the Bluetooth Device.
*/
virtual std::string getMac() const = 0;

/**
* Getter for the friendly name.
*
* @return The friendly name of the Bluetooth Device.
*/
virtual std::string getFriendlyName() const = 0;

/**
* Getter for the @c DeviceState.
*
* @return The @c DeviceState of the current device.
*/
virtual DeviceState getDeviceState() = 0;

/**
* Getter for the paired state of the device. This should return
* the state after any pending state changes have been resolved.
*
* @return A bool representing whether the device is paired.
*/
virtual bool isPaired() = 0;

/**
* Initiate a pair with this device.
*
* @return Indicates whether pairing was successful.
*/
virtual std::future<bool> pair() = 0;

/**
* Initiate an unpair with this device.
*
* @return Indicates whether the unpairing was successful.
*/
virtual std::future<bool> unpair() = 0;

/**
* Getter for the paired state of the device. This should return
* the state after any pending state changes have been resolved.
*
* @return A bool representing whether the device is connected.
*/
virtual bool isConnected() = 0;

/**
* Initiate a connect with this device.
*
* @return Indicates whether connecting was successful.
*/
virtual std::future<bool> connect() = 0;

/**
* Initiate a disconnect with this device.
*
* @return Indicates whether disconnect was successful.
*/
virtual std::future<bool> disconnect() = 0;

/// @return The Bluetooth Services that this device supports.
virtual std::vector<std::shared_ptr<services::SDPRecordInterface>> getSupportedServices() = 0;

// TODO : Generic getService method.
/// @return A pointer to an instance of the @c A2DPSourceInterface if supported, else a nullptr.
virtual std::shared_ptr<services::A2DPSourceInterface> getA2DPSource() = 0;

/// @return A pointer to an instance of the @c AVRCPTargetInterface if supported, else a nullptr.
virtual std::shared_ptr<services::AVRCPTargetInterface> getAVRCPTarget() = 0;
};

} // namespace bluetooth
} // namespace sdkInterfaces
} // namespace avsCommon
} // namespace alexaClientSDK

#endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEINTERFACE_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

#ifndef ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEMANAGERINTERFACE_H_
#define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEMANAGERINTERFACE_H_

#include <list>
#include <memory>

#include "AVSCommon/SDKInterfaces/Bluetooth/BluetoothDeviceInterface.h"
#include "AVSCommon/SDKInterfaces/Bluetooth/BluetoothHostControllerInterface.h"

namespace alexaClientSDK {
namespace avsCommon {
namespace sdkInterfaces {
namespace bluetooth {

/**
* This component is a starting point of any platform specific implementation of bluetooth functionality. It is
* responsible for ownership of @c BluetoothDeviceInterface objects and @c BluetootHostController objects.
*
*/
class BluetoothDeviceManagerInterface {
public:
/**
* Destructor
*/
virtual ~BluetoothDeviceManagerInterface() = default;

/**
* Get @c BluetoothHostControllerInterface instance
* @return Pointer to a @c BluetoothHostControllerInterface instance
*/
virtual std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothHostControllerInterface>
getHostController() = 0;

/**
* Get a list of devices the Host Controller is aware of. This list must contain:
*
* i) Paired devices.
* ii) Devices found during the scanning process.
*/
virtual std::list<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>
getDiscoveredDevices() = 0;
};

} // namespace bluetooth
} // namespace sdkInterfaces
} // namespace avsCommon
} // namespace alexaClientSDK

#endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEMANAGERINTERFACE_H_
Loading

0 comments on commit 32f85e2

Please sign in to comment.