com.geotab.model.entity.diagnostic.Diagnostic Maven / Gradle / Ivy
/*
*
* 2020 Copyright (C) Geotab Inc. All rights reserved.
*/
package com.geotab.model.entity.diagnostic;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.geotab.model.entity.NameEntityWithVersion;
import com.geotab.model.entity.controller.Controller;
import com.geotab.model.entity.enginetype.EngineType;
import com.geotab.model.entity.source.Source;
import com.geotab.model.entity.unitofmeasure.UnitOfMeasure;
import com.geotab.model.enumeration.DiagnosticType;
import com.geotab.model.enumeration.FaultResetMode;
import com.geotab.model.enumeration.ValidLoggingPeriod;
import com.geotab.model.serialization.ControllerAsStringSerializer;
import com.geotab.model.serialization.DiagnosticDeserializer;
import com.google.common.collect.Lists;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* Vehicle diagnostic information from the engine computer that can either be measurement data or
* fault code data.
*
* Note: Diagnostics cannot be added, set or removed via the API..
*/
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonDeserialize(using = DiagnosticDeserializer.class)
public abstract class Diagnostic extends NameEntityWithVersion {
public static final List TAMPERING_DIAGNOSTICS = Lists.newArrayList(
new BasicDiagnostic("DiagnosticDeviceRestartedBecauseAllPowerWasRemovedId"),
new BasicDiagnostic("DiagnosticGpsAntennaUnpluggedId"),
new BasicDiagnostic("DiagnosticGpsAntennaShortCircuitId")
);
/**
* The diagnostic parameter code number.
*/
protected Integer code;
/**
* The applicable {@link Controller} for the diagnostic parameter.
*/
@JsonSerialize(using = ControllerAsStringSerializer.class)
protected Controller controller;
/**
* The {@link DiagnosticType} (source) of the diagnostic parameter.
*/
protected DiagnosticType diagnosticType;
/**
* The {@link EngineType} for this diagnostic if applicable.
*/
protected EngineType engineType;
/**
* The {@link FaultResetMode} of the diagnostic (whether the fault resets automatically or
* manually).
*/
protected FaultResetMode faultResetMode;
/**
* The {@link Source} for the diagnostic (the type of diagnostic code).
*/
protected Source source;
/**
* The {@link UnitOfMeasure} applicable to the diagnostic parameter.
*/
protected UnitOfMeasure unitOfMeasure;
/**
* The {@link ValidLoggingPeriod}. The diagnostic should only be interpolated within the range of
* the given type.
*/
protected ValidLoggingPeriod validLoggingPeriod;
/**
* The value which describes if the diagnostic guarantees it will log when estimate error is
* exceeded.
*/
@JsonProperty("isLogGuaranteedOnEstimateError")
protected Boolean isLogGuaranteedOnEstimateError;
protected Diagnostic(String id, String name, Long version, Integer code,
Controller controller, DiagnosticType diagnosticType,
EngineType engineType, FaultResetMode faultResetMode,
Source source, UnitOfMeasure unitOfMeasure,
ValidLoggingPeriod validLoggingPeriod, Boolean isLogGuaranteedOnEstimateError) {
super(id, name, version);
this.code = code;
this.controller = controller;
this.diagnosticType = diagnosticType;
this.engineType = engineType;
this.faultResetMode = faultResetMode;
this.source = source;
this.unitOfMeasure = unitOfMeasure;
this.validLoggingPeriod = validLoggingPeriod;
this.isLogGuaranteedOnEstimateError = isLogGuaranteedOnEstimateError;
}
}