cabrillo.camera - Client

  • Release version: Yokohama
  • Updated January 30, 2025
  • 1 minute to read
  • Cabrillo JS camera functions to provide camera access for bar code scanning.

    cabrillo.camera - getBarcode()

    Provides a standard interface for scanning bar codes. Use this to present a bar code scanner and capture scanned result.

    Supported bar code types.
    • 1D bar codes: EAN-13, EAN-8, UPC-A, UPC-E, Code-39, Code-93, Code-128, ITF
    • 2D bar codes: QR Code, Data Matrix, PDF-417, AZTEC
    Table 1. Parameters
    Name Type Description
    None
    Table 2. Returns
    Type Description
    promise Resolves to a bar code string, or if the operation fails, an error.
    cabrillo.camera.getBarcode().then(function(barcode) {
        if (barcode) {
            console.log('Scanned barcode.', barcode);
        } else {
            console.log('User cancelled scanning barcode.');
        }
    }, function(error) {
        console.log('Failed to scan barcode.', error);
    });