Alexander, Took a peek on the sane sources and managed to get it working, with your guide.
Some observations: 1 - I have limited it to work with 1 Frame only. Would be nice to have an API where sane manages multi-frame situations; 2 - Sane is very easy, the difficult part is to convert the received bytes onto an image. Would also be nice to convert the code on scanimage.c to an API call; Note: I got it working with the Ricoh driver, will try to connect with an apple device and wireshark it Thanks. Em sáb., 23 de jan. de 2021 às 05:45, Alexander Pevzner <[email protected]> escreveu: > On 1/22/21 11:43 PM, Thiago Milczarek Sayão wrote: > > Thanks for the reply. > > > > Another approach is to use the C api directly and map it to java using > JNI. > > > > I'm looking at scanimage.c file, but it deals with lots of things. Is > > there a high level api? > > I's actually simple. > > 1. Call sane_init() to initialize the driver > 2. Call sane_get_devices() to obtain list of devices > 3. Somehow choose a device from the list > 4. Call sane_open() to obtain device handle > 5. Call sane_start() to start scanning > 6. Call sane_get_parameters() to obtain image parameters > 7. Call sane_read() to read image data, until it returns erroneous > status or zero length (which means EOF) > 8. Call sane_close() to release device handle > 9. Call sane_exit() to cleanup the driver > > Items 2-7 can be repeated without need to initialize/cleanup driver > before/after each scan. > > Any of these functions may return error status code. > > To scan everything from ADF, you need to repeat steps 5-7, until > sane_start() returns SANE_STATUS_NO_DOCS. Don't consider > SANE_STATUS_NO_DOCS as an error, if you've got at least one image. > > It will scan with default options. > > Once you've get it working, I can tell you how to deal with options. > > -- > > Wishes, Alexander Pevzner ([email protected]) >
