SensorAdapterGetIndicatorStatus function

Called by the Windows Biometric Framework to retrieve a value that indicates whether the sensor indicator is on or off.

Syntax


HRESULT WINAPI SensorAdapterGetIndicatorStatus(
  _Inout_  PWINBIO_PIPELINE Pipeline,
  _Out_    PWINBIO_INDICATOR_STATUS IndicatorStatus
);

Parameters

Pipeline [in, out]

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

IndicatorStatus [out]

Pointer to a WINBIO_INDICATOR_STATUS value. This can be one of the following:

  • WINBIO_INDICATOR_ON
  • WINBIO_INDICATOR_OFF

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 mandatory pointer parameter is NULL.

WINBIO_E_DEVICE_FAILURE

There was a hardware failure.

WINBIO_E_INVALID_DEVICE_STATE

The SensorContext member of the WINBIO_PIPELINE structure pointed to by the Pipeline argument is NULL or the SensorHandle member is set to INVALID_HANDLE_VALUE.

WINBIO_E_UNSUPPORTED_PROPERTY

The sensor does not have an indicator.

 

Examples

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


//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterGetIndicatorStatus
//
// Purpose:
//      Retrieves a value that indicates whether the sensor indicator is 
//      on or off.
//      
// Parameters:
//      Pipeline        -  Pointer to a WINBIO_PIPELINE structure associated with 
//                         the biometric unit.
//      IndicatorStatus -  Pointer to a WINBIO_INDICATOR_STATUS value.
//
static HRESULT
WINAPI
SensorAdapterGetIndicatorStatus(
    __inout PWINBIO_PIPELINE Pipeline,
    __out PWINBIO_INDICATOR_STATUS IndicatorStatus
    )
{
    //////////////////////////////////////////////////////////////////////////////////////////
    // If the sensor adapter does not have an indicator, return 
    // WINBIO_E_UNSUPPORTED_PROPERTY.
    //////////////////////////////////////////////////////////////////////////////////////////

    HRESULT hr = S_OK;
    BOOL result = TRUE;
    DWORD bytesReturned = 0;

    // The WINBIO_GET_INDICATOR structure is included in winbio_ioctl.h.
    WINBIO_GET_INDICATOR getIndicator = {0};

    // Verify that pointer arguments are not NULL.
    if (!ARGUMENT_PRESENT(Pipeline) ||
        !ARGUMENT_PRESENT(IndicatorStatus))
    {
        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 output parameter.
    *IndicatorStatus = WINBIO_INDICATOR_OFF;

    // This sample assumes that the sensor driver returns
    // a fixed size WINBIO_GET_INDICATOR buffer in response
    // to a vendor defined get-indicator IOCTL.
    result = DeviceIoControl(
                Pipeline->SensorHandle,
                IOCTL_VENDOR_PRIVATE_CMD_GET_INDICATOR,
                NULL,
                0,
                &getIndicator,
                sizeof(WINBIO_GET_INDICATOR),
                &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_GET_INDICATOR))
    {
        hr = _AdapterGetHresultFromWin32(GetLastError());
    }
    else
    {
        if (SUCCEEDED(getIndicator.WinBioHresult))
        {
            *IndicatorStatus = getIndicator.IndicatorStatus;
        }
        hr = getIndicator.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
SensorAdapterSetIndicatorStatus

 

 

Community Additions

ADD
Show:
© 2014 Microsoft