Capability value can be set only when device is open.

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
sebascomeau
Posts: 16
Joined: Fri Jan 31, 2014 5:31 pm

Capability value can be set only when device is open.

Post by sebascomeau » Thu May 12, 2016 5:06 pm

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

sebascomeau
Posts: 16
Joined: Fri Jan 31, 2014 5:31 pm

Re: Capability value can be set only when device is open.

Post by sebascomeau » Thu May 12, 2016 5:18 pm

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()

Alex
Site Admin
Posts: 1474
Joined: Thu Jul 10, 2008 2:21 pm

Re: Capability value can be set only when device is open.

Post by Alex » Mon May 16, 2016 11:52 am

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

sebascomeau
Posts: 16
Joined: Fri Jan 31, 2014 5:31 pm

Re: Capability value can be set only when device is open.

Post by sebascomeau » Mon May 16, 2016 5:27 pm

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

Alex
Site Admin
Posts: 1474
Joined: Thu Jul 10, 2008 2:21 pm

Re: Capability value can be set only when device is open.

Post by Alex » Tue May 17, 2016 2:37 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests