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.tacmi.internal.coe;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.tacmi.internal.message.MessageType;
20 * This class defines a key for POD identification
22 * @author Christian Niessner - Initial contribution
25 public final class PodIdentifier {
26 public final MessageType messageType;
27 public final byte podId;
28 public final boolean outgoing;
31 * Create new AnalogValue with specified value and type
33 public PodIdentifier(MessageType messageType, byte podId, boolean outgoing) {
34 this.messageType = messageType;
36 throw new ArrayIndexOutOfBoundsException(podId);
38 switch (messageType) {
40 if (podId < 1 || podId > 8) {
41 throw new ArrayIndexOutOfBoundsException(podId);
45 if (podId != 0 && podId != 9) {
46 throw new ArrayIndexOutOfBoundsException(podId);
51 this.outgoing = outgoing;
55 public int hashCode() {
56 return (this.messageType.ordinal() << 8) | podId | (outgoing ? 0x10000 : 0);
60 public boolean equals(@Nullable Object o) {
61 if (!(o instanceof PodIdentifier)) {
64 PodIdentifier po = (PodIdentifier) o;
65 return this.messageType == po.messageType && this.podId == po.podId && this.outgoing == po.outgoing;