59 lines
1.7 KiB
C
59 lines
1.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#ifndef GXFP_SESSION_H
|
|
#define GXFP_SESSION_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct gxfp_session;
|
|
|
|
enum gxfp_session_state {
|
|
GXFP_SESSION_OPEN = 0,
|
|
GXFP_SESSION_ACTIVE,
|
|
GXFP_SESSION_WAITING_FINGER_DOWN,
|
|
GXFP_SESSION_FINGER_PRESENT,
|
|
GXFP_SESSION_CAPTURING,
|
|
GXFP_SESSION_WAITING_FINGER_UP,
|
|
GXFP_SESSION_ERROR,
|
|
};
|
|
|
|
struct gxfp_image12 {
|
|
uint16_t *pixels;
|
|
size_t width;
|
|
size_t height;
|
|
uint8_t header[5];
|
|
uint8_t trailer;
|
|
uint32_t crc_stored;
|
|
uint32_t crc_calculated;
|
|
};
|
|
|
|
int gxfp_session_open(struct gxfp_session **out, const char *device_path);
|
|
int gxfp_session_activate(struct gxfp_session *session, int timeout_ms);
|
|
int gxfp_session_deactivate(struct gxfp_session *session);
|
|
|
|
int gxfp_session_arm_finger_down(struct gxfp_session *session);
|
|
int gxfp_session_wait_finger_down(struct gxfp_session *session, int timeout_ms);
|
|
int gxfp_session_capture(struct gxfp_session *session,
|
|
struct gxfp_image12 *image, int timeout_ms);
|
|
int gxfp_session_arm_finger_up(struct gxfp_session *session);
|
|
int gxfp_session_wait_finger_up(struct gxfp_session *session, int timeout_ms);
|
|
|
|
int gxfp_image12_to_u8(const struct gxfp_image12 *source,
|
|
uint8_t *destination, size_t destination_size);
|
|
void gxfp_image12_clear(struct gxfp_image12 *image);
|
|
|
|
void gxfp_session_cancel(struct gxfp_session *session);
|
|
enum gxfp_session_state
|
|
gxfp_session_get_state(const struct gxfp_session *session);
|
|
void gxfp_session_close(struct gxfp_session *session);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|