Windows Dev Center

SensorAdapterSetMode function

Called by the Windows Biometric Framework to set the sensor adapter mode.

Syntax


HRESULT WINAPI SensorAdapterSetMode(
  _Inout_ PWINBIO_PIPELINE   Pipeline,
  _In_    WINBIO_SENSOR_MODE Mode
);

Parameters

Pipeline [in, out]

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

Mode [in]

A WINBIO_SENSOR_MODE value. This can be one of the following values:

  • WINBIO_SENSOR_UNKNOWN_MODE
  • WINBIO_SENSOR_BASIC_MODE
  • WINBIO_SENSOR_ADVANCED_MODE
  • WINBIO_SENSOR_NAVIGATION_MODE
  • WINBIO_SENSOR_SLEEP_MODE

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 argument cannot be 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_INVALID_SENSOR_MODE

The sensor adapter does not support the value specified by the Mode parameter.

 

Examples

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


//////////////////////////////////////////////////////////////////////////////////////////
//
// SensorAdapterSetMode
//
// Purpose:
//      Sets the sensor adapter mode.
//      
// Parameters:
//      Pipeline -  Pointer to a WINBIO_PIPELINE structure associated with 
//                  the biometric unit.
//      Mode     -  A WINBIO_SENSOR_MODE value.
//
static HRESULT
WINAPI
SensorAdapterSetMode(
    __inout PWINBIO_PIPELINE Pipeline,
    __in WINBIO_SENSOR_MODE Mode
    )
{
    HRESULT hr = S_OK;

    // 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;
    }

    switch (Mode)
    {
    case WINBIO_SENSOR_BASIC_MODE:
        // Use a custom function (_SendIoctlToDriver) to send a mode change 
        // command to the sensor device. See the SensorAdapterReset documentation
        // for an example of how this function should work.
        hr = _SendIoctlToDriver( Pipeline, IOCTL_VENDOR_PRIVATE_CMD_SET_MODE_BASIC );

        // If you have defined fields in the sensor context structure that
        // are sensitive to the sensor mode, update them here.
        break;

    case WINBIO_SENSOR_ADVANCED_MODE:
        // Use a custom function (_SendIoctlToDriver) to send a mode change 
        // command to the sensor device. See the SensorAdapterReset documentation
        // for an example of how this function should work.
        hr = _SendIoctlToDriver( Pipeline, IOCTL_VENDOR_PRIVATE_CMD_SET_MODE_ADVANCED );
        break;

    default:
        // The requested mode is not supported
        hr = WINBIO_E_INVALID_SENSOR_MODE;
    }

    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:
© 2015 Microsoft