cover

Enable VIN Scanning on iOS

What is a VIN? #

A VIN (Vehicle Identification Number) is a unique code used to identify individual motor vehicles. It consists of 17 characters, which include both digits and capital letters, and it provides information about the vehicle's manufacturer, model, and serial number.

The VIN (Vehicle Identification Number) feature is designed to scan barcodes specific to vehicle identification.

Setup VIN Scanning #

It can be enabled either via a pre-defined template or manually.

For the pre-defined template, the system's BarkoderHelper applies the VIN template to the configuration. The Region of Interest (ROI) is set to capture the entire viewfinder (a rectangle sized 100x30 starting at the top-left corner).

For manual setup, the system enables Code 39, Code 128, Data Matrix and QR Code decoding because all of those barcode types can be used as VIN. The decoding speed is set to slow (for better results), and the barKoder resolution is set to high. Again, a ROI is set similar to the pre-defined template.

In both methods, the license key must be valid, otherwise, the results will contain asterisks.

Set it via pre-defined template: #

                private func setVin() {
    // In order to perform scanning, config property need to be set before
    // If license key is not valid you will receive results with asterisks inside
    barkoderView.config = BarkoderConfig(licenseKey: "LICENSE_KEY") { licenseResult in
        print("Licensing SDK: \(licenseResult)")
    }

    if let config = barkoderView.config {
        BarkoderHelper.applyConfigSettingsFromTemplate(config, template: .vin, finished: { updatedConfig in
            // Enabling ROI
            self.barkoderView.config?.regionOfInterestVisible = true

            // Optional ROI for vin if the viewfinder is on fullscreen
            let vinRoiRect = CGRect(x: 0, y: 35, width: 100, height: 30)
            try? self.barkoderView.config?.setRegionOfInterest(vinRoiRect)
        })
    }
}
            

Set it manually: #

                private func setVin() {
    // In order to perform scanning, config property need to be set before
    // If license key is not valid you will receive results with asterisks inside
    barkoderView.config = BarkoderConfig(licenseKey: "LICENSE_KEY") { licenseResult in
        print("Licensing SDK: \(licenseResult)")
    }

    // Enabling code39, code128, datamatrix and qr
    barkoderView.config?.decoderConfig?.code39.enabled = true
    barkoderView.config?.decoderConfig?.code128.enabled = true
    barkoderView.config?.decoderConfig?.datamatrix.enabled = true
    barkoderView.config?.decoderConfig?.qr.enabled = true

    // For best result decoding speed should be slow, and barkoder resolution should be high
    barkoderView.config?.decoderConfig?.decodingSpeed = DecodingSpeed.init(2)
    barkoderView.config?.barkoderResolution = .high

    // Setting ROI
    let vinRoiRect = CGRect(x: 0, y: 35, width: 100, height: 30)
    try? self.barkoderView.config?.setRegionOfInterest(vinRoiRect)
}

            

Page Contents

History:

close