PIBIO_SENSOR_FINISH_CAPTURE_FN 콜백 함수(winbio_adapter.h)
SensorAdapterStartCapture 함수에서 시작된 캡처 작업이 완료될 때까지 기다리기 위해 Windows 생체 인식 프레임워크에서 호출됩니다.
구문
PIBIO_SENSOR_FINISH_CAPTURE_FN PibioSensorFinishCaptureFn;
HRESULT PibioSensorFinishCaptureFn(
[in, out] PWINBIO_PIPELINE Pipeline,
[out] PWINBIO_REJECT_DETAIL RejectDetail
)
{...}
매개 변수
[in, out] Pipeline
작업을 수행하는 생체 인식 단위와 연결된 WINBIO_PIPELINE 구조체에 대한 포인터입니다.
[out] RejectDetail
생체 인식 샘플 캡처 실패에 대한 추가 정보를 수신하는 WINBIO_REJECT_DETAIL 값에 대한 포인터입니다. 작업이 성공하면 이 매개 변수가 0으로 설정됩니다. 다음 값은 지문 샘플에 대해 정의됩니다.
- WINBIO_FP_TOO_HIGH
- WINBIO_FP_TOO_LOW
- WINBIO_FP_TOO_LEFT
- WINBIO_FP_TOO_RIGHT
- WINBIO_FP_TOO_FAST
- WINBIO_FP_TOO_SLOW
- WINBIO_FP_POOR_QUALITY
- WINBIO_FP_TOO_SKEWED
- WINBIO_FP_TOO_SHORT
- WINBIO_FP_MERGE_FAILURE
반환 값
함수가 성공하면 S_OK를 반환합니다. 함수가 실패하면 오류를 나타내는 HRESULT 값을 반환합니다. 다음 값은 Windows 생체 인식 프레임워크에서 인식됩니다.
반환 코드 | 설명 |
---|---|
|
샘플을 캡처할 수 없습니다. 이 오류 코드를 반환하는 경우 문제의 특성을 나타내는 RejectDetail 매개 변수에 값도 지정해야 합니다. |
|
센서 드라이버가 ERROR_CANCELLED 또는 ERROR_OPERATION_ABORTED 반환했습니다. |
|
디바이스 오류가 발생했습니다. |
|
Pipeline 인수가 가리키는 WINBIO_PIPELINE 구조체의 SensorContext 멤버가 NULL이거나 SensorHandle 멤버가 INVALID_HANDLE_VALUE 설정됩니다. |
설명
Windows 생체 인식 프레임워크는 SensorAdapterStartCapture를 성공적으로 호출하거나 SensorAdapterCancel을 호출한 후 이 함수를 호출합니다. SensorAdapterStartCapture에 대한 호출이 실패하면 이 함수를 호출하지 않습니다.
이 함수의 구현이 반환되면 파이프라인의 데이터는 SensorAdapterPushDataToEngine 또는 SensorAdapterExportSensorData와 같은 함수에 대한 후속 호출에 대해 준비되어야 합니다.
센서 I/O 작업이 성공, 실패 또는 취소된 후에만 반환해야 하는 차단 함수입니다. 일반적으로 센서 어댑터 컨텍스트의 OVERLAPPED 구조를 GetOverlappedResult 함수에 전달하여 이 함수를 차단합니다. SensorAdapterFinishCapture가 반환될 때 OVERLAPPED 구조체의 hEvent 핸들에 신호를 받아야 합니다. GetOverlappedResult 함수는 센서 I/O 작업의 끝을 감지할 때 이 핸들을 자동으로 설정합니다. 어댑터가 I/O 완성을 감지하기 위해 다른 메커니즘을 사용하는 경우 이벤트를 직접 신호로 표시해야 합니다.
예제
다음 의사 코드는 이 함수의 가능한 구현 중 하나를 보여 줍니다. 예제는 컴파일되지 않습니다. 목적에 맞게 조정해야 합니다.
//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterFinishCapture
//
// Purpose:
// Waits for the completion of a capture operation initiated by the
// SensorAdapterStartCapture function.
//
// Parameters:
// Pipeline - Pointer to a WINBIO_PIPELINE structure associated with
// the biometric unit.
// RejectDetail - Pointer to a WINBIO_REJECT_DETAIL value that receives
// additional information about the failure to capture a
// biometric sample.
//
static HRESULT
WINAPI
SensorAdapterFinishCapture(
__inout PWINBIO_PIPELINE Pipeline,
__out PWINBIO_REJECT_DETAIL RejectDetail
)
{
HRESULT hr = S_OK;
WINBIO_SENSOR_STATUS sensorStatus = WINBIO_SENSOR_FAILURE;
WINBIO_CAPTURE_PARAMETERS captureParameters = {0};
BOOL result = TRUE;
DWORD bytesReturned = 0;
// Verify that pointer arguments are not NULL.
if (!ARGUMENT_PRESENT(Pipeline) ||
!ARGUMENT_PRESENT(RejectDetail))
{
hr = E_POINTER;
goto cleanup;
}
// Retrieve the context from the pipeline.
PWINBIO_SENSOR_CONTEXT sensorContext =
(PWINBIO_SENSOR_CONTEXT)Pipeline->SensorContext;
// Verify the state of the pipeline.
if (sensorContext == NULL ||
Pipeline->SensorHandle == INVALID_HANDLE_VALUE)
{
return WINBIO_E_INVALID_DEVICE_STATE;
}
// Initialize the RejectDetail argument.
*RejectDetail = 0;
// Wait for I/O completion. This sample assumes that the I/O operation was
// started using the code example shown in the SensorAdapterStartCapture
// documentation.
SetLastError(ERROR_SUCCESS);
result = GetOverlappedResult(
Pipeline->SensorHandle,
&sensorContext->Overlapped,
&bytesReturned,
TRUE
);
if (!result)
{
// There was an I/O error.
return _AdapterGetHresultFromWin32(GetLastError());
}
if (bytesReturned == sizeof (DWORD))
{
// The buffer is not large enough. This can happen if a device needs a
// bigger buffer depending on the purpose. Allocate a larger buffer and
// force the caller to reissue their I/O request.
DWORD allocationSize = sensorContext->CaptureBuffer->PayloadSize;
// Allocate at least the minimum buffer size needed to retrieve the
// payload structure.
if (allocationSize < sizeof(WINBIO_CAPTURE_DATA))
{
allocationSize = sizeof(WINBIO_CAPTURE_DATA);
}
// Free the old buffer and allocate a new one.
_AdapterRelease(sensorContext->CaptureBuffer);
sensorContext->CaptureBuffer = NULL;
sensorContext->CaptureBuffer =
(PWINBIO_CAPTURE_DATA)_AdapterAlloc(allocationSize);
if (sensorContext->CaptureBuffer == NULL)
{
sensorContext->CaptureBufferSize = 0;
return E_OUTOFMEMORY;
}
sensorContext->CaptureBufferSize = allocationSize;
return WINBIO_E_BAD_CAPTURE;
}
// Normalize the status value before sending it back to the biometric service.
if (sensorContext->CaptureBuffer != NULL &&
sensorContext->CaptureBufferSize >= sizeof (WINBIO_CAPTURE_DATA))
{
switch (sensorContext->CaptureBuffer->SensorStatus)
{
case WINBIO_SENSOR_ACCEPT:
// The capture was acceptable.
break;
case WINBIO_SENSOR_REJECT:
// The capture was not acceptable. Overwrite the WinBioHresult value
// in case it has not been properly set.
sensorContext->CaptureBuffer->WinBioHresult = WINBIO_E_BAD_CAPTURE;
break;
case WINBIO_SENSOR_BUSY:
// The device is busy. Reset the WinBioHresult value in case it
// has not been properly set.
sensorContext->CaptureBuffer->WinBioHresult = WINBIO_E_DEVICE_BUSY;
break;
case WINBIO_SENSOR_READY:
case WINBIO_SENSOR_NOT_CALIBRATED:
case WINBIO_SENSOR_FAILURE:
default:
// There has been a device failure. Reset the WinBioHresult value
// in case it has not been properly set.
sensorContext->CaptureBuffer->WinBioHresult = WINBIO_E_INVALID_DEVICE_STATE;
break;
}
*RejectDetail = sensorContext->CaptureBuffer->RejectDetail;
hr = sensorContext->CaptureBuffer->WinBioHresult;
}
else
{
// The buffer is not large enough or the buffer pointer is NULL.
hr = WINBIO_E_INVALID_DEVICE_STATE;
}
return hr;
}
요구 사항
요구 사항 | 값 |
---|---|
지원되는 최소 클라이언트 | Windows 7 [데스크톱 앱만 해당] |
지원되는 최소 서버 | Windows Server 2008 R2 [데스크톱 앱만 해당] |
대상 플랫폼 | Windows |
헤더 | winbio_adapter.h(Winbio_adapter.h 포함) |