调整代码

This commit is contained in:
13038267101 2022-11-15 09:47:06 +08:00
parent 6c7252b51d
commit 85e0e11829
10 changed files with 49 additions and 111 deletions

View File

@ -969,6 +969,10 @@ namespace setting3399
G400_AUTO = 16, G400_AUTO = 16,
G400_MAXAUTO = 16 G400_MAXAUTO = 16
}; };
//#define SAVE_TO_FILE
} }
//3399协议整理 -OVER //3399协议整理 -OVER
#pragma pack(pop) #pragma pack(pop)

View File

@ -38,14 +38,25 @@ if (NULL != (p)) {delete((p)); \
(p) = NULL; \ (p) = NULL; \
}\ }\
} }
#ifdef OEM_HANWANG //#ifdef OEM_HANWANG
#define hg_scanner hw_scanner //#define hg_scanner hw_scanner
#elif defined(OEM_LISICHENG) //#elif defined(OEM_LISICHENG)
#define hg_scanner lsc_scanner //#define hg_scanner lsc_scanner
#elif defined(OEM_CANGTIAN) //#elif defined(OEM_CANGTIAN)
#define hg_scanner cts_scanner //#define hg_scanner cts_scanner
#endif //#endif
#define USB_REQ_GET_FPGA_REGS 0x40
#define USB_REQ_SET_FPGA_REGS 0x41
#define USB_REQ_GET_MOTOR_REGS 0x42
#define USB_REQ_SET_MOTOR_REGS 0x43
#define USB_REQ_GET_DEV_STATUS 0x60
#define USB_REQ_GET_DEV_CONFIGURATION 0x61
#define USB_REQ_SET_DEV_CONFIGURATION 0x62
#define USB_REQ_GET_DEV_REGS 0x63
#define USB_REQ_SET_DEV_REGS 0x64
class hg_scanner class hg_scanner
{ {
bool notify_setting_result_; bool notify_setting_result_;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -486,7 +486,11 @@ extern "C"{
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#define SAFE_FREE(p){ \
if (NULL != (p)) {free((p)); \
(p) = NULL; \
}\
}
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
// log ... // log ...
@ -500,9 +504,10 @@ extern "C"{
if(hg_scanner_log_is_enable(level)) \ if(hg_scanner_log_is_enable(level)) \
{ \ { \
char* msgbuf = (char*)malloc(bytes); \ char* msgbuf = (char*)malloc(bytes); \
if (msgbuf != NULL) \
sprintf(msgbuf, fmt, arg1); \ sprintf(msgbuf, fmt, arg1); \
hg_scanner_log(msgbuf); \ hg_scanner_log(msgbuf); \
free(msgbuf); \ SAFE_FREE(msgbuf); \
} }
#define VLOG_MINI_1(level, fmt, arg1) VLOG_1(level, VLOG_MINI_BYTES, fmt, arg1) #define VLOG_MINI_1(level, fmt, arg1) VLOG_1(level, VLOG_MINI_BYTES, fmt, arg1)
@ -510,9 +515,10 @@ extern "C"{
if(hg_scanner_log_is_enable(level)) \ if(hg_scanner_log_is_enable(level)) \
{ \ { \
char* msgbuf = (char*)malloc(bytes); \ char* msgbuf = (char*)malloc(bytes); \
if (msgbuf != NULL) \
sprintf(msgbuf, fmt, arg1, arg2); \ sprintf(msgbuf, fmt, arg1, arg2); \
hg_scanner_log(msgbuf); \ hg_scanner_log(msgbuf); \
free(msgbuf); \ SAFE_FREE(msgbuf); \
} }
#define VLOG_MINI_2(level, fmt, arg1, arg2) VLOG_2(level, VLOG_MINI_BYTES, fmt, arg1, arg2) #define VLOG_MINI_2(level, fmt, arg1, arg2) VLOG_2(level, VLOG_MINI_BYTES, fmt, arg1, arg2)
@ -520,9 +526,10 @@ extern "C"{
if(hg_scanner_log_is_enable(level)) \ if(hg_scanner_log_is_enable(level)) \
{ \ { \
char* msgbuf = (char*)malloc(bytes); \ char* msgbuf = (char*)malloc(bytes); \
if (msgbuf != NULL) \
sprintf(msgbuf, fmt, arg1, arg2, arg3); \ sprintf(msgbuf, fmt, arg1, arg2, arg3); \
hg_scanner_log(msgbuf); \ hg_scanner_log(msgbuf); \
free(msgbuf); \ SAFE_FREE(msgbuf); \
} }
#define VLOG_MINI_3(level, fmt, arg1, arg2, arg3) VLOG_3(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3) #define VLOG_MINI_3(level, fmt, arg1, arg2, arg3) VLOG_3(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3)
@ -530,9 +537,10 @@ extern "C"{
if(hg_scanner_log_is_enable(level)) \ if(hg_scanner_log_is_enable(level)) \
{ \ { \
char* msgbuf = (char*)malloc(bytes); \ char* msgbuf = (char*)malloc(bytes); \
if (msgbuf != NULL) \
sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4); \ sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4); \
hg_scanner_log(msgbuf); \ hg_scanner_log(msgbuf); \
free(msgbuf); \ SAFE_FREE(msgbuf); \
} }
#define VLOG_MINI_4(level, fmt, arg1, arg2, arg3, arg4) \ #define VLOG_MINI_4(level, fmt, arg1, arg2, arg3, arg4) \
VLOG_4(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4) VLOG_4(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4)
@ -541,9 +549,10 @@ extern "C"{
if(hg_scanner_log_is_enable(level)) \ if(hg_scanner_log_is_enable(level)) \
{ \ { \
char* msgbuf = (char*)malloc(bytes); \ char* msgbuf = (char*)malloc(bytes); \
if(msgbuf) \
sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4, arg5); \ sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4, arg5); \
hg_scanner_log(msgbuf); \ hg_scanner_log(msgbuf); \
free(msgbuf); \ SAFE_FREE(msgbuf); \
} }
#define VLOG_MINI_5(level, fmt, arg1, arg2, arg3, arg4, arg5) \ #define VLOG_MINI_5(level, fmt, arg1, arg2, arg3, arg4, arg5) \
VLOG_5(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4, arg5) VLOG_5(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4, arg5)
@ -552,10 +561,12 @@ extern "C"{
if(hg_scanner_log_is_enable(level)) \ if(hg_scanner_log_is_enable(level)) \
{ \ { \
char* msgbuf = (char*)malloc(bytes); \ char* msgbuf = (char*)malloc(bytes); \
if (msgbuf != NULL) \
sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4, arg5, arg6); \ sprintf(msgbuf, fmt, arg1, arg2, arg3, arg4, arg5, arg6); \
hg_scanner_log(msgbuf); \ hg_scanner_log(msgbuf); \
free(msgbuf); \ SAFE_FREE(msgbuf); \
} }
#define VLOG_MINI_6(level, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \ #define VLOG_MINI_6(level, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
VLOG_6(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4, arg5, arg6) VLOG_6(level, VLOG_MINI_BYTES, fmt, arg1, arg2, arg3, arg4, arg5, arg6)