This commit is contained in:
parent
a2b937031a
commit
377dad1541
|
@ -162,6 +162,11 @@ HGResult HGSaneManagerImpl::OpenSource(HGUInt index, class HGSaneSourceImpl **so
|
|||
|
||||
HGResult HGSaneManagerImpl::OpenDefaultSource(HGSaneSourceImpl **sourceImpl)
|
||||
{
|
||||
if (NULL == sourceImpl)
|
||||
{
|
||||
return HGBASE_ERR_INVALIDARG;
|
||||
}
|
||||
|
||||
HGSaneSourceImpl *newSourceImpl = new HGSaneSourceImpl(this);
|
||||
HGResult ret = newSourceImpl->Open(m_vSource[0].first.c_str(), m_vSource[0].second.c_str());
|
||||
if (HGBASE_ERR_OK != ret)
|
||||
|
@ -943,9 +948,11 @@ HGResult HGSaneDeviceImpl::GetScanMode(HGChar *scanMode, HGUInt maxLen)
|
|||
if (ret == SANE_STATUS_GOOD)
|
||||
{
|
||||
strcpy(scanMode, value);
|
||||
free(value);
|
||||
return HGBASE_ERR_OK;
|
||||
}
|
||||
}
|
||||
free(value);
|
||||
}
|
||||
|
||||
return HGBASE_ERR_FAIL;
|
||||
|
@ -978,6 +985,7 @@ HGResult HGSaneDeviceImpl::SetScanMode(const HGChar *scanMode)
|
|||
{
|
||||
SANE_Int dev_options = 0;
|
||||
SANE_Int method = 0;
|
||||
SANE_String value = nullptr;
|
||||
m_sourceImpl->m_saneApi.sane_control_option_api(m_devHandle, 0, SANE_ACTION_GET_VALUE, &dev_options, nullptr);
|
||||
for (int i = 1; i < dev_options; ++i)
|
||||
{
|
||||
|
@ -989,9 +997,11 @@ HGResult HGSaneDeviceImpl::SetScanMode(const HGChar *scanMode)
|
|||
SANE_Status ret = m_sourceImpl->m_saneApi.sane_control_option_api(m_devHandle, i, SANE_ACTION_SET_VALUE, value, &method);
|
||||
if (ret == SANE_STATUS_GOOD)
|
||||
{
|
||||
free(value);
|
||||
return HGBASE_ERR_OK;
|
||||
}
|
||||
}
|
||||
free(value);
|
||||
}
|
||||
|
||||
return HGBASE_ERR_FAIL;
|
||||
|
|
Loading…
Reference in New Issue