SensorAdapterReset function

Called by the Windows Biometric Framework to reinitialize the sensor. The specific details of the reset state are determined by the sensor hardware vendor.

Syntax


HRESULT WINAPI SensorAdapterReset(
  _Inout_  PWINBIO_PIPELINE Pipeline
);

Parameters

Pipeline [in, out]

Pointer to a WINBIO_PIPELINE structure associated with the biometric unit performing the operation.

Return value

If the function succeeds, it returns S_OK. If the function fails, it must return one of the following HRESULT values to indicate the error.

Return codeDescription
E_POINTER

A Pipeline argument is NULL.

WINBIO_E_DEVICE_FAILURE

There was a hardware failure.

 

Examples

The following pseudocode shows one possible implementation of this function. The example does not compile. You must adapt it to suit your purpose.


//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterReset
//
// Purpose:
//      Reinitialize the sensor.
//      
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//
static HRESULT
WINAPI
SensorAdapterReset(
    __inout PWINBIO_PIPELINE Pipeline
    )
{
    HRESULT hr = S_OK;
    WINBIO_BLANK_PAYLOAD blankPayload = {0};
    BOOL result = TRUE;
    DWORD bytesReturned = 0;

    // Verify that the Pipeline parameter is not NULL.
    if (!ARGUMENT_PRESENT(Pipeline))
    {
        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;
    }

    // This sample assumes that the sensor driver returns
    // a fixed-size WINBIO_BLANK_PAYLOAD buffer in response
    // to a vendor-defined reset IOCTL.
    result = DeviceIoControl(
                Pipeline->SensorHandle,
                IOCTL_VENDOR_PRIVATE_CMD_RESET,
                NULL,
                0,
                &blankPayload,
                sizeof(WINBIO_BLANK_PAYLOAD),
                &bytesReturned,
                &sensorContext->Overlapped
                );
    if (!result && GetLastError() == ERROR_IO_PENDING)
    {
        SetLastError(ERROR_SUCCESS);

        result = GetOverlappedResult(
                    Pipeline->SensorHandle,
                    &sensorContext->Overlapped,
                    &bytesReturned,
                    TRUE
                    );
    }
    if (!result || bytesReturned < sizeof(WINBIO_BLANK_PAYLOAD))
    {
        hr = _AdapterGetHresultFromWin32(GetLastError());
    }
    else
    {
        hr = blankPayload.WinBioHresult;
    }
    return hr;
}


Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

Winbio_adapter.h (include Winbio_adapter.h)

See also

Plug-in Functions

 

 

Community Additions

ADD
Show:
© 2014 Microsoft