]> git.basschouten.com Git - openhab-addons.git/blob
afb5f65a22b757543d500bc814ab0c8f9e982ca4
[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.novafinedust.internal.sds011protocol.messages;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Data from the sensor containing information about the installed firmware
19  *
20  * @author Stefan Triller - Initial contribution
21  *
22  */
23 @NonNullByDefault
24 public class SensorFirmwareReply extends SensorReply {
25
26     private final byte year;
27     private final byte month;
28     private final byte day;
29
30     public SensorFirmwareReply(byte[] receivedData) {
31         super(receivedData);
32         this.year = receivedData[3];
33         this.month = receivedData[4];
34         this.day = receivedData[5];
35     }
36
37     /**
38      * Gets the firmware of the sensor as a String
39      *
40      * @return firmware of the sensor formatted as YY-MM-DD
41      */
42     public String getFirmware() {
43         return year + "-" + month + "-" + day;
44     }
45
46     @Override
47     public String toString() {
48         return "FirmwareReply: [firmware=" + getFirmware() + "]";
49     }
50 }