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.openhab.binding.tacmi.internal.message.AnalogMessage;
17 import org.openhab.binding.tacmi.internal.message.DigitalMessage;
18 import org.openhab.binding.tacmi.internal.message.MessageType;
19 import org.openhab.core.thing.ChannelUID;
22 * This class carries all relevant data for the POD
24 * @author Christian Niessner - Initial contribution
27 public class PodDataOutgoing extends PodData {
29 protected long lastSent;
30 protected final ChannelUID[] channeUIDs;
31 protected final boolean[] initialized;
32 private boolean allValuesInitialized;
35 * Create new AnalogValue with specified value and type
37 public PodDataOutgoing(PodIdentifier pi, byte node) {
39 boolean analog = pi.messageType == MessageType.ANALOG;
40 int valueCount = analog ? 4 : 16;
41 this.channeUIDs = new ChannelUID[valueCount];
42 this.initialized = new boolean[valueCount];
43 this.allValuesInitialized = false;
44 this.message = analog ? new AnalogMessage(node, pi.podId) : new DigitalMessage(node, pi.podId);
45 this.lastSent = System.currentTimeMillis();
49 * checks if all (in use) values have been set to a value - used to prevent sending of unintended values via CoE
51 public boolean isAllValuesInitialized() {
52 if (this.allValuesInitialized) {
55 boolean allInitialized = true;
56 for (int idx = 0; idx < this.initialized.length; idx++) {
57 if (this.channeUIDs[idx] != null && !this.initialized[idx]) {
61 if (!allInitialized) {
64 this.allValuesInitialized = true;
68 public String getUninitializedChannelNames() {
69 if (this.allValuesInitialized) {
73 StringBuilder sb = new StringBuilder();
74 for (int idx = 0; idx < this.initialized.length; idx++) {
75 ChannelUID ct = this.channeUIDs[idx];
76 if (ct != null && !this.initialized[idx]) {
77 if (sb.length() > 0) {
80 sb.append(ct.getId());