kopia lustrzana https://gitlab.com/sane-project/backends
Full definition of ADF support.
rodzic
22416dece7
commit
cf94e585f5
|
@ -124,6 +124,7 @@ typedef struct capst
|
|||
int RiskyRightMargin;
|
||||
int RiskyTopMargin;
|
||||
int RiskyBottomMargin;
|
||||
int duplex;
|
||||
} caps_t;
|
||||
|
||||
typedef struct capabilities
|
||||
|
|
|
@ -327,12 +327,21 @@ print_xml_c(xmlNode *node, capabilities_t *scanner, int type)
|
|||
scanner->Sources = char_to_array(scanner->Sources, &scanner->SourcesSize, (SANE_String_Const)"Platen", 0);
|
||||
scanner->source = PLATEN;
|
||||
print_xml_c(node->children, scanner, PLATEN);
|
||||
scanner->caps[scanner->source].duplex = 0;
|
||||
}
|
||||
else if (!strcmp((const char *)node->name, "AdfSimplexInputCaps")) {
|
||||
scanner->Sources = char_to_array(scanner->Sources, &scanner->SourcesSize, (SANE_String_Const)"Feeder", 0);
|
||||
if (scanner->source == -1) scanner->source = ADFSIMPLEX;
|
||||
print_xml_c(node->children, scanner, ADFSIMPLEX);
|
||||
scanner->caps[scanner->source].duplex = 0;
|
||||
}
|
||||
else if (!strcmp((const char *)node->name, "AdfDuplexInputCaps")) {
|
||||
scanner->Sources = char_to_array(scanner->Sources, &scanner->SourcesSize, (SANE_String_Const)"Feeder", 0);
|
||||
if (scanner->source == -1) scanner->source = ADFDUPLEX;
|
||||
print_xml_c(node->children, scanner, ADFDUPLEX);
|
||||
scanner->caps[scanner->source].duplex = 1;
|
||||
}
|
||||
AdfDuplexInputCap
|
||||
else
|
||||
print_xml_c(node->children, scanner, type);
|
||||
node = node->next;
|
||||
|
|
|
@ -69,17 +69,10 @@ static const char settings[] =
|
|||
" <scan:XResolution>%d</scan:XResolution>" \
|
||||
" <scan:YResolution>%d</scan:YResolution>" \
|
||||
" <pwg:InputSource>%s</pwg:InputSource>" \
|
||||
" <scan:InputSource>i%s</scan:InputSource>" \
|
||||
"%s" \
|
||||
"</scan:ScanSettings>";
|
||||
|
||||
static char formatExtJPEG[] =
|
||||
" <scan:DocumentFormatExt>image/jpeg</scan:DocumentFormatExt>";
|
||||
|
||||
static char formatExtPNG[] =
|
||||
" <scan:DocumentFormatExt>image/png</scan:DocumentFormatExt>";
|
||||
|
||||
static char formatExtTIFF[] =
|
||||
" <scan:DocumentFormatExt>image/tiff</scan:DocumentFormatExt>";
|
||||
|
||||
/**
|
||||
* \fn static size_t download_callback(void *str, size_t size, size_t nmemb, void *userp)
|
||||
* \brief Callback function that stocks in memory the content of the 'job'. Example below :
|
||||
|
@ -144,6 +137,7 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
|
|||
char *temporary = NULL;
|
||||
char *f_ext = "";
|
||||
char *format_ext = NULL;
|
||||
char duplex_mode[1024] = { 0 };
|
||||
|
||||
*status = SANE_STATUS_GOOD;
|
||||
if (name == NULL || scanner == NULL) {
|
||||
|
@ -167,17 +161,19 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
|
|||
curl_handle = curl_easy_init();
|
||||
if (scanner->caps[scanner->source].format_ext == 1)
|
||||
{
|
||||
if (!strcmp(scanner->caps[scanner->source].default_format, "image/jpeg"))
|
||||
format_ext = formatExtJPEG;
|
||||
else if (!strcmp(scanner->caps[scanner->source].default_format, "image/png"))
|
||||
format_ext = formatExtPNG;
|
||||
else if (!strcmp(scanner->caps[scanner->source].default_format, "image/tiff"))
|
||||
format_ext = formatExtTIFF;
|
||||
else
|
||||
format_ext = f_ext;
|
||||
char f_ext_tmp[1024];
|
||||
snprintf(f_ext_tmp, sizeof(f_ext_tmp),
|
||||
" <scan:DocumentFormatExt>%s</scan:DocumentFormatExt>",
|
||||
scanner->caps[scanner->source].default_format);
|
||||
format_ext = f_exti_tmp;
|
||||
}
|
||||
else
|
||||
format_ext = f_ext;
|
||||
if(!strcmp(scanner->Sources[scanner->source], "Feeder")) {
|
||||
snprintf(duplex_mode, sizeof(duplex_mode),
|
||||
" <scan:Duplex>%s</scan:Duplex>",
|
||||
scanner->caps[scanner->source].duplex ? "true" : "false");
|
||||
}
|
||||
DBG( 1, "Create NewJob : %s\n", scanner->caps[scanner->source].default_format);
|
||||
if (curl_handle != NULL) {
|
||||
snprintf(cap_data, sizeof(cap_data), settings,
|
||||
|
@ -190,7 +186,9 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
|
|||
scanner->caps[scanner->source].default_color,
|
||||
scanner->caps[scanner->source].default_resolution,
|
||||
scanner->caps[scanner->source].default_resolution,
|
||||
scanner->Sources[scanner->source]);
|
||||
scanner->Sources[scanner->source],
|
||||
scanner->Sources[scanner->source],
|
||||
duplex_mode[0] == 0 ? "" : duplex_mode);
|
||||
DBG( 1, "Create NewJob : %s\n", cap_data);
|
||||
upload->read_data = strdup(cap_data);
|
||||
upload->size = strlen(cap_data);
|
||||
|
|
Ładowanie…
Reference in New Issue