void Update()
{
if (_isScanInProgress) return;
_isScanInProgress = true;
Debug.Log("FDF Scan: " + _scanCounter++);
var image = new ImageInputSource(_texture); //Simulating a new texture per scan
_scanner.Prepare(image, _scannerOptions, (scanner, error) =>
{
if (error != null)
{
Debug.LogError("FDF Prepare failed: " + error.Description);
_isScanInProgress = false;
return;
}
scanner.Process((scanner, result) =>
{
if (result.HasError())
{
Debug.LogError(result.Error.Description);
_isScanInProgress = false;
return;
}
if (result.Barcodes != null) {
foreach (Barcode each in result.Barcodes)
{
Debug.Log(string.Format("QRCode Info: Format: {0}, Value Type : {1}, Raw Value : {2}, Bounding Box : {3}", each.Format, each.ValueType, each.RawValue, each.BoundingBox));
var bl = each.CornerPoints[0];
var br = each.CornerPoints[1];
var tr = each.CornerPoints[2];
var tl = each.CornerPoints[3];
Debug.Log(string.Format("QRCode Points: BL: {0}, BR: {1}, TR: {2}, TL: {3}", bl, br, tr, tl));
}
}
_isScanInProgress = false;
scanner.Close(null);
});
});
}