twain3.0/huagao/Device/scn_config.cpp

56 lines
1.3 KiB
C++

#include "stdafx.h"
#include "scn_config.h"
#include "math.h"
hgConfigClass::hgConfigClass(GScanCap param)
{
m_param = { 0 };
PaperStatus ps = { param.papertype,param.paperAlign };
m_param.paper = ContainspaperTypesKey(ps) ? SupPaperTyps[ps] : 0;
m_param.color = ContainsPixTypeKey(param.hardwarecaps.capturepixtype) ? SupPixelTypes[param.hardwarecaps.capturepixtype] : 2;
m_param.dpi = ContainsResolutionKey(param.resolution_native) ? SupResolutions[param.resolution_native] :
m_param.double_feed_enbale = param.hardwarecaps.en_doublefeed;
m_param.stable_enbale = param.hardwarecaps.en_stapledetect;
m_param.screw_detect_enable = param.hardwarecaps.en_skrewdetect;
m_param.screw_detect_level = m_param.screw_detect_enable? secrewMaps[param.hardwarecaps.skrewdetectlevel]:0;
#ifdef G200
m_param.pc_correct = 0;
#else // G200
m_param.correct_enable = 1;
#endif
m_param.unused_one = m_param.unused_two = 0;
}
bool hgConfigClass::ContainspaperTypesKey(PaperStatus key)
{
if (SupPaperTyps.count(key) > 0)
{
return true;
}
return false;
}
bool hgConfigClass::ContainsPixTypeKey(uint16_t key)
{
if (SupPixelTypes.count(key)>0)
{
return true;
}
return false;
}
bool hgConfigClass::ContainsResolutionKey(float key)
{
if ( SupResolutions.count(key)>0)
{
return true;
}
return false;
}
unsigned int hgConfigClass::GetData()
{
return m_param.value;
}