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

Commit 5e49fdf

Browse files
author
Vishnu Karpuram
committed
Version 2.9.1 alexa-smart-screen-sdk
*** Bug Fixes *** * Fixed hold-to-talk event handling logic in the native layer to keep it in sync with GUI *** Enhancements *** * Upgraded dependency to APL Client Library 1.8.3 * Upgraded nanoid version to 3.2.0, minimist version to 1.2.6 and refreshed the package-lock.json with new dependencies. Note that users upgrading to this version will need to remove the existing node modules from modules/GUI/js/node_modules before the build.
1 parent fca0701 commit 5e49fdf

File tree

26 files changed

+264
-115
lines changed

26 files changed

+264
-115
lines changed

CHANGELOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
### v2.9.0 released 12/16/2021:
1+
### v2.9.1 released 04/05/2022:
2+
#### Bug fixes
3+
* Fixed hold-to-talk event handling logic in the native layer to keep it in sync with GUI
4+
5+
#### Enhancements
6+
* Upgraded dependency to APL Client Library 1.8.3
7+
* Upgraded nanoid version to 3.2.0, minimist version to 1.2.6 and refreshed the package-lock.json with new dependencies. Note that users upgrading to this version will need to remove the existing node modules from modules/GUI/js/node_modules before the build.
28

9+
### v2.9.0 released 12/16/2021:
310
#### Breaking Changes
411
* Decoupled APL Client Library and APL Core Engine build from Smart Screen SDK. Please follow new build instructions here [https://developer.amazon.com/en-US/docs/alexa/alexa-smart-screen-sdk/overview.html]
512

@@ -82,7 +89,6 @@
8289
* Fixed a regression introduced in 2.4 wherein keyboard events no longer interrupted TTS and APL activity
8390

8491
### v2.4.0 released 11/09/2020:
85-
8692
#### Enhancements
8793
* Upgraded dependency to Device SDK 1.21.0 [https://github.com/alexa/avs-device-sdk/tree/v1.21.0]
8894
* Added DND Support
@@ -92,7 +98,6 @@
9298
* Fixed an issue where the sample app automatically goes into the listening mode when prompted by a skill
9399

94100
### v2.3.0 released 09/24/2020:
95-
96101
#### Enhancements
97102
* Upgraded dependency to Device SDK 1.20.1 [https://github.com/alexa/avs-device-sdk/tree/v1.20.1]
98103
* Support for APL 1.4 [https://developer.amazon.com/en-US/docs/alexa/alexa-presentation-language/apl-changes-1-4.html]
@@ -107,7 +112,6 @@
107112
* Fixed import content failure cache update
108113

109114
### v2.2.0 released 07/13/2020:
110-
111115
#### Enhancements
112116
* Upgraded dependency to Device SDK 1.20.0
113117
* Optimization for APL package import latency
@@ -131,7 +135,6 @@
131135
* The AVS Device SDK must be built with an additional flag: `-DRAPIDJSON_MEM_OPTIMIZATION=OFF`
132136

133137
### v2.1.0 released 06/02/2020:
134-
135138
#### Enhancements
136139
* Upgraded dependency to Device SDK 1.19.1
137140
* Provided a reference implementation for rendering of captions
@@ -156,7 +159,6 @@
156159
* Progress bar on Now Playing display card does not reflect the actual audio offset when such information is not provided in RenderPlayerInfo directive
157160

158161
### v2.0.2 released 04/14/2020:
159-
160162
#### Bug fixes
161163
* Added support for Raspbian Buster.
162164
* Upgrade dependency on Device SDK 1.19
@@ -174,7 +176,6 @@
174176
* The build option ENABLE_CAPTIONS does not enable captions. Enabling it will cause undefined behaviour during a build.
175177

176178
### v2.0.1 released 11/26/2019:
177-
178179
#### Bug Fixes
179180
* Fixed segfault is situation when bad Misc DB path was provided in configuration.
180181
* Fixed situation where video playback controls were unresponsive on some skills.
@@ -185,7 +186,6 @@
185186
* In rare cases button presses could trigger repeat speech.
186187

187188
### v2.0 released 11/16/2019:
188-
189189
Initial public release
190190

191191
#### Known Issues

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
22

3-
project(AlexaSmartScreenSDK VERSION 2.9.0 LANGUAGES CXX)
3+
project(AlexaSmartScreenSDK VERSION 2.9.1 LANGUAGES CXX)
44
set(PROJECT_BRIEF "A cross-platform, modular SDK for multi modal interaction with the Alexa Voice Service")
55
configure_file (
66
"${PROJECT_SOURCE_DIR}/modules/Alexa/Utils/include/Utils/SmartScreenSDKVersion.h.in"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Alexa Smart Screen SDK
22

33
<p>
4-
<a href="https://github.com/alexa/alexa-smart-screen-sdk/tree/v2.9.0" alt="version">
5-
<img src="https://img.shields.io/badge/stable%20version-2.9.0-brightgreen" /></a>
4+
<a href="https://github.com/alexa/alexa-smart-screen-sdk/tree/v2.9.1" alt="version">
5+
<img src="https://img.shields.io/badge/stable%20version-2.9.1-brightgreen" /></a>
66
<a href="https://github.com/alexa/avs-device-sdk/tree/v1.26.0" alt="DeviceSDK">
77
<img src="https://img.shields.io/badge/avs%20device%20sdk-1.26.0-blueviolet" /></a>
8-
<a href="https://github.com/alexa/apl-client-library/tree/v1.8.2" alt="APLClientLibrary">
9-
<img src="https://img.shields.io/badge/apl%20client%20library-1.8.2-blue" /></a>
8+
<a href="https://github.com/alexa/apl-client-library/tree/v1.8.3" alt="APLClientLibrary">
9+
<img src="https://img.shields.io/badge/apl%20client%20library-1.8.3-blue" /></a>
1010
<a href="https://github.com/alexa/alexa-smart-screen-sdk/issues" alt="issues">
1111
<img src="https://img.shields.io/github/issues/alexa/alexa-smart-screen-sdk" /></a>
1212
</p>

modules/Alexa/ApplicationUtilities/Communication/src/WebSocketServer.cpp

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,30 @@ bool WebSocketServer::start() {
9999
}
100100
#endif
101101

102-
websocketpp::lib::error_code errorCode;
102+
try {
103+
websocketpp::lib::error_code errorCode;
103104

104-
m_webSocketServer.start_accept(errorCode);
105-
if (errorCode) {
106-
ACSDK_ERROR(LX("server::start_accept")
107-
.d("errorCode", errorCode.value())
108-
.d("errorCategory", errorCode.category().name()));
109-
return false;
110-
}
105+
m_webSocketServer.start_accept(errorCode);
106+
if (errorCode) {
107+
ACSDK_ERROR(LX("server::start_accept")
108+
.d("errorCode", errorCode.value())
109+
.d("errorCategory", errorCode.category().name()));
110+
return false;
111+
}
111112

112-
auto endpoint = m_webSocketServer.get_local_endpoint(errorCode);
113-
if (errorCode) {
114-
ACSDK_ERROR(LX("server::get_local_endpoint")
115-
.d("errorCode", errorCode.value())
116-
.d("errorCategory", errorCode.category().name()));
117-
return false;
118-
}
113+
auto endpoint = m_webSocketServer.get_local_endpoint(errorCode);
114+
if (errorCode) {
115+
ACSDK_ERROR(LX("server::get_local_endpoint")
116+
.d("errorCode", errorCode.value())
117+
.d("errorCategory", errorCode.category().name()));
118+
return false;
119+
}
119120

120-
ACSDK_INFO(LX("Listening for websocket connections").d("interface", endpoint.address()).d("port", endpoint.port()));
121+
ACSDK_INFO(
122+
LX("Listening for websocket connections").d("interface", endpoint.address()).d("port", endpoint.port()));
123+
} catch (const std::bad_weak_ptr& e) {
124+
ACSDK_ERROR(LX("std::bad_weak_ptr").d("reason", e.what()));
125+
}
121126

122127
m_webSocketServer.run();
123128

modules/Alexa/ApplicationUtilities/SmartScreenClient/include/SmartScreenClient/SmartScreenClient.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,11 +1137,11 @@ AudioInputProcessor.
11371137

11381138
/**
11391139
* Handle execute command result.
1140-
* @param token The token.
1141-
* @param result The execute command result.
1142-
* @param error The error.
1140+
* @param token the execute command result token.
1141+
* @param event the command execution event.
1142+
* @param message the execute command completion message.
11431143
*/
1144-
void handleExecuteCommandsResult(const std::string& token, bool result, std::string error);
1144+
void handleExecuteCommandsResult(const std::string& token, const std::string& event, const std::string& message);
11451145

11461146
/**
11471147
* Handle activity event.

modules/Alexa/ApplicationUtilities/SmartScreenClient/src/SmartScreenClient.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <acsdkBluetooth/BluetoothMediaInputTransformer.h>
5959
#endif
6060

61+
#include <AlexaPresentation/AplCommandsExecutionEvent.h>
6162
#include <SDKComponent/SDKComponent.h>
6263

6364
#include "SmartScreenClient/DefaultClientComponent.h"
@@ -1942,8 +1943,14 @@ void SmartScreenClient::handleRenderDocumentResult(const std::string& token, boo
19421943
m_alexaPresentation->processRenderDocumentResult(token, result, error);
19431944
}
19441945

1945-
void SmartScreenClient::handleExecuteCommandsResult(const std::string& token, bool result, std::string error) {
1946-
m_alexaPresentation->processExecuteCommandsResult(token, result, error);
1946+
void SmartScreenClient::handleExecuteCommandsResult(
1947+
const std::string& token,
1948+
const std::string& event,
1949+
const std::string& message) {
1950+
m_alexaPresentation->processExecuteCommandsResult(
1951+
token,
1952+
alexaSmartScreenSDK::smartScreenCapabilityAgents::alexaPresentation::stringToCommandExecutionEvent(event),
1953+
message);
19471954
}
19481955

19491956
void SmartScreenClient::handleActivityEvent(

modules/Alexa/SampleApp/include/SampleApp/AplClientBridge.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ class AplClientBridge
8282

8383
void onSendEvent(const std::string& token, const std::string& event) override;
8484

85-
void onCommandExecutionComplete(const std::string& token, bool result) override;
85+
void onCommandExecutionComplete(
86+
const std::string& token,
87+
APLClient::AplCommandExecutionEvent event,
88+
const std::string& message) override;
8689

8790
void onRenderDocumentComplete(const std::string& token, bool result, const std::string& error) override;
8891

modules/Alexa/SampleApp/include/SampleApp/GUI/GUIClient.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,11 +374,18 @@ class GUIClient
374374
void executeHandleTapToTalk(rapidjson::Document& message);
375375

376376
/**
377-
* Handle HoldToTalk event.
377+
* Handle HoldToTalkStart event.
378378
*
379379
* @param message A complete message object with header and payload.
380380
*/
381-
void executeHandleHoldToTalk(rapidjson::Document& message);
381+
void executeHandleHoldToTalkStart(rapidjson::Document& message);
382+
383+
/**
384+
* Handle HoldToTalkEnd event.
385+
*
386+
* @param message A complete message object with header and payload.
387+
*/
388+
void executeHandleHoldToTalkEnd(rapidjson::Document& message);
382389

383390
/**
384391
* Handle focus acquire requests.

modules/Alexa/SampleApp/include/SampleApp/GUI/GUIManager.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class GUIManager
178178
/// @{
179179
void handleTapToTalk() override;
180180

181-
void handleHoldToTalk() override;
181+
void handleHoldToTalk(bool start) override;
182182

183183
void handleMicrophoneToggle() override;
184184

@@ -219,7 +219,8 @@ class GUIManager
219219

220220
void handleRenderDocumentResult(std::string token, bool result, std::string error) override;
221221

222-
void handleExecuteCommandsResult(std::string token, bool result, std::string error) override;
222+
void handleExecuteCommandsResult(const std::string& token, const std::string& event, const std::string& message)
223+
override;
223224

224225
void handleActivityEvent(
225226
alexaSmartScreenSDK::smartScreenSDKInterfaces::ActivityEvent event,
@@ -469,9 +470,6 @@ class GUIManager
469470
/// The wake word audio provider.
470471
alexaClientSDK::capabilityAgents::aip::AudioProvider m_wakeWordAudioProvider;
471472

472-
/// Whether a hold is currently occurring.
473-
bool m_isHoldOccurring;
474-
475473
/// Whether a tap is currently occurring.
476474
bool m_isTapOccurring;
477475

modules/Alexa/SampleApp/src/AplClientBridge.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,14 @@ void AplClientBridge::onSendEvent(const std::string& token, const std::string& e
150150
m_executor.submit([this, token, event] { m_guiManager->handleUserEvent(token, event); });
151151
}
152152

153-
void AplClientBridge::onCommandExecutionComplete(const std::string& token, bool result) {
153+
void AplClientBridge::onCommandExecutionComplete(
154+
const std::string& token,
155+
APLClient::AplCommandExecutionEvent event,
156+
const std::string& message) {
154157
ACSDK_DEBUG9(LX(__func__));
155-
m_executor.submit([this, token, result] { m_guiManager->handleExecuteCommandsResult(token, result, ""); });
158+
m_executor.submit([this, token, event, message] {
159+
m_guiManager->handleExecuteCommandsResult(token, APLClient::commandExecutionEventToString(event), message);
160+
});
156161
}
157162

158163
void AplClientBridge::onRenderDocumentComplete(const std::string& token, bool result, const std::string& error) {
@@ -362,6 +367,11 @@ void AplClientBridge::executeCommands(const std::string& jsonPayload, const std:
362367
auto aplClientRenderer = getAplClientRendererFromAplToken(token);
363368
if (aplClientRenderer) {
364369
aplClientRenderer->executeCommands(jsonPayload, token);
370+
} else {
371+
m_guiManager->handleExecuteCommandsResult(
372+
token,
373+
APLClient::commandExecutionEventToString(APLClient::AplCommandExecutionEvent::FAILED),
374+
"No document renderer instance for token.");
365375
}
366376
});
367377
}

modules/Alexa/SampleApp/src/GUI/GUIClient.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ static const std::string MESSAGE_TYPE_INIT_RESPONSE("initResponse");
3535
/// The message type for Tap To Talk.
3636
static const std::string MESSAGE_TYPE_TAP_TO_TALK("tapToTalk");
3737

38-
/// The message type for Hold To Talk.
39-
static const std::string MESSAGE_TYPE_HOLD_TO_TALK("holdToTalk");
38+
/// The message type for Hold To Talk start.
39+
static const std::string MESSAGE_TYPE_HOLD_TO_TALK_START("holdToTalkStart");
40+
41+
/// The message type for Hold To Talk end.
42+
static const std::string MESSAGE_TYPE_HOLD_TO_TALK_END("holdToTalkEnd");
4043

4144
/// The message type for Focus acquire request.
4245
static const std::string MESSAGE_TYPE_FOCUS_ACQUIRE_REQUEST("focusAcquireRequest");
@@ -331,8 +334,11 @@ GUIClient::GUIClient(
331334
m_captionManager{SmartScreenCaptionStateManager(miscStorage)} {
332335
m_messageHandlers.emplace(
333336
MESSAGE_TYPE_TAP_TO_TALK, [this](rapidjson::Document& payload) { executeHandleTapToTalk(payload); });
337+
m_messageHandlers.emplace(MESSAGE_TYPE_HOLD_TO_TALK_START, [this](rapidjson::Document& payload) {
338+
executeHandleHoldToTalkStart(payload);
339+
});
334340
m_messageHandlers.emplace(
335-
MESSAGE_TYPE_HOLD_TO_TALK, [this](rapidjson::Document& payload) { executeHandleHoldToTalk(payload); });
341+
MESSAGE_TYPE_HOLD_TO_TALK_END, [this](rapidjson::Document& payload) { executeHandleHoldToTalkEnd(payload); });
336342
m_messageHandlers.emplace(MESSAGE_TYPE_FOCUS_ACQUIRE_REQUEST, [this](rapidjson::Document& payload) {
337343
executeHandleFocusAcquireRequest(payload);
338344
});
@@ -608,8 +614,12 @@ void GUIClient::executeHandleTapToTalk(rapidjson::Document& message) {
608614
m_guiManager->handleTapToTalk();
609615
}
610616

611-
void GUIClient::executeHandleHoldToTalk(rapidjson::Document& message) {
612-
m_guiManager->handleHoldToTalk();
617+
void GUIClient::executeHandleHoldToTalkStart(rapidjson::Document& message) {
618+
m_guiManager->handleHoldToTalk(true);
619+
}
620+
621+
void GUIClient::executeHandleHoldToTalkEnd(rapidjson::Document& message) {
622+
m_guiManager->handleHoldToTalk(false);
613623
}
614624

615625
void GUIClient::executeHandleAcceptCall(rapidjson::Document& message) {

modules/Alexa/SampleApp/src/GUI/GUIManager.cpp

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ GUIManager::GUIManager(
127127
m_playerActivityState{PlayerActivity::FINISHED} {
128128
m_guiClient = guiClient;
129129
m_isMicOn = true;
130-
m_isHoldOccurring = false;
131130
m_isTapOccurring = false;
132131
m_isSpeakingOrListening = false;
133132
m_clearAlertChannelOnForegrounded = false;
@@ -240,15 +239,20 @@ void GUIManager::handleTapToTalk() {
240239
;
241240
}
242241

243-
void GUIManager::handleHoldToTalk() {
244-
ACSDK_DEBUG9(LX("handleHoldToTalk"));
245-
m_executor.submit([this]() {
242+
void GUIManager::handleHoldToTalk(bool start) {
243+
ACSDK_DEBUG9(LX(__func__).d("start", start));
244+
m_executor.submit([this, start]() {
246245
handleASRProfileChanged(m_holdToTalkAudioProvider.profile);
247246
if (!m_isMicOn) {
248247
return;
249248
}
250249
bool activeCameraWithMicrophone = false;
251250

251+
// Set the value of @c isHoldOccurring to what UI thinks it should be.
252+
// There could be circumstances where the user applications might fall out
253+
// of sync with SDK about the status of hold-to-talk.
254+
bool isHoldOccurring = !start;
255+
252256
#ifdef ENABLE_RTCSC
253257
// Mic input is fully routed to active camera and not Alexa AIP when:
254258
// - ASR Profile is CLOSE_TALK (physical remote mic input)
@@ -264,12 +268,12 @@ void GUIManager::handleHoldToTalk() {
264268
smartScreenSDKInterfaces::AudioState::UNKNOWN != m_cameraMicrophoneAudioState) &&
265269
smartScreenSDKInterfaces::ConcurrentTwoWayTalk::UNKNOWN != m_cameraConcurrentTwoWayTalk);
266270
#endif
267-
if (!m_isHoldOccurring) {
271+
if (!isHoldOccurring) {
268272
// If we have no active 2-way talk camera, route mic input to Alexa AIP provider as usual.
269-
m_isHoldOccurring =
273+
isHoldOccurring =
270274
activeCameraWithMicrophone || m_ssClient->notifyOfHoldToTalkStart(m_holdToTalkAudioProvider).get();
271275
} else {
272-
m_isHoldOccurring = false;
276+
isHoldOccurring = false;
273277
if (!activeCameraWithMicrophone) {
274278
m_ssClient->notifyOfHoldToTalkEnd();
275279
}
@@ -279,9 +283,9 @@ void GUIManager::handleHoldToTalk() {
279283
// If we have an active 2-way camera, enable/disable its microphone.
280284
if (activeCameraWithMicrophone) {
281285
// Set camera mic state
282-
handleSetCameraMicrophoneState(m_isHoldOccurring);
286+
handleSetCameraMicrophoneState(isHoldOccurring);
283287
// Inform GUI of camera mic state
284-
m_guiClient->handleCameraMicrophoneStateChanged(m_isHoldOccurring);
288+
m_guiClient->handleCameraMicrophoneStateChanged(isHoldOccurring);
285289
}
286290
#endif
287291
});
@@ -580,9 +584,12 @@ void GUIManager::handleRenderDocumentResult(std::string token, bool result, std:
580584
m_executor.submit([this, result, token, error]() { m_ssClient->handleRenderDocumentResult(token, result, error); });
581585
}
582586

583-
void GUIManager::handleExecuteCommandsResult(std::string token, bool result, std::string error) {
587+
void GUIManager::handleExecuteCommandsResult(
588+
const std::string& token,
589+
const std::string& event,
590+
const std::string& message) {
584591
m_executor.submit(
585-
[this, token, result, error]() { m_ssClient->handleExecuteCommandsResult(token, result, error); });
592+
[this, token, event, message]() { m_ssClient->handleExecuteCommandsResult(token, event, message); });
586593
}
587594

588595
void GUIManager::handleActivityEvent(smartScreenSDKInterfaces::ActivityEvent event, const std::string& source) {

0 commit comments

Comments
 (0)