code_device/twain/sane_helper.h

44 lines
1.8 KiB
C
Raw Normal View History

2023-07-10 07:28:45 +00:00
// utilities for transfroming options between TWAIN and sane ...
//
// Date: 2022-04-14
//
#pragma once
#include <sane/sane_ex.h>
#include <string>
class sane_helper
{
std::string dll_root_;
HMODULE dll_handle_ = nullptr;
void clear(void);
public:
SANE_Status (*invoke_sane_init) (SANE_Int * version_code, SANE_Auth_Callback authorize) = nullptr;
SANE_Status (*invoke_sane_init_ex)(SANE_Int* version_code, sane_callback cb, void* param) = nullptr;
void (*invoke_sane_exit) (void) = nullptr;
SANE_Status (*invoke_sane_get_devices) (const SANE_Device *** device_list, SANE_Bool local_only) = nullptr;
SANE_Status (*invoke_sane_open) (SANE_String_Const devicename, SANE_Handle * handle) = nullptr;
void (*invoke_sane_close) (SANE_Handle handle) = nullptr;
const SANE_Option_Descriptor* (*invoke_sane_get_option_descriptor) (SANE_Handle handle, SANE_Int option) = nullptr;
SANE_Status (*invoke_sane_control_option) (SANE_Handle handle, SANE_Int option, SANE_Action action, void *value, SANE_Int * info) = nullptr;
SANE_Status (*invoke_sane_get_parameters) (SANE_Handle handle, SANE_Parameters * params) = nullptr;
SANE_Status (*invoke_sane_start) (SANE_Handle handle) = nullptr;
SANE_Status (*invoke_sane_read) (SANE_Handle handle, SANE_Byte * data, SANE_Int max_length, SANE_Int * length) = nullptr;
void (*invoke_sane_cancel) (SANE_Handle handle) = nullptr;
SANE_Status (*invoke_sane_set_io_mode) (SANE_Handle handle, SANE_Bool non_blocking) = nullptr;
SANE_Status (*invoke_sane_get_select_fd) (SANE_Handle handle, SANE_Int * fd) = nullptr;
SANE_String_Const (*invoke_sane_strstatus) (SANE_Status status) = nullptr;
public:
sane_helper();
~sane_helper();
bool load_sane(const char* vendor); // libsane_hgsane.so.1, and vendor is 'hgsane'
};
extern sane_helper* sane_helper_;