生产工具增加日志,解决速度模式显示异常的问题

This commit is contained in:
yangjiaxuan 2024-08-09 17:04:52 +08:00
parent 20e8a2279f
commit 5f009ccd27
7 changed files with 61 additions and 5 deletions

View File

@ -301,7 +301,7 @@ int DeviceManager::getSpeedMode()
const wchar_t G100[6] = { 70,80,90,110 }; const wchar_t G100[6] = { 70,80,90,110 };
const wchar_t G200[6] = { 100,110,120,130 }; const wchar_t G200[6] = { 100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70 }; const wchar_t G300[6] = { 40,50,60,70,80 };
const wchar_t G400[6] = { 40,50,60,70,80 }; const wchar_t G400[6] = { 40,50,60,70,80 };
QString devType = getDevType(); QString devType = getDevType();

View File

@ -687,13 +687,13 @@ QString Form_mainInterface::getSpeedMode()
const wchar_t G100[6] = { 60,70,80,90,110 }; const wchar_t G100[6] = { 60,70,80,90,110 };
const wchar_t G200[6] = { 90,100,110,120,130 }; const wchar_t G200[6] = { 90,100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70,80,90 }; const wchar_t G300[6] = { 40,50,60,70,80 };
const wchar_t G306[6] = { 30,40,50,60,70 }; const wchar_t G306[6] = { 30,40,50,60,70 };
const wchar_t G400[6] = { 40,50,60,70,80 }; const wchar_t G400[6] = { 40,50,60,70,80 };
int speed = 0; int speed = 0;
QString devType = m_devType; QString devType = m_devType;
if (m_devFwNum.mid(3, 1) == "Z"); //306 if (m_devFwNum.mid(3, 1) == "Z") //306
{ {
devType = "G306"; devType = "G306";
} }

24
code/base/dllmain.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "log/log.h"
HLOG g_hLog = nullptr;
const char* oem = "HuaGoScan";
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_hLog = EnableLog(nullptr, oem, "app");
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
DisableLog(g_hLog);
g_hLog = nullptr;
break;
}
return TRUE;
}

View File

@ -72,19 +72,23 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>..\..\..\sdk\include;..\..\app\HGProductionTool\;$(IncludePath)</IncludePath> <IncludePath>..\..\..\sdk\include;..\..\app\HGProductionTool\;$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)..\..\..\sdk\lib\win\$(PlatformTarget)\$(Configuration);$(ProjectDir)..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;..\..\app\HGProductionTool\;$(IncludePath)</IncludePath> <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;..\..\app\HGProductionTool\;$(IncludePath)</IncludePath>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
<IntDir>x86\$(Configuration)\</IntDir> <IntDir>x86\$(Configuration)\</IntDir>
<LibraryPath>$(SolutionDir)..\..\..\sdk\lib\win\$(PlatformTarget)\$(Configuration);$(ProjectDir)..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;..\..\app\HGProductionTool\;</IncludePath> <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;..\..\app\HGProductionTool\;</IncludePath>
<LibraryPath>$(SolutionDir)..\..\..\sdk\lib\win\$(PlatformTarget)\$(Configuration);$(ProjectDir)..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;..\..\app\HGProductionTool\;</IncludePath> <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;..\..\app\HGProductionTool\;</IncludePath>
<OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir> <OutDir>$(SolutionDir)x86\$(Configuration)\</OutDir>
<IntDir>x86\$(Configuration)\</IntDir> <IntDir>x86\$(Configuration)\</IntDir>
<LibraryPath>$(SolutionDir)..\..\..\sdk\lib\win\$(PlatformTarget)\$(Configuration);$(ProjectDir)..\..\..\sdk\lib\win\$(PlatformTarget)\oem\huagao\;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@ -96,6 +100,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>commonlog.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\code_app\build2\build\windows\huagao\x86\Debug\</Command> <Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\code_app\build2\build\windows\huagao\x86\Debug\</Command>
@ -115,6 +120,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>commonlog.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\release\win\x86\Release\ <Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\release\win\x86\Release\
@ -131,6 +137,7 @@ copy $(OutDir)test.dll $(SolutionDir)..\..\..\code_app\build2\build\windows\huag
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>commonlog.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -147,12 +154,14 @@ copy $(OutDir)test.dll $(SolutionDir)..\..\..\code_app\build2\build\windows\huag
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>commonlog.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\release\win\x64\Release\</Command> <Command>copy $(OutDir)test.dll $(SolutionDir)..\..\..\release\win\x64\Release\</Command>
</PostBuildEvent> </PostBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="test_base.cpp" /> <ClCompile Include="test_base.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -18,6 +18,9 @@
<ClCompile Include="test_base.cpp"> <ClCompile Include="test_base.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="test_base.h"> <ClInclude Include="test_base.h">

View File

@ -5,6 +5,8 @@
#include <iostream> #include <iostream>
#include "huagao/hgscanner_error.h" #include "huagao/hgscanner_error.h"
#include "sane/sane_option_definitions.h"; #include "sane/sane_option_definitions.h";
#include "log/log.h"
extern HLOG g_hLog;
test *test_ = nullptr; test *test_ = nullptr;
@ -144,6 +146,17 @@ std::atomic<bool> is_distortion_get_image(false);
int g_currentCorrectType = 0; int g_currentCorrectType = 0;
int g_dynamicCorrectStatus = SCANNER_ERR_OK; int g_dynamicCorrectStatus = SCANNER_ERR_OK;
std::string test::get_serial_num()
{
std::string sn = "";
unsigned int len = 0;
int ret = helper_->io_control(IO_CTRL_CODE_GET_SERIAL, &sn[0], &len);
sn.resize(len);
ret = helper_->io_control(IO_CTRL_CODE_GET_SERIAL, &sn[0], &len);
return sn;
}
/*设置vid pid*/ /*设置vid pid*/
int test::test_set_vidpid(void* data) int test::test_set_vidpid(void* data)
{ {
@ -246,7 +259,7 @@ int test::test_configure_speed_mode(void* data)
bool type = false; bool type = false;
const char G139[6] = { 60,70,80,90,110 }; const char G139[6] = { 60,70,80,90,110 };
const char G239[6] = { 90,100,110,120,130 }; const char G239[6] = { 90,100,110,120,130 };
const char G300[6] = { 40,50,60,70,80,90 }; const char G300[6] = { 40,50,60,70,80 };
const char G306[6] = { 30,40,50,60,70 }; const char G306[6] = { 30,40,50,60,70 };
const char G400[6] = { 40,50,60,70,80 }; const char G400[6] = { 40,50,60,70,80 };
@ -583,6 +596,8 @@ test::test(ui_helper* helper)
helper_ = helper; helper_ = helper;
helper_->register_sane_callback(sane_ex_callback, NULL); helper_->register_sane_callback(sane_ex_callback, NULL);
init_test_map_(); init_test_map_();
m_sn = get_serial_num();
} }
test::~test() test::~test()
{ {
@ -1267,6 +1282,8 @@ int test::test_set_auto_distortion(void* data)
if (setdistortion == getdistortion) if (setdistortion == getdistortion)
{ {
helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置畸变值成功", true); helper_->test_callback(set_test_name_.c_str(), ui_helper::TEST_EVENT_RESULT, (void*)L"设置畸变值成功", true);
InfoLog(g_hLog, "Serial Number: %s, set distortion value: %f", m_sn.c_str(), setdistortion);
} }
else else
{ {
@ -1514,7 +1531,7 @@ int test::test_get_device_config(void* data)
const wchar_t G139[6] = { 60,70,80,90,110 }; const wchar_t G139[6] = { 60,70,80,90,110 };
const wchar_t G239[6] = { 90,100,110,120,130 }; const wchar_t G239[6] = { 90,100,110,120,130 };
const wchar_t G300[6] = { 40,50,60,70,80,90 }; const wchar_t G300[6] = { 40,50,60,70,80 };
const wchar_t G306[6] = { 30,40,50,60,70 }; const wchar_t G306[6] = { 30,40,50,60,70 };
const wchar_t G400[6] = { 40,50,60,70,80 }; const wchar_t G400[6] = { 40,50,60,70,80 };
SANE_Int num = 0; SANE_Int num = 0;

View File

@ -299,6 +299,7 @@ public:
std::mutex m_lock; std::mutex m_lock;
ui_helper* helper_; ui_helper* helper_;
int fw_; int fw_;
std::string m_sn;
std::mutex mutex_; std::mutex mutex_;
std::condition_variable cv_; std::condition_variable cv_;
@ -327,6 +328,8 @@ private:
}; };
private: private:
std::string get_serial_num();
/*设置vid pid*/ /*设置vid pid*/
int test_set_vidpid(void* data); int test_set_vidpid(void* data);
/*设置序列号*/ /*设置序列号*/