添加调试信息输出协议;图像头信息增加图像处理是否为最后一个步骤标志
This commit is contained in:
parent
1443eb9445
commit
e224747d6e
|
@ -51,11 +51,6 @@ scanner_hw::~scanner_hw()
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
int scanner_hw::empty_printf(const char* fmt, ...)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void scanner_hw::init(void)
|
void scanner_hw::init(void)
|
||||||
{
|
{
|
||||||
std::string text("");
|
std::string text("");
|
||||||
|
@ -284,11 +279,8 @@ void scanner_hw::init(void)
|
||||||
|
|
||||||
};
|
};
|
||||||
OPT_HANDLER(papertm)
|
OPT_HANDLER(papertm)
|
||||||
{
|
{
|
||||||
if(*(bool*)value)
|
log_debug_info_ = *(bool*)value;
|
||||||
dbg_print_ = printf;
|
|
||||||
else
|
|
||||||
dbg_print_ = &scanner_hw::empty_printf;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
opt_handler_[SANE_OPT_NAME(IS_CHECK_STAPLE)] = staple;
|
opt_handler_[SANE_OPT_NAME(IS_CHECK_STAPLE)] = staple;
|
||||||
|
@ -486,7 +478,7 @@ void scanner_hw::thread_image_capture(bool paper_ready)
|
||||||
}
|
}
|
||||||
|
|
||||||
scanning_ = false;
|
scanning_ = false;
|
||||||
img_callback((dyn_mem_ptr)WORKER_STATUS_IDLE, false, (LPPACKIMAGE)err);
|
img_callback((dyn_mem_ptr)WORKER_STATUS_IDLE, CIS_CB_SCAN_OVER, (LPPACKIMAGE)err);
|
||||||
}
|
}
|
||||||
int scanner_hw::start_and_wait_lifter(int to_ms, int* ui_words_id)
|
int scanner_hw::start_and_wait_lifter(int to_ms, int* ui_words_id)
|
||||||
{
|
{
|
||||||
|
@ -510,10 +502,13 @@ int scanner_hw::start_and_wait_lifter(int to_ms, int* ui_words_id)
|
||||||
}
|
}
|
||||||
int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_cnt, int* ui_words, bool* mbstopped)
|
int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_cnt, int* ui_words, bool* mbstopped)
|
||||||
{
|
{
|
||||||
int ret = SCANNER_ERR_OK, minh = 210 * dpi_y_ / 25.4,
|
int ret = SCANNER_ERR_OK, minh = 210 * dpi_y_ / MM_PER_INCH,
|
||||||
words = 0;
|
words = 0;
|
||||||
|
bool resok = true;
|
||||||
uint32_t pass = 0;
|
uint32_t pass = 0;
|
||||||
|
uint64_t bgn = chronograph::from_process_born();
|
||||||
chronograph watch;
|
chronograph watch;
|
||||||
|
std::string loginfo("");
|
||||||
std::pair<int, int> mbev;
|
std::pair<int, int> mbev;
|
||||||
dyn_mem_shared_ptr mem = nullptr;
|
dyn_mem_shared_ptr mem = nullptr;
|
||||||
std::function<IMAGE_HANDLER_PROTO> img_callback(img_handler_);
|
std::function<IMAGE_HANDLER_PROTO> img_callback(img_handler_);
|
||||||
|
@ -532,26 +527,6 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
img->life = chronograph::from_process_born();
|
img->life = chronograph::from_process_born();
|
||||||
while(scanning_)
|
while(scanning_)
|
||||||
{
|
{
|
||||||
bool resok = true;
|
|
||||||
uint64_t bgn = chronograph::from_process_born();
|
|
||||||
uint32_t oper_index = 0;
|
|
||||||
#ifdef REBUILD_IN_CIS_THREAD
|
|
||||||
if(mem)
|
|
||||||
{
|
|
||||||
img_callback(mem, true, img);
|
|
||||||
dbg_print_("\n\t%d: to rebuild spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
|
||||||
mem->release();
|
|
||||||
mem = nullptr;
|
|
||||||
retrieve_v4l2_mem(cism, cism_cnt);
|
|
||||||
|
|
||||||
resok = res_(TASK_CAPTURER, false, 0);
|
|
||||||
dbg_print_("\t%d: to check resource spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
resok = res_(TASK_CAPTURER, false, 0);
|
|
||||||
dbg_print_("\t%d: to check resource spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int fatal = 0;
|
int fatal = 0;
|
||||||
ret = SCANNER_ERR_DEVICE_HD_002;
|
ret = SCANNER_ERR_DEVICE_HD_002;
|
||||||
words = ID_WORDS_STATUS_DEVICE_HD_002;
|
words = ID_WORDS_STATUS_DEVICE_HD_002;
|
||||||
|
@ -577,7 +552,7 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
ret = SCANNER_ERR_OK;
|
ret = SCANNER_ERR_OK;
|
||||||
words = 0;
|
words = 0;
|
||||||
}
|
}
|
||||||
dbg_print_("\t%d: to wait paper-out spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
dbg_print_(loginfo, img->pos.paper_ind + 1, "paperout", chronograph::from_process_born() - bgn, false);
|
||||||
|
|
||||||
pass = watch.elapse_ms();
|
pass = watch.elapse_ms();
|
||||||
img->pos.paper_ind++;
|
img->pos.paper_ind++;
|
||||||
|
@ -585,13 +560,13 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
if(!count_mode_)
|
if(!count_mode_)
|
||||||
{
|
{
|
||||||
img->height = get_image_real_height(minh);
|
img->height = get_image_real_height(minh);
|
||||||
dbg_print_("\t%d: to get_image_real_height spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
dbg_print_(loginfo, img->pos.paper_ind, "getheight", chronograph::from_process_born() - bgn, false);
|
||||||
|
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
int ind = -1;
|
int ind = -1;
|
||||||
void* frame = camera_->read_frame(to_stream_, size, ind);
|
void* frame = camera_->read_frame(to_stream_, size, ind);
|
||||||
|
|
||||||
dbg_print_("\t%d: to read_frame spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
dbg_print_(loginfo, img->pos.paper_ind, "rdframe", chronograph::from_process_born() - bgn, false);
|
||||||
if(!frame)
|
if(!frame)
|
||||||
{
|
{
|
||||||
if(fatal != MOTOR_BORD_EVENT_SCAN_DONE)
|
if(fatal != MOTOR_BORD_EVENT_SCAN_DONE)
|
||||||
|
@ -609,30 +584,13 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
mem->set_param(cism, 0);
|
mem->set_param(cism, 0);
|
||||||
mem->set_param((void*)(long)ind, 1);
|
mem->set_param((void*)(long)ind, 1);
|
||||||
img->pos.status = hg_err_2_image_status(ret);
|
img->pos.status = hg_err_2_image_status(ret);
|
||||||
dbg_print_("\t%d: to construct dyn_mem_shared spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
dbg_print_(loginfo, img->pos.paper_ind, "genimgobj", chronograph::from_process_born() - bgn, false);
|
||||||
#ifndef REBUILD_IN_CIS_THREAD
|
|
||||||
img_handler_(mem, true, img); // (frame, ind, LPPACKIMAGE, cism, ret, pass, bool)
|
|
||||||
mem->release();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(!scan_cntless_ && img->pos.paper_ind == scan_count_)
|
if(!scan_cntless_ && img->pos.paper_ind == scan_count_)
|
||||||
{
|
{
|
||||||
utils::to_log(LOG_LEVEL_ALL, "Scanning finished for given count %d!\n", scan_count_);
|
utils::to_log(LOG_LEVEL_ALL, "Scanning finished for given count %d!\n", scan_count_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef REBUILD_IN_CIS_THREAD
|
|
||||||
// retrieve V4L2 memory ...
|
|
||||||
retrieve_v4l2_mem(cism, cism_cnt);
|
|
||||||
dbg_print_("\t%d: to retrieve_v4l2_mem spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
|
||||||
if(cism_cnt[0] >= camera_->get_mem_count())
|
|
||||||
{
|
|
||||||
ret = SCANNER_ERR_DEVICE_CIS_OUT_OF_MEM;
|
|
||||||
words = ID_WORDS_STATUS_CIS_OUT_OF_MEM;
|
|
||||||
utils::to_log(LOG_LEVEL_FATAL, "Scanning stopped for that V4L2 is out of memory!\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -642,17 +600,34 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
if(ret || fatal == MOTOR_BORD_EVENT_SCAN_DONE)
|
if(ret || fatal == MOTOR_BORD_EVENT_SCAN_DONE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// resource checking ...
|
|
||||||
if(!resok)
|
|
||||||
resok = res_(TASK_CAPTURER, true, SEC_2_MS(10));
|
|
||||||
if(resok && scanning_)
|
if(resok && scanning_)
|
||||||
{
|
{
|
||||||
dbg_print_("\t%d: to flow completed spend %ums.\n", ++oper_index, chronograph::from_process_born() - bgn);
|
dbg_print_(loginfo, img->pos.paper_ind, "final", chronograph::from_process_born() - bgn, true);
|
||||||
|
#ifndef REBUILD_IN_CIS_THREAD
|
||||||
|
if(cism_cnt[0] >= camera_->get_mem_count())
|
||||||
|
{
|
||||||
|
ret = SCANNER_ERR_DEVICE_CIS_OUT_OF_MEM;
|
||||||
|
words = ID_WORDS_STATUS_CIS_OUT_OF_MEM;
|
||||||
|
utils::to_log(LOG_LEVEL_FATAL, "Scanning stopped for that V4L2 is out of memory!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// should check paper ready ?
|
// should check paper ready ?
|
||||||
watch.reset();
|
watch.reset();
|
||||||
|
bgn = img->life = chronograph::from_process_born();
|
||||||
motor_->pick_paper();
|
motor_->pick_paper();
|
||||||
img->life = chronograph::from_process_born();
|
|
||||||
|
img_callback(mem, CIS_CB_IMAGE, img);
|
||||||
|
dbg_print_(loginfo, img->pos.paper_ind + 1, "rebuild", chronograph::from_process_born() - bgn, false);
|
||||||
|
mem->release();
|
||||||
|
mem = nullptr;
|
||||||
|
|
||||||
|
retrieve_v4l2_mem(cism, cism_cnt);
|
||||||
|
dbg_print_(loginfo, img->pos.paper_ind + 1, "retrieve_v4l2_mem", chronograph::from_process_born() - bgn, false);
|
||||||
|
|
||||||
|
resok = res_(TASK_CAPTURER, false, 0);
|
||||||
|
dbg_print_(loginfo, img->pos.paper_ind + 1, "chkrsc", chronograph::from_process_born() - bgn, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -665,14 +640,12 @@ int scanner_hw::scan_one_turn(LPPACKIMAGE img, safe_fifo<int>* cism, int* cism_c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef REBUILD_IN_CIS_THREAD
|
|
||||||
if(mem)
|
if(mem)
|
||||||
{
|
{
|
||||||
img_callback(mem, true, img);
|
img_callback(mem, CIS_CB_IMAGE, img);
|
||||||
mem->release();
|
mem->release();
|
||||||
mem = nullptr;
|
mem = nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if(ui_words)
|
if(ui_words)
|
||||||
*ui_words = words;
|
*ui_words = words;
|
||||||
|
@ -1044,6 +1017,39 @@ int scanner_hw::open(std::function<IMAGE_HANDLER_PROTO> image_handler, CHK_RES_F
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto empty_log = [this](LOG_CIS_TIME_PROTO) -> void
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
auto real_log = [this](LOG_CIS_TIME_PROTO) -> void
|
||||||
|
{
|
||||||
|
if(log.empty())
|
||||||
|
log = "Paper " + std::to_string(paper) + " - ";
|
||||||
|
else
|
||||||
|
log += " -> ";
|
||||||
|
log += std::to_string(ms) + "ms(" + step + ")";
|
||||||
|
|
||||||
|
if(last)
|
||||||
|
{
|
||||||
|
size_t len = sizeof(PACK_BASE) + log.length() + 1;
|
||||||
|
dyn_mem_ptr ptr = dyn_mem::memory(len);
|
||||||
|
LPPACK_BASE pck = (LPPACK_BASE)ptr->ptr();
|
||||||
|
|
||||||
|
BASE_PACKET_REPLY(*pck, PACK_CMD_DEBUG_INFO, 0, 0);
|
||||||
|
strcpy(pck->payload, log.c_str());
|
||||||
|
pck->payload[log.length()] = 0;
|
||||||
|
pck->payload_len = log.length() + 1;
|
||||||
|
ptr->set_len(len);
|
||||||
|
img_handler_(ptr, CIS_CB_STATUS, nullptr);
|
||||||
|
ptr->release();
|
||||||
|
log = "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(log_debug_info_)
|
||||||
|
dbg_print_ = real_log;
|
||||||
|
else
|
||||||
|
dbg_print_ = empty_log;
|
||||||
|
|
||||||
return SCANNER_ERR_OK;
|
return SCANNER_ERR_OK;
|
||||||
}
|
}
|
||||||
int scanner_hw::start_scan(void)
|
int scanner_hw::start_scan(void)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
//
|
//
|
||||||
// dyn_mem_ptr: image data buffer, or be uint32_t if bool was false
|
// dyn_mem_ptr: image data buffer, or be uint32_t if bool was false
|
||||||
//
|
//
|
||||||
// bool: true - image, dyn_mem_ptr is image data buffer; false - dyn_mem_ptr is an uint32_t code of hardware event
|
// type: see cis_cb_type
|
||||||
//
|
//
|
||||||
// LPPACKIMAGE: image information, or uint32_t event data when bool is false
|
// LPPACKIMAGE: image information, or uint32_t event data when bool is false
|
||||||
//
|
//
|
||||||
|
@ -25,7 +25,8 @@
|
||||||
// real channels(color mode) should judge by
|
// real channels(color mode) should judge by
|
||||||
//
|
//
|
||||||
// LPPACKIMAGE->width / 2 sides / cis::get_line_stream_length(LPPACKIMAGE->resolution_x, false)
|
// LPPACKIMAGE->width / 2 sides / cis::get_line_stream_length(LPPACKIMAGE->resolution_x, false)
|
||||||
#define IMAGE_HANDLER_PROTO void(dyn_mem_ptr, bool, LPPACKIMAGE)
|
#define IMAGE_HANDLER_PROTO void(CIS_IMAGE_PROTO)
|
||||||
|
#define LOG_CIS_TIME_PROTO std::string& log, int paper, const char* step, uint32_t ms, bool last
|
||||||
|
|
||||||
#include "./cis/cis_param.h"
|
#include "./cis/cis_param.h"
|
||||||
class GVideoISP1;
|
class GVideoISP1;
|
||||||
|
@ -98,8 +99,8 @@ class scanner_hw : public sane_opt_provider
|
||||||
int to_paper_out_ = 5000; // timeout in ms of paper passed
|
int to_paper_out_ = 5000; // timeout in ms of paper passed
|
||||||
int to_stream_ = 5000; // timeout in ms of frame data can be read
|
int to_stream_ = 5000; // timeout in ms of frame data can be read
|
||||||
|
|
||||||
static int empty_printf(const char* fmt, ...);
|
bool log_debug_info_ = false;
|
||||||
int (*dbg_print_)(const char* fmt, ...) = &scanner_hw::empty_printf;
|
std::function<void(LOG_CIS_TIME_PROTO)> dbg_print_;
|
||||||
|
|
||||||
void init(void);
|
void init(void);
|
||||||
void init_version(std::string& text);
|
void init_version(std::string& text);
|
||||||
|
|
|
@ -143,6 +143,7 @@ void imgproc_mgr::send_image(LPPAGEDPARAM obj, LPPACKIMAGE head, cv::Mat& mat, v
|
||||||
h.prc_stage = head->prc_stage;
|
h.prc_stage = head->prc_stage;
|
||||||
h.prc_time = head->prc_time;
|
h.prc_time = head->prc_time;
|
||||||
}
|
}
|
||||||
|
h.prc_last = last;
|
||||||
|
|
||||||
#ifdef USE_THREAD_PAGED_DATA
|
#ifdef USE_THREAD_PAGED_DATA
|
||||||
ptr = new image_packet(&h, compd, obj->mean.scan_id, info, info_l);
|
ptr = new image_packet(&h, compd, obj->mean.scan_id, info, info_l);
|
||||||
|
@ -542,28 +543,28 @@ int imgproc_mgr::clear(void)
|
||||||
static uint64_t rebuild_cis = 0;
|
static uint64_t rebuild_cis = 0;
|
||||||
static uint32_t scan_count = 0;
|
static uint32_t scan_count = 0;
|
||||||
|
|
||||||
int imgproc_mgr::process(LPPACKIMAGE info, dyn_mem_ptr data, bool img)
|
int imgproc_mgr::process(CIS_IMAGE_PROTO)
|
||||||
{
|
{
|
||||||
RAWIMG ri;
|
RAWIMG ri;
|
||||||
int ret = SCANNER_ERR_OK;
|
int ret = SCANNER_ERR_OK;
|
||||||
int ind = put_ind_ % working_cnt_;
|
int ind = put_ind_ % working_cnt_;
|
||||||
|
|
||||||
#ifdef REBUILD_IN_CIS_THREAD
|
#ifdef REBUILD_IN_CIS_THREAD
|
||||||
if(img)
|
if(type == CIS_CB_IMAGE)
|
||||||
{
|
{
|
||||||
LPPAGEDPARAM paged = nullptr;
|
LPPAGEDPARAM paged = nullptr;
|
||||||
#ifdef USE_THREAD_PAGED_DATA
|
#ifdef USE_THREAD_PAGED_DATA
|
||||||
paged = params_[0];
|
paged = params_[ind];
|
||||||
#endif
|
#endif
|
||||||
if(dump_img_)
|
if(dump_img_)
|
||||||
{
|
{
|
||||||
cv::Mat mat(info->width, info->height, CV_8UC1, data->ptr());
|
cv::Mat mat(lpinfo->width, lpinfo->height, CV_8UC1, data->ptr());
|
||||||
send_image(paged, info, mat, nullptr, 0, false);
|
send_image(paged, lpinfo, mat, nullptr, 0, false);
|
||||||
}
|
}
|
||||||
if(first_->is_enable())
|
if(first_->is_enable())
|
||||||
{
|
{
|
||||||
chronograph watch;
|
chronograph watch;
|
||||||
first_->do_rebuild(info, data->ptr(), ri.imgs);
|
first_->do_rebuild(lpinfo, data->ptr(), ri.imgs);
|
||||||
rebuild_cis += ri.imgs[0].info.prc_time;
|
rebuild_cis += ri.imgs[0].info.prc_time;
|
||||||
scan_count++;
|
scan_count++;
|
||||||
if(dump_img_)
|
if(dump_img_)
|
||||||
|
@ -572,15 +573,15 @@ int imgproc_mgr::process(LPPACKIMAGE info, dyn_mem_ptr data, bool img)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PROCIMGINFO i;
|
PROCIMGINFO i;
|
||||||
i.info = *info;
|
i.info = *lpinfo;
|
||||||
i.img = cv::Mat(info->width, info->height, CV_8UC1, data->ptr());
|
i.img = cv::Mat(lpinfo->width, lpinfo->height, CV_8UC1, data->ptr());
|
||||||
ri.imgs.push_back(i);
|
ri.imgs.push_back(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if(type == CIS_CB_SCAN_OVER)
|
||||||
{
|
{
|
||||||
PROCIMGINFO i;
|
PROCIMGINFO i;
|
||||||
i.info.data_size = (uint32_t)(long)info;
|
i.info.data_size = (uint32_t)(long)lpinfo;
|
||||||
ri.imgs.push_back(i);
|
ri.imgs.push_back(i);
|
||||||
if(scan_count)
|
if(scan_count)
|
||||||
{
|
{
|
||||||
|
@ -590,15 +591,25 @@ int imgproc_mgr::process(LPPACKIMAGE info, dyn_mem_ptr data, bool img)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ri.data = data;
|
ri.data = data;
|
||||||
if(img)
|
if(type == CIS_CB_IMAGE)
|
||||||
|
{
|
||||||
data->add_ref();
|
data->add_ref();
|
||||||
if(img)
|
ri.info = *lpinfo;
|
||||||
ri.info = *info;
|
}
|
||||||
else
|
else if(type == CIS_CB_SCAN_OVER)
|
||||||
ri.info.data_size = (uint32_t)(long)info;
|
{
|
||||||
|
ri.info.data_size = (uint32_t)(long)lpinfo;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else if(type == CIS_CB_STATUS)
|
||||||
|
{
|
||||||
|
data->set_session_id(session_id_);
|
||||||
|
img_sender_(data, sender_param_);
|
||||||
|
|
||||||
ri.img = img;
|
return SCANNER_ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ri.img = type == CIS_CB_IMAGE;
|
||||||
#ifdef USE_THREAD_PAGED_DATA
|
#ifdef USE_THREAD_PAGED_DATA
|
||||||
params_[ind]->mean.que->save(ri, true);
|
params_[ind]->mean.que->save(ri, true);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -132,7 +132,7 @@ public:
|
||||||
public:
|
public:
|
||||||
int load_processor(const char* path); // outer-modules path
|
int load_processor(const char* path); // outer-modules path
|
||||||
int clear(void);
|
int clear(void);
|
||||||
int process(LPPACKIMAGE info, dyn_mem_ptr data, bool img);
|
int process(CIS_IMAGE_PROTO);
|
||||||
|
|
||||||
// life
|
// life
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -282,15 +282,15 @@ void async_scanner::init(void)
|
||||||
}
|
}
|
||||||
else if(devui::UI_CMD_COUNT_PAPER == pack->msg)
|
else if(devui::UI_CMD_COUNT_PAPER == pack->msg)
|
||||||
{
|
{
|
||||||
auto receiver = [this](dyn_mem_ptr data, bool img, LPPACKIMAGE lpinfo) -> void
|
auto receiver = [this](CIS_IMAGE_PROTO) -> void
|
||||||
{
|
{
|
||||||
img_prcr_->process(lpinfo, data, img);
|
img_prcr_->process(data, type, lpinfo);
|
||||||
};
|
};
|
||||||
bool auto_scan = true;
|
bool auto_scan = true;
|
||||||
std::string prev(cfg_mgr_->get_option_value(SANE_OPT_NAME(WAIT_TO_SCAN), SANE_ACTION_GET_VALUE));
|
std::string prev(cfg_mgr_->get_option_value(SANE_OPT_NAME(WAIT_TO_SCAN), SANE_ACTION_GET_VALUE));
|
||||||
cis_->set_value(SANE_OPT_NAME(WAIT_TO_SCAN), &auto_scan);
|
cis_->set_value(SANE_OPT_NAME(WAIT_TO_SCAN), &auto_scan);
|
||||||
cis_->open(receiver, CHK_RES_FUNC(), nullptr, true);
|
cis_->open(receiver, CHK_RES_FUNC(), nullptr, true);
|
||||||
cis_->start_scan();
|
cis_->start_scan();
|
||||||
}
|
}
|
||||||
else if(devui::UI_CMD_STOP_SCAN == pack->msg)
|
else if(devui::UI_CMD_STOP_SCAN == pack->msg)
|
||||||
{
|
{
|
||||||
|
@ -693,9 +693,9 @@ dyn_mem_ptr async_scanner::handle_scan_start(LPPACK_BASE pack, uint32_t* used, p
|
||||||
scan_err_ = 0;
|
scan_err_ = 0;
|
||||||
reply_start_ = false;
|
reply_start_ = false;
|
||||||
|
|
||||||
auto receiver = [this](dyn_mem_ptr data, bool img, LPPACKIMAGE lpinfo) -> void
|
auto receiver = [this](CIS_IMAGE_PROTO) -> void
|
||||||
{
|
{
|
||||||
img_prcr_->process(lpinfo, data, img);
|
img_prcr_->process(data, type, lpinfo);
|
||||||
};
|
};
|
||||||
DECL_CHK_RES_FUNC(this, res)
|
DECL_CHK_RES_FUNC(this, res)
|
||||||
{
|
{
|
||||||
|
|
|
@ -409,3 +409,11 @@ public:
|
||||||
|
|
||||||
#define SENDER_PROTO data_source_ptr ptr, void* param
|
#define SENDER_PROTO data_source_ptr ptr, void* param
|
||||||
#define RES_CHK_PROTO int type, bool wait, int to_ms, void* param
|
#define RES_CHK_PROTO int type, bool wait, int to_ms, void* param
|
||||||
|
|
||||||
|
enum cis_cb_type
|
||||||
|
{
|
||||||
|
CIS_CB_STATUS = 0, // data is status text string
|
||||||
|
CIS_CB_IMAGE, // data is image, dyn_mem_ptr is image data buffer
|
||||||
|
CIS_CB_SCAN_OVER, // dyn_mem_ptr is an uint32_t code of hardware event
|
||||||
|
};
|
||||||
|
#define CIS_IMAGE_PROTO dyn_mem_ptr data, int type, LPPACKIMAGE lpinfo
|
|
@ -112,6 +112,7 @@ enum packet_cmd
|
||||||
PAIR_COMMAND(PACK_CMD_SCAN_START), // start scanning, [in]: PACK_BASE, [out]: PACK_BASE
|
PAIR_COMMAND(PACK_CMD_SCAN_START), // start scanning, [in]: PACK_BASE, [out]: PACK_BASE
|
||||||
PAIR_COMMAND(PACK_CMD_SCAN_IMG), // device -> host, PACK_BASE::payload - LPPACKIMAGE
|
PAIR_COMMAND(PACK_CMD_SCAN_IMG), // device -> host, PACK_BASE::payload - LPPACKIMAGE
|
||||||
PAIR_COMMAND(PACK_CMD_SCAN_PAPER), // device -> host, ONE paper has passed through the CIS. PACK_BASE::data - index of this paper
|
PAIR_COMMAND(PACK_CMD_SCAN_PAPER), // device -> host, ONE paper has passed through the CIS. PACK_BASE::data - index of this paper
|
||||||
|
PACK_CMD_DEBUG_INFO, // device -> host, PACK_BASE::data is (char*)debug-info-text
|
||||||
PACK_CMD_SCAN_FINISHED_ROGER, // device -> host, PACK_BASE::data is scanner_status
|
PACK_CMD_SCAN_FINISHED_ROGER, // device -> host, PACK_BASE::data is scanner_status
|
||||||
PAIR_COMMAND(PACK_CMD_SCAN_STOP), // stop scanning, [in]: PACK_BASE, [out]: PACK_BASE
|
PAIR_COMMAND(PACK_CMD_SCAN_STOP), // stop scanning, [in]: PACK_BASE, [out]: PACK_BASE
|
||||||
//PAIR_COMMAND(PACK_CMD_SCAN_IMAGE_REQ), // get image request, [in]: PACK_BASE, [out] PACK_BASE on error, or PACK_BASE::payload - LPPACKIMAGE
|
//PAIR_COMMAND(PACK_CMD_SCAN_IMAGE_REQ), // get image request, [in]: PACK_BASE, [out] PACK_BASE on error, or PACK_BASE::payload - LPPACKIMAGE
|
||||||
|
@ -321,7 +322,8 @@ typedef struct _pack_img
|
||||||
uint32_t bpp : 6; // bits per pixel. (image-collector set)
|
uint32_t bpp : 6; // bits per pixel. (image-collector set)
|
||||||
uint32_t bppc : 6; // bits per pixel in this channel, equal to 'bpp' if pos.channel_ind == 0x0f. (image-collector set)
|
uint32_t bppc : 6; // bits per pixel in this channel, equal to 'bpp' if pos.channel_ind == 0x0f. (image-collector set)
|
||||||
uint32_t compression : 6; // image data compression, see 'img_compression'. (image-collector set)
|
uint32_t compression : 6; // image data compression, see 'img_compression'. (image-collector set)
|
||||||
uint32_t reserved : 2; //
|
uint32_t reserved : 1; //
|
||||||
|
uint32_t prc_last : 1; // whether the last image processor
|
||||||
uint32_t prc_stage : 14; // position of image processor, 0 is raw from CIS directly
|
uint32_t prc_stage : 14; // position of image processor, 0 is raw from CIS directly
|
||||||
uint32_t prc_time : 18; // spent time in milliseconds of image-process prc_stage
|
uint32_t prc_time : 18; // spent time in milliseconds of image-process prc_stage
|
||||||
uint32_t info_size; // image information size in bytes, information part is used for quality of JPEG, pallete of BMP .... (image-collector set)
|
uint32_t info_size; // image information size in bytes, information part is used for quality of JPEG, pallete of BMP .... (image-collector set)
|
||||||
|
|
Loading…
Reference in New Issue