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.hue.internal.api.dto.clip1;
16 * Collection of updates to the bridge configuration.
18 * @author Q42 - Initial contribution
19 * @author Denis Dudnik - moved Jue library source code inside the smarthome Hue binding, minor code cleanup
20 * @author Samuel Leisering - added Sensor support
22 public class BridgeConfigUpdate extends ConfigUpdate {
24 * Set the port of the proxy or null if there is no proxy.
26 * @param port port for proxy
27 * @return this object for chaining calls
29 public BridgeConfigUpdate setProxyPort(Integer port) {
30 if (port != null && port < 0) {
31 throw new IllegalArgumentException("Invalid value for port");
34 commands.add(new Command("proxyport", port == null ? 0 : port));
39 * Set the name of the bridge, which also functions as the UPnP name.
41 * @param name new name [4..16]
42 * @return this object for chaining calls
44 public BridgeConfigUpdate setName(String name) {
45 if (Util.stringSize(name) < 4 || Util.stringSize(name) > 16) {
46 throw new IllegalArgumentException("Bridge name must be between 4 and 16 characters long");
49 commands.add(new Command("name", name));
54 * Set the address of the proxy or null if there is no proxy.
56 * @param ip ip of proxy
57 * @return this object for chaining calls
59 public BridgeConfigUpdate setProxyAddress(String ip) {
60 if (ip != null && Util.stringSize(ip) > 40) {
61 throw new IllegalArgumentException("Bridge proxy address can be at most 40 characters long");
64 commands.add(new Command("proxyaddress", ip == null ? "none" : ip));
69 * Set whether the link button has been pressed within the last 30 seconds or not.
71 * @param pressed true for pressed, false for not pressed
72 * @return this object for chaining calls
74 public BridgeConfigUpdate setLinkButton(boolean pressed) {
75 commands.add(new Command("linkbutton", pressed));
80 * Set the IP address of the bridge.
82 * @param ip ip address of bridge
83 * @return this object for chaining calls
85 public BridgeConfigUpdate setIPAddress(String ip) {
86 commands.add(new Command("ipaddress", ip));
91 * Set the network mask of the bridge.
93 * @param netmask network mask
94 * @return this object for chaining calls
96 public BridgeConfigUpdate setNetworkMask(String netmask) {
97 commands.add(new Command("netmask", netmask));
102 * Set the gateway address of the bridge.
104 * @param ip gateway address
105 * @return this object for chaining calls
107 public BridgeConfigUpdate setGateway(String ip) {
108 commands.add(new Command("gateway", ip));
113 * Set whether the bridge uses DHCP to get an ip address or not.
115 * @param enabled dhcp enabled
116 * @return this object for chaining calls
118 public BridgeConfigUpdate setDHCP(boolean enabled) {
119 commands.add(new Command("dhcp", enabled));