]> git.basschouten.com Git - openhab-addons.git/blob
fcdf6659e1f8f66c5412d1848765898e989468a0
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.volvooncall.internal.dto;
14
15 import java.time.ZonedDateTime;
16 import java.util.Optional;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 /**
22  * The {@link PositionData} is responsible for storing
23  * informations returned by vehicle position rest
24  * answer
25  *
26  * @author GaĆ«l L'hopital - Initial contribution
27  */
28 @NonNullByDefault
29 public class PositionData {
30     public @Nullable Double longitude;
31     public @Nullable Double latitude;
32     private @Nullable ZonedDateTime timestamp;
33     public @Nullable String speed;
34     private @Nullable String heading;
35
36     public Boolean isHeading() {
37         return "true".equalsIgnoreCase(heading);
38     }
39
40     public Optional<ZonedDateTime> getTimestamp() {
41         ZonedDateTime timestamp = this.timestamp;
42         if (timestamp != null) {
43             return Optional.of(timestamp);
44         }
45         return Optional.empty();
46     }
47     /*
48      * Currently unused in the binding, maybe interesting in the future
49      * private String streetAddress;
50      * private String postalCode;
51      * private String city;
52      * private String iSO2CountryCode;
53      * private String region;
54      */
55 }