校正数据文件中UTF8字符转WEB-UTF格式;增加清理纸道功能;添加异常类
This commit is contained in:
parent
19e006a132
commit
ef6c6a0186
|
@ -195,7 +195,7 @@ namespace correct
|
||||||
else
|
else
|
||||||
return l.clr > r.clr;
|
return l.clr > r.clr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CORDATA> load_old_correct_data(const char* file, std::vector<int>* dpis = nullptr)
|
std::vector<CORDATA> load_old_correct_data(const char* file, std::vector<int>* dpis = nullptr)
|
||||||
{
|
{
|
||||||
std::vector<CORDATA> old;
|
std::vector<CORDATA> old;
|
||||||
|
@ -276,12 +276,23 @@ namespace correct
|
||||||
|
|
||||||
return std::move(old);
|
return std::move(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
int save_correct_data(CORDATA& data, std::vector<int>& fixed_dpi, int init_dpi, bool init_clr)
|
int save_correct_data(CORDATA& data, std::vector<int>& fixed_dpi, int init_dpi, bool init_clr)
|
||||||
{
|
{
|
||||||
correct::CONDDATA def;
|
correct::CONDDATA def;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
std::string root(CIS_CORRECT_DATA_PATH), cont("");
|
std::string root(CIS_CORRECT_DATA_PATH), cont(""),
|
||||||
|
clr(""), gray("");
|
||||||
gb_json *init = new gb_json();
|
gb_json *init = new gb_json();
|
||||||
|
uint8_t *utf8 = (uint8_t*)WORDS_COLOR_COLOR;
|
||||||
|
|
||||||
|
err = utils::utf8_2_web(utf8, clr);
|
||||||
|
if(err)
|
||||||
|
clr = WORDS_COLOR_COLOR;
|
||||||
|
utf8 = (uint8_t*)WORDS_COLOR_GRAY;
|
||||||
|
err = utils::utf8_2_web(utf8, gray);
|
||||||
|
if(err)
|
||||||
|
gray = WORDS_COLOR_GRAY;
|
||||||
|
|
||||||
for(auto& item: data.data)
|
for(auto& item: data.data)
|
||||||
{
|
{
|
||||||
|
@ -293,9 +304,9 @@ namespace correct
|
||||||
|
|
||||||
key += "==";
|
key += "==";
|
||||||
if(item.clr)
|
if(item.clr)
|
||||||
key += WORDS_COLOR_COLOR;
|
key += clr;
|
||||||
else
|
else
|
||||||
key += WORDS_COLOR_GRAY;
|
key += gray;
|
||||||
key += "&&";
|
key += "&&";
|
||||||
if(fixed_dpi.size())
|
if(fixed_dpi.size())
|
||||||
{
|
{
|
||||||
|
@ -446,11 +457,11 @@ namespace cis
|
||||||
child->get_value("default", def);
|
child->get_value("default", def);
|
||||||
if(def)
|
if(def)
|
||||||
{
|
{
|
||||||
printf("Before: %s\n", child->to_string().c_str());
|
utils::to_log(LOG_LEVEL_ALL, "Correction-data of '%s' Before: %s\n", v, child->to_string().c_str());
|
||||||
def->attach_text(&data[0]);
|
def->attach_text(&data[0]);
|
||||||
def->key() = "default";
|
def->key() = "default";
|
||||||
def->release();
|
def->release();
|
||||||
printf("After: %s\n", child->to_string().c_str());
|
utils::to_log(LOG_LEVEL_ALL, "Correction-data of '%s' After: %s\n", v, child->to_string().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
child->release();
|
child->release();
|
||||||
|
@ -474,9 +485,11 @@ namespace cis
|
||||||
child->get_value("default", def);
|
child->get_value("default", def);
|
||||||
if(def)
|
if(def)
|
||||||
{
|
{
|
||||||
|
utils::to_log(LOG_LEVEL_ALL, "Correction-data of '%s' Before: %s\n", fn.c_str(), child->to_string().c_str());
|
||||||
def->attach_text(&data[0]);
|
def->attach_text(&data[0]);
|
||||||
def->key() = "default";
|
def->key() = "default";
|
||||||
def->release();
|
def->release();
|
||||||
|
utils::to_log(LOG_LEVEL_ALL, "Correction-data of '%s' After: %s\n", fn.c_str(), child->to_string().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
child->release();
|
child->release();
|
||||||
|
|
|
@ -1045,3 +1045,18 @@ bool scanner_hw::is_scanning(void)
|
||||||
{
|
{
|
||||||
return scanning_;
|
return scanning_;
|
||||||
}
|
}
|
||||||
|
void scanner_hw::clean_paper_passway(void)
|
||||||
|
{
|
||||||
|
if(!motor_.get())
|
||||||
|
{
|
||||||
|
auto cb = [this](int ev, unsigned int data) -> void
|
||||||
|
{
|
||||||
|
mb_events_.save(std::make_pair(ev, data), true);
|
||||||
|
};
|
||||||
|
mb_events_.clear();
|
||||||
|
motor_.reset(new MotorBoard(cb));
|
||||||
|
}
|
||||||
|
|
||||||
|
motor_->clean_paper_road();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,4 +127,5 @@ public:
|
||||||
int trans_motorboard_err_2_hg_error(int mberr, bool to_ui = false, std::function<void(int)> bef_ui = std::function<void(int)>());
|
int trans_motorboard_err_2_hg_error(int mberr, bool to_ui = false, std::function<void(int)> bef_ui = std::function<void(int)>());
|
||||||
int hg_err_2_image_status(int hgerr);
|
int hg_err_2_image_status(int hgerr);
|
||||||
bool is_scanning(void);
|
bool is_scanning(void);
|
||||||
|
void clean_paper_passway(void);
|
||||||
};
|
};
|
||||||
|
|
|
@ -147,10 +147,10 @@ void imgproc_mgr::process(RAWIMG* img)
|
||||||
|
|
||||||
for(auto& v: processors_)
|
for(auto& v: processors_)
|
||||||
{
|
{
|
||||||
send_image(*src, false);
|
send_image(*src, false);
|
||||||
if(v->is_enable())
|
if(v->is_enable())
|
||||||
{
|
{
|
||||||
v->process(*src, *dst);
|
process(v, src, dst);
|
||||||
src->clear();
|
src->clear();
|
||||||
swp = src;
|
swp = src;
|
||||||
src = dst;
|
src = dst;
|
||||||
|
@ -165,7 +165,7 @@ void imgproc_mgr::process(RAWIMG* img)
|
||||||
{
|
{
|
||||||
if(v->is_enable())
|
if(v->is_enable())
|
||||||
{
|
{
|
||||||
v->process(*src, *dst);
|
process(v, src, dst);
|
||||||
src->clear();
|
src->clear();
|
||||||
swp = src;
|
swp = src;
|
||||||
src = dst;
|
src = dst;
|
||||||
|
@ -196,6 +196,25 @@ void imgproc_mgr::process(RAWIMG* img)
|
||||||
ptr->release();
|
ptr->release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void imgproc_mgr::process(image_processor* prc, std::vector<PROCIMGINFO>* in, std::vector<PROCIMGINFO>* out)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
prc->process(*in, *out);
|
||||||
|
}
|
||||||
|
catch(const exception_ex& e)
|
||||||
|
{
|
||||||
|
std::string msg(std::string("image process '") + prc->from() + "': " + e.what());
|
||||||
|
|
||||||
|
throw(exception_ex(msg.c_str()));
|
||||||
|
}
|
||||||
|
catch(const std::exception& e)
|
||||||
|
{
|
||||||
|
std::string msg(std::string("image process '") + prc->from() + "': " + e.what());
|
||||||
|
|
||||||
|
throw(exception_ex(msg.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
void imgproc_mgr::send_image(LPPACKIMAGE head, uint8_t* data, size_t size, void* info, size_t info_l)
|
void imgproc_mgr::send_image(LPPACKIMAGE head, uint8_t* data, size_t size, void* info, size_t info_l)
|
||||||
{
|
{
|
||||||
auto ovr = [&](uint64_t total, uint64_t cur_size, uint32_t err, void* user_data) -> int
|
auto ovr = [&](uint64_t total, uint64_t cur_size, uint32_t err, void* user_data) -> int
|
||||||
|
|
|
@ -51,6 +51,7 @@ class imgproc_mgr : public sane_opt_provider
|
||||||
uint32_t add_busy_worker(int inc = 1);
|
uint32_t add_busy_worker(int inc = 1);
|
||||||
void thread_worker(void);
|
void thread_worker(void);
|
||||||
void process(RAWIMG* img);
|
void process(RAWIMG* img);
|
||||||
|
void process(image_processor* prc, std::vector<PROCIMGINFO>* in, std::vector<PROCIMGINFO>* out);
|
||||||
void send_image(LPPACKIMAGE head, uint8_t* data, size_t size, void* info = nullptr, size_t info_l = 0);
|
void send_image(LPPACKIMAGE head, uint8_t* data, size_t size, void* info = nullptr, size_t info_l = 0);
|
||||||
void send_image(std::vector<PROCIMGINFO>& imgs, bool clear_after_send);
|
void send_image(std::vector<PROCIMGINFO>& imgs, bool clear_after_send);
|
||||||
|
|
||||||
|
|
|
@ -303,6 +303,10 @@ void async_scanner::init(void)
|
||||||
bool auto_scan = false;
|
bool auto_scan = false;
|
||||||
cis_->set_value(SANE_OPT_NAME(WAIT_TO_SCAN), &auto_scan);
|
cis_->set_value(SANE_OPT_NAME(WAIT_TO_SCAN), &auto_scan);
|
||||||
}
|
}
|
||||||
|
else if(devui::UI_CMD_CLEAN_PASSWAY == pack->msg)
|
||||||
|
{
|
||||||
|
cis_->clean_paper_passway();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
devui::init_ui(uicb, false);
|
devui::init_ui(uicb, false);
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace devui
|
||||||
UI_CMD_COUNT_PAPER = 0x10,
|
UI_CMD_COUNT_PAPER = 0x10,
|
||||||
UI_CMD_STOP_SCAN,
|
UI_CMD_STOP_SCAN,
|
||||||
|
|
||||||
|
UI_CMD_CLEAN_PASSWAY = 0x30,
|
||||||
|
|
||||||
UI_STATUS_SCANNING = 0x1000, // begin scanning. data: (LPSCANSTREAM)
|
UI_STATUS_SCANNING = 0x1000, // begin scanning. data: (LPSCANSTREAM)
|
||||||
UI_STATUS_PAPER_CNT, // ONE paper has pass through. data: (uint32_t*)milliseconds for paper pass through
|
UI_STATUS_PAPER_CNT, // ONE paper has pass through. data: (uint32_t*)milliseconds for paper pass through
|
||||||
UI_STATUS_MESSAGE, // status message, hold screen. data: LPSTATMSG
|
UI_STATUS_MESSAGE, // status message, hold screen. data: LPSTATMSG
|
||||||
|
|
|
@ -218,6 +218,7 @@ class log_cls
|
||||||
FILE* file_;
|
FILE* file_;
|
||||||
int level_;
|
int level_;
|
||||||
int type_;
|
int type_;
|
||||||
|
int max_file_size_ = MAX_LOG_FILE_SIZE;
|
||||||
std::mutex lock_;
|
std::mutex lock_;
|
||||||
|
|
||||||
static log_cls* inst_;
|
static log_cls* inst_;
|
||||||
|
@ -256,15 +257,16 @@ class log_cls
|
||||||
static void log_file(const char* info, void* param, void* param2)
|
static void log_file(const char* info, void* param, void* param2)
|
||||||
{
|
{
|
||||||
FILE** file = (FILE**)param;
|
FILE** file = (FILE**)param;
|
||||||
|
log_cls *cls = (log_cls*)param2;
|
||||||
|
|
||||||
if (*file == nullptr)
|
if (*file == nullptr)
|
||||||
*file = create_log_file(((std::string*)param2)->c_str(), false);
|
*file = create_log_file(cls->path_file_.c_str(), false);
|
||||||
|
|
||||||
if (*file)
|
if (*file)
|
||||||
{
|
{
|
||||||
fwrite(info, 1, strlen(info), *file);
|
fwrite(info, 1, strlen(info), *file);
|
||||||
fflush(*file);
|
fflush(*file);
|
||||||
if (ftell(*file) >= MAX_LOG_FILE_SIZE)
|
if (ftell(*file) >= cls->max_file_size_)
|
||||||
{
|
{
|
||||||
fclose(*file);
|
fclose(*file);
|
||||||
remove(((std::string*)param2)->c_str());
|
remove(((std::string*)param2)->c_str());
|
||||||
|
@ -344,6 +346,10 @@ public:
|
||||||
{
|
{
|
||||||
level_ = level;
|
level_ = level;
|
||||||
}
|
}
|
||||||
|
void set_max_file_size(int size)
|
||||||
|
{
|
||||||
|
max_file_size_ = size;
|
||||||
|
}
|
||||||
int level(void)
|
int level(void)
|
||||||
{
|
{
|
||||||
return level_;
|
return level_;
|
||||||
|
@ -357,7 +363,7 @@ public:
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(lock_);
|
std::lock_guard<std::mutex> lock(lock_);
|
||||||
|
|
||||||
log_(info, &file_, &path_file_);
|
log_(info, &file_, this);
|
||||||
}
|
}
|
||||||
std::string get_log_file_path(const char* dst = nullptr)
|
std::string get_log_file_path(const char* dst = nullptr)
|
||||||
{
|
{
|
||||||
|
@ -661,6 +667,74 @@ namespace utils
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
int utf8_2_16(uint8_t* &in, uint16_t& ch)
|
||||||
|
{
|
||||||
|
static uint8_t lead[] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
if(*in < 0x80)
|
||||||
|
{
|
||||||
|
ch = *in++;
|
||||||
|
}
|
||||||
|
else if(*in < 0x0E0)
|
||||||
|
{
|
||||||
|
ch = *in++;
|
||||||
|
ch &= ~0x0C0;
|
||||||
|
if(*in < 0x80)
|
||||||
|
ret = EINVAL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ch <<= 6;
|
||||||
|
ch |= *in++ & 0x3f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(*in < 0x0F0)
|
||||||
|
{
|
||||||
|
ch = *in++;
|
||||||
|
ch &= ~0x0E0;
|
||||||
|
if(*in < 0x80)
|
||||||
|
ret = EINVAL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ch <<= 6;
|
||||||
|
ch |= *in++ & 0x3f;
|
||||||
|
if(*in < 0x80)
|
||||||
|
ret = EINVAL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ch <<= 6;
|
||||||
|
ch |= *in++ & 0x3f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
int utf8_2_web(uint8_t* &in, std::string& web)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
while(*in)
|
||||||
|
{
|
||||||
|
uint16_t v = 0;
|
||||||
|
char buf[40] = {0};
|
||||||
|
|
||||||
|
ret = utf8_2_16(in, v);
|
||||||
|
if(ret)
|
||||||
|
break;
|
||||||
|
if(v < 0x80)
|
||||||
|
buf[0] = v;
|
||||||
|
else
|
||||||
|
sprintf(buf, "\\u%04X", v);
|
||||||
|
web += buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
std::string get_command_result(const char* cmd, int len, int *err)
|
std::string get_command_result(const char* cmd, int len, int *err)
|
||||||
{
|
{
|
||||||
|
@ -1482,6 +1556,10 @@ namespace utils
|
||||||
|
|
||||||
return std::move(file);
|
return std::move(file);
|
||||||
}
|
}
|
||||||
|
void set_log_file_max_size(int size)
|
||||||
|
{
|
||||||
|
log_cls::instance()->set_max_file_size(size);
|
||||||
|
}
|
||||||
void uninit(void)
|
void uninit(void)
|
||||||
{
|
{
|
||||||
log_info(("=====================================--Exited--" + std::to_string(GetCurrentProcessId()) + "=====================================\n\n\n\n").c_str(), LOG_LEVEL_FATAL);
|
log_info(("=====================================--Exited--" + std::to_string(GetCurrentProcessId()) + "=====================================\n\n\n\n").c_str(), LOG_LEVEL_FATAL);
|
||||||
|
@ -1604,6 +1682,26 @@ namespace utils
|
||||||
|
|
||||||
return std::move(std::string((char*)&bfh, sizeof(bfh)));
|
return std::move(std::string((char*)&bfh, sizeof(bfh)));
|
||||||
}
|
}
|
||||||
|
int save_bitmap(const char* file, int w, int h, int bpp, int dpix, int dpiy, void* bits)
|
||||||
|
{
|
||||||
|
int err = 0;
|
||||||
|
FILE* dst = fopen(file, "wb");
|
||||||
|
|
||||||
|
if(dst)
|
||||||
|
{
|
||||||
|
std::string bih(bitmap_info_header(w, h, bpp, dpix, dpiy)),
|
||||||
|
bfh(bitmap_file_header((BITMAPINFOHEADER*)&bih[0]));
|
||||||
|
|
||||||
|
fwrite(bfh.c_str(), 1, bfh.length(), dst);
|
||||||
|
fwrite(bih.c_str(), 1, bih.length(), dst);
|
||||||
|
fwrite(bits, 1, ((BITMAPINFOHEADER*)&bih[0])->biSizeImage, dst);
|
||||||
|
fclose(dst);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
err = errno;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
#if OS_WIN
|
#if OS_WIN
|
||||||
bool run_get_message(HWND hwnd, UINT filter_min, UINT filter_max, std::function<bool(MSG*, bool*)> msghandler)
|
bool run_get_message(HWND hwnd, UINT filter_min, UINT filter_max, std::function<bool(MSG*, bool*)> msghandler)
|
||||||
|
@ -2407,6 +2505,10 @@ void safe_thread::thread_worker(std::function<void(void)> func, std::string name
|
||||||
utils::to_log(LOG_LEVEL_DEBUG, "--- safe_thread of '%s - %p' exited.\n", name.c_str(), GetCurrentThreadId());
|
utils::to_log(LOG_LEVEL_DEBUG, "--- safe_thread of '%s - %p' exited.\n", name.c_str(), GetCurrentThreadId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
catch (exception_ex e)
|
||||||
|
{
|
||||||
|
utils::to_log(LOG_LEVEL_FATAL, "Exception in thread '%p - %s': %s\n", GetCurrentThreadId(), name.c_str(), e.what());
|
||||||
|
}
|
||||||
catch (std::exception e)
|
catch (std::exception e)
|
||||||
{
|
{
|
||||||
utils::to_log(LOG_LEVEL_FATAL, "Exception in thread '%p - %s': %s\n", GetCurrentThreadId(), name.c_str(), e.what());
|
utils::to_log(LOG_LEVEL_FATAL, "Exception in thread '%p - %s': %s\n", GetCurrentThreadId(), name.c_str(), e.what());
|
||||||
|
@ -2658,3 +2760,24 @@ int safe_file::save(const void* data, uint16_t bytes)
|
||||||
|
|
||||||
return rename((path_ + tmp_appendix_).c_str(), path_.c_str());
|
return rename((path_ + tmp_appendix_).c_str(), path_.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// exception_ex
|
||||||
|
exception_ex::exception_ex() : what_("exception_ex")
|
||||||
|
{}
|
||||||
|
exception_ex::exception_ex(const char* msg) : what_(msg ? msg : "")
|
||||||
|
{}
|
||||||
|
exception_ex::exception_ex(const exception_ex& r) : what_(r.what_)
|
||||||
|
{}
|
||||||
|
exception_ex::~exception_ex()
|
||||||
|
{}
|
||||||
|
|
||||||
|
const char* exception_ex::what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT
|
||||||
|
{
|
||||||
|
return what_.c_str();
|
||||||
|
}
|
||||||
|
void exception_ex::set_info(const char* info)
|
||||||
|
{
|
||||||
|
what_ = info ? info : "";
|
||||||
|
}
|
||||||
|
|
|
@ -62,6 +62,18 @@ namespace utils
|
||||||
// ENODATA - need more data
|
// ENODATA - need more data
|
||||||
int utf16_2_8(unsigned short* &in, char ch[8]);
|
int utf16_2_8(unsigned short* &in, char ch[8]);
|
||||||
|
|
||||||
|
// Function: transfere from utf8 to utf16
|
||||||
|
//
|
||||||
|
// Parameters: in - [in]: head of utf8 beginning
|
||||||
|
//
|
||||||
|
// [out]: beginning of the next character if success or no changes on failure
|
||||||
|
// ch - to receive the character
|
||||||
|
//
|
||||||
|
// Return: 0 - success
|
||||||
|
// EINVAL - invalid utf8 string
|
||||||
|
int utf8_2_16(uint8_t* &in, uint16_t& ch);
|
||||||
|
int utf8_2_web(uint8_t* &in, std::string& web); // convert 'E5 A5 BD' to '\u597D'
|
||||||
|
|
||||||
std::string get_command_result(const char* cmd, int len = -1, int *err = nullptr);
|
std::string get_command_result(const char* cmd, int len = -1, int *err = nullptr);
|
||||||
std::string get_local_data_path(void);
|
std::string get_local_data_path(void);
|
||||||
std::string temporary_path(void);
|
std::string temporary_path(void);
|
||||||
|
@ -101,6 +113,7 @@ namespace utils
|
||||||
|
|
||||||
// return logging file path if 'type' was LOG_TYPE_FILE
|
// return logging file path if 'type' was LOG_TYPE_FILE
|
||||||
std::string init_log(log_type type, log_level level = LOG_LEVEL_ALL, const char* fn_appendix = nullptr/*appendix to default log-file-name*/);
|
std::string init_log(log_type type, log_level level = LOG_LEVEL_ALL, const char* fn_appendix = nullptr/*appendix to default log-file-name*/);
|
||||||
|
void set_log_file_max_size(int size = SIZE_MB(10));
|
||||||
void uninit(void);
|
void uninit(void);
|
||||||
void log_info(const char* info, int level = LOG_LEVEL_ALL);
|
void log_info(const char* info, int level = LOG_LEVEL_ALL);
|
||||||
void log_mem_info(const char* desc, const void* data, size_t bytes, int level = LOG_LEVEL_ALL); // log as 0x12345678 00 01 02 ...
|
void log_mem_info(const char* desc, const void* data, size_t bytes, int level = LOG_LEVEL_ALL); // log as 0x12345678 00 01 02 ...
|
||||||
|
@ -116,6 +129,7 @@ namespace utils
|
||||||
// bitmap header ...
|
// bitmap header ...
|
||||||
std::string bitmap_info_header(int pixel_w, int pixel_h, int bpp, int dpix, int dpiy = 0); // return BITMPINFOHEADER + pallete if need. dpiy same as dpix if was ZERO
|
std::string bitmap_info_header(int pixel_w, int pixel_h, int bpp, int dpix, int dpiy = 0); // return BITMPINFOHEADER + pallete if need. dpiy same as dpix if was ZERO
|
||||||
std::string bitmap_file_header(BITMAPINFOHEADER *lpbi); // return BITMAPFILEHEADER
|
std::string bitmap_file_header(BITMAPINFOHEADER *lpbi); // return BITMAPFILEHEADER
|
||||||
|
int save_bitmap(const char* file, int w, int h, int bpp, int dpix, int dpiy, void* bits);
|
||||||
|
|
||||||
#if OS_WIN
|
#if OS_WIN
|
||||||
// Function: pump message recycle (GetMessageW)
|
// Function: pump message recycle (GetMessageW)
|
||||||
|
@ -536,3 +550,20 @@ public:
|
||||||
std::string load(void);
|
std::string load(void);
|
||||||
int save(const void* data, uint16_t bytes);
|
int save(const void* data, uint16_t bytes);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
class exception_ex : public std::exception
|
||||||
|
{
|
||||||
|
std::string what_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
exception_ex();
|
||||||
|
exception_ex(const char* msg);
|
||||||
|
exception_ex(const exception_ex& r);
|
||||||
|
~exception_ex();
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual const char*
|
||||||
|
what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT override;
|
||||||
|
void set_info(const char* info);
|
||||||
|
};
|
||||||
|
|
|
@ -753,6 +753,8 @@ void ui_mgr::init(void)
|
||||||
{
|
{
|
||||||
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
|
auto f = [this](dev_menu* m, int id) -> MENU_CMD_HANDLER_RET
|
||||||
{
|
{
|
||||||
|
devui::send_message(devui::UI_CMD_CLEAN_PASSWAY);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
handler_[menu_command::MENU_CMD_ID_CLEAR_PASSWAY] = f;
|
handler_[menu_command::MENU_CMD_ID_CLEAR_PASSWAY] = f;
|
||||||
|
|
10
ui/font.cpp
10
ui/font.cpp
|
@ -24,6 +24,16 @@ namespace custom_font
|
||||||
|
|
||||||
void init_8x8(void)
|
void init_8x8(void)
|
||||||
{
|
{
|
||||||
|
static uint8_t zong[] = {8, 8
|
||||||
|
, 0x00, 0x60, 0x6E, 0x4B, 0x7A, 0x4B, 0x6E, 0x60
|
||||||
|
};
|
||||||
|
font_map8x8_["\346\200\273"] = zong;
|
||||||
|
|
||||||
|
static uint8_t maohao[] = {4, 8
|
||||||
|
, 0x00, 0x50, 0x50, 0x00
|
||||||
|
};
|
||||||
|
font_map8x8_["\357\274\232"] = maohao;
|
||||||
|
|
||||||
static uint8_t colon[] = {3, 8
|
static uint8_t colon[] = {3, 8
|
||||||
, 0x00, 0x28, 0x00
|
, 0x00, 0x28, 0x00
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,8 +60,8 @@ add_packagedirs("sdk")
|
||||||
add_defines("BUILD_AS_DEVICE")
|
add_defines("BUILD_AS_DEVICE")
|
||||||
add_defines("VER_MAIN=2")
|
add_defines("VER_MAIN=2")
|
||||||
add_defines("VER_FAMILY=200")
|
add_defines("VER_FAMILY=200")
|
||||||
add_defines("VER_DATE=20240222")
|
add_defines("VER_DATE=20240223")
|
||||||
add_defines("VER_BUILD=19")
|
add_defines("VER_BUILD=12")
|
||||||
|
|
||||||
target("conf")
|
target("conf")
|
||||||
set_kind("phony")
|
set_kind("phony")
|
||||||
|
|
Loading…
Reference in New Issue