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