]> git.basschouten.com Git - openhab-addons.git/blob
de921a3c1b7e493316e38624bb369ad8808ce747
[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.innogysmarthome.internal.client.entity.message;
14
15 import java.util.List;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * Defines the structure of a {@link Message}. Messages are part of the innogy system and besides other things are used
21  * to raise battery warnings.
22  *
23  * @author Oliver Kuhl - Initial contribution
24  */
25 public class Message {
26     /** device related messages */
27     public static final String TYPE_DEVICE_UNREACHABLE = "DeviceUnreachable";
28     public static final String TYPE_DEVICE_ACTIVITY_LOGGING_ENABLED = "DeviceActivityLoggingEnabled";
29     public static final String TYPE_DEVICE_FACTORY_RESET = "DeviceFactoryReset";
30     public static final String TYPE_DEVICE_LOW_BATTERY = "DeviceLowBattery";
31     public static final String TYPE_DEVICE_MOLD = "DeviceMold";
32     public static final String TYPE_DEVICE_LOW_RF_QUALITY = "DeviceLowRfQuality";
33     public static final String TYPE_DEVICE_FREEZE = "DeviceFreeze";
34     public static final String TYPE_SH_DEVICE_UPDATE_AVAILABLE = "ShDeviceUpdateAvailable";
35     public static final String TYPE_SH_DEVICE_UPDATE_FAILED = "ShDeviceUpdateFailed";
36
37     /** user related messages */
38     public static final String TYPE_USER_EMAIL_ADDRESS_NOT_VALIDATED = "UserEmailAddressNotValidated";
39     public static final String TYPE_USER_INVITATION_ACCEPTED = "UserInvitiationAccepted";
40     public static final String TYPE_USER_FOREIGN_DELETION = "UserForeignDeletion";
41
42     /** SHC related messages */
43     public static final String TYPE_SHC_REMOTE_REBOOTED = "ShcRemoteRebooted";
44     public static final String TYPE_SHC_UPDATE_COMPLETED = "ShcUpdateCompleted";
45     public static final String TYPE_SHC_UPDATE_CANCELED = "ShcUpdateCanceled";
46     public static final String TYPE_SHC_DEFERRABLE_UPDATE = "ShcDeferrableUpdate";
47     public static final String TYPE_SHC_REAL_TIME_CLOCK_LOST = "ShcRealTimeClockLost";
48     public static final String TYPE_SHC_ONLINE_SWITCH_IS_OFF = "ShcOnlineSwitchIsOff";
49     public static final String TYPE_SHC_MANDATORY_UPDATE = "ShcMandatoryUpdate";
50     public static final String TYPE_SHC_NO_CONNECTION_TO_BACKEND = "ShcNoConnectionToBackend";
51
52     /** app related messages */
53     public static final String TYPE_APP_ADDED_TO_SHC = "AppAddedToShc";
54     public static final String TYPE_APP_UPDATED_ON_SHC = "AppUpdatedOnShc";
55     public static final String TYPE_APP_TOKEN_SYNC_FAILURE = "AppTokenSyncFailure";
56     public static final String TYPE_APP_DOWNLOAD_FAILED = "AppDownloadFailed";
57     public static final String TYPE_APPLICATION_LOADING_ERROR = "ApplicationLoadingError";
58     public static final String TYPE_APPLICATION_EXPIRED = "ApplicationExpired";
59     public static final String TYPE_INVALID_CUSTOM_APP = "InvalidCustomApp";
60     public static final String TYPE_CUSTOM_APP_WAS_UPGRADED = "CustomAppWasUpgraded";
61     public static final String TYPE_CUSTOM_APP_UPGRADE_FAILED = "CustomAppUpgradeFailed";
62
63     /** others */
64     public static final String TYPE_BID_COS_INCLUSION_TIMEOUT = "BidCosInclusionTimeout";
65     public static final String TYPE_ADDRESS_COLLISION = "AddressCollision";
66     public static final String TYPE_BACKEND_CONFIG_OUT_OF_SYNC = "BackendConfigOutOfSync";
67     public static final String TYPE_SMOKE_DETECTED = "SmokeDetected";
68     public static final String TYPE_LEMON_BEAT_DONGLE_INITIALIZATION_FAILED = "LemonBeatDongleInitializationFailed";
69     public static final String TYPE_USB_DEVICE_UNPLUGGED = "USBDeviceUnplugged";
70     public static final String TYPE_INVALID_AES_KEY = "InvalidAesKey";
71     public static final String TYPE_MEMORY_SHORTAGE = "MemoryShortage";
72     public static final String TYPE_LOG_LEVEL_CHANGED = "LogLevelChanged";
73     public static final String TYPE_RULE_EXCEPTION_FAILED = "RuleExecutionFailed";
74     public static final String TYPE_SEND_MESSAGE_LIMIT_EXCEEDED = "SendMessageLimitExceeded";
75     public static final String TYPE_CONFIG_FIX_ENTITY_DELETED = "ConfigFixEntityDeleted";
76
77     /**
78      * Identifier of the message – must be unique.
79      */
80     private String id;
81
82     /**
83      * Specifies the type of the message.
84      */
85     private String type;
86
87     /**
88      * Defines whether the message has been viewed by a user.
89      */
90     @SerializedName("read")
91     private boolean isRead;
92
93     /**
94      * Defines whether it is an alert or a message, default is message.
95      */
96     @SerializedName("class")
97     private String messageClass;
98     /**
99      * Timestamp when the message was created.
100      *
101      * Optional.
102      */
103     private String timestamp;
104
105     /**
106      * Reference to the underlying devices, which the message relates to.
107      *
108      * Optional.
109      */
110     private List<String> devices;
111
112     /**
113      * Container for all parameters of the message. The parameters are contained in Property entities.
114      *
115      * Optional.
116      */
117     private MessageProperties properties;
118
119     /**
120      * The product (context) that generated the message.
121      */
122     private String namespace;
123
124     /**
125      * @return the id
126      */
127     public String getId() {
128         return id;
129     }
130
131     /**
132      * @param id the id to set
133      */
134     public void setId(String id) {
135         this.id = id;
136     }
137
138     /**
139      * @return the type
140      */
141     public String getType() {
142         return type;
143     }
144
145     /**
146      * @param type the type to set
147      */
148     public void setType(String type) {
149         this.type = type;
150     }
151
152     /**
153      * @return the messageClass
154      */
155     public String getMessageClass() {
156         return messageClass;
157     }
158
159     /**
160      * @param messageClass the messageClass to set
161      */
162     public void setMessageClass(String messageClass) {
163         this.messageClass = messageClass;
164     }
165
166     /**
167      * @return the timestamp
168      */
169     public String getTimestamp() {
170         return timestamp;
171     }
172
173     /**
174      * @param timestamp the timestamp to set
175      */
176     public void setTimestamp(String timestamp) {
177         this.timestamp = timestamp;
178     }
179
180     /**
181      * @return the isRead
182      */
183     public boolean isRead() {
184         return isRead;
185     }
186
187     /**
188      * @param isRead the isRead to set
189      */
190     public void setRead(boolean isRead) {
191         this.isRead = isRead;
192     }
193
194     /**
195      * @return the devices
196      */
197     public List<String> getDevices() {
198         return devices;
199     }
200
201     /**
202      * @param devices the devices to set
203      */
204     public void setDevices(List<String> devices) {
205         this.devices = devices;
206     }
207
208     /**
209      * @return the dataPropertyList
210      */
211     public MessageProperties getProperties() {
212         return properties;
213     }
214
215     /**
216      * @param properties the dataPropertyList to set
217      */
218     public void setProperties(MessageProperties properties) {
219         this.properties = properties;
220     }
221
222     /**
223      * @return the namespace
224      */
225     public String getNamespace() {
226         return namespace;
227     }
228
229     /**
230      * @param namespace the namespace to set
231      */
232     public void setNamespace(String namespace) {
233         this.namespace = namespace;
234     }
235
236     /**
237      * Returns true, if the message is of type "DeviceUnreachable".
238      *
239      * @return
240      */
241     public boolean isTypeDeviceUnreachable() {
242         return TYPE_DEVICE_UNREACHABLE.equals(type);
243     }
244
245     /**
246      * Returns true, if the message is of type "DeviceLowBattery".
247      *
248      * @return
249      */
250     public boolean isTypeDeviceLowBattery() {
251         return TYPE_DEVICE_LOW_BATTERY.equals(type);
252     }
253 }