public static void RequestBarcode(params BarcodeRequest[] requests) { if ((Interface == NatCamInterface.NativeInterface && !Native.mMetadataDetection) || (Interface == NatCamInterface.FallbackInterface && !Fallback.mMetadataDetection)) { Ext.Warn("NatCam was initialized without preparing for metadata detection. Ignoring call"); return; } if (requests.Length == 0) { Ext.Warn("Cannot request barcode with no requests supplied"); return; } for (int i = 0; i < requests.Length; i++) { BarcodeRequest req = requests[i]; BarcodeCallback temp = null; temp = delegate(Barcode code) { if ((code.format & req.format) > 0) { if (req.callback != null) { req.callback(code); //Null checking saves one, kills none } if (req.detectOnce) { OnBarcodeDetect -= temp; } } }; OnBarcodeDetect += temp; } }
public static void Decode(Color32[] frame, int width, int height, NatCamDispatch dispatch, BarcodeCallback callback) { if (callback == null) { return; } #if NATCAM_ZXING_DEPENDENCY results = reader.DecodeMultiple(frame, width, height); dispatch.Dispatch(() => results.ForEach(result => callback(NatCamBarcode(result)))); #endif }
[NCDoc(89)] public BarcodeRequest(BarcodeCallback Callback, BarcodeFormat PreferredFormat = BarcodeFormat.ALL, bool DetectOnce = true) { callback = Callback; format = PreferredFormat; detectOnce = DetectOnce; }
public static void RegisterEvents(Action Start, Action Update, PhotoCallback Photo, BarcodeCallback Barcode, FaceCallback Face, Action <bool> Focus) { PropagateStart = Start; PropagateUpdate = Update; PropagatePhoto = Photo; PropagateBarcode = Barcode; PropagateFace = Face; listener.RegisterCallback(Focus); }