]> git.basschouten.com Git - openhab-addons.git/blob
73b375d2b90dd15f8d55f322d022afdd14837d7a
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.volvooncall.internal.dto;
14
15 import static org.openhab.binding.volvooncall.internal.VolvoOnCallBindingConstants.UNDEFINED;
16
17 import java.util.List;
18 import java.util.Optional;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.core.library.types.OnOffType;
23
24 import com.google.gson.annotations.SerializedName;
25
26 /**
27  * The {@link Status} is responsible for storing
28  * Status information returned by vehicle status rest answer
29  *
30  * @author GaĆ«l L'hopital - Initial contribution
31  */
32 @NonNullByDefault
33 public class Status extends VocAnswer {
34     public enum FluidLevel {
35         @SerializedName("Normal")
36         NORMAL,
37         @SerializedName("Low")
38         LOW,
39         @SerializedName("VeryLow")
40         VERY_LOW,
41         UNKNOWN
42     }
43
44     public double averageFuelConsumption = UNDEFINED;
45     public int averageSpeed = UNDEFINED;
46     public int fuelAmount = UNDEFINED;
47     public int fuelAmountLevel = UNDEFINED;
48     public int distanceToEmpty = UNDEFINED;
49     public int odometer = UNDEFINED;
50     public int tripMeter1 = UNDEFINED;
51     public int tripMeter2 = UNDEFINED;
52
53     private @Nullable OnOffType carLocked;
54     private @Nullable OnOffType engineRunning;
55     @SerializedName("brakeFluid")
56     public FluidLevel brakeFluidLevel = FluidLevel.UNKNOWN;
57     public FluidLevel washerFluidLevel = FluidLevel.UNKNOWN;
58     private @Nullable WindowsStatus windows;
59     private @Nullable DoorsStatus doors;
60     private @Nullable TyrePressure tyrePressure;
61     private @Nullable HvBattery hvBattery;
62     private @Nullable Heater heater;
63     public String serviceWarningStatus = "";
64     private @NonNullByDefault({}) List<Object> bulbFailures;
65
66     public Optional<WindowsStatus> getWindows() {
67         return Optional.ofNullable(windows);
68     }
69
70     public Optional<DoorsStatus> getDoors() {
71         return Optional.ofNullable(doors);
72     }
73
74     public Optional<TyrePressure> getTyrePressure() {
75         return Optional.ofNullable(tyrePressure);
76     }
77
78     public Optional<HvBattery> getHvBattery() {
79         return Optional.ofNullable(hvBattery);
80     }
81
82     public Optional<Heater> getHeater() {
83         return Optional.ofNullable(heater);
84     }
85
86     public Optional<OnOffType> getCarLocked() {
87         return Optional.ofNullable(carLocked);
88     }
89
90     public Optional<OnOffType> getEngineRunning() {
91         return Optional.ofNullable(engineRunning);
92     }
93
94     public boolean aFailedBulb() {
95         return !bulbFailures.isEmpty();
96     }
97
98     /*
99      * Currently not used in the binding, maybe interesting for the future
100      *
101      * @SerializedName("ERS")
102      * private ERSStatus ers;
103      * private ZonedDateTime averageFuelConsumptionTimestamp;
104      * private ZonedDateTime averageSpeedTimestamp;
105      * private ZonedDateTime brakeFluidTimestamp;
106      * private ZonedDateTime bulbFailuresTimestamp;
107      * private ZonedDateTime carLockedTimestamp;
108      * private ZonedDateTime distanceToEmptyTimestamp;
109      * private ZonedDateTime engineRunningTimestamp;
110      * private ZonedDateTime fuelAmountLevelTimestamp;
111      * private ZonedDateTime fuelAmountTimestamp;
112      * private ZonedDateTime odometerTimestamp;
113      * private Boolean privacyPolicyEnabled;
114      * private ZonedDateTime privacyPolicyEnabledTimestamp;
115      * private String remoteClimatizationStatus;
116      * private ZonedDateTime remoteClimatizationStatusTimestamp;
117      * private ZonedDateTime serviceWarningStatusTimestamp;
118      * private Object theftAlarm;
119      * private String timeFullyAccessibleUntil;
120      * private String timePartiallyAccessibleUntil;
121      * private ZonedDateTime tripMeter1Timestamp;
122      * private ZonedDateTime tripMeter2Timestamp;
123      * private ZonedDateTime washerFluidLevelTimestamp;
124      */
125 }