]> git.basschouten.com Git - openhab-addons.git/blob
6a97e53a364f0525cdbef7e558c04115cd05749c
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.emotiva.internal.dto;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import javax.xml.bind.annotation.XmlRootElement;
19
20 import org.openhab.binding.emotiva.internal.protocol.EmotivaControlCommands;
21 import org.openhab.binding.emotiva.internal.protocol.EmotivaSubscriptionTags;
22
23 /**
24  * The EmotivaUnsubscriptionDTO message type. Use to remove subscription after registration via {
25  * 
26  * @link EmotivaSubscriptionRequest}.
27  *
28  * @author Espen Fossen - Initial contribution
29  */
30 @XmlRootElement(name = "emotivaUnsubscribe")
31 public class EmotivaUnsubscribeDTO extends AbstractJAXBElementDTO {
32
33     @SuppressWarnings("unused")
34     public EmotivaUnsubscribeDTO() {
35     }
36
37     public EmotivaUnsubscribeDTO(List<EmotivaCommandDTO> commands) {
38         this.commands = commands;
39     }
40
41     public EmotivaUnsubscribeDTO(EmotivaSubscriptionTags[] emotivaCommandTypes) {
42         List<EmotivaCommandDTO> list = new ArrayList<>();
43         for (EmotivaSubscriptionTags commandType : emotivaCommandTypes) {
44             list.add(EmotivaCommandDTO.fromType(commandType));
45         }
46         this.commands = list;
47     }
48
49     public EmotivaUnsubscribeDTO(EmotivaSubscriptionTags tag) {
50         this.commands = List.of(EmotivaCommandDTO.fromType(tag));
51     }
52
53     public EmotivaUnsubscribeDTO(EmotivaControlCommands commandType) {
54         this.commands = List.of(EmotivaCommandDTO.fromType(commandType));
55     }
56 }