From: lsiepel Date: Mon, 26 Dec 2022 16:00:53 +0000 (+0100) Subject: [airvisualnode] Add null annotations (#13895) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=1c5b79414509a378152ba103998f047a52fe6b1b;p=openhab-addons.git [airvisualnode] Add null annotations (#13895) * Add null annotation Signed-off-by: Leo Siepel --- diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/AirVisualNodeHandlerFactory.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/AirVisualNodeHandlerFactory.java index dfb47e12a0..82c1d5a972 100644 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/AirVisualNodeHandlerFactory.java +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/AirVisualNodeHandlerFactory.java @@ -14,6 +14,7 @@ package org.openhab.binding.airvisualnode.internal; import static org.openhab.binding.airvisualnode.internal.AirVisualNodeBindingConstants.*; +import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.airvisualnode.internal.handler.AirVisualNodeHandler; import org.openhab.core.thing.Thing; @@ -29,6 +30,7 @@ import org.osgi.service.component.annotations.Component; * * @author Victor Antonovich - Initial contribution */ +@NonNullByDefault @Component(service = ThingHandlerFactory.class, configurationPid = "binding.airvisualnode") public class AirVisualNodeHandlerFactory extends BaseThingHandlerFactory { diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/config/AirVisualNodeConfig.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/config/AirVisualNodeConfig.java index 56c80cf214..2428ae58e6 100644 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/config/AirVisualNodeConfig.java +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/config/AirVisualNodeConfig.java @@ -12,22 +12,25 @@ */ package org.openhab.binding.airvisualnode.internal.config; +import org.eclipse.jdt.annotation.NonNullByDefault; + /** * Configuration for AirVisual Node. * * @author Victor Antonovich - Initial contribution */ +@NonNullByDefault public class AirVisualNodeConfig { public static final String ADDRESS = "address"; - public String address; + public String address = ""; - public String username; + public String username = ""; - public String password; + public String password = ""; - public String share; + public String share = ""; public long refresh; diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/discovery/AirVisualNodeDiscoveryService.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/discovery/AirVisualNodeDiscoveryService.java index e071d2f82c..94df64bf2a 100644 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/discovery/AirVisualNodeDiscoveryService.java +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/discovery/AirVisualNodeDiscoveryService.java @@ -20,6 +20,8 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.airvisualnode.internal.AirVisualNodeBindingConstants; import org.openhab.binding.airvisualnode.internal.config.AirVisualNodeConfig; import org.openhab.core.config.discovery.AbstractDiscoveryService; @@ -39,16 +41,18 @@ import jcifs.smb.SmbFile; * * @author Victor Antonovich - Initial contribution */ +@NonNullByDefault @Component(service = DiscoveryService.class) public class AirVisualNodeDiscoveryService extends AbstractDiscoveryService { private final Logger logger = LoggerFactory.getLogger(AirVisualNodeDiscoveryService.class); + private static final int REFRESH_MINUTES = 5; public static final String AVISUAL_WORKGROUP_NAME = "MSHOME"; private static final Pattern AVISUAL_NAME_PATTERN = Pattern.compile("^AVISUAL-([^/]+)$"); - private ScheduledFuture backgroundDiscoveryFuture; + private @Nullable ScheduledFuture backgroundDiscoveryFuture; public AirVisualNodeDiscoveryService() { super(Collections.singleton(AirVisualNodeBindingConstants.THING_TYPE_AVNODE), 600, true); @@ -63,19 +67,20 @@ public class AirVisualNodeDiscoveryService extends AbstractDiscoveryService { @Override protected void startBackgroundDiscovery() { logger.debug("Starting background discovery"); - backgroundDiscoveryFuture = scheduler.scheduleWithFixedDelay(this::scan, 0, 5, TimeUnit.MINUTES); + ScheduledFuture localDiscoveryFuture = backgroundDiscoveryFuture; + if (localDiscoveryFuture == null || localDiscoveryFuture.isCancelled()) { + backgroundDiscoveryFuture = scheduler.scheduleWithFixedDelay(this::scan, 0, REFRESH_MINUTES, + TimeUnit.MINUTES); + } } @Override protected void stopBackgroundDiscovery() { logger.debug("Stopping background discovery"); - cancelBackgroundDiscoveryFuture(); - super.stopBackgroundDiscovery(); - } - private void cancelBackgroundDiscoveryFuture() { - if (backgroundDiscoveryFuture != null && !backgroundDiscoveryFuture.isDone()) { - backgroundDiscoveryFuture.cancel(true); + ScheduledFuture localDiscoveryFuture = backgroundDiscoveryFuture; + if (localDiscoveryFuture != null) { + localDiscoveryFuture.cancel(true); backgroundDiscoveryFuture = null; } } @@ -87,7 +92,7 @@ public class AirVisualNodeDiscoveryService extends AbstractDiscoveryService { String workgroupUrl = "smb://" + AVISUAL_WORKGROUP_NAME + "/"; workgroupMembers = new SmbFile(workgroupUrl).listFiles(); } catch (IOException e) { - // Can't get workgroup member list + logger.debug("IOException while trying to get workgroup member list", e); return; } @@ -105,6 +110,10 @@ public class AirVisualNodeDiscoveryService extends AbstractDiscoveryService { // Extract the Node serial number from device name String nodeSerialNumber = m.group(1); + if (nodeSerialNumber != null) { + logger.debug("Extracting the Node serial number failed"); + return; + } // The Node Thing UID is serial number converted to lower case ThingUID thingUID = new ThingUID(AirVisualNodeBindingConstants.THING_TYPE_AVNODE, nodeSerialNumber.toLowerCase()); @@ -119,14 +128,19 @@ public class AirVisualNodeDiscoveryService extends AbstractDiscoveryService { // Create discovery result String nodeAddress = nodeNbtAddress.getInetAddress().getHostAddress(); - DiscoveryResult result = DiscoveryResultBuilder.create(thingUID) - .withProperty(AirVisualNodeConfig.ADDRESS, nodeAddress) - .withRepresentationProperty(AirVisualNodeConfig.ADDRESS) - .withLabel("AirVisual Node (" + nodeSerialNumber + ")").build(); - thingDiscovered(result); + if (nodeAddress != null) { + DiscoveryResult result = DiscoveryResultBuilder.create(thingUID) + .withProperty(AirVisualNodeConfig.ADDRESS, nodeAddress) + .withRepresentationProperty(AirVisualNodeConfig.ADDRESS) + .withLabel("AirVisual Node (" + nodeSerialNumber + ")").build(); + thingDiscovered(result); + } else { + logger.debug("Getting the node address from the host failed"); + } } catch (UnknownHostException e) { logger.debug("The Node address resolving failed ", e); } + } } } diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/DateAndTime.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/DateAndTime.java new file mode 100644 index 0000000000..698f44a1dc --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/DateAndTime.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto; + +/** + * Date and time / timestamp data. + * + * @author Victor Antonovich - Initial contribution + */ +public class DateAndTime { + + private String date; + private String time; + private String timestamp; + + public DateAndTime(String date, String time, String timestamp) { + this.date = date; + this.time = time; + this.timestamp = timestamp; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/MeasurementsInterface.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/MeasurementsInterface.java new file mode 100644 index 0000000000..c75f2f1e7d --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/MeasurementsInterface.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto; + +import org.eclipse.jdt.annotation.NonNullByDefault; + +/** + * Interface for AirVisual and AirVisual Pro models measurements data + * + * @author Oleg Davydyuk - Initial contribution + */ +@NonNullByDefault +public interface MeasurementsInterface { + int getCo2Ppm(); + + int getHumidityRH(); + + int getPm25AQICN(); + + int getPm25AQIUS(); + + float getPm01Ugm3(); + + float getPm10Ugm3(); + + float getPm25Ugm3(); + + float getTemperatureC(); + + float getTemperatureF(); + + int getVocPpb(); +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/NodeDataInterface.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/NodeDataInterface.java new file mode 100644 index 0000000000..c5d4aca6ad --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/NodeDataInterface.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.airvisualnode.internal.dto.airvisual.Settings; +import org.openhab.binding.airvisualnode.internal.dto.airvisual.Status; + +/** + * Interface for AirVisual and AirVisual Pro models + * + * @author Oleg Davydyuk - Initial contribution + */ +@NonNullByDefault +public interface NodeDataInterface { + DateAndTime getDateAndTime(); + + MeasurementsInterface getMeasurements(); + + String getSerialNumber(); + + Settings getSettings(); + + Status getStatus(); +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/PowerSavingTime.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/PowerSavingTime.java new file mode 100644 index 0000000000..48ba6f320c --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/PowerSavingTime.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto; + +/** + * Power saving time data. + * + * @author Victor Antonovich - Initial contribution + */ +public class PowerSavingTime { + + private int hour; + private int minute; + + public PowerSavingTime(int hour, int minute) { + this.hour = hour; + this.minute = minute; + } + + public int getHour() { + return hour; + } + + public void setHour(int hour) { + this.hour = hour; + } + + public int getMinute() { + return minute; + } + + public void setMinute(int minute) { + this.minute = minute; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/PowerSavingTimeSlot.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/PowerSavingTimeSlot.java new file mode 100644 index 0000000000..c9f449652e --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/PowerSavingTimeSlot.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto; + +/** + * Power saving time slot data. + * + * @author Victor Antonovich - Initial contribution + */ +public class PowerSavingTimeSlot { + + private int hourOff; + private int hourOn; + + public PowerSavingTimeSlot(int hourOff, int hourOn) { + this.hourOff = hourOff; + this.hourOn = hourOn; + } + + public int getHourOff() { + return hourOff; + } + + public void setHourOff(int hourOff) { + this.hourOff = hourOff; + } + + public int getHourOn() { + return hourOn; + } + + public void setHourOn(int hourOn) { + this.hourOn = hourOn; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Measurements.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Measurements.java new file mode 100644 index 0000000000..fbacb209c3 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Measurements.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisual; + +import org.openhab.binding.airvisualnode.internal.dto.MeasurementsInterface; + +import com.google.gson.annotations.SerializedName; + +/** + * Measurements data. + * + * @author Victor Antonovich - Initial contribution + */ +public class Measurements implements MeasurementsInterface { + + private int co2Ppm; + @SerializedName("humidity_RH") + private int humidityRH; + @SerializedName("pm25_AQICN") + private int pm25AQICN; + @SerializedName("pm25_AQIUS") + private int pm25AQIUS; + private float pm25Ugm3; + @SerializedName("temperature_C") + private float temperatureC; + @SerializedName("temperature_F") + private float temperatureF; + private int vocPpb; + + public Measurements(int co2Ppm, int humidityRH, int pm25AQICN, int pm25AQIUS, float pm25Ugm3, float temperatureC, + float temperatureF, int vocPpb) { + this.co2Ppm = co2Ppm; + this.humidityRH = humidityRH; + this.pm25AQICN = pm25AQICN; + this.pm25AQIUS = pm25AQIUS; + this.pm25Ugm3 = pm25Ugm3; + this.temperatureC = temperatureC; + this.temperatureF = temperatureF; + this.vocPpb = vocPpb; + } + + public int getCo2Ppm() { + return co2Ppm; + } + + public void setCo2Ppm(int co2Ppm) { + this.co2Ppm = co2Ppm; + } + + public int getHumidityRH() { + return humidityRH; + } + + public void setHumidityRH(int humidityRH) { + this.humidityRH = humidityRH; + } + + public int getPm25AQICN() { + return pm25AQICN; + } + + public void setPm25AQICN(int pm25AQICN) { + this.pm25AQICN = pm25AQICN; + } + + public int getPm25AQIUS() { + return pm25AQIUS; + } + + public void setPm25AQIUS(int pm25AQIUS) { + this.pm25AQIUS = pm25AQIUS; + } + + @Override + public float getPm01Ugm3() { + return 0; + } + + @Override + public float getPm10Ugm3() { + return 0; + } + + public float getPm25Ugm3() { + return pm25Ugm3; + } + + public void setPm25Ugm3(float pm25Ugm3) { + this.pm25Ugm3 = pm25Ugm3; + } + + public float getTemperatureC() { + return temperatureC; + } + + public void setTemperatureC(float temperatureC) { + this.temperatureC = temperatureC; + } + + public float getTemperatureF() { + return temperatureF; + } + + public void setTemperatureF(float temperatureF) { + this.temperatureF = temperatureF; + } + + public int getVocPpb() { + return vocPpb; + } + + public void setVocPpb(int vocPpb) { + this.vocPpb = vocPpb; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/NodeData.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/NodeData.java new file mode 100644 index 0000000000..08a5b1cedc --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/NodeData.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisual; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.airvisualnode.internal.dto.DateAndTime; +import org.openhab.binding.airvisualnode.internal.dto.MeasurementsInterface; +import org.openhab.binding.airvisualnode.internal.dto.NodeDataInterface; + +/** + * Top level object for AirVisual Node JSON data. + * + * @author Victor Antonovich - Initial contribution + */ +@NonNullByDefault +public class NodeData implements NodeDataInterface { + + private DateAndTime dateAndTime; + private Measurements measurements; + private String serialNumber; + private Settings settings; + private Status status; + + public NodeData(DateAndTime dateAndTime, Measurements measurements, String serialNumber, Settings settings, + Status status) { + this.dateAndTime = dateAndTime; + this.measurements = measurements; + this.serialNumber = serialNumber; + this.settings = settings; + this.status = status; + } + + public DateAndTime getDateAndTime() { + return dateAndTime; + } + + public void setDateAndTime(DateAndTime dateAndTime) { + this.dateAndTime = dateAndTime; + } + + public MeasurementsInterface getMeasurements() { + return measurements; + } + + public void setMeasurements(Measurements measurements) { + this.measurements = measurements; + } + + public String getSerialNumber() { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + } + + public Settings getSettings() { + return settings; + } + + public void setSettings(Settings settings) { + this.settings = settings; + } + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/PowerSaving.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/PowerSaving.java new file mode 100644 index 0000000000..77ffcc4d6c --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/PowerSaving.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisual; + +import java.util.List; + +import org.openhab.binding.airvisualnode.internal.dto.PowerSavingTime; +import org.openhab.binding.airvisualnode.internal.dto.PowerSavingTimeSlot; + +import com.google.gson.annotations.SerializedName; + +/** + * Power saving data. + * + * @author Victor Antonovich - Initial contribution + */ +public class PowerSaving { + + @SerializedName("2slots") + private List timeSlots = null; + private String mode; + @SerializedName("yes") + private List times = null; + + public PowerSaving(List timeSlots, String mode, List times) { + this.mode = mode; + this.times = times; + this.timeSlots = timeSlots; + } + + public List getTimeSlots() { + return timeSlots; + } + + public void setTimeSlots(List timeSlots) { + this.timeSlots = timeSlots; + } + + public List getTimes() { + return times; + } + + public void setTimes(List times) { + this.times = times; + } + + public String getMode() { + return mode; + } + + public void setMode(String mode) { + this.mode = mode; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Settings.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Settings.java new file mode 100644 index 0000000000..541f4062d2 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Settings.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisual; + +/** + * Settings data. + * + * @author Victor Antonovich - Initial contribution + */ +public class Settings { + + private String followedStation; + private boolean isAqiUsa; + private boolean isConcentrationShowed; + private boolean isIndoor; + private boolean isLcdOn; + private boolean isNetworkTime; + private boolean isTemperatureCelsius; + private String language; + private int lcdBrightness; + private String nodeName; + private PowerSaving powerSaving; + private String speedUnit; + private String timezone; + + public Settings(String followedStation, boolean isAqiUsa, boolean isConcentrationShowed, boolean isIndoor, + boolean isLcdOn, boolean isNetworkTime, boolean isTemperatureCelsius, String language, int lcdBrightness, + String nodeName, PowerSaving powerSaving, String speedUnit, String timezone) { + this.followedStation = followedStation; + this.isAqiUsa = isAqiUsa; + this.isConcentrationShowed = isConcentrationShowed; + this.isIndoor = isIndoor; + this.isLcdOn = isLcdOn; + this.isNetworkTime = isNetworkTime; + this.isTemperatureCelsius = isTemperatureCelsius; + this.language = language; + this.lcdBrightness = lcdBrightness; + this.nodeName = nodeName; + this.powerSaving = powerSaving; + this.speedUnit = speedUnit; + this.timezone = timezone; + } + + public String getFollowedStation() { + return followedStation; + } + + public void setFollowedStation(String followedStation) { + this.followedStation = followedStation; + } + + public boolean isIsAqiUsa() { + return isAqiUsa; + } + + public void setIsAqiUsa(boolean isAqiUsa) { + this.isAqiUsa = isAqiUsa; + } + + public boolean isIsConcentrationShowed() { + return isConcentrationShowed; + } + + public void setIsConcentrationShowed(boolean isConcentrationShowed) { + this.isConcentrationShowed = isConcentrationShowed; + } + + public boolean isIsIndoor() { + return isIndoor; + } + + public void setIsIndoor(boolean isIndoor) { + this.isIndoor = isIndoor; + } + + public boolean isIsLcdOn() { + return isLcdOn; + } + + public void setIsLcdOn(boolean isLcdOn) { + this.isLcdOn = isLcdOn; + } + + public boolean isIsNetworkTime() { + return isNetworkTime; + } + + public void setIsNetworkTime(boolean isNetworkTime) { + this.isNetworkTime = isNetworkTime; + } + + public boolean isIsTemperatureCelsius() { + return isTemperatureCelsius; + } + + public void setIsTemperatureCelsius(boolean isTemperatureCelsius) { + this.isTemperatureCelsius = isTemperatureCelsius; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public int getLcdBrightness() { + return lcdBrightness; + } + + public void setLcdBrightness(int lcdBrightness) { + this.lcdBrightness = lcdBrightness; + } + + public String getNodeName() { + return nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public PowerSaving getPowerSaving() { + return powerSaving; + } + + public void setPowerSaving(PowerSaving powerSaving) { + this.powerSaving = powerSaving; + } + + public String getSpeedUnit() { + return speedUnit; + } + + public void setSpeedUnit(String speedUnit) { + this.speedUnit = speedUnit; + } + + public String getTimezone() { + return timezone; + } + + public void setTimezone(String timezone) { + this.timezone = timezone; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Status.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Status.java new file mode 100644 index 0000000000..e12c2047f6 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisual/Status.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisual; + +/** + * Status data. + * + * @author Victor Antonovich - Initial contribution + */ +public class Status { + + private String appVersion; + private int battery; + private long datetime; + private String model; + private String sensorPm25Serial; + private int syncTime; + private String systemVersion; + private int usedMemory; + private int wifiStrength; + + public Status(String appVersion, int battery, long datetime, String model, String sensorPm25Serial, int syncTime, + String systemVersion, int usedMemory, int wifiStrength) { + this.appVersion = appVersion; + this.battery = battery; + this.datetime = datetime; + this.model = model; + this.sensorPm25Serial = sensorPm25Serial; + this.syncTime = syncTime; + this.systemVersion = systemVersion; + this.usedMemory = usedMemory; + this.wifiStrength = wifiStrength; + } + + public String getAppVersion() { + return appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } + + public int getBattery() { + return battery; + } + + public void setBattery(int battery) { + this.battery = battery; + } + + public long getDatetime() { + return datetime; + } + + public void setDatetime(long datetime) { + this.datetime = datetime; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public String getSensorPm25Serial() { + return sensorPm25Serial; + } + + public void setSensorPm25Serial(String sensorPm25Serial) { + this.sensorPm25Serial = sensorPm25Serial; + } + + public int getSyncTime() { + return syncTime; + } + + public void setSyncTime(int syncTime) { + this.syncTime = syncTime; + } + + public String getSystemVersion() { + return systemVersion; + } + + public void setSystemVersion(String systemVersion) { + this.systemVersion = systemVersion; + } + + public int getUsedMemory() { + return usedMemory; + } + + public void setUsedMemory(int usedMemory) { + this.usedMemory = usedMemory; + } + + public int getWifiStrength() { + return wifiStrength; + } + + public void setWifiStrength(int wifiStrength) { + this.wifiStrength = wifiStrength; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Measurements.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Measurements.java new file mode 100644 index 0000000000..5f5f54aef0 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Measurements.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisualpro; + +import org.openhab.binding.airvisualnode.internal.dto.MeasurementsInterface; + +import com.google.gson.annotations.SerializedName; + +/** + * Measurements data. + * + * @author Victor Antonovich - Initial contribution + */ +public class Measurements implements MeasurementsInterface { + + @SerializedName("co2_ppm") + private int co2Ppm; + + @SerializedName("humidity_RH") + private int humidityRH; + + @SerializedName("pm25_AQICN") + private int pm25AQICN; + + @SerializedName("pm25_AQIUS") + private int pm25AQIUS; + + @SerializedName("pm01_ugm3") + private float pm01Ugm3; + + @SerializedName("pm25_ugm3") + private float pm25Ugm3; + + @SerializedName("pm10_ugm3") + private float pm10Ugm3; + + @SerializedName("temperature_C") + private float temperatureC; + + @SerializedName("temperature_F") + private float temperatureF; + + private int vocPpb; + + public Measurements(int co2Ppm, int humidityRH, int pm25AQICN, int pm25AQIUS, float pm01Ugm3, float pm10Ugm3, + float pm25Ugm3, float temperatureC, float temperatureF, int vocPpb) { + this.co2Ppm = co2Ppm; + this.humidityRH = humidityRH; + this.pm25AQICN = pm25AQICN; + this.pm25AQIUS = pm25AQIUS; + this.pm01Ugm3 = pm01Ugm3; + this.pm10Ugm3 = pm10Ugm3; + this.pm25Ugm3 = pm25Ugm3; + this.temperatureC = temperatureC; + this.temperatureF = temperatureF; + this.vocPpb = vocPpb; + } + + public int getCo2Ppm() { + return co2Ppm; + } + + public void setCo2Ppm(int co2Ppm) { + this.co2Ppm = co2Ppm; + } + + public int getHumidityRH() { + return humidityRH; + } + + public void setHumidityRH(int humidityRH) { + this.humidityRH = humidityRH; + } + + public int getPm25AQICN() { + return pm25AQICN; + } + + public void setPm25AQICN(int pm25AQICN) { + this.pm25AQICN = pm25AQICN; + } + + public int getPm25AQIUS() { + return pm25AQIUS; + } + + public void setPm25AQIUS(int pm25AQIUS) { + this.pm25AQIUS = pm25AQIUS; + } + + public float getPm01Ugm3() { + return pm01Ugm3; + } + + public void setPm01Ugm3(float pm01Ugm3) { + this.pm01Ugm3 = pm01Ugm3; + } + + public float getPm10Ugm3() { + return pm10Ugm3; + } + + public void setPm10Ugm3(float pm10Ugm3) { + this.pm10Ugm3 = pm10Ugm3; + } + + public float getPm25Ugm3() { + return pm25Ugm3; + } + + public void setPm25Ugm3(float pm25Ugm3) { + this.pm25Ugm3 = pm25Ugm3; + } + + public float getTemperatureC() { + return temperatureC; + } + + public void setTemperatureC(float temperatureC) { + this.temperatureC = temperatureC; + } + + public float getTemperatureF() { + return temperatureF; + } + + public void setTemperatureF(float temperatureF) { + this.temperatureF = temperatureF; + } + + public int getVocPpb() { + return vocPpb; + } + + public void setVocPpb(int vocPpb) { + this.vocPpb = vocPpb; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/PowerSaving.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/PowerSaving.java new file mode 100644 index 0000000000..726563f98d --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/PowerSaving.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisualpro; + +import java.util.List; + +import org.openhab.binding.airvisualnode.internal.dto.PowerSavingTime; +import org.openhab.binding.airvisualnode.internal.dto.PowerSavingTimeSlot; + +import com.google.gson.annotations.SerializedName; + +/** + * Power saving data. + * + * @author Victor Antonovich - Initial contribution + */ +public class PowerSaving { + + @SerializedName("2slots") + private List timeSlots = null; + + private String mode; + + private long runningTime; + + @SerializedName("yes") + private List times = null; + + public PowerSaving(List timeSlots, String mode, long runningTime, + List times) { + this.mode = mode; + this.runningTime = runningTime; + this.times = times; + this.timeSlots = timeSlots; + } + + public List getTimeSlots() { + return timeSlots; + } + + public void setTimeSlots(List timeSlots) { + this.timeSlots = timeSlots; + } + + public List getTimes() { + return times; + } + + public void setTimes(List times) { + this.times = times; + } + + public String getMode() { + return mode; + } + + public void setMode(String mode) { + this.mode = mode; + } + + public long getRunningTime() { + return runningTime; + } + + public void setRunningTime(long runningTime) { + this.runningTime = runningTime; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/ProNodeData.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/ProNodeData.java new file mode 100644 index 0000000000..c249fb5f16 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/ProNodeData.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisualpro; + +import java.util.List; + +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.openhab.binding.airvisualnode.internal.dto.DateAndTime; +import org.openhab.binding.airvisualnode.internal.dto.MeasurementsInterface; +import org.openhab.binding.airvisualnode.internal.dto.NodeDataInterface; +import org.openhab.binding.airvisualnode.internal.dto.airvisual.Settings; +import org.openhab.binding.airvisualnode.internal.dto.airvisual.Status; + +/** + * Top level object for AirVisual Node JSON data. + * + * @author Victor Antonovich - Initial contribution + */ +@NonNullByDefault +public class ProNodeData implements NodeDataInterface { + + private DateAndTime dateAndTime; + private List measurements; + private String serialNumber; + private Settings settings; + private Status status; + + public ProNodeData(DateAndTime dateAndTime, List measurements, String serialNumber, Settings settings, + Status status) { + this.dateAndTime = dateAndTime; + this.measurements = measurements; + this.serialNumber = serialNumber; + this.settings = settings; + this.status = status; + } + + public DateAndTime getDateAndTime() { + return dateAndTime; + } + + public void setDateAndTime(DateAndTime dateAndTime) { + this.dateAndTime = dateAndTime; + } + + public MeasurementsInterface getMeasurements() { + return measurements.get(0); + } + + public void setMeasurements(List measurements) { + this.measurements = measurements; + } + + public String getSerialNumber() { + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + } + + public Settings getSettings() { + return settings; + } + + public void setSettings(Settings settings) { + this.settings = settings; + } + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/SensorLife.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/SensorLife.java new file mode 100644 index 0000000000..5d326fe530 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/SensorLife.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisualpro; + +/** + * Sensor Usage/Life data + * + * @author Oleg Davydyuk - Initial contribution + */ +public class SensorLife { + + private long pm25; + + public SensorLife(long pm25) { + this.pm25 = pm25; + } + + public long getPm25() { + return pm25; + } + + public void setPm25(long pm25) { + this.pm25 = pm25; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/SensorMode.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/SensorMode.java new file mode 100644 index 0000000000..7e21d04978 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/SensorMode.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisualpro; + +/** + * Sensor Operating Mode + * + * @author Oleg Davydyuk - Initial contribution + */ +public class SensorMode { + + private long customModeInterval; + + private long mode; + + public SensorMode(long customModeInterval, long mode) { + this.customModeInterval = customModeInterval; + this.mode = mode; + } + + public long getCustomModeInterval() { + return customModeInterval; + } + + public void setCustomModeInterval(long customModeInterval) { + this.customModeInterval = customModeInterval; + } + + public long getMode() { + return mode; + } + + public void setMode(long mode) { + this.mode = mode; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Settings.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Settings.java new file mode 100644 index 0000000000..90033f2e50 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Settings.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisualpro; + +import org.openhab.binding.airvisualnode.internal.dto.airvisual.PowerSaving; + +/** + * Settings data. + * + * @author Victor Antonovich - Initial contribution + */ +public class Settings { + + private String followMode; + private String followedStation; + private boolean isAqiUsa; + private boolean isConcentrationShowed; + private boolean isIndoor; + private boolean isLcdOn; + private boolean isNetworkTime; + private boolean isTemperatureCelsius; + private String language; + private int lcdBrightness; + private String nodeName; + private PowerSaving powerSaving; + private SensorMode sensorMode; + private String speedUnit; + private String timezone; + + public Settings(String followMode, String followedStation, boolean isAqiUsa, boolean isConcentrationShowed, + boolean isIndoor, boolean isLcdOn, boolean isNetworkTime, boolean isTemperatureCelsius, String language, + int lcdBrightness, String nodeName, PowerSaving powerSaving, SensorMode sensorMode, String speedUnit, + String timezone) { + this.followMode = followMode; + this.followedStation = followedStation; + this.isAqiUsa = isAqiUsa; + this.isConcentrationShowed = isConcentrationShowed; + this.isIndoor = isIndoor; + this.isLcdOn = isLcdOn; + this.isNetworkTime = isNetworkTime; + this.isTemperatureCelsius = isTemperatureCelsius; + this.language = language; + this.lcdBrightness = lcdBrightness; + this.nodeName = nodeName; + this.powerSaving = powerSaving; + this.sensorMode = sensorMode; + this.speedUnit = speedUnit; + this.timezone = timezone; + } + + public String getFollowMode() { + return followMode; + } + + public void setFollowMode(String followMode) { + this.followMode = followMode; + } + + public String getFollowedStation() { + return followedStation; + } + + public void setFollowedStation(String followedStation) { + this.followedStation = followedStation; + } + + public boolean isIsAqiUsa() { + return isAqiUsa; + } + + public void setIsAqiUsa(boolean isAqiUsa) { + this.isAqiUsa = isAqiUsa; + } + + public boolean isIsConcentrationShowed() { + return isConcentrationShowed; + } + + public void setIsConcentrationShowed(boolean isConcentrationShowed) { + this.isConcentrationShowed = isConcentrationShowed; + } + + public boolean isIsIndoor() { + return isIndoor; + } + + public void setIsIndoor(boolean isIndoor) { + this.isIndoor = isIndoor; + } + + public boolean isIsLcdOn() { + return isLcdOn; + } + + public void setIsLcdOn(boolean isLcdOn) { + this.isLcdOn = isLcdOn; + } + + public boolean isIsNetworkTime() { + return isNetworkTime; + } + + public void setIsNetworkTime(boolean isNetworkTime) { + this.isNetworkTime = isNetworkTime; + } + + public boolean isIsTemperatureCelsius() { + return isTemperatureCelsius; + } + + public void setIsTemperatureCelsius(boolean isTemperatureCelsius) { + this.isTemperatureCelsius = isTemperatureCelsius; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public int getLcdBrightness() { + return lcdBrightness; + } + + public void setLcdBrightness(int lcdBrightness) { + this.lcdBrightness = lcdBrightness; + } + + public String getNodeName() { + return nodeName; + } + + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + public PowerSaving getPowerSaving() { + return powerSaving; + } + + public void setPowerSaving(PowerSaving powerSaving) { + this.powerSaving = powerSaving; + } + + public String getSpeedUnit() { + return speedUnit; + } + + public void setSpeedUnit(String speedUnit) { + this.speedUnit = speedUnit; + } + + public String getTimezone() { + return timezone; + } + + public void setTimezone(String timezone) { + this.timezone = timezone; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Status.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Status.java new file mode 100644 index 0000000000..c49ee30e42 --- /dev/null +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/dto/airvisualpro/Status.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) 2010-2022 Contributors to the openHAB project + * + * See the NOTICE file(s) distributed with this work for additional + * information. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.openhab.binding.airvisualnode.internal.dto.airvisualpro; + +/** + * Status data. + * + * @author Victor Antonovich - Initial contribution + */ +public class Status { + + private String appVersion; + private int battery; + private long datetime; + private String deviceName; + private String ipAddress; + private String macAddress; + private String model; + private SensorLife sensorLife; + private String sensorPm25Serial; + private int syncTime; + private String systemVersion; + private int usedMemory; + private int wifiStrength; + + public Status(String appVersion, int battery, long datetime, String deviceName, String ipAddress, String macAddress, + String model, SensorLife sensorLife, String sensorPm25Serial, int syncTime, String systemVersion, + int usedMemory, int wifiStrength) { + this.appVersion = appVersion; + this.battery = battery; + this.datetime = datetime; + this.deviceName = deviceName; + this.ipAddress = ipAddress; + this.macAddress = macAddress; + this.model = model; + this.sensorLife = sensorLife; + this.sensorPm25Serial = sensorPm25Serial; + this.syncTime = syncTime; + this.systemVersion = systemVersion; + this.usedMemory = usedMemory; + this.wifiStrength = wifiStrength; + } + + public String getAppVersion() { + return appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } + + public int getBattery() { + return battery; + } + + public void setBattery(int battery) { + this.battery = battery; + } + + public long getDatetime() { + return datetime; + } + + public void setDatetime(long datetime) { + this.datetime = datetime; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public String getMacAddress() { + return macAddress; + } + + public void setMacAddress(String macAddress) { + this.macAddress = macAddress; + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public SensorLife getSensorLife() { + return sensorLife; + } + + public void setSensorLife(SensorLife sensorLife) { + this.sensorLife = sensorLife; + } + + public String getSensorPm25Serial() { + return sensorPm25Serial; + } + + public void setSensorPm25Serial(String sensorPm25Serial) { + this.sensorPm25Serial = sensorPm25Serial; + } + + public int getSyncTime() { + return syncTime; + } + + public void setSyncTime(int syncTime) { + this.syncTime = syncTime; + } + + public String getSystemVersion() { + return systemVersion; + } + + public void setSystemVersion(String systemVersion) { + this.systemVersion = systemVersion; + } + + public int getUsedMemory() { + return usedMemory; + } + + public void setUsedMemory(int usedMemory) { + this.usedMemory = usedMemory; + } + + public int getWifiStrength() { + return wifiStrength; + } + + public void setWifiStrength(int wifiStrength) { + this.wifiStrength = wifiStrength; + } +} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/handler/AirVisualNodeHandler.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/handler/AirVisualNodeHandler.java index f8532856b5..742e4db7b4 100644 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/handler/AirVisualNodeHandler.java +++ b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/handler/AirVisualNodeHandler.java @@ -35,11 +35,13 @@ import java.util.Map; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import org.eclipse.jdt.annotation.NonNullByDefault; +import org.eclipse.jdt.annotation.Nullable; import org.openhab.binding.airvisualnode.internal.config.AirVisualNodeConfig; -import org.openhab.binding.airvisualnode.internal.json.MeasurementsInterface; -import org.openhab.binding.airvisualnode.internal.json.NodeDataInterface; -import org.openhab.binding.airvisualnode.internal.json.airvisual.NodeData; -import org.openhab.binding.airvisualnode.internal.json.airvisualpro.ProNodeData; +import org.openhab.binding.airvisualnode.internal.dto.MeasurementsInterface; +import org.openhab.binding.airvisualnode.internal.dto.NodeDataInterface; +import org.openhab.binding.airvisualnode.internal.dto.airvisual.NodeData; +import org.openhab.binding.airvisualnode.internal.dto.airvisualpro.ProNodeData; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.QuantityType; @@ -71,29 +73,23 @@ import jcifs.smb.SmbFileInputStream; * * @author Victor Antonovich - Initial contribution */ +@NonNullByDefault public class AirVisualNodeHandler extends BaseThingHandler { private final Logger logger = LoggerFactory.getLogger(AirVisualNodeHandler.class); public static final String NODE_JSON_FILE = "latest_config_measurements.json"; + private static final long DELAY_IN_MS = 500; private final Gson gson; - - private ScheduledFuture pollFuture; - + private @Nullable ScheduledFuture pollFuture; private long refreshInterval; - - private String nodeAddress; - - private String nodeUsername; - - private String nodePassword; - - private String nodeShareName; - - private NodeDataInterface nodeData; - - private boolean isProVersion; + private String nodeAddress = ""; + private String nodeUsername = ""; + private String nodePassword = ""; + private String nodeShareName = ""; + private @Nullable NodeDataInterface nodeData; + private boolean isProVersion = false; public AirVisualNodeHandler(Thing thing) { super(thing); @@ -106,22 +102,19 @@ public class AirVisualNodeHandler extends BaseThingHandler { AirVisualNodeConfig config = getConfigAs(AirVisualNodeConfig.class); - if (config.address == null) { + if (config.address.isBlank()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Node address must be set"); return; } - this.nodeAddress = config.address; - - this.nodeUsername = config.username; - - if (config.password == null) { + if (config.password.isBlank()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Node password must be set"); return; } - this.nodePassword = config.password; + this.nodeAddress = config.address; + this.nodeUsername = config.username; + this.nodePassword = config.password; this.nodeShareName = config.share; - this.refreshInterval = config.refresh * 1000L; try { @@ -141,10 +134,17 @@ public class AirVisualNodeHandler extends BaseThingHandler { private void removeProChannels() { List channels = new ArrayList<>(getThing().getChannels()); - channels.removeIf(channel -> channel.getLabel().equals("PM0.1") || channel.getLabel().equals("PM10")); + channels.removeIf(channel -> isProChannel(channel.getLabel())); replaceChannels(channels); } + private boolean isProChannel(@Nullable String channelLabel) { + if (channelLabel == null || channelLabel.isBlank()) { + return false; + } + return "PM0.1".equals(channelLabel) || "PM10".equals(channelLabel); + } + private void replaceChannels(List channels) { ThingBuilder thingBuilder = editThing(); thingBuilder.withChannels(channels); @@ -173,14 +173,15 @@ public class AirVisualNodeHandler extends BaseThingHandler { } private synchronized void stopPoll() { - if (pollFuture != null && !pollFuture.isCancelled()) { - pollFuture.cancel(false); + ScheduledFuture localFuture = pollFuture; + if (localFuture != null) { + localFuture.cancel(false); } } private synchronized void schedulePoll() { - logger.debug("Scheduling poll for 500ms out, then every {} ms", refreshInterval); - pollFuture = scheduler.scheduleWithFixedDelay(this::poll, 500, refreshInterval, TimeUnit.MILLISECONDS); + logger.debug("Scheduling poll for {}}ms out, then every {} ms", DELAY_IN_MS, refreshInterval); + pollFuture = scheduler.scheduleWithFixedDelay(this::poll, DELAY_IN_MS, refreshInterval, TimeUnit.MILLISECONDS); } private void poll() { @@ -203,8 +204,9 @@ public class AirVisualNodeHandler extends BaseThingHandler { } else { currentNodeData = gson.fromJson(jsonData, NodeData.class); } - - if (nodeData == null || currentNodeData.getStatus().getDatetime() > nodeData.getStatus().getDatetime()) { + NodeDataInterface localNodeDate = nodeData; + if (localNodeDate == null + || currentNodeData.getStatus().getDatetime() > localNodeDate.getStatus().getDatetime()) { nodeData = currentNodeData; // Update all channels from the updated Node data for (Channel channel : getThing().getChannels()) { @@ -222,8 +224,9 @@ public class AirVisualNodeHandler extends BaseThingHandler { } private void updateChannel(String channelId, boolean force) { - if (nodeData != null && (force || isLinked(channelId))) { - State state = getChannelState(channelId, nodeData); + NodeDataInterface localnodeData = nodeData; + if (localnodeData != null && (force || isLinked(channelId))) { + State state = getChannelState(channelId, localnodeData); logger.debug("Update channel {} with state {}", channelId, state); updateState(channelId, state); } diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/DateAndTime.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/DateAndTime.java deleted file mode 100644 index 23d2f68067..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/DateAndTime.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json; - -/** - * Date and time / timestamp data. - * - * @author Victor Antonovich - Initial contribution - */ -public class DateAndTime { - - private String date; - private String time; - private String timestamp; - - public DateAndTime(String date, String time, String timestamp) { - this.date = date; - this.time = time; - this.timestamp = timestamp; - } - - public String getDate() { - return date; - } - - public void setDate(String date) { - this.date = date; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public String getTimestamp() { - return timestamp; - } - - public void setTimestamp(String timestamp) { - this.timestamp = timestamp; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/MeasurementsInterface.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/MeasurementsInterface.java deleted file mode 100644 index 8a188961ee..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/MeasurementsInterface.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json; - -import org.eclipse.jdt.annotation.NonNullByDefault; - -/** - * Interface for AirVisual and AirVisual Pro models measurements data - * - * @author Oleg Davydyuk - Initial contribution - */ -@NonNullByDefault -public interface MeasurementsInterface { - int getCo2Ppm(); - - int getHumidityRH(); - - int getPm25AQICN(); - - int getPm25AQIUS(); - - float getPm01Ugm3(); - - float getPm10Ugm3(); - - float getPm25Ugm3(); - - float getTemperatureC(); - - float getTemperatureF(); - - int getVocPpb(); -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/NodeDataInterface.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/NodeDataInterface.java deleted file mode 100644 index 6fc28849fe..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/NodeDataInterface.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json; - -import org.eclipse.jdt.annotation.NonNullByDefault; -import org.openhab.binding.airvisualnode.internal.json.airvisual.Settings; -import org.openhab.binding.airvisualnode.internal.json.airvisual.Status; - -/** - * Interface for AirVisual and AirVisual Pro models - * - * @author Oleg Davydyuk - Initial contribution - */ -@NonNullByDefault -public interface NodeDataInterface { - DateAndTime getDateAndTime(); - - MeasurementsInterface getMeasurements(); - - String getSerialNumber(); - - Settings getSettings(); - - Status getStatus(); -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/PowerSavingTime.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/PowerSavingTime.java deleted file mode 100644 index 6add6260b0..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/PowerSavingTime.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json; - -/** - * Power saving time data. - * - * @author Victor Antonovich - Initial contribution - */ -public class PowerSavingTime { - - private int hour; - private int minute; - - public PowerSavingTime(int hour, int minute) { - this.hour = hour; - this.minute = minute; - } - - public int getHour() { - return hour; - } - - public void setHour(int hour) { - this.hour = hour; - } - - public int getMinute() { - return minute; - } - - public void setMinute(int minute) { - this.minute = minute; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/PowerSavingTimeSlot.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/PowerSavingTimeSlot.java deleted file mode 100644 index fa4328231c..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/PowerSavingTimeSlot.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json; - -/** - * Power saving time slot data. - * - * @author Victor Antonovich - Initial contribution - */ -public class PowerSavingTimeSlot { - - private int hourOff; - private int hourOn; - - public PowerSavingTimeSlot(int hourOff, int hourOn) { - this.hourOff = hourOff; - this.hourOn = hourOn; - } - - public int getHourOff() { - return hourOff; - } - - public void setHourOff(int hourOff) { - this.hourOff = hourOff; - } - - public int getHourOn() { - return hourOn; - } - - public void setHourOn(int hourOn) { - this.hourOn = hourOn; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Measurements.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Measurements.java deleted file mode 100644 index da1d6492d4..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Measurements.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisual; - -import org.openhab.binding.airvisualnode.internal.json.MeasurementsInterface; - -import com.google.gson.annotations.SerializedName; - -/** - * Measurements data. - * - * @author Victor Antonovich - Initial contribution - */ -public class Measurements implements MeasurementsInterface { - - private int co2Ppm; - @SerializedName("humidity_RH") - private int humidityRH; - @SerializedName("pm25_AQICN") - private int pm25AQICN; - @SerializedName("pm25_AQIUS") - private int pm25AQIUS; - private float pm25Ugm3; - @SerializedName("temperature_C") - private float temperatureC; - @SerializedName("temperature_F") - private float temperatureF; - private int vocPpb; - - public Measurements(int co2Ppm, int humidityRH, int pm25AQICN, int pm25AQIUS, float pm25Ugm3, float temperatureC, - float temperatureF, int vocPpb) { - this.co2Ppm = co2Ppm; - this.humidityRH = humidityRH; - this.pm25AQICN = pm25AQICN; - this.pm25AQIUS = pm25AQIUS; - this.pm25Ugm3 = pm25Ugm3; - this.temperatureC = temperatureC; - this.temperatureF = temperatureF; - this.vocPpb = vocPpb; - } - - public int getCo2Ppm() { - return co2Ppm; - } - - public void setCo2Ppm(int co2Ppm) { - this.co2Ppm = co2Ppm; - } - - public int getHumidityRH() { - return humidityRH; - } - - public void setHumidityRH(int humidityRH) { - this.humidityRH = humidityRH; - } - - public int getPm25AQICN() { - return pm25AQICN; - } - - public void setPm25AQICN(int pm25AQICN) { - this.pm25AQICN = pm25AQICN; - } - - public int getPm25AQIUS() { - return pm25AQIUS; - } - - public void setPm25AQIUS(int pm25AQIUS) { - this.pm25AQIUS = pm25AQIUS; - } - - @Override - public float getPm01Ugm3() { - return 0; - } - - @Override - public float getPm10Ugm3() { - return 0; - } - - public float getPm25Ugm3() { - return pm25Ugm3; - } - - public void setPm25Ugm3(float pm25Ugm3) { - this.pm25Ugm3 = pm25Ugm3; - } - - public float getTemperatureC() { - return temperatureC; - } - - public void setTemperatureC(float temperatureC) { - this.temperatureC = temperatureC; - } - - public float getTemperatureF() { - return temperatureF; - } - - public void setTemperatureF(float temperatureF) { - this.temperatureF = temperatureF; - } - - public int getVocPpb() { - return vocPpb; - } - - public void setVocPpb(int vocPpb) { - this.vocPpb = vocPpb; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/NodeData.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/NodeData.java deleted file mode 100644 index 7ce8bc97cc..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/NodeData.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisual; - -import org.openhab.binding.airvisualnode.internal.json.DateAndTime; -import org.openhab.binding.airvisualnode.internal.json.MeasurementsInterface; -import org.openhab.binding.airvisualnode.internal.json.NodeDataInterface; - -/** - * Top level object for AirVisual Node JSON data. - * - * @author Victor Antonovich - Initial contribution - */ -public class NodeData implements NodeDataInterface { - - private DateAndTime dateAndTime; - private Measurements measurements; - private String serialNumber; - private Settings settings; - private Status status; - - public NodeData(DateAndTime dateAndTime, Measurements measurements, String serialNumber, Settings settings, - Status status) { - this.dateAndTime = dateAndTime; - this.measurements = measurements; - this.serialNumber = serialNumber; - this.settings = settings; - this.status = status; - } - - public DateAndTime getDateAndTime() { - return dateAndTime; - } - - public void setDateAndTime(DateAndTime dateAndTime) { - this.dateAndTime = dateAndTime; - } - - public MeasurementsInterface getMeasurements() { - return measurements; - } - - public void setMeasurements(Measurements measurements) { - this.measurements = measurements; - } - - public String getSerialNumber() { - return serialNumber; - } - - public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; - } - - public Settings getSettings() { - return settings; - } - - public void setSettings(Settings settings) { - this.settings = settings; - } - - public Status getStatus() { - return status; - } - - public void setStatus(Status status) { - this.status = status; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/PowerSaving.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/PowerSaving.java deleted file mode 100644 index 5e764d500e..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/PowerSaving.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisual; - -import java.util.List; - -import org.openhab.binding.airvisualnode.internal.json.PowerSavingTime; -import org.openhab.binding.airvisualnode.internal.json.PowerSavingTimeSlot; - -import com.google.gson.annotations.SerializedName; - -/** - * Power saving data. - * - * @author Victor Antonovich - Initial contribution - */ -public class PowerSaving { - - @SerializedName("2slots") - private List timeSlots = null; - private String mode; - @SerializedName("yes") - private List times = null; - - public PowerSaving(List timeSlots, String mode, List times) { - this.mode = mode; - this.times = times; - this.timeSlots = timeSlots; - } - - public List getTimeSlots() { - return timeSlots; - } - - public void setTimeSlots(List timeSlots) { - this.timeSlots = timeSlots; - } - - public List getTimes() { - return times; - } - - public void setTimes(List times) { - this.times = times; - } - - public String getMode() { - return mode; - } - - public void setMode(String mode) { - this.mode = mode; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Settings.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Settings.java deleted file mode 100644 index 5f5daaad6f..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Settings.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisual; - -/** - * Settings data. - * - * @author Victor Antonovich - Initial contribution - */ -public class Settings { - - private String followedStation; - private boolean isAqiUsa; - private boolean isConcentrationShowed; - private boolean isIndoor; - private boolean isLcdOn; - private boolean isNetworkTime; - private boolean isTemperatureCelsius; - private String language; - private int lcdBrightness; - private String nodeName; - private PowerSaving powerSaving; - private String speedUnit; - private String timezone; - - public Settings(String followedStation, boolean isAqiUsa, boolean isConcentrationShowed, boolean isIndoor, - boolean isLcdOn, boolean isNetworkTime, boolean isTemperatureCelsius, String language, int lcdBrightness, - String nodeName, PowerSaving powerSaving, String speedUnit, String timezone) { - this.followedStation = followedStation; - this.isAqiUsa = isAqiUsa; - this.isConcentrationShowed = isConcentrationShowed; - this.isIndoor = isIndoor; - this.isLcdOn = isLcdOn; - this.isNetworkTime = isNetworkTime; - this.isTemperatureCelsius = isTemperatureCelsius; - this.language = language; - this.lcdBrightness = lcdBrightness; - this.nodeName = nodeName; - this.powerSaving = powerSaving; - this.speedUnit = speedUnit; - this.timezone = timezone; - } - - public String getFollowedStation() { - return followedStation; - } - - public void setFollowedStation(String followedStation) { - this.followedStation = followedStation; - } - - public boolean isIsAqiUsa() { - return isAqiUsa; - } - - public void setIsAqiUsa(boolean isAqiUsa) { - this.isAqiUsa = isAqiUsa; - } - - public boolean isIsConcentrationShowed() { - return isConcentrationShowed; - } - - public void setIsConcentrationShowed(boolean isConcentrationShowed) { - this.isConcentrationShowed = isConcentrationShowed; - } - - public boolean isIsIndoor() { - return isIndoor; - } - - public void setIsIndoor(boolean isIndoor) { - this.isIndoor = isIndoor; - } - - public boolean isIsLcdOn() { - return isLcdOn; - } - - public void setIsLcdOn(boolean isLcdOn) { - this.isLcdOn = isLcdOn; - } - - public boolean isIsNetworkTime() { - return isNetworkTime; - } - - public void setIsNetworkTime(boolean isNetworkTime) { - this.isNetworkTime = isNetworkTime; - } - - public boolean isIsTemperatureCelsius() { - return isTemperatureCelsius; - } - - public void setIsTemperatureCelsius(boolean isTemperatureCelsius) { - this.isTemperatureCelsius = isTemperatureCelsius; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public int getLcdBrightness() { - return lcdBrightness; - } - - public void setLcdBrightness(int lcdBrightness) { - this.lcdBrightness = lcdBrightness; - } - - public String getNodeName() { - return nodeName; - } - - public void setNodeName(String nodeName) { - this.nodeName = nodeName; - } - - public PowerSaving getPowerSaving() { - return powerSaving; - } - - public void setPowerSaving(PowerSaving powerSaving) { - this.powerSaving = powerSaving; - } - - public String getSpeedUnit() { - return speedUnit; - } - - public void setSpeedUnit(String speedUnit) { - this.speedUnit = speedUnit; - } - - public String getTimezone() { - return timezone; - } - - public void setTimezone(String timezone) { - this.timezone = timezone; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Status.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Status.java deleted file mode 100644 index eb5b2a731b..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisual/Status.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisual; - -/** - * Status data. - * - * @author Victor Antonovich - Initial contribution - */ -public class Status { - - private String appVersion; - private int battery; - private long datetime; - private String model; - private String sensorPm25Serial; - private int syncTime; - private String systemVersion; - private int usedMemory; - private int wifiStrength; - - public Status(String appVersion, int battery, long datetime, String model, String sensorPm25Serial, int syncTime, - String systemVersion, int usedMemory, int wifiStrength) { - this.appVersion = appVersion; - this.battery = battery; - this.datetime = datetime; - this.model = model; - this.sensorPm25Serial = sensorPm25Serial; - this.syncTime = syncTime; - this.systemVersion = systemVersion; - this.usedMemory = usedMemory; - this.wifiStrength = wifiStrength; - } - - public String getAppVersion() { - return appVersion; - } - - public void setAppVersion(String appVersion) { - this.appVersion = appVersion; - } - - public int getBattery() { - return battery; - } - - public void setBattery(int battery) { - this.battery = battery; - } - - public long getDatetime() { - return datetime; - } - - public void setDatetime(long datetime) { - this.datetime = datetime; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public String getSensorPm25Serial() { - return sensorPm25Serial; - } - - public void setSensorPm25Serial(String sensorPm25Serial) { - this.sensorPm25Serial = sensorPm25Serial; - } - - public int getSyncTime() { - return syncTime; - } - - public void setSyncTime(int syncTime) { - this.syncTime = syncTime; - } - - public String getSystemVersion() { - return systemVersion; - } - - public void setSystemVersion(String systemVersion) { - this.systemVersion = systemVersion; - } - - public int getUsedMemory() { - return usedMemory; - } - - public void setUsedMemory(int usedMemory) { - this.usedMemory = usedMemory; - } - - public int getWifiStrength() { - return wifiStrength; - } - - public void setWifiStrength(int wifiStrength) { - this.wifiStrength = wifiStrength; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Measurements.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Measurements.java deleted file mode 100644 index d7e4d422de..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Measurements.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisualpro; - -import org.openhab.binding.airvisualnode.internal.json.MeasurementsInterface; - -import com.google.gson.annotations.SerializedName; - -/** - * Measurements data. - * - * @author Victor Antonovich - Initial contribution - */ -public class Measurements implements MeasurementsInterface { - - @SerializedName("co2_ppm") - private int co2Ppm; - - @SerializedName("humidity_RH") - private int humidityRH; - - @SerializedName("pm25_AQICN") - private int pm25AQICN; - - @SerializedName("pm25_AQIUS") - private int pm25AQIUS; - - @SerializedName("pm01_ugm3") - private float pm01Ugm3; - - @SerializedName("pm25_ugm3") - private float pm25Ugm3; - - @SerializedName("pm10_ugm3") - private float pm10Ugm3; - - @SerializedName("temperature_C") - private float temperatureC; - - @SerializedName("temperature_F") - private float temperatureF; - - private int vocPpb; - - public Measurements(int co2Ppm, int humidityRH, int pm25AQICN, int pm25AQIUS, float pm01Ugm3, float pm10Ugm3, - float pm25Ugm3, float temperatureC, float temperatureF, int vocPpb) { - - this.co2Ppm = co2Ppm; - this.humidityRH = humidityRH; - this.pm25AQICN = pm25AQICN; - this.pm25AQIUS = pm25AQIUS; - this.pm01Ugm3 = pm01Ugm3; - this.pm10Ugm3 = pm10Ugm3; - this.pm25Ugm3 = pm25Ugm3; - this.temperatureC = temperatureC; - this.temperatureF = temperatureF; - this.vocPpb = vocPpb; - } - - public int getCo2Ppm() { - return co2Ppm; - } - - public void setCo2Ppm(int co2Ppm) { - this.co2Ppm = co2Ppm; - } - - public int getHumidityRH() { - return humidityRH; - } - - public void setHumidityRH(int humidityRH) { - this.humidityRH = humidityRH; - } - - public int getPm25AQICN() { - return pm25AQICN; - } - - public void setPm25AQICN(int pm25AQICN) { - this.pm25AQICN = pm25AQICN; - } - - public int getPm25AQIUS() { - return pm25AQIUS; - } - - public void setPm25AQIUS(int pm25AQIUS) { - this.pm25AQIUS = pm25AQIUS; - } - - public float getPm01Ugm3() { - return pm01Ugm3; - } - - public void setPm01Ugm3(float pm01Ugm3) { - this.pm01Ugm3 = pm01Ugm3; - } - - public float getPm10Ugm3() { - return pm10Ugm3; - } - - public void setPm10Ugm3(float pm10Ugm3) { - this.pm10Ugm3 = pm10Ugm3; - } - - public float getPm25Ugm3() { - return pm25Ugm3; - } - - public void setPm25Ugm3(float pm25Ugm3) { - this.pm25Ugm3 = pm25Ugm3; - } - - public float getTemperatureC() { - return temperatureC; - } - - public void setTemperatureC(float temperatureC) { - this.temperatureC = temperatureC; - } - - public float getTemperatureF() { - return temperatureF; - } - - public void setTemperatureF(float temperatureF) { - this.temperatureF = temperatureF; - } - - public int getVocPpb() { - return vocPpb; - } - - public void setVocPpb(int vocPpb) { - this.vocPpb = vocPpb; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/PowerSaving.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/PowerSaving.java deleted file mode 100644 index bcab535000..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/PowerSaving.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisualpro; - -import java.util.List; - -import org.openhab.binding.airvisualnode.internal.json.PowerSavingTime; -import org.openhab.binding.airvisualnode.internal.json.PowerSavingTimeSlot; - -import com.google.gson.annotations.SerializedName; - -/** - * Power saving data. - * - * @author Victor Antonovich - Initial contribution - */ -public class PowerSaving { - - @SerializedName("2slots") - private List timeSlots = null; - - private String mode; - - private long runningTime; - - @SerializedName("yes") - private List times = null; - - public PowerSaving(List timeSlots, String mode, long runningTime, - List times) { - this.mode = mode; - this.runningTime = runningTime; - this.times = times; - this.timeSlots = timeSlots; - } - - public List getTimeSlots() { - return timeSlots; - } - - public void setTimeSlots(List timeSlots) { - this.timeSlots = timeSlots; - } - - public List getTimes() { - return times; - } - - public void setTimes(List times) { - this.times = times; - } - - public String getMode() { - return mode; - } - - public void setMode(String mode) { - this.mode = mode; - } - - public long getRunningTime() { - return runningTime; - } - - public void setRunningTime(long runningTime) { - this.runningTime = runningTime; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/ProNodeData.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/ProNodeData.java deleted file mode 100644 index 0f96444b6e..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/ProNodeData.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisualpro; - -import java.util.List; - -import org.openhab.binding.airvisualnode.internal.json.DateAndTime; -import org.openhab.binding.airvisualnode.internal.json.MeasurementsInterface; -import org.openhab.binding.airvisualnode.internal.json.NodeDataInterface; -import org.openhab.binding.airvisualnode.internal.json.airvisual.Settings; -import org.openhab.binding.airvisualnode.internal.json.airvisual.Status; - -/** - * Top level object for AirVisual Node JSON data. - * - * @author Victor Antonovich - Initial contribution - */ -public class ProNodeData implements NodeDataInterface { - - private DateAndTime dateAndTime; - private List measurements; - private String serialNumber; - private Settings settings; - private Status status; - - public ProNodeData(DateAndTime dateAndTime, List measurements, String serialNumber, Settings settings, - Status status) { - this.dateAndTime = dateAndTime; - this.measurements = measurements; - this.serialNumber = serialNumber; - this.settings = settings; - this.status = status; - } - - public DateAndTime getDateAndTime() { - return dateAndTime; - } - - public void setDateAndTime(DateAndTime dateAndTime) { - this.dateAndTime = dateAndTime; - } - - public MeasurementsInterface getMeasurements() { - return measurements.get(0); - } - - public void setMeasurements(List measurements) { - this.measurements = measurements; - } - - public String getSerialNumber() { - return serialNumber; - } - - public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; - } - - public Settings getSettings() { - return settings; - } - - public void setSettings(Settings settings) { - this.settings = settings; - } - - public Status getStatus() { - return status; - } - - public void setStatus(Status status) { - this.status = status; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/SensorLife.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/SensorLife.java deleted file mode 100644 index 60ab54aaf6..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/SensorLife.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisualpro; - -/** - * Sensor Usage/Life data - * - * @author Oleg Davydyuk - Initial contribution - */ -public class SensorLife { - - private long pm25; - - public SensorLife(long pm25) { - this.pm25 = pm25; - } - - public long getPm25() { - return pm25; - } - - public void setPm25(long pm25) { - this.pm25 = pm25; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/SensorMode.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/SensorMode.java deleted file mode 100644 index c3ec7ff0e9..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/SensorMode.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisualpro; - -/** - * Sensor Operating Mode - * - * @author Oleg Davydyuk - Initial contribution - */ -public class SensorMode { - - private long customModeInterval; - - private long mode; - - public SensorMode(long customModeInterval, long mode) { - this.customModeInterval = customModeInterval; - this.mode = mode; - } - - public long getCustomModeInterval() { - return customModeInterval; - } - - public void setCustomModeInterval(long customModeInterval) { - this.customModeInterval = customModeInterval; - } - - public long getMode() { - return mode; - } - - public void setMode(long mode) { - this.mode = mode; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Settings.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Settings.java deleted file mode 100644 index 4c65db14ef..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Settings.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisualpro; - -import org.openhab.binding.airvisualnode.internal.json.airvisual.PowerSaving; - -/** - * Settings data. - * - * @author Victor Antonovich - Initial contribution - */ -public class Settings { - - private String followMode; - private String followedStation; - private boolean isAqiUsa; - private boolean isConcentrationShowed; - private boolean isIndoor; - private boolean isLcdOn; - private boolean isNetworkTime; - private boolean isTemperatureCelsius; - private String language; - private int lcdBrightness; - private String nodeName; - private PowerSaving powerSaving; - private SensorMode sensorMode; - private String speedUnit; - private String timezone; - - public Settings(String followMode, String followedStation, boolean isAqiUsa, boolean isConcentrationShowed, - boolean isIndoor, boolean isLcdOn, boolean isNetworkTime, boolean isTemperatureCelsius, String language, - int lcdBrightness, String nodeName, PowerSaving powerSaving, SensorMode sensorMode, String speedUnit, - String timezone) { - - this.followMode = followMode; - this.followedStation = followedStation; - this.isAqiUsa = isAqiUsa; - this.isConcentrationShowed = isConcentrationShowed; - this.isIndoor = isIndoor; - this.isLcdOn = isLcdOn; - this.isNetworkTime = isNetworkTime; - this.isTemperatureCelsius = isTemperatureCelsius; - this.language = language; - this.lcdBrightness = lcdBrightness; - this.nodeName = nodeName; - this.powerSaving = powerSaving; - this.sensorMode = sensorMode; - this.speedUnit = speedUnit; - this.timezone = timezone; - } - - public String getFollowMode() { - return followMode; - } - - public void setFollowMode(String followMode) { - this.followMode = followMode; - } - - public String getFollowedStation() { - return followedStation; - } - - public void setFollowedStation(String followedStation) { - this.followedStation = followedStation; - } - - public boolean isIsAqiUsa() { - return isAqiUsa; - } - - public void setIsAqiUsa(boolean isAqiUsa) { - this.isAqiUsa = isAqiUsa; - } - - public boolean isIsConcentrationShowed() { - return isConcentrationShowed; - } - - public void setIsConcentrationShowed(boolean isConcentrationShowed) { - this.isConcentrationShowed = isConcentrationShowed; - } - - public boolean isIsIndoor() { - return isIndoor; - } - - public void setIsIndoor(boolean isIndoor) { - this.isIndoor = isIndoor; - } - - public boolean isIsLcdOn() { - return isLcdOn; - } - - public void setIsLcdOn(boolean isLcdOn) { - this.isLcdOn = isLcdOn; - } - - public boolean isIsNetworkTime() { - return isNetworkTime; - } - - public void setIsNetworkTime(boolean isNetworkTime) { - this.isNetworkTime = isNetworkTime; - } - - public boolean isIsTemperatureCelsius() { - return isTemperatureCelsius; - } - - public void setIsTemperatureCelsius(boolean isTemperatureCelsius) { - this.isTemperatureCelsius = isTemperatureCelsius; - } - - public String getLanguage() { - return language; - } - - public void setLanguage(String language) { - this.language = language; - } - - public int getLcdBrightness() { - return lcdBrightness; - } - - public void setLcdBrightness(int lcdBrightness) { - this.lcdBrightness = lcdBrightness; - } - - public String getNodeName() { - return nodeName; - } - - public void setNodeName(String nodeName) { - this.nodeName = nodeName; - } - - public PowerSaving getPowerSaving() { - return powerSaving; - } - - public void setPowerSaving(PowerSaving powerSaving) { - this.powerSaving = powerSaving; - } - - public String getSpeedUnit() { - return speedUnit; - } - - public void setSpeedUnit(String speedUnit) { - this.speedUnit = speedUnit; - } - - public String getTimezone() { - return timezone; - } - - public void setTimezone(String timezone) { - this.timezone = timezone; - } -} diff --git a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Status.java b/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Status.java deleted file mode 100644 index 599afad2b1..0000000000 --- a/bundles/org.openhab.binding.airvisualnode/src/main/java/org/openhab/binding/airvisualnode/internal/json/airvisualpro/Status.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) 2010-2022 Contributors to the openHAB project - * - * See the NOTICE file(s) distributed with this work for additional - * information. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0 - * - * SPDX-License-Identifier: EPL-2.0 - */ -package org.openhab.binding.airvisualnode.internal.json.airvisualpro; - -/** - * Status data. - * - * @author Victor Antonovich - Initial contribution - */ -public class Status { - - private String appVersion; - private int battery; - private long datetime; - private String deviceName; - private String ipAddress; - private String macAddress; - private String model; - private SensorLife sensorLife; - private String sensorPm25Serial; - private int syncTime; - private String systemVersion; - private int usedMemory; - private int wifiStrength; - - public Status(String appVersion, int battery, long datetime, String deviceName, String ipAddress, String macAddress, - String model, SensorLife sensorLife, String sensorPm25Serial, int syncTime, String systemVersion, - int usedMemory, int wifiStrength) { - this.appVersion = appVersion; - this.battery = battery; - this.datetime = datetime; - this.deviceName = deviceName; - this.ipAddress = ipAddress; - this.macAddress = macAddress; - this.model = model; - this.sensorLife = sensorLife; - this.sensorPm25Serial = sensorPm25Serial; - this.syncTime = syncTime; - this.systemVersion = systemVersion; - this.usedMemory = usedMemory; - this.wifiStrength = wifiStrength; - } - - public String getAppVersion() { - return appVersion; - } - - public void setAppVersion(String appVersion) { - this.appVersion = appVersion; - } - - public int getBattery() { - return battery; - } - - public void setBattery(int battery) { - this.battery = battery; - } - - public long getDatetime() { - return datetime; - } - - public void setDatetime(long datetime) { - this.datetime = datetime; - } - - public String getDeviceName() { - return deviceName; - } - - public void setDeviceName(String deviceName) { - this.deviceName = deviceName; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public String getMacAddress() { - return macAddress; - } - - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public SensorLife getSensorLife() { - return sensorLife; - } - - public void setSensorLife(SensorLife sensorLife) { - this.sensorLife = sensorLife; - } - - public String getSensorPm25Serial() { - return sensorPm25Serial; - } - - public void setSensorPm25Serial(String sensorPm25Serial) { - this.sensorPm25Serial = sensorPm25Serial; - } - - public int getSyncTime() { - return syncTime; - } - - public void setSyncTime(int syncTime) { - this.syncTime = syncTime; - } - - public String getSystemVersion() { - return systemVersion; - } - - public void setSystemVersion(String systemVersion) { - this.systemVersion = systemVersion; - } - - public int getUsedMemory() { - return usedMemory; - } - - public void setUsedMemory(int usedMemory) { - this.usedMemory = usedMemory; - } - - public int getWifiStrength() { - return wifiStrength; - } - - public void setWifiStrength(int wifiStrength) { - this.wifiStrength = wifiStrength; - } -}