return NULL;
h->current_scanner_config = NULL;
- h->current_scan_status = malloc(sizeof(scanstatus));
+ h->scan_status = malloc(sizeof(scan_status_t));
h->read_info = malloc(sizeof(readinfo));
h->image = malloc(sizeof(imagedata));
h->coord = malloc(sizeof(coord_t));
h->profile = 0;
h->sessionid = 0;
h->state = NOTCONNECTED;
- h->current_scan_status->current_image_number = 1;
- h->current_scan_status->available_images = 0;
- h->current_scan_status->downloaded_images = 0;
- h->current_scan_status->complete_scanned = false;
+ h->scan_status->current_image_number = 1;
+ h->scan_status->available_images = 0;
+ h->scan_status->downloaded_images = 0;
+ h->scan_status->complete_scanned = false;
h->read_info->scan_started = false;
h->read_info->cancel = false;
h->read_info->read_size = 0;
json_object_put(h->current_scanner_config);
h->current_scanner_config = NULL;
- free(h->current_scan_status);
- h->current_scan_status = NULL;
+ free(h->scan_status);
+ h->scan_status = NULL;
free(h->read_info);
h->read_info = NULL;
free(h->image->data);
free(h->image->data);
h->image->data = NULL;
- h->current_scan_status->current_image_number = 1;
- h->current_scan_status->available_images = 0;
- h->current_scan_status->downloaded_images = 0;
- h->current_scan_status->complete_scanned = false;
+ h->scan_status->current_image_number = 1;
+ h->scan_status->available_images = 0;
+ h->scan_status->downloaded_images = 0;
+ h->scan_status->complete_scanned = false;
h->read_info->scan_started = false;
h->read_info->cancel = false;
h->read_info->read_size = 0;
{
kds_s2000w_debug_printf(ALL, "get_current_scan_status");
- if (h->current_scan_status->available_images > 1)
+ if (h->scan_status->available_images > 1)
return;
response* resp = kds_s2000w_client_response_init();
json_object* status_resp_obj = json_tokener_parse(resp->data);
json_object* status_obj = json_object_object_get(status_resp_obj, "Status");
json_object* status_value_obj = json_object_object_get(status_obj, "NumImagesStored");
- h->current_scan_status->available_images = json_object_get_int(status_value_obj);
+ h->scan_status->available_images = json_object_get_int(status_value_obj);
status_value_obj = NULL;
status_value_obj = json_object_object_get(status_obj, "State");
const char* scanner_state = json_object_get_string(status_value_obj);
if (strcmp(scanner_state, "Scanning") != 0)
- h->current_scan_status->complete_scanned = true;
+ h->scan_status->complete_scanned = true;
json_object_put(status_resp_obj);
status_resp_obj = NULL;
h->image->size = 0;
response* resp = kds_s2000w_client_response_init();
- kds_s2000w_client_get_image(h->sessionid, h->current_scan_status->current_image_number, resp);
+ kds_s2000w_client_get_image(h->sessionid, h->scan_status->current_image_number, resp);
h->image->size = resp->size;
h->image->data = malloc(sizeof(char) * resp->size);
memcpy(h->image->data, resp->data, resp->size);
kds_s2000w_client_response_free(resp);
resp = NULL;
- h->current_scan_status->downloaded_images++;
+ h->scan_status->downloaded_images++;
}
void kds_s2000w_handler_delete_current_image(handler* h)
{
kds_s2000w_debug_printf(ALL, "delete_current_image");
- kds_s2000w_client_delete_image(h->sessionid, h->current_scan_status->current_image_number);
- h->current_scan_status->available_images--;
+ kds_s2000w_client_delete_image(h->sessionid, h->scan_status->current_image_number);
+ h->scan_status->available_images--;
}
\ No newline at end of file
for (uint32_t i = 0; i < 30; i++) {
kds_s2000w_handler_get_current_scan_status(h);
- if (h->current_scan_status->available_images > 0)
+ if (h->scan_status->available_images > 0)
break;
}
- if (h->current_scan_status->available_images < 1)
+ if (h->scan_status->available_images < 1)
return SANE_STATUS_NO_DOCS;
kds_s2000w_handler_download_current_image(h);
kds_s2000w_handler_delete_current_image(h);
- h->current_scan_status->current_image_number++;
+ h->scan_status->current_image_number++;
- if (h->current_scan_status->complete_scanned) {
+ if (h->scan_status->complete_scanned) {
kds_s2000w_handler_stop_scan(h);
return SANE_STATUS_GOOD;
}
kds_s2000w_handler_get_current_scan_status(h);
- if (h->current_scan_status->complete_scanned) {
+ if (h->scan_status->complete_scanned) {
kds_s2000w_debug_printf(DEBUG, "scan completed");
kds_s2000w_handler_reset(h);
return;
}
- if (h->current_scan_status->available_images == 0) {
+ if (h->scan_status->available_images == 0) {
kds_s2000w_debug_printf(DEBUG, "scan completed no availible images");
kds_s2000w_handler_reset(h);
kds_s2000w_handler_recreate_session(h);
int result = sane_kds_s2000w_net_start(h);
assert_int_equal(result, SANE_STATUS_GOOD);
- assert_false(h->current_scan_status->complete_scanned);
+ assert_false(h->scan_status->complete_scanned);
json_object_put(h->current_scanner_config);
h->current_scanner_config = NULL;
int result = sane_kds_s2000w_net_start(h);
assert_int_equal(result, SANE_STATUS_GOOD);
- assert_false(h->current_scan_status->complete_scanned);
+ assert_false(h->scan_status->complete_scanned);
json_object_put(h->current_scanner_config);
h->current_scanner_config = NULL;
int result = sane_kds_s2000w_net_start(h);
assert_int_equal(result, SANE_STATUS_GOOD);
- assert_true(h->current_scan_status->complete_scanned);
+ assert_true(h->scan_status->complete_scanned);
json_object_put(h->current_scanner_config);
h->current_scanner_config = NULL;
int32_t result = sane_kds_s2000w_net_start(h);
assert_int_equal(result, SANE_STATUS_GOOD);
- assert_true(h->current_scan_status->complete_scanned);
+ assert_true(h->scan_status->complete_scanned);
json_object_put(h->current_scanner_config);
h->current_scanner_config = NULL;
expect_function_call(__wrap_kds_s2000w_client_status_session);
expect_function_call(__wrap_kds_s2000w_client_stop_scan);
handler* h = kds_s2000w_handler_init();
- h->current_scan_status->available_images = 1;
+ h->scan_status->available_images = 1;
sane_kds_s2000w_net_cancel(h);
sane_kds_s2000w_net_cancel(h);
assert_false(h->read_info->cancel);
- assert_false(h->current_scan_status->complete_scanned);
+ assert_false(h->scan_status->complete_scanned);
kds_s2000w_client_response_free(resp_status);
resp_status = NULL;
sane_kds_s2000w_net_cancel(h);
assert_false(h->read_info->cancel);
- assert_false(h->current_scan_status->complete_scanned);
+ assert_false(h->scan_status->complete_scanned);
kds_s2000w_client_response_free(resp_status);
resp_status = NULL;