2 * Copyright (c) 2010-2024 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.emotiva.internal.dto;
15 import java.util.ArrayList;
16 import java.util.List;
18 import javax.xml.bind.annotation.XmlRootElement;
20 import org.openhab.binding.emotiva.internal.protocol.EmotivaControlCommands;
21 import org.openhab.binding.emotiva.internal.protocol.EmotivaSubscriptionTags;
24 * The EmotivaUnsubscriptionDTO message type. Use to remove subscription after registration via {
26 * @link EmotivaSubscriptionRequest}.
28 * @author Espen Fossen - Initial contribution
30 @XmlRootElement(name = "emotivaUnsubscribe")
31 public class EmotivaUnsubscribeDTO extends AbstractJAXBElementDTO {
33 @SuppressWarnings("unused")
34 public EmotivaUnsubscribeDTO() {
37 public EmotivaUnsubscribeDTO(List<EmotivaCommandDTO> commands) {
38 this.commands = commands;
41 public EmotivaUnsubscribeDTO(EmotivaSubscriptionTags[] emotivaCommandTypes) {
42 List<EmotivaCommandDTO> list = new ArrayList<>();
43 for (EmotivaSubscriptionTags commandType : emotivaCommandTypes) {
44 list.add(EmotivaCommandDTO.fromType(commandType));
49 public EmotivaUnsubscribeDTO(EmotivaSubscriptionTags tag) {
50 this.commands = List.of(EmotivaCommandDTO.fromType(tag));
53 public EmotivaUnsubscribeDTO(EmotivaControlCommands commandType) {
54 this.commands = List.of(EmotivaCommandDTO.fromType(commandType));