Skip to content
Snippets Groups Projects
Commit d9949f29 authored by Thomas Oster's avatar Thomas Oster
Browse files

Added Serial-Communication API for the Lasersaur driver (UNTESTED!)

parent 27a10a15
No related branches found
No related tags found
No related merge requests found
File added
File added
......@@ -27,10 +27,14 @@ dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.commons-net-3.1.jar=lib/commons-net-3.1.jar
file.reference.jna.jar=lib/jna.jar
file.reference.purejavacomm.jar=lib/purejavacomm.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.commons-net-3.1.jar}
${file.reference.commons-net-3.1.jar}:\
${file.reference.jna.jar}:\
${file.reference.purejavacomm.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
......
......@@ -29,6 +29,8 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import purejavacomm.CommPort;
import purejavacomm.CommPortIdentifier;
/**
* This class implements a driver for the LAOS Lasercutter board. Currently it
......@@ -386,9 +388,15 @@ public class Lasersaur extends LaserCutter {
ByteArrayOutputStream buffer = null;
pl.taskChanged(this, "checking job");
checkJob(job);
buffer = new ByteArrayOutputStream();
out = new BufferedOutputStream(buffer);
pl.taskChanged(this, "buffering");
pl.taskChanged(this, "connecting");
CommPortIdentifier cpi = CommPortIdentifier.getPortIdentifier(this.getComPort());
if (cpi == null)
{
throw new Exception("Error: Could not Open COM-Port '"+this.getComPort()+"'");
}
CommPort port = cpi.open("VisiCut", 10000);
out = new BufferedOutputStream(port.getOutputStream());
pl.taskChanged(this, "sending");
out.write(this.generateInitializationCode());
pl.progressChanged(this, 20);
if (job.contains3dRaster()) {
......@@ -405,7 +413,7 @@ public class Lasersaur extends LaserCutter {
pl.progressChanged(this, 80);
out.write(this.generateShutdownCode());
out.close();
System.out.write(buffer.toByteArray());
port.close();
pl.taskChanged(this, "sent.");
pl.progressChanged(this, 100);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment