2 * Copyright (c) 2010-2023 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.magentatv.internal.config;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * The {@link MagentaTVThingConfiguration} contains the thing config (updated at
22 * @author Markus Michels - Initial contribution
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.
36 public void update(MagentaTVThingConfiguration newConfig) {
37 ipAddress = newConfig.ipAddress;
38 port = newConfig.port;
40 macAddress = newConfig.macAddress;
41 accountName = newConfig.accountName;
42 accountPassword = newConfig.accountPassword;
43 userId = newConfig.userId;
46 public String getUDN() {
47 return udn.toUpperCase();
50 public void setUDN(String udn) {
54 public String getIpAddress() {
58 public String getMacAddress() {
62 public void setMacAddress(String macAddress) {
63 this.macAddress = macAddress.toUpperCase();
66 public String getAccountName() {
70 public void setAccountName(String accountName) {
71 this.accountName = accountName;
74 public String getAccountPassword() {
75 return accountPassword;
78 public void setAccountPassword(String accountPassword) {
79 this.accountPassword = accountPassword;
82 public String getUserId() {
86 public void setUserId(String userId) {
90 protected String getString(@Nullable Object value) {
91 return value != null ? (String) value : "";