HGScannerLib增加获取设备状态的接口
This commit is contained in:
parent
058999c7c9
commit
eb5f0f95c4
|
@ -22,6 +22,7 @@ HGLib_ReleaseDeviceParamGroupList
|
|||
HGLib_ReleaseDeviceParam
|
||||
HGLib_ResetDeviceParam
|
||||
HGLib_DeviceIsPaperOn
|
||||
HGLib_GetDeviceStatus
|
||||
HGLib_DeviceRestart
|
||||
HGLib_DeviceShutDown
|
||||
HGLib_StartDeviceScan
|
||||
|
|
|
@ -948,6 +948,16 @@ HGBool HGLibDeviceImpl::IsPaperOn()
|
|||
return HGFALSE;
|
||||
}
|
||||
|
||||
HGInt HGLibDeviceImpl::GetStatus()
|
||||
{
|
||||
SANE_Bool isOn = SANE_FALSE;
|
||||
unsigned int len = sizeof(SANE_Bool);
|
||||
SANE_Status status = sane_io_control(m_devHandle, IO_CTRL_CODE_GET_PAPER_ON, &isOn, &len);
|
||||
if (SANE_STATUS_GOOD == status)
|
||||
return isOn ? 1 : 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
HGBool HGLibDeviceImpl::Restart()
|
||||
{
|
||||
SANE_Power stat = SANE_POWER_RESTART;
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
static HGBool ReleaseParam(HGLibDeviceParam* param);
|
||||
HGBool ResetParam();
|
||||
HGBool IsPaperOn();
|
||||
HGInt GetStatus();
|
||||
HGBool Restart();
|
||||
HGBool ShutDown();
|
||||
HGBool StartScan(HGLibDeviceScanEventFunc eventFunc, HGPointer eventParam,
|
||||
|
|
|
@ -252,6 +252,17 @@ HGBool HGAPI HGLib_DeviceIsPaperOn(HGLibDevice device)
|
|||
return deviceImpl->IsPaperOn();
|
||||
}
|
||||
|
||||
HGInt HGAPI HGLib_GetDeviceStatus(HGLibDevice device)
|
||||
{
|
||||
if (NULL == device)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
HGLibDeviceImpl* deviceImpl = (HGLibDeviceImpl*)device;
|
||||
return deviceImpl->GetStatus();
|
||||
}
|
||||
|
||||
HGBool HGAPI HGLib_DeviceRestart(HGLibDevice device)
|
||||
{
|
||||
if (NULL == device)
|
||||
|
|
|
@ -527,6 +527,9 @@ HGEXPORT HGBool HGAPI HGLib_ResetDeviceParam(HGLibDevice device);
|
|||
/* 设备是否有纸 */
|
||||
HGEXPORT HGBool HGAPI HGLib_DeviceIsPaperOn(HGLibDevice device);
|
||||
|
||||
/* 获取设备状态, -1表示异常,0表示无纸,1表示有纸 */
|
||||
HGEXPORT HGInt HGAPI HGLib_GetDeviceStatus(HGLibDevice device);
|
||||
|
||||
/* 重启设备 */
|
||||
HGEXPORT HGBool HGAPI HGLib_DeviceRestart(HGLibDevice device);
|
||||
|
||||
|
|
Loading…
Reference in New Issue