Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

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

**Enhancements**

* Support was added for the `fr_CA` locale.
* The Executor has been optimized to run a single thread when there are active job in the queue, and to remain idle when there are not active jobs.
* An additional parameter of `alertType` has been added to the Alerts capability agent. This will allow observers of alerts to know the type of alert being delivered.
* Support for programmatic unload and load of PulseAudio Bluetooth modules was added. To enable this feature, there is a [new CMake option](https://github.com/alexa/avs-device-sdk/wiki/CMake-parameters#bluetooth): `BLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS`. Note that [libpulse-dev is a required dependency](https://github.com/alexa/avs-device-sdk/wiki/Dependencies#bluetooth) of this feature.
* An observer interface was added for when an active Bluetooth device connects and disconnects.
* The `BluetoothDeviceManagerInterface` instantiation was moved from `DefaultClient` to `SampleApp` to allow applications to override it.
* The `MediaPlayerInterface` now supports repeating playback of URL sources.
* The Kitt.AI wake word engine (WWE) is now compatible with GCC5+.
* Stop of ongoing alerts, management of MessageObservers, and management of CallStateObservers have been exposed through DefaultClient.

**Bug Fixes**

* [Issue 953](#953) - The `MediaPlayerInterface` requirement that callbacks not be made upon a callers thread has been removed.
* [Issue 1136](#1136) - Added a missing default virtual destructor.
* [Issue 1140](#1140) - Fixed an issue where DND states were not synchronized to the AVS cloud after device reset.
* [Issue 1143](#1143) - Fixed an issue in which the SpeechSynthesizer couldn't enter a sleeping state.
* [Issue 1183](#1183) - Fixed an issue where alarm is not sounding for certain timezones
* Changing an alert's volume from the Alexa app now works when an alert is playing.
* Added missing shutdown handling for ContentDecrypter to prevent the `Stop` command from triggering a crash when SAMPLE-AES encrypted content was streaming.
* Fixed a bug where if the Notifications database is empty, due to a crash or corruption, the SDK initialization process enters an infinite loop when it retries to get context from the Notifications capability agent.
* Fixed a race condition that caused `AlertsRenderer` observers to miss notification that an alert has been completed.

**Known Issues**

* `PlaylistParser` and `IterativePlaylistParser` generate two HTTP requests (one to fetch the content type, and one to fetch the audio data) for each audio stream played.
* Music playback history isn't being displayed in the Alexa app for certain account and device types.
* On GCC 8+, issues related to `-Wclass-memaccess` will trigger warnings. However, this won't cause the build to fail and these warnings can be ignored.
* Android error ("libDefaultClient.so" not found) can be resolved by upgrading to ADB version 1.0.40
* When network connection is lost, lost connection status is not returned via local TTS.
* `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 a source device is streaming silence via Bluetooth, the Alexa app indicates that audio 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.
* `make integration` is currently not available for Android. In order to run integration tests on Android, you'll need to manually upload the test binary file along with any input file. At that point, the adb can be used to run the integration tests.
* On Raspberry Pi running Android Things with HDMI output audio, beginning of speech is truncated when Alexa responds to user text-to-speech (TTS).
* When the sample app is restarted and network connection is lost, Reminder TTS does not play. Instead, the default alarm tone will play twice.
  • Loading branch information
Keith Huang committed Feb 26, 2019
1 parent 451e605 commit ea3ebdb
Show file tree
Hide file tree
Showing 109 changed files with 3,020 additions and 1,176 deletions.
1 change: 0 additions & 1 deletion AVSCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ add_library(AVSCommon SHARED
Utils/src/Stream/StreamFunctions.cpp
Utils/src/Stream/Streambuf.cpp
Utils/src/StringUtils.cpp
Utils/src/TaskQueue.cpp
Utils/src/TaskThread.cpp
Utils/src/TimePoint.cpp
Utils/src/TimeUtils.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-2019 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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-2019 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

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

namespace alexaClientSDK {
namespace avsCommon {
Expand Down Expand Up @@ -54,6 +55,13 @@ class BluetoothDeviceManagerInterface {
*/
virtual std::list<std::shared_ptr<avsCommon::sdkInterfaces::bluetooth::BluetoothDeviceInterface>>
getDiscoveredDevices() = 0;

/**
* Get the @c BluetoothEventBus used by this device manager to post bluetooth related events.
*
* @return A @c BluetoothEventBus object associated with the device manager.
*/
virtual std::shared_ptr<avsCommon::utils::bluetooth::BluetoothEventBus> getEventBus() = 0;
};

} // namespace bluetooth
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright 2019 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_BLUETOOTHDEVICEOBSERVERINTERFACE_H_
#define ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEOBSERVERINTERFACE_H_

#include <string>
#include <unordered_set>

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

/**
* This interface allows a derived class to know when a bluetooth device is connected or disconnected.
*/
class BluetoothDeviceObserverInterface {
public:
/**
* The observable attributes of the bluetooth device.
*/
struct DeviceAttributes {
/**
* Constructor.
*/
DeviceAttributes() = default;

/// The name of the active bluetooth device
std::string name;

/// The bluetooth services this device supports.
std::unordered_set<std::string> supportedServices;
};

/**
* Destructor.
*/
virtual ~BluetoothDeviceObserverInterface() = default;

/**
* Used to notify the observer when an active bluetooth device is connected.
*
* @param attributes The @c DeviceAttributes of the active bluetooth device.
*/
virtual void onActiveDeviceConnected(const DeviceAttributes& attributes) = 0;

/**
* Used to notify the observer when an active bluetooth device is disconnected.
*
* @param attributes The @c DeviceAttributes of the active bluetooth device.
*/
virtual void onActiveDeviceDisconnected(const DeviceAttributes& attributes) = 0;
};

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

#endif // ALEXA_CLIENT_SDK_AVSCOMMON_SDKINTERFACES_INCLUDE_AVSCOMMON_SDKINTERFACES_BLUETOOTH_BLUETOOTHDEVICEOBSERVERINTERFACE_H_
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2018-2019 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.
Expand Down Expand Up @@ -41,7 +41,10 @@ enum class BluetoothEventType {
STREAMING_STATE_CHANGED,

/// Represents when an AVRCP command has been received.
AVRCP_COMMAND_RECEIVED
AVRCP_COMMAND_RECEIVED,

/// When the BluetoothDeviceManager has initialized.
BLUETOOTH_DEVICE_MANAGER_INITIALIZED
};

/// Helper struct to allow enum class to be a key in collections
Expand Down Expand Up @@ -304,6 +307,18 @@ inline AVRCPCommandReceivedEvent::AVRCPCommandReceivedEvent(
std::make_shared<avsCommon::sdkInterfaces::bluetooth::services::AVRCPCommand>(command)) {
}

/**
* Event indicating that the BluetoothDeviceManager has finished initialization. This should only be sent once.
*/
class BluetoothDeviceManagerInitializedEvent : public BluetoothEvent {
public:
explicit BluetoothDeviceManagerInitializedEvent();
};

inline BluetoothDeviceManagerInitializedEvent::BluetoothDeviceManagerInitializedEvent() :
BluetoothEvent(BluetoothEventType::BLUETOOTH_DEVICE_MANAGER_INITIALIZED) {
}

} // namespace bluetooth
} // namespace utils
} // namespace avsCommon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class FormattedAudioStreamAdapterListener {
avsCommon::utils::AudioFormat audioFormat,
const unsigned char* buffer,
size_t size) = 0;

/**
* Destructor.
*/
virtual ~FormattedAudioStreamAdapterListener() = default;
};

} // namespace bluetooth
Expand Down
2 changes: 1 addition & 1 deletion AVSCommon/Utils/include/AVSCommon/Utils/Logger/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace logger {
* static const std::string TAG = "MyClass";
* #define LX(event) alexaClientSDK::avsCommon::utils::logger::LogEntry(TAG, event)
*
* When an event is to be logged, a wrapper macro named @c ACDK_<LEVEL> is invoked with an expression that starts
* When an event is to be logged, a wrapper macro named @c ACSDK_<LEVEL> is invoked with an expression that starts
* with an invocation of the @c LX macro. The value of <LEVEL> is the name of the @c LogLevel value to associate
* with the @c LogEntry. Here is an example of a very simple log line that logs a "somethingHappened" event from
* the source @c TAG with a severity level of @c INFO.
Expand Down
62 changes: 51 additions & 11 deletions AVSCommon/Utils/include/AVSCommon/Utils/Logger/ThreadMoniker.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,78 @@ namespace logger {

/**
* Class to provide @c std::this_thread access to unique name for itself.
*
* The name ThreadMoniker is used instead of ThreadId to avoid confusion with platform specific thread identifiers
* or the @c std::thread::id values rendered as a string.
*/
class ThreadMoniker {
public:
/**
* Constructor.
* Get the moniker for @c std::this_thread.
*
* @return The moniker for @c std::this_thread.
*/
ThreadMoniker();
static inline std::string getThisThreadMoniker();

/**
* Get the moniker for @c std::this_thread.
* Generate a unique moniker.
*
* @return The moniker for @c std::this_thread.
* @return A new unique moniker.
*/
static inline const std::string getThisThreadMoniker();
static std::string generateMoniker();

/**
* Set the moniker for @c std::this_thread. This method should be called before @c getThisThreadMoniker() in order
* to take effect.
*
* @param moniker The moniker for @c std::this_thread.
*/
static inline void setThisThreadMoniker(const std::string& moniker);

private:
/**
* Constructor.
*
* @param moniker Optional moniker for this thread. If no moniker is provided, a new moniker will be provided.
*/
ThreadMoniker(const std::string& moniker = std::string());

/**
* Return the @c ThreadMoniker object for the current thread.
*
* @param moniker Use this moniker to initialize the @c ThreadMoniker if it doesn't exist already.
* @return The moniker for the @c std::this_thread.
*/
static inline const ThreadMoniker& getMonikerObject(const std::string& moniker = std::string());

/**
* Return the @c ThreadMoniker object for the current thread for OS that don't support thread local variables.
*
* @param moniker Use this moniker to initialize the @c ThreadMoniker if it doesn't exist already.
* @return The moniker for the @c std::this_thread.
*/
static const ThreadMoniker& getMonikerObjectFromMap(const std::string& moniker = std::string());

/// The current thread's moniker.
std::string m_moniker;
};

const std::string ThreadMoniker::getThisThreadMoniker() {
std::string ThreadMoniker::getThisThreadMoniker() {
return getMonikerObject().m_moniker;
}

void ThreadMoniker::setThisThreadMoniker(const std::string& moniker) {
getMonikerObject(moniker);
}

const ThreadMoniker& ThreadMoniker::getMonikerObject(const std::string& moniker) {
#ifdef _WIN32
std::ostringstream winThreadID;
winThreadID << std::setw(3) << std::hex << std::right << std::this_thread::get_id();
return winThreadID.str();
return getMonikerObjectFromMap(moniker);
#else
/// Per-thread static instance so that @c m_threadMoniker.m_moniker is @c std::this_thread's moniker.
static thread_local ThreadMoniker m_threadMoniker;
static thread_local ThreadMoniker m_threadMoniker{moniker};

return m_threadMoniker.m_moniker;
return m_threadMoniker;
#endif
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-2019 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.
Expand Down Expand Up @@ -39,18 +39,17 @@ class MediaPlayerObserverInterface;
* A @c MediaPlayerInterface allows for sourcing, playback control, navigation, and querying the state of media content.
* A @c MediaPlayerInterface implementation must only handle one source at a time.
*
* Each playback controlling API call (i.e. @c play(), @c pause(), @c stop(), @c resume()) which returns @c true will
* result in a callback to the observer. If @c false is returned from these calls, no callback will occur. Callbacks
* should not be made on the caller's thread prior to returning from a call.
* Each playback controlling API call (i.e. @c play(), @c pause(), @c stop(), @c resume()) that succeeds will also
* result in a callback to the observer. To see how to tell when a method succeeded, please refer to the documentation
* of each method.
*
* An implementation can call @c onPlaybackError() at any time. If an @c onPlaybackError() callback occurs while a
* plaback controlling API call is waiting for a callback, the original callback must not be made, and the
* implementation should rever to a stopped state. Any subsequent operations after an @c onPlaybackError() callback
* implementation should revert to a stopped state. Any subsequent operations after an @c onPlaybackError() callback
* must be preceded by a new @c setSource() call.
*
* Implementations must make a call to @c onPlaybackStopped() with the previous @c SourceId when a new source is
* set if the previous source was in a non-stopped state. Any calls to a @c MediaPlayerInterface after an @c
* onPlaybackStopped() call will fail, as the MediaPlayer has "reset" its state.
* set if the previous source was in a non-stopped state.
*
* @c note A @c MediaPlayerInterface implementation must be able to support the various audio formats listed at:
* https://developer.amazon.com/docs/alexa-voice-service/recommended-media-support.html.
Expand Down Expand Up @@ -93,13 +92,15 @@ class MediaPlayerInterface {
*
* @param url The url to set as the source.
* @param offset An optional offset parameter to start playing from when a @c play() call is made.
* @param repeat An optional parameter to play the url source in a loop.
*
* @return The @c SourceId that represents the source being handled as a result of this call. @c ERROR will be
* returned if the source failed to be set.
*/
virtual SourceId setSource(
const std::string& url,
std::chrono::milliseconds offset = std::chrono::milliseconds::zero()) = 0;
std::chrono::milliseconds offset = std::chrono::milliseconds::zero(),
bool repeat = false) = 0;

/**
* Set an @c istream source to play. The source should be set before making calls to any of the playback control
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-2019 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.
Expand Down Expand Up @@ -36,6 +36,11 @@ namespace mediaPlayer {
*
* @warning An observer should never call a method from the observed media player while handling a callback.
* This may cause a deadlock while trying to re-acquire a mutex.
*
* @warning Be aware that there is a high risk of deadlock if the observer calls media player functions while holding
* an exclusive lock. The deadlock may happen because the call to media player functions may end up calling the same
* observer which will try to acquire the same lock that it already has. One way to avoid this issue is by using a
* recursive lock.
*/
class MediaPlayerObserverInterface {
public:
Expand Down
4 changes: 2 additions & 2 deletions AVSCommon/Utils/include/AVSCommon/Utils/SDKVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ namespace utils {
namespace sdkVersion{

inline static std::string getCurrentVersion(){
return "1.11.0";
return "1.12.0";
}

inline static int getMajorVersion(){
return 1;
}

inline static int getMinorVersion(){
return 11;
return 12;
}

inline static int getPatchVersion(){
Expand Down
Loading

0 comments on commit ea3ebdb

Please sign in to comment.