sjamesr/jfreesane — pull request #11 by matthiasblaesing (2014-03-05 19:07:43+00:00)
Title: Implement authentication for saned

Based on http://www.sane-project.org/html/doc017.html#s5.2.10 and observed behaviour of scanimage

With changes this works:

InetAddress address = InetAddress.getByName("localhost");
SaneSession session = SaneSession.withRemoteSane(address);
session.setPasswordProvider(new SanePasswordProvider() {

public char[] getPassword() {
return "".toCharArray();
}

public String getUsername() {
return "";
}
});
for (SaneDevice sd : session.listDevices()) {
System.out.println(sd.getName() + " - " + sd.getVendor()+ " - " + sd.getModel());
}
SaneDevice device = session.getDevice("test:1");
SaneDevice device2 = session.getDevice("test:0");
device.open();
device2.open();
for(OptionGroup og: device.getOptionGroups()) {
for(SaneOption so: og.getOptions()) {
System.out.println(so.getDescription());
}
}
BufferedImage bi = device.acquireImage();