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[])
public Vin(byte[] compressedVin)
Parameters
compressedVin
byte[]The compressed vin.
Exceptions
- ArgumentOutOfRangeException
Compressed VIN must have VinCompressedByteSize bytes.
Vin(string)
public Vin(string value)
Parameters
value
stringThe value.
Fields
UnknownVin
The unknown vin.
public const string UnknownVin = "?"
Field Value
VinCompressedByteSize
Vin compressed byte size
public const int VinCompressedByteSize = 13
Field Value
VinMaxNumberOfChars
Maximum number of characters in the VIN
public const int VinMaxNumberOfChars = 17
Field Value
VinValidationWarning
Prefix string to any Vin validation result string
public const string VinValidationWarning = "Vin validation warning/s"
Field Value
Methods
CompressVin(string)
Encodes up to VinMaxNumberOfChars characters of the uncompressed vin into VinCompressedByteSize bytes
public static byte[] CompressVin(string uncompressedVin)
Parameters
uncompressedVin
stringThe 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
stringThe value.
Returns
- Vin
vin or null if it cant be parsed.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
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
stringThe uncompressedVinString.
Returns
- string
The validation error string if any.