]> git.basschouten.com Git - openhab-addons.git/blob
382b4f7ef03dc1d3b4c5f418aca43f3a6e6f9f3e
[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.plugwise.internal;
14
15 import java.time.LocalDateTime;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.plugwise.internal.protocol.Message;
19
20 /**
21  * A queued message that is being sent or waiting to be sent to the Stick.
22  *
23  * @author Wouter Born - Initial contribution
24  */
25 @NonNullByDefault
26 public class PlugwiseQueuedMessage {
27
28     private final PlugwiseMessagePriority priority;
29     private final LocalDateTime dateTime = LocalDateTime.now();
30     private final Message message;
31     private int attempts;
32
33     public PlugwiseQueuedMessage(Message message, PlugwiseMessagePriority priority) {
34         this.message = message;
35         this.priority = priority;
36     }
37
38     public int getAttempts() {
39         return attempts;
40     }
41
42     public LocalDateTime getDateTime() {
43         return dateTime;
44     }
45
46     public Message getMessage() {
47         return message;
48     }
49
50     public PlugwiseMessagePriority getPriority() {
51         return priority;
52     }
53
54     public void increaseAttempts() {
55         attempts++;
56     }
57 }