All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.geotab.model.entity.device.CustomVehicleDevice Maven / Gradle / Ivy

package com.geotab.model.entity.device;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.geotab.model.entity.group.Group;
import com.geotab.model.entity.worktime.WorkTime;
import com.geotab.model.enumeration.DevicePlan;
import com.geotab.model.enumeration.DeviceType;
import com.geotab.model.enumeration.HosOption;
import com.geotab.util.DeviceDefaultsUtil;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * A custom third-party automotive vehicle device that is used in MyGeotab. This is used for
 * extensibility and is based on the {@link CustomDevice} object.
 */
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class CustomVehicleDevice
    extends CustomDevice
    implements VehicleIdentificationNumberAware, OdometerAdjustmentProviderAware,
    EngineHoursAdjustmentProviderAware, LicensableAware {

  /**
   * Vehicle Identification Number (VIN) of the vehicle associated with the device. Maximum length
   * [50] Default [""].
   */
  private String vehicleIdentificationNumber;

  /**
   * Engine Vehicle Identification Number from the engine of the vehicle associated with the
   * device.
   */
  private String engineVehicleIdentificationNumber;

  /**
   * The Odometer for the device.
   */
  private Double odometer;

  /**
   * A value used to correct the odometer value received from the engine. Default [1].
   */
  private Float odometerFactor;

  /**
   * The offset to be applied odometer reported by the engine computer. Default [0].
   */
  private Double odometerOffset;

  /**
   * The Engine Hours for the device. Default [0].
   */
  private Double engineHours;

  /**
   * The offset to be applied engine hours data reported by the engine computer. Default [0].
   */
  private Integer engineHourOffset;

  /**
   * The vehicle license plate details of the vehicle associated with the device. Maximum length
   * [50] Default [""].
   */
  private String licensePlate;

  /**
   * The state or province of the vehicle associated with the device. Maximum length [50] Default
   * [""].
   */
  private String licenseState;

  /**
   * Toggle that determines whether or not a device is under automatic vehicle management. Default
   * [false].
   */
  @JsonProperty("pinDevice")
  private boolean pinDevice;

  /**
   * Disable or enable sleeper berth.
   */
  private Boolean disableSleeperBerth;

  /**
   * A toggle that represents automatic generation of DutyStatusLogs for a {@link Device}.
   */
  private HosOption autoHos;

  @Override
  public void populateDefaults() {
    super.populateDefaults();
    DeviceDefaultsUtil.addCustomVehicleDeviceDefaults(this);
  }

  @JsonIgnore
  public boolean isAutomaticVehicleManagementEnabled() {
    return !pinDevice;
  }

  @Builder(builderMethodName = "customVehicleDeviceBuilder")
  public CustomVehicleDevice(String id, String name, Long version, DeviceType deviceType,
      LocalDateTime ignoreDownloadsUntil, String serialNumber, Integer productId,
      Duration timeToDownload,
      WorkTime workTime, List groups, List devicePlans, String timeZoneId,
      Float maxSecondsBetweenLogs, LocalDateTime activeFrom,
      LocalDateTime activeTo, String comment, DeviceFlags deviceFlags,
      String vehicleIdentificationNumber, String engineVehicleIdentificationNumber,
      Double odometer, Float odometerFactor, Double odometerOffset, Double engineHours,
      Integer engineHourOffset, String licensePlate, String licenseState, boolean pinDevice,
      Boolean disableSleeperBerth, HosOption autoHos, Map customFeatures) {

    super(id, name, version, deviceType, ignoreDownloadsUntil, serialNumber, productId,
        timeToDownload, workTime, groups, devicePlans, timeZoneId,
        maxSecondsBetweenLogs, activeFrom, activeTo, comment, deviceFlags, customFeatures);

    this.vehicleIdentificationNumber = vehicleIdentificationNumber;
    this.engineVehicleIdentificationNumber = engineVehicleIdentificationNumber;
    this.odometer = odometer;
    this.odometerFactor = odometerFactor;
    this.odometerOffset = odometerOffset;
    this.engineHours = engineHours;
    this.engineHourOffset = engineHourOffset;
    this.licensePlate = licensePlate;
    this.licenseState = licenseState;
    this.pinDevice = pinDevice;
    this.disableSleeperBerth = disableSleeperBerth;
    this.autoHos = autoHos;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy