]> git.basschouten.com Git - openhab-addons.git/blob
4d098ecf93d414e5e9cb160624f3e2a7b1cec72e
[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.satel.internal.event;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.satel.internal.types.IntegraType;
17
18 /**
19  * Event class describing type and version of connected Integra system.
20  *
21  * @author Krzysztof Goworek - Initial contribution
22  */
23 @NonNullByDefault
24 public class IntegraVersionEvent implements SatelEvent {
25
26     private byte type;
27     private String version;
28     private byte language;
29     private boolean settingsInFlash;
30
31     /**
32      * Constructs new event class.
33      *
34      * @param type Integra type
35      * @param version string describing version number and firmware revision
36      * @param language firmware language: 1 - english
37      * @param settingsInFlash settings stored in flash memory
38      */
39     public IntegraVersionEvent(byte type, String version, byte language, boolean settingsInFlash) {
40         this.type = type;
41         this.version = version;
42         this.language = language;
43         this.settingsInFlash = settingsInFlash;
44     }
45
46     /**
47      * @return Integra type
48      * @see IntegraType
49      */
50     public byte getType() {
51         return type;
52     }
53
54     /**
55      * @return firmware version and date
56      */
57     public String getVersion() {
58         return version;
59     }
60
61     /**
62      * @return firmware language
63      */
64     public byte getLanguage() {
65         return language;
66     }
67
68     /**
69      * @return <code>true</code> if configuration is stored in flash memory
70      */
71     public boolean getSettingsInflash() {
72         return this.settingsInFlash;
73     }
74
75     @Override
76     public String toString() {
77         return String.format("IntegraVersionEvent: type = %d, version = %s, language = %d, settingsInFlash = %b",
78                 this.type & 0xFF, this.version, this.language, this.settingsInFlash);
79     }
80 }