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 RiskyRightMargin;
|
||||||
int RiskyTopMargin;
|
int RiskyTopMargin;
|
||||||
int RiskyBottomMargin;
|
int RiskyBottomMargin;
|
||||||
|
int duplex;
|
||||||
} caps_t;
|
} caps_t;
|
||||||
|
|
||||||
typedef struct capabilities
|
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->Sources = char_to_array(scanner->Sources, &scanner->SourcesSize, (SANE_String_Const)"Platen", 0);
|
||||||
scanner->source = PLATEN;
|
scanner->source = PLATEN;
|
||||||
print_xml_c(node->children, scanner, PLATEN);
|
print_xml_c(node->children, scanner, PLATEN);
|
||||||
|
scanner->caps[scanner->source].duplex = 0;
|
||||||
}
|
}
|
||||||
else if (!strcmp((const char *)node->name, "AdfSimplexInputCaps")) {
|
else if (!strcmp((const char *)node->name, "AdfSimplexInputCaps")) {
|
||||||
scanner->Sources = char_to_array(scanner->Sources, &scanner->SourcesSize, (SANE_String_Const)"Feeder", 0);
|
scanner->Sources = char_to_array(scanner->Sources, &scanner->SourcesSize, (SANE_String_Const)"Feeder", 0);
|
||||||
if (scanner->source == -1) scanner->source = ADFSIMPLEX;
|
if (scanner->source == -1) scanner->source = ADFSIMPLEX;
|
||||||
print_xml_c(node->children, scanner, 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
|
else
|
||||||
print_xml_c(node->children, scanner, type);
|
print_xml_c(node->children, scanner, type);
|
||||||
node = node->next;
|
node = node->next;
|
||||||
|
|
|
@ -69,17 +69,10 @@ static const char settings[] =
|
||||||
" <scan:XResolution>%d</scan:XResolution>" \
|
" <scan:XResolution>%d</scan:XResolution>" \
|
||||||
" <scan:YResolution>%d</scan:YResolution>" \
|
" <scan:YResolution>%d</scan:YResolution>" \
|
||||||
" <pwg:InputSource>%s</pwg:InputSource>" \
|
" <pwg:InputSource>%s</pwg:InputSource>" \
|
||||||
|
" <scan:InputSource>i%s</scan:InputSource>" \
|
||||||
|
"%s" \
|
||||||
"</scan:ScanSettings>";
|
"</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)
|
* \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 :
|
* \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 *temporary = NULL;
|
||||||
char *f_ext = "";
|
char *f_ext = "";
|
||||||
char *format_ext = NULL;
|
char *format_ext = NULL;
|
||||||
|
char duplex_mode[1024] = { 0 };
|
||||||
|
|
||||||
*status = SANE_STATUS_GOOD;
|
*status = SANE_STATUS_GOOD;
|
||||||
if (name == NULL || scanner == NULL) {
|
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();
|
curl_handle = curl_easy_init();
|
||||||
if (scanner->caps[scanner->source].format_ext == 1)
|
if (scanner->caps[scanner->source].format_ext == 1)
|
||||||
{
|
{
|
||||||
if (!strcmp(scanner->caps[scanner->source].default_format, "image/jpeg"))
|
char f_ext_tmp[1024];
|
||||||
format_ext = formatExtJPEG;
|
snprintf(f_ext_tmp, sizeof(f_ext_tmp),
|
||||||
else if (!strcmp(scanner->caps[scanner->source].default_format, "image/png"))
|
" <scan:DocumentFormatExt>%s</scan:DocumentFormatExt>",
|
||||||
format_ext = formatExtPNG;
|
scanner->caps[scanner->source].default_format);
|
||||||
else if (!strcmp(scanner->caps[scanner->source].default_format, "image/tiff"))
|
format_ext = f_exti_tmp;
|
||||||
format_ext = formatExtTIFF;
|
|
||||||
else
|
|
||||||
format_ext = f_ext;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
format_ext = f_ext;
|
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);
|
DBG( 1, "Create NewJob : %s\n", scanner->caps[scanner->source].default_format);
|
||||||
if (curl_handle != NULL) {
|
if (curl_handle != NULL) {
|
||||||
snprintf(cap_data, sizeof(cap_data), settings,
|
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_color,
|
||||||
scanner->caps[scanner->source].default_resolution,
|
scanner->caps[scanner->source].default_resolution,
|
||||||
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);
|
DBG( 1, "Create NewJob : %s\n", cap_data);
|
||||||
upload->read_data = strdup(cap_data);
|
upload->read_data = strdup(cap_data);
|
||||||
upload->size = strlen(cap_data);
|
upload->size = strlen(cap_data);
|
||||||
|
|
Ładowanie…
Reference in New Issue