convert

package
v0.2.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package convert provides a function to generate conversion functions for a vehicle struct.

Code generated by github.com/DIMO-Network/model-garage.

Code generated by github.com/DIMO-Network/model-garage DO NOT EDIT.

Code generated by github.com/DIMO-Network/model-garage DO NOT EDIT.

Index

Constants

View Source
const (
	// StatusV1 is the version string for payloads with the version 1.0 schema.
	StatusV1 = "v1.0.0"
	// StatusV1Converted is the version string for payloads that have been converted to the 1.0 schema.
	StatusV1Converted = "v1.1.0"
	// StatusV2 is the version string for payloads with the version 2.0 schema.
	StatusV2 = "v2.0.0"
)

Variables

This section is empty.

Functions

func ChassisAxleRow1WheelLeftTirePressureFromV1Data added in v0.2.7

func ChassisAxleRow1WheelLeftTirePressureFromV1Data(jsonData []byte) (ret float64, err error)

ChassisAxleRow1WheelLeftTirePressureFromV1Data converts the given JSON data to a float64.

func ChassisAxleRow1WheelLeftTirePressureFromV2Data added in v0.2.7

func ChassisAxleRow1WheelLeftTirePressureFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

ChassisAxleRow1WheelLeftTirePressureFromData converts the given JSON data to a float64.

func ChassisAxleRow1WheelRightTirePressureFromV1Data added in v0.2.7

func ChassisAxleRow1WheelRightTirePressureFromV1Data(jsonData []byte) (ret float64, err error)

ChassisAxleRow1WheelRightTirePressureFromV1Data converts the given JSON data to a float64.

func ChassisAxleRow1WheelRightTirePressureFromV2Data added in v0.2.7

func ChassisAxleRow1WheelRightTirePressureFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

ChassisAxleRow1WheelRightTirePressureFromData converts the given JSON data to a float64.

func ChassisAxleRow2WheelLeftTirePressureFromV1Data added in v0.2.7

func ChassisAxleRow2WheelLeftTirePressureFromV1Data(jsonData []byte) (ret float64, err error)

ChassisAxleRow2WheelLeftTirePressureFromV1Data converts the given JSON data to a float64.

func ChassisAxleRow2WheelLeftTirePressureFromV2Data added in v0.2.7

func ChassisAxleRow2WheelLeftTirePressureFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

ChassisAxleRow2WheelLeftTirePressureFromData converts the given JSON data to a float64.

func ChassisAxleRow2WheelRightTirePressureFromV1Data added in v0.2.7

func ChassisAxleRow2WheelRightTirePressureFromV1Data(jsonData []byte) (ret float64, err error)

ChassisAxleRow2WheelRightTirePressureFromV1Data converts the given JSON data to a float64.

func ChassisAxleRow2WheelRightTirePressureFromV2Data added in v0.2.7

func ChassisAxleRow2WheelRightTirePressureFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

ChassisAxleRow2WheelRightTirePressureFromData converts the given JSON data to a float64.

func CurrentLocationAltitudeFromV1Data added in v0.2.7

func CurrentLocationAltitudeFromV1Data(jsonData []byte) (ret float64, err error)

CurrentLocationAltitudeFromV1Data converts the given JSON data to a float64.

func CurrentLocationAltitudeFromV2Data added in v0.2.7

func CurrentLocationAltitudeFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

CurrentLocationAltitudeFromData converts the given JSON data to a float64.

func CurrentLocationIsRedactedFromV1Data added in v0.2.7

func CurrentLocationIsRedactedFromV1Data(jsonData []byte) (ret float64, err error)

CurrentLocationIsRedactedFromV1Data converts the given JSON data to a float64.

func CurrentLocationIsRedactedFromV2Data added in v0.2.7

func CurrentLocationIsRedactedFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

CurrentLocationIsRedactedFromData converts the given JSON data to a float64.

func CurrentLocationLatitudeFromV1Data added in v0.2.7

func CurrentLocationLatitudeFromV1Data(jsonData []byte) (ret float64, err error)

CurrentLocationLatitudeFromV1Data converts the given JSON data to a float64.

func CurrentLocationLatitudeFromV2Data added in v0.2.7

func CurrentLocationLatitudeFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

CurrentLocationLatitudeFromData converts the given JSON data to a float64.

func CurrentLocationLongitudeFromV1Data added in v0.2.7

func CurrentLocationLongitudeFromV1Data(jsonData []byte) (ret float64, err error)

CurrentLocationLongitudeFromV1Data converts the given JSON data to a float64.

func CurrentLocationLongitudeFromV2Data added in v0.2.7

func CurrentLocationLongitudeFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

CurrentLocationLongitudeFromData converts the given JSON data to a float64.

func DIMOAftermarketHDOPFromV1Data added in v0.2.7

func DIMOAftermarketHDOPFromV1Data(jsonData []byte) (ret float64, err error)

DIMOAftermarketHDOPFromV1Data converts the given JSON data to a float64.

func DIMOAftermarketHDOPFromV2Data added in v0.2.7

func DIMOAftermarketHDOPFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

DIMOAftermarketHDOPFromData converts the given JSON data to a float64.

func DIMOAftermarketNSATFromV1Data added in v0.2.7

func DIMOAftermarketNSATFromV1Data(jsonData []byte) (ret float64, err error)

DIMOAftermarketNSATFromV1Data converts the given JSON data to a float64.

func DIMOAftermarketNSATFromV2Data added in v0.2.7

func DIMOAftermarketNSATFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

DIMOAftermarketNSATFromData converts the given JSON data to a float64.

func DIMOAftermarketSSIDFromV1Data added in v0.2.7

func DIMOAftermarketSSIDFromV1Data(jsonData []byte) (ret string, err error)

DIMOAftermarketSSIDFromV1Data converts the given JSON data to a string.

func DIMOAftermarketSSIDFromV2Data added in v0.2.7

func DIMOAftermarketSSIDFromV2Data(originalDoc []byte, result gjson.Result) (ret string, err error)

DIMOAftermarketSSIDFromData converts the given JSON data to a string.

func DIMOAftermarketWPAStateFromV1Data added in v0.2.7

func DIMOAftermarketWPAStateFromV1Data(jsonData []byte) (ret string, err error)

DIMOAftermarketWPAStateFromV1Data converts the given JSON data to a string.

func DIMOAftermarketWPAStateFromV2Data added in v0.2.7

func DIMOAftermarketWPAStateFromV2Data(originalDoc []byte, result gjson.Result) (ret string, err error)

DIMOAftermarketWPAStateFromData converts the given JSON data to a string.

func ExteriorAirTemperatureFromV1Data added in v0.2.7

func ExteriorAirTemperatureFromV1Data(jsonData []byte) (ret float64, err error)

ExteriorAirTemperatureFromV1Data converts the given JSON data to a float64.

func ExteriorAirTemperatureFromV2Data added in v0.2.7

func ExteriorAirTemperatureFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

ExteriorAirTemperatureFromData converts the given JSON data to a float64.

func GetSchemaVersion added in v0.2.1

func GetSchemaVersion(jsonData []byte) string

GetSchemaVersion returns the version string of the schema used in the payload.

func IsInvalidType added in v0.2.7

func IsInvalidType(err error) bool

IsInvalidType returns true if the error is of type errInvalidType.

func LowVoltageBatteryCurrentVoltageFromV1Data added in v0.2.7

func LowVoltageBatteryCurrentVoltageFromV1Data(jsonData []byte) (ret float64, err error)

LowVoltageBatteryCurrentVoltageFromV1Data converts the given JSON data to a float64.

func LowVoltageBatteryCurrentVoltageFromV2Data added in v0.2.7

func LowVoltageBatteryCurrentVoltageFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

LowVoltageBatteryCurrentVoltageFromData converts the given JSON data to a float64.

func NameFromV2Signal added in v0.2.1

func NameFromV2Signal(sigResult gjson.Result) (string, error)

NameFromV2Signal gets a name from a V2 signal.

func OBDBarometricPressureFromV1Data added in v0.2.7

func OBDBarometricPressureFromV1Data(jsonData []byte) (ret float64, err error)

OBDBarometricPressureFromV1Data converts the given JSON data to a float64.

func OBDBarometricPressureFromV2Data added in v0.2.7

func OBDBarometricPressureFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

OBDBarometricPressureFromData converts the given JSON data to a float64.

func OBDEngineLoadFromV1Data added in v0.2.7

func OBDEngineLoadFromV1Data(jsonData []byte) (ret float64, err error)

OBDEngineLoadFromV1Data converts the given JSON data to a float64.

func OBDEngineLoadFromV2Data added in v0.2.7

func OBDEngineLoadFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

OBDEngineLoadFromData converts the given JSON data to a float64.

func OBDIntakeTempFromV1Data added in v0.2.7

func OBDIntakeTempFromV1Data(jsonData []byte) (ret float64, err error)

OBDIntakeTempFromV1Data converts the given JSON data to a float64.

func OBDIntakeTempFromV2Data added in v0.2.7

func OBDIntakeTempFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

OBDIntakeTempFromData converts the given JSON data to a float64.

func OBDRunTimeFromV1Data added in v0.2.7

func OBDRunTimeFromV1Data(jsonData []byte) (ret float64, err error)

OBDRunTimeFromV1Data converts the given JSON data to a float64.

func OBDRunTimeFromV2Data added in v0.2.7

func OBDRunTimeFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

OBDRunTimeFromData converts the given JSON data to a float64.

func PowertrainCombustionEngineECTFromV1Data added in v0.2.7

func PowertrainCombustionEngineECTFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainCombustionEngineECTFromV1Data converts the given JSON data to a float64.

func PowertrainCombustionEngineECTFromV2Data added in v0.2.7

func PowertrainCombustionEngineECTFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainCombustionEngineECTFromData converts the given JSON data to a float64.

func PowertrainCombustionEngineEngineOilLevelFromV1Data added in v0.2.7

func PowertrainCombustionEngineEngineOilLevelFromV1Data(jsonData []byte) (ret string, err error)

PowertrainCombustionEngineEngineOilLevelFromV1Data converts the given JSON data to a string.

func PowertrainCombustionEngineEngineOilLevelFromV2Data added in v0.2.7

func PowertrainCombustionEngineEngineOilLevelFromV2Data(originalDoc []byte, result gjson.Result) (ret string, err error)

PowertrainCombustionEngineEngineOilLevelFromData converts the given JSON data to a string.

func PowertrainCombustionEngineEngineOilRelativeLevelFromV1Data added in v0.2.7

func PowertrainCombustionEngineEngineOilRelativeLevelFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainCombustionEngineEngineOilRelativeLevelFromV1Data converts the given JSON data to a float64.

func PowertrainCombustionEngineEngineOilRelativeLevelFromV2Data added in v0.2.7

func PowertrainCombustionEngineEngineOilRelativeLevelFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainCombustionEngineEngineOilRelativeLevelFromData converts the given JSON data to a float64.

func PowertrainCombustionEngineMAFFromV1Data added in v0.2.7

func PowertrainCombustionEngineMAFFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainCombustionEngineMAFFromV1Data converts the given JSON data to a float64.

func PowertrainCombustionEngineMAFFromV2Data added in v0.2.7

func PowertrainCombustionEngineMAFFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainCombustionEngineMAFFromData converts the given JSON data to a float64.

func PowertrainCombustionEngineSpeedFromV1Data added in v0.2.7

func PowertrainCombustionEngineSpeedFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainCombustionEngineSpeedFromV1Data converts the given JSON data to a float64.

func PowertrainCombustionEngineSpeedFromV2Data added in v0.2.7

func PowertrainCombustionEngineSpeedFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainCombustionEngineSpeedFromData converts the given JSON data to a float64.

func PowertrainCombustionEngineTPSFromV1Data added in v0.2.7

func PowertrainCombustionEngineTPSFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainCombustionEngineTPSFromV1Data converts the given JSON data to a float64.

func PowertrainCombustionEngineTPSFromV2Data added in v0.2.7

func PowertrainCombustionEngineTPSFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainCombustionEngineTPSFromData converts the given JSON data to a float64.

func PowertrainFuelSystemRelativeLevelFromV1Data added in v0.2.7

func PowertrainFuelSystemRelativeLevelFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainFuelSystemRelativeLevelFromV1Data converts the given JSON data to a float64.

func PowertrainFuelSystemRelativeLevelFromV2Data added in v0.2.7

func PowertrainFuelSystemRelativeLevelFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainFuelSystemRelativeLevelFromData converts the given JSON data to a float64.

func PowertrainFuelSystemSupportedFuelTypesFromV1Data added in v0.2.7

func PowertrainFuelSystemSupportedFuelTypesFromV1Data(jsonData []byte) (ret string, err error)

PowertrainFuelSystemSupportedFuelTypesFromV1Data converts the given JSON data to a string.

func PowertrainFuelSystemSupportedFuelTypesFromV2Data added in v0.2.7

func PowertrainFuelSystemSupportedFuelTypesFromV2Data(originalDoc []byte, result gjson.Result) (ret string, err error)

PowertrainFuelSystemSupportedFuelTypesFromData converts the given JSON data to a string.

func PowertrainRangeFromV1Data added in v0.2.7

func PowertrainRangeFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainRangeFromV1Data converts the given JSON data to a float64.

func PowertrainRangeFromV2Data added in v0.2.7

func PowertrainRangeFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainRangeFromData converts the given JSON data to a float64.

func PowertrainTractionBatteryChargingChargeLimitFromV1Data added in v0.2.7

func PowertrainTractionBatteryChargingChargeLimitFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainTractionBatteryChargingChargeLimitFromV1Data converts the given JSON data to a float64.

func PowertrainTractionBatteryChargingChargeLimitFromV2Data added in v0.2.7

func PowertrainTractionBatteryChargingChargeLimitFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainTractionBatteryChargingChargeLimitFromData converts the given JSON data to a float64.

func PowertrainTractionBatteryChargingIsChargingFromV1Data added in v0.2.7

func PowertrainTractionBatteryChargingIsChargingFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainTractionBatteryChargingIsChargingFromV1Data converts the given JSON data to a float64.

func PowertrainTractionBatteryChargingIsChargingFromV2Data added in v0.2.7

func PowertrainTractionBatteryChargingIsChargingFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainTractionBatteryChargingIsChargingFromData converts the given JSON data to a float64.

func PowertrainTractionBatteryCurrentPowerFromV1Data added in v0.2.7

func PowertrainTractionBatteryCurrentPowerFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainTractionBatteryCurrentPowerFromV1Data converts the given JSON data to a float64.

func PowertrainTractionBatteryCurrentPowerFromV2Data added in v0.2.7

func PowertrainTractionBatteryCurrentPowerFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainTractionBatteryCurrentPowerFromData converts the given JSON data to a float64.

func PowertrainTractionBatteryGrossCapacityFromV1Data added in v0.2.7

func PowertrainTractionBatteryGrossCapacityFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainTractionBatteryGrossCapacityFromV1Data converts the given JSON data to a float64.

func PowertrainTractionBatteryGrossCapacityFromV2Data added in v0.2.7

func PowertrainTractionBatteryGrossCapacityFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainTractionBatteryGrossCapacityFromData converts the given JSON data to a float64.

func PowertrainTractionBatteryStateOfChargeCurrentFromV1Data added in v0.2.7

func PowertrainTractionBatteryStateOfChargeCurrentFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainTractionBatteryStateOfChargeCurrentFromV1Data converts the given JSON data to a float64.

func PowertrainTractionBatteryStateOfChargeCurrentFromV2Data added in v0.2.7

func PowertrainTractionBatteryStateOfChargeCurrentFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainTractionBatteryStateOfChargeCurrentFromData converts the given JSON data to a float64.

func PowertrainTransmissionTravelledDistanceFromV1Data added in v0.2.7

func PowertrainTransmissionTravelledDistanceFromV1Data(jsonData []byte) (ret float64, err error)

PowertrainTransmissionTravelledDistanceFromV1Data converts the given JSON data to a float64.

func PowertrainTransmissionTravelledDistanceFromV2Data added in v0.2.7

func PowertrainTransmissionTravelledDistanceFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

PowertrainTransmissionTravelledDistanceFromData converts the given JSON data to a float64.

func PowertrainTypeFromV1Data added in v0.2.7

func PowertrainTypeFromV1Data(jsonData []byte) (ret string, err error)

PowertrainTypeFromV1Data converts the given JSON data to a string.

func PowertrainTypeFromV2Data added in v0.2.7

func PowertrainTypeFromV2Data(originalDoc []byte, result gjson.Result) (ret string, err error)

PowertrainTypeFromData converts the given JSON data to a string.

func SignalsFromPayload

func SignalsFromPayload(ctx context.Context, tokenGetter TokenIDGetter, jsonData []byte) ([]vss.Signal, error)

SignalsFromPayload extracts signals from a payload. It detects the payload version and calls the appropriate function.

func SignalsFromV1Data added in v0.2.7

func SignalsFromV1Data(baseSignal vss.Signal, jsonData []byte) ([]vss.Signal, []error)

SignalsFromV1Data creates a slice of vss.Signal from the given v1 status JSON data. On error, partial results may be returned.

func SignalsFromV1Payload

func SignalsFromV1Payload(ctx context.Context, tokenGetter TokenIDGetter, jsonData []byte) ([]vss.Signal, error)

SignalsFromV1Payload gets a slice signals from a v1 payload.

func SignalsFromV2Data added in v0.2.7

func SignalsFromV2Data(originalDoc []byte, baseSignal vss.Signal, signalName string, sigResult gjson.Result) ([]vss.Signal, error)

SignalsFromData converts the given JSON data to a slice of signals.

func SignalsFromV2Payload

func SignalsFromV2Payload(jsonData []byte) ([]vss.Signal, error)

SignalsFromV2Payload extracts signals from a V2 payload.

func SourceFromData added in v0.2.10

func SourceFromData(jsonData []byte) (string, error)

SourceFromData gets a source from a V2 payload.

func SpeedFromV1Data added in v0.2.7

func SpeedFromV1Data(jsonData []byte) (ret float64, err error)

SpeedFromV1Data converts the given JSON data to a float64.

func SpeedFromV2Data added in v0.2.7

func SpeedFromV2Data(originalDoc []byte, result gjson.Result) (ret float64, err error)

SpeedFromData converts the given JSON data to a float64.

func SubjectFromV1Data added in v0.2.1

func SubjectFromV1Data(jsonData []byte) (string, error)

SubjectFromV1Data gets a subject from a v1 payload.

func TimestampFromV1Data added in v0.2.1

func TimestampFromV1Data(jsonData []byte) (time.Time, error)

TimestampFromV1Data gets a timestamp from a v1 payload.

func TimestampFromV2Signal added in v0.2.1

func TimestampFromV2Signal(sigResult gjson.Result) (time.Time, error)

TimestampFromV2Signal gets a timestamp from a V2 signal.

func ToChassisAxleRow1WheelLeftTirePressure0 added in v0.2.7

func ToChassisAxleRow1WheelLeftTirePressure0(originalDoc []byte, val float64) (float64, error)

ToChassisAxleRow1WheelLeftTirePressure0 converts data from field 'tires.frontLeft' of type float64 to 'Vehicle.Chassis.Axle.Row1.Wheel.Left.Tire.Pressure' of type float64. Vehicle.Chassis.Axle.Row1.Wheel.Left.Tire.Pressure: Tire pressure in kilo-Pascal. Unit: 'kPa'

func ToChassisAxleRow1WheelRightTirePressure0 added in v0.2.7

func ToChassisAxleRow1WheelRightTirePressure0(originalDoc []byte, val float64) (float64, error)

ToChassisAxleRow1WheelRightTirePressure0 converts data from field 'tires.frontRight' of type float64 to 'Vehicle.Chassis.Axle.Row1.Wheel.Right.Tire.Pressure' of type float64. Vehicle.Chassis.Axle.Row1.Wheel.Right.Tire.Pressure: Tire pressure in kilo-Pascal. Unit: 'kPa'

func ToChassisAxleRow2WheelLeftTirePressure0 added in v0.2.7

func ToChassisAxleRow2WheelLeftTirePressure0(originalDoc []byte, val float64) (float64, error)

ToChassisAxleRow2WheelLeftTirePressure0 converts data from field 'tires.backLeft' of type float64 to 'Vehicle.Chassis.Axle.Row2.Wheel.Left.Tire.Pressure' of type float64. Vehicle.Chassis.Axle.Row2.Wheel.Left.Tire.Pressure: Tire pressure in kilo-Pascal. Unit: 'kPa'

func ToChassisAxleRow2WheelRightTirePressure0 added in v0.2.7

func ToChassisAxleRow2WheelRightTirePressure0(originalDoc []byte, val float64) (float64, error)

ToChassisAxleRow2WheelRightTirePressure0 converts data from field 'tires.backRight' of type float64 to 'Vehicle.Chassis.Axle.Row2.Wheel.Right.Tire.Pressure' of type float64. Vehicle.Chassis.Axle.Row2.Wheel.Right.Tire.Pressure: Tire pressure in kilo-Pascal. Unit: 'kPa'

func ToCurrentLocationAltitude0 added in v0.2.7

func ToCurrentLocationAltitude0(originalDoc []byte, val float64) (float64, error)

ToCurrentLocationAltitude0 converts data from field 'altitude' of type float64 to 'Vehicle.CurrentLocation.Altitude' of type float64. Vehicle.CurrentLocation.Altitude: Current altitude relative to WGS 84 reference ellipsoid, as measured at the position of GNSS receiver antenna. Unit: 'm'

func ToCurrentLocationIsRedacted0 added in v0.2.7

func ToCurrentLocationIsRedacted0(originalDoc []byte, val bool) (float64, error)

ToCurrentLocationIsRedacted0 converts data from field 'isRedacted' of type bool to 'Vehicle.CurrentLocation.IsRedacted' of type float64. Vehicle.CurrentLocation.IsRedacted: Indicates if the latitude and longitude signals at the current timestamp have been redacted using a privacy zone.

func ToCurrentLocationLatitude0 added in v0.2.7

func ToCurrentLocationLatitude0(originalDoc []byte, val float64) (float64, error)

ToCurrentLocationLatitude0 converts data from field 'latitude' of type float64 to 'Vehicle.CurrentLocation.Latitude' of type float64. Vehicle.CurrentLocation.Latitude: Current latitude of vehicle in WGS 84 geodetic coordinates, as measured at the position of GNSS receiver antenna. Unit: 'degrees' Min: '-90' Max: '90'

func ToCurrentLocationLongitude0 added in v0.2.7

func ToCurrentLocationLongitude0(originalDoc []byte, val float64) (float64, error)

ToCurrentLocationLongitude0 converts data from field 'longitude' of type float64 to 'Vehicle.CurrentLocation.Longitude' of type float64. Vehicle.CurrentLocation.Longitude: Current longitude of vehicle in WGS 84 geodetic coordinates, as measured at the position of GNSS receiver antenna. Unit: 'degrees' Min: '-180' Max: '180'

func ToDIMOAftermarketHDOP0 added in v0.2.7

func ToDIMOAftermarketHDOP0(originalDoc []byte, val float64) (float64, error)

ToDIMOAftermarketHDOP0 converts data from field 'hdop' of type float64 to 'Vehicle.DIMO.Aftermarket.HDOP' of type float64. Vehicle.DIMO.Aftermarket.HDOP: Horizontal dilution of precision of GPS

func ToDIMOAftermarketNSAT0 added in v0.2.7

func ToDIMOAftermarketNSAT0(originalDoc []byte, val float64) (float64, error)

ToDIMOAftermarketNSAT0 converts data from field 'nsat' of type float64 to 'Vehicle.DIMO.Aftermarket.NSAT' of type float64. Vehicle.DIMO.Aftermarket.NSAT: Number of sync satellites for GPS

func ToDIMOAftermarketSSID0 added in v0.2.7

func ToDIMOAftermarketSSID0(originalDoc []byte, val string) (string, error)

ToDIMOAftermarketSSID0 converts data from field 'ssid' of type string to 'Vehicle.DIMO.Aftermarket.SSID' of type string. Vehicle.DIMO.Aftermarket.SSID: Service Set Identifier for the wifi.

func ToDIMOAftermarketSSID1 added in v0.2.7

func ToDIMOAftermarketSSID1(originalDoc []byte, val string) (string, error)

ToDIMOAftermarketSSID1 converts data from field 'wifi.ssid' of type string to 'Vehicle.DIMO.Aftermarket.SSID' of type string. Vehicle.DIMO.Aftermarket.SSID: Service Set Identifier for the wifi.

func ToDIMOAftermarketWPAState0 added in v0.2.7

func ToDIMOAftermarketWPAState0(originalDoc []byte, val string) (string, error)

ToDIMOAftermarketWPAState0 converts data from field 'wpa_state' of type string to 'Vehicle.DIMO.Aftermarket.WPAState' of type string. Vehicle.DIMO.Aftermarket.WPAState: Indicate the current WPA state for the device's wifi

func ToDIMOAftermarketWPAState1 added in v0.2.7

func ToDIMOAftermarketWPAState1(originalDoc []byte, val string) (string, error)

ToDIMOAftermarketWPAState1 converts data from field 'wifi.wpaState' of type string to 'Vehicle.DIMO.Aftermarket.WPAState' of type string. Vehicle.DIMO.Aftermarket.WPAState: Indicate the current WPA state for the device's wifi

func ToExteriorAirTemperature0 added in v0.2.7

func ToExteriorAirTemperature0(originalDoc []byte, val float64) (float64, error)

ToExteriorAirTemperature0 converts data from field 'ambientAirTemp' of type float64 to 'Vehicle.Exterior.AirTemperature' of type float64. Vehicle.Exterior.AirTemperature: Air temperature outside the vehicle. Unit: 'celsius'

func ToExteriorAirTemperature1 added in v0.2.7

func ToExteriorAirTemperature1(originalDoc []byte, val float64) (float64, error)

ToExteriorAirTemperature1 converts data from field 'ambientTemp' of type float64 to 'Vehicle.Exterior.AirTemperature' of type float64. Vehicle.Exterior.AirTemperature: Air temperature outside the vehicle. Unit: 'celsius'

func ToLowVoltageBatteryCurrentVoltage0 added in v0.2.7

func ToLowVoltageBatteryCurrentVoltage0(originalDoc []byte, val float64) (float64, error)

ToLowVoltageBatteryCurrentVoltage0 converts data from field 'batteryVoltage' of type float64 to 'Vehicle.LowVoltageBattery.CurrentVoltage' of type float64. Vehicle.LowVoltageBattery.CurrentVoltage: Current Voltage of the low voltage battery. Unit: 'V'

func ToOBDBarometricPressure0 added in v0.2.7

func ToOBDBarometricPressure0(originalDoc []byte, val float64) (float64, error)

ToOBDBarometricPressure0 converts data from field 'barometricPressure' of type float64 to 'Vehicle.OBD.BarometricPressure' of type float64. Vehicle.OBD.BarometricPressure: PID 33 - Barometric pressure Unit: 'kPa'

func ToOBDEngineLoad0 added in v0.2.7

func ToOBDEngineLoad0(originalDoc []byte, val float64) (float64, error)

ToOBDEngineLoad0 converts data from field 'engineLoad' of type float64 to 'Vehicle.OBD.EngineLoad' of type float64. Vehicle.OBD.EngineLoad: PID 04 - Engine load in percent - 0 = no load, 100 = full load Unit: 'percent'

func ToOBDIntakeTemp0 added in v0.2.7

func ToOBDIntakeTemp0(originalDoc []byte, val float64) (float64, error)

ToOBDIntakeTemp0 converts data from field 'intakeTemp' of type float64 to 'Vehicle.OBD.IntakeTemp' of type float64. Vehicle.OBD.IntakeTemp: PID 0F - Intake temperature Unit: 'celsius'

func ToOBDRunTime0 added in v0.2.7

func ToOBDRunTime0(originalDoc []byte, val float64) (float64, error)

ToOBDRunTime0 converts data from field 'runTime' of type float64 to 'Vehicle.OBD.RunTime' of type float64. Vehicle.OBD.RunTime: PID 1F - Engine run time Unit: 's'

func ToPowertrainCombustionEngineECT0 added in v0.2.7

func ToPowertrainCombustionEngineECT0(originalDoc []byte, val float64) (float64, error)

ToPowertrainCombustionEngineECT0 converts data from field 'coolantTemp' of type float64 to 'Vehicle.Powertrain.CombustionEngine.ECT' of type float64. Vehicle.Powertrain.CombustionEngine.ECT: Engine coolant temperature. Unit: 'celsius'

func ToPowertrainCombustionEngineEngineOilLevel0 added in v0.2.7

func ToPowertrainCombustionEngineEngineOilLevel0(originalDoc []byte, val float64) (string, error)

ToPowertrainCombustionEngineEngineOilLevel0 converts data from field 'oil' of type float64 to 'Vehicle.Powertrain.CombustionEngine.EngineOilLevel' of type string. Vehicle.Powertrain.CombustionEngine.EngineOilLevel: Engine oil level.

func ToPowertrainCombustionEngineEngineOilRelativeLevel0 added in v0.2.7

func ToPowertrainCombustionEngineEngineOilRelativeLevel0(originalDoc []byte, val float64) (float64, error)

ToPowertrainCombustionEngineEngineOilRelativeLevel0 converts data from field 'oil' of type float64 to 'Vehicle.Powertrain.CombustionEngine.EngineOilRelativeLevel' of type float64. Vehicle.Powertrain.CombustionEngine.EngineOilRelativeLevel: Engine oil level as a percentage. Unit: 'percent' Min: '0' Max: '100'

func ToPowertrainCombustionEngineMAF0 added in v0.2.7

func ToPowertrainCombustionEngineMAF0(originalDoc []byte, val float64) (float64, error)

ToPowertrainCombustionEngineMAF0 converts data from field 'maf' of type float64 to 'Vehicle.Powertrain.CombustionEngine.MAF' of type float64. Vehicle.Powertrain.CombustionEngine.MAF: Grams of air drawn into engine per second. Unit: 'g/s'

func ToPowertrainCombustionEngineSpeed0 added in v0.2.7

func ToPowertrainCombustionEngineSpeed0(originalDoc []byte, val float64) (float64, error)

ToPowertrainCombustionEngineSpeed0 converts data from field 'rpm' of type float64 to 'Vehicle.Powertrain.CombustionEngine.Speed' of type float64. Vehicle.Powertrain.CombustionEngine.Speed: Engine speed measured as rotations per minute. Unit: 'rpm'

func ToPowertrainCombustionEngineSpeed1 added in v0.2.7

func ToPowertrainCombustionEngineSpeed1(originalDoc []byte, val float64) (float64, error)

ToPowertrainCombustionEngineSpeed1 converts data from field 'engineSpeed' of type float64 to 'Vehicle.Powertrain.CombustionEngine.Speed' of type float64. Vehicle.Powertrain.CombustionEngine.Speed: Engine speed measured as rotations per minute. Unit: 'rpm'

func ToPowertrainCombustionEngineTPS0 added in v0.2.7

func ToPowertrainCombustionEngineTPS0(originalDoc []byte, val float64) (float64, error)

ToPowertrainCombustionEngineTPS0 converts data from field 'throttlePosition' of type float64 to 'Vehicle.Powertrain.CombustionEngine.TPS' of type float64. Vehicle.Powertrain.CombustionEngine.TPS: Current throttle position. Unit: 'percent' Max: '100'

func ToPowertrainFuelSystemRelativeLevel0 added in v0.2.7

func ToPowertrainFuelSystemRelativeLevel0(originalDoc []byte, val float64) (float64, error)

ToPowertrainFuelSystemRelativeLevel0 converts data from field 'fuelLevel' of type float64 to 'Vehicle.Powertrain.FuelSystem.RelativeLevel' of type float64. Vehicle.Powertrain.FuelSystem.RelativeLevel: Level in fuel tank as percent of capacity. 0 = empty. 100 = full. Unit: 'percent' Min: '0' Max: '100'

func ToPowertrainFuelSystemRelativeLevel1 added in v0.2.7

func ToPowertrainFuelSystemRelativeLevel1(originalDoc []byte, val float64) (float64, error)

ToPowertrainFuelSystemRelativeLevel1 converts data from field 'fuelPercentRemaining' of type float64 to 'Vehicle.Powertrain.FuelSystem.RelativeLevel' of type float64. Vehicle.Powertrain.FuelSystem.RelativeLevel: Level in fuel tank as percent of capacity. 0 = empty. 100 = full. Unit: 'percent' Min: '0' Max: '100'

func ToPowertrainFuelSystemSupportedFuelTypes0 added in v0.2.7

func ToPowertrainFuelSystemSupportedFuelTypes0(originalDoc []byte, val string) (string, error)

ToPowertrainFuelSystemSupportedFuelTypes0 converts data from field 'fuelType' of type string to 'Vehicle.Powertrain.FuelSystem.SupportedFuelTypes' of type string. Vehicle.Powertrain.FuelSystem.SupportedFuelTypes: High level information of fuel types supported

func ToPowertrainRange0 added in v0.2.7

func ToPowertrainRange0(originalDoc []byte, val float64) (float64, error)

ToPowertrainRange0 converts data from field 'range' of type float64 to 'Vehicle.Powertrain.Range' of type float64. Vehicle.Powertrain.Range: Remaining range in meters using all energy sources available in the vehicle. Unit: 'm'

func ToPowertrainTractionBatteryChargingChargeLimit0 added in v0.2.7

func ToPowertrainTractionBatteryChargingChargeLimit0(originalDoc []byte, val float64) (float64, error)

ToPowertrainTractionBatteryChargingChargeLimit0 converts data from field 'chargeLimit' of type float64 to 'Vehicle.Powertrain.TractionBattery.Charging.ChargeLimit' of type float64. Vehicle.Powertrain.TractionBattery.Charging.ChargeLimit: Target charge limit (state of charge) for battery. Unit: 'percent' Min: '0' Max: '100'

func ToPowertrainTractionBatteryChargingIsCharging0 added in v0.2.7

func ToPowertrainTractionBatteryChargingIsCharging0(originalDoc []byte, val bool) (float64, error)

ToPowertrainTractionBatteryChargingIsCharging0 converts data from field 'charging' of type bool to 'Vehicle.Powertrain.TractionBattery.Charging.IsCharging' of type float64. Vehicle.Powertrain.TractionBattery.Charging.IsCharging: True if charging is ongoing. Charging is considered to be ongoing if energy is flowing from charger to vehicle.

func ToPowertrainTractionBatteryCurrentPower0 added in v0.2.7

func ToPowertrainTractionBatteryCurrentPower0(originalDoc []byte, val float64) (float64, error)

ToPowertrainTractionBatteryCurrentPower0 converts data from field 'charger.power' of type float64 to 'Vehicle.Powertrain.TractionBattery.CurrentPower' of type float64. Vehicle.Powertrain.TractionBattery.CurrentPower: Current electrical energy flowing in/out of battery. Positive = Energy flowing in to battery, e.g. during charging. Negative = Energy flowing out of battery, e.g. during driving. Unit: 'W'

func ToPowertrainTractionBatteryGrossCapacity0 added in v0.2.7

func ToPowertrainTractionBatteryGrossCapacity0(originalDoc []byte, val float64) (float64, error)

ToPowertrainTractionBatteryGrossCapacity0 converts data from field 'batteryCapacity' of type float64 to 'Vehicle.Powertrain.TractionBattery.GrossCapacity' of type float64. Vehicle.Powertrain.TractionBattery.GrossCapacity: Gross capacity of the battery. Unit: 'kWh'

func ToPowertrainTractionBatteryStateOfChargeCurrent0 added in v0.2.7

func ToPowertrainTractionBatteryStateOfChargeCurrent0(originalDoc []byte, val float64) (float64, error)

ToPowertrainTractionBatteryStateOfChargeCurrent0 converts data from field 'soc' of type float64 to 'Vehicle.Powertrain.TractionBattery.StateOfCharge.Current' of type float64. Vehicle.Powertrain.TractionBattery.StateOfCharge.Current: Physical state of charge of the high voltage battery, relative to net capacity. This is not necessarily the state of charge being displayed to the customer. Unit: 'percent' Min: '0' Max: '100.0'

func ToPowertrainTransmissionTravelledDistance0 added in v0.2.7

func ToPowertrainTransmissionTravelledDistance0(originalDoc []byte, val float64) (float64, error)

ToPowertrainTransmissionTravelledDistance0 converts data from field 'odometer' of type float64 to 'Vehicle.Powertrain.Transmission.TravelledDistance' of type float64. Vehicle.Powertrain.Transmission.TravelledDistance: Odometer reading, total distance travelled during the lifetime of the transmission. Unit: 'km'

func ToPowertrainType0 added in v0.2.7

func ToPowertrainType0(originalDoc []byte, val string) (string, error)

ToPowertrainType0 converts data from field 'fuelType' of type string to 'Vehicle.Powertrain.Type' of type string. Vehicle.Powertrain.Type: Defines the powertrain type of the vehicle.

func ToSpeed0 added in v0.2.7

func ToSpeed0(originalDoc []byte, val float64) (float64, error)

ToSpeed0 converts data from field 'vehicleSpeed' of type float64 to 'Vehicle.Speed' of type float64. Vehicle.Speed: Vehicle speed. Unit: 'km/h'

func ToSpeed1 added in v0.2.7

func ToSpeed1(originalDoc []byte, val float64) (float64, error)

ToSpeed1 converts data from field 'speed' of type float64 to 'Vehicle.Speed' of type float64. Vehicle.Speed: Vehicle speed. Unit: 'km/h'

func TokenIDFromData added in v0.2.10

func TokenIDFromData(jsonData []byte) (uint32, error)

TokenIDFromData gets a tokenID from a V2 payload.

func TokenIDFromV1Data added in v0.2.10

func TokenIDFromV1Data(ctx context.Context, jsonData []byte, tokenGetter TokenIDGetter) (uint32, error)

TokenIDFromV1Data gets a tokenID from a v1 payload. attempts to get the tokenID from the vehicleTokenId field. If the field is not found and tokenGetter is not nil it will attempt to get the tokenId using the subject field and the tokenGetter.

Types

type ConversionError added in v0.2.13

type ConversionError struct {
	// DecodedSignals is the list of signals that were successfully decoded.
	DecodedSignals []vss.Signal `json:"decodedSignals"`
	Errors         []error      `json:"errors"`
	TokenID        uint32       `json:"tokenId"`
	Source         string       `json:"source"`
}

ConversionError is an error that occurs during conversion.

func (ConversionError) Error added in v0.2.13

func (e ConversionError) Error() string

Error returns the error message.

func (ConversionError) Unwrap added in v0.2.13

func (e ConversionError) Unwrap() []error

Unwrap returns all errors that occurred during conversion.

type FieldNotFoundError added in v0.1.1

type FieldNotFoundError struct {
	Field  string
	Lookup string
}

FieldNotFoundError is an error for missing fields.

func (FieldNotFoundError) Error added in v0.1.1

func (e FieldNotFoundError) Error() string

Error returns the error message.

type TokenIDGetter

type TokenIDGetter interface {
	TokenIDFromSubject(ctx context.Context, subject string) (uint32, error)
}

TokenIDGetter is an interface to get a tokenID from a subject.

type VersionError added in v0.1.1

type VersionError struct {
	Version string
}

VersionError is an error for unsupported specversion.

func (VersionError) Error added in v0.1.1

func (e VersionError) Error() string

Error returns the error message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL