]> git.basschouten.com Git - openhab-addons.git/blob
b9d5dd4885af0dc648fdeceec1d779b7a6b1109d
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.miele.internal.handler;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.miele.internal.MieleTranslationProvider;
18 import org.openhab.binding.miele.internal.api.dto.DeviceMetaData;
19 import org.openhab.core.types.State;
20
21 /**
22  * The {@link ApplianceChannelSelector} class defines a common interface for
23  * all the data structures used by appliance thing handlers. It is used to traverse
24  * the channels that possibly exist for an appliance, and convert data
25  * returned by the appliance to a compatible State
26  *
27  * @author Karel Goderis - Initial contribution
28  * @author Jacob Laursen - Added power/water consumption channels
29  */
30 @NonNullByDefault
31 public interface ApplianceChannelSelector {
32
33     @Override
34     String toString();
35
36     /**
37      * Returns the ChannelID for the given datapoint
38      */
39     String getChannelID();
40
41     /**
42      * Returns the Miele defined ID for the given datapoint
43      */
44     String getMieleID();
45
46     /**
47      * Returns true if the given datapoint is to be considered as a Property
48      * instead of a regular modifiable datapoint
49      */
50     boolean isProperty();
51
52     /**
53      * Returns true if the given channel is extracted from extended
54      * state information
55      */
56     boolean isExtendedState();
57
58     /**
59      * Returns a State for the given string, taking into
60      * account the metadata provided as well as text
61      * translations for corresponding numeric values.
62      *
63      * @param s - the value to be used to instantiate the State
64      * @param dmd - the device meta data
65      * @param translationProvider {@link MieleTranslationProvider} instance
66      */
67     State getState(String s, @Nullable DeviceMetaData dmd, MieleTranslationProvider translationProvider);
68
69     /**
70      * Returns a State for the given string, taking into
71      * account the metadata provided. The meta data is sent by
72      * the Miele appliance and is used to decide the State type
73      *
74      * @param s - the value to be used to instantiate the State
75      * @param dmd - the device meta data
76      */
77     State getState(String s, @Nullable DeviceMetaData dmd);
78
79     /**
80      * Returns a raw State for the given string, not taking into
81      * account any metadata.
82      *
83      * @param s - the value to be used to instantiate the State
84      */
85     State getState(String s);
86 }