Home › Forums › TWAIN Classic › understand when the scanner is disconnected / unplugged?
- This topic has 1 reply, 2 voices, and was last updated 10 years, 5 months ago by MarkM.
- AuthorPosts
There is a damn way to understand when a scanner is disconnected? I’m using a porting c # but I’m in charge and yet there are a host of commands that do not work as possible and this, from what I read in other forums it says that it is impossible, how come we have all become crazy?
what’s CheckStatus = 0x0201,
i use this example
http://www.codeproject.com/Articles/1376/NET-TWAIN-image-scanner#xx1007385xxCAP_DEVICEONLINE is the capability that reports whether or not the scanner is powered on and ready for use. It’s a mandatory capability, so all TWAIN drivers are expected to support it.
If a command fails due to loss of the device, it should return TWRC_FAILURE / TWCC_CHECKDEVICEONLINE. This isn’t mandatory, so your mileage may vary depending on the TWAIN driver. You get the condition code by calling DG_CONTROL / DAT_STATUS / MSG_GET immediately after any command that returns TWRC_FAILURE.
If the TWAIN driver supports CAP_DEVICEEVENTS for TWDE_CHECKDEVICEONLINE, then you can get notifications when the scanner is disconnected / reconnected. Again, this isn’t going to be supported by all TWAIN drivers.
The condition code you referred to, TWCC_CHECKSTATUS, is used to report when the driver make an adjustment to a requested setting. For example, if you set ICAP_BRIGHTNESS to 105, the driver could decide to adjust to 100 (for instance if it only supports steps of 10) and return check status to say “I made the change, but it’s not exactly what you asked for…”
- AuthorPosts