#include <sane/sane.h>
#include "kds_s2000w_option_descriptors.h"
#include "kds_s2000w_handler.h"
+#include "kds_s2000w_debug.h"
typedef struct {
int cancel;
int _sane_kds_s2000w_net_find_first_data_byte(const char* data)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_find_first_data_byte");
const int header_spaces = 3;
const char space = 0x0a;
int space_count = 0;
SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_init");
*version_code = SANE_VERSION_CODE(1, 0, 0);
kds_s2000w_option_descriptor_init_option_descriptors();
device_info = malloc(sizeof(SANE_Device));
void _sane_kds_s2000w_net_exit(void)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_exit");
free(device_info);
device_info = NULL;
}
SANE_Status _sane_kds_s2000w_net_get_devices(SANE_Device*** device_list,
SANE_Bool local_only)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_get_devices");
if (local_only)
return SANE_STATUS_NO_MEM;
SANE_Status _sane_kds_s2000w_net_open(SANE_String_Const devicename,
SANE_Handle handle)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_open");
if (strcmp(devicename, "kds_s2000w_net") != 0)
return SANE_STATUS_INVAL;
void _sane_kds_s2000w_net_close(SANE_Handle handle)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_close");
kds_s2000w_option_descriptor_free_option_descriptors();
kds_s2000w_handler_close();
}
const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
SANE_Handle handle, SANE_Int option)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_get_option_descriptor");
return kds_s2000w_option_get_descriptor(option);
}
SANE_Status _sane_kds_s2000w_net_control_option(SANE_Handle handle,
SANE_Int option, SANE_Action action, void* value, SANE_Int* info)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_control_option");
if (action == SANE_ACTION_GET_VALUE)
kds_s2000w_handler_get_option(option, value);
void _sane_kds_s2000w_net_cancel(SANE_Handle handle)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_cancel");
read_info.cancel = 1;
return;
}
SANE_Status _sane_kds_s2000w_net_get_parameters(SANE_Handle handle,
SANE_Parameters* params)
{
- printf("get parameters 1\n");
+ debug_printf(ALL, "sane_kds_s2000w_net_get_parameters");
if (!read_info.scan_started)
return SANE_STATUS_GOOD;
- printf("get parameters 2\n");
for (int i = 0; i < 10; i++) {
sleep(1);
read_info.current_metadata = kds_s2000w_handler_get_parameters();
break;
}
- printf("get parameters 3\n");
if (!read_info.current_metadata.valid)
return SANE_STATUS_UNSUPPORTED;
SANE_Status _sane_kds_s2000w_net_start(SANE_Handle handle)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_start");
if (read_info.scan_started)
return SANE_STATUS_GOOD;
SANE_Status _sane_kds_s2000w_net_read(SANE_Handle handle, SANE_Byte* data,
SANE_Int max_length, SANE_Int* length)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_read");
if (read_info.cancel) {
read_info.scan_started = 0;
*length = 0;
SANE_Status _sane_kds_s2000w_net_set_io_mode(SANE_Handle handle,
SANE_Bool non_blocking)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_set_io_mode");
return SANE_STATUS_UNSUPPORTED;
}
SANE_Status _sane_kds_s2000w_net_get_select_fd(SANE_Handle handle, SANE_Int* fd)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_get_select_fd");
return SANE_STATUS_UNSUPPORTED;
}
SANE_String_Const _sane_kds_s2000w_net_strstatus(SANE_Status status)
{
+ debug_printf(ALL, "sane_kds_s2000w_net_strstatus");
return "not implemended";
}
\ No newline at end of file