Table of Contents

Class Vin

Namespace
Geotab.Checkmate.ObjectModel.Engine
Assembly
Geotab.Checkmate.ObjectModel.dll

Class that represents a vehicle identification number. Provides functionality to deal with compression and some validation.

public sealed class Vin
Inheritance
Vin
Inherited Members

Constructors

Vin(byte[])

Initializes a new instance of the Vin class.Initializes a new instance of the Vin class.

public Vin(byte[] compressedVin)

Parameters

compressedVin byte[]

The compressed vin.

Exceptions

ArgumentOutOfRangeException

Compressed VIN must have VinCompressedByteSize bytes.

Vin(string)

Initializes a new instance of the Vin class.Initializes a new instance of the Vin class.

public Vin(string value)

Parameters

value string

The value.

Fields

UnknownVin

The unknown vin.

public const string UnknownVin = "?"

Field Value

string

VinCompressedByteSize

Vin compressed byte size

public const int VinCompressedByteSize = 13

Field Value

int

VinMaxNumberOfChars

Maximum number of characters in the VIN

public const int VinMaxNumberOfChars = 17

Field Value

int

VinValidationWarning

Prefix string to any Vin validation result string

public const string VinValidationWarning = "Vin validation warning/s"

Field Value

string

Methods

CompressVin(string)

Encodes up to VinMaxNumberOfChars characters of the uncompressed vin into VinCompressedByteSize bytes

public static byte[] CompressVin(string uncompressedVin)

Parameters

uncompressedVin string

The vehicle identification number.

Returns

byte[]

The vin as a compressed byte array of the VinCompressedByteSize byte size.

Remarks

This compression matches GO device compression. This maps the entire 0-255 range into a 64 width range from 48 ('0') to 112 ('p'). Vin is always compress to VinCompressedByteSize byte size. If Vin is shorter than that it will be padded. When decompressed each padding becomes "?". Therefore empty Vin string becomes "?????????????"

DecompressVin(byte[])

Convert a binary vin into a string.

public static string DecompressVin(byte[] compressedVin)

Parameters

compressedVin byte[]

The compressed vin.

Returns

string

The vin as a string.

Parse(string)

Try parse the vin from a string.

public static Vin? Parse(string value)

Parameters

value string

The value.

Returns

Vin

vin or null if it cant be parsed.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

TryParse(byte[])

Tries the parse.

public static bool TryParse(byte[] compressedVin)

Parameters

compressedVin byte[]

The compressed vin.

Returns

bool

True if the parse was successful.

ValidateVinString(string)

Validates uncompressed Vin string

public static string ValidateVinString(string uncompressedVinString)

Parameters

uncompressedVinString string

The uncompressedVinString.

Returns

string

The validation error string if any.