scan_status current_scan_status;
+void _download_current_image()
+{
+ if (image.size > 0) {
+ free(image.data);
+ image.data = NULL;
+ image.size = 0;
+ }
+ resp = kds_s2000w_client_response_init();
+ kds_s2000w_client_get_image(state->sessionid, current_scan_status.current_image_number, resp);
+ image.size = resp->size;
+ image.data = malloc(sizeof(char) * resp->size);
+ memcpy(image.data, resp->data, resp->size);
+ kds_s2000w_client_response_free(resp);
+ resp = NULL;
+ current_scan_status.downloaded_images++;
+ sleep(1);
+}
+
void _get_current_scan_status()
{
json_object* status_resp_obj = NULL;
return mdata;
}
- if (image.size > 0) {
- free(image.data);
- image.data = NULL;
- image.size = 0;
- }
- resp = kds_s2000w_client_response_init();
- kds_s2000w_client_get_image(state->sessionid, current_scan_status.current_image_number, resp);
- image.size = resp->size;
- image.data = malloc(sizeof(char) * resp->size);
- memcpy(image.data, resp->data, resp->size);
- kds_s2000w_client_response_free(resp);
- resp = NULL;
- current_scan_status.downloaded_images++;
- sleep(1);
+ _download_current_image();
printf("current available images: %i\n", current_scan_status.available_images);
printf("current downloaded images: %i\n", current_scan_status.downloaded_images);