]> git.basschouten.com Git - openhab-addons.git/blob
9dad6bdd534642ac9d498473b37dc8b4b2f4fb38
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.dali.internal.protocol;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The {@link DaliResponse} represents different types of responses to DALI
20  * commands.
21  *
22  * @author Robert Schmid - Initial contribution
23  */
24 @NonNullByDefault
25 public class DaliResponse {
26     public void parse(@Nullable DaliBackwardFrame frame) {
27     }
28
29     public static class Numeric extends DaliResponse {
30         public @Nullable Integer value;
31
32         @Override
33         public void parse(@Nullable DaliBackwardFrame frame) {
34             if (frame != null) {
35                 value = frame.data;
36             }
37         }
38     }
39
40     public static class NumericMask extends DaliResponse.Numeric {
41         public @Nullable Boolean mask;
42
43         @Override
44         public void parse(@Nullable DaliBackwardFrame frame) {
45             super.parse(frame);
46             if (this.value == 255) {
47                 this.value = null;
48                 this.mask = true;
49             } else {
50                 this.mask = false;
51             }
52         }
53     }
54 }