import otherSupport.SettingsManager;
import comediJNI.Comedi;
import comediJNI.ComediDef;

/** Port of comedi1 demo from Comedi */
public class comedi1 {
	static {
	//	System.load(System.getProperty("user.dir") + "/jni/comediJNI.so");
		new SettingsManager("minerva", true);
	}

	public static final int subdev = 0;		/* change this to your input subdevice */
	public static final int chan = 0;		/* change this to your channel */
	public static final int range = 0;		/* more on this later */
	public static final int aref = ComediDef.AREF_GROUND;	/* more on this later */

	public static void main(String[] args) {
		
		long it;
		int chan = 0;
		
		it = Comedi.open("/dev/comedi0");
		if(it == 0)
			throw new RuntimeException("Comedi open error: " + Comedi.strerror(Comedi.errorno()));
		
		int ret[] = Comedi.data_read(it, subdev, chan, range, aref);
		if(ret[0] < 0)
			throw new RuntimeException("Comedi read error: " + Comedi.strerror(Comedi.errorno()));
		
		System.out.println("data = " + ret[1]);
		
	}
}
