Java API

Jeff Freedman (jsf@hevanet.com)
Thu, 09 Oct 1997 15:17:12 -0700

This is a multi-part message in MIME format.
--------------C9C510BDADC904EACC7A3783
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Is anyone else working on a Java API to SANE? If not, I've started
working on this, using the Linux JDK 1.1.3. With it, you'll be able to
access the SANE native API using Java, like the attached test program
does.

But if someone's already done this, I won't bother doing the rest:-).

-- Jeff
--------------C9C510BDADC904EACC7A3783
Content-Type: text/plain; charset=us-ascii; name="Test.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Test.java"

class Test
{
public static void main(String[] args)
{
Sane sane = new Sane();
int version[] = new int[1]; // Array to get version #.
int status = sane.init(version);
if (status != Sane.STATUS_GOOD)
{
System.out.println("getDevices() failed. Status= " + status);
return;
}
System.out.println("VersionMajor =" + sane.versionMajor(version[0]));
System.out.println("VersionMinor =" + sane.versionMinor(version[0]));
System.out.println("VersionBuild =" + sane.versionBuild(version[0]));
// Get list of devices.
// Allocate room for 50.
SaneDevice devList[] = new SaneDevice[50];
status = sane.getDevices(devList, false);
if (status != Sane.STATUS_GOOD)
{
System.out.println("getDevices() failed. Status= " + status);
return;
}
for (int i = 0; i < 50 && devList[i] != null; i++)
{
System.out.println("Device '" + devList[i].name + "' is a " +
devList[i].vendor + " " + devList[i].model + " " +
devList[i].type);
}
}
}

--------------C9C510BDADC904EACC7A3783--

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com