Share via


PIBIO_SENSOR_PUSH_DATA_TO_ENGINE_FN función de devolución de llamada (winbio_adapter.h)

Llamado por Windows Biometric Framework para que el contenido actual del búfer de ejemplo esté disponible para el adaptador del motor.

Sintaxis

PIBIO_SENSOR_PUSH_DATA_TO_ENGINE_FN PibioSensorPushDataToEngineFn;

HRESULT PibioSensorPushDataToEngineFn(
  [in, out] PWINBIO_PIPELINE Pipeline,
  [in]      WINBIO_BIR_PURPOSE Purpose,
  [in]      WINBIO_BIR_DATA_FLAGS Flags,
  [out]     PWINBIO_REJECT_DETAIL RejectDetail
)
{...}

Parámetros

[in, out] Pipeline

Puntero a la estructura de WINBIO_PIPELINE asociada a la unidad biométrica que realiza la operación.

[in] Purpose

Valor que especifica las propiedades de la estructura WINBIO_BIR que se pasará al motor. Puede ser un OR bit a bit de las siguientes marcas de nivel de seguridad y procesamiento:

  • WINBIO_PURPOSE_VERIFY
  • WINBIO_PURPOSE_IDENTIFY
  • WINBIO_PURPOSE_ENROLL
  • WINBIO_PURPOSE_ENROLL_FOR_VERIFICATION
  • WINBIO_PURPOSE_ENROLL_FOR_IDENTIFICATION

[in] Flags

Valor que especifica el formato del ejemplo. Puede ser un OR bit a bit de las siguientes marcas de nivel de seguridad y procesamiento:

  • WINBIO_DATA_FLAG_PRIVACY

El ejemplo debe cifrarse.

  • WINBIO_DATA_FLAG_INTEGRITY

El ejemplo debe estar firmado digitalmente o protegido por un código de autenticación de mensajes (MAC).

  • WINBIO_DATA_FLAG_SIGNED

Si se establece esta marca y la marca de WINBIO_DATA_FLAG_INTEGRITY , se debe firmar el ejemplo. Si no se establece esta marca, pero se establece la marca WINBIO_DATA_FLAG_INTEGRITY , se debe calcular un MAC.

  • WINBIO_DATA_FLAG_RAW

El ejemplo debe colocarse en el objeto WINBIO_BIR en el formato en el que se capturó.

[out] RejectDetail

Puntero a un valor de WINBIO_REJECT_DETAIL que contiene información sobre el error anterior para capturar una muestra biométrica y, por lo tanto, el motivo por el que el búfer de muestra está vacío. Si una captura anterior se realizó correctamente, este parámetro se establece en cero. Los valores siguientes se definen para la captura de huellas digitales:

  • 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

Valor devuelto

Si la función se ejecuta correctamente, devuelve S_OK. Si se produce un error en la función, debe devolver uno de los siguientes valores HRESULT para indicar el error.

Código devuelto Descripción
E_POINTER
Un argumento de puntero obligatorio es NULL.
WINBIO_E_BAD_CAPTURE
Los datos de ejemplo no son adecuados para su uso. Si devuelve este código de error, también debe especificar un valor en el parámetro RejectDetail para indicar la naturaleza del problema.
WINBIO_E_INVALID_DEVICE_STATE
El miembro SensorContext de la estructura WINBIO_PIPELINE a la que apunta el argumento Pipeline es NULL.
WINBIO_E_NO_CAPTURE_DATA
No existe ningún dato de captura.

Comentarios

La implementación de esta función debe convertir los datos sin procesar contenidos en el búfer de ejemplo en una estructura de WINBIO_BIR estándar e insertar esta estructura en el motor mediante la función EngineAdapterAcceptSampleData . La manera correcta de hacerlo es llamar a la función auxiliar WbioEngineAcceptSampleData definida en Winbio_adapter.h archivo de encabezado.

Si la función EngineAdapterAcceptSampleData devuelve WINBIO_E_BAD_CAPTURE, la implementación de SensorAdapterPushDataToEngine debe devolver el valor RejectDetail propagado por el adaptador del motor.

El adaptador del sensor conserva la propiedad del búfer de ejemplo pasado a EngineAdapterAcceptSampleData. El adaptador del sensor es responsable de liberar este búfer en algún momento después de que EngineAdapterAcceptSampleData devuelva.

Ejemplos

El siguiente pseudocódigo muestra una posible implementación de esta función. El ejemplo no se compila. Debes adaptarlo para que se adapte a tu propósito.

//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterPushDataToEngine
//
// Purpose:
//      Makes the current contents of the sample buffer available to the 
//      engine adapter.
//      
// Parameters:
//      Pipeline     -  Pointer to a WINBIO_PIPELINE structure associated with 
//                      the biometric unit.
//      Purpose      -  Specifies the properties of the WINBIO_BIR structure 
//                      that will be passed to the engine.
//      Flags        -  A value that specifies the format of the sample.
//      RejectDetail -  Pointer to a WINBIO_REJECT_DETAIL value that receives 
//                      additional information about the reason the sample
//                      buffer is empty.
//
static HRESULT
WINAPI
SensorAdapterPushDataToEngine(
    __inout PWINBIO_PIPELINE Pipeline,
    __in WINBIO_BIR_PURPOSE Purpose,
    __in WINBIO_BIR_DATA_FLAGS Flags,
    __out PWINBIO_REJECT_DETAIL RejectDetail
    )
{
    HRESULT hr = S_OK;

    // 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)
    {
        hr = WINBIO_E_INVALID_DEVICE_STATE;
        goto cleanup;
    }

    if (sensorContext->CaptureBuffer != NULL &&
        sensorContext->CaptureBufferSize >= sizeof (WINBIO_CAPTURE_DATA) &&
        sensorContext->CaptureBuffer->CaptureData.Size != 0 &&
        sensorContext->CaptureBuffer->SensorStatus == WINBIO_SENSOR_ACCEPT)
    {
        // There is valid capture data in the Pipeline. Call the 
        // WbioEngineAcceptSampleData function to notify the engine adapter, but
        // retain ownership of the buffer in the sensor adapter. 
        // WbioEngineAcceptSampleData is a wrapper function declared in the
        // Winbio_adapter.h header file.
        hr = WbioEngineAcceptSampleData(
                    Pipeline,
                    (PWINBIO_BIR)sensorContext->CaptureBuffer->CaptureData.Data,
                    sensorContext->CaptureBuffer->CaptureData.Size,
                    Purpose,
                    RejectDetail
                    );
    }
    else if (sensorContext->CaptureBuffer != NULL &&
             sensorContext->CaptureBufferSize >= sizeof (WINBIO_CAPTURE_DATA) &&
             sensorContext->CaptureBuffer->WinBioHresult == WINBIO_E_BAD_CAPTURE)
    {
        // The most recent capture was not acceptable.  Do not attempt to push 
        // the sample to the engine. Instead, simply return the reject detail
        // information generated by the previous capture.
        hr = sensorContext->CaptureBuffer->WinBioHresult;
        *RejectDetail = sensorContext->CaptureBuffer->RejectDetail;
    }
    else
    {
        hr = WINBIO_E_NO_CAPTURE_DATA;
    }

    return hr;
}

Requisitos

Requisito Value
Cliente mínimo compatible Windows 7 [solo aplicaciones de escritorio]
Servidor mínimo compatible Windows Server 2008 R2 [solo aplicaciones de escritorio]
Plataforma de destino Windows
Encabezado winbio_adapter.h (incluya Winbio_adapter.h)

Consulte también

Funciones de complemento