├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── ALPHABET-OLD ├── 0.NGC ├── 1.NGC ├── 2.NGC ├── 3.NGC ├── 4.NGC ├── 5.NGC ├── 6.NGC ├── 7.NGC ├── 8.NGC ├── 9.NGC ├── A.NGC ├── AMPERSAND.NGC ├── ASTERIX.NGC ├── AT.NGC ├── B.NGC ├── B1CLOSE.NGC ├── B1OPEN.NGC ├── B2CLOSE.NGC ├── B2OPEN.NGC ├── B3CLOSE.NGC ├── B3OPEN.NGC ├── BAR.NGC ├── BSLASH.NGC ├── C.NGC ├── CARET.NGC ├── COLON.NGC ├── COMMA.NGC ├── D.NGC ├── DOLLAR.NGC ├── DOUBLEQ.NGC ├── E.NGC ├── EQUAL.NGC ├── EXCLAMATION.NGC ├── F.NGC ├── FSLASH.NGC ├── G.NGC ├── GRAVE.NGC ├── GREATERTHAN.NGC ├── H.NGC ├── HYPHEN.NGC ├── I.NGC ├── J.NGC ├── K.NGC ├── L.NGC ├── LESSTHAN.NGC ├── M.NGC ├── N.NGC ├── O.NGC ├── P.NGC ├── PERCENT.NGC ├── PERIOD.NGC ├── PLUS.NGC ├── POUND.NGC ├── Q.NGC ├── QUESTION.NGC ├── R.NGC ├── S.NGC ├── SEMICOLON.NGC ├── SINGLEQ.NGC ├── SMALL_A.NGC ├── SMALL_B.NGC ├── SMALL_C.NGC ├── SMALL_D.NGC ├── SMALL_E.NGC ├── SMALL_F.NGC ├── SMALL_G.NGC ├── SMALL_H.NGC ├── SMALL_I.NGC ├── SMALL_J.NGC ├── SMALL_K.NGC ├── SMALL_L.NGC ├── SMALL_M.NGC ├── SMALL_N.NGC ├── SMALL_O.NGC ├── SMALL_P.NGC ├── SMALL_Q.NGC ├── SMALL_R.NGC ├── SMALL_S.NGC ├── SMALL_T.NGC ├── SMALL_U.NGC ├── SMALL_V.NGC ├── SMALL_W.NGC ├── SMALL_X.NGC ├── SMALL_Y.NGC ├── SMALL_Z.NGC ├── SPACE.NGC ├── T.NGC ├── TILDE.NGC ├── U.NGC ├── UNDERSCORE.NGC ├── V.NGC ├── W.NGC ├── X.NGC ├── Y.NGC └── Z.NGC ├── ALPHABET ├── 0.NGC ├── 1.NGC ├── 2.NGC ├── 3.NGC ├── 4.NGC ├── 5.NGC ├── 6.NGC ├── 7.NGC ├── 8.NGC ├── 9.NGC ├── A.NGC ├── AMPERSAND.NGC ├── ASTERIX.NGC ├── AT.NGC ├── B.NGC ├── B1CLOSE.NGC ├── B1OPEN.NGC ├── B2CLOSE.NGC ├── B2OPEN.NGC ├── B3CLOSE.NGC ├── B3OPEN.NGC ├── BAR.NGC ├── BSLASH.NGC ├── C.NGC ├── CARET.NGC ├── COLON.NGC ├── COMMA.NGC ├── D.NGC ├── DOLLAR.NGC ├── DOUBLEQ.NGC ├── E.NGC ├── EQUAL.NGC ├── EXCLAMATION.NGC ├── F.NGC ├── FSLASH.NGC ├── G.NGC ├── GRAVE.NGC ├── GREATERTHAN.NGC ├── H.NGC ├── HYPHEN.NGC ├── I.NGC ├── J.NGC ├── K.NGC ├── L.NGC ├── LESSTHAN.NGC ├── M.NGC ├── N.NGC ├── O.NGC ├── P.NGC ├── PERCENT.NGC ├── PERIOD.NGC ├── PLUS.NGC ├── POUND.NGC ├── Q.NGC ├── QUESTION.NGC ├── R.NGC ├── S.NGC ├── SEMICOLON.NGC ├── SINGLEQ.NGC ├── SMALL_A.NGC ├── SMALL_B.NGC ├── SMALL_C.NGC ├── SMALL_D.NGC ├── SMALL_E.NGC ├── SMALL_F.NGC ├── SMALL_G.NGC ├── SMALL_H.NGC ├── SMALL_I.NGC ├── SMALL_J.NGC ├── SMALL_K.NGC ├── SMALL_L.NGC ├── SMALL_M.NGC ├── SMALL_N.NGC ├── SMALL_O.NGC ├── SMALL_P.NGC ├── SMALL_Q.NGC ├── SMALL_R.NGC ├── SMALL_S.NGC ├── SMALL_T.NGC ├── SMALL_U.NGC ├── SMALL_V.NGC ├── SMALL_W.NGC ├── SMALL_X.NGC ├── SMALL_Y.NGC ├── SMALL_Z.NGC ├── SPACE.NGC ├── T.NGC ├── TILDE.NGC ├── U.NGC ├── UNDERSCORE.NGC ├── V.NGC ├── W.NGC ├── X.NGC ├── Y.NGC └── Z.NGC ├── GcodeSender.jar ├── README.md ├── antscript.xml ├── bin ├── .gitignore └── GcodeSender │ ├── GcodeSender$1.class │ ├── GcodeSender.class │ ├── Generators │ ├── GcodeGenerator.class │ ├── HilbertCurveGenerator$1.class │ ├── HilbertCurveGenerator.class │ ├── YourMessageHereGenerator$1.class │ ├── YourMessageHereGenerator$Align.class │ ├── YourMessageHereGenerator$VAlign.class │ └── YourMessageHereGenerator.class │ ├── SerialConnection.class │ ├── SerialConnectionReadyListener.class │ └── StatusBar.class ├── java └── src │ ├── com │ └── marginallyclever │ │ └── gcodesender │ │ ├── GcodeSender.java │ │ ├── Generators │ │ ├── GcodeGenerator.java │ │ ├── HilbertCurveGenerator.java │ │ └── YourMessageHereGenerator.java │ │ ├── SerialConnection.java │ │ ├── SerialConnectionReadyListener.java │ │ └── StatusBar.java │ └── main │ └── assembly │ └── application.xml ├── libs └── jSSC-2.6.0-Release │ ├── COPYING │ ├── COPYING.LESSER │ ├── README.txt │ ├── javadoc │ └── jssc-2.6.0-javadoc.jar │ ├── jssc.jar │ └── src │ ├── cpp │ ├── _nix_based │ │ └── jssc.cpp │ ├── jssc_SerialNativeInterface.h │ └── windows │ │ └── jssc.c++ │ └── jssc-2.6.0-src.jar ├── pom.xml ├── src └── GcodeSender │ └── Generators │ └── HilbertCurveGenerator.java ├── start.command ├── start32.bat └── start64.bat /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | TEMP.NGC 3 | 4 | *.class 5 | <<<<<<< HEAD 6 | 7 | *.class 8 | ======= 9 | 10 | *.class 11 | *.class 12 | /target/ 13 | 14 | *.class 15 | >>>>>>> origin/master 16 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | GcodeSender 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//java/src=UTF-8 3 | encoding/=UTF-8 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /ALPHABET-OLD/0.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 7 | G0 X-1 Y-2 8 | G0 X1 9 | G0 Y2 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/1.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X0.5 8 | G0 Y-2 9 | G0 Z0.5 10 | G0 X-0.5 11 | G0 Z-0.5 12 | G0 X1 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/2.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | G0 Y-1 9 | G0 X-1 10 | G0 Y-1 11 | G0 X1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/3.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X1 6 | G0 Y2 7 | G0 X-1 8 | G0 Z0.5 9 | G0 Y-1 10 | G0 Z-0.5 11 | G0 X1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/4.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0.5 3 | G91 4 | G0 X1 5 | G0 Z-0.5 6 | 7 | G0 Y2 8 | G0 X-1 Y-1 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/5.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X1 6 | G0 Y1 7 | G0 X-1 8 | G0 Y1 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/6.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0.5 3 | G91 4 | G0 Y1 5 | G0 Z-0.5 6 | 7 | G0 X1 8 | G0 Y-1 9 | G0 X-1 10 | G0 Y2 11 | G0 X1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/7.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0.5 3 | G91 4 | G0 Y2 5 | G0 Z-0.5 6 | 7 | G0 X1 8 | G0 Y-2 X-1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X2 -------------------------------------------------------------------------------- /ALPHABET-OLD/8.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X1 6 | G0 Y2 7 | G0 X-1 8 | G0 Y-2 9 | G0 Z0.5 10 | G0 Y1 11 | G0 Z-0.5 12 | G0 X1 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/9.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X1 6 | G0 Y2 7 | G0 X-1 8 | G0 Y-1 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/A.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 7 | G0 Y-1 8 | G0 X-1 9 | G0 Z0.5 10 | G0 X1 11 | G0 Z-0.5 12 | G0 Y-1 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/AMPERSAND.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-1 X-0.5 8 | G0 X-0.5 9 | G0 Y1 10 | G0 Y1 X0.5 11 | G0 X-0.5 12 | G0 X1 Y-2 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/ASTERIX.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y1 X1 8 | G0 Z0.5 9 | G0 X-0.5 10 | G0 Z-0.5 11 | G0 Y-1 12 | G0 Z0.5 13 | G0 X0.5 14 | G0 Z-0.5 15 | G0 Y1 X-1 16 | G0 Z0.5 17 | G0 Y-0.5 18 | G0 Z-0.5 19 | G0 X1 20 | 21 | G90 22 | G0 Z0.5 23 | G91 24 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/AT.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y0.5 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-0.25 8 | G0 Y1 9 | G0 X0.5 10 | G0 Y-1 11 | G0 X0.25 12 | G0 Y1.5 13 | G0 X-1 14 | G0 Y-2 15 | G0 X1 16 | 17 | G90 18 | G0 Z0.5 19 | G91 20 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/B.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 7 | G0 Y-2 8 | G0 X-1 9 | G0 Y1 10 | G0 X1 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/B1CLOSE.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X0.5 Y-0.5 8 | G0 Y-1 9 | G0 Y-0.5 X-0.5 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/B1OPEN.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-0.5 Y-0.5 8 | G0 Y-1 9 | G0 Y-0.5 X0.5 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/B2CLOSE.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X0.5 8 | G0 Y-2 9 | G0 X-0.5 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/B2OPEN.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-0.5 8 | G0 Y-2 9 | G0 X0.5 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/B3CLOSE.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X0.5 Y-0.25 8 | G0 Y-0.5 9 | G0 X0.5 Y-0.25 10 | G0 X-0.5 Y-0.25 11 | G0 Y-0.5 12 | G0 X-0.5 Y-0.25 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/B3OPEN.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-0.5 Y-0.25 8 | G0 Y-0.5 9 | G0 X-0.5 Y-0.25 10 | G0 X0.5 Y-0.25 11 | G0 Y-0.5 12 | G0 X0.5 Y-0.25 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/BAR.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/BSLASH.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 Y-2 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/C.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y-2 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 15 | 16 | 17 | -------------------------------------------------------------------------------- /ALPHABET-OLD/CARET.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X0.5 Y0.5 8 | G0 X0.5 Y-0.5 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/COLON.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G4 0.25 8 | G0 Z0.5 9 | G0 Y1 10 | G0 Z-0.5 11 | G4 0.25 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.5 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/COMMA.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-0.25 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1.5 Y0.25 -------------------------------------------------------------------------------- /ALPHABET-OLD/D.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 Y-1 7 | G0 X-1 Y-1 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X2 13 | 14 | 15 | -------------------------------------------------------------------------------- /ALPHABET-OLD/DOLLAR.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 Z0.5 9 | G0 Y1.5 X0.5 10 | G0 Z-0.5 11 | G0 X-1 12 | G0 Y-0.5 13 | G0 X1 14 | G0 Y-0.5 15 | G0 X-1 16 | 17 | G90 18 | G0 Z0.5 19 | G91 20 | G0 X2 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/DOUBLEQ.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.3 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-0.5 8 | G0 Z0.5 9 | G0 Y0.5 X0.3 10 | G0 Z-0.5 11 | G0 Y-0.5 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.4 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/E.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y-1 9 | G0 X1 10 | G0 X-1 11 | G0 Y-1 12 | G0 X1 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 18 | 19 | 20 | -------------------------------------------------------------------------------- /ALPHABET-OLD/EQUAL.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | G0 Z0.5 9 | G0 Y-1 10 | G0 Z-0.5 11 | G0 X-1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X2 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/EXCLAMATION.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-1 8 | G0 Z0.5 9 | G0 Y-1 10 | G0 Z-0.5 11 | G4 0.25 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/F.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y1 6 | G0 X1 7 | G0 X-1 8 | G0 Y1 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/FSLASH.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X1 Y2 6 | 7 | G90 8 | G0 Z0.5 9 | G91 10 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/G.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y-2 9 | G0 X1 10 | G0 Y1 11 | G0 X-0.5 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.5 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/GRAVE.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X0.5 Y-0.5 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1.5 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/GREATERTHAN.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1.5 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-0.5 X-1 8 | G0 Y-0.5 X1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/H.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 Y-1 7 | G0 X1 8 | G0 Y1 9 | G0 Y-2 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/HYPHEN.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/I.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X1 6 | G0 Z0.5 7 | G0 Y2 8 | G0 Z-0.5 9 | G0 X-1 10 | G0 Z0.5 11 | G0 X0.5 12 | G0 Z-0.5 13 | G0 Y-2 14 | 15 | G90 16 | G0 Z0.5 17 | G91 18 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/J.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 X-1 9 | G0 Y1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X2 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/K.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 Z0.5 7 | G0 X1 8 | G0 Z-0.5 9 | G0 Y-1 X-1 10 | G0 Y-1 X1 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/L.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 X1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/LESSTHAN.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-0.5 X1 8 | G0 Y-0.5 X-1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X2 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/M.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X0.5 Y-1 7 | G0 X0.5 Y1 8 | G0 Y-2 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/N.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 Y-2 7 | G0 Y2 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/O.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 7 | G0 Y-2 8 | G0 X-1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X2 -------------------------------------------------------------------------------- /ALPHABET-OLD/P.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 7 | G0 Y-1 8 | G0 X-1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X2 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/PERCENT.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 X1 6 | G0 Z0.5 7 | G0 X-1 8 | G0 Z-0.5 9 | G0 X0.25 10 | G0 Y-0.25 11 | G0 X-0.25 12 | G0 Y0.25 13 | G0 Z0.5 14 | G0 X0.75 Y-1.75 15 | G0 Z-0.5 16 | G0 X0.25 17 | G0 Y-0.25 18 | G0 X-0.25 19 | G0 Y0.25 20 | G0 Z0.5 21 | 22 | G90 23 | G0 Z0.5 24 | G91 25 | G0 X1.25 Y-0.25 -------------------------------------------------------------------------------- /ALPHABET-OLD/PERIOD.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G4 0.25 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/PLUS.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y0.5 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y1 8 | G0 Z0.5 9 | G0 X-0.5 Y-0.5 10 | G0 Z-0.5 11 | G0 X1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/POUND.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.3 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 Z0.5 9 | G0 Y2 X0.3 10 | G0 Z-0.5 11 | G0 Y-2 12 | G0 Z0.5 13 | G0 Y1.2 X-0.6 14 | G0 Z-0.5 15 | G0 X1 16 | G0 Z0.5 17 | G0 Y-0.6 X-1 18 | G0 Z-0.5 19 | G0 X1 20 | 21 | G90 22 | G0 Z0.5 23 | G91 24 | G0 X1 Y-0.6 -------------------------------------------------------------------------------- /ALPHABET-OLD/Q.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 7 | G0 Y-2 8 | G0 X-1 9 | G0 Z0.5 10 | G0 X0.5 Y0.5 11 | G0 Z-0.5 12 | G0 X0.5 Y-0.5 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/QUESTION.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y0.5 8 | G0 X1 9 | G0 Y-1 10 | G0 X-0.5 11 | G0 Y-0.5 12 | G0 Z0.5 13 | G0 Y-0.5 14 | G0 Z-0.5 15 | G4 0.25 16 | 17 | G90 18 | G0 Z0.5 19 | G91 20 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/R.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 X1 7 | G0 Y-1 8 | G0 X-1 9 | G0 X1 Y-1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/S.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y-1 9 | G0 X1 10 | G0 Y-1 11 | G0 X-1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X2 -------------------------------------------------------------------------------- /ALPHABET-OLD/SEMICOLON.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-0.25 8 | G0 Z0.5 9 | G0 Y1.25 10 | G0 Z-0.5 11 | G4 0.25 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.5 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SINGLEQ.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-0.5 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1.5 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_A.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | G0 Y-1 9 | G0 X-1 10 | G0 Y0.5 11 | G0 X1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_B.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 X1 9 | G0 Y1 10 | G0 X-1 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X2 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_C.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y-1 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_D.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y-1 9 | G0 X1 10 | G0 Y2 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_E.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | G0 Y0.5 9 | G0 X-1 10 | G0 Y-1 11 | G0 X1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_F.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y1 6 | G0 X0.5 7 | G0 X-0.5 8 | G0 Y1 9 | G0 X0.5 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1.5 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_G.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y1 9 | G0 X1 10 | G0 Y-2 11 | G0 X-1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X2 Y1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_H.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 Z0.5 9 | G0 Y1 10 | G0 Z-0.5 11 | G0 X1 12 | G0 Y-1 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_I.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y1 8 | G0 Z0.5 9 | G0 Y0.5 10 | G0 Z-0.5 11 | G04 0.5 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.5 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_J.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X1 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 X-0.5 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1.5 Y1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_K.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y2 6 | G0 Z0.5 7 | G0 X0.5 Y-0.5 8 | G0 Z-0.5 9 | G0 Y-0.5 X-0.5 10 | G0 Y-1 X1 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_L.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y2 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1.5 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_M.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X0.25 Y1 6 | G0 X0.25 Y-1 7 | G0 X0.25 Y1 8 | G0 X0.25 Y-1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_N.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y1 6 | G0 X1 7 | G0 Y-1 8 | 9 | G90 10 | G0 Z0.5 11 | G91 12 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_O.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 X1 6 | G0 Y1 7 | G0 X-1 8 | G0 Y-1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X2 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_P.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y-1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y2 8 | G0 X1 9 | G0 Y-1 10 | G0 X-1 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X2 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_Q.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y1 9 | G0 X1 10 | G0 Y-2 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X1 Y1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_R.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y1 6 | G0 X1 7 | 8 | G90 9 | G0 Z0.5 10 | G91 11 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_S.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 X1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X-1 8 | G0 Y-0.5 9 | G0 X1 10 | G0 Y-0.5 11 | G0 X-1 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X2 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_T.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X0.5 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y2 8 | G0 Z0.5 9 | G0 X-0.25 Y-1 10 | G0 Z-0.5 11 | G0 X0.5 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.25 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_U.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-1 8 | G0 X1 9 | G0 Y1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_V.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-1 X0.5 8 | G0 Y1 X0.5 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_W.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-1 X0.25 8 | G0 Y1 X0.25 9 | G0 Y-1 X0.25 10 | G0 Y1 X0.25 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_X.NGC: -------------------------------------------------------------------------------- 1 | G90 2 | G0 Z0 3 | G91 4 | 5 | G0 Y1 X1 6 | G0 Z0.5 7 | G0 X-1 8 | G0 Z-0.5 9 | G0 Y-1 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_Y.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X0.5 Y-1 8 | G0 Z0.5 9 | G0 X0.5 Y1 10 | G0 Z-0.5 11 | G0 X-1 Y-2 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X2 Y1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SMALL_Z.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y1 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | G0 X-1 Y-1 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/SPACE.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 X2 -------------------------------------------------------------------------------- /ALPHABET-OLD/T.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | G0 Z0.5 9 | G0 X-0.5 10 | G0 Z-0.5 11 | G0 Y-2 12 | 13 | G90 14 | G0 Z0.5 15 | G91 16 | G0 X1.5 -------------------------------------------------------------------------------- /ALPHABET-OLD/TILDE.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y0.75 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y0.5 X0.3 8 | G0 Y-0.5 X0.4 9 | G0 Y0.5 X0.3 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-1.25 -------------------------------------------------------------------------------- /ALPHABET-OLD/U.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 8 | G0 X1 9 | G0 Y2 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/UNDERSCORE.NGC: -------------------------------------------------------------------------------- 1 | G0 Z0 2 | G91 3 | G0 X1 4 | G0 Z0.5 5 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/V.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 X0.5 8 | G0 Y2 X0.5 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/W.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-2 X0.25 8 | G0 Y1 X0.25 9 | G0 Y-1 X0.25 10 | G0 Y2 X0.25 11 | 12 | G90 13 | G0 Z0.5 14 | G91 15 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/X.NGC: -------------------------------------------------------------------------------- 1 | G0 Z0 2 | G91 3 | 4 | G0 Y2 X1 5 | G0 Z0.5 6 | G0 X-1 7 | G0 Z-0.5 8 | G0 Y-2 X1 9 | 10 | G90 11 | G0 Z0.5 12 | G91 13 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET-OLD/Y.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 Y-1 X0.5 8 | G0 Y-1 9 | G0 Z0.5 10 | G0 Y1 11 | G0 Z-0.5 12 | G0 Y1 X0.5 13 | 14 | G90 15 | G0 Z0.5 16 | G91 17 | G0 X1 Y-2 -------------------------------------------------------------------------------- /ALPHABET-OLD/Z.NGC: -------------------------------------------------------------------------------- 1 | G91 2 | G0 Y2 3 | G90 4 | G0 Z0 5 | G91 6 | 7 | G0 X1 8 | G0 X-1 Y-2 9 | G0 X1 10 | 11 | G90 12 | G0 Z0.5 13 | G91 14 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/0.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 5 | G0 X-1 Y-2 6 | G0 X1 7 | G0 Y2 8 | 9 | UP 10 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/1.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 X0.5 5 | G0 Y-2 6 | UP 7 | G0 X-0.5 8 | DOWN 9 | G0 X1 10 | 11 | UP -------------------------------------------------------------------------------- /ALPHABET/2.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 X1 5 | G0 Y-1 6 | G0 X-1 7 | G0 Y-1 8 | G0 X1 9 | 10 | UP -------------------------------------------------------------------------------- /ALPHABET/3.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X1 4 | G0 Y2 5 | G0 X-1 6 | UP 7 | G0 Y-1 8 | DOWN 9 | G0 X1 10 | 11 | UP 12 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/4.NGC: -------------------------------------------------------------------------------- 1 | UP 2 | G0 X1 3 | DOWN 4 | 5 | G0 Y2 6 | G0 X-1 Y-1 7 | G0 X1 8 | 9 | UP 10 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/5.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X1 4 | G0 Y1 5 | G0 X-1 6 | G0 Y1 7 | G0 X1 8 | 9 | UP 10 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/6.NGC: -------------------------------------------------------------------------------- 1 | UP 2 | G0 Y1 3 | DOWN 4 | 5 | G0 X1 6 | G0 Y-1 7 | G0 X-1 8 | G0 Y2 9 | G0 X1 10 | 11 | UP 12 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/7.NGC: -------------------------------------------------------------------------------- 1 | UP 2 | G0 Y2 3 | DOWN 4 | 5 | G0 X1 6 | G0 Y-2 X-1 7 | 8 | UP 9 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/8.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X1 4 | G0 Y2 5 | G0 X-1 6 | G0 Y-2 7 | UP 8 | G0 Y1 9 | DOWN 10 | G0 X1 11 | 12 | UP 13 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/9.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X1 4 | G0 Y2 5 | G0 X-1 6 | G0 Y-1 7 | G0 X1 8 | 9 | UP 10 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/A.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 5 | G0 Y-1 6 | G0 X-1 7 | UP 8 | G0 X1 9 | DOWN 10 | G0 Y-1 11 | 12 | UP -------------------------------------------------------------------------------- /ALPHABET/AMPERSAND.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 X1 2 | DOWN 3 | 4 | G0 Y-1 X-0.5 5 | G0 X-0.5 6 | G0 Y1 7 | G0 Y1 X0.5 8 | G0 X-0.5 9 | G0 X1 Y-2 10 | 11 | UP -------------------------------------------------------------------------------- /ALPHABET/ASTERIX.NGC: -------------------------------------------------------------------------------- 1 | G0 Y0.5 2 | DOWN 3 | 4 | G0 Y1 X1 5 | UP 6 | G0 X-0.5 7 | DOWN 8 | G0 Y-1 9 | UP 10 | G0 X0.5 11 | DOWN 12 | G0 Y1 X-1 13 | UP 14 | G0 Y-0.5 15 | DOWN 16 | G0 X1 17 | 18 | UP 19 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/AT.NGC: -------------------------------------------------------------------------------- 1 | G0 Y0.5 X0.5 2 | DOWN 3 | 4 | G0 X-0.25 5 | G0 Y1 6 | G0 X0.5 7 | G0 Y-1 8 | G0 X0.25 9 | G0 Y1.5 10 | G0 X-1 11 | G0 Y-2 12 | G0 X1 13 | 14 | UP -------------------------------------------------------------------------------- /ALPHABET/B.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 5 | G0 Y-2 6 | G0 X-1 7 | G0 Y1 8 | G0 X1 9 | 10 | UP 11 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/B1CLOSE.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 X0.5 Y-0.5 5 | G0 Y-1 6 | G0 Y-0.5 X-0.5 7 | 8 | UP 9 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/B1OPEN.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 X-0.5 Y-0.5 5 | G0 Y-1 6 | G0 Y-0.5 X0.5 7 | 8 | UP 9 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/B2CLOSE.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 X0.5 5 | G0 Y-2 6 | G0 X-0.5 7 | 8 | UP 9 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/B2OPEN.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 X-0.5 5 | G0 Y-2 6 | G0 X0.5 7 | 8 | UP 9 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/B3CLOSE.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 X0.5 Y-0.25 5 | G0 Y-0.5 6 | G0 X0.5 Y-0.25 7 | G0 X-0.5 Y-0.25 8 | G0 Y-0.5 9 | G0 X-0.5 Y-0.25 10 | 11 | UP 12 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/B3OPEN.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 X-0.5 Y-0.25 5 | G0 Y-0.5 6 | G0 X-0.5 Y-0.25 7 | G0 X0.5 Y-0.25 8 | G0 Y-0.5 9 | G0 X0.5 Y-0.25 10 | 11 | UP 12 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/BAR.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 Y-2 5 | 6 | UP 7 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/BSLASH.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 X1 Y-2 5 | 6 | UP -------------------------------------------------------------------------------- /ALPHABET/C.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y-2 6 | G0 X1 7 | 8 | UP -------------------------------------------------------------------------------- /ALPHABET/CARET.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1.5 2 | DOWN 3 | 4 | G0 X0.5 Y0.5 5 | G0 X0.5 Y-0.5 6 | 7 | UP 8 | G0 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET/COLON.NGC: -------------------------------------------------------------------------------- 1 | G0 X0.5 2 | DOWN 3 | 4 | G4 0.25 5 | UP 6 | G0 Y1 7 | DOWN 8 | G4 0.25 9 | 10 | UP 11 | G0 X0.5 Y-1 -------------------------------------------------------------------------------- /ALPHABET/COMMA.NGC: -------------------------------------------------------------------------------- 1 | G0 X0.5 2 | DOWN 3 | 4 | G0 Y-0.25 5 | 6 | UP 7 | G0 X0.5 Y0.25 -------------------------------------------------------------------------------- /ALPHABET/D.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 Y-1 5 | G0 X-1 Y-1 6 | 7 | UP 8 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/DOLLAR.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 Y-2 5 | UP 6 | G0 Y1.5 X0.5 7 | DOWN 8 | G0 X-1 9 | G0 Y-0.5 10 | G0 X1 11 | G0 Y-0.5 12 | G0 X-1 13 | 14 | UP 15 | G0 X1 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET/DOUBLEQ.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.3 2 | DOWN 3 | 4 | G0 Y-0.5 5 | UP 6 | G0 Y0.5 X0.3 7 | DOWN 8 | G0 Y-0.5 9 | 10 | UP 11 | G0 X0.4 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET/E.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y-1 6 | G0 X1 7 | G0 X-1 8 | G0 Y-1 9 | G0 X1 10 | 11 | UP -------------------------------------------------------------------------------- /ALPHABET/EQUAL.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1.5 2 | DOWN 3 | 4 | G0 X1 5 | UP 6 | G0 Y-1 7 | DOWN 8 | G0 X-1 9 | 10 | UP 11 | G0 X1 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET/EXCLAMATION.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 Y-1 5 | UP 6 | G0 Y-1 7 | DOWN 8 | G4 0.25 9 | 10 | UP 11 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/F.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y1 4 | G0 X1 5 | G0 X-1 6 | G0 Y1 7 | G0 X1 8 | 9 | UP 10 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/FSLASH.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X1 Y2 4 | 5 | UP 6 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/G.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y-2 6 | G0 X1 7 | G0 Y1 8 | G0 X-0.5 9 | 10 | UP 11 | G0 X0.5 Y-1 -------------------------------------------------------------------------------- /ALPHABET/GRAVE.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 X0.5 Y-0.5 5 | 6 | UP 7 | G0 X0.5 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET/GREATERTHAN.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1.5 X1 2 | DOWN 3 | 4 | G0 Y-0.5 X-1 5 | G0 Y-0.5 X1 6 | 7 | UP 8 | G0 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET/H.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 Y-1 5 | G0 X1 6 | G0 Y1 7 | G0 Y-2 8 | 9 | UP -------------------------------------------------------------------------------- /ALPHABET/HYPHEN.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 2 | DOWN 3 | 4 | G0 X1 5 | 6 | UP 7 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/I.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X1 4 | UP 5 | G0 Y2 6 | DOWN 7 | G0 X-1 8 | UP 9 | G0 X0.5 10 | DOWN 11 | G0 Y-2 12 | 13 | UP 14 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/J.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X1 2 | DOWN 3 | 4 | G0 Y-2 5 | G0 X-1 6 | G0 Y1 7 | 8 | UP 9 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET/K.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | UP 5 | G0 X1 6 | DOWN 7 | G0 Y-1 X-1 8 | G0 Y-1 X1 9 | 10 | UP -------------------------------------------------------------------------------- /ALPHABET/L.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 Y-2 5 | G0 X1 6 | 7 | UP -------------------------------------------------------------------------------- /ALPHABET/LESSTHAN.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1.5 2 | DOWN 3 | 4 | G0 Y-0.5 X1 5 | G0 Y-0.5 X-1 6 | 7 | UP 8 | G0 X1 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET/M.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X0.5 Y-1 5 | G0 X0.5 Y1 6 | G0 Y-2 7 | 8 | UP -------------------------------------------------------------------------------- /ALPHABET/N.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 Y-2 5 | G0 Y2 6 | 7 | UP 8 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/O.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 5 | G0 Y-2 6 | G0 X-1 7 | 8 | UP 9 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/P.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 5 | G0 Y-1 6 | G0 X-1 7 | 8 | UP 9 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET/PERCENT.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 X1 4 | UP 5 | G0 X-1 6 | DOWN 7 | G0 X0.25 8 | G0 Y-0.25 9 | G0 X-0.25 10 | G0 Y0.25 11 | UP 12 | G0 X0.75 Y-1.75 13 | DOWN 14 | G0 X0.25 15 | G0 Y-0.25 16 | G0 X-0.25 17 | G0 Y0.25 18 | UP 19 | 20 | UP 21 | G0 X0.25 Y-0.25 -------------------------------------------------------------------------------- /ALPHABET/PERIOD.NGC: -------------------------------------------------------------------------------- 1 | G0 X0.5 2 | DOWN 3 | 4 | G4 0.25 5 | 6 | UP 7 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/PLUS.NGC: -------------------------------------------------------------------------------- 1 | G0 Y0.5 X0.5 2 | DOWN 3 | 4 | G0 Y1 5 | UP 6 | G0 X-0.5 Y-0.5 7 | DOWN 8 | G0 X1 9 | 10 | UP 11 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/POUND.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.3 2 | DOWN 3 | 4 | G0 Y-2 5 | UP 6 | G0 Y2 X0.3 7 | DOWN 8 | G0 Y-2 9 | UP 10 | G0 Y1.2 X-0.6 11 | DOWN 12 | G0 X1 13 | UP 14 | G0 Y-0.6 X-1 15 | DOWN 16 | G0 X1 17 | 18 | UP 19 | G0 Y-0.6 -------------------------------------------------------------------------------- /ALPHABET/Q.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 5 | G0 Y-2 6 | G0 X-1 7 | UP 8 | G0 X0.5 Y0.5 9 | DOWN 10 | G0 X0.5 Y-0.5 11 | 12 | UP -------------------------------------------------------------------------------- /ALPHABET/QUESTION.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1.5 2 | DOWN 3 | 4 | G0 Y0.5 5 | G0 X1 6 | G0 Y-1 7 | G0 X-0.5 8 | G0 Y-0.5 9 | UP 10 | G0 Y-0.5 11 | DOWN 12 | G4 0.25 13 | 14 | UP 15 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/R.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | G0 X1 5 | G0 Y-1 6 | G0 X-1 7 | G0 X1 Y-1 8 | 9 | UP -------------------------------------------------------------------------------- /ALPHABET/S.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y-1 6 | G0 X1 7 | G0 Y-1 8 | G0 X-1 9 | 10 | UP 11 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/SEMICOLON.NGC: -------------------------------------------------------------------------------- 1 | G0 X0.5 2 | DOWN 3 | 4 | G0 Y-0.25 5 | UP 6 | G0 Y1.25 7 | DOWN 8 | G4 0.25 9 | 10 | UP 11 | G0 X0.5 Y-1 -------------------------------------------------------------------------------- /ALPHABET/SINGLEQ.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 X0.5 2 | DOWN 3 | 4 | G0 Y-0.5 5 | 6 | UP 7 | G0 X0.5 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET/SMALL_A.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 2 | DOWN 3 | 4 | G0 X1 5 | G0 Y-1 6 | G0 X-1 7 | G0 Y0.5 8 | G0 X1 9 | 10 | UP 11 | G0 Y-0.5 -------------------------------------------------------------------------------- /ALPHABET/SMALL_B.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 Y-2 5 | G0 X1 6 | G0 Y1 7 | G0 X-1 8 | 9 | UP 10 | G0 X1 Y-1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_C.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y-1 6 | G0 X1 7 | 8 | UP -------------------------------------------------------------------------------- /ALPHABET/SMALL_D.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y-1 6 | G0 X1 7 | G0 Y2 8 | 9 | UP 10 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/SMALL_E.NGC: -------------------------------------------------------------------------------- 1 | G0 Y0.5 2 | DOWN 3 | 4 | G0 X1 5 | G0 Y0.5 6 | G0 X-1 7 | G0 Y-1 8 | G0 X1 9 | 10 | UP -------------------------------------------------------------------------------- /ALPHABET/SMALL_F.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y1 4 | G0 X0.5 5 | G0 X-0.5 6 | G0 Y1 7 | G0 X0.5 8 | 9 | UP 10 | G0 X0.5 Y-2 -------------------------------------------------------------------------------- /ALPHABET/SMALL_G.NGC: -------------------------------------------------------------------------------- 1 | G0 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y1 6 | G0 X1 7 | G0 Y-2 8 | G0 X-1 9 | 10 | UP 11 | G0 X1 Y1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_H.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 Y-2 5 | UP 6 | G0 Y1 7 | DOWN 8 | G0 X1 9 | G0 Y-1 10 | 11 | UP -------------------------------------------------------------------------------- /ALPHABET/SMALL_I.NGC: -------------------------------------------------------------------------------- 1 | G0 X0.5 2 | DOWN 3 | 4 | G0 Y1 5 | UP 6 | G0 Y0.5 7 | DOWN 8 | G04 0.5 9 | 10 | UP 11 | G0 X0.5 Y-1.5 -------------------------------------------------------------------------------- /ALPHABET/SMALL_J.NGC: -------------------------------------------------------------------------------- 1 | G0 X1 Y1 2 | DOWN 3 | 4 | G0 Y-2 5 | G0 X-0.5 6 | 7 | UP 8 | G0 X0.5 Y1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_K.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 4 | UP 5 | G0 X0.5 Y-0.5 6 | DOWN 7 | G0 Y-0.5 X-0.5 8 | G0 Y-1 X1 9 | 10 | UP -------------------------------------------------------------------------------- /ALPHABET/SMALL_L.NGC: -------------------------------------------------------------------------------- 1 | G0 X0.5 2 | DOWN 3 | 4 | G0 Y2 5 | 6 | UP 7 | G0 X0.5 Y-2 -------------------------------------------------------------------------------- /ALPHABET/SMALL_M.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X0.25 Y1 4 | G0 X0.25 Y-1 5 | G0 X0.25 Y1 6 | G0 X0.25 Y-1 7 | 8 | UP -------------------------------------------------------------------------------- /ALPHABET/SMALL_N.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y1 4 | G0 X1 5 | G0 Y-1 6 | 7 | UP -------------------------------------------------------------------------------- /ALPHABET/SMALL_O.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 X1 4 | G0 Y1 5 | G0 X-1 6 | G0 Y-1 7 | 8 | UP 9 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_P.NGC: -------------------------------------------------------------------------------- 1 | G0 Y-1 2 | DOWN 3 | 4 | G0 Y2 5 | G0 X1 6 | G0 Y-1 7 | G0 X-1 8 | 9 | UP 10 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_Q.NGC: -------------------------------------------------------------------------------- 1 | G0 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y1 6 | G0 X1 7 | G0 Y-2 8 | 9 | UP 10 | G0 Y1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_R.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y1 4 | G0 X1 5 | 6 | UP 7 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_S.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 X1 2 | DOWN 3 | 4 | G0 X-1 5 | G0 Y-0.5 6 | G0 X1 7 | G0 Y-0.5 8 | G0 X-1 9 | 10 | UP 11 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_T.NGC: -------------------------------------------------------------------------------- 1 | G0 X0.5 2 | DOWN 3 | 4 | G0 Y2 5 | UP 6 | G0 X-0.25 Y-1 7 | DOWN 8 | G0 X0.5 9 | 10 | UP 11 | G0 X0.25 Y-1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_U.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 2 | DOWN 3 | 4 | G0 Y-1 5 | G0 X1 6 | G0 Y1 7 | 8 | UP 9 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_V.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 2 | DOWN 3 | 4 | G0 Y-1 X0.5 5 | G0 Y1 X0.5 6 | 7 | UP 8 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_W.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 2 | DOWN 3 | 4 | G0 Y-1 X0.25 5 | G0 Y1 X0.25 6 | G0 Y-1 X0.25 7 | G0 Y1 X0.25 8 | 9 | UP 10 | G0 Y-1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_X.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y1 X1 4 | UP 5 | G0 X-1 6 | DOWN 7 | G0 Y-1 X1 8 | 9 | UP -------------------------------------------------------------------------------- /ALPHABET/SMALL_Y.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 2 | DOWN 3 | 4 | G0 X0.5 Y-1 5 | UP 6 | G0 X0.5 Y1 7 | DOWN 8 | G0 X-1 Y-2 9 | 10 | UP 11 | G0 X1 Y1 -------------------------------------------------------------------------------- /ALPHABET/SMALL_Z.NGC: -------------------------------------------------------------------------------- 1 | G0 Y1 2 | DOWN 3 | 4 | G0 X1 5 | G0 X-1 Y-1 6 | G0 X1 7 | 8 | UP 9 | -------------------------------------------------------------------------------- /ALPHABET/SPACE.NGC: -------------------------------------------------------------------------------- 1 | G0 X1 -------------------------------------------------------------------------------- /ALPHABET/T.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 X1 5 | UP 6 | G0 X-0.5 7 | DOWN 8 | G0 Y-2 9 | 10 | UP 11 | G0 X0.5 -------------------------------------------------------------------------------- /ALPHABET/TILDE.NGC: -------------------------------------------------------------------------------- 1 | G0 Y0.75 2 | DOWN 3 | 4 | G0 Y0.5 X0.3 5 | G0 Y-0.5 X0.4 6 | G0 Y0.5 X0.3 7 | 8 | UP 9 | G0 Y-1.25 -------------------------------------------------------------------------------- /ALPHABET/U.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 Y-2 5 | G0 X1 6 | G0 Y2 7 | 8 | UP 9 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/UNDERSCORE.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | G0 X1 3 | UP -------------------------------------------------------------------------------- /ALPHABET/V.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 Y-2 X0.5 5 | G0 Y2 X0.5 6 | 7 | UP 8 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/W.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 Y-2 X0.25 5 | G0 Y1 X0.25 6 | G0 Y-1 X0.25 7 | G0 Y2 X0.25 8 | 9 | UP 10 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/X.NGC: -------------------------------------------------------------------------------- 1 | DOWN 2 | 3 | G0 Y2 X1 4 | UP 5 | G0 X-1 6 | DOWN 7 | G0 Y-2 X1 8 | 9 | UP -------------------------------------------------------------------------------- /ALPHABET/Y.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 Y-1 X0.5 5 | G0 Y-1 6 | UP 7 | G0 Y1 8 | DOWN 9 | G0 Y1 X0.5 10 | 11 | UP 12 | G0 Y-2 -------------------------------------------------------------------------------- /ALPHABET/Z.NGC: -------------------------------------------------------------------------------- 1 | G0 Y2 2 | DOWN 3 | 4 | G0 X1 5 | G0 X-1 Y-2 6 | G0 X1 7 | 8 | UP -------------------------------------------------------------------------------- /GcodeSender.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/GcodeSender.jar -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #GcodeSender 2 | 3 | This program will feed instructions to an serial device one line at a time. 4 | It waits for the ">" character from the device between each send. ">" is how the device tells the GcodeSender that the device is ready to receive more instructions. 5 | 6 | If you find this free program useful, please purchase parts for your robots from https://www.marginallyclever.com and tell your friends. Your support let us be more helpful. 7 | 8 | ## I just want to run it! 9 | 10 | ./java/GcodeSender.jar is compiled and should run. 11 | 12 | On most systems you can double click it to start. 13 | 14 | ##Drivers 15 | 16 | Need Arduino code that reads GCode and moves motors? Try [GCodeCNCDemo](https://github.com/MarginallyClever/gcodecncdemo). 17 | 18 | ##More 19 | 20 | For the latest version please visit [the repository](http://www.github.com/MarginallyClever/GcodeSender). 21 | 22 | For more information, please visit [the wiki](http://www.github.com/MarginallyClever/GcodeSender/wiki). 23 | 24 | For technical help, please visit [the forums](https://www.marginallyclever.com/forums). 25 | 26 | ##Author 27 | 28 | http://marginallyclever.com 29 | Dan Royer 30 | 2014-01-29 31 | 32 | -------------------------------------------------------------------------------- /antscript.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | /.DS_Store 2 | /GcodeSender/ 3 | -------------------------------------------------------------------------------- /bin/GcodeSender/GcodeSender$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/GcodeSender$1.class -------------------------------------------------------------------------------- /bin/GcodeSender/GcodeSender.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/GcodeSender.class -------------------------------------------------------------------------------- /bin/GcodeSender/Generators/GcodeGenerator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/Generators/GcodeGenerator.class -------------------------------------------------------------------------------- /bin/GcodeSender/Generators/HilbertCurveGenerator$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/Generators/HilbertCurveGenerator$1.class -------------------------------------------------------------------------------- /bin/GcodeSender/Generators/HilbertCurveGenerator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/Generators/HilbertCurveGenerator.class -------------------------------------------------------------------------------- /bin/GcodeSender/Generators/YourMessageHereGenerator$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/Generators/YourMessageHereGenerator$1.class -------------------------------------------------------------------------------- /bin/GcodeSender/Generators/YourMessageHereGenerator$Align.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/Generators/YourMessageHereGenerator$Align.class -------------------------------------------------------------------------------- /bin/GcodeSender/Generators/YourMessageHereGenerator$VAlign.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/Generators/YourMessageHereGenerator$VAlign.class -------------------------------------------------------------------------------- /bin/GcodeSender/Generators/YourMessageHereGenerator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/Generators/YourMessageHereGenerator.class -------------------------------------------------------------------------------- /bin/GcodeSender/SerialConnection.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/SerialConnection.class -------------------------------------------------------------------------------- /bin/GcodeSender/SerialConnectionReadyListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/SerialConnectionReadyListener.class -------------------------------------------------------------------------------- /bin/GcodeSender/StatusBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/bin/GcodeSender/StatusBar.class -------------------------------------------------------------------------------- /java/src/com/marginallyclever/gcodesender/GcodeSender.java: -------------------------------------------------------------------------------- 1 | package com.marginallyclever.gcodesender; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.Container; 5 | import java.awt.GridLayout; 6 | import java.awt.event.ActionEvent; 7 | import java.awt.event.ActionListener; 8 | import java.awt.event.KeyEvent; 9 | import java.awt.event.KeyListener; 10 | import java.io.BufferedReader; 11 | import java.io.File; 12 | import java.io.FileInputStream; 13 | import java.io.IOException; 14 | import java.io.InputStreamReader; 15 | import java.net.HttpURLConnection; 16 | import java.net.URL; 17 | import java.nio.charset.StandardCharsets; 18 | import java.util.ArrayList; 19 | import java.util.Arrays; 20 | import java.util.Scanner; 21 | import java.util.prefs.Preferences; 22 | 23 | import javax.swing.BoxLayout; 24 | import javax.swing.JButton; 25 | import javax.swing.JCheckBox; 26 | import javax.swing.JFileChooser; 27 | import javax.swing.JFrame; 28 | import javax.swing.JMenu; 29 | import javax.swing.JMenuBar; 30 | import javax.swing.JMenuItem; 31 | import javax.swing.JOptionPane; 32 | import javax.swing.JPanel; 33 | import javax.swing.JSplitPane; 34 | import javax.swing.JTextField; 35 | import javax.swing.KeyStroke; 36 | import javax.swing.filechooser.FileFilter; 37 | import javax.swing.filechooser.FileNameExtensionFilter; 38 | 39 | import com.marginallyclever.gcodesender.Generators.GcodeGenerator; 40 | import com.marginallyclever.gcodesender.Generators.HilbertCurveGenerator; 41 | import com.marginallyclever.gcodesender.Generators.YourMessageHereGenerator; 42 | 43 | 44 | /** 45 | * GcodeSender makes a serial connection to an arduino with adafruit motor shields. Each shield drives two stepper motors. 46 | * If a clock were drawn around the origin, The motors would be arranged at the 3:00, 7:00, and 11:00 positions. 47 | * 48 | * @author danroyer 49 | * 50 | */ 51 | public class GcodeSender 52 | extends JPanel 53 | implements ActionListener, KeyListener, SerialConnectionReadyListener 54 | { 55 | private static final long serialVersionUID=1; 56 | private static final String RECENT_FILES = "recent-files-"; 57 | 58 | private static String VERSION="1.1.0"; 59 | protected static GcodeSender singleton; 60 | 61 | // command line 62 | private JPanel textInputArea; 63 | private JTextField commandLineText; 64 | private JButton commandLineSend; 65 | 66 | // menus 67 | static private JFrame mainframe; 68 | private JMenuBar menuBar; 69 | private JMenuItem buttonOpenFile; 70 | private JMenuItem buttonExit; 71 | private JMenuItem [] buttonRecent = new JMenuItem[10]; 72 | private JMenuItem buttonRescan; 73 | private JMenuItem buttonDisconnect; 74 | private JMenuItem buttonStart; 75 | private JMenuItem buttonPause; 76 | private JMenuItem buttonHalt; 77 | private JMenuItem buttonAbout; 78 | private JMenuItem buttonCheckForUpdate; 79 | private StatusBar statusBar; 80 | 81 | // serial connections 82 | private final SerialConnection arduino; 83 | private boolean aReady; 84 | private boolean wasConfirmed; 85 | 86 | // settings 87 | private final Preferences prefs; 88 | private String[] recentFiles = {"","","","","","","","","",""}; 89 | 90 | public double [] len = new double[6]; 91 | 92 | // files 93 | private boolean running; 94 | private boolean paused=true; 95 | private boolean oneAtATime; 96 | private boolean loopForever; 97 | private long linesTotal; 98 | private long linesProcessed; 99 | private boolean fileOpened; 100 | private ArrayList gcode; 101 | 102 | // Generators 103 | private GcodeGenerator [] generators; 104 | private JMenuItem generatorButtons[]; 105 | 106 | 107 | public JFrame GetMainFrame() { 108 | return mainframe; 109 | } 110 | 111 | static public GcodeSender getSingleton() { 112 | if(singleton==null) singleton=new GcodeSender(); 113 | return singleton; 114 | } 115 | 116 | 117 | private GcodeSender() { 118 | prefs = Preferences.userRoot().node("GcodeSender"); 119 | 120 | loadConfig(); 121 | 122 | LoadGenerators(); 123 | 124 | arduino = new SerialConnection("Arduino"); 125 | arduino.addListener(this); 126 | } 127 | 128 | 129 | protected void LoadGenerators() { 130 | // TODO find the generator jar files and load them. 131 | generators = new GcodeGenerator[2]; 132 | generators[0] = new HilbertCurveGenerator(); 133 | generators[1] = new YourMessageHereGenerator(); 134 | 135 | generatorButtons = new JMenuItem[2]; 136 | } 137 | 138 | protected JMenu LoadGenerateMenu() { 139 | JMenu menu = new JMenu("Generate"); 140 | menu.setEnabled(!running); 141 | 142 | for(int i=0;i" 268 | +"

GcodeSender v"+VERSION+"

" 269 | +"

http://www.marginallyclever.com/

" 270 | +"

Created by Dan Royer (dan@marginallyclever.com).


" 271 | +"

To get the latest version please visit
https://github.com/MarginallyClever/GcodeSender


" 272 | +"

This program is open source and free. If this was helpful
to you, please buy me a thank you beer through Paypal.

" 273 | +""); 274 | return; 275 | } 276 | if( subject == buttonCheckForUpdate ) { 277 | checkForUpdate(); 278 | return; 279 | } 280 | 281 | int i; 282 | for(i=0;i<10;++i) { 283 | if(subject == buttonRecent[i]) { 284 | openFile(recentFiles[i]); 285 | return; 286 | } 287 | } 288 | } 289 | 290 | 291 | /** 292 | * Parse https://github.com/MarginallyClever/Makelangelo/releases/latest redirect notice 293 | * to find the latest release tag. 294 | */ 295 | public void checkForUpdate() { 296 | try { 297 | URL github = new URL("https://github.com/MarginallyClever/GCodeSender/releases/latest"); 298 | HttpURLConnection conn = (HttpURLConnection) github.openConnection(); 299 | conn.setInstanceFollowRedirects(false); //you still need to handle redirect manully. 300 | HttpURLConnection.setFollowRedirects(false); 301 | BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); 302 | 303 | String inputLine; 304 | if ((inputLine = in.readLine()) != null) { 305 | // parse the URL in the text-only redirect 306 | String matchStart = ""; 308 | int start = inputLine.indexOf(matchStart); 309 | int end = inputLine.indexOf(matchEnd); 310 | if (start != -1 && end != -1) { 311 | inputLine = inputLine.substring(start + matchStart.length(), end); 312 | // parse the last part of the redirect URL, which contains the release tag (which is the VERSION) 313 | inputLine = inputLine.substring(inputLine.lastIndexOf("/") + 1); 314 | 315 | System.out.println("last release: " + inputLine); 316 | System.out.println("your VERSION: " + VERSION); 317 | 318 | if (inputLine.compareTo(VERSION) > 0) { 319 | JOptionPane.showMessageDialog(null, "A new version of this software is available. The latest version is "+inputLine+"\n" 320 | +"Please visit http://www.marginallyclever.com/ to get the new hotness."); 321 | } else { 322 | JOptionPane.showMessageDialog(null, "This version is up to date."); 323 | } 324 | } 325 | } else { 326 | throw new Exception(); 327 | } 328 | in.close(); 329 | } catch (Exception e) { 330 | JOptionPane.showMessageDialog(null, "Sorry, I failed. Please visit http://www.marginallyclever.com/ to check yourself."); 331 | } 332 | } 333 | 334 | 335 | /** 336 | * stop sending commands to the robot. 337 | * @todo add an e-stop command? 338 | */ 339 | public void halt() { 340 | running=false; 341 | paused=false; 342 | linesProcessed=0; 343 | updateMenuBar(); 344 | } 345 | 346 | 347 | protected boolean inSendNow; 348 | /** 349 | * Take the next line from the file and send it to the robot, if permitted. 350 | */ 351 | public void sendFileCommand() { 352 | if(inSendNow || !running || paused || !fileOpened || !arduino.isPortOpened() || linesProcessed>=linesTotal) return; 353 | 354 | inSendNow=true; 355 | 356 | String line; 357 | do { 358 | // are there any more commands? 359 | line=gcode.get((int)linesProcessed).trim(); 360 | linesProcessed++; 361 | 362 | arduino.Log(">> "+line+"\n"); 363 | 364 | // loop until we find a line that gets sent to the robot, at which point we'll 365 | // pause for the robot to respond. Also stop at end of file. 366 | if( oneAtATime && line.length()>0 ) { 367 | int n = JOptionPane.showConfirmDialog(mainframe,line,"line "+linesProcessed,JOptionPane.OK_CANCEL_OPTION); 368 | if(n == JOptionPane.CANCEL_OPTION) { 369 | halt(); 370 | break; 371 | } 372 | } 373 | } while(!sendLineToRobot(line) && linesProcessed(); 459 | try { 460 | while (scanner.hasNextLine()) { 461 | gcode.add(scanner.nextLine()); 462 | ++linesTotal; 463 | } 464 | } 465 | finally{ 466 | scanner.close(); 467 | } 468 | } 469 | catch(IOException e) { 470 | removeRecentFile(filename); 471 | return; 472 | } 473 | 474 | fileOpened=true; 475 | updateRecentFiles(filename); 476 | 477 | halt(); 478 | } 479 | 480 | 481 | /** 482 | * changes the order of the recent files list in the File submenu, saves the updated prefs, and refreshes the menus. 483 | * @param filename the file to push to the top of the list. 484 | */ 485 | public void updateRecentFiles(String filename) { 486 | int cnt = recentFiles.length; 487 | String [] newFiles = new String[cnt]; 488 | 489 | newFiles[0]=filename; 490 | 491 | int i; 492 | int j=1; 493 | for(i=0;i0) ? filename=recentFiles[0] : ""; 550 | 551 | FileFilter filterImage = new FileNameExtensionFilter("Images (jpg/bmp/png/gif)", "jpg", "jpeg", "png", "wbmp", "bmp", "gif"); 552 | FileFilter filterGCODE = new FileNameExtensionFilter("GCODE files (ngc)", "ngc"); 553 | 554 | JFileChooser fc = new JFileChooser(new File(filename)); 555 | fc.addChoosableFileFilter(filterImage); 556 | fc.addChoosableFileFilter(filterGCODE); 557 | if(fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { 558 | openFile(fc.getSelectedFile().getAbsolutePath()); 559 | } 560 | } 561 | 562 | private void updateMenuBar() { 563 | JMenu menu; 564 | JMenu subMenu; 565 | 566 | if(menuBar != null) menuBar.removeAll(); 567 | 568 | menu = new JMenu("GCodeSender"); 569 | 570 | buttonAbout = new JMenuItem("About",KeyEvent.VK_A); 571 | buttonAbout.getAccessibleContext().setAccessibleDescription("About this program"); 572 | buttonAbout.addActionListener(this); 573 | menu.add(buttonAbout); 574 | 575 | 576 | buttonCheckForUpdate = new JMenuItem("Check for update",KeyEvent.VK_A); 577 | buttonCheckForUpdate.addActionListener(this); 578 | menu.add(buttonCheckForUpdate); 579 | 580 | buttonExit = new JMenuItem("Exit",KeyEvent.VK_Q); 581 | buttonExit.getAccessibleContext().setAccessibleDescription("Goodbye..."); 582 | buttonExit.addActionListener(this); 583 | menu.add(buttonExit); 584 | 585 | menuBar.add(menu); 586 | 587 | // connection menu 588 | menu = new JMenu("Connection"); 589 | menu.setMnemonic(KeyEvent.VK_T); 590 | menu.getAccessibleContext().setAccessibleDescription("Connection settings."); 591 | menu.setEnabled(!running); 592 | 593 | subMenu = arduino.getBaudMenu(); 594 | subMenu.setText("Speed"); 595 | menu.add(subMenu); 596 | 597 | subMenu = arduino.getPortMenu(); 598 | subMenu.setText("Port"); 599 | menu.add(subMenu); 600 | 601 | buttonRescan = new JMenuItem("Rescan Ports",KeyEvent.VK_N); 602 | buttonRescan.getAccessibleContext().setAccessibleDescription("Rescan the available ports."); 603 | buttonRescan.addActionListener(this); 604 | menu.add(buttonRescan); 605 | 606 | menu.addSeparator(); 607 | 608 | buttonDisconnect = new JMenuItem("Disconnect",KeyEvent.VK_A); 609 | buttonDisconnect.addActionListener(this); 610 | menu.add(buttonDisconnect); 611 | 612 | menuBar.add(menu); 613 | 614 | 615 | // file menu. 616 | menu = new JMenu("File"); 617 | menu.setMnemonic(KeyEvent.VK_F); 618 | menu.setEnabled(!running); 619 | menuBar.add(menu); 620 | 621 | buttonOpenFile = new JMenuItem("Open File...",KeyEvent.VK_O); 622 | buttonOpenFile.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.ALT_MASK)); 623 | buttonOpenFile.getAccessibleContext().setAccessibleDescription("Open a g-code file..."); 624 | buttonOpenFile.addActionListener(this); 625 | menu.add(buttonOpenFile); 626 | 627 | menu.addSeparator(); 628 | 629 | // list recent files 630 | getRecentFiles(); 631 | if(recentFiles.length>0) { 632 | // list files here 633 | int i; 634 | for(i=0;i0); 184 | turtleDx = (float)(newx/len); 185 | turtleDy = (float)(newy/len); 186 | } 187 | 188 | 189 | public void turtle_goForward(OutputStream output) throws IOException { 190 | output.write(("G0 X"+(turtleDx * turtleStep)+" Y"+(turtleDy * turtleStep)+"\n").getBytes(StandardCharsets.UTF_8)); 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /java/src/com/marginallyclever/gcodesender/Generators/YourMessageHereGenerator.java: -------------------------------------------------------------------------------- 1 | package com.marginallyclever.gcodesender.Generators; 2 | 3 | import java.awt.GridLayout; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.awt.geom.Rectangle2D; 7 | import java.io.BufferedReader; 8 | import java.io.File; 9 | import java.io.FileInputStream; 10 | import java.io.FileOutputStream; 11 | import java.io.IOException; 12 | import java.io.InputStreamReader; 13 | import java.io.OutputStreamWriter; 14 | import java.util.StringTokenizer; 15 | 16 | import javax.swing.Box; 17 | import javax.swing.JButton; 18 | import javax.swing.JDialog; 19 | import javax.swing.JLabel; 20 | import javax.swing.JScrollPane; 21 | import javax.swing.JTextArea; 22 | import javax.swing.JTextField; 23 | 24 | import com.marginallyclever.gcodesender.GcodeSender; 25 | 26 | public class YourMessageHereGenerator implements GcodeGenerator { 27 | private static final String G90 = "G90;\n"; 28 | private static final String G91 = "G91;\n"; 29 | 30 | // machine properties 31 | protected float feedRate =1800.0f; 32 | protected float feedRateRapid =8000.0f; 33 | protected float zUp =3.0f; 34 | protected float zDown =1.8f; 35 | protected float scale=1.0f; 36 | 37 | // font properties 38 | protected float kerning=0.20f; 39 | protected float letterWidth =1.0f; 40 | protected float letterHeight =2.0f; 41 | protected float lineSpacing =0.50f; 42 | protected float padding=0.20f; 43 | private static final String alphabetFolder = System.getProperty("user.dir") + "/" + "ALPHABET/"; 44 | protected String outputFile = System.getProperty("user.dir") + "/" + "TEMP.NGC"; 45 | protected int charsPerLine =35; 46 | protected String lastMessage = ""; 47 | 48 | // text position and alignment 49 | public enum VAlign { TOP, MIDDLE, BOTTOM }; 50 | public enum Align { LEFT, CENTER, RIGHT }; 51 | protected VAlign alignVertical = VAlign.MIDDLE; 52 | protected Align alignHorizontal = Align.CENTER; 53 | protected float posx; 54 | protected float posy; 55 | 56 | // debugging 57 | protected boolean drawBoundingBox = true; 58 | 59 | 60 | 61 | public String GetMenuName() { 62 | return "Your message here"; 63 | } 64 | 65 | 66 | public void Generate() { 67 | final JDialog driver = new JDialog(GcodeSender.getSingleton().GetMainFrame(),"Your Message Here",true); 68 | driver.setLayout(new GridLayout(0,1)); 69 | 70 | final JTextArea text = new JTextArea(lastMessage,40,4); 71 | 72 | driver.add(new JLabel("Message")); 73 | driver.add(new JScrollPane(text)); 74 | 75 | final JTextField fieldUp = new JTextField(Float.toString(zUp)); 76 | final JTextField fieldDown = new JTextField(Float.toString(zDown)); 77 | driver.add(new JLabel("Up")); driver.add(fieldUp); 78 | driver.add(new JLabel("Down")); driver.add(fieldDown); 79 | 80 | final JButton buttonSave = new JButton("Go"); 81 | final JButton buttonCancel = new JButton("Cancel"); 82 | Box horizontalBox = Box.createHorizontalBox(); 83 | horizontalBox.add(Box.createGlue()); 84 | horizontalBox.add(buttonSave); 85 | horizontalBox.add(buttonCancel); 86 | driver.add(horizontalBox); 87 | 88 | ActionListener driveButtons = new ActionListener() { 89 | public void actionPerformed(ActionEvent e) { 90 | Object subject = e.getSource(); 91 | 92 | if(subject == buttonSave) { 93 | zUp = Float.parseFloat(fieldUp.getText()); 94 | zDown = Float.parseFloat(fieldDown.getText()); 95 | lastMessage=text.getText(); 96 | TextCreateMessageNow(lastMessage); 97 | // open the file automatically to save a click. 98 | GcodeSender.getSingleton().openFile(outputFile); 99 | 100 | driver.dispose(); 101 | } 102 | if(subject == buttonCancel) { 103 | driver.dispose(); 104 | } 105 | } 106 | }; 107 | 108 | buttonSave.addActionListener(driveButtons); 109 | buttonCancel.addActionListener(driveButtons); 110 | 111 | driver.setSize(300,300); 112 | driver.setVisible(true); 113 | } 114 | 115 | 116 | protected String [] SplitForLength(String src) { 117 | String [] testLines = src.split(";\n"); 118 | int i; 119 | int j; 120 | 121 | int numLines = 0; 122 | for(i=0;i charsPerLine) { 124 | int x = (int)Math.ceil( (double)testLines[i].length() / (double) charsPerLine); 125 | numLines += x; 126 | } else { 127 | numLines++; 128 | } 129 | } 130 | 131 | String [] lines = new String[numLines]; 132 | j=0; 133 | for(i=0;i charsPerLine) { 139 | String [] temp = testLines[i].split("(?<=\\G.{"+ charsPerLine +"})"); 140 | for(int k=0;k0) { 217 | // newline 218 | output.write("G0 Y"+interline+";\n"); 219 | // carriage return 220 | output.write(G90); 221 | output.write("G0 X"+messageStart+";\n"); 222 | output.write(G91); 223 | } 224 | 225 | TextDrawLine(lines[i],output); 226 | } 227 | 228 | output.write(G90); 229 | liftPen(output); 230 | } 231 | 232 | 233 | protected void TextDrawLine(String a1,OutputStreamWriter output) throws IOException { 234 | 235 | int i; 236 | for(i=0;i': name="LESSTHAN"; break; 270 | case '?': name="QUESTION"; break; 271 | case '@': name="AT"; break; 272 | case '[': name="B2OPEN"; break; 273 | case ']': name="B2CLOSE"; break; 274 | case '^': name="CARET"; break; 275 | case '_': name="UNDERSCORE"; break; 276 | case '`': name="GRAVE"; break; 277 | case '{': name="B3OPEN"; break; 278 | case '|': name="BAR"; break; 279 | case '}': name="B3CLOSE"; break; 280 | case '~': name="TILDE"; break; 281 | case '\\': name="BSLASH"; break; 282 | case '�': name="SPACE"; break; 283 | default: name=Character.toString(letter); break; 284 | } 285 | } 286 | String fn = alphabetFolder + name + ".NGC"; 287 | 288 | if(new File(fn).isFile()) { 289 | if(i>0 && kerning!=0) { 290 | output.write("G0 X"+SX(kerning)+";\n"); 291 | } 292 | 293 | // file found. copy/paste it into the temp file 294 | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fn),"UTF-8")); 295 | 296 | String b; 297 | while ( (b = in.readLine()) != null ) { 298 | if(b.trim().length()==0) continue; 299 | if(b.equals("UP")) { 300 | output.write(G90); 301 | liftPen(output); 302 | output.write(G91); 303 | } else if(b.equals("DOWN")) { 304 | output.write(G90); 305 | lowerPen(output); 306 | output.write(G91); 307 | } else { 308 | StringTokenizer st = new StringTokenizer(b); 309 | String gap=""; 310 | while (st.hasMoreTokens()) { 311 | String c=st.nextToken(); 312 | if(c.startsWith("G")) { 313 | output.write(gap+c); 314 | } else if(c.startsWith("X")) { 315 | // translate coordinates 316 | float x = Float.parseFloat(c.substring(1)); // cm to mm 317 | output.write(gap+"X"+SX(x)); 318 | } else if(c.startsWith("Y")) { 319 | // translate coordinates 320 | float x = Float.parseFloat(c.substring(1)); // cm to mm 321 | output.write(gap+"Y"+SY(x)); 322 | } else { 323 | output.write(gap+c); 324 | } 325 | gap=" "; 326 | } 327 | output.write(";\n"); 328 | } 329 | } 330 | in.close(); 331 | } else { 332 | // file not found 333 | System.out.print(fn); 334 | System.out.println(" NOK"); 335 | } 336 | } 337 | } 338 | 339 | protected float TX(float x) { 340 | return SX(x-posx); 341 | } 342 | 343 | protected float TY(float y) { 344 | return SY(y-posy); 345 | } 346 | 347 | protected float SX(float x) { 348 | return x*scale; 349 | } 350 | 351 | protected float SY(float y) { 352 | return y*-scale; 353 | } 354 | 355 | protected void liftPen(OutputStreamWriter output) throws IOException { 356 | output.write("G0 F"+ feedRateRapid +" Z"+ zUp +";\n"); 357 | } 358 | 359 | protected void lowerPen(OutputStreamWriter output) throws IOException { 360 | output.write("G0 F"+ feedRate +" Z"+ zDown +";\n"); 361 | } 362 | 363 | 364 | public void TextSetPosition(float x,float y) { 365 | posx=x; 366 | posy=y; 367 | } 368 | 369 | public void TextSetAlign(Align x) { 370 | alignHorizontal = x; 371 | } 372 | 373 | public void TextSetVAlign(VAlign x) { 374 | alignVertical = x; 375 | } 376 | 377 | public void TextSetCharsPerLine(int numChars) { 378 | charsPerLine = numChars; 379 | } 380 | 381 | public void TextFindCharsPerLine(float width) { 382 | charsPerLine = (int)Math.floor( (float)(width - padding*2.0f) / (float)(letterWidth + kerning) ); 383 | } 384 | 385 | protected Rectangle2D TextCalculateBounds(String text) { 386 | String [] lines = TextWrapToLength(text); 387 | int len = TextLongestLine(lines); 388 | 389 | int numLines = lines.length; 390 | float h = padding*2 + ( letterHeight + lineSpacing) * numLines;//- line_spacing; removed because of letters that hang below the line 391 | float w = padding*2 + ( letterWidth + kerning ) * len - kerning; 392 | float xmax=0; 393 | float xmin=0; 394 | float ymax=0; 395 | float ymin=0; 396 | 397 | switch(alignHorizontal) { 398 | case LEFT: 399 | xmax=posx + w; 400 | xmin=posx; 401 | break; 402 | case CENTER: 403 | xmax = posx + w/2; 404 | xmin = posx - w/2; 405 | break; 406 | case RIGHT: 407 | xmax = posx; 408 | xmin = posx - w; 409 | break; 410 | default: 411 | assert(false); 412 | } 413 | 414 | switch(alignVertical) { 415 | case BOTTOM: 416 | ymax=posy + h; 417 | ymin=posy; 418 | break; 419 | case MIDDLE: 420 | ymax = posy + h/2; 421 | ymin = posy - h/2; 422 | break; 423 | case TOP: 424 | ymax = posy; 425 | ymin = posy - h; 426 | break; 427 | default: 428 | assert(false); 429 | } 430 | Rectangle2D r = new Rectangle2D.Float(); 431 | r.setRect((double)xmin, (double)ymin, (double)(xmax - xmin), (double)(ymax - ymin)); 432 | 433 | return r; 434 | } 435 | 436 | 437 | 438 | protected String [] TextWrapToLength(String src) { 439 | String [] testLines = src.split("\n"); 440 | int i,j; 441 | 442 | int numLines = 0; 443 | for(i=0;i charsPerLine) { 445 | int x = (int)Math.ceil( (double)testLines[i].length() / (double) charsPerLine); 446 | numLines += x; 447 | } else { 448 | numLines++; 449 | } 450 | } 451 | 452 | String [] lines = new String[numLines]; 453 | j=0; 454 | for(i=0;i charsPerLine) { 460 | String [] temp = testLines[i].split("(?<=\\G.{"+ charsPerLine +"})"); 461 | for(int k=0;k commandQueue = new ArrayList(); 57 | 58 | // Listeners which should be notified of a change to the percentage. 59 | private final ArrayList listeners = new ArrayList(); 60 | 61 | 62 | public SerialConnection(String name) { 63 | prefs = Preferences.userRoot().node("SerialConnection").node(name); 64 | 65 | DetectSerialPorts(); 66 | 67 | OpenPort(GetLastPort()); 68 | } 69 | 70 | public void finalize() { 71 | ClosePort(); 72 | } 73 | 74 | private String GetLastPort(){ 75 | return prefs.get(LAST_PORT,""); 76 | } 77 | 78 | private void SetLastPort(String portName) { 79 | prefs.put(LAST_PORT, portName); 80 | } 81 | 82 | private String GetLastBaud() { 83 | return prefs.get("last baud",BAUD_RATE); 84 | } 85 | 86 | private void SetLastBaud(String baud) { 87 | prefs.put(LAST_PORT, baud); 88 | } 89 | 90 | public void Log(String msg) { 91 | log.append(msg); 92 | log.setCaretPosition(log.getText().length()); 93 | } 94 | 95 | @Override 96 | public void serialEvent(SerialPortEvent events) { 97 | String rawInput; 98 | String oneLine; 99 | int x; 100 | 101 | if(events.isRXCHAR()) { 102 | if(!portOpened) return; 103 | try { 104 | int len = events.getEventValue(); 105 | byte [] buffer = serialPort.readBytes(len); 106 | if( len>0 ) { 107 | rawInput = new String(buffer,0,len, StandardCharsets.UTF_8); 108 | inputBuffer+=rawInput; 109 | // each line ends with a \n. 110 | for( x=inputBuffer.indexOf("\n"); x!=-1; x=inputBuffer.indexOf("\n") ) { 111 | x=x+1; 112 | oneLine = inputBuffer.substring(0,x); 113 | inputBuffer = inputBuffer.substring(x); 114 | 115 | // check for error 116 | int errorLine = errorReported(oneLine); 117 | if(errorLine != -1) { 118 | notifyLineError(errorLine); 119 | } else { 120 | // no error 121 | { 122 | notifyDataAvailable(oneLine); 123 | } 124 | } 125 | 126 | // wait for the cue to send another command 127 | if(oneLine.indexOf(CUE)==0) { 128 | waitingForCue=false; 129 | } 130 | } 131 | if(!waitingForCue) { 132 | sendQueuedCommand(); 133 | } 134 | } 135 | } catch (SerialPortException e) {} 136 | } 137 | } 138 | 139 | private void notifyLineError(int lineNumber) { 140 | for (SerialConnectionReadyListener listener : listeners) { 141 | listener.lineError(this,lineNumber); 142 | } 143 | } 144 | 145 | private void notifyConnectionReady() { 146 | for (SerialConnectionReadyListener listener : listeners) { 147 | listener.connectionReady(this); 148 | } 149 | } 150 | 151 | // tell all listeners data has arrived 152 | private void notifyDataAvailable(String line) { 153 | for (SerialConnectionReadyListener listener : listeners) { 154 | listener.dataAvailable(this,line); 155 | } 156 | } 157 | 158 | 159 | /** 160 | * Check if the robot reports an error and if so what line number. 161 | * 162 | * @return -1 if there was no error, otherwise the line number containing the error. 163 | */ 164 | protected int errorReported(String line) { 165 | if (line.lastIndexOf(NOCHECKSUM) != -1) { 166 | String afterError = line.substring(line.lastIndexOf(NOCHECKSUM) + NOCHECKSUM.length()); 167 | String x = getNumberPortion(afterError); 168 | int err = 0; 169 | try { 170 | err = Integer.decode(x); 171 | } catch (Exception e) { 172 | } 173 | 174 | return err; 175 | } 176 | if (line.lastIndexOf(BADCHECKSUM) != -1) { 177 | String afterError = line.substring(line.lastIndexOf(BADCHECKSUM) + BADCHECKSUM.length()); 178 | String x = getNumberPortion(afterError); 179 | int err = 0; 180 | try { 181 | err = Integer.decode(x); 182 | } catch (Exception e) { 183 | } 184 | 185 | return err; 186 | } 187 | if (line.lastIndexOf(BADLINENUM) != -1) { 188 | String afterError = line.substring(line.lastIndexOf(BADLINENUM) + BADLINENUM.length()); 189 | String x = getNumberPortion(afterError); 190 | int err = 0; 191 | try { 192 | err = Integer.decode(x); 193 | } catch (Exception e) { 194 | } 195 | 196 | return err; 197 | } 198 | 199 | return -1; 200 | } 201 | /** 202 | * Java string to int is very picky. this method is slightly less picky. Only works with positive whole numbers. 203 | * 204 | * @param src 205 | * @return the portion of the string that is actually a number 206 | */ 207 | private String getNumberPortion(String src) { 208 | src = src.trim(); 209 | int length = src.length(); 210 | StringBuilder result = new StringBuilder(); 211 | for (int i = 0; i < length; i++) { 212 | Character character = src.charAt(i); 213 | if (Character.isDigit(character)) { 214 | result.append(character); 215 | } 216 | } 217 | return result.toString(); 218 | } 219 | 220 | protected void sendQueuedCommand() { 221 | if(!portOpened || waitingForCue) return; 222 | 223 | if(commandQueue.size()==0) { 224 | notifyConnectionReady(); 225 | return; 226 | } 227 | 228 | String command; 229 | try { 230 | command=commandQueue.remove(0); 231 | if(!command.endsWith("\n")) command+="\n"; 232 | 233 | serialPort.writeBytes(command.getBytes(StandardCharsets.UTF_8)); 234 | waitingForCue=true; 235 | } 236 | catch(IndexOutOfBoundsException e1) {} 237 | catch(SerialPortException e2) {} 238 | } 239 | 240 | public void SendCommand(String command) { 241 | if(!portOpened) return; 242 | 243 | commandQueue.add(command); 244 | sendQueuedCommand(); 245 | } 246 | 247 | // Find all available serial ports for the settings->ports menu. 248 | public void DetectSerialPorts() { 249 | String OS = System.getProperty("os.name").toLowerCase(); 250 | 251 | if (OS.indexOf("mac") >= 0) { 252 | portsDetected = SerialPortList.getPortNames("/dev/"); 253 | //System.out.println("OS X"); 254 | } else if (OS.indexOf("win") >= 0) { 255 | portsDetected = SerialPortList.getPortNames("COM"); 256 | //System.out.println("Windows"); 257 | } else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0) { 258 | portsDetected = SerialPortList.getPortNames("/dev/"); 259 | //System.out.println("Linux/Unix"); 260 | } else { 261 | System.out.println("OS ERROR"); 262 | System.out.println("OS NAME=" + System.getProperty("os.name")); 263 | } 264 | } 265 | 266 | public boolean PortExists(String portName) { 267 | if(portName==null || portName.equals("")) return false; 268 | 269 | int i; 270 | for(i=0;iPort could not be configured:"+e.getMessage()+"\n"); 313 | return 3; 314 | } 315 | portOpened=true; 316 | SetLastPort(portName); 317 | Log("Connected."); 318 | 319 | return 0; 320 | } 321 | 322 | @Override 323 | public void actionPerformed(ActionEvent e) { 324 | Object subject = e.getSource(); 325 | 326 | int i; 327 | for(i=0;i 5 | 6 | with-dependencies 7 | false 8 | 9 | 10 | jar 11 | 12 | 13 | 14 | 15 | 16 | / 17 | true 18 | runtime 19 | true 20 | 21 | 22 | libgluegen-rt* 23 | libnativewindow_awt.* 24 | libnativewindow_macosx.* 25 | libnativewindow_x11.* 26 | libnewt.* 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/COPYING.LESSER: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/README.txt: -------------------------------------------------------------------------------- 1 | jSSC-2.6.0 Release version (01.06.2013) 2 | 3 | This version contains native libs for Windows(x86, x86-64), Linux(x86, x86-64, ARM soft & hard float), Solaris(x86, x86-64), Mac OS X(x86, x86-64, PPC, PPC64). 4 | All native libs contains in the jssc.jar file and you don't need manage native libs manually. 5 | 6 | In this build: 7 | 8 | Note: Linux x86 and x86-64 was builded on Ubuntu 10.04 and don't depends GLIBC-2.15 unlike jSSC-2.5.0 9 | 10 | Additions: 11 | * Added os.name - "Darwin" and os.arch - "universal" support. It can be useful for MacOS X developers. 12 | * Added ttyO to Linux RegExp for listing OMAP serial devices. 13 | * Added JSSC_IGNPAR and JSSC_PARMRK properties for enabling IGNPAR and PARMRK flags in _nix termios structure. 14 | 15 | With Best Regards, Sokolov Alexey aka scream3r. 16 | 17 | ============= Previous Builds ============== 18 | 19 | /////////////////////////////////////////// 20 | //jSSC-2.5.0 Release version (27.04.2013)// 21 | /////////////////////////////////////////// 22 | 23 | In this build: 24 | 25 | Fixes: 26 | * Important! Fixed bug with garbage reading on Linux, MacOSX, Solaris, cause of incorrect using of VMIN and VTIME. Now "read" methods works correctly and are blocking like in Windows 27 | * Important! Fixed error with garbage reading in Windows using jSSC after another application used serial port. To prevent this effect COMMTIMEOUTS structure zeroing added to setParams() method 28 | * Important! The port handle now stored in variable of type "long" instead of "int", to prevent potential problems with type conversions on Win64 29 | * Fixed MacOS X 10.8 bug with native lib loading (*.dylib -> *.jnilib) 30 | * Fixed Linux error with exclusive access to serial port (TIOCEXCL). TIOCNXCL added to closePort() method for clearing exclusive access 31 | * Fixed Windows native lib port name concatenation error 32 | * Fixed native lib extraction path if user home is read only, in this situation lib will be extracted to tmp folder 33 | * Null port name fix. If try to invoke method openPort() for SerialPort(null) object, exception TYPE_NULL_NOT_PERMITTED will be thrown 34 | * Enabled TIOCEXCL support in Solaris 35 | 36 | Additions: 37 | * Added ARM Soft & Hard float support (Tested of Raspberry Pi with Oracle JDK(6-7-8)) 38 | * Added ttyACM, ttyAMA, rfcomm to Linux RegExp and tty.usbmodem to MacOS X RegExp 39 | * Added precompiled RegExp's for Linux, Solaris, MacOS X for more faster port listing 40 | * Added private common for Linux, Solaris, MacOS X method getUnixBasedPortNames() for listing serial ports 41 | * Rewrited comparator for sorting port names. Now it's a common comparator for Windows, Linux, Solaris and MacOS X 42 | * Added some syntax sugar to SerialPortList class, for changing search path, RegExp and comparator 43 | * Added timeouts for read operations and SerialPortTimeoutException class for catching timeout exceptions 44 | * Added JSSC_NO_TIOCEXCL JVM property for disable using of exclusive access to serial port 45 | * Added termios(_nix) and DCB(Windows) structure cheking on port opening, it helps separate real serial devices from others 46 | * Added "ERR_" constants into SerialNativeInterface 47 | * Added new exception TYPE_INCORRECT_SERIAL_PORT 48 | * Added new exception TYPE_PERMISSION_DENIED. It can be very useful for _nix based system if user have no permissions for using serial device 49 | 50 | And other little modifications... 51 | 52 | /////////////////////////////////////////// 53 | //jSSC-0.9.0 Release version (21.12.2011)// 54 | /////////////////////////////////////////// 55 | 56 | In this build: 57 | * Added Solaris support (x86, x86-64) 58 | * Added Mac OS X support 10.5 and higher(x86, x86-64, PPC, PPC64) 59 | * Fixed some bugs in Linux native part 60 | * Changed openPort() method 61 | 62 | Important Note: 63 | openPort() method has been changed, now if port busy SerialPortException with type: TYPE_PORT_BUSY will be thrown, 64 | and if port not found SerialPortException with type: TYPE_PORT_NOT_FOUND will be thrown. 65 | 66 | It's possible to know that port is busy (TYPE_PORT_BUSY) by using TIOCEXCL directive in *nix native library, 67 | but using of this directive make some troubles in Solaris OS, that's why TIOCEXCL not used in Solaris (!) 68 | Be careful with it. 69 | 70 | Also Solaris and Mac OS X versions of jSSC not support following events: 71 | ERR, TXEMPTY, BREAK. 72 | 73 | Solaris version not support non standard baudrates 74 | Mac OS X version not support parity: MARK, SPACE. 75 | 76 | * Included javadoc and source codes 77 | 78 | ///////////////////////////////////////// 79 | //jSSC-0.8 Release version (28.11.2011)// 80 | ///////////////////////////////////////// 81 | 82 | In this build: 83 | * Implemented events BREAK and ERR (RXFLAG not supported in Linux) 84 | * Added method sendBreak(int duration) - send Break signal for setted time 85 | * Fixed bugs in Linux events listener 86 | * Fixed bug with long port closing operation in Linux 87 | 88 | ///////////////////////////// 89 | //jSSC-0.8-tb4 (21.11.2011)// 90 | ///////////////////////////// 91 | 92 | In this build was fixed a bug in getPortNames() method under Linux. 93 | 94 | Not implemented yet list: 95 | * Events: BREAK, ERR and RXFLAG 96 | 97 | ///////////////////////////// 98 | //jSSC-0.8-tb3 (09.09.2011)// 99 | ///////////////////////////// 100 | 101 | In this build was implemented: 102 | * purgePort() 103 | 104 | And was fixed some Linux and Windows lib bugs. 105 | 106 | New in this build: 107 | * getInputBufferBytesCount() - get count of bytes in input buffer (if error has occured -1 will be returned) 108 | * getOutputBufferBytesCount() - get count of bytes in output buffer (if error has occured -1 will be returned) 109 | * setFlowControlMode() - setting flow control (available: FLOWCONTROL_NONE, 110 | FLOWCONTROL_RTSCTS_IN, 111 | FLOWCONTROL_RTSCTS_OUT, 112 | FLOWCONTROL_XONXOFF_IN, 113 | FLOWCONTROL_XONXOFF_OUT) 114 | * getFlowControlMode() - getting setted flow control mode 115 | 116 | Some "syntactic sugar" for more usability: 117 | 118 | * writeByte() - write single byte 119 | * writeString() - write string 120 | * writeInt() - write int value (for example 0xFF) 121 | * writeIntArray - write int array (for example new int[]{0xFF, 0x00, 0xFF}) 122 | 123 | * readString(int byteCount) - read string 124 | * readHexString(int byteCount) - read Hex string with a space separator (for example "FF 00 FF") 125 | * readHexString(int byteCount, String separator) - read Hex string with setted separator (for example if separator : "FF:00:FF") 126 | * readHexStringArray(int byteCount) - read Hex string array (for example {FF, 00, FF}) 127 | * readIntArray(int byteCount) - read int array (values in int array are in range from 0 to 255 128 | for example if byte == -1 value in this array it will be 255) 129 | 130 | The following methods read all bytes in input buffer, if buffer is empty methods will return null 131 | 132 | * readBytes() 133 | * readString() 134 | * readHexString() 135 | * readHexString() 136 | * readHexStringArray() 137 | * readIntArray() 138 | 139 | ============================================ 140 | 141 | Not implemented yet list: 142 | * Events: BREAK, ERR and RXFLAG 143 | 144 | /////////////////////////////// 145 | // jSSC-0.8-tb2 (14.07.2011) // 146 | /////////////////////////////// 147 | 148 | In this build was implemented: 149 | * getPortNames() 150 | * Parity: MARK and SPACE 151 | 152 | And was fixed some Linux lib bugs. 153 | 154 | Not implemented yet list: 155 | * purgePort() 156 | * Events: BREAK, ERR and RXFLAG 157 | 158 | /////////////////////////////// 159 | // jSSC-0.8-tb1 (11.07.2011) // 160 | /////////////////////////////// 161 | 162 | Not implemented yet list: 163 | * getPortNames() 164 | * Parity: MARK and SPACE 165 | * purgePort() 166 | * Events: BREAK, ERR and RXFLAG 167 | -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/javadoc/jssc-2.6.0-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/libs/jSSC-2.6.0-Release/javadoc/jssc-2.6.0-javadoc.jar -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/jssc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/libs/jSSC-2.6.0-Release/jssc.jar -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/src/cpp/_nix_based/jssc.cpp: -------------------------------------------------------------------------------- 1 | /* jSSC (Java Simple Serial Connector) - serial port communication library. 2 | * © Alexey Sokolov (scream3r), 2010-2013. 3 | * 4 | * This file is part of jSSC. 5 | * 6 | * jSSC is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * jSSC is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with jSSC. If not, see . 18 | * 19 | * If you use jSSC in public project you can inform me about this by e-mail, 20 | * of course if you want it. 21 | * 22 | * e-mail: scream3r.org@gmail.com 23 | * web-site: http://scream3r.org | http://code.google.com/p/java-simple-serial-connector/ 24 | */ 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include //-D_TS_ERRNO use for Solaris C++ compiler 32 | 33 | #include //since 2.5.0 34 | 35 | #ifdef __linux__ 36 | #include 37 | #endif 38 | #ifdef __SunOS 39 | #include //Needed for FIONREAD in Solaris 40 | #include //Needed for select() function 41 | #endif 42 | #ifdef __APPLE__ 43 | #include //Needed for IOSSIOSPEED in Mac OS X (Non standard baudrate) 44 | #endif 45 | 46 | #include 47 | #include "../jssc_SerialNativeInterface.h" 48 | 49 | //#include //-lCstd use for Solaris linker 50 | 51 | 52 | /* OK */ 53 | /* 54 | * Port opening 55 | * 56 | * In 2.2.0 added useTIOCEXCL 57 | */ 58 | JNIEXPORT jlong JNICALL Java_jssc_SerialNativeInterface_openPort(JNIEnv *env, jobject object, jstring portName, jboolean useTIOCEXCL){ 59 | const char* port = env->GetStringUTFChars(portName, JNI_FALSE); 60 | jlong hComm = open(port, O_RDWR | O_NOCTTY | O_NDELAY); 61 | if(hComm != -1){ 62 | //since 2.2.0 -> (check termios structure for separating real serial devices from others) 63 | termios *settings = new termios(); 64 | if(tcgetattr(hComm, settings) == 0){ 65 | #if defined TIOCEXCL //&& !defined __SunOS 66 | if(useTIOCEXCL == JNI_TRUE){ 67 | ioctl(hComm, TIOCEXCL); 68 | } 69 | #endif 70 | int flags = fcntl(hComm, F_GETFL, 0); 71 | flags &= ~O_NDELAY; 72 | fcntl(hComm, F_SETFL, flags); 73 | } 74 | else { 75 | hComm = jssc_SerialNativeInterface_ERR_INCORRECT_SERIAL_PORT;//-4; 76 | } 77 | delete settings; 78 | //<- since 2.2.0 79 | } 80 | else {//since 0.9 -> 81 | if(errno == EBUSY){//Port busy 82 | hComm = jssc_SerialNativeInterface_ERR_PORT_BUSY;//-1 83 | } 84 | else if(errno == ENOENT){//Port not found 85 | hComm = jssc_SerialNativeInterface_ERR_PORT_NOT_FOUND;//-2; 86 | }//-> since 2.2.0 87 | else if(errno == EACCES){//Permission denied 88 | hComm = jssc_SerialNativeInterface_ERR_PERMISSION_DENIED;//-3; 89 | } 90 | else { 91 | hComm = jssc_SerialNativeInterface_ERR_PORT_NOT_FOUND;//-2; 92 | }//<- since 2.2.0 93 | }//<- since 0.9 94 | env->ReleaseStringUTFChars(portName, port); 95 | return hComm; 96 | } 97 | 98 | /* OK */ 99 | /* 100 | * Choose baudrate 101 | */ 102 | speed_t getBaudRateByNum(jint baudRate) { 103 | switch(baudRate){ 104 | case 0: 105 | return B0; 106 | case 50: 107 | return B50; 108 | case 75: 109 | return B75; 110 | case 110: 111 | return B110; 112 | case 134: 113 | return B134; 114 | case 150: 115 | return B150; 116 | case 200: 117 | return B200; 118 | case 300: 119 | return B300; 120 | case 600: 121 | return B600; 122 | case 1200: 123 | return B1200; 124 | case 1800: 125 | return B1800; 126 | case 2400: 127 | return B2400; 128 | case 4800: 129 | return B4800; 130 | case 9600: 131 | return B9600; 132 | case 19200: 133 | return B19200; 134 | case 38400: 135 | return B38400; 136 | #ifdef B57600 137 | case 57600: 138 | return B57600; 139 | #endif 140 | #ifdef B115200 141 | case 115200: 142 | return B115200; 143 | #endif 144 | #ifdef B230400 145 | case 230400: 146 | return B230400; 147 | #endif 148 | #ifdef B460800 149 | case 460800: 150 | return B460800; 151 | #endif 152 | 153 | #ifdef B500000 154 | case 500000: 155 | return B500000; 156 | #endif 157 | #ifdef B576000 158 | case 576000: 159 | return B576000; 160 | #endif 161 | #ifdef B921600 162 | case 921600: 163 | return B921600; 164 | #endif 165 | #ifdef B1000000 166 | case 1000000: 167 | return B1000000; 168 | #endif 169 | 170 | #ifdef B1152000 171 | case 1152000: 172 | return B1152000; 173 | #endif 174 | #ifdef B1500000 175 | case 1500000: 176 | return B1500000; 177 | #endif 178 | #ifdef B2000000 179 | case 2000000: 180 | return B2000000; 181 | #endif 182 | #ifdef B2500000 183 | case 2500000: 184 | return B2500000; 185 | #endif 186 | 187 | #ifdef B3000000 188 | case 3000000: 189 | return B3000000; 190 | #endif 191 | #ifdef B3500000 192 | case 3500000: 193 | return B3500000; 194 | #endif 195 | #ifdef B4000000 196 | case 4000000: 197 | return B4000000; 198 | #endif 199 | default: 200 | return -1; 201 | } 202 | } 203 | 204 | /* OK */ 205 | /* 206 | * Choose data bits 207 | */ 208 | int getDataBitsByNum(jint byteSize) { 209 | switch(byteSize){ 210 | case 5: 211 | return CS5; 212 | case 6: 213 | return CS6; 214 | case 7: 215 | return CS7; 216 | case 8: 217 | return CS8; 218 | default: 219 | return -1; 220 | } 221 | } 222 | 223 | //since 2.6.0 -> 224 | const jint PARAMS_FLAG_IGNPAR = 1; 225 | const jint PARAMS_FLAG_PARMRK = 2; 226 | //<- since 2.6.0 227 | 228 | /* OK */ 229 | /* 230 | * Set serial port settings 231 | * 232 | * In 2.6.0 added flags parameter 233 | */ 234 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setParams 235 | (JNIEnv *env, jobject object, jlong portHandle, jint baudRate, jint byteSize, jint stopBits, jint parity, jboolean setRTS, jboolean setDTR, jint flags){ 236 | jboolean returnValue = JNI_FALSE; 237 | 238 | speed_t baudRateValue = getBaudRateByNum(baudRate); 239 | int dataBits = getDataBitsByNum(byteSize); 240 | 241 | termios *settings = new termios(); 242 | if(tcgetattr(portHandle, settings) == 0){ 243 | if(baudRateValue != -1){ 244 | //Set standart baudrate from "termios.h" 245 | if(cfsetispeed(settings, baudRateValue) < 0 || cfsetospeed(settings, baudRateValue) < 0){ 246 | goto methodEnd; 247 | } 248 | } 249 | else { 250 | #ifdef __SunOS 251 | goto methodEnd;//Solaris don't support non standart baudrates 252 | #elif defined __linux__ 253 | //Try to calculate a divisor for setting non standart baudrate 254 | serial_struct *serial_info = new serial_struct(); 255 | if(ioctl(portHandle, TIOCGSERIAL, serial_info) < 0){ //Getting serial_info structure 256 | delete serial_info; 257 | goto methodEnd; 258 | } 259 | else { 260 | serial_info->flags |= ASYNC_SPD_CUST; 261 | serial_info->custom_divisor = (serial_info->baud_base/baudRate); //Calculate divisor 262 | if(serial_info->custom_divisor == 0){ //If divisor == 0 go to method end to prevent "division by zero" error 263 | delete serial_info; 264 | goto methodEnd; 265 | } 266 | settings->c_cflag |= B38400; 267 | if(cfsetispeed(settings, B38400) < 0 || cfsetospeed(settings, B38400) < 0){ 268 | delete serial_info; 269 | goto methodEnd; 270 | } 271 | if(ioctl(portHandle, TIOCSSERIAL, serial_info) < 0){//Try to set new settings with non standart baudrate 272 | delete serial_info; 273 | goto methodEnd; 274 | } 275 | delete serial_info; 276 | } 277 | #endif 278 | } 279 | } 280 | 281 | /* 282 | * Setting data bits 283 | */ 284 | if(dataBits != -1){ 285 | settings->c_cflag &= ~CSIZE; 286 | settings->c_cflag |= dataBits; 287 | } 288 | else { 289 | goto methodEnd; 290 | } 291 | 292 | /* 293 | * Setting stop bits 294 | */ 295 | if(stopBits == 0){ //1 stop bit (for info see ->> MSDN) 296 | settings->c_cflag &= ~CSTOPB; 297 | } 298 | else if((stopBits == 1) || (stopBits == 2)){ //1 == 1.5 stop bits; 2 == 2 stop bits (for info see ->> MSDN) 299 | settings->c_cflag |= CSTOPB; 300 | } 301 | else { 302 | goto methodEnd; 303 | } 304 | 305 | settings->c_cflag |= (CREAD | CLOCAL); 306 | settings->c_cflag &= ~CRTSCTS; 307 | settings->c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ECHOCTL | ECHOPRT | ECHOKE | ISIG | IEXTEN); 308 | 309 | settings->c_iflag &= ~(IXON | IXOFF | IXANY | INPCK | IGNPAR | PARMRK | ISTRIP | IGNBRK | BRKINT | INLCR | IGNCR| ICRNL); 310 | #ifdef IUCLC 311 | settings->c_iflag &= ~IUCLC; 312 | #endif 313 | settings->c_oflag &= ~OPOST; 314 | 315 | //since 2.6.0 -> 316 | if((flags & PARAMS_FLAG_IGNPAR) == PARAMS_FLAG_IGNPAR){ 317 | settings->c_iflag |= IGNPAR; 318 | } 319 | if((flags & PARAMS_FLAG_PARMRK) == PARAMS_FLAG_PARMRK){ 320 | settings->c_iflag |= PARMRK; 321 | } 322 | //<- since 2.6.0 323 | 324 | //since 0.9 -> 325 | settings->c_cc[VMIN] = 0; 326 | settings->c_cc[VTIME] = 0; 327 | //<- since 0.9 328 | 329 | /* 330 | * Parity bits 331 | */ 332 | #ifdef PAREXT 333 | settings->c_cflag &= ~(PARENB | PARODD | PAREXT);//Clear parity settings 334 | #elif defined CMSPAR 335 | settings->c_cflag &= ~(PARENB | PARODD | CMSPAR);//Clear parity settings 336 | #else 337 | settings->c_cflag &= ~(PARENB | PARODD);//Clear parity settings 338 | #endif 339 | if(parity == 1){//Parity ODD 340 | settings->c_cflag |= (PARENB | PARODD); 341 | settings->c_iflag |= INPCK; 342 | } 343 | else if(parity == 2){//Parity EVEN 344 | settings->c_cflag |= PARENB; 345 | settings->c_iflag |= INPCK; 346 | } 347 | else if(parity == 3){//Parity MARK 348 | #ifdef PAREXT 349 | settings->c_cflag |= (PARENB | PARODD | PAREXT); 350 | settings->c_iflag |= INPCK; 351 | #elif defined CMSPAR 352 | settings->c_cflag |= (PARENB | PARODD | CMSPAR); 353 | settings->c_iflag |= INPCK; 354 | #endif 355 | } 356 | else if(parity == 4){//Parity SPACE 357 | #ifdef PAREXT 358 | settings->c_cflag |= (PARENB | PAREXT); 359 | settings->c_iflag |= INPCK; 360 | #elif defined CMSPAR 361 | settings->c_cflag |= (PARENB | CMSPAR); 362 | settings->c_iflag |= INPCK; 363 | #endif 364 | } 365 | else if(parity == 0){ 366 | //Do nothing (Parity NONE) 367 | } 368 | else { 369 | goto methodEnd; 370 | } 371 | 372 | if(tcsetattr(portHandle, TCSANOW, settings) == 0){//Try to set all settings 373 | #ifdef __APPLE__ 374 | //Try to set non-standard baud rate in Mac OS X 375 | if(baudRateValue == -1){ 376 | speed_t speed = (speed_t)baudRate; 377 | if(ioctl(portHandle, IOSSIOSPEED, &speed) < 0){//IOSSIOSPEED must be used only after tcsetattr 378 | goto methodEnd; 379 | } 380 | } 381 | #endif 382 | int lineStatus; 383 | if(ioctl(portHandle, TIOCMGET, &lineStatus) >= 0){ 384 | if(setRTS == JNI_TRUE){ 385 | lineStatus |= TIOCM_RTS; 386 | } 387 | else { 388 | lineStatus &= ~TIOCM_RTS; 389 | } 390 | if(setDTR == JNI_TRUE){ 391 | lineStatus |= TIOCM_DTR; 392 | } 393 | else { 394 | lineStatus &= ~TIOCM_DTR; 395 | } 396 | if(ioctl(portHandle, TIOCMSET, &lineStatus) >= 0){ 397 | returnValue = JNI_TRUE; 398 | } 399 | } 400 | } 401 | methodEnd: { 402 | delete settings; 403 | return returnValue; 404 | } 405 | } 406 | 407 | const jint PURGE_RXABORT = 0x0002; //ignored 408 | const jint PURGE_RXCLEAR = 0x0008; 409 | const jint PURGE_TXABORT = 0x0001; //ignored 410 | const jint PURGE_TXCLEAR = 0x0004; 411 | 412 | /* OK */ 413 | /* 414 | * PurgeComm 415 | */ 416 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_purgePort 417 | (JNIEnv *env, jobject object, jlong portHandle, jint flags){ 418 | int clearValue = -1; 419 | if((flags & PURGE_RXCLEAR) && (flags & PURGE_TXCLEAR)){ 420 | clearValue = TCIOFLUSH; 421 | } 422 | else if(flags & PURGE_RXCLEAR) { 423 | clearValue = TCIFLUSH; 424 | } 425 | else if(flags & PURGE_TXCLEAR) { 426 | clearValue = TCOFLUSH; 427 | } 428 | else if((flags & PURGE_RXABORT) || (flags & PURGE_TXABORT)){ 429 | return JNI_TRUE; 430 | } 431 | else { 432 | return JNI_FALSE; 433 | } 434 | return tcflush(portHandle, clearValue) == 0 ? JNI_TRUE : JNI_FALSE; 435 | } 436 | 437 | /* OK */ 438 | /* Closing the port */ 439 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_closePort 440 | (JNIEnv *env, jobject object, jlong portHandle){ 441 | #if defined TIOCNXCL //&& !defined __SunOS 442 | ioctl(portHandle, TIOCNXCL);//since 2.1.0 Clear exclusive port access on closing 443 | #endif 444 | return close(portHandle) == 0 ? JNI_TRUE : JNI_FALSE; 445 | } 446 | 447 | /* OK */ 448 | /* 449 | * Setting events mask 450 | */ 451 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setEventsMask 452 | (JNIEnv *env, jobject object, jlong portHandle, jint mask){ 453 | //Don't needed in linux, implemented in java code 454 | return JNI_TRUE; 455 | } 456 | 457 | /* OK */ 458 | /* 459 | * Getting events mask 460 | */ 461 | JNIEXPORT jint JNICALL Java_jssc_SerialNativeInterface_getEventsMask 462 | (JNIEnv *env, jobject object, jlong portHandle){ 463 | //Don't needed in linux, implemented in java code 464 | return -1; 465 | } 466 | 467 | /* OK */ 468 | /* 469 | * RTS line status changing (ON || OFF) 470 | */ 471 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setRTS 472 | (JNIEnv *env, jobject object, jlong portHandle, jboolean enabled){ 473 | int returnValue = 0; 474 | int lineStatus; 475 | ioctl(portHandle, TIOCMGET, &lineStatus); 476 | if(enabled == JNI_TRUE){ 477 | lineStatus |= TIOCM_RTS; 478 | } 479 | else { 480 | lineStatus &= ~TIOCM_RTS; 481 | } 482 | returnValue = ioctl(portHandle, TIOCMSET, &lineStatus); 483 | return (returnValue >= 0 ? JNI_TRUE : JNI_FALSE); 484 | } 485 | 486 | /* OK */ 487 | /* 488 | * DTR line status changing (ON || OFF) 489 | */ 490 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setDTR 491 | (JNIEnv *env, jobject object, jlong portHandle, jboolean enabled){ 492 | int returnValue = 0; 493 | int lineStatus; 494 | ioctl(portHandle, TIOCMGET, &lineStatus); 495 | if(enabled == JNI_TRUE){ 496 | lineStatus |= TIOCM_DTR; 497 | } 498 | else { 499 | lineStatus &= ~TIOCM_DTR; 500 | } 501 | returnValue = ioctl(portHandle, TIOCMSET, &lineStatus); 502 | return (returnValue >= 0 ? JNI_TRUE : JNI_FALSE); 503 | } 504 | 505 | /* OK */ 506 | /* 507 | * Writing data to the port 508 | */ 509 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_writeBytes 510 | (JNIEnv *env, jobject object, jlong portHandle, jbyteArray buffer){ 511 | jbyte* jBuffer = env->GetByteArrayElements(buffer, JNI_FALSE); 512 | jint bufferSize = env->GetArrayLength(buffer); 513 | jint result = write(portHandle, jBuffer, (size_t)bufferSize); 514 | env->ReleaseByteArrayElements(buffer, jBuffer, 0); 515 | return result == bufferSize ? JNI_TRUE : JNI_FALSE; 516 | } 517 | 518 | /* OK */ 519 | /* 520 | * Reading data from the port 521 | * 522 | * Rewrited in 2.5.0 (using select() function for correct block reading in MacOS X) 523 | */ 524 | JNIEXPORT jbyteArray JNICALL Java_jssc_SerialNativeInterface_readBytes 525 | (JNIEnv *env, jobject object, jlong portHandle, jint byteCount){ 526 | fd_set read_fd_set; 527 | jbyte *lpBuffer = new jbyte[byteCount]; 528 | int byteRemains = byteCount; 529 | while(byteRemains > 0) { 530 | FD_ZERO(&read_fd_set); 531 | FD_SET(portHandle, &read_fd_set); 532 | select(portHandle + 1, &read_fd_set, NULL, NULL, NULL); 533 | int result = read(portHandle, lpBuffer + (byteCount - byteRemains), byteRemains); 534 | if(result > 0){ 535 | byteRemains -= result; 536 | } 537 | } 538 | FD_CLR(portHandle, &read_fd_set); 539 | jbyteArray returnArray = env->NewByteArray(byteCount); 540 | env->SetByteArrayRegion(returnArray, 0, byteCount, lpBuffer); 541 | delete lpBuffer; 542 | return returnArray; 543 | } 544 | 545 | /* OK */ 546 | /* 547 | * Get bytes count in serial port buffers (Input and Output) 548 | */ 549 | JNIEXPORT jintArray JNICALL Java_jssc_SerialNativeInterface_getBuffersBytesCount 550 | (JNIEnv *env, jobject object, jlong portHandle){ 551 | jint returnValues[2]; 552 | returnValues[0] = -1; //Input buffer 553 | returnValues[1] = -1; //Output buffer 554 | jintArray returnArray = env->NewIntArray(2); 555 | ioctl(portHandle, FIONREAD, &returnValues[0]); 556 | ioctl(portHandle, TIOCOUTQ, &returnValues[1]); 557 | env->SetIntArrayRegion(returnArray, 0, 2, returnValues); 558 | return returnArray; 559 | } 560 | 561 | const jint FLOWCONTROL_NONE = 0; 562 | const jint FLOWCONTROL_RTSCTS_IN = 1; 563 | const jint FLOWCONTROL_RTSCTS_OUT = 2; 564 | const jint FLOWCONTROL_XONXOFF_IN = 4; 565 | const jint FLOWCONTROL_XONXOFF_OUT = 8; 566 | 567 | /* OK */ 568 | /* 569 | * Setting flow control mode 570 | */ 571 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setFlowControlMode 572 | (JNIEnv *env, jobject object, jlong portHandle, jint mask){ 573 | jboolean returnValue = JNI_FALSE; 574 | termios *settings = new termios(); 575 | if(tcgetattr(portHandle, settings) == 0){ 576 | settings->c_cflag &= ~CRTSCTS; 577 | settings->c_iflag &= ~(IXON | IXOFF); 578 | if(mask != FLOWCONTROL_NONE){ 579 | if(((mask & FLOWCONTROL_RTSCTS_IN) == FLOWCONTROL_RTSCTS_IN) || ((mask & FLOWCONTROL_RTSCTS_OUT) == FLOWCONTROL_RTSCTS_OUT)){ 580 | settings->c_cflag |= CRTSCTS; 581 | } 582 | if((mask & FLOWCONTROL_XONXOFF_IN) == FLOWCONTROL_XONXOFF_IN){ 583 | settings->c_iflag |= IXOFF; 584 | } 585 | if((mask & FLOWCONTROL_XONXOFF_OUT) == FLOWCONTROL_XONXOFF_OUT){ 586 | settings->c_iflag |= IXON; 587 | } 588 | } 589 | if(tcsetattr(portHandle, TCSANOW, settings) == 0){ 590 | returnValue = JNI_TRUE; 591 | } 592 | } 593 | delete settings; 594 | return returnValue; 595 | } 596 | 597 | /* OK */ 598 | /* 599 | * Getting flow control mode 600 | */ 601 | JNIEXPORT jint JNICALL Java_jssc_SerialNativeInterface_getFlowControlMode 602 | (JNIEnv *env, jobject object, jlong portHandle){ 603 | jint returnValue = 0; 604 | termios *settings = new termios(); 605 | if(tcgetattr(portHandle, settings) == 0){ 606 | if(settings->c_cflag & CRTSCTS){ 607 | returnValue |= (FLOWCONTROL_RTSCTS_IN | FLOWCONTROL_RTSCTS_OUT); 608 | } 609 | if(settings->c_iflag & IXOFF){ 610 | returnValue |= FLOWCONTROL_XONXOFF_IN; 611 | } 612 | if(settings->c_iflag & IXON){ 613 | returnValue |= FLOWCONTROL_XONXOFF_OUT; 614 | } 615 | } 616 | return returnValue; 617 | } 618 | 619 | /* OK */ 620 | /* 621 | * Send break for setted duration 622 | */ 623 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_sendBreak 624 | (JNIEnv *env, jobject object, jlong portHandle, jint duration){ 625 | jboolean returnValue = JNI_FALSE; 626 | if(duration > 0){ 627 | if(ioctl(portHandle, TIOCSBRK, 0) >= 0){ 628 | int sec = (duration >= 1000 ? duration/1000 : 0); 629 | int nanoSec = (sec > 0 ? duration - sec*1000 : duration)*1000000; 630 | struct timespec *timeStruct = new timespec(); 631 | timeStruct->tv_sec = sec; 632 | timeStruct->tv_nsec = nanoSec; 633 | nanosleep(timeStruct, NULL); 634 | delete(timeStruct); 635 | if(ioctl(portHandle, TIOCCBRK, 0) >= 0){ 636 | returnValue = JNI_TRUE; 637 | } 638 | } 639 | } 640 | return returnValue; 641 | } 642 | 643 | /* OK */ 644 | /* 645 | * Return "statusLines" from ioctl(portHandle, TIOCMGET, &statusLines) 646 | * Need for "_waitEvents" and "_getLinesStatus" 647 | */ 648 | int getLinesStatus(jlong portHandle) { 649 | int statusLines; 650 | ioctl(portHandle, TIOCMGET, &statusLines); 651 | return statusLines; 652 | } 653 | 654 | /* OK */ 655 | /* 656 | * Not supported in Solaris and Mac OS X 657 | * 658 | * Get interrupts count for: 659 | * 0 - Break(for BREAK event) 660 | * 1 - TX(for TXEMPTY event) 661 | * --ERRORS(for ERR event)-- 662 | * 2 - Frame 663 | * 3 - Overrun 664 | * 4 - Parity 665 | */ 666 | void getInterruptsCount(jlong portHandle, int intArray[]) { 667 | #ifdef TIOCGICOUNT 668 | struct serial_icounter_struct *icount = new serial_icounter_struct(); 669 | if(ioctl(portHandle, TIOCGICOUNT, icount) >= 0){ 670 | intArray[0] = icount->brk; 671 | intArray[1] = icount->tx; 672 | intArray[2] = icount->frame; 673 | intArray[3] = icount->overrun; 674 | intArray[4] = icount->parity; 675 | } 676 | delete icount; 677 | #endif 678 | } 679 | 680 | const jint INTERRUPT_BREAK = 512; 681 | const jint INTERRUPT_TX = 1024; 682 | const jint INTERRUPT_FRAME = 2048; 683 | const jint INTERRUPT_OVERRUN = 4096; 684 | const jint INTERRUPT_PARITY = 8192; 685 | 686 | const jint EV_CTS = 8; 687 | const jint EV_DSR = 16; 688 | const jint EV_RING = 256; 689 | const jint EV_RLSD = 32; 690 | const jint EV_RXCHAR = 1; 691 | //const jint EV_RXFLAG = 2; //Not supported 692 | const jint EV_TXEMPTY = 4; 693 | const jint events[] = {INTERRUPT_BREAK, 694 | INTERRUPT_TX, 695 | INTERRUPT_FRAME, 696 | INTERRUPT_OVERRUN, 697 | INTERRUPT_PARITY, 698 | EV_CTS, 699 | EV_DSR, 700 | EV_RING, 701 | EV_RLSD, 702 | EV_RXCHAR, 703 | //EV_RXFLAG, //Not supported 704 | EV_TXEMPTY}; 705 | 706 | /* OK */ 707 | /* 708 | * Collecting data for EventListener class (Linux have no implementation of "WaitCommEvent" function from Windows) 709 | * 710 | */ 711 | JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_waitEvents 712 | (JNIEnv *env, jobject object, jlong portHandle) { 713 | 714 | jclass intClass = env->FindClass("[I"); 715 | jobjectArray returnArray = env->NewObjectArray(sizeof(events)/sizeof(jint), intClass, NULL); 716 | 717 | /*Input buffer*/ 718 | jint bytesCountIn = 0; 719 | ioctl(portHandle, FIONREAD, &bytesCountIn); 720 | 721 | /*Output buffer*/ 722 | jint bytesCountOut = 0; 723 | ioctl(portHandle, TIOCOUTQ, &bytesCountOut); 724 | 725 | /*Lines status*/ 726 | int statusLines = getLinesStatus(portHandle); 727 | 728 | jint statusCTS = 0; 729 | jint statusDSR = 0; 730 | jint statusRING = 0; 731 | jint statusRLSD = 0; 732 | 733 | /*CTS status*/ 734 | if(statusLines & TIOCM_CTS){ 735 | statusCTS = 1; 736 | } 737 | 738 | /*DSR status*/ 739 | if(statusLines & TIOCM_DSR){ 740 | statusDSR = 1; 741 | } 742 | 743 | /*RING status*/ 744 | if(statusLines & TIOCM_RNG){ 745 | statusRING = 1; 746 | } 747 | 748 | /*RLSD(DCD) status*/ 749 | if(statusLines & TIOCM_CAR){ 750 | statusRLSD = 1; 751 | } 752 | 753 | /*Interrupts*/ 754 | int interrupts[] = {-1, -1, -1, -1, -1}; 755 | getInterruptsCount(portHandle, interrupts); 756 | 757 | jint interruptBreak = interrupts[0]; 758 | jint interruptTX = interrupts[1]; 759 | jint interruptFrame = interrupts[2]; 760 | jint interruptOverrun = interrupts[3]; 761 | jint interruptParity = interrupts[4]; 762 | 763 | for(int i = 0; i < sizeof(events)/sizeof(jint); i++){ 764 | jint returnValues[2]; 765 | switch(events[i]) { 766 | 767 | case INTERRUPT_BREAK: //Interrupt Break - for BREAK event 768 | returnValues[1] = interruptBreak; 769 | goto forEnd; 770 | case INTERRUPT_TX: //Interrupt TX - for TXEMPTY event 771 | returnValues[1] = interruptTX; 772 | goto forEnd; 773 | case INTERRUPT_FRAME: //Interrupt Frame - for ERR event 774 | returnValues[1] = interruptFrame; 775 | goto forEnd; 776 | case INTERRUPT_OVERRUN: //Interrupt Overrun - for ERR event 777 | returnValues[1] = interruptOverrun; 778 | goto forEnd; 779 | case INTERRUPT_PARITY: //Interrupt Parity - for ERR event 780 | returnValues[1] = interruptParity; 781 | goto forEnd; 782 | case EV_CTS: 783 | returnValues[1] = statusCTS; 784 | goto forEnd; 785 | case EV_DSR: 786 | returnValues[1] = statusDSR; 787 | goto forEnd; 788 | case EV_RING: 789 | returnValues[1] = statusRING; 790 | goto forEnd; 791 | case EV_RLSD: /*DCD*/ 792 | returnValues[1] = statusRLSD; 793 | goto forEnd; 794 | case EV_RXCHAR: 795 | returnValues[1] = bytesCountIn; 796 | goto forEnd; 797 | /*case EV_RXFLAG: // Event RXFLAG - Not supported 798 | returnValues[0] = EV_RXFLAG; 799 | returnValues[1] = 0; 800 | goto forEnd;*/ 801 | case EV_TXEMPTY: 802 | returnValues[1] = bytesCountOut; 803 | goto forEnd; 804 | } 805 | forEnd: { 806 | returnValues[0] = events[i]; 807 | jintArray singleResultArray = env->NewIntArray(2); 808 | env->SetIntArrayRegion(singleResultArray, 0, 2, returnValues); 809 | env->SetObjectArrayElement(returnArray, i, singleResultArray); 810 | }; 811 | } 812 | return returnArray; 813 | } 814 | 815 | /* OK */ 816 | /* 817 | * Getting serial ports names like an a String array (String[]) 818 | */ 819 | JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_getSerialPortNames 820 | (JNIEnv *env, jobject object){ 821 | //Don't needed in linux, implemented in java code (Note: null will be returned) 822 | return NULL; 823 | } 824 | 825 | /* OK */ 826 | /* 827 | * Getting lines status 828 | * 829 | * returnValues[0] - CTS 830 | * returnValues[1] - DSR 831 | * returnValues[2] - RING 832 | * returnValues[3] - RLSD(DCD) 833 | */ 834 | JNIEXPORT jintArray JNICALL Java_jssc_SerialNativeInterface_getLinesStatus 835 | (JNIEnv *env, jobject object, jlong portHandle){ 836 | jint returnValues[4]; 837 | for(jint i = 0; i < 4; i++){ 838 | returnValues[i] = 0; 839 | } 840 | jintArray returnArray = env->NewIntArray(4); 841 | 842 | /*Lines status*/ 843 | int statusLines = getLinesStatus(portHandle); 844 | 845 | /*CTS status*/ 846 | if(statusLines & TIOCM_CTS){ 847 | returnValues[0] = 1; 848 | } 849 | 850 | /*DSR status*/ 851 | if(statusLines & TIOCM_DSR){ 852 | returnValues[1] = 1; 853 | } 854 | 855 | /*RING status*/ 856 | if(statusLines & TIOCM_RNG){ 857 | returnValues[2] = 1; 858 | } 859 | 860 | /*RLSD(DCD) status*/ 861 | if(statusLines & TIOCM_CAR){ 862 | returnValues[3] = 1; 863 | } 864 | 865 | env->SetIntArrayRegion(returnArray, 0, 4, returnValues); 866 | return returnArray; 867 | } 868 | -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/src/cpp/jssc_SerialNativeInterface.h: -------------------------------------------------------------------------------- 1 | /* jSSC (Java Simple Serial Connector) - serial port communication library. 2 | * © Alexey Sokolov (scream3r), 2010-2013. 3 | * 4 | * This file is part of jSSC. 5 | * 6 | * jSSC is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * jSSC is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with jSSC. If not, see . 18 | * 19 | * If you use jSSC in public project you can inform me about this by e-mail, 20 | * of course if you want it. 21 | * 22 | * e-mail: scream3r.org@gmail.com 23 | * web-site: http://scream3r.org | http://code.google.com/p/java-simple-serial-connector/ 24 | */ 25 | /* DO NOT EDIT THIS FILE - it is machine generated */ 26 | #include 27 | /* Header for class jssc_SerialNativeInterface */ 28 | 29 | #ifndef _Included_jssc_SerialNativeInterface 30 | #define _Included_jssc_SerialNativeInterface 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | #undef jssc_SerialNativeInterface_OS_LINUX 35 | #define jssc_SerialNativeInterface_OS_LINUX 0L 36 | #undef jssc_SerialNativeInterface_OS_WINDOWS 37 | #define jssc_SerialNativeInterface_OS_WINDOWS 1L 38 | #undef jssc_SerialNativeInterface_OS_SOLARIS 39 | #define jssc_SerialNativeInterface_OS_SOLARIS 2L 40 | #undef jssc_SerialNativeInterface_OS_MAC_OS_X 41 | #define jssc_SerialNativeInterface_OS_MAC_OS_X 3L 42 | #undef jssc_SerialNativeInterface_ERR_PORT_BUSY 43 | #define jssc_SerialNativeInterface_ERR_PORT_BUSY -1LL 44 | #undef jssc_SerialNativeInterface_ERR_PORT_NOT_FOUND 45 | #define jssc_SerialNativeInterface_ERR_PORT_NOT_FOUND -2LL 46 | #undef jssc_SerialNativeInterface_ERR_PERMISSION_DENIED 47 | #define jssc_SerialNativeInterface_ERR_PERMISSION_DENIED -3LL 48 | #undef jssc_SerialNativeInterface_ERR_INCORRECT_SERIAL_PORT 49 | #define jssc_SerialNativeInterface_ERR_INCORRECT_SERIAL_PORT -4LL 50 | /* 51 | * Class: jssc_SerialNativeInterface 52 | * Method: openPort 53 | * Signature: (Ljava/lang/String;Z)J 54 | */ 55 | JNIEXPORT jlong JNICALL Java_jssc_SerialNativeInterface_openPort 56 | (JNIEnv *, jobject, jstring, jboolean); 57 | 58 | /* 59 | * Class: jssc_SerialNativeInterface 60 | * Method: setParams 61 | * Signature: (JIIIIZZI)Z 62 | */ 63 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setParams 64 | (JNIEnv *, jobject, jlong, jint, jint, jint, jint, jboolean, jboolean, jint); 65 | 66 | /* 67 | * Class: jssc_SerialNativeInterface 68 | * Method: purgePort 69 | * Signature: (JI)Z 70 | */ 71 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_purgePort 72 | (JNIEnv *, jobject, jlong, jint); 73 | 74 | /* 75 | * Class: jssc_SerialNativeInterface 76 | * Method: closePort 77 | * Signature: (J)Z 78 | */ 79 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_closePort 80 | (JNIEnv *, jobject, jlong); 81 | 82 | /* 83 | * Class: jssc_SerialNativeInterface 84 | * Method: setEventsMask 85 | * Signature: (JI)Z 86 | */ 87 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setEventsMask 88 | (JNIEnv *, jobject, jlong, jint); 89 | 90 | /* 91 | * Class: jssc_SerialNativeInterface 92 | * Method: getEventsMask 93 | * Signature: (J)I 94 | */ 95 | JNIEXPORT jint JNICALL Java_jssc_SerialNativeInterface_getEventsMask 96 | (JNIEnv *, jobject, jlong); 97 | 98 | /* 99 | * Class: jssc_SerialNativeInterface 100 | * Method: waitEvents 101 | * Signature: (J)[[I 102 | */ 103 | JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_waitEvents 104 | (JNIEnv *, jobject, jlong); 105 | 106 | /* 107 | * Class: jssc_SerialNativeInterface 108 | * Method: setRTS 109 | * Signature: (JZ)Z 110 | */ 111 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setRTS 112 | (JNIEnv *, jobject, jlong, jboolean); 113 | 114 | /* 115 | * Class: jssc_SerialNativeInterface 116 | * Method: setDTR 117 | * Signature: (JZ)Z 118 | */ 119 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setDTR 120 | (JNIEnv *, jobject, jlong, jboolean); 121 | 122 | /* 123 | * Class: jssc_SerialNativeInterface 124 | * Method: readBytes 125 | * Signature: (JI)[B 126 | */ 127 | JNIEXPORT jbyteArray JNICALL Java_jssc_SerialNativeInterface_readBytes 128 | (JNIEnv *, jobject, jlong, jint); 129 | 130 | /* 131 | * Class: jssc_SerialNativeInterface 132 | * Method: writeBytes 133 | * Signature: (J[B)Z 134 | */ 135 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_writeBytes 136 | (JNIEnv *, jobject, jlong, jbyteArray); 137 | 138 | /* 139 | * Class: jssc_SerialNativeInterface 140 | * Method: getBuffersBytesCount 141 | * Signature: (J)[I 142 | */ 143 | JNIEXPORT jintArray JNICALL Java_jssc_SerialNativeInterface_getBuffersBytesCount 144 | (JNIEnv *, jobject, jlong); 145 | 146 | /* 147 | * Class: jssc_SerialNativeInterface 148 | * Method: setFlowControlMode 149 | * Signature: (JI)Z 150 | */ 151 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setFlowControlMode 152 | (JNIEnv *, jobject, jlong, jint); 153 | 154 | /* 155 | * Class: jssc_SerialNativeInterface 156 | * Method: getFlowControlMode 157 | * Signature: (J)I 158 | */ 159 | JNIEXPORT jint JNICALL Java_jssc_SerialNativeInterface_getFlowControlMode 160 | (JNIEnv *, jobject, jlong); 161 | 162 | /* 163 | * Class: jssc_SerialNativeInterface 164 | * Method: getSerialPortNames 165 | * Signature: ()[Ljava/lang/String; 166 | */ 167 | JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_getSerialPortNames 168 | (JNIEnv *, jobject); 169 | 170 | /* 171 | * Class: jssc_SerialNativeInterface 172 | * Method: getLinesStatus 173 | * Signature: (J)[I 174 | */ 175 | JNIEXPORT jintArray JNICALL Java_jssc_SerialNativeInterface_getLinesStatus 176 | (JNIEnv *, jobject, jlong); 177 | 178 | /* 179 | * Class: jssc_SerialNativeInterface 180 | * Method: sendBreak 181 | * Signature: (JI)Z 182 | */ 183 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_sendBreak 184 | (JNIEnv *, jobject, jlong, jint); 185 | 186 | #ifdef __cplusplus 187 | } 188 | #endif 189 | #endif 190 | -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/src/cpp/windows/jssc.c++: -------------------------------------------------------------------------------- 1 | /* jSSC (Java Simple Serial Connector) - serial port communication library. 2 | * © Alexey Sokolov (scream3r), 2010-2013. 3 | * 4 | * This file is part of jSSC. 5 | * 6 | * jSSC is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU Lesser General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * jSSC is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with jSSC. If not, see . 18 | * 19 | * If you use jSSC in public project you can inform me about this by e-mail, 20 | * of course if you want it. 21 | * 22 | * e-mail: scream3r.org@gmail.com 23 | * web-site: http://scream3r.org | http://code.google.com/p/java-simple-serial-connector/ 24 | */ 25 | #include 26 | #include 27 | #include 28 | #include "../jssc_SerialNativeInterface.h" 29 | 30 | //#include 31 | 32 | /* 33 | * Port opening. 34 | * 35 | * In 2.2.0 added useTIOCEXCL (not used in Windows, only for compatibility with _nix version) 36 | */ 37 | JNIEXPORT jlong JNICALL Java_jssc_SerialNativeInterface_openPort(JNIEnv *env, jobject object, jstring portName, jboolean useTIOCEXCL){ 38 | char prefix[] = "\\\\.\\"; 39 | const char* port = env->GetStringUTFChars(portName, JNI_FALSE); 40 | 41 | //since 2.1.0 -> string concat fix 42 | char portFullName[strlen(prefix) + strlen(port) + 1]; 43 | strcpy(portFullName, prefix); 44 | strcat(portFullName, port); 45 | //<- since 2.1.0 46 | 47 | HANDLE hComm = CreateFile(portFullName, 48 | GENERIC_READ | GENERIC_WRITE, 49 | 0, 50 | 0, 51 | OPEN_EXISTING, 52 | FILE_FLAG_OVERLAPPED, 53 | 0); 54 | env->ReleaseStringUTFChars(portName, port); 55 | 56 | //since 2.3.0 -> 57 | if(hComm != INVALID_HANDLE_VALUE){ 58 | DCB *dcb = new DCB(); 59 | if(!GetCommState(hComm, dcb)){ 60 | hComm = (HANDLE)jssc_SerialNativeInterface_ERR_INCORRECT_SERIAL_PORT;//(-4)Incorrect serial port 61 | } 62 | delete dcb; 63 | } 64 | else { 65 | DWORD errorValue = GetLastError(); 66 | if(errorValue == ERROR_ACCESS_DENIED){ 67 | hComm = (HANDLE)jssc_SerialNativeInterface_ERR_PORT_BUSY;//(-1)Port busy 68 | } 69 | else if(errorValue == ERROR_FILE_NOT_FOUND){ 70 | hComm = (HANDLE)jssc_SerialNativeInterface_ERR_PORT_NOT_FOUND;//(-2)Port not found 71 | } 72 | } 73 | //<- since 2.3.0 74 | return (jlong)hComm;//since 2.4.0 changed to jlong 75 | }; 76 | 77 | /* 78 | * Setting serial port params. 79 | * 80 | * In 2.6.0 added flags (not used in Windows, only for compatibility with _nix version) 81 | */ 82 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setParams 83 | (JNIEnv *env, jobject object, jlong portHandle, jint baudRate, jint byteSize, jint stopBits, jint parity, jboolean setRTS, jboolean setDTR, jint flags){ 84 | HANDLE hComm = (HANDLE)portHandle; 85 | DCB *dcb = new DCB(); 86 | jboolean returnValue = JNI_FALSE; 87 | if(GetCommState(hComm, dcb)){ 88 | dcb->BaudRate = baudRate; 89 | dcb->ByteSize = byteSize; 90 | dcb->StopBits = stopBits; 91 | dcb->Parity = parity; 92 | 93 | //since 0.8 -> 94 | if(setRTS == JNI_TRUE){ 95 | dcb->fRtsControl = RTS_CONTROL_ENABLE; 96 | } 97 | else { 98 | dcb->fRtsControl = RTS_CONTROL_DISABLE; 99 | } 100 | if(setDTR == JNI_TRUE){ 101 | dcb->fDtrControl = DTR_CONTROL_ENABLE; 102 | } 103 | else { 104 | dcb->fDtrControl = DTR_CONTROL_DISABLE; 105 | } 106 | dcb->fOutxCtsFlow = FALSE; 107 | dcb->fOutxDsrFlow = FALSE; 108 | dcb->fDsrSensitivity = FALSE; 109 | dcb->fTXContinueOnXoff = TRUE; 110 | dcb->fOutX = FALSE; 111 | dcb->fInX = FALSE; 112 | dcb->fErrorChar = FALSE; 113 | dcb->fNull = FALSE; 114 | dcb->fAbortOnError = FALSE; 115 | dcb->XonLim = 2048; 116 | dcb->XoffLim = 512; 117 | dcb->XonChar = (char)17; //DC1 118 | dcb->XoffChar = (char)19; //DC3 119 | //<- since 0.8 120 | 121 | if(SetCommState(hComm, dcb)){ 122 | 123 | //since 2.1.0 -> previously setted timeouts by another application should be cleared 124 | COMMTIMEOUTS *lpCommTimeouts = new COMMTIMEOUTS(); 125 | lpCommTimeouts->ReadIntervalTimeout = 0; 126 | lpCommTimeouts->ReadTotalTimeoutConstant = 0; 127 | lpCommTimeouts->ReadTotalTimeoutMultiplier = 0; 128 | lpCommTimeouts->WriteTotalTimeoutConstant = 0; 129 | lpCommTimeouts->WriteTotalTimeoutMultiplier = 0; 130 | if(SetCommTimeouts(hComm, lpCommTimeouts)){ 131 | returnValue = JNI_TRUE; 132 | } 133 | delete lpCommTimeouts; 134 | //<- since 2.1.0 135 | } 136 | } 137 | delete dcb; 138 | return returnValue; 139 | } 140 | 141 | /* 142 | * PurgeComm 143 | */ 144 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_purgePort 145 | (JNIEnv *env, jobject object, jlong portHandle, jint flags){ 146 | HANDLE hComm = (HANDLE)portHandle; 147 | DWORD dwFlags = (DWORD)flags; 148 | return (PurgeComm(hComm, dwFlags) ? JNI_TRUE : JNI_FALSE); 149 | } 150 | 151 | /* 152 | * Port closing 153 | */ 154 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_closePort 155 | (JNIEnv *env, jobject object, jlong portHandle){ 156 | HANDLE hComm = (HANDLE)portHandle; 157 | return (CloseHandle(hComm) ? JNI_TRUE : JNI_FALSE); 158 | } 159 | 160 | /* 161 | * Set events mask 162 | */ 163 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setEventsMask 164 | (JNIEnv *env, jobject object, jlong portHandle, jint mask){ 165 | HANDLE hComm = (HANDLE)portHandle; 166 | DWORD dwEvtMask = (DWORD)mask; 167 | return (SetCommMask(hComm, dwEvtMask) ? JNI_TRUE : JNI_FALSE); 168 | } 169 | 170 | /* 171 | * Get events mask 172 | */ 173 | JNIEXPORT jint JNICALL Java_jssc_SerialNativeInterface_getEventsMask 174 | (JNIEnv *env, jobject object, jlong portHandle){ 175 | HANDLE hComm = (HANDLE)portHandle; 176 | DWORD lpEvtMask; 177 | if(GetCommMask(hComm, &lpEvtMask)){ 178 | return (jint)lpEvtMask; 179 | } 180 | else { 181 | return -1; 182 | } 183 | } 184 | 185 | /* 186 | * Change RTS line state (ON || OFF) 187 | */ 188 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setRTS 189 | (JNIEnv *env, jobject object, jlong portHandle, jboolean enabled){ 190 | HANDLE hComm = (HANDLE)portHandle; 191 | if(enabled == JNI_TRUE){ 192 | return (EscapeCommFunction(hComm, SETRTS) ? JNI_TRUE : JNI_FALSE); 193 | } 194 | else { 195 | return (EscapeCommFunction(hComm, CLRRTS) ? JNI_TRUE : JNI_FALSE); 196 | } 197 | } 198 | 199 | /* 200 | * Change DTR line state (ON || OFF) 201 | */ 202 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setDTR 203 | (JNIEnv *env, jobject object, jlong portHandle, jboolean enabled){ 204 | HANDLE hComm = (HANDLE)portHandle; 205 | if(enabled == JNI_TRUE){ 206 | return (EscapeCommFunction(hComm, SETDTR) ? JNI_TRUE : JNI_FALSE); 207 | } 208 | else { 209 | return (EscapeCommFunction(hComm, CLRDTR) ? JNI_TRUE : JNI_FALSE); 210 | } 211 | } 212 | 213 | /* 214 | * Write data to port 215 | * portHandle - port handle 216 | * buffer - byte array for sending 217 | */ 218 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_writeBytes 219 | (JNIEnv *env, jobject object, jlong portHandle, jbyteArray buffer){ 220 | HANDLE hComm = (HANDLE)portHandle; 221 | DWORD lpNumberOfBytesTransferred; 222 | DWORD lpNumberOfBytesWritten; 223 | OVERLAPPED *overlapped = new OVERLAPPED(); 224 | jboolean returnValue = JNI_FALSE; 225 | jbyte* jBuffer = env->GetByteArrayElements(buffer, JNI_FALSE); 226 | overlapped->hEvent = CreateEventA(NULL, true, false, NULL); 227 | if(WriteFile(hComm, jBuffer, (DWORD)env->GetArrayLength(buffer), &lpNumberOfBytesWritten, overlapped)){ 228 | returnValue = JNI_TRUE; 229 | } 230 | else if(GetLastError() == ERROR_IO_PENDING){ 231 | if(WaitForSingleObject(overlapped->hEvent, INFINITE) == WAIT_OBJECT_0){ 232 | if(GetOverlappedResult(hComm, overlapped, &lpNumberOfBytesTransferred, false)){ 233 | returnValue = JNI_TRUE; 234 | } 235 | } 236 | } 237 | env->ReleaseByteArrayElements(buffer, jBuffer, 0); 238 | CloseHandle(overlapped->hEvent); 239 | delete overlapped; 240 | return returnValue; 241 | } 242 | 243 | /* 244 | * Read data from port 245 | * portHandle - port handle 246 | * byteCount - count of bytes for reading 247 | */ 248 | JNIEXPORT jbyteArray JNICALL Java_jssc_SerialNativeInterface_readBytes 249 | (JNIEnv *env, jobject object, jlong portHandle, jint byteCount){ 250 | HANDLE hComm = (HANDLE)portHandle; 251 | DWORD lpNumberOfBytesTransferred; 252 | DWORD lpNumberOfBytesRead; 253 | OVERLAPPED *overlapped = new OVERLAPPED(); 254 | jbyte lpBuffer[byteCount]; 255 | jbyteArray returnArray = env->NewByteArray(byteCount); 256 | overlapped->hEvent = CreateEventA(NULL, true, false, NULL); 257 | if(ReadFile(hComm, lpBuffer, (DWORD)byteCount, &lpNumberOfBytesRead, overlapped)){ 258 | env->SetByteArrayRegion(returnArray, 0, byteCount, lpBuffer); 259 | } 260 | else if(GetLastError() == ERROR_IO_PENDING){ 261 | if(WaitForSingleObject(overlapped->hEvent, INFINITE) == WAIT_OBJECT_0){ 262 | if(GetOverlappedResult(hComm, overlapped, &lpNumberOfBytesTransferred, false)){ 263 | env->SetByteArrayRegion(returnArray, 0, byteCount, lpBuffer); 264 | } 265 | } 266 | } 267 | CloseHandle(overlapped->hEvent); 268 | delete overlapped; 269 | return returnArray; 270 | } 271 | 272 | /* 273 | * Get bytes count in serial port buffers (Input and Output) 274 | */ 275 | JNIEXPORT jintArray JNICALL Java_jssc_SerialNativeInterface_getBuffersBytesCount 276 | (JNIEnv *env, jobject object, jlong portHandle){ 277 | HANDLE hComm = (HANDLE)portHandle; 278 | jint returnValues[2]; 279 | returnValues[0] = -1; 280 | returnValues[1] = -1; 281 | jintArray returnArray = env->NewIntArray(2); 282 | DWORD lpErrors; 283 | COMSTAT *comstat = new COMSTAT(); 284 | if(ClearCommError(hComm, &lpErrors, comstat)){ 285 | returnValues[0] = (jint)comstat->cbInQue; 286 | returnValues[1] = (jint)comstat->cbOutQue; 287 | } 288 | else { 289 | returnValues[0] = -1; 290 | returnValues[1] = -1; 291 | } 292 | delete comstat; 293 | env->SetIntArrayRegion(returnArray, 0, 2, returnValues); 294 | return returnArray; 295 | } 296 | 297 | //since 0.8 -> 298 | const jint FLOWCONTROL_NONE = 0; 299 | const jint FLOWCONTROL_RTSCTS_IN = 1; 300 | const jint FLOWCONTROL_RTSCTS_OUT = 2; 301 | const jint FLOWCONTROL_XONXOFF_IN = 4; 302 | const jint FLOWCONTROL_XONXOFF_OUT = 8; 303 | //<- since 0.8 304 | 305 | /* 306 | * Setting flow control mode 307 | * 308 | * since 0.8 309 | */ 310 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_setFlowControlMode 311 | (JNIEnv *env, jobject object, jlong portHandle, jint mask){ 312 | HANDLE hComm = (HANDLE)portHandle; 313 | jboolean returnValue = JNI_FALSE; 314 | DCB *dcb = new DCB(); 315 | if(GetCommState(hComm, dcb)){ 316 | dcb->fRtsControl = RTS_CONTROL_ENABLE; 317 | dcb->fOutxCtsFlow = FALSE; 318 | dcb->fOutX = FALSE; 319 | dcb->fInX = FALSE; 320 | if(mask != FLOWCONTROL_NONE){ 321 | if((mask & FLOWCONTROL_RTSCTS_IN) == FLOWCONTROL_RTSCTS_IN){ 322 | dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; 323 | } 324 | if((mask & FLOWCONTROL_RTSCTS_OUT) == FLOWCONTROL_RTSCTS_OUT){ 325 | dcb->fOutxCtsFlow = TRUE; 326 | } 327 | if((mask & FLOWCONTROL_XONXOFF_IN) == FLOWCONTROL_XONXOFF_IN){ 328 | dcb->fInX = TRUE; 329 | } 330 | if((mask & FLOWCONTROL_XONXOFF_OUT) == FLOWCONTROL_XONXOFF_OUT){ 331 | dcb->fOutX = TRUE; 332 | } 333 | } 334 | if(SetCommState(hComm, dcb)){ 335 | returnValue = JNI_TRUE; 336 | } 337 | } 338 | delete dcb; 339 | return returnValue; 340 | } 341 | 342 | /* 343 | * Getting flow control mode 344 | * 345 | * since 0.8 346 | */ 347 | JNIEXPORT jint JNICALL Java_jssc_SerialNativeInterface_getFlowControlMode 348 | (JNIEnv *env, jobject object, jlong portHandle){ 349 | HANDLE hComm = (HANDLE)portHandle; 350 | jint returnValue = 0; 351 | DCB *dcb = new DCB(); 352 | if(GetCommState(hComm, dcb)){ 353 | if(dcb->fRtsControl == RTS_CONTROL_HANDSHAKE){ 354 | returnValue |= FLOWCONTROL_RTSCTS_IN; 355 | } 356 | if(dcb->fOutxCtsFlow == TRUE){ 357 | returnValue |= FLOWCONTROL_RTSCTS_OUT; 358 | } 359 | if(dcb->fInX == TRUE){ 360 | returnValue |= FLOWCONTROL_XONXOFF_IN; 361 | } 362 | if(dcb->fOutX == TRUE){ 363 | returnValue |= FLOWCONTROL_XONXOFF_OUT; 364 | } 365 | } 366 | delete dcb; 367 | return returnValue; 368 | } 369 | 370 | /* 371 | * Send break for setted duration 372 | * 373 | * since 0.8 374 | */ 375 | JNIEXPORT jboolean JNICALL Java_jssc_SerialNativeInterface_sendBreak 376 | (JNIEnv *env, jobject object, jlong portHandle, jint duration){ 377 | HANDLE hComm = (HANDLE)portHandle; 378 | jboolean returnValue = JNI_FALSE; 379 | if(duration > 0){ 380 | if(SetCommBreak(hComm) > 0){ 381 | Sleep(duration); 382 | if(ClearCommBreak(hComm) > 0){ 383 | returnValue = JNI_TRUE; 384 | } 385 | } 386 | } 387 | return returnValue; 388 | } 389 | 390 | /* 391 | * Wait event 392 | * portHandle - port handle 393 | */ 394 | JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_waitEvents 395 | (JNIEnv *env, jobject object, jlong portHandle) { 396 | HANDLE hComm = (HANDLE)portHandle; 397 | DWORD lpEvtMask = 0; 398 | DWORD lpNumberOfBytesTransferred = 0; 399 | OVERLAPPED *overlapped = new OVERLAPPED(); 400 | jclass intClass = env->FindClass("[I"); 401 | jobjectArray returnArray; 402 | boolean functionSuccessful = false; 403 | overlapped->hEvent = CreateEventA(NULL, true, false, NULL); 404 | if(WaitCommEvent(hComm, &lpEvtMask, overlapped)){ 405 | functionSuccessful = true; 406 | } 407 | else if(GetLastError() == ERROR_IO_PENDING){ 408 | if(WaitForSingleObject(overlapped->hEvent, INFINITE) == WAIT_OBJECT_0){ 409 | if(GetOverlappedResult(hComm, overlapped, &lpNumberOfBytesTransferred, false)){ 410 | functionSuccessful = true; 411 | } 412 | } 413 | } 414 | if(functionSuccessful){ 415 | boolean executeGetCommModemStatus = false; 416 | boolean executeClearCommError = false; 417 | DWORD events[9];//fixed since 0.8 (old value is 8) 418 | jint eventsCount = 0; 419 | if((EV_BREAK & lpEvtMask) == EV_BREAK){ 420 | events[eventsCount] = EV_BREAK; 421 | eventsCount++; 422 | } 423 | if((EV_CTS & lpEvtMask) == EV_CTS){ 424 | events[eventsCount] = EV_CTS; 425 | eventsCount++; 426 | executeGetCommModemStatus = true; 427 | } 428 | if((EV_DSR & lpEvtMask) == EV_DSR){ 429 | events[eventsCount] = EV_DSR; 430 | eventsCount++; 431 | executeGetCommModemStatus = true; 432 | } 433 | if((EV_ERR & lpEvtMask) == EV_ERR){ 434 | events[eventsCount] = EV_ERR; 435 | eventsCount++; 436 | executeClearCommError = true; 437 | } 438 | if((EV_RING & lpEvtMask) == EV_RING){ 439 | events[eventsCount] = EV_RING; 440 | eventsCount++; 441 | executeGetCommModemStatus = true; 442 | } 443 | if((EV_RLSD & lpEvtMask) == EV_RLSD){ 444 | events[eventsCount] = EV_RLSD; 445 | eventsCount++; 446 | executeGetCommModemStatus = true; 447 | } 448 | if((EV_RXCHAR & lpEvtMask) == EV_RXCHAR){ 449 | events[eventsCount] = EV_RXCHAR; 450 | eventsCount++; 451 | executeClearCommError = true; 452 | } 453 | if((EV_RXFLAG & lpEvtMask) == EV_RXFLAG){ 454 | events[eventsCount] = EV_RXFLAG; 455 | eventsCount++; 456 | executeClearCommError = true; 457 | } 458 | if((EV_TXEMPTY & lpEvtMask) == EV_TXEMPTY){ 459 | events[eventsCount] = EV_TXEMPTY; 460 | eventsCount++; 461 | executeClearCommError = true; 462 | } 463 | /* 464 | * Execute GetCommModemStatus function if it's needed (get lines status) 465 | */ 466 | jint statusCTS = 0; 467 | jint statusDSR = 0; 468 | jint statusRING = 0; 469 | jint statusRLSD = 0; 470 | boolean successGetCommModemStatus = false; 471 | if(executeGetCommModemStatus){ 472 | DWORD lpModemStat; 473 | if(GetCommModemStatus(hComm, &lpModemStat)){ 474 | successGetCommModemStatus = true; 475 | if((MS_CTS_ON & lpModemStat) == MS_CTS_ON){ 476 | statusCTS = 1; 477 | } 478 | if((MS_DSR_ON & lpModemStat) == MS_DSR_ON){ 479 | statusDSR = 1; 480 | } 481 | if((MS_RING_ON & lpModemStat) == MS_RING_ON){ 482 | statusRING = 1; 483 | } 484 | if((MS_RLSD_ON & lpModemStat) == MS_RLSD_ON){ 485 | statusRLSD = 1; 486 | } 487 | } 488 | else { 489 | jint lastError = (jint)GetLastError(); 490 | statusCTS = lastError; 491 | statusDSR = lastError; 492 | statusRING = lastError; 493 | statusRLSD = lastError; 494 | } 495 | } 496 | /* 497 | * Execute ClearCommError function if it's needed (get count of bytes in buffers and errors) 498 | */ 499 | jint bytesCountIn = 0; 500 | jint bytesCountOut = 0; 501 | jint communicationsErrors = 0; 502 | boolean successClearCommError = false; 503 | if(executeClearCommError){ 504 | DWORD lpErrors; 505 | COMSTAT *comstat = new COMSTAT(); 506 | if(ClearCommError(hComm, &lpErrors, comstat)){ 507 | successClearCommError = true; 508 | bytesCountIn = (jint)comstat->cbInQue; 509 | bytesCountOut = (jint)comstat->cbOutQue; 510 | communicationsErrors = (jint)lpErrors; 511 | } 512 | else { 513 | jint lastError = (jint)GetLastError(); 514 | bytesCountIn = lastError; 515 | bytesCountOut = lastError; 516 | communicationsErrors = lastError; 517 | } 518 | delete comstat; 519 | } 520 | /* 521 | * Create int[][] for events values 522 | */ 523 | returnArray = env->NewObjectArray(eventsCount, intClass, NULL); 524 | /* 525 | * Set events values 526 | */ 527 | for(jint i = 0; i < eventsCount; i++){ 528 | jint returnValues[2]; 529 | switch(events[i]){ 530 | case EV_BREAK: 531 | returnValues[0] = (jint)events[i]; 532 | returnValues[1] = 0; 533 | goto forEnd; 534 | case EV_CTS: 535 | returnValues[1] = statusCTS; 536 | goto modemStatus; 537 | case EV_DSR: 538 | returnValues[1] = statusDSR; 539 | goto modemStatus; 540 | case EV_ERR: 541 | returnValues[1] = communicationsErrors; 542 | goto bytesAndErrors; 543 | case EV_RING: 544 | returnValues[1] = statusRING; 545 | goto modemStatus; 546 | case EV_RLSD: 547 | returnValues[1] = statusRLSD; 548 | goto modemStatus; 549 | case EV_RXCHAR: 550 | returnValues[1] = bytesCountIn; 551 | goto bytesAndErrors; 552 | case EV_RXFLAG: 553 | returnValues[1] = bytesCountIn; 554 | goto bytesAndErrors; 555 | case EV_TXEMPTY: 556 | returnValues[1] = bytesCountOut; 557 | goto bytesAndErrors; 558 | default: 559 | returnValues[0] = (jint)events[i]; 560 | returnValues[1] = 0; 561 | goto forEnd; 562 | }; 563 | modemStatus: { 564 | if(successGetCommModemStatus){ 565 | returnValues[0] = (jint)events[i]; 566 | } 567 | else { 568 | returnValues[0] = -1; 569 | } 570 | goto forEnd; 571 | } 572 | bytesAndErrors: { 573 | if(successClearCommError){ 574 | returnValues[0] = (jint)events[i]; 575 | } 576 | else { 577 | returnValues[0] = -1; 578 | } 579 | goto forEnd; 580 | } 581 | forEnd: { 582 | jintArray singleResultArray = env->NewIntArray(2); 583 | env->SetIntArrayRegion(singleResultArray, 0, 2, returnValues); 584 | env->SetObjectArrayElement(returnArray, i, singleResultArray); 585 | }; 586 | } 587 | } 588 | else { 589 | returnArray = env->NewObjectArray(1, intClass, NULL); 590 | jint returnValues[2]; 591 | returnValues[0] = -1; 592 | returnValues[1] = (jint)GetLastError(); 593 | jintArray singleResultArray = env->NewIntArray(2); 594 | env->SetIntArrayRegion(singleResultArray, 0, 2, returnValues); 595 | env->SetObjectArrayElement(returnArray, 0, singleResultArray); 596 | }; 597 | CloseHandle(overlapped->hEvent); 598 | delete overlapped; 599 | return returnArray; 600 | } 601 | 602 | /* 603 | * Get serial port names 604 | */ 605 | JNIEXPORT jobjectArray JNICALL Java_jssc_SerialNativeInterface_getSerialPortNames 606 | (JNIEnv *env, jobject object){ 607 | HKEY phkResult; 608 | LPCSTR lpSubKey = "HARDWARE\\DEVICEMAP\\SERIALCOMM\\"; 609 | jobjectArray returnArray = NULL; 610 | if(RegOpenKeyExA(HKEY_LOCAL_MACHINE, lpSubKey, 0, KEY_READ, &phkResult) == ERROR_SUCCESS){ 611 | boolean hasMoreElements = true; 612 | DWORD keysCount = 0; 613 | char valueName[256]; 614 | DWORD valueNameSize; 615 | DWORD enumResult; 616 | while(hasMoreElements){ 617 | valueNameSize = 256; 618 | enumResult = RegEnumValueA(phkResult, keysCount, valueName, &valueNameSize, NULL, NULL, NULL, NULL); 619 | if(enumResult == ERROR_SUCCESS){ 620 | keysCount++; 621 | } 622 | else if(enumResult == ERROR_NO_MORE_ITEMS){ 623 | hasMoreElements = false; 624 | } 625 | else { 626 | hasMoreElements = false; 627 | } 628 | } 629 | if(keysCount > 0){ 630 | jclass stringClass = env->FindClass("java/lang/String"); 631 | returnArray = env->NewObjectArray((jsize)keysCount, stringClass, NULL); 632 | char lpValueName[256]; 633 | DWORD lpcchValueName; 634 | byte lpData[256]; 635 | DWORD lpcbData; 636 | DWORD result; 637 | for(DWORD i = 0; i < keysCount; i++){ 638 | lpcchValueName = 256; 639 | lpcbData = 256; 640 | result = RegEnumValueA(phkResult, i, lpValueName, &lpcchValueName, NULL, NULL, lpData, &lpcbData); 641 | if(result == ERROR_SUCCESS){ 642 | env->SetObjectArrayElement(returnArray, i, env->NewStringUTF((char*)lpData)); 643 | } 644 | } 645 | } 646 | CloseHandle(phkResult); 647 | } 648 | return returnArray; 649 | } 650 | 651 | /* 652 | * Get lines status 653 | * 654 | * returnValues[0] - CTS 655 | * returnValues[1] - DSR 656 | * returnValues[2] - RING 657 | * returnValues[3] - RLSD 658 | * 659 | */ 660 | JNIEXPORT jintArray JNICALL Java_jssc_SerialNativeInterface_getLinesStatus 661 | (JNIEnv *env, jobject object, jlong portHandle){ 662 | HANDLE hComm = (HANDLE)portHandle; 663 | DWORD lpModemStat; 664 | jint returnValues[4]; 665 | for(jint i = 0; i < 4; i++){ 666 | returnValues[i] = 0; 667 | } 668 | jintArray returnArray = env->NewIntArray(4); 669 | if(GetCommModemStatus(hComm, &lpModemStat)){ 670 | if((MS_CTS_ON & lpModemStat) == MS_CTS_ON){ 671 | returnValues[0] = 1; 672 | } 673 | if((MS_DSR_ON & lpModemStat) == MS_DSR_ON){ 674 | returnValues[1] = 1; 675 | } 676 | if((MS_RING_ON & lpModemStat) == MS_RING_ON){ 677 | returnValues[2] = 1; 678 | } 679 | if((MS_RLSD_ON & lpModemStat) == MS_RLSD_ON){ 680 | returnValues[3] = 1; 681 | } 682 | } 683 | env->SetIntArrayRegion(returnArray, 0, 4, returnValues); 684 | return returnArray; 685 | } 686 | -------------------------------------------------------------------------------- /libs/jSSC-2.6.0-Release/src/jssc-2.6.0-src.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MarginallyClever/GcodeSender/9f0ed07668c72f1333ed7b02ed0a23b2c47163de/libs/jSSC-2.6.0-Release/src/jssc-2.6.0-src.jar -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | GcodeSender 4 | GcodeSender 5 | http://www.makelangelo.com/ 6 | v1.1.0 7 | 8 | 9 | https://github.com/MarginallyClever/GcodeSender/issues 10 | GitHub Issues 11 | 12 | 13 | 14 | 15 | GPLv2 16 | http://opensource.org/licenses/GPL-2.0 17 | repo 18 | 19 | 20 | 21 | 22 | https://github.com/MarginallyClever/GcodeSender 23 | scm:git:git@github.com:MarginallyClever/GcodeSender.git 24 | 25 | 26 | 27 | Marginally Clever Robots, Ltd. 28 | http://www.marginallyclever.com/ 29 | 30 | 31 | 32 | 33 | ${minimum.maven.version} 34 | 35 | 36 | 40 | java/src 41 | 42 | 43 | java/src 44 | 45 | **/*.java 46 | 47 | 48 | 49 | src/main/resources 50 | true 51 | 52 | **/*.properties 53 | 54 | 55 | 56 | src/main/resources 57 | false 58 | 59 | **/*.properties 60 | 61 | 62 | 63 | 64 | 65 | maven-compiler-plugin 66 | 3.3 67 | 68 | ${minimum.java.version} 69 | ${minimum.java.version} 70 | false 71 | 72 | -Xlint:unchecked 73 | -Xlint:deprecation 74 | 75 | 76 | 77 | 78 | maven-assembly-plugin 79 | 80 | 81 | 82 | splash.png 83 | 84 | 85 | com.marginallyclever.gcodesender.GcodeSender 86 | 87 | 88 | 89 | java/src/main/assembly/application.xml 90 | 91 | 92 | 93 | 94 | make-assembly 95 | 96 | package 97 | 98 | 99 | single 100 | 101 | 102 | 103 | 104 | 105 | 106 | maven-clean-plugin 107 | 2.6.1 108 | 109 | 110 | maven-deploy-plugin 111 | 2.8.2 112 | 113 | 114 | maven-install-plugin 115 | 2.5.2 116 | 117 | 118 | maven-jar-plugin 119 | 2.6 120 | 121 | 122 | 123 | splash.png 124 | 125 | 126 | com.marginallyclever.gcodesender.GcodeSender 127 | 128 | 129 | 130 | 131 | 132 | maven-resources-plugin 133 | 2.7 134 | 135 | 136 | maven-site-plugin 137 | 3.4 138 | 139 | 140 | maven-surefire-plugin 141 | 2.18.1 142 | 143 | 144 | 145 | maven-dependency-plugin 146 | 147 | ${maven-dependency-plugin.ignoreNonCompile} 148 | 149 | 150 | 151 | org.apache.maven.plugins 152 | maven-enforcer-plugin 153 | 1.4 154 | 155 | 156 | enforce-java 157 | 158 | enforce 159 | 160 | 161 | 162 | 163 | ${minimum.java.version} 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | maven-javadoc-plugin 172 | 2.10.3 173 | 174 | 175 | maven-project-info-reports-plugin 176 | 2.8 177 | 178 | 179 | org.pitest 180 | pitest-maven 181 | 1.1.7 182 | 183 | 184 | com.marginallyclever* 185 | 186 | 187 | com.marginallyclever* 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | maven-assembly-plugin 196 | 2.5.5 197 | 198 | 199 | maven-dependency-plugin 200 | 2.10 201 | 202 | 203 | maven-release-plugin 204 | 2.5.2 205 | 206 | 207 | maven-antrun-plugin 208 | 1.8 209 | 210 | 211 | 212 | 213 | 214 | 215 | commons-io 216 | commons-io 217 | 2.4 218 | 219 | 220 | org.scream3r 221 | jssc 222 | 2.8.0 223 | 224 | 225 | junit 226 | junit 227 | 4.12 228 | test 229 | 230 | 231 | 232 | UTF-8 233 | 3 234 | 1.8 235 | 2.3.2 236 | true 237 | 238 | 239 | 240 | 241 | my-local-repo 242 | file://${basedir}/local-maven-repo 243 | 244 | 245 | -------------------------------------------------------------------------------- /src/GcodeSender/Generators/HilbertCurveGenerator.java: -------------------------------------------------------------------------------- 1 | package GcodeSender.Generators; 2 | 3 | import java.awt.GridLayout; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.io.FileOutputStream; 7 | import java.io.IOException; 8 | import java.io.OutputStream; 9 | 10 | import javax.swing.Box; 11 | import javax.swing.JButton; 12 | import javax.swing.JDialog; 13 | import javax.swing.JLabel; 14 | import javax.swing.JTextField; 15 | 16 | import GcodeSender.GcodeSender; 17 | 18 | 19 | // source http://introcs.cs.princeton.edu/java/32class/Hilbert.java.html 20 | public class HilbertCurveGenerator implements GcodeGenerator { 21 | float turtle_x,turtle_y; 22 | float turtle_dx,turtle_dy; 23 | float turtle_step=10.0f; 24 | float xmax = 7; 25 | float xmin = -7; 26 | float ymax = 7; 27 | float ymin = -7; 28 | float tool_offset_z = 1.25f; 29 | float z_down=40; 30 | float z_up=90; 31 | int order=4; // controls complexity of curve 32 | 33 | 34 | public String GetMenuName() { 35 | return "Hilbert Curve"; 36 | } 37 | 38 | 39 | public void Generate() { 40 | final JDialog driver = new JDialog(GcodeSender.getSingleton().GetMainFrame(),"Hilbert Curve",true); 41 | driver.setLayout(new GridLayout(0,1)); 42 | 43 | final JTextField field_size = new JTextField(Integer.toString((int)xmax)); 44 | final JTextField field_order = new JTextField(Integer.toString(order)); 45 | final JTextField field_up = new JTextField(Integer.toString((int)z_up)); 46 | final JTextField field_down = new JTextField(Integer.toString((int)z_down)); 47 | 48 | driver.add(new JLabel("Size")); driver.add(field_size); 49 | driver.add(new JLabel("Order")); driver.add(field_order); 50 | driver.add(new JLabel("Up")); driver.add(field_up); 51 | driver.add(new JLabel("Down")); driver.add(field_down); 52 | 53 | final JButton buttonSave = new JButton("Go"); 54 | final JButton buttonCancel = new JButton("Cancel"); 55 | Box horizontalBox = Box.createHorizontalBox(); 56 | horizontalBox.add(Box.createGlue()); 57 | horizontalBox.add(buttonSave); 58 | horizontalBox.add(buttonCancel); 59 | driver.add(horizontalBox); 60 | 61 | ActionListener driveButtons = new ActionListener() { 62 | public void actionPerformed(ActionEvent e) { 63 | Object subject = e.getSource(); 64 | 65 | if(subject == buttonSave) { 66 | z_up = Float.parseFloat(field_up.getText()); 67 | z_down = Float.parseFloat(field_down.getText()); 68 | xmax = Integer.parseInt(field_size.getText()); 69 | ymax= xmax; 70 | xmin=-xmax; 71 | ymin=-xmax; 72 | order = Integer.parseInt(field_order.getText()); 73 | CreateCurveNow(); 74 | 75 | driver.dispose(); 76 | } 77 | if(subject == buttonCancel) { 78 | driver.dispose(); 79 | } 80 | } 81 | }; 82 | 83 | buttonSave.addActionListener(driveButtons); 84 | buttonCancel.addActionListener(driveButtons); 85 | 86 | driver.setSize(300,400); 87 | driver.setVisible(true); 88 | } 89 | 90 | 91 | private void CreateCurveNow() { 92 | try { 93 | String outputFile = System.getProperty("user.dir") + "/" + "TEMP.NGC"; 94 | System.out.println("output file = "+outputFile); 95 | OutputStream output = new FileOutputStream(outputFile); 96 | output.write(new String("G28\n").getBytes()); 97 | output.write(new String("G90\n").getBytes()); 98 | output.write(new String("G54 X-30 Z-"+tool_offset_z+"\n").getBytes()); 99 | 100 | turtle_x=0; 101 | turtle_y=0; 102 | turtle_dx=0; 103 | turtle_dy=-1; 104 | turtle_step = (float)((xmax-xmin) / (Math.pow(2, order))); 105 | 106 | // Draw bounding box 107 | output.write(new String("G90\n").getBytes()); 108 | output.write(new String("G0 Z"+z_up+"\n").getBytes()); 109 | output.write(new String("G0 X"+xmax+" Y"+ymax+"\n").getBytes()); 110 | output.write(new String("G0 Z"+z_down+"\n").getBytes()); 111 | output.write(new String("G0 X"+xmax+" Y"+ymin+"\n").getBytes()); 112 | output.write(new String("G0 X"+xmin+" Y"+ymin+"\n").getBytes()); 113 | output.write(new String("G0 X"+xmin+" Y"+ymax+"\n").getBytes()); 114 | output.write(new String("G0 X"+xmax+" Y"+ymax+"\n").getBytes()); 115 | output.write(new String("G0 Z"+z_up+"\n").getBytes()); 116 | 117 | // move to starting position 118 | output.write(new String("G91\n").getBytes()); 119 | output.write(new String("G0 X"+(-turtle_step/2)+" Y"+(-turtle_step/2)+"\n").getBytes()); 120 | 121 | // do the curve 122 | output.write(new String("G90\n").getBytes()); 123 | output.write(new String("G0 Z"+z_down+"\n").getBytes()); 124 | 125 | output.write(new String("G91\n").getBytes()); 126 | hilbert(output,order); 127 | 128 | output.write(new String("G90\n").getBytes()); 129 | output.write(new String("G0 Z"+z_up+"\n").getBytes()); 130 | 131 | // finish up 132 | output.write(new String("G28\n").getBytes()); 133 | 134 | output.flush(); 135 | output.close(); 136 | 137 | // open the file automatically to save a click. 138 | GcodeSender.getSingleton().OpenFile(outputFile); 139 | } 140 | catch(IOException ex) {} 141 | } 142 | 143 | 144 | // Hilbert curve 145 | private void hilbert(OutputStream output,int n) throws IOException { 146 | if (n == 0) return; 147 | turtle_turn(90); 148 | treblih(output,n-1); 149 | turtle_goForward(output); 150 | turtle_turn(-90); 151 | hilbert(output,n-1); 152 | turtle_goForward(output); 153 | hilbert(output,n-1); 154 | turtle_turn(-90); 155 | turtle_goForward(output); 156 | treblih(output,n-1); 157 | turtle_turn(90); 158 | } 159 | 160 | 161 | // evruc trebliH 162 | public void treblih(OutputStream output,int n) throws IOException { 163 | if (n == 0) return; 164 | turtle_turn(-90); 165 | hilbert(output,n-1); 166 | turtle_goForward(output); 167 | turtle_turn(90); 168 | treblih(output,n-1); 169 | turtle_goForward(output); 170 | treblih(output,n-1); 171 | turtle_turn(90); 172 | turtle_goForward(output); 173 | hilbert(output,n-1); 174 | turtle_turn(-90); 175 | } 176 | 177 | 178 | public void turtle_turn(float degrees) { 179 | double n = degrees * Math.PI / 180.0; 180 | double newx = Math.cos(n) * turtle_dx + Math.sin(n) * turtle_dy; 181 | double newy = -Math.sin(n) * turtle_dx + Math.cos(n) * turtle_dy; 182 | double len = Math.sqrt(newx*newx + newy*newy); 183 | assert(len>0); 184 | turtle_dx = (float)(newx/len); 185 | turtle_dy = (float)(newy/len); 186 | } 187 | 188 | 189 | public void turtle_goForward(OutputStream output) throws IOException { 190 | //turtle_x += turtle_dx * distance; 191 | //turtle_y += turtle_dy * distance; 192 | //output.write(new String("G0 X"+(turtle_x)+" Y"+(turtle_y)+"\n").getBytes()); 193 | output.write(new String("G0 X"+(turtle_dx*turtle_step)+" Y"+(turtle_dy*turtle_step)+"\n").getBytes()); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /start.command: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SOURCE="${BASH_SOURCE[0]}" 3 | DIR="$( dirname "$SOURCE" )" 4 | while [ -h "$SOURCE" ] 5 | do 6 | SOURCE="$(readlink "$SOURCE")" 7 | [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" 8 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 9 | done 10 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 11 | 12 | java -jar "$DIR/gcodesender.jar" -------------------------------------------------------------------------------- /start32.bat: -------------------------------------------------------------------------------- 1 | :: special thanks to http://rgagnon.com/javadetails/java-0642.html 2 | :: http://stackoverflow.com/questions/638301/discover-from-a-batch-file-where-is-java-installed 3 | @echo off 4 | cls 5 | setlocal ENABLEEXTENSIONS 6 | :: 7 | :: get the current version 8 | :: 9 | FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment" /v CurrentVersion') DO set CurVer=%%B 10 | 11 | FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment\%CurVer%" /v JavaHome') DO set JAVA_HOME=%%B 12 | 13 | if defined JAVA_HOME ( 14 | @echo The current Java runtime is %CurVer% 15 | ) else ( 16 | @echo Java not found. 17 | goto end 18 | ) 19 | 20 | "%JAVA_HOME%\bin\java.exe" -jar gcodesender.jar 21 | 22 | :end 23 | @pause -------------------------------------------------------------------------------- /start64.bat: -------------------------------------------------------------------------------- 1 | :: special thanks to http://rgagnon.com/javadetails/java-0642.html 2 | :: http://stackoverflow.com/questions/638301/discover-from-a-batch-file-where-is-java-installed 3 | @echo off 4 | cls 5 | setlocal ENABLEEXTENSIONS 6 | :: 7 | :: get the current version 8 | :: 9 | FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment" /v CurrentVersion') DO set CurVer=%%B 10 | 11 | FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "HKLM\Software\JavaSoft\Java Runtime Environment\%CurVer%" /v JavaHome') DO set JAVA_HOME=%%B 12 | 13 | if defined JAVA_HOME ( 14 | @echo The current Java runtime is %CurVer% 15 | ) else ( 16 | @echo Java not found. 17 | goto end 18 | ) 19 | 20 | "%JAVA_HOME%\bin\java.exe" -jar gcodesender.jar 21 | 22 | :end 23 | @pause --------------------------------------------------------------------------------