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

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

package com.geotab.model.entity.device;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.geotab.model.CustomParameter;
import com.geotab.model.entity.enginetype.EngineType;
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.GoTalkLanguage;
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 java.util.Optional;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * A legacy Geotab device is any GO device prior to GO4v3. Additional properties can be seen in
 * {@link Device}.
 */
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class GoLegacy extends GoDevice implements DigitalAuxiliariesAware, RfChannelsAware {

  /**
   * The distance to be used (in meters) to generate a log. A log will be reported each time the
   * this distance has been exceeded. Default [1000].
   */
  protected Integer deltaDistance;

  /**
   * The delta heading. Default [48].
   */
  protected Integer deltaHeading;

  /**
   * The delta heading HS. Default [14].
   */
  protected Integer deltaHeadingHS;

  /**
   * The delta heading min speed in km/h. Default [14].
   */
  protected Double deltaHeadingMinSpeed;

  /**
   * The delta heading min speed HS in km/h. Default [72].
   */
  protected Double deltaHeadingMinSpeedHS;

  /**
   * The delta min speed in km/h. Default [50].
   */
  protected Double deltaMinSpeed;

  /**
   * The delta speed in km/h. Default [9].
   */
  protected Double deltaSpeed;

  /**
   * The harsh break. Default [17].
   */
  protected Double harshBreak;

  /**
   * Whether to send warning on harsh brake. Default [false].
   */
  @JsonProperty("isHarshBrakeWarningOn")
  protected boolean isHarshBrakeWarningOn;

  /**
   * An array that can get/set the AuxWarningSpeeds for the vehicle.
   */
  protected double[] auxWarningSpeed;

  /**
   * An array that can get/set the EnableAuxWarnings for the vehicle.
   */
  protected boolean[] enableAuxWarning;

  /**
   * The EnableControlExternalRelay value for the vehicle.
   */
  protected boolean enableControlExternalRelay;

  /**
   * The External Device ShutDown Delay value for the vehicle.
   */
  protected int externalDeviceShutDownDelay;

  /**
   * The immobilize arming.
   */
  protected int immobilizeArming;

  /**
   * The immobilize unit.
   */
  protected boolean immobilizeUnit;

  /**
   * An array that can get/set the IsAuxIgnTriggers for the vehicle.
   */
  @JsonProperty("isAuxIgnTrigger")
  protected boolean[] isAuxIgnTrigger;

  /**
   * An array of values indicating if a corresponding Aux signal should be inverted on importing the
   * device data.
   */
  @JsonProperty("isAuxInverted")
  protected boolean[] isAuxInverted;

  /**
   * Exposes the radio channels as an array of 20 bytes.
   */
  protected short[] channel;

  /**
   * The channel count.
   */
  protected Byte channelCount;

  /**
   * The FrequencyOffset used on the device radio. The default is 1 and should not be changed. Only
   * has an effect on Channel Set 0 - which consists of channels 0 to 15.
   */
  protected Byte frequencyOffset;

  /**
   * A value indicating whether this instance is aided GPS enabled.
   */
  @JsonProperty("isAidedGpsEnabled")
  protected boolean isAidedGpsEnabled;

  /**
   * The IsRfUploadOnWhenMoving value for the vehicle.
   */
  @JsonProperty("isRfUploadOnWhenMoving")
  protected boolean isRfUploadOnWhenMoving;

  /**
   * The version of this set of rf channels. Each time a change is made, increment this value until
   * it rolls over.
   */
  protected short rfParameterVersion;

  @Builder(builderMethodName = "goLegacyBuilder")
  public GoLegacy(String id, String name, Long version, DeviceType deviceType,
      LocalDateTime ignoreDownloadsUntil, String serialNumber, Integer productId,
      String vehicleIdentificationNumber, String licensePlate, String licenseState,
      Short major, Short minor, Duration timeToDownload, WorkTime workTime,
      List groups, List devicePlans, boolean pinDevice,
      String timeZoneId, Float maxSecondsBetweenLogs,
      LocalDateTime activeFrom, LocalDateTime activeTo, String comment, DeviceFlags deviceFlags,
      List autoGroups, List customParameters, boolean disableBuzzer,
      boolean enableBeepOnIdle, boolean enableMustReprogram, boolean enableSpeedWarning,
      EngineType engineType, String engineVehicleIdentificationNumber,
      boolean ensureHotStart, Integer gpsOffDelay, Integer idleMinutes, Boolean isSpeedIndicator,
      Double minAccidentSpeed, Short parameterVersion, Double speedingOff, Double speedingOn,
      GoTalkLanguage goTalkLanguage, Double fuelTankCapacity, Boolean disableSleeperBerth,
      HosOption autoHos, Short parameterVersionOnDevice,
      Integer deltaDistance, Integer deltaHeading, Integer deltaHeadingHS,
      Double deltaHeadingMinSpeed, Double deltaHeadingMinSpeedHS, Double deltaMinSpeed,
      Double deltaSpeed, Double harshBreak, boolean isHarshBrakeWarningOn, double[] auxWarningSpeed,
      boolean[] enableAuxWarning, boolean enableControlExternalRelay,
      int externalDeviceShutDownDelay, int immobilizeArming, boolean immobilizeUnit,
      boolean[] isAuxIgnTrigger, boolean[] isAuxInverted, short[] channel,
      Byte channelCount, Byte frequencyOffset, Boolean isAidedGpsEnabled,
      Boolean isRfUploadOnWhenMoving, Short rfParameterVersion,
      Map customFeatures) {

    super(id, name, version, deviceType, ignoreDownloadsUntil, serialNumber, productId,
        vehicleIdentificationNumber, licensePlate, licenseState, major, minor,
        timeToDownload, workTime, groups, devicePlans, pinDevice, timeZoneId,
        maxSecondsBetweenLogs, activeFrom, activeTo, comment, deviceFlags, autoGroups,
        customParameters, disableBuzzer, enableBeepOnIdle, enableMustReprogram, enableSpeedWarning,
        engineType, engineVehicleIdentificationNumber, ensureHotStart, gpsOffDelay,
        idleMinutes, isSpeedIndicator, minAccidentSpeed, parameterVersion, speedingOff, speedingOn,
        goTalkLanguage, fuelTankCapacity, disableSleeperBerth, autoHos, parameterVersionOnDevice,
        customFeatures);

    this.deltaDistance = deltaDistance;
    this.deltaHeading = deltaHeading;
    this.deltaHeadingHS = deltaHeadingHS;
    this.deltaHeadingMinSpeed = deltaHeadingMinSpeed;
    this.deltaHeadingMinSpeedHS = deltaHeadingMinSpeedHS;
    this.deltaMinSpeed = deltaMinSpeed;
    this.deltaSpeed = deltaSpeed;
    this.harshBreak = harshBreak;
    this.isHarshBrakeWarningOn = isHarshBrakeWarningOn;
    this.auxWarningSpeed = checkAndPadAuxArray(auxWarningSpeed);
    this.enableAuxWarning = checkAndPadAuxArray(enableAuxWarning);
    this.enableControlExternalRelay = enableControlExternalRelay;
    this.externalDeviceShutDownDelay = externalDeviceShutDownDelay;
    this.immobilizeArming = immobilizeArming;
    this.immobilizeUnit = immobilizeUnit;
    this.isAuxIgnTrigger = checkAndPadAuxIgnArray(isAuxIgnTrigger);
    this.isAuxInverted = checkAndPadAuxArray(isAuxInverted);
    this.channel = checkAndPadChannelArray(channel);
    this.channelCount = channelCount;
    this.frequencyOffset = frequencyOffset;
    this.isAidedGpsEnabled = isAidedGpsEnabled;
    this.isRfUploadOnWhenMoving = isRfUploadOnWhenMoving;
    this.rfParameterVersion = rfParameterVersion;
  }

  @Override
  public void populateDefaults() {
    super.populateDefaults();
    this.productId = Optional.ofNullable(this.productId).orElse(1);
    DeviceDefaultsUtil.addGoLegacyDefaults(this);
    DeviceDefaultsUtil.addRfChannelDefaults(this);
    DeviceDefaultsUtil.addAuxiliaryDefaults(this);
  }

  public void setChannel(short[] channel) {
    this.channel = checkAndPadChannelArray(channel);
  }

  public void setEnableAuxWarning(boolean[] enableAuxWarning) {
    this.enableAuxWarning = checkAndPadAuxArray(enableAuxWarning);
  }

  public void setIsAuxIgnTrigger(boolean[] isAuxIgnTrigger) {
    this.isAuxIgnTrigger = checkAndPadAuxIgnArray(isAuxIgnTrigger);
  }

  public void setIsAuxInverted(boolean[] isAuxInverted) {
    this.isAuxInverted = checkAndPadAuxArray(isAuxInverted);
  }

  public void setAuxWarningSpeed(double[] auxWarningSpeed) {
    this.auxWarningSpeed = checkAndPadAuxArray(auxWarningSpeed);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy