2 * Copyright (c) 2010-2021 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.digitalstrom.internal.lib.structure.devices.deviceparameters.impl;
16 * The {@link DSID} represents the digitalSTROM-Device identifier.
18 * @author Alexander Betker - initial contributer
23 private final String DEFAULT_DSID = "3504175fe000000000000001";
24 private final String PRE = "3504175fe0000000";
27 * Creates a new {@link DSID}.
29 * @param dsid to create
31 public DSID(String dsid) {
33 if (dsid != null && !dsid.trim().equals("")) {
34 if (dsid.trim().length() == 24) {
36 } else if (dsid.trim().length() == 8) {
37 this.dsid = this.PRE + dsid;
38 } else if (dsid.trim().toUpperCase().equals("ALL")) {
41 this.dsid = DEFAULT_DSID;
44 this.dsid = DEFAULT_DSID;
49 * Returns the dSID as {@link String}.
53 public String getValue() {
58 public boolean equals(Object obj) {
59 if (obj instanceof DSID) {
60 return ((DSID) obj).getValue().equals(this.getValue());
66 public int hashCode() {
67 return dsid.hashCode();
71 public String toString() {