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

Commit

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

**Enhancements**
* Added the Notifications Capability Agent. This allows a client to receive notification indicators from Alexa.
* Added support for the `SoftwareInfo` event. This code is triggered in the `SampleApp` by providing a positive decimal integer as the "firmwareVersion" value in "sampleApp" object of the `AlexaClientSDKConfig.json`. The reported firmware version can be updated after starting the `SampleApp` by calling `SoftwareInfoSender::setFirmwareVersion()`. This code path can be exercised in the `SampleApp` with the new command: `f`.
* Added unit tests for Alerts.
* The GStreamer-based pipeline allows for the configuration of `MediaPlayer` output based on information provided in `Config`.
* Playlist streaming now uses a `BLOCKING` writer, which improves streaming efficiency.

**Bug Fixes**
* Fixed bug where `SpeechSynthesizer` would not stop playback when a state change timeout was encountered.
* Fixed the `SampleApplication` destructor to avoid segfaults if the object is not constructed correctly.
* Fixed bug where `AudioPlayer` would erroneously call `executeStop()` in `cancelDirective()`.
* [Issue 396](#396) - Fixed bug for compilation error with GCC7 in `AVSCommon/SDKInterfaces/include/AVSCommon/SDKInterfaces/Audio/AlertsAudioFactoryInterface.h`
* [Issue 384](#384) - Fixed bug that caused `AuthServer.py` to crash.
* Fixed bug where a long delay was encountered after pausing and resuming a large Audible chapter.
* Fixed bug that caused named timers and reminders to loop for an additional `loopCount` .
* Fixed memory corruption bug in `MessageInterpreter`.
* Fixed illegal memory accesses in `MediaPlayer` logging.

**Known Issues**
* The `ACL` may encounter issues if audio attachments are received but not consumed.
* Display Cards for Kindle don't render.
* If using the GStreamer-based `MediaPlayer` implementation, after muting and un-muting an audio item, the next item in the queue will begin playing rather than continuing playback of the originally muted audio item.
* `SpeechSynthesizerState` currently uses `GAINING_FOCUS` and `LOSING_FOCUS` as a workaround for handling intermediate state. These states may be removed in a future release.
* Music playback doesn't immediately stop when a user barges-in on iHeartRadio.
  • Loading branch information
celinval committed Jan 12, 2018
1 parent 528fc40 commit 5259a2f
Show file tree
Hide file tree
Showing 175 changed files with 13,767 additions and 1,094 deletions.
14 changes: 1 addition & 13 deletions ACL/include/ACL/Transport/TransportDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,7 @@ namespace acl {
class TransportDefines {
public:
/// Table with the retry times on subsequent retries.
static int RETRY_TABLE[];

/// Size of the retry table.
static int RETRY_TABLE_SIZE;

/// Randomization used in the computation of retry times.
static int RETRY_RANDOMIZATION_PERCENTAGE;

/// Lower bound of the interval to distribute the retry duration.
static int RETRY_DECREASE_PERCENTAGE;

/// Upper bound of the interval to distribute the retry duration.
static int RETRY_INCREASE_PERCENTAGE;
const static std::vector<int> RETRY_TABLE;

/// Retry Timer Object for transport.
static avsCommon::utils::RetryTimer RETRY_TIMER;
Expand Down
4 changes: 2 additions & 2 deletions ACL/src/Transport/PostConnectSynchronizer.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* PostConnectSynchronizer.cpp
*
* Copyright 2016-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2016-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.
Expand Down Expand Up @@ -189,7 +189,7 @@ void PostConnectSynchronizer::onContextFailure(const ContextRequestError error)
}

void PostConnectSynchronizer::onSendCompleted(MessageRequestObserverInterface::Status status) {
ACSDK_DEBUG(LX("onSendCompleted").d("status", avsCommon::avs::MessageRequest::statusToString(status)));
ACSDK_DEBUG(LX("onSendCompleted").d("status", status));
if (status == MessageRequestObserverInterface::Status::SUCCESS ||
status == MessageRequestObserverInterface::Status::SUCCESS_NO_CONTENT) {
{
Expand Down
22 changes: 3 additions & 19 deletions ACL/src/Transport/TransportDefines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <vector>

#include "ACL/Transport/TransportDefines.h"

namespace alexaClientSDK {
namespace acl {

/// Table with the retry times on subsequent retries.
int TransportDefines::RETRY_TABLE[] = {
const std::vector<int> TransportDefines::RETRY_TABLE = {
250, // Retry 1: 0.25s
1000, // Retry 2: 1.00s
3000, // Retry 3: 3.00s
Expand All @@ -30,25 +31,8 @@ int TransportDefines::RETRY_TABLE[] = {
20000, // Retry 6: 20.00s
};

/// Size of the retry table.
int TransportDefines::RETRY_TABLE_SIZE = (sizeof(RETRY_TABLE) / sizeof(RETRY_TABLE[0]));

/// Randomization used in the computation of retry times.
int TransportDefines::RETRY_RANDOMIZATION_PERCENTAGE = 50;

/// Lower bound of the interval to distribute the retry duration.
int TransportDefines::RETRY_DECREASE_PERCENTAGE =
(100 * 100) / (TransportDefines::RETRY_RANDOMIZATION_PERCENTAGE + 100);

/// Upper bound of the interval to distribute the retry duration.
int TransportDefines::RETRY_INCREASE_PERCENTAGE = 100 + TransportDefines::RETRY_RANDOMIZATION_PERCENTAGE;

/// Retry Timer object.
avsCommon::utils::RetryTimer TransportDefines::RETRY_TIMER(
TransportDefines::RETRY_TABLE,
TransportDefines::RETRY_TABLE_SIZE,
TransportDefines::RETRY_DECREASE_PERCENTAGE,
TransportDefines::RETRY_INCREASE_PERCENTAGE);
avsCommon::utils::RetryTimer TransportDefines::RETRY_TIMER(TransportDefines::RETRY_TABLE);

} // namespace acl
} // namespace alexaClientSDK
4 changes: 2 additions & 2 deletions ACL/test/Transport/Common/MimeUtils.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MimeUtils.h.h
* MimeUtils.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates.
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
6 changes: 4 additions & 2 deletions ACL/test/Transport/Common/TestableAttachmentManager.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* TestableAttachmentManager.cpp
*
* Copyright 2017 Amazon.com, Inc. or its affiliates.
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates.
*
* 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 @@ -48,7 +48,9 @@ bool TestableAttachmentManager::setAttachmentTimeoutMinutes(std::chrono::minutes
return m_manager->setAttachmentTimeoutMinutes(timeoutMinutes);
}

std::unique_ptr<AttachmentWriter> TestableAttachmentManager::createWriter(const std::string& attachmentId) {
std::unique_ptr<AttachmentWriter> TestableAttachmentManager::createWriter(
const std::string& attachmentId,
avsCommon::utils::sds::WriterPolicy policy) {
// First, let's create a dummy SDS. Otherwise we need to intantiate the writer with nullptr, which is
// probably not a good idea.
auto buffSize = SDSType::calculateBufferSize(DUMMY_SDS_BUFFER_SIZE);
Expand Down
5 changes: 3 additions & 2 deletions ACL/test/Transport/Common/TestableAttachmentManager.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* TestableAttachmentManager.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates.
* Copyright 2017-2018 Amazon.com, Inc. or its affiliates.
*
* 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 @@ -40,7 +40,8 @@ class TestableAttachmentManager : public avsCommon::avs::attachment::AttachmentM
bool setAttachmentTimeoutMinutes(std::chrono::minutes timeoutMinutes) override;

std::unique_ptr<avsCommon::avs::attachment::AttachmentWriter> createWriter(
const std::string& attachmentId) override;
const std::string& attachmentId,
avsCommon::utils::sds::WriterPolicy policy) override;

std::unique_ptr<avsCommon::avs::attachment::AttachmentReader> createReader(
const std::string& attachmentId,
Expand Down
6 changes: 5 additions & 1 deletion ACL/test/Transport/Common/TestableAttachmentWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ TestableAttachmentWriter::TestableAttachmentWriter(
m_hasWriteBeenInvoked{false} {
}

std::size_t TestableAttachmentWriter::write(const void* buf, std::size_t numBytes, WriteStatus* writeStatus) {
std::size_t TestableAttachmentWriter::write(
const void* buf,
std::size_t numBytes,
WriteStatus* writeStatus,
std::chrono::milliseconds timeout) {
bool simulatePause = false;

if (!m_hasWriteBeenInvoked) {
Expand Down
6 changes: 5 additions & 1 deletion ACL/test/Transport/Common/TestableAttachmentWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ class TestableAttachmentWriter : public avsCommon::avs::attachment::InProcessAtt
std::shared_ptr<avsCommon::utils::sds::InProcessSDS> dummySDS,
std::unique_ptr<avsCommon::avs::attachment::AttachmentWriter> writer);

std::size_t write(const void* buf, std::size_t numBytes, WriteStatus* writeStatus) override;
std::size_t write(
const void* buf,
std::size_t numBytes,
WriteStatus* writeStatus,
std::chrono::milliseconds timeout) override;

void close() override;

Expand Down
7 changes: 3 additions & 4 deletions ADSL/src/MessageInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ void MessageInterpreter::receive(const std::string& contextId, const std::string
}

void MessageInterpreter::sendParseValueException(const std::string& key, const std::string& json) {
alexaClientSDK::avsCommon::utils::logger::LogEntry* errorDescription =
&(LX("messageParsingFailed").d("reason", "valueRetrievalFailed").d("key", key).d("payload", json));
ACSDK_ERROR(*errorDescription);
sendExceptionEncounteredHelper(m_exceptionEncounteredSender, json, errorDescription->c_str());
const std::string errorMessage = "reason=valueRetrievalFailed,key=" + key + ",payload=" + json;
ACSDK_ERROR(LX("messageParsingFailed").m(errorMessage));
sendExceptionEncounteredHelper(m_exceptionEncounteredSender, json, errorMessage);
}

} // namespace adsl
Expand Down
4 changes: 2 additions & 2 deletions ADSL/test/common/MockDirectiveHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* DirectiveSequencerTest.cpp
* MockDirectiveHandler.cpp
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand Down
7 changes: 5 additions & 2 deletions AVSCommon/AVS/include/AVSCommon/AVS/Attachment/Attachment.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Attachment.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand All @@ -25,6 +25,7 @@
#include "AVSCommon/AVS/Attachment/AttachmentReader.h"
#include "AVSCommon/AVS/Attachment/AttachmentWriter.h"
#include "AVSCommon/Utils/SDS/InProcessSDS.h"
#include "AVSCommon/Utils/SDS/WriterPolicy.h"

namespace alexaClientSDK {
namespace avsCommon {
Expand Down Expand Up @@ -53,7 +54,9 @@ class Attachment {
*
* @return a @unique_ptr to an AttachmentWriter.
*/
virtual std::unique_ptr<AttachmentWriter> createWriter() = 0;

virtual std::unique_ptr<AttachmentWriter> createWriter(
utils::sds::WriterPolicy policy = utils::sds::WriterPolicy::ALL_OR_NOTHING) = 0;

/**
* Creates a reader object, with which the Attachment may be read from.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* AttachmentManager.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand Down Expand Up @@ -84,7 +84,9 @@ class AttachmentManager : public AttachmentManagerInterface {

bool setAttachmentTimeoutMinutes(std::chrono::minutes timeoutMinutes) override;

std::unique_ptr<AttachmentWriter> createWriter(const std::string& attachmentId) override;
std::unique_ptr<AttachmentWriter> createWriter(
const std::string& attachmentId,
avsCommon::utils::sds::WriterPolicy policy = avsCommon::utils::sds::WriterPolicy::ALL_OR_NOTHING) override;

std::unique_ptr<AttachmentReader> createReader(const std::string& attachmentId, AttachmentReader::Policy policy)
override;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* AttachmentManagerInterface.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand Down Expand Up @@ -88,7 +88,9 @@ class AttachmentManagerInterface {
* @param attachmentId The id of the @c Attachment.
* @return An @c AttachmentWriter.
*/
virtual std::unique_ptr<AttachmentWriter> createWriter(const std::string& attachmentId) = 0;
virtual std::unique_ptr<AttachmentWriter> createWriter(
const std::string& attachmentId,
avsCommon::utils::sds::WriterPolicy policy = avsCommon::utils::sds::WriterPolicy::ALL_OR_NOTHING) = 0;

/**
* Returns a pointer to an @c AttachmentReader.
Expand Down
18 changes: 14 additions & 4 deletions AVSCommon/AVS/include/AVSCommon/AVS/Attachment/AttachmentWriter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* AttachmentWriter.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand Down Expand Up @@ -40,10 +40,13 @@ class AttachmentWriter {
CLOSED,
/// The write could not succeed due to the underlying buffer being full.
OK_BUFFER_FULL,
/// The number of bytes in the request is smaller than the word-size of the underlying data representation.
/// The number of bytes in the request is smaller than the word-size of the underlying data representation. This
/// is only posible if the policy is ALL_OR_NOTHING.
ERROR_BYTES_LESS_THAN_WORD_SIZE,
/// A non-specified error occurred.
ERROR_INTERNAL
ERROR_INTERNAL,
/// The write timed out. This is only possible if the writer policy is BLOCKING.
TIMEDOUT
};

/**
Expand All @@ -57,9 +60,16 @@ class AttachmentWriter {
* @param buf The buffer where data should be copied from.
* @param numBytes The size of the buffer in bytes.
* @param[out] writeStatus The out-parameter where the resulting state of the write will be expressed.
* @param timeout The maximum time to wait (if @c policy is @c BLOCKING) for space to write into. If this parameter
* is zero, there is no timeout and blocking writes will wait forever. If @c policy is not @C BLOCKING, this
* parameter is ignored.
* @return The number of bytes written as a result of this call.
*/
virtual std::size_t write(const void* buf, std::size_t numBytes, WriteStatus* writeStatus) = 0;
virtual std::size_t write(
const void* buf,
std::size_t numBytes,
WriteStatus* writeStatus,
std::chrono::milliseconds timeout = std::chrono::milliseconds(0)) = 0;

/**
* The close function. An implementation will take care of any resource management when a writer no longer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* InProcessAttachment.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand Down Expand Up @@ -49,7 +49,9 @@ class InProcessAttachment : public Attachment {
*/
InProcessAttachment(const std::string& id, std::unique_ptr<SDSType> sds = nullptr);

std::unique_ptr<AttachmentWriter> createWriter() override;
std::unique_ptr<AttachmentWriter> createWriter(
InProcessAttachmentWriter::SDSTypeWriter::Policy policy =
InProcessAttachmentWriter::SDSTypeWriter::Policy::ALL_OR_NOTHING) override;

std::unique_ptr<AttachmentReader> createReader(AttachmentReader::Policy policy) override;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* InProcessAttachmentWriter.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand Down Expand Up @@ -43,16 +43,23 @@ class InProcessAttachmentWriter : public AttachmentWriter {
* Create an InProcessAttachmentWriter.
*
* @param sds The underlying @c SharedDataStream which this object will use.
* @param policy The policy of the new Writer.
* @return Returns a new InProcessAttachmentWriter, or nullptr if the operation failed.
*/
static std::unique_ptr<InProcessAttachmentWriter> create(std::shared_ptr<SDSType> sds);
static std::unique_ptr<InProcessAttachmentWriter> create(
std::shared_ptr<SDSType> sds,
SDSTypeWriter::Policy policy = SDSTypeWriter::Policy::ALL_OR_NOTHING);

/**
* Destructor.
*/
~InProcessAttachmentWriter();

std::size_t write(const void* buf, std::size_t numBytes, WriteStatus* writeStatus) override;
std::size_t write(
const void* buf,
std::size_t numBytes,
WriteStatus* writeStatus,
std::chrono::milliseconds timeout = std::chrono::milliseconds(0)) override;

void close() override;

Expand All @@ -61,8 +68,11 @@ class InProcessAttachmentWriter : public AttachmentWriter {
* Constructor.
*
* @param sds The underlying @c SharedDataStream which this object will use.
* @param policy The policy of the new Writer.
*/
InProcessAttachmentWriter(std::shared_ptr<SDSType> sds);
InProcessAttachmentWriter(
std::shared_ptr<SDSType> sds,
SDSTypeWriter::Policy policy = SDSTypeWriter::Policy::ALL_OR_NOTHING);

/// The underlying @c SharedDataStream reader.
std::shared_ptr<SDSTypeWriter> m_writer;
Expand Down
4 changes: 2 additions & 2 deletions AVSCommon/AVS/include/AVSCommon/AVS/ExceptionErrorType.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* ExceptionEncountered.h
* ExceptionErrorType.h
*
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright 2017-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.
Expand Down
Loading

0 comments on commit 5259a2f

Please sign in to comment.