Windows Dev Center

SensorAdapterSetIndicatorStatus function

Called by the Windows Biometric Framework to toggle the sensor indicator on or off.

Syntax


HRESULT WINAPI SensorAdapterSetIndicatorStatus(
  _Inout_ PWINBIO_PIPELINE        Pipeline,
  _In_    WINBIO_INDICATOR_STATUS IndicatorStatus
);

Parameters

Pipeline [in, out]

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

IndicatorStatus [in]

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

The Pipeline parameter is NULL.

E_INVALIDARG

The IndicatorStatus parameter is not correct

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.


//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterSetIndicatorStatus
//
// Purpose:
//      Toggles the sensor indicator on or off.
//      
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//
static HRESULT
WINAPI
SensorAdapterSetIndicatorStatus(
    __inout PWINBIO_PIPELINE Pipeline,
    __in WINBIO_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_SET_INDICATOR and WINBIO_BLANK_PAYLOAD structures are
    // included in winbio_ioctl.h.
    WINBIO_SET_INDICATOR setIndicator = {0};
    WINBIO_BLANK_PAYLOAD blankPayload = {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;
    }

    // Specify the WINBIO_SET_INDICATOR members.
    setIndicator.PayloadSize = sizeof (WINBIO_SET_INDICATOR);
    setIndicator.IndicatorStatus = IndicatorStatus;

    // This sample assumes that the sensor driver returns
    // a fixed size WINBIO_BLANK_PAYLOAD buffer in response
    // to a vendor defined set-indicator IOCTL.
    result = DeviceIoControl(
                Pipeline->SensorHandle,
                IOCTL_VENDOR_PRIVATE_CMD_SET_INDICATOR,
                &setIndicator,
                sizeof (WINBIO_SET_INDICATOR),
                &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
SensorAdapterGetIndicatorStatus

 

 

Community Additions

ADD
Show:
© 2015 Microsoft