## FpContext

FpContext — Discover fingerprint devices

## Functions

FpContext * | fp_context_new ()
void | fp_context_enumerate ()
GPtrArray * | fp_context_get_devices ()

## Signals

void | device-added | Run Last
void | device-removed | Run Last

## Types and Values

#define | FP_TYPE_CONTEXT
struct | FpContextClass
| FpContext

## Object Hierarchy

        GObject
        ╰── FpContext

## Description

The FpContext allows you to discover fingerprint scanning hardware. This is the starting point when integrating libfprint into your software.

The device-added and device-removed signals allow you to handle devices that may be hotplugged at runtime.

## Functions

### fp_context_new ()

    FpContext *
    fp_context_new (void);

Create a new FpContext.

#### Returns

a newly created FpContext.

[transfer full]

### fp_context_enumerate ()

    void
    fp_context_enumerate (FpContext *context);

Enumerate all devices. You should call this function exactly once at startup. Please note that it iterates the mainloop until all devices are enumerated.

#### Parameters

context | a FpContext |

### fp_context_get_devices ()

    GPtrArray *
    fp_context_get_devices (FpContext *context);

Get all devices. `fp_context_enumerate()` will be called as needed.

#### Parameters

context | a FpContext |

#### Returns

a new GPtrArray of FpDevice's.

[transfer none][element-type FpDevice]

## Types and Values

### FP_TYPE_CONTEXT

    #define FP_TYPE_CONTEXT (fp_context_get_type ())

### struct FpContextClass

    struct FpContextClass {
      GObjectClass parent_class;

      void         (*device_added)            (FpContext *context,
                                               FpDevice  *device);
      void         (*device_removed)          (FpContext *context,
                                               FpDevice  *device);
    };

Class structure for FpContext instances.

#### Members

`device_added` () | Called when a new device is added |
`device_removed` () | Called when a device is removed |

### FpContext

    typedef struct _FpContext FpContext;

## Signal Details

### The `“device-added”` signal

    void
    user_function (FpContext *context,
                   FpDevice  *device,
                   gpointer   user_data)

This signal is emitted when a fingerprint reader is added.

#### Parameters

context | the FpContext instance that emitted the signal |
device | A FpDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“device-removed”` signal

    void
    user_function (FpContext *context,
                   FpDevice  *device,
                   gpointer   user_data)

This signal is emitted when a fingerprint reader is removed.

It is guaranteed that the device has been closed before this signal is emitted. See the FpDevice removed signal documentation for more information.

#### Parameters

context | the FpContext instance that emitted the signal |
device | A FpDevice |
user_data | user data set when the signal handler was connected. |

Flags: Run Last