## Image device operations Image device operations — Image device operation functions |

## Functions

void | fpi_imgdev_abort_scan ()
void | fpi_imgdev_activate_complete ()
void | fpi_imgdev_close_complete ()
void | fpi_imgdev_deactivate_complete ()
enum fp_imgdev_action | fpi_imgdev_get_action ()
int | fpi_imgdev_get_action_result ()
enum fp_imgdev_enroll_state | fpi_imgdev_get_action_state ()
void | fpi_imgdev_image_captured ()
void | fpi_imgdev_open_complete ()
void | fpi_imgdev_report_finger_status ()
void | fpi_imgdev_session_error ()
void | fpi_imgdev_set_action_result ()

## Types and Values

enum | fp_imgdev_action
enum | fp_imgdev_state
enum | fp_imgdev_enroll_state

## Includes

    #include <fpi-dev-img.h>

## Description

As drivers work through different operations, they need to report back to the core as to their internal state, so errors and successes can be reported back to front-ends.

## Functions

### fpi_imgdev_abort_scan ()

    void
    fpi_imgdev_abort_scan (struct fp_img_dev *imgdev,
                           int result);

Aborts a scan after an error, and set the action result. See `fpi_imgdev_get_action_result()` for possible values.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |
result | the scan result |

### fpi_imgdev_activate_complete ()

    void
    fpi_imgdev_activate_complete (struct fp_img_dev *imgdev,
                                  int status);

Marks an activation as complete, whether successful or not. See `fpi_imgdev_get_action_result()` for possible values.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |
status | the activation result |

### fpi_imgdev_close_complete ()

    void
    fpi_imgdev_close_complete (struct fp_img_dev *imgdev);

Function to call when the device has been closed.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |

### fpi_imgdev_deactivate_complete ()

    void
    fpi_imgdev_deactivate_complete (struct fp_img_dev *imgdev);

Marks a deactivation as complete.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |

### fpi_imgdev_get_action ()

    enum fp_imgdev_action
    fpi_imgdev_get_action (struct fp_img_dev *imgdev);

Returns the current action being performed by an imaging device.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |

#### Returns

a enum fp_imgdev_action

### fpi_imgdev_get_action_result ()

    int
    fpi_imgdev_get_action_result (struct fp_img_dev *imgdev);

Returns an integer representing the result of an action. Which enum the result code is taken from depends on the current action being performed. See fp_capture_result, fp_enroll_result and fp_verify_result.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |

### fpi_imgdev_get_action_state ()

    enum fp_imgdev_enroll_state
    fpi_imgdev_get_action_state (struct fp_img_dev *imgdev);

Returns the state of an imaging device while enrolling a fingerprint.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |

#### Returns

a enum fp_imgdev_enroll_state

### fpi_imgdev_image_captured ()

    void
    fpi_imgdev_image_captured (struct fp_img_dev *imgdev,
                               struct fp_img *img);

Report to the core that the driver captured this image from the sensor.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |
img | an fp_img image |

### fpi_imgdev_open_complete ()

    void
    fpi_imgdev_open_complete (struct fp_img_dev *imgdev,
                              int status);

Function to call when the device has been opened, whether successfully of not.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |
status | an error code |

### fpi_imgdev_report_finger_status ()

    void
    fpi_imgdev_report_finger_status (struct fp_img_dev *imgdev,
                                     gboolean present);

Reports from the driver whether the user's finger is on the sensor.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |
present | whether the finger is present on the sensor |

### fpi_imgdev_session_error ()

    void
    fpi_imgdev_session_error (struct fp_img_dev *imgdev,
                              int error);

Report an error that occurred in the driver.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |
error | an error code |

### fpi_imgdev_set_action_result ()

    void
    fpi_imgdev_set_action_result (struct fp_img_dev *imgdev,
                                  int action_result);

Drivers should use `fpi_imgdev_image_captured()` instead. This function should not be used, and will be removed soon.

#### Parameters

imgdev | a fp_img_dev imaging fingerprint device |
action_result | an action result |

## Types and Values

### enum fp_imgdev_action

The current action being performed by an imaging device. The current action can be gathered inside the driver using `fpi_imgdev_get_action()`.

#### Members

IMG_ACTION_NONE | no action |
IMG_ACTION_ENROLL | device action is enrolling |
IMG_ACTION_VERIFY | device action is verifying |
IMG_ACTION_IDENTIFY | device action is identifying |
IMG_ACTION_CAPTURE | device action is capturing |

### enum fp_imgdev_state

The state of an imaging device while doing a capture. The state is passed through to the driver using the ::`activate()` or ::`change_state()` vfuncs.

#### Members

IMGDEV_STATE_INACTIVE | inactive |
IMGDEV_STATE_AWAIT_FINGER_ON | waiting for the finger to be pressed or swiped |
IMGDEV_STATE_CAPTURE | capturing an image |
IMGDEV_STATE_AWAIT_FINGER_OFF | waiting for the finger to be removed |

### enum fp_imgdev_enroll_state

The state of an imaging device while enrolling a fingerprint. Given that enrollment requires multiple captures, a number of those states will be repeated before the state is `IMG_ACQUIRE_STATE_DONE` .

#### Members

IMG_ACQUIRE_STATE_NONE | doing nothing |
IMG_ACQUIRE_STATE_ACTIVATING | activating the device |
IMG_ACQUIRE_STATE_AWAIT_FINGER_ON | waiting for the finger to be pressed or swiped |
IMG_ACQUIRE_STATE_AWAIT_IMAGE | waiting for the image to be captured |
IMG_ACQUIRE_STATE_AWAIT_FINGER_OFF | waiting for the finger to be removed |
IMG_ACQUIRE_STATE_DONE | enrollment has all the images it needs |
IMG_ACQUIRE_STATE_DEACTIVATING | deactivating the device |