TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Twain Driver Implementation question – long scan

Forums › TWAIN Classic › Twain Driver Implementation question – long scan

  • This topic has 3 replies, 2 voices, and was last updated 11 years ago by jimwatters.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • February 18, 2010 at 7:18 am #22581 Reply
    Denis
    Participant
    • Topics - 7
    • Replies - 9
    • Total Posts - 16

    Hi Community,
    I read Twain Spec several times but this aspect still not clear to me. I am trying to implement driver for very slow scanner. So when first image already was transferred second is in process. In MSG_ENDXFER I as understand have to set pData->Count to -1. This means that I have more data. what State should I put my source: 5 or 6? it seems 5 is correct, or not?

    but the biggest issue is with Twack_32 from SDK. it processes scanning in a loop: do{} while (twPendingXfer.Count != 0);
    so it does not wait for MSG_XFERREADY. is this correct and usual? i think if this implemented this way in SDK many applications in wild world use this tactic. May be I need to implement other way. But if i set pData->Count to zero, twacker exits scan loop 🙁

    Any advice will be helpful
    Thank you!

    February 18, 2010 at 2:48 pm #25170 Reply
    jimwatters
    Participant
    • Topics - 2
    • Replies - 72
    • Total Posts - 74

    If you have more images to transfer you should stay in state 6 and return a count of -1 or >0.

    Traversing from state 6 to 5 happens if you send a count of 0 for DAT_PENDINGXFERS.

    Either by transferring all images or after receiving DAT_PENDINGXFERS/MSG_RESET which stops the transfers and sets the count to 0.

    The source only sends one MSG_XFERREADY at the beginning of each scan loop.

    Jim Watters

    February 19, 2010 at 1:38 am #25171 Reply
    Denis
    Participant
    • Topics - 7
    • Replies - 9
    • Total Posts - 16

    Jim, thank you!

    I will stay in state6. I have question regarding how to process this situation correctly:
    because source sends Ready only for first image, does this mean for subsequent requests I have to block DAT_IMAGENATIVEXFER request till image will be fully scanned?

    and what is correct to send back to DSM if this scan during I blocked process was canceled by pressing hardware button? Now I send MSG_CLOSEDSREQ, may be i need to do this more accurate way.

    Thank you!!!

    February 22, 2010 at 11:08 pm #25172 Reply
    jimwatters
    Participant
    • Topics - 2
    • Replies - 72
    • Total Posts - 74

    If I understand correctly you are always returning -1 as XferCount to indicate that there is more images coming regardless if there is more paper in the scanner. The scanner has a stop button to finish the scan job.

    Then return TWRC_CANCEL to the DAT_IMAGExxxXFER message to indicate the user canceled.

    The source remains in state 7. It is up to the application to send PendingXfer MSG_RESET

    If the UI was visible and you want the application to close the UI too then you should send MSG_CLOSEDSREQ.

    Applications like Photoshop will keep the UI open so the user can press scan to start the next batch.

    Jim Watters

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Twain Driver Implementation question – long scan
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • could not open the twain source. Make sure there is a valid source for your sca
  • Changing TWAIN driver defaults
  • Scanner starts transfer when console gets closed (CITRIX)
  • Kodak RFS 3600
  • Didn’t save enough file scan
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.