2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.amazonechocontrol.internal.jsons;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.amazonechocontrol.internal.Connection;
20 * The {@link JsonAnnouncementContent} encapsulate the GSON data of the sequence command AlexaAnnouncement for sending
23 * @author Michael Geramb - Initial contribution
26 public class JsonAnnouncementContent {
27 public String locale = "";
28 public Display display;
31 public JsonAnnouncementContent(Connection.AnnouncementWrapper announcement) {
32 display = new Display(announcement.bodyText, announcement.title);
33 speak = new Speak(announcement.speak);
36 public static class Display {
40 public Display(String body, @Nullable String title) {
42 this.title = (title == null || title.isEmpty() ? "openHAB" : title);
46 public static class Speak {
50 public Speak(String speakText) {
51 type = (speakText.startsWith("<speak>") && speakText.endsWith("</speak>")) ? "ssml" : "text";