static recommendVersion(ecLevel, mode, headerBits, dataBits) {
        // Hard part: need to know version to know how many bits length takes. But need to know how many
        // bits it takes to know version. First we take a guess at version by assuming version will be
        // the minimum, 1:
        const provisionalBitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, Version.getVersionForNumber(1));
        const provisionalVersion = this.chooseVersion(provisionalBitsNeeded, ecLevel);
        // Use that guess to calculate the right version. I am still not sure this works in 100% of cases.
        const bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);
        return this.chooseVersion(bitsNeeded, ecLevel);
    }
/**
     * Decides the smallest version of QR code that will contain all of the provided data.
     *
     * @throws WriterException if the data cannot fit in any version
     */
Decides the smallest version of QR code that will contain all of the provided data.
@throws WriterException if the data cannot fit in any version
Decides the smallest version of QR code that will contain all of the provided data . @throws WriterException if the data cannot fit in any version
static recommendVersion(ecLevel, mode, headerBits, dataBits) {
        const provisionalBitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, Version.getVersionForNumber(1));
        const provisionalVersion = this.chooseVersion(provisionalBitsNeeded, ecLevel);
        const bitsNeeded = this.calculateBitsNeeded(mode, headerBits, dataBits, provisionalVersion);
        return this.chooseVersion(bitsNeeded, ecLevel);
    }
static recommendVersion ( ecLevel , mode , headerBits , dataBits ) { const provisionalBitsNeeded = this . calculateBitsNeeded ( mode , headerBits , dataBits , Version . getVersionForNumber ( 1 ) ) ; const provisionalVersion = this . chooseVersion ( provisionalBitsNeeded , ecLevel ) ; const bitsNeeded = this . calculateBitsNeeded ( mode , headerBits , dataBits , provisionalVersion ) ; return this . chooseVersion ( bitsNeeded , ecLevel ) ; }
Decides the smallest version of QR code that will contain all of the provided data.
Decides the smallest version of QR code that will contain all of the provided data .
// Hard part: need to know version to know how many bits length takes. But need to know how many // bits it takes to know version. First we take a guess at version by assuming version will be // the minimum, 1: // Use that guess to calculate the right version. I am still not sure this works in 100% of cases.