Hi,
We are receiving the error "Capability value can be set only when device is open." randomly when scanning during the day. This error is thrown not when we are manually setting the capabilities but during the image transfer process based on the log file.
Here's our ScanHelper class.
http://cdn.ccnb.ca/vintasoft/20160512/scanhelper.txt
Here's the log file.
http://cdn.ccnb.ca/vintasoft/20160512/v ... 100227.txt
Scanner: HP Scanjet N9120
Vintasoft.WpfTwain.dll version: 10.0.6.1
Thanks for you help,
Sébastien Comeau
Capability value can be set only when device is open.
Moderator: Alex
-
- Posts: 16
- Joined: Fri Jan 31, 2014 5:31 pm
-
- Posts: 16
- Joined: Fri Jan 31, 2014 5:31 pm
Re: Capability value can be set only when device is open.
We also received this error. Check the following stack:
Dijito.FrontEnd.DeviceException: Device is not open: Unknown error 1. ---> Vintasoft.WpfTwain.TwainDeviceException: Device is not open: Unknown error 1. à Vintasoft.WpfTwain.TwainEnvironment.?(DebugLevel A_0, String A_1, ? A_2) à Vintasoft.WpfTwain.TwainEnvironment.?(String A_0, ? A_1) à Vintasoft.WpfTwain.Device.Open() à Dijito.FrontEnd.Helper.ScanHelper.Scan()
Dijito.FrontEnd.DeviceException: Device is not open: Unknown error 1. ---> Vintasoft.WpfTwain.TwainDeviceException: Device is not open: Unknown error 1. à Vintasoft.WpfTwain.TwainEnvironment.?(DebugLevel A_0, String A_1, ? A_2) à Vintasoft.WpfTwain.TwainEnvironment.?(String A_0, ? A_1) à Vintasoft.WpfTwain.Device.Open() à Dijito.FrontEnd.Helper.ScanHelper.Scan()
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Capability value can be set only when device is open.
Hi Sébastien,
Thank you for information. Log-file shows that your application tries to set unit of measure when device is transferring image - this is prohibited.
SDK does not have code that sets unit of measure. Your code looks correct, the SetDeviceCapabilities method is correct. BUT "something" sets unit of measure in a wrong state. Please inspect your code and try to find where you are setting the unit of measure.
Best regards, Alexander
Thank you for information. Log-file shows that your application tries to set unit of measure when device is transferring image - this is prohibited.
SDK does not have code that sets unit of measure. Your code looks correct, the SetDeviceCapabilities method is correct. BUT "something" sets unit of measure in a wrong state. Please inspect your code and try to find where you are setting the unit of measure.
Best regards, Alexander
-
- Posts: 16
- Joined: Fri Jan 31, 2014 5:31 pm
Re: Capability value can be set only when device is open.
We found that the problem should be cause by calling the Scan method again before the previous call is finished. However, we are using the synchronous way to acquires the images and the scan method can be call again before the previous call has finished. Explain me more in details each device states. It is safe to check if the device is closed before the scanning process?
Thanks,
Sébastien Comeau
Thanks,
Sébastien Comeau
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Capability value can be set only when device is open.
You have the problem because you are breaking the modal image acquisition loop when you are throwing an exception if scan is failed or device event occured. Please update your code and call the Device.AcquireModal method until it does not return the AcquireModalState.None value.
Best regards, Alexander
Best regards, Alexander