PIBIO_SENSOR_PUSH_DATA_TO_ENGINE_FN função de retorno de chamada (winbio_adapter.h)

Chamado pela Estrutura Biométrica do Windows para disponibilizar o conteúdo atual do buffer de exemplo para o adaptador do mecanismo.

Sintaxe

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

Ponteiro para a estrutura WINBIO_PIPELINE associada à unidade biométrica que executa a operação.

[in] Purpose

Um valor que especifica as propriedades da estrutura WINBIO_BIR que será passada para o mecanismo. Isso pode ser um OR bit a bit dos seguintes sinalizadores de nível de segurança e processamento:

  • WINBIO_PURPOSE_VERIFY
  • WINBIO_PURPOSE_IDENTIFY
  • WINBIO_PURPOSE_ENROLL
  • WINBIO_PURPOSE_ENROLL_FOR_VERIFICATION
  • WINBIO_PURPOSE_ENROLL_FOR_IDENTIFICATION

[in] Flags

Um valor que especifica o formato do exemplo. Isso pode ser um OR bit a bit dos seguintes sinalizadores de nível de segurança e processamento:

  • WINBIO_DATA_FLAG_PRIVACY

O exemplo deve ser criptografado.

  • WINBIO_DATA_FLAG_INTEGRITY

O exemplo deve ser assinado digitalmente ou protegido por um MAC (código de autenticação de mensagem).

  • WINBIO_DATA_FLAG_SIGNED

Se esse sinalizador e o sinalizador WINBIO_DATA_FLAG_INTEGRITY estiverem definidos, o exemplo deverá ser assinado. Se esse sinalizador não estiver definido, mas o sinalizador WINBIO_DATA_FLAG_INTEGRITY estiver definido, um MAC deverá ser calculado.

  • WINBIO_DATA_FLAG_RAW

O exemplo deve ser colocado no objeto WINBIO_BIR no formato em que foi capturado.

[out] RejectDetail

Um ponteiro para um valor WINBIO_REJECT_DETAIL que contém informações sobre a falha anterior para capturar uma amostra biométrica e, portanto, o motivo pelo qual o buffer de exemplo está vazio. Se uma captura anterior tiver sido bem-sucedida, esse parâmetro será definido como zero. Os seguintes valores são definidos para captura de impressão digital:

  • 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

Retornar valor

Se a função for bem-sucedida, ela retornará S_OK. Se a função falhar, ela deverá retornar um dos seguintes valores HRESULT para indicar o erro.

Código de retorno Descrição
E_POINTER
Um argumento de ponteiro obrigatório é NULL.
WINBIO_E_BAD_CAPTURE
Os dados de exemplo não são adequados para uso. Se você retornar esse código de erro, também deverá especificar um valor no parâmetro RejectDetail para indicar a natureza do problema.
WINBIO_E_INVALID_DEVICE_STATE
O membro SensorContext da estrutura WINBIO_PIPELINE apontada pelo argumento Pipeline é NULL.
WINBIO_E_NO_CAPTURE_DATA
Não existem dados de captura.

Comentários

Sua implementação dessa função deve converter dados brutos contidos no buffer de exemplo em uma estrutura de WINBIO_BIR padrão e efetuar push dessa estrutura para o mecanismo usando a função EngineAdapterAcceptSampleData . A maneira correta de fazer isso é chamar a função auxiliar WbioEngineAcceptSampleData definida no arquivo de cabeçalho Winbio_adapter.h.

Se a função EngineAdapterAcceptSampleData retornar WINBIO_E_BAD_CAPTURE, a implementação de SensorAdapterPushDataToEngine deverá retornar o valor RejectDetail propagado pelo adaptador do mecanismo.

O adaptador do sensor retém a propriedade do buffer de exemplo passado para EngineAdapterAcceptSampleData. O adaptador do sensor é responsável por liberar esse buffer em algum momento após o retorno de EngineAdapterAcceptSampleData .

Exemplos

O pseudocódigo a seguir mostra uma implementação possível dessa função. O exemplo não é compilado. Você deve adaptá-lo para se adequar ao seu 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 Valor
Cliente mínimo com suporte Windows 7 [somente aplicativos da área de trabalho]
Servidor mínimo com suporte Windows Server 2008 R2 [somente aplicativos da área de trabalho]
Plataforma de Destino Windows
Cabeçalho winbio_adapter.h (inclua Winbio_adapter.h)

Confira também

Funções de plug-in