|
|
|
// AUTO GENERATED FILE, DO NOT EDIT.
|
|
|
|
//
|
|
|
|
// Generated by `package:ffigen`.
|
|
|
|
import 'dart:ffi' as ffi;
|
|
|
|
|
|
|
|
/// Bindings to `native_verokit.h`.
|
|
|
|
class GeneratedBindings {
|
|
|
|
/// Holds the symbol lookup function.
|
|
|
|
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
|
|
|
_lookup;
|
|
|
|
|
|
|
|
/// The symbols are looked up in [dynamicLibrary].
|
|
|
|
GeneratedBindings(ffi.DynamicLibrary dynamicLibrary)
|
|
|
|
: _lookup = dynamicLibrary.lookup;
|
|
|
|
|
|
|
|
/// The symbols are looked up with [lookup].
|
|
|
|
GeneratedBindings.fromLookup(
|
|
|
|
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
|
|
|
lookup)
|
|
|
|
: _lookup = lookup;
|
|
|
|
|
|
|
|
/// Returns the version of the zxing-cpp library.
|
|
|
|
///
|
|
|
|
/// @return The version of the zxing-cpp library.
|
|
|
|
ffi.Pointer<ffi.Char> version() {
|
|
|
|
return _version();
|
|
|
|
}
|
|
|
|
|
|
|
|
late final _versionPtr =
|
|
|
|
_lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>('version');
|
|
|
|
late final _version =
|
|
|
|
_versionPtr.asFunction<ffi.Pointer<ffi.Char> Function()>();
|
|
|
|
|
|
|
|
/// @brief Reads barcode from image.
|
|
|
|
/// @param bytes Image bytes.
|
|
|
|
/// @param format The format of the barcode
|
|
|
|
/// @param width Image width.
|
|
|
|
/// @param height Image height.
|
|
|
|
/// @param cropWidth Crop width.
|
|
|
|
/// @param cropHeight Crop height.
|
|
|
|
/// @param logEnabled Log enabled.
|
|
|
|
/// @return Barcode result.
|
|
|
|
CodeResult readBarcode(
|
|
|
|
ffi.Pointer<ffi.Char> bytes,
|
|
|
|
int format,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int cropWidth,
|
|
|
|
int cropHeight,
|
|
|
|
int logEnabled,
|
|
|
|
) {
|
|
|
|
return _readBarcode(
|
|
|
|
bytes,
|
|
|
|
format,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
cropWidth,
|
|
|
|
cropHeight,
|
|
|
|
logEnabled,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
late final _readBarcodePtr = _lookup<
|
|
|
|
ffi.NativeFunction<
|
|
|
|
CodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int, ffi.Int,
|
|
|
|
ffi.Int, ffi.Int, ffi.Int)>>('readBarcode');
|
|
|
|
late final _readBarcode = _readBarcodePtr.asFunction<
|
|
|
|
CodeResult Function(
|
|
|
|
ffi.Pointer<ffi.Char>, int, int, int, int, int, int)>();
|
|
|
|
|
|
|
|
/// @brief Reads barcodes from image.
|
|
|
|
/// @param bytes Image bytes.
|
|
|
|
/// @param format The format of the barcode
|
|
|
|
/// @param width Image width.
|
|
|
|
/// @param height Image height.
|
|
|
|
/// @param cropWidth Crop width.
|
|
|
|
/// @param cropHeight Crop height.
|
|
|
|
/// @param logEnabled Log enabled.
|
|
|
|
/// @return Barcode results.
|
|
|
|
ffi.Pointer<CodeResult> readBarcodes(
|
|
|
|
ffi.Pointer<ffi.Char> bytes,
|
|
|
|
int format,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int cropWidth,
|
|
|
|
int cropHeight,
|
|
|
|
int logEnabled,
|
|
|
|
) {
|
|
|
|
return _readBarcodes(
|
|
|
|
bytes,
|
|
|
|
format,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
cropWidth,
|
|
|
|
cropHeight,
|
|
|
|
logEnabled,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
late final _readBarcodesPtr = _lookup<
|
|
|
|
ffi.NativeFunction<
|
|
|
|
ffi.Pointer<CodeResult> Function(ffi.Pointer<ffi.Char>, ffi.Int,
|
|
|
|
ffi.Int, ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('readBarcodes');
|
|
|
|
late final _readBarcodes = _readBarcodesPtr.asFunction<
|
|
|
|
ffi.Pointer<CodeResult> Function(
|
|
|
|
ffi.Pointer<ffi.Char>, int, int, int, int, int, int)>();
|
|
|
|
|
|
|
|
/// @brief Encode a string into a barcode
|
|
|
|
/// @param contents The string to encode
|
|
|
|
/// @param width The width of the barcode
|
|
|
|
/// @param height The height of the barcode
|
|
|
|
/// @param format The format of the barcode
|
|
|
|
/// @param margin The margin of the barcode
|
|
|
|
/// @param logEnabled Log enabled.
|
|
|
|
/// @param eccLevel The error correction level of the barcode. Used for Aztec, PDF417, and QRCode only, [0-8].
|
|
|
|
/// @return The barcode data
|
|
|
|
EncodeResult encodeBarcode(
|
|
|
|
ffi.Pointer<ffi.Char> contents,
|
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int format,
|
|
|
|
int margin,
|
|
|
|
int eccLevel,
|
|
|
|
int logEnabled,
|
|
|
|
) {
|
|
|
|
return _encodeBarcode(
|
|
|
|
contents,
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
format,
|
|
|
|
margin,
|
|
|
|
eccLevel,
|
|
|
|
logEnabled,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
late final _encodeBarcodePtr = _lookup<
|
|
|
|
ffi.NativeFunction<
|
|
|
|
EncodeResult Function(ffi.Pointer<ffi.Char>, ffi.Int, ffi.Int,
|
|
|
|
ffi.Int, ffi.Int, ffi.Int, ffi.Int)>>('encodeBarcode');
|
|
|
|
late final _encodeBarcode = _encodeBarcodePtr.asFunction<
|
|
|
|
EncodeResult Function(
|
|
|
|
ffi.Pointer<ffi.Char>, int, int, int, int, int, int)>();
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class Format {
|
|
|
|
/// < Used as a return value if no valid barcode has been detected
|
|
|
|
static const int None = 0;
|
|
|
|
|
|
|
|
/// < Aztec (2D)
|
|
|
|
static const int Aztec = 1;
|
|
|
|
|
|
|
|
/// < Codabar (1D)
|
|
|
|
static const int Codabar = 2;
|
|
|
|
|
|
|
|
/// < Code39 (1D)
|
|
|
|
static const int Code39 = 4;
|
|
|
|
|
|
|
|
/// < Code93 (1D)
|
|
|
|
static const int Code93 = 8;
|
|
|
|
|
|
|
|
/// < Code128 (1D)
|
|
|
|
static const int Code128 = 16;
|
|
|
|
|
|
|
|
/// < GS1 DataBar, formerly known as RSS 14
|
|
|
|
static const int DataBar = 32;
|
|
|
|
|
|
|
|
/// < GS1 DataBar Expanded, formerly known as RSS EXPANDED
|
|
|
|
static const int DataBarExpanded = 64;
|
|
|
|
|
|
|
|
/// < DataMatrix (2D)
|
|
|
|
static const int DataMatrix = 128;
|
|
|
|
|
|
|
|
/// < EAN-8 (1D)
|
|
|
|
static const int EAN8 = 256;
|
|
|
|
|
|
|
|
/// < EAN-13 (1D)
|
|
|
|
static const int EAN13 = 512;
|
|
|
|
|
|
|
|
/// < ITF (Interleaved Two of Five) (1D)
|
|
|
|
static const int ITF = 1024;
|
|
|
|
|
|
|
|
/// < MaxiCode (2D)
|
|
|
|
static const int MaxiCode = 2048;
|
|
|
|
|
|
|
|
/// < PDF417 (1D) or (2D)
|
|
|
|
static const int PDF417 = 4096;
|
|
|
|
|
|
|
|
/// < QR Code (2D)
|
|
|
|
static const int QRCode = 8192;
|
|
|
|
|
|
|
|
/// < UPC-A (1D)
|
|
|
|
static const int UPCA = 16384;
|
|
|
|
|
|
|
|
/// < UPC-E (1D)
|
|
|
|
static const int UPCE = 32768;
|
|
|
|
static const int OneDCodes = 51070;
|
|
|
|
static const int TwoDCodes = 14465;
|
|
|
|
static const int Any = 65535;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CodeResult extends ffi.Struct {
|
|
|
|
@ffi.Int()
|
|
|
|
external int isValid;
|
|
|
|
|
|
|
|
external ffi.Pointer<ffi.Char> text;
|
|
|
|
|
|
|
|
@ffi.Int32()
|
|
|
|
external int format;
|
|
|
|
}
|
|
|
|
|
|
|
|
class EncodeResult extends ffi.Struct {
|
|
|
|
@ffi.Int()
|
|
|
|
external int isValid;
|
|
|
|
|
|
|
|
external ffi.Pointer<ffi.Char> text;
|
|
|
|
|
|
|
|
@ffi.Int32()
|
|
|
|
external int format;
|
|
|
|
|
|
|
|
external ffi.Pointer<ffi.UnsignedInt> data;
|
|
|
|
|
|
|
|
@ffi.Int()
|
|
|
|
external int length;
|
|
|
|
|
|
|
|
external ffi.Pointer<ffi.Char> error;
|
|
|
|
}
|