github.com/artisanhe/tools@v1.0.1-0.20210607022958-19a8fef2eb04/vin-code/mitsubishi.go (about) 1 package vincode 2 3 import ( 4 "github.com/artisanhe/tools/vin-code/mfrs/msbs" 5 "github.com/artisanhe/tools/vin-code/misc" 6 ) 7 8 // 三菱 9 type MSBSVINCode string 10 11 func (str MSBSVINCode) ParseWMI() (WMIData, error) { 12 re := msbs.GetWMIRune(string(str)) 13 wmi := WMIData{} 14 cv, ok := msbs.Country[re.CountryRune] 15 if !ok { 16 return wmi, VINCodeParseCountryError 17 } 18 wmi.Country = cv 19 20 mv, ok := msbs.Manufact[re.ManfRune] 21 if !ok { 22 return wmi, VINCodeParseManufError 23 } 24 wmi.Manufacturer = mv 25 26 tv, ok := msbs.VehicleType[re.VehicleTypeRune] 27 if !ok { 28 return wmi, VINCodeParseVehicleTypeError 29 } 30 wmi.VehicleType = tv 31 32 return wmi, nil 33 } 34 35 func (str MSBSVINCode) ParseVDS() (VDSData, error) { 36 re := msbs.GetVDSRune(string(str)) 37 vds := VDSData{} 38 39 rt, ok := msbs.RestraintSys[re.RestraintSysRune] 40 if !ok { 41 return vds, VINCodeParseRestriantError 42 } 43 vds.RestraintSystem = rt 44 45 cs, ok := msbs.CarSeries[re.CarSeriesStr] 46 if !ok { 47 return vds, VINCodeParseCarSeriesError 48 } 49 vds.CarSeries = cs 50 51 dt, ok := msbs.DoorType[re.DoorTypeRune] 52 if !ok { 53 return vds, VINCodeParseDoorTypeError 54 } 55 vds.DoorType = dt 56 57 eg, ok := msbs.Engine[re.EngineRune] 58 if !ok { 59 return vds, VINCodeParseEngineError 60 } 61 vds.Engine = eg 62 63 return vds, nil 64 } 65 66 func (str MSBSVINCode) ParseVIS() (VISData, error) { 67 re := msbs.GetVISRune(string(str)) 68 vis := VISData{} 69 vis.SequenceNO = re.SequenceNO 70 ap, ok := msbs.AssemblyPlant[re.AssemblyRune] 71 if !ok { 72 return vis, VINCodeParseAssemblyError 73 } 74 vis.AssemblyPlant = ap 75 vis.ModelYear = misc.GetModelYearStr(re.YearRune) 76 if vis.ModelYear == "0" { 77 return vis, VINCodeParseYearError 78 } 79 80 return vis, nil 81 }