]> git.basschouten.com Git - openhab-addons.git/blob
b499a99e2786441b18d3c3fd04a7cfea82997ed5
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.magentatv.internal.config;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The {@link MagentaTVThingConfiguration} contains the thing config (updated at
20  * runtime).
21  *
22  * @author Markus Michels - Initial contribution
23  */
24 @NonNullByDefault
25 public class MagentaTVThingConfiguration {
26     public String ipAddress = ""; // IP Address of the MR
27     public String port = ""; // Port of the remote service
28     public String udn = ""; // UPnP UDN
29     public String macAddress = ""; // Usually gets filled by the thing discovery (or set by .things file)
30     public String accountName = ""; // Credentials: Account Name from Telekom Kundencenter (used for OAuth)
31     public String accountPassword = ""; // Credentials: Account Password from Telekom Kundencenter (used for OAuth)
32     public String userId = ""; // userId required for pairing (can be configured manually or gets auto-filled by the
33                                // binding on successful OAuth. Value is persisted so OAuth nedds only to be redone when
34                                // credentials change.
35
36     public void update(MagentaTVThingConfiguration newConfig) {
37         ipAddress = newConfig.ipAddress;
38         port = newConfig.port;
39         udn = newConfig.udn;
40         macAddress = newConfig.macAddress;
41         accountName = newConfig.accountName;
42         accountPassword = newConfig.accountPassword;
43         userId = newConfig.userId;
44     }
45
46     public String getUDN() {
47         return udn.toUpperCase();
48     }
49
50     public void setUDN(String udn) {
51         this.udn = udn;
52     }
53
54     public String getIpAddress() {
55         return ipAddress;
56     }
57
58     public String getMacAddress() {
59         return macAddress;
60     }
61
62     public void setMacAddress(String macAddress) {
63         this.macAddress = macAddress.toUpperCase();
64     }
65
66     public String getAccountName() {
67         return accountName;
68     }
69
70     public void setAccountName(String accountName) {
71         this.accountName = accountName;
72     }
73
74     public String getAccountPassword() {
75         return accountPassword;
76     }
77
78     public void setAccountPassword(String accountPassword) {
79         this.accountPassword = accountPassword;
80     }
81
82     public String getUserId() {
83         return userId;
84     }
85
86     public void setUserId(String userId) {
87         this.userId = userId;
88     }
89
90     protected String getString(@Nullable Object value) {
91         return value != null ? (String) value : "";
92     }
93 }