Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognition failure for 2-characters manufacture brands #7

Closed
huangkaichang opened this issue Apr 9, 2021 · 2 comments
Closed

Recognition failure for 2-characters manufacture brands #7

huangkaichang opened this issue Apr 9, 2021 · 2 comments

Comments

@huangkaichang
Copy link

Hi. Thanks for the package

I noticed the "wmi" is the first 3 characters of the vin number after normalization.

VIN({required this.number, this.extended = false})
      : wmi = normalize(number).substring(0, 3),
        vds = normalize(number).substring(3, 9),
        vis = normalize(number).substring(9, 17);

But some of the brands' wmi is 2-characters, like Nissan(1N), in manufacturers map.
'1N': 'Nissan',

So the getManufacturer() function will return "Unknown"

String? getManufacturer() {
    if (manufacturers.containsKey(this.wmi)) {
      return manufacturers[this.wmi];
    } else {
      return "Unknown (WMI: ${this.wmi.toUpperCase()})";
    }
  }
@pmundt
Copy link
Member

pmundt commented May 29, 2021

Good catch, do you have an example VIN with a 2-character WMI I can add a unit test for? The VIN must still be 17 characters long, so I want to make sure I've accounted for the padding byte in the right place.

@pmundt pmundt closed this as completed in 3763cf9 May 29, 2021
@pmundt
Copy link
Member

pmundt commented May 29, 2021

Ok, I found an example from Toyota. In this case, the WMI doesn't change from 3 characters, it's just that the manufacturer ID is encoded in the first 2 characters and the 3rd is used to encode the vehicle type. I've added a fallback now so that if the full 3-char lookup fails, we try again with the 2nd. I'll include this in a 0.2.1 release to be pushed out soon. Thanks again for the report!

pmundt added a commit that referenced this issue May 29, 2021
Some manufacturers use the first 2 characters of the WMI as the
manufacturer ID, with the 3rd denoting the specific class of vehicle
specific to that manufacturer.

Fixes #7.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants