/// <summary> /// Interaction logic for CheckFingerDP.xaml /// </summary> public bool CheckCaptureResult(CaptureResult captureResult) { if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { return(false); //throw new Exception(captureResult.ResultCode.ToString()); } switch (captureResult.Quality) { case Constants.CaptureQuality.DP_QUALITY_GOOD: return(true); case Constants.CaptureQuality.DP_QUALITY_READER_DIRTY: SendPopUpMessage("Scanner is dirty"); break; case Constants.CaptureQuality.DP_QUALITY_READER_FAILED: SendPopUpMessage("Reader failed"); break; case Constants.CaptureQuality.DP_QUALITY_FAKE_FINGER: SendPopUpMessage("Bad finger Image"); break; } return(false); }
public static async Task <CaptureResult> CaptureSummaryToOneNote(Image imageToWrite) { //var imgThumb = GenerateThumbnails(); string result = string.Empty; string pageId = Configurator.DestinationOneNote.PageId; bool isSuccess = await OneNoteCapture.AppendImage(imageToWrite, pageId, "Test"); //if (isSuccess) //{ // isSuccess = await OneNoteCapture.AppendImage(imgThumb, pageId, "Test2"); //} CaptureResult c = new CaptureResult(); c.IsSuccess = isSuccess; Logger.Info("After write captured screenshot to OneNote"); if (!isSuccess) { c.UserMessage = "Failure when adding to OneNote"; } else { c.UserMessage = "OneNote capture successful at " + DateTime.Now.ToLongTimeString(); } return(c); }
public bool Capture(PaymentMethod currentPayment) { Mediachase.Commerce.Orders.Payment payment = (Mediachase.Commerce.Orders.Payment)currentPayment.Payment; Log.InfoFormat("Capturing payment with ID:{0} belonging to order with ID: {1}", payment.Id, payment.OrderGroupId); int transactionId; if (!int.TryParse(payment.AuthorizationCode, out transactionId)) { Log.ErrorFormat("Could not get PayEx transaction ID from payment with ID:{0} belonging to order with ID: {1}", payment.Id, payment.OrderGroupId); return(false); } Log.InfoFormat("PayEx transaction ID is {0} on payment with ID:{1} belonging to order with ID: {2}", transactionId, payment.Id, payment.OrderGroupId); long amount = payment.Amount.RoundToLong(); string orderNumber = OrderNumberFormatter.MakeNumeric(currentPayment.PurchaseOrder.TrackingNumber); CaptureResult result = _paymentManager.Capture(transactionId, amount, orderNumber, currentPayment.Payment.Vat, string.Empty); bool success = false; if (result.Success && !string.IsNullOrWhiteSpace(result.TransactionNumber)) { Log.InfoFormat("Setting PayEx transaction number to {0} on payment with ID:{1} belonging to order with ID: {2} during capture", result.TransactionNumber, payment.Id, payment.OrderGroupId); payment.ValidationCode = result.TransactionNumber; payment.AcceptChanges(); success = true; Log.InfoFormat("Successfully captured payment with ID:{0} belonging to order with ID: {1}", currentPayment.Payment.Id, currentPayment.OrderGroupId); } if (_paymentCapturer != null) { return(_paymentCapturer.Capture(currentPayment) && success); } return(success); }
public override async Task <CaptureResult> Capture() { var result = new CaptureResult(); try { if (fileManager.Exists(root)) { var files = new List <FileValue>(); foreach (var path in expandedFilenames) { if (fileManager.Exists(path)) { var file = new FileValue(); file.RelativePath = Path.GetRelativePath(root, path); file.Contents = await fileManager.ReadAllBytes(path); files.Add(file); } } FilesValue value = new FilesValue(); value.Files = files.ToArray(); result.Value = value.ToDictionary(); result.Success = true; } } catch (Exception e) { logger.LogError(e, "Failed to capture files"); } return(result); }
public void AddVisionResultToList(AxisOffset offset) { lock (_captureResultLocker) { CaptureResult.Add(offset); } }
//method that runs for every capturing public void OnCaptured(CaptureResult captureResult) { try { // Check capture quality and throw an error if bad. if (!fp.CheckCaptureResult(captureResult)) { return; } else { //convert to a valid finger print first DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { throw new Exception(resultConversion.ResultCode.ToString()); } else { //if it succesfully convert then display for user to see // Create bitmap - this part display the captured on screen foreach (Fid.Fiv fiv in captureResult.Data.Views) { SendMessage(Action.SendBitmap, fp.CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height)); } firstFinger = resultConversion.Data; } } } catch (Exception ex) { // Send error message, then close form SendMessage(Action.SendMessage, "Error: " + ex.Message); } }
/// <summary> /// Example for performing simple partial refund request. /// Payment has to be in captured state in order to refund be successful. /// Amount sent to be partialy refundend has to be less than total amount of the payment /// </summary> public void SimplePartialRefund() { //Reserving and capturing payment in order to refund method example could be successful CaptureResult captureResult = ReserveAndCapture(Amount.Get(1200.00, Currency.EUR), AuthType.payment); //Transaction ID is returned from the gateway when payment request was successful string transactionId = captureResult.Payment.TransactionId; //initialize refund request class //for simple partial refund amount property should be set with amount less than total amount RefundRequest refundRequest = new RefundRequest { PaymentId = transactionId, Amount = Amount.Get(450.00, Currency.EUR) }; //call refund method RefundResult refundResult = _api.Refund(refundRequest); //Result property contains information if the request was successful or not if (refundResult.Result == Result.Success) { //refund was successful Transaction transaction = refundResult.Payment; } else { //refund unsuccessful //error messages contain information about what went wrong string errorMerchantMessage = refundResult.ResultMerchantMessage; string errorMessage = refundResult.ResultMessage; } }
/// <summary> /// Handler for when a fingerprint is captured. /// </summary> /// <param name="captureResult">contains info and data on the fingerprint capture</param> private void OnCaptured(CaptureResult captureResult) { try { // Check capture quality and throw an error if bad. if (!_sender.CheckCaptureResult(captureResult)) { return; } SendMessage(Action.SendMessage, "A finger was captured."); Fingerprint newFingerPrint = new Fingerprint(); if (count < 4) { foreach (Fid.Fiv fiv in captureResult.Data.Views) { newFingerPrint.AsBitmap = _sender.CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height); } patient.Fingerprints.Add(newFingerPrint); Afis.Extract(patient); count += 1; if (count != 4) { SendMessage(Action.SendMessage, "Now place your next finger on the reader."); } else { SendMessage(Action.SendMessage, "Now place a search finger on the reader."); } } else if (count > 0) { Person matchFinger = new Person(); foreach (Fid.Fiv fiv in captureResult.Data.Views) { newFingerPrint.AsBitmap = _sender.CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height); } matchFinger.Fingerprints.Add(newFingerPrint); Afis.Extract(matchFinger); long memUsage = GetMemoryUsage(patient); float score = Afis.Verify(matchFinger, patient); bool match = (score > Afis.Threshold); string matchString = "AFIS doesn't match. Get out of here kid!"; if (match) { matchString = "AFIS matches."; } SendMessage(Action.SendMessage, "Identification resulted: " + matchString + " score = " + score.ToString()); SendMessage(Action.SendMessage, "Place another finger on the reader."); count += 1; } } catch (Exception ex) { // Send error message, then close form SendMessage(Action.SendMessage, "Error: " + ex.Message); } }
/// <summary> /// Helper method needed for reserving and capturing payment in order to refund examples could work /// </summary> /// <param name="amount"></param> /// <param name="type"></param> /// <returns></returns> private CaptureResult ReserveAndCapture(Amount amount, AuthType type) { var request = new ReserveRequest { ShopOrderId = "csharpexample" + Guid.NewGuid().ToString(), Terminal = "AltaPay Dev Terminal", Amount = amount, PaymentType = type, Pan = "4111000011110000", ExpiryMonth = 1, ExpiryYear = 2012, Cvc = "123", }; PaymentResult paymentResult = _api.ReserveAmount(request); if (paymentResult.Result != Result.Success) { throw new Exception("The result was: " + paymentResult.Result + ", message: " + paymentResult.ResultMerchantMessage); } CaptureRequest captureRequest = new CaptureRequest { PaymentId = paymentResult.Payment.TransactionId }; CaptureResult captureResult = _api.Capture(captureRequest); if (captureResult.Result != Result.Success) { throw new Exception("The result was: " + captureResult.Result + ", message: " + captureResult.ResultMerchantMessage); } return(captureResult); }
/// <summary> /// Example for performing simple refund request. /// Payment has to be in captured state in order to refund be successful. /// </summary> public void SimpleRefund() { //Reserving and capturing payment in order to refund method example could be successful CaptureResult captureResult = ReserveAndCapture(Amount.Get(1200.00, Currency.EUR), AuthType.payment); //Transaction ID is returned from the gateway when payment request was successful string transactionId = captureResult.Payment.TransactionId; //initialize refund request class, this class is used for forwarding all the data needed for refund request //for simple refund requests transaction ID is mandatory field RefundRequest refundRequest = new RefundRequest { PaymentId = transactionId }; //call refund method RefundResult refundResult = _api.Refund(refundRequest); //Result property contains information if the request was successful or not if (refundResult.Result == Result.Success) { //refund was successful Transaction transaction = refundResult.Payment; } else { //refund unsuccessful //error messages contain information about what went wrong string errorMerchantMessage = refundResult.ResultMerchantMessage; string errorMessage = refundResult.ResultMessage; } }
private void enrollment_OnCaptured(EnrollmentControl enrollmentControl, CaptureResult captureResult, int fingerPosition) { if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { if (globales.dispositivo != null) { globales.dispositivo.Dispose(); globales.dispositivo = null; } // Disconnect reader from enrollment control _enrollmentControl.Reader = null; MessageBox.Show("Error: " + captureResult.ResultCode); // btnCancel.Enabled = false; } else { if (captureResult.Data != null) { foreach (Fid.Fiv fiv in captureResult.Data.Views) { imagenDedo.Image = CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height); } } } }
[Test] // Not really a unit test, just a Klarna calling example public static void Main() { String paymentId = "35"; // PUT A PAYMENT ID FROM A PREVIOUSLY CREATED ORDER HERE CaptureResult captureResult = _api.Capture(new CaptureRequest { PaymentId = paymentId }); Assert.AreEqual(Result.Success, captureResult.Result); List <PaymentOrderLine> orderLines = new List <PaymentOrderLine> { new PaymentOrderLine { Description = "description 1", ItemId = "id 01", Quantity = -1, UnitPrice = 1.1, GoodsType = GoodsType.Item }, new PaymentOrderLine { Description = "new item", ItemId = "new id", Quantity = 1, UnitPrice = 1.1, GoodsType = GoodsType.Item } }; UpdateOrderRequest req = new UpdateOrderRequest(paymentId, orderLines); UpdateOrderResult result = _api.UpdateOrder(req); Assert.AreEqual(Result.Success, result.Result); }
void SetProperty(PSObject pso, CaptureResult result) { PSObject prop = pso; var section = result.Section; // traverse variable parts to before the final part for (int i = 0; i < section.VarPath.Count - 1; i++) { if (section.VarPath[i] is ArrayVariablePart) { throw new InvalidOperationException("Array variable part only allowed at the end of the capture"); } prop = UpsertProperty <PSObject>(prop, section.VarPath[i].Name); } // set final capture part if (section.VarPath.Count > 0) { var vp = section.VarPath.Last(); if (vp is ObjectVariablePart) { prop.Members.Add(new PSNoteProperty(vp.Name, result.Values.Single())); } else if (vp is ArrayVariablePart) { var array = UpsertProperty <List <string> >(prop, vp.Name); array.AddRange(result.Values); } } }
/// <summary> /// Example for performing simple partial capture request. /// Amount sent to be partialy captured has to be less than total amount of the payment /// </summary> public void SimplePartialCapture() { //Reserving amount in order to capture method example could be successful PaymentResult paymentResult = ReserveAmount(Amount.Get(1200.00, Currency.EUR), AuthType.payment); //Transaction ID is returned from the gateway when payment request was successful string transactionId = paymentResult.Payment.TransactionId; //initialize capture request class, this class is used for forwarding all the data needed for capture request //for simple partial capture amount property should be set with amount less than total amount CaptureRequest captureRequest = new CaptureRequest { PaymentId = transactionId, Amount = Amount.Get(600.00, Currency.EUR) }; //call capture method CaptureResult captureResult = _api.Capture(captureRequest); //Result property contains information if the request was successful or not if (captureResult.Result == Result.Success) { //capture was successful Transaction transaction = captureResult.Payment; } else { //capture unsuccessful //error messages contain information about what went wrong string errorMerchantMessage = captureResult.ResultMerchantMessage; string errorMessage = captureResult.ResultMessage; } }
public override void OnCaptureProgressed( CameraCaptureSession session, CaptureRequest request, CaptureResult partialResult) { Process(partialResult); }
private void Process(CaptureResult result) { switch (owner.mState) { case CamRecorder.STATE_WAITING_LOCK: { Integer afState = (Integer)result.Get(CaptureResult.ControlAfState); if (afState == null || afState.IntValue() == (int)ControlAFState.Inactive) { owner.mState = CamRecorder.STATE_PICTURE_TAKEN; owner.CaptureStillPicture(); } else if ((((int)ControlAFState.FocusedLocked) == afState.IntValue()) || (((int)ControlAFState.NotFocusedLocked) == afState.IntValue()) ) { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() == ((int)ControlAEState.Converged)) { owner.mState = CamRecorder.STATE_PICTURE_TAKEN; owner.CaptureStillPicture(); } else { owner.RunPrecaptureSequence(); } } break; } case CamRecorder.STATE_WAITING_PRECAPTURE: { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() == ((int)ControlAEState.Precapture) || aeState.IntValue() == ((int)ControlAEState.FlashRequired)) { owner.mState = CamRecorder.STATE_WAITING_NON_PRECAPTURE; } break; } case CamRecorder.STATE_WAITING_NON_PRECAPTURE: { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() != ((int)ControlAEState.Precapture)) { owner.mState = CamRecorder.STATE_PICTURE_TAKEN; owner.CaptureStillPicture(); } break; } } }
private void Streaming() { try { Application.DoEvents(); pcbHuella.Image = null; if (!Clases.HuellaDigital.OpenReader()) { this.Close(); } if (!Clases.HuellaDigital.reader.Capabilities.CanStream) { MessageBox.Show("This reader cannot stream in this environment."); return; } Clases.HuellaDigital.reader.StartStreaming(); CaptureResult captureResult = null; reset = false; while ((!reset)) { captureResult = Clases.HuellaDigital.reader.GetStreamImage(Constants.Formats.Fid.ANSI, Constants.CaptureProcessing.DP_IMG_PROC_DEFAULT, Clases.HuellaDigital.reader.Capabilities.Resolutions[0]); Application.DoEvents(); if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { if (Clases.HuellaDigital.reader != null) { Clases.HuellaDigital.reader.Dispose(); Clases.HuellaDigital.reader = null; } reset = true; MessageBox.Show("Error: " + captureResult.ResultCode.ToString()); } if (captureResult.Data != null) { foreach (Fid.Fiv fiv in captureResult.Data.Views) { SendMessage(Clases.HuellaDigital.CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height)); } } } } catch (ObjectDisposedException ex) { Clases.CFuncionesGenerales.MensajeError("Se ha tratado de realizar en un objeto desechado.", ex); } catch (InvalidOperationException ex) { Clases.CFuncionesGenerales.MensajeError("Se ha tratado de realizar una operación en un objeto cuyo estado actual no lo permite.", ex); } }
/// <summary> /// Handler for when a fingerprint is captured. /// </summary> /// <param name="captureResult">contains info and data on the fingerprint capture</param> private void OnCaptured(CaptureResult captureResult) { try { // Check capture quality and throw an error if bad. if (!_sender.CheckCaptureResult(captureResult)) { return; } SendMessage(Action.SendMessage, "A finger was captured."); DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI); if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { _sender.Reset = true; throw new Exception(captureResult.ResultCode.ToString()); } if (count == 0) { rightIndex = resultConversion.Data; count += 1; SendMessage(Action.SendMessage, "Now place your right thumb on the reader."); } else if (count == 1) { rightThumb = resultConversion.Data; count += 1; SendMessage(Action.SendMessage, "Now place any finger on the reader."); } else if (count == 2) { anyFinger = resultConversion.Data; Fmd[] fmds = new Fmd[2]; fmds[0] = rightIndex; fmds[1] = rightThumb; // See the SDK documentation for an explanation on threshold scores. int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000; IdentifyResult identifyResult = Comparison.Identify(anyFinger, 0, fmds, thresholdScore, 2); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { _sender.Reset = true; throw new Exception(identifyResult.ResultCode.ToString()); } SendMessage(Action.SendMessage, "Identification resulted in the following number of matches: " + identifyResult.Indexes.Length.ToString()); SendMessage(Action.SendMessage, "Place your right index finger on the reader."); count = 0; } } catch (Exception ex) { // Send error message, then close form SendMessage(Action.SendMessage, "Error: " + ex.Message); } }
public override Task <CaptureResult> Capture() { var result = new CaptureResult(); result.Value = Display.Primary.CurrentZoomPercentage; result.Success = true; return(Task.FromResult(result)); }
private void OnCaptured(CaptureResult captureResult) { bool existio = false; try { if (!Clases.HuellaDigital.CheckCaptureResult(captureResult)) { return; } ////Creamos el bitmap para el PictureBox //foreach (Fid.Fiv fiv in captureResult.Data.Views) //{ // SendMessage(Action.SendBitmap, Clases.HuellaDigital.CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height)); //} //Guardamos la variable de la huella res = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI); if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { Clases.HuellaDigital.Reset = true; throw new Exception(captureResult.ResultCode.ToString()); } Fmd[] fmds = new Fmd[2]; foreach (int k in Clases.HuellaDigital.Fmds.Keys) { fmds[0] = Clases.HuellaDigital.Fmds[k]; int probabilidad = DPFJ_PROBABILITY_ONE * 1 / 100000; IdentifyResult ideRes = Comparison.Identify(res.Data, 0, fmds, probabilidad, Clases.HuellaDigital.Fmds.Count + 1); if (ideRes.ResultCode != Constants.ResultCode.DP_SUCCESS) { Clases.HuellaDigital.Reset = true; throw new Exception(ideRes.ResultCode.ToString()); } if (ideRes.Indexes.Length > 0) { SendMessage(Action.SendOK, k.ToString()); existio = true; break; } } if (!existio) { SendMessage(Action.SendMessage, "La huella no coincide con alguna del registro\n"); } } catch (Exception ex) { //Mostramos un MessageBox con el mensaje de error SendMessage(Action.SendMessage, ex.Message); } }
public void Process(CaptureResult result) { switch (Parent.mState) { case CameraState.Preview: break; case CameraState.WaitingLock: // https://github.com/googlesamples/android-Camera2Basic/blob/master/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java#L295 var afState = ((Integer)result.Get(CaptureResult.ControlAfState))?.IntValue(); if (afState == null) { Parent.CaptureStillPicture(); } else if ((int)ControlAFState.FocusedLocked == afState || (int)ControlAFState.FocusedLocked == afState) { // CaptureResult.ControlAeState can be null on some devices var aeState1 = ((Integer)result.Get(CaptureResult.ControlAeState))?.IntValue(); if (aeState1 == null || aeState1 == (int)ControlAEState.Converged) { Parent.mState = CameraState.PictureTaken; Parent.CaptureStillPicture(); } else { Parent.CaptureStillPicture(); } } break; case CameraState.WaitingPrecapture: // CaptureResult.ControlAeState can be null on some devices var aeState2 = ((Integer)result.Get(CaptureResult.ControlAeState))?.IntValue(); if (aeState2 == null || aeState2 == (int)ControlAEState.Precapture || aeState2 == (int)ControlAEState.FlashRequired) { Parent.mState = CameraState.WaitingNonPrecapture; } break; case CameraState.WaitingNonPrecapture: // CaptureResult.ControlAeState can be null on some devices var aeState3 = ((Integer)result.Get(CaptureResult.ControlAeState))?.IntValue(); if (aeState3 == null || aeState3 == (int)ControlAEState.Precapture) { Parent.mState = CameraState.PictureTaken; Parent.CaptureStillPicture(); } break; default: break; } }
public CaptureResult GetImageResult(int width, int height) { CaptureResult result = new CaptureResult( GetImageResult(capturePasses[0].camera, width, height, capturePasses[0].supportsAntialiasing, capturePasses[0].needsRescale), GetImageResult(capturePasses[1].camera, width, height, capturePasses[1].supportsAntialiasing, capturePasses[1].needsRescale) ); return(result); }
public override void OnCaptured(CaptureResult captureResult) { ImagenEvaluacionVisible = false; ProgressRingVisible = Visibility.Visible; base.OnCaptured(captureResult); CompararHuellaImputado(); ImagenEvaluacionVisible = true; ProgressRingVisible = Visibility.Collapsed; }
private void Process(CaptureResult result) { switch (owner.State) { case CameraState.WaitingLock: { Integer afState = (Integer)result.Get(CaptureResult.ControlAfState); if (afState == null) { owner.State = CameraState.PictureTaken; owner.CaptureStillPicture(); } else if ((((int)ControlAFState.FocusedLocked) == afState.IntValue()) || (((int)ControlAFState.NotFocusedLocked) == afState.IntValue())) { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() == ((int)ControlAEState.Converged)) { owner.State = CameraState.PictureTaken; owner.CaptureStillPicture(); } else { owner.RunPrecaptureSequence(); } } break; } case CameraState.WaitingPrecapture: { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() == ((int)ControlAEState.Precapture) || aeState.IntValue() == ((int)ControlAEState.FlashRequired)) { owner.State = CameraState.WaitingNonPrecapture; } break; } case CameraState.WaitingNonPrecapture: { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() != ((int)ControlAEState.Precapture)) { owner.State = CameraState.PictureTaken; owner.CaptureStillPicture(); } break; } } }
/// <summary> /// The check capture result. /// </summary> /// <param name="captureResult"> /// The capture result. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private bool CheckCaptureResult(CaptureResult captureResult) { if (captureResult.Quality != Constants.CaptureQuality.DP_QUALITY_GOOD) { return(false); } return(captureResult.Data != null); }
public void Success_ReturnsCorrectResult(TransactionStatus transactionStatus, bool statusSuccess, bool expected) { Status status = Factory.CreateStatus(statusSuccess); CaptureResult captureResult = new CaptureResult { Status = status, TransactionStatus = transactionStatus }; Assert.AreEqual(expected, captureResult.Success); }
public static CaptureResult ParseCaptureResult(string xmlText) { var result = new CaptureResult { RawXml = xmlText }; var root = result.GetRootElement(); ParseTransactionResult(result, root); return(result); }
private void Process(CaptureResult result) { try { Owner.Session.Capture(Owner.mPreviewRequestBuilder.Build(), Owner.callback, Owner.mBackgroundHandler); } catch {// when stopping the stream this will error 1 time. } }
/// <summary> /// Handler for when a fingerprint is captured. /// </summary> /// <param name="captureResult">contains info and data on the fingerprint capture</param> private void OnCaptured(CaptureResult captureResult) { try { // Check capture quality and throw an error if bad. if (!_sender.CheckCaptureResult(captureResult)) { return; } SendMessage(Action.SendMessage, oHelper.Mensaje2); DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(captureResult.Data, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { _sender.Reset = true; throw new Exception(resultConversion.ResultCode.ToString()); } if (count == 0) { firstFinger = resultConversion.Data; OperadorEncontrado = funciones.CompararHuella(firstFinger, secondFinger); if (OperadorEncontrado.IdOperador != 0) { SendMessage(Action.SendMessage, "Huella coincide con operador " + OperadorEncontrado.Nombre + " y su status es " + OperadorEncontrado.Status); SendMessage(Action.SendMessage, oHelper.Mensaje1); } else { SendMessage(Action.SendMessage, oHelper.Mensaje5); SendMessage(Action.SendMessage, oHelper.Mensaje1); } count = 0; } } catch (Exception ex) { // Send error message, then close form SendMessage(Action.SendMessage, oHelper.Error + ex.Message); } ///si el lector es desconectado con la ventana de verification abierta, mandamos a cerrarla automaticamente ///para llamar al evento Verification_Closed y que se cargue el load del main para que salga el mensajeBox de lector ///desconectado (Reintentar/Salir) if (captureResult.ResultCode == Constants.ResultCode.DP_DEVICE_FAILURE) { Thread t = new Thread(cerrar); t.Start(); } }
private void Process(CaptureResult result) { switch (Owner.mState) { case Camera2BasicFragment.STATE_WAITING_LOCK: { Integer afState = (Integer)result.Get(CaptureResult.ControlAfState); if (afState == null) { Owner.CaptureStillPicture(); } else if ((((int)ControlAFState.FocusedLocked) == afState.IntValue()) || (((int)ControlAFState.NotFocusedLocked) == afState.IntValue())) { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() == ((int)ControlAEState.Converged)) { Owner.mState = Camera2BasicFragment.STATE_PICTURE_TAKEN; Owner.CaptureStillPicture(); } else { Owner.RunPrecaptureSequence(); } } break; } case Camera2BasicFragment.STATE_WAITING_PRECAPTURE: { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() == ((int)ControlAEState.Precapture) || aeState.IntValue() == ((int)ControlAEState.FlashRequired)) { Owner.mState = Camera2BasicFragment.STATE_WAITING_NON_PRECAPTURE; } break; } case Camera2BasicFragment.STATE_WAITING_NON_PRECAPTURE: { // ControlAeState can be null on some devices Integer aeState = (Integer)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.IntValue() != ((int)ControlAEState.Precapture)) { Owner.mState = Camera2BasicFragment.STATE_PICTURE_TAKEN; Owner.CaptureStillPicture(); } break; } } }
private void ProcessImageCapture(CaptureResult result) { switch (state) { case MediaCaptorState.WaitingLock: { var afState = (int?)result.Get(CaptureResult.ControlAfState); if (afState == null) { CaptureStillPicture(); } else if ((((int)ControlAFState.FocusedLocked) == afState.Value) || (((int)ControlAFState.NotFocusedLocked) == afState.Value)) { // ControlAeState can be null on some devices var aeState = (int?)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.Value == ((int)ControlAEState.Converged)) { state = MediaCaptorState.PictureTaken; CaptureStillPicture(); } else { RunPrecaptureSequence(); } } break; } case MediaCaptorState.WaitingPrecapture: { // ControlAeState can be null on some devices var aeState = (int?)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.Value == ((int)ControlAEState.Precapture) || aeState.Value == ((int)ControlAEState.FlashRequired)) { state = MediaCaptorState.WaitingNonPrecapture; } break; } case MediaCaptorState.WaitingNonPrecapture: { // ControlAeState can be null on some devices var aeState = (int?)result.Get(CaptureResult.ControlAeState); if (aeState == null || aeState.Value != ((int)ControlAEState.Precapture)) { state = MediaCaptorState.PictureTaken; CaptureStillPicture(); } break; } } }
private void Process(CaptureResult result) { switch (_controller.State) { case CameraState.WaitingLock: var afState = result.Get(CaptureResult.ControlAfState) as Integer; if (afState == null) { _controller.CaptureStillPicture(); } else if ((int)ControlAFState.FocusedLocked == (int)afState || (int)ControlAFState.NotFocusedLocked == (int)afState) { // CONTROL_AE_STATE can be null on some devices var ae = result.Get(CaptureResult.ControlAeState) as Integer; if (ae == null || ae.IntValue() == (int)ControlAEState.Converged) { _controller.State = CameraState.PictureTaken; _controller.CaptureStillPicture(); } else { _controller.RunPrecaptureSequence(); } } break; case CameraState.WaitingPrecapture: // CONTROL_AE_STATE can be null on some devices var state = result.Get(CaptureResult.ControlAeState) as Integer; if (state == null || state.IntValue() == (int)ControlAEState.Precapture || state.IntValue() == (int)ControlAEState.FlashRequired) { _controller.State = CameraState.WaitingNonPrecapture; } break; case CameraState.WaitingNonPrecapture: // CONTROL_AE_STATE can be null on some devices var aeState = result.Get(CaptureResult.ControlAeState) as Integer; if (aeState == null || aeState.IntValue() == (int)ControlAEState.Precapture) { _controller.State = CameraState.PictureTaken; _controller.CaptureStillPicture(); } break; } }
public override void OnCaptureProgressed(CameraCaptureSession session, CaptureRequest request, CaptureResult partialResult) { Process(partialResult); }