AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
WindowManagerNamespace.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_IPC_NAMESPACES_WINDOWMANAGERNAMESPACE_H_
17 #define ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_IPC_NAMESPACES_WINDOWMANAGERNAMESPACE_H_
18 
19 #include <string>
20 
21 #include <rapidjson/document.h>
22 
24 
25 namespace alexaClientSDK {
26 namespace sampleApplications {
27 namespace ipcServerSampleApp {
28 namespace ipc {
29 namespace IPCNamespaces {
30 
32 static const char IPC_MSG_NAMESPACE_WINDOW_MANAGER[] = "WindowManager";
33 
35 static const char IPC_MSG_NAME_SET_VISUAL_CHARACTERISTICS[] = "setVisualCharacteristics";
36 
38 static const char IPC_MSG_NAME_CLEAR_WINDOW[] = "clearWindow";
39 
41 static const char IPC_MSG_DEVICE_DISPLAY_TAG[] = "deviceDisplay";
42 
44 static const char IPC_MSG_INTERACTION_MODES_TAG[] = "interactionModes";
45 
47 static const char IPC_MSG_WINDOW_TEMPLATES_TAG[] = "windowTemplates";
48 
50 static const int IPC_MSG_VERSION_WINDOW_MANAGER(1);
51 
54 
56 static const char VISUAL_CHARACTERISTICS_CAPABILITY_CONFIG_INTERACTION_MODES_TAG[] = "interactionModes";
57 
60 
66 public:
75  const avsCommon::utils::Optional<std::string>& displayCharacteristics,
76  const avsCommon::utils::Optional<std::string>& interactionModes,
77  const avsCommon::utils::Optional<std::string>& windowTemplates) :
78  Message(
79  IPC_MSG_NAMESPACE_WINDOW_MANAGER,
81  IPC_MSG_NAME_SET_VISUAL_CHARACTERISTICS) {
82  rapidjson::Value payload(rapidjson::kObjectType);
83  rapidjson::Document messageDocument(&alloc());
84 
85  if (displayCharacteristics.hasValue()) {
86  payload.AddMember(
87  IPC_MSG_DEVICE_DISPLAY_TAG,
88  messageDocument.Parse(
89  displayCharacteristics.value())[VISUAL_CHARACTERISTICS_CAPABILITY_CONFIG_DISPLAY_TAG],
90  alloc());
91  }
92 
93  if (interactionModes.hasValue()) {
94  payload.AddMember(
95  IPC_MSG_INTERACTION_MODES_TAG,
96  messageDocument.Parse(
97  interactionModes.value())[VISUAL_CHARACTERISTICS_CAPABILITY_CONFIG_INTERACTION_MODES_TAG],
98  alloc());
99  }
100 
101  if (windowTemplates.hasValue()) {
102  payload.AddMember(
103  IPC_MSG_WINDOW_TEMPLATES_TAG,
104  messageDocument.Parse(
105  windowTemplates.value())[VISUAL_CHARACTERISTICS_CAPABILITY_CONFIG_WINDOW_TEMPLATES_TAG],
106  alloc());
107  }
108 
109  setPayload(std::move(payload));
110  }
111 };
112 
117 public:
123  explicit ClearWindowMessage(const std::string& windowId) :
124  Message(IPC_MSG_NAMESPACE_WINDOW_MANAGER, IPC_MSG_VERSION_WINDOW_MANAGER, IPC_MSG_NAME_CLEAR_WINDOW) {
125  setWindowIdInPayload(windowId);
126  addPayload();
127  }
128 };
129 
130 } // namespace IPCNamespaces
131 } // namespace ipc
132 } // namespace ipcServerSampleApp
133 } // namespace sampleApplications
134 } // namespace alexaClientSDK
135 #endif // ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_IPC_NAMESPACES_WINDOWMANAGERNAMESPACE_H_
static const char VISUAL_CHARACTERISTICS_CAPABILITY_CONFIG_INTERACTION_MODES_TAG[]
The key in visual characteristics capability config for interaction modes configuration.
Definition: WindowManagerNamespace.h:56
SetVisualCharacteristicsMessage(const avsCommon::utils::Optional< std::string > &displayCharacteristics, const avsCommon::utils::Optional< std::string > &interactionModes, const avsCommon::utils::Optional< std::string > &windowTemplates)
Definition: WindowManagerNamespace.h:74
::std::string string
Definition: gtest-port.h:1097
static const char IPC_MSG_NAME_SET_VISUAL_CHARACTERISTICS[]
The message name for set visual characteristics.
Definition: WindowManagerNamespace.h:35
static const int IPC_MSG_VERSION_WINDOW_MANAGER(1)
The namespace version for Window Manager.
Message(const std::string &nameSpace, const int version, const std::string &name)
Definition: Message.h:64
auto alloc() -> decltype(mDocument.GetAllocator())
Definition: Message.h:227
bool hasValue() const
Definition: Optional.h:203
static const char IPC_MSG_NAMESPACE_WINDOW_MANAGER[]
The message namespace for Window Manager.
Definition: WindowManagerNamespace.h:32
static const char IPC_MSG_NAME_CLEAR_WINDOW[]
The message name for clearWindow.
Definition: WindowManagerNamespace.h:38
Message & setPayload(rapidjson::Value &&payload)
Definition: Message.h:218
bool Value(const T &value, M matcher)
Definition: gmock-matchers.h:4347
static const char IPC_MSG_WINDOW_TEMPLATES_TAG[]
The window templates json key in visual characteristics message.
Definition: WindowManagerNamespace.h:47
ClearWindowMessage(const std::string &windowId)
Definition: WindowManagerNamespace.h:123
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static const char IPC_MSG_INTERACTION_MODES_TAG[]
The interaction modes json key in visual characteristics message.
Definition: WindowManagerNamespace.h:44
static const char VISUAL_CHARACTERISTICS_CAPABILITY_CONFIG_DISPLAY_TAG[]
The key in visual characteristics capability config for Device display characteristics.
Definition: WindowManagerNamespace.h:53
ValueT value() const
Definition: Optional.h:208
static const char IPC_MSG_DEVICE_DISPLAY_TAG[]
The device display json key in visual characteristics message.
Definition: WindowManagerNamespace.h:41
const T & move(const T &t)
Definition: gtest-port.h:1317
static const char VISUAL_CHARACTERISTICS_CAPABILITY_CONFIG_WINDOW_TEMPLATES_TAG[]
The key in visual characteristics capability config for window templates configuration.
Definition: WindowManagerNamespace.h:59
Message & setWindowIdInPayload(const std::string &windowId)
Definition: Message.h:199

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0