Home › Forums › TWAIN Classic › Refreshing the data Source
- This topic has 6 replies, 2 voices, and was last updated 16 years, 10 months ago by redrgreen.
- AuthorPosts
Hi I have an application running TWAIN with the Data Source UI not shown, when the user clicks Aquire the last image from the connected Digital camera is downloaded. However there are two problems which have arisen.
1. If the Data Source is left enabled and the user takes a new photo the data source does not register this new photo.
2. If the user clicks Aquire when there are no photos in the camera memory then Enabling the DS fails, i.e. it is not possible to enable the DS with the UI hidden when there is nothing to transfer.Are there any solutions to these two issues?
Regards
NiallHi I have an application running TWAIN with the Data Source UI not shown, when the user clicks Aquire the last image from the connected Digital camera is downloaded.
Is that what you want to happen?
1. If the Data Source is left enabled and the user takes a new photo the data source does not register this new photo.
Why is the data source left enabled?
2. If the user clicks Aquire when there are no photos in the camera memory then Enabling the DS fails, i.e. it is not possible to enable the DS with the UI hidden when there is nothing to transfer.
Huh. So rc=failure. Mostly curious just (as I havent got a clue why you’re seeing this) but what is the cc?
What device are you using?
Do you see the same symtoms from twacker32?.
Hi
In answer to your first question Yes this is what I want to happen, and in answer to your second, so the user can continue to shoot and automatically download shots once they are taken( that is essentially the purpose of the aplication), and in answer to your third question Yes twacker32 behaves in the same way, i.e. it crashes. The camera I’m using to test this app is a Canon EOS 350D
Any thoughts?for your #2 problem, it seems to me that you need to verify that an image exists before enabling the device. for a twain solution take a look at the file related triplets. in appendix A there is an section “File System”, it’ll show you how to check if files exist using MSG_GETFIRSTFILE MSG_GETNEXTFILE. if your device doesn’t suuport those caps, then you might be able to verify this with stand io calls. .. or I’ve misunderstood the problem.
for #1, walk me thru the rough logic opening enabling disabling and closing the device with how that relates to the user taking shots.
and I wonder, why use twain here? I’m assuming you have the device connected and most devices that I have are mounted as a drive when connected. Couldn’t you use standard io calls to pull images off of the device as soon as they become available? Are you using twain calls to take the shots or just pull them once they’ve been taken? Do you use any twain calls to configure the device (set brightness etc,)? or are you trying to setup some automation?
Hi gabe
I have opted not to use TWAIN for this app in the end opting instead for Canons own SDk which does exactly what I want. The primary motivation for using TWAIN was not to have to rely on a propriatory SDK however its not essential.
FYI with regard to the logic of the app, essentially the user connects his or her camera to their computer and each time a shot is taken it appears on the monitor automatically with out the user having to leave their camera and download the image just taken. That may seem a peculiar thing to want to do as a user, however it is designed to capture images from cameras connected to clinical equipment or microscopes, telescopes etc. or even just studio shots.
The problem with just using IO calls would be that there is no feed back from the camera, so the app would not know if a new picture had been taken, hense the need to leave the datasource enabled, however this apparently does not update. Thankfully the SDK accomplishes this easily.
Regards
NiallIf notification was|is the issue it seems (maybe just to me) that you could you use any number of standard api calls to provide notification. FindFirstChangeNotification, ReadDirectoryChangesW and FileSystemWatcher come to mind and if you used them with the twain directory calls you’d know where to look, but glad to hear you found a solution and if you’re only trying to support one device their sdk may be a better long term solution. God knows I wouldn’t use twain if I didn’t have to.
Cheers,
Thanks for your help and suggestions 😉
- AuthorPosts