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
14 package org.openhab.binding.qbus.internal.protocol;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import org.eclipse.jdt.annotation.Nullable;
18 import org.openhab.binding.qbus.internal.handler.QbusCO2Handler;
21 * The {@link QbusCO2} class represents the action Qbus CO2 output.
23 * @author Koen Schockaert - Initial Contribution
27 public final class QbusCO2 {
29 private @Nullable Integer state;
31 private @Nullable QbusCO2Handler thingHandler;
34 * This method should be called if the ThingHandler for the thing corresponding to this CO2 is initialized.
35 * It keeps a record of the thing handler in this object so the thing can be updated when
36 * the CO2 output receives an update from the Qbus IP-interface.
40 public void setThingHandler(QbusCO2Handler handler) {
41 this.thingHandler = handler;
49 public @Nullable Integer getState() {
54 * Update the value of the CO2.
58 void updateState(@Nullable Integer state) {
60 QbusCO2Handler handler = this.thingHandler;
61 if (handler != null) {
62 handler.handleStateUpdate(this);