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

Commit

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

**Enhancements**

* New optional configuration for [EqualizerController](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L154). The EqualizerController interface allows you to adjust equalizer settings on your product, such as decibel (dB) levels and modes.
* Added reference implementation of the EqualizerController for GStreamer-based (MacOS, Linux, and Raspberry Pi) and OpenSL ES-based (Android) MediaPlayers. Note: In order to use with Android, it must support OpenSL ES.
* New optional configuration for the [TemplateRuntime display card value](https://github.com/alexa/avs-device-sdk/blob/v1.10.0/Integration/AlexaClientSDKConfig.json#L144).
* A configuration file generator script, `genConfig.sh` is now included with the SDK in the **tools/Install** directory. `genConfig.sh` and it's associated arguments populate `AlexaClientSDKConfig.json` with the data required to authorize with LWA.
* Added Bluetooth A2DP source and AVRCP target support for Linux.
* Added Amazon for Business (A4B) support, which includes support for handling the new [RevokeAuthorization](https://developer.amazon.com/docs/alexa-voice-service/system.html#revokeauth) directive in the Settings interface. A new CMake option has been added to enable A4B within the SDK, `-DA4B`.
* Added locale support for IT and ES.
* The Alexa Communication Library (ACL), `CBLAUthDelegate`, and sample app have been enhanced to detect de-authorization using the new `z` command.
* Added `ExternalMediaPlayerObserver`, which receives notification of player state, track, and username changes.
* `HTTP2ConnectionInterface` was factored out of `HTTP2Transport` to enable unit testing of `HTTP2Transport` and re-use of `HTTP2Connection` logic.

**Bug Fixes**

* Fixed a bug in which `ExternalMediaPlayer` adapter playback wasn't being recognized by AVS.
* [Issue 973](#973) - Fixed issues related to `AudioPlayer` where progress reports were being sent out of order or with incorrect offsets.
* An `EXPECTING`, state has been added to `DialogUXState` in order to handle `EXPECT_SPEECH` state for hold-to-talk devices.
* [Issue 948](#948) - Fixed a bug in which the sample app was stuck in a listening state.
* Fixed a bug where there was a delay between receiving a `DeleteAlert` directive, and deleting the alert.
* [Issue 839](#839) - Fixed an issue where speech was being truncated due to the `DialogUXStateAggregator` transitioning between a `THINKING` and `IDLE` state.
* Fixed a bug in which the `AudioPlayer` attempted to play when it wasn't in the `FOREGROUND` focus.
* `CapabilitiesDelegateTest` now works on Android.
* [Issue 950](#950) - Improved Android Media Player audio quality.
* [Issue 908](#908) - Fixed compile error on g++ 7.x in which includes were missing.
  • Loading branch information
scotthea-amazon committed Oct 24, 2018
1 parent 9090ca5 commit f1696fc
Show file tree
Hide file tree
Showing 325 changed files with 24,429 additions and 5,170 deletions.
84 changes: 84 additions & 0 deletions ACL/include/ACL/Transport/DownchannelHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* 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_ACL_INCLUDE_ACL_TRANSPORT_DOWNCHANNELHANDLER_H_
#define ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_DOWNCHANNELHANDLER_H_

#include <memory>

#include <AVSCommon/AVS/Attachment/AttachmentManager.h>
#include <AVSCommon/Utils/HTTP2/HTTP2RequestSourceInterface.h>

#include "ACL/Transport/ExchangeHandler.h"
#include "ACL/Transport/MessageConsumerInterface.h"
#include "ACL/Transport/MimeResponseStatusHandlerInterface.h"

namespace alexaClientSDK {
namespace acl {

class DownchannelHandler;

/**
* Handle the HTTP2 request and response that establishes and services the downchannel of an connection to AVS.
*/
class DownchannelHandler
: public ExchangeHandler
, public avsCommon::utils::http2::HTTP2RequestSourceInterface
, public MimeResponseStatusHandlerInterface
, public std::enable_shared_from_this<DownchannelHandler> {
public:
/**
* Create a DownchannelHandler, and send the downchannel request.
*
* @param context The ExchangeContext in which this MessageRequest handler will operate.
* @param authToken The token to use to authorize the request.
* @param messageConsumer Object to send decoded messages to.
* @param attachmentManager Object with which to get attachments to write to.
* @return The new DownchannelHandler or nullptr if the operation failed.
*/
static std::shared_ptr<DownchannelHandler> create(
std::shared_ptr<ExchangeHandlerContextInterface> context,
const std::string& authToken,
std::shared_ptr<MessageConsumerInterface> messageConsumer,
std::shared_ptr<avsCommon::avs::attachment::AttachmentManager> attachmentManager);

private:
/**
* Constructor.
*
* @param context The ExchangeContext in which this MessageRequest handler will operate.
* @param authToken The token to use to authorize the request.
*/
DownchannelHandler(std::shared_ptr<ExchangeHandlerContextInterface> context, const std::string& authToken);

/// @name HTTP2RequestSourceInterface methods
/// @{
std::vector<std::string> getRequestHeaderLines() override;
avsCommon::utils::http2::HTTP2SendDataResult onSendData(char* bytes, size_t size) override;
/// @}

/// @name MimeResponseStatusHandlerInterface
/// @{
void onActivity() override;
bool onReceiveResponseCode(long responseCode) override;
void onResponseFinished(avsCommon::utils::http2::HTTP2ResponseFinishedStatus status, const std::string& nonMimeBody)
override;
/// @}
};

} // namespace acl
} // namespace alexaClientSDK

#endif // ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_DOWNCHANNELHANDLER_H_
60 changes: 60 additions & 0 deletions ACL/include/ACL/Transport/ExchangeHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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_ACL_INCLUDE_ACL_TRANSPORT_EXCHANGEHANDLER_H_
#define ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_EXCHANGEHANDLER_H_

#include <memory>

#include "ACL/Transport/ExchangeHandlerContextInterface.h"

namespace alexaClientSDK {
namespace acl {

class HTTP2Transport;

/**
* Common base class for HTTP2 request / response exchanges with AVS.
*/
class ExchangeHandler {
public:
/**
* Constructor.
*
* @param context The context in which this HTTP2 request / reply exchange will be performed.
* @param authToken The authorization token to send in the request.
*/
ExchangeHandler(std::shared_ptr<ExchangeHandlerContextInterface> context, const std::string& authToken);

/**
* Destructor
*/
virtual ~ExchangeHandler() = default;

protected:
/// The @c HTTP2Transport instance for which this exchange is to be performed.
std::shared_ptr<ExchangeHandlerContextInterface> m_context;

/// The auth token used to make the request.
const std::string m_authToken;

/// The AVS authorization header to send in the request.
const std::string m_authHeader;
};

} // namespace acl
} // namespace alexaClientSDK

#endif // ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_EXCHANGEHANDLER_H_
112 changes: 112 additions & 0 deletions ACL/include/ACL/Transport/ExchangeHandlerContextInterface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* 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_ACL_INCLUDE_ACL_TRANSPORT_EXCHANGEHANDLERCONTEXTINTERFACE_H_
#define ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_EXCHANGEHANDLERCONTEXTINTERFACE_H_

#include <memory>
#include <string>

#include <AVSCommon/Utils/HTTP2/HTTP2RequestConfig.h>
#include <AVSCommon/Utils/HTTP2/HTTP2RequestInterface.h>

namespace alexaClientSDK {
namespace acl {

/**
* Interface providing context that an ExchangeHandler operates within.
*/
class ExchangeHandlerContextInterface {
public:
/**
* Destructor
*/
virtual ~ExchangeHandlerContextInterface() = default;

/**
* Notification that the downchannel has been established.
*/
virtual void onDownchannelConnected() = 0;

/**
* Notification that the downchannel has failed to be established or has disconnected.
*/
virtual void onDownchannelFinished() = 0;

/**
* Notification that an @c MessgeRequest has been sent.
*/
virtual void onMessageRequestSent() = 0;

/**
* Notification that sending a message request timed out.
*/
virtual void onMessageRequestTimeout() = 0;

/**
* Notification that sending a @c MessageRequest has failed or been acknowledged by AVS
* (this is used to indicate it is okay to send the next message).
*/
virtual void onMessageRequestAcknowledged() = 0;

/**
* Notification tht a message request has finished it's exchange with AVS.
*/
virtual void onMessageRequestFinished() = 0;

/**
* Notification that sending a ping to AVS has failed or been acknowledged by AVS.
*
* @param success Whether the ping was acknowledged successfully.
*/
virtual void onPingRequestAcknowledged(bool success) = 0;

/**
* Notification that a ping request timed out.
*/
virtual void onPingTimeout() = 0;

/**
* Notification of network activity between this client and AVS.
* (this is used to detect sustained inactivity requiring the send of a ping).
*/
virtual void onActivity() = 0;

/**
* Notification that a request received a FORBIDDEN (403) response.
*
* @param authToken The auth token used for the forbidden request or an empty string if the token is not specified.
*/
virtual void onForbidden(const std::string& authToken = "") = 0;

/**
* Create an HTTP2Request for this HTTP2Transport.
*
* @param cfg The configuration object which defines the request.
* @return The new instance of HTTP2RequestInterface, or nullptr if the operation failed.
*/
virtual std::shared_ptr<avsCommon::utils::http2::HTTP2RequestInterface> createAndSendRequest(
const avsCommon::utils::http2::HTTP2RequestConfig& cfg) = 0;

/**
* Get AVS endpoint to send request to.
*/
virtual std::string getEndpoint() = 0;
};

} // namespace acl
} // namespace alexaClientSDK

#endif // ALEXA_CLIENT_SDK_ACL_INCLUDE_ACL_TRANSPORT_EXCHANGEHANDLERCONTEXTINTERFACE_H_
Loading

0 comments on commit f1696fc

Please sign in to comment.