2 * Copyright (c) 2010-2024 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.volvooncall.internal.dto;
15 import static org.openhab.binding.volvooncall.internal.VolvoOnCallBindingConstants.UNDEFINED;
17 import java.util.List;
18 import java.util.Optional;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.core.library.types.OnOffType;
24 import com.google.gson.annotations.SerializedName;
27 * The {@link Status} is responsible for storing
28 * Status information returned by vehicle status rest answer
30 * @author Gaƫl L'hopital - Initial contribution
33 public class Status extends VocAnswer {
34 public enum FluidLevel {
35 @SerializedName("Normal")
37 @SerializedName("Low")
39 @SerializedName("VeryLow")
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;
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;
66 public Optional<WindowsStatus> getWindows() {
67 return Optional.ofNullable(windows);
70 public Optional<DoorsStatus> getDoors() {
71 return Optional.ofNullable(doors);
74 public Optional<TyrePressure> getTyrePressure() {
75 return Optional.ofNullable(tyrePressure);
78 public Optional<HvBattery> getHvBattery() {
79 return Optional.ofNullable(hvBattery);
82 public Optional<Heater> getHeater() {
83 return Optional.ofNullable(heater);
86 public Optional<OnOffType> getCarLocked() {
87 return Optional.ofNullable(carLocked);
90 public Optional<OnOffType> getEngineRunning() {
91 return Optional.ofNullable(engineRunning);
94 public boolean aFailedBulb() {
95 return !bulbFailures.isEmpty();
99 * Currently not used in the binding, maybe interesting for the future
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;