2 * Copyright (c) 2010-2023 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 java.time.ZonedDateTime;
16 import java.util.Optional;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * The {@link PositionData} is responsible for storing
23 * informations returned by vehicle position rest
26 * @author Gaƫl L'hopital - Initial contribution
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;
36 public Boolean isHeading() {
37 return "true".equalsIgnoreCase(heading);
40 public Optional<ZonedDateTime> getTimestamp() {
41 ZonedDateTime timestamp = this.timestamp;
42 if (timestamp != null) {
43 return Optional.of(timestamp);
45 return Optional.empty();
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;