HGScannerLib增加设备关机和重启的接口

This commit is contained in:
luoliangyi 2022-10-13 17:24:27 +08:00
parent 0335466fc8
commit 65958831b9
7 changed files with 52 additions and 0 deletions

View File

@ -20,5 +20,7 @@ HGLib_ReleaseDeviceParamGroupList
HGLib_ReleaseDeviceParam
HGLib_ResetDeviceParam
HGLib_DeviceIsPaperOn
HGLib_DeviceRestart
HGLib_DeviceShutDown
HGLib_StartDeviceScan
HGLib_StopDeviceScan

View File

@ -944,6 +944,26 @@ HGBool HGLibDeviceImpl::IsPaperOn()
return HGFALSE;
}
HGBool HGLibDeviceImpl::Restart()
{
SANE_Power stat = SANE_Power::SANE_POWER_RESTART;
unsigned int len = sizeof(SANE_Power);
SANE_Status status = sane_io_control(m_devHandle, IO_CTRL_CODE_SET_POWER_LEVEL, &stat, &len);
if (SANE_STATUS_GOOD == status)
return HGTRUE;
return HGFALSE;
}
HGBool HGLibDeviceImpl::ShutDown()
{
SANE_Power stat = SANE_Power::SANE_POWER_SHUTDOWN;
unsigned int len = sizeof(SANE_Power);
SANE_Status status = sane_io_control(m_devHandle, IO_CTRL_CODE_SET_POWER_LEVEL, &stat, &len);
if (SANE_STATUS_GOOD == status)
return HGTRUE;
return HGFALSE;
}
HGBool HGLibDeviceImpl::StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam)
{

View File

@ -32,6 +32,8 @@ public:
static HGBool ReleaseParam(HGLibDeviceParam* param);
HGBool ResetParam();
HGBool IsPaperOn();
HGBool Restart();
HGBool ShutDown();
HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);
HGBool StopScan();

View File

@ -219,6 +219,28 @@ HGBool HGAPI HGLib_DeviceIsPaperOn(HGLibDevice device)
return deviceImpl->IsPaperOn();
}
HGBool HGAPI HGLib_DeviceRestart(HGLibDevice device)
{
if (NULL == device)
{
return HGFALSE;
}
HGLibDeviceImpl* deviceImpl = (HGLibDeviceImpl*)device;
return deviceImpl->Restart();
}
HGBool HGAPI HGLib_DeviceShutDown(HGLibDevice device)
{
if (NULL == device)
{
return HGFALSE;
}
HGLibDeviceImpl* deviceImpl = (HGLibDeviceImpl*)device;
return deviceImpl->ShutDown();
}
HGBool HGAPI HGLib_StartDeviceScan(HGLibDevice device, HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam)
{

View File

@ -494,6 +494,12 @@ HGEXPORT HGBool HGAPI HGLib_ResetDeviceParam(HGLibDevice device);
/* 设备是否有纸 */
HGEXPORT HGBool HGAPI HGLib_DeviceIsPaperOn(HGLibDevice device);
/* 重启设备 */
HGEXPORT HGBool HGAPI HGLib_DeviceRestart(HGLibDevice device);
/* 关闭设备 */
HGEXPORT HGBool HGAPI HGLib_DeviceShutDown(HGLibDevice device);
/* 开始扫描 */
HGEXPORT HGBool HGAPI HGLib_StartDeviceScan(HGLibDevice device, HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
HGLibDeviceScanImageFunc imageFunc, HGPointer imageParam);