]> git.basschouten.com Git - openhab-addons.git/blob
56aaee817d6ce459b9ba1ebf333879837b998865
[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.yamahareceiver.internal.state;
14
15 import java.util.HashMap;
16 import java.util.HashSet;
17 import java.util.Map;
18 import java.util.Set;
19
20 import org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants;
21
22 /**
23  * Basic AVR state (name, version, available zones, etc)
24  *
25  * @author David Graeff - Initial contribution
26  * @author Tomasz Maruszak - DAB support, Spotify support, better feature detection
27  */
28 public class DeviceInformationState implements Invalidateable {
29     public String host;
30     // Some AVR information
31     public String name;
32     public String id;
33     public String version;
34     public final Set<YamahaReceiverBindingConstants.Zone> zones = new HashSet<>();
35     public final Set<YamahaReceiverBindingConstants.Feature> features = new HashSet<>();
36     /**
37      * Stores additional properties for the device (protocol specific)
38      */
39     public final Map<String, Object> properties = new HashMap<>();
40
41     public DeviceInformationState() {
42         invalidate();
43     }
44
45     // If we lost the connection, invalidate the state.
46     @Override
47     public void invalidate() {
48         host = null;
49         name = "N/A";
50         id = "";
51         version = "0.0";
52         zones.clear();
53         features.clear();
54         properties.clear();
55     }
56 }