kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'full-location-header' into 'master'
The job URL is adapted to the information provided by the value of the Location property. See merge request sane-project/backends!635merge-requests/213/merge
commit
980bb29cb8
|
@ -1222,9 +1222,11 @@ sane_cancel(SANE_Handle h)
|
||||||
}
|
}
|
||||||
handler->scanner->work = SANE_FALSE;
|
handler->scanner->work = SANE_FALSE;
|
||||||
handler->cancel = SANE_TRUE;
|
handler->cancel = SANE_TRUE;
|
||||||
escl_scanner(handler->device, handler->result);
|
escl_scanner(handler->device, handler->scanner->scanJob, handler->result);
|
||||||
free(handler->result);
|
free(handler->result);
|
||||||
handler->result = NULL;
|
handler->result = NULL;
|
||||||
|
free(handler->scanner->scanJob);
|
||||||
|
handler->scanner->scanJob = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1592,7 +1594,7 @@ sane_start(SANE_Handle h)
|
||||||
return SANE_STATUS_NO_DOCS;
|
return SANE_STATUS_NO_DOCS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status = escl_scan(handler->scanner, handler->device, handler->result);
|
status = escl_scan(handler->scanner, handler->device, handler->scanner->scanJob, handler->result);
|
||||||
if (status != SANE_STATUS_GOOD)
|
if (status != SANE_STATUS_GOOD)
|
||||||
return (status);
|
return (status);
|
||||||
if (!strcmp(handler->scanner->caps[handler->scanner->source].default_format, "image/jpeg"))
|
if (!strcmp(handler->scanner->caps[handler->scanner->source].default_format, "image/jpeg"))
|
||||||
|
|
|
@ -156,6 +156,7 @@ typedef struct capabilities
|
||||||
SANE_String_Const *Sources;
|
SANE_String_Const *Sources;
|
||||||
int SourcesSize;
|
int SourcesSize;
|
||||||
FILE *tmp;
|
FILE *tmp;
|
||||||
|
char *scanJob;
|
||||||
unsigned char *img_data;
|
unsigned char *img_data;
|
||||||
long img_size;
|
long img_size;
|
||||||
long img_read;
|
long img_read;
|
||||||
|
@ -238,9 +239,11 @@ char *escl_newjob(capabilities_t *scanner,
|
||||||
|
|
||||||
SANE_Status escl_scan(capabilities_t *scanner,
|
SANE_Status escl_scan(capabilities_t *scanner,
|
||||||
const ESCL_Device *device,
|
const ESCL_Device *device,
|
||||||
|
char *scanJob,
|
||||||
char *result);
|
char *result);
|
||||||
|
|
||||||
void escl_scanner(const ESCL_Device *device,
|
void escl_scanner(const ESCL_Device *device,
|
||||||
|
char *scanJob,
|
||||||
char *result);
|
char *result);
|
||||||
|
|
||||||
typedef void CURL;
|
typedef void CURL;
|
||||||
|
|
|
@ -296,7 +296,17 @@ wake_up_device:
|
||||||
result = strdup(location);
|
result = strdup(location);
|
||||||
DBG( 1, "Create NewJob : %s\n", result);
|
DBG( 1, "Create NewJob : %s\n", result);
|
||||||
*temporary = '\n';
|
*temporary = '\n';
|
||||||
|
*location = '\0';
|
||||||
|
location = strrchr(tmp_location,'/');
|
||||||
wakup_count = 0;
|
wakup_count = 0;
|
||||||
|
if (location) {
|
||||||
|
location++;
|
||||||
|
scanner->scanJob = strdup(location);
|
||||||
|
DBG( 1, "Full location header [%s]\n", scanner->scanJob);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
scanner->scanJob = strdup("ScanJobs");
|
||||||
|
*location = '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
|
|
|
@ -44,10 +44,10 @@ write_callback(void __sane_unused__*str,
|
||||||
* This function is called in the 'sane_cancel' function.
|
* This function is called in the 'sane_cancel' function.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
escl_scanner(const ESCL_Device *device, char *result)
|
escl_scanner(const ESCL_Device *device, char *scanJob, char *result)
|
||||||
{
|
{
|
||||||
CURL *curl_handle = NULL;
|
CURL *curl_handle = NULL;
|
||||||
const char *scan_jobs = "/eSCL/ScanJobs";
|
const char *scan_jobs = "/eSCL/";
|
||||||
const char *scanner_start = "/NextDocument";
|
const char *scanner_start = "/NextDocument";
|
||||||
char scan_cmd[PATH_MAX] = { 0 };
|
char scan_cmd[PATH_MAX] = { 0 };
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -58,8 +58,8 @@ escl_scanner(const ESCL_Device *device, char *result)
|
||||||
CURL_CALL:
|
CURL_CALL:
|
||||||
curl_handle = curl_easy_init();
|
curl_handle = curl_easy_init();
|
||||||
if (curl_handle != NULL) {
|
if (curl_handle != NULL) {
|
||||||
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s",
|
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s%s",
|
||||||
scan_jobs, result, scanner_start);
|
scan_jobs, scanJob, result, scanner_start);
|
||||||
escl_curl_url(curl_handle, device, scan_cmd);
|
escl_curl_url(curl_handle, device, scan_cmd);
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
|
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
|
||||||
if (curl_easy_perform(curl_handle) == CURLE_OK) {
|
if (curl_easy_perform(curl_handle) == CURLE_OK) {
|
||||||
|
|
|
@ -57,10 +57,10 @@ write_callback(void *str, size_t size, size_t nmemb, void *userp)
|
||||||
* \return status (if everything is OK, status = SANE_STATUS_GOOD, otherwise, SANE_STATUS_NO_MEM/SANE_STATUS_INVAL)
|
* \return status (if everything is OK, status = SANE_STATUS_GOOD, otherwise, SANE_STATUS_NO_MEM/SANE_STATUS_INVAL)
|
||||||
*/
|
*/
|
||||||
SANE_Status
|
SANE_Status
|
||||||
escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *result)
|
escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *scanJob, char *result)
|
||||||
{
|
{
|
||||||
CURL *curl_handle = NULL;
|
CURL *curl_handle = NULL;
|
||||||
const char *scan_jobs = "/eSCL/ScanJobs";
|
const char *scan_jobs = "/eSCL/";
|
||||||
const char *scanner_start = "/NextDocument";
|
const char *scanner_start = "/NextDocument";
|
||||||
char scan_cmd[PATH_MAX] = { 0 };
|
char scan_cmd[PATH_MAX] = { 0 };
|
||||||
SANE_Status status = SANE_STATUS_GOOD;
|
SANE_Status status = SANE_STATUS_GOOD;
|
||||||
|
@ -70,8 +70,8 @@ escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *result)
|
||||||
scanner->real_read = 0;
|
scanner->real_read = 0;
|
||||||
curl_handle = curl_easy_init();
|
curl_handle = curl_easy_init();
|
||||||
if (curl_handle != NULL) {
|
if (curl_handle != NULL) {
|
||||||
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s",
|
snprintf(scan_cmd, sizeof(scan_cmd), "%s%s%s%s",
|
||||||
scan_jobs, result, scanner_start);
|
scan_jobs, scanJob, result, scanner_start);
|
||||||
escl_curl_url(curl_handle, device, scan_cmd);
|
escl_curl_url(curl_handle, device, scan_cmd);
|
||||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
|
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
|
||||||
if (scanner->tmp)
|
if (scanner->tmp)
|
||||||
|
|
Ładowanie…
Reference in New Issue