浏览代码

Start helper from debug menu

Thomas Buck 12 年前
父节点
当前提交
f58bf4fafb

+ 23
- 9
Cube Control/Frame.java 查看文件

77
   private JButton frameDuration = new JButton();
77
   private JButton frameDuration = new JButton();
78
   // Ende Attribute
78
   // Ende Attribute
79
 
79
 
80
-  private cubeWorker worker = new cubeWorker();
80
+  public cubeWorker worker = new cubeWorker();
81
   private boolean fileSelected = false;
81
   private boolean fileSelected = false;
82
   // Ende Variablen
82
   // Ende Variablen
83
 
83
 
762
     Frame f = new Frame("Cube Control");
762
     Frame f = new Frame("Cube Control");
763
   Led3D l = f.get3D();
763
   Led3D l = f.get3D();
764
   java.util.Scanner sc = new java.util.Scanner(System.in);
764
   java.util.Scanner sc = new java.util.Scanner(System.in);
765
-
766
   System.out.println("#### Cube Control Debug Console ####");
765
   System.out.println("#### Cube Control Debug Console ####");
767
   System.out.println("## Enter a Command ('h' for help) ##");
766
   System.out.println("## Enter a Command ('h' for help) ##");
768
   System.out.print("$> ");
767
   System.out.print("$> ");
769
 
768
 
770
   do {
769
   do {
771
-    if (sc.hasNext()) {
772
-      String s = sc.next();
770
+    if (sc.hasNextLine()) {
771
+      String s = sc.nextLine();
773
       
772
       
774
       if (s.equals("p") || (s.equals("print")))
773
       if (s.equals("p") || (s.equals("print")))
775
         l.printTranslationData();
774
         l.printTranslationData();
795
         System.out.println("All LEDs off now...");
794
         System.out.println("All LEDs off now...");
796
       }
795
       }
797
 
796
 
797
+	  if (s.equals("e") || s.equals("exec")) {
798
+  	  		System.out.println(HelperUtility.runHelper(new String[0]));
799
+	  }
800
+
801
+	  if (s.startsWith("e ") || s.startsWith("exec ")) {
802
+			int pos = 0;
803
+			while (s.charAt(pos) != ' ') {
804
+				pos++;
805
+			}
806
+			String[] arr = new String[1];
807
+			arr[0] = s.substring(pos + 1);
808
+			System.out.println(HelperUtility.runHelper(arr));
809
+	  }
810
+
798
       if (s.equals("h") || (s.equals("help"))) {
811
       if (s.equals("h") || (s.equals("help"))) {
799
         System.out.println("Commands:");
812
         System.out.println("Commands:");
800
-        System.out.println("\t'on'    / '1'\t:\tToggle all LEDs on");
801
-        System.out.println("\t'off'   / '0'\t:\tToggle all LEDs off");
802
-        System.out.println("\t'print' / 'p'\t:\tPrint 3D Translation Matrix Data");
803
-        System.out.println("\t'help'  / 'h'\t:\tShow this message");
804
-        System.out.println("\t'quit'  / 'q'\t:\tExit Cube Control");
813
+        System.out.println("\t'on'     / '1'\t:\tToggle all LEDs on");
814
+        System.out.println("\t'off'    / '0'\t:\tToggle all LEDs off");
815
+        System.out.println("\t'print'  / 'p'\t:\tPrint 3D Translation Matrix Data");
816
+		System.out.println("\t'exec'   / 'e'\t:\tExecute helper with given args");
817
+        System.out.println("\t'help'   / 'h'\t:\tShow this message");
818
+        System.out.println("\t'quit'   / 'q'\t:\tExit Cube Control");
805
       }
819
       }
806
 
820
 
807
       System.out.print("$> ");
821
       System.out.print("$> ");

+ 10
- 17
Cube Control/HelperUtility.java 查看文件

83
 			BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
83
 			BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
84
 			String line;
84
 			String line;
85
 			boolean fin = false;
85
 			boolean fin = false;
86
+
87
+			while ((line = br.readLine()) != null) {
88
+				ret = ret + line + "\n";
89
+			}
86
 			
90
 			
87
-			do { // Wait for process to finish... Doesn't work...?
88
-				fin = false;
89
-				try {
90
-					p.waitFor();
91
-				} catch (Exception e) {
92
-					fin = true;
93
-				}
91
+			p.waitFor();
94
 
92
 
95
-				// Read output in same loop... Should work...!
96
-				line = br.readLine();
97
-				if (line != null) {
98
-					ret = ret + line + "\n";
99
-					fin = true;
100
-				}
101
-			} while (fin);
93
+			while ((line = br.readLine()) != null) {
94
+				ret = ret + line + "\n";
95
+			}
102
 
96
 
103
 			br.close();
97
 			br.close();
104
-			if (ret.length() == 0) {
105
-				ret = "g"; // We have added a last \n... We will remove it, so add garbage to be removed...
98
+			if (ret.length() > 0) {
99
+				ret = ret.substring(0, ret.length() - 1);
106
 			}
100
 			}
107
-			ret = ret.substring(0, ret.length() - 1);
108
 			return ret;
101
 			return ret;
109
 		} catch(Exception e) {
102
 		} catch(Exception e) {
110
 			e.printStackTrace();
103
 			e.printStackTrace();

+ 1
- 1
Cube Control/doc/AFrame.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:33 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:38 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 AFrame
7
 AFrame
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/Animation.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:33 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:38 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Animation
7
 Animation
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/AnimationUtility.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:33 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:39 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 AnimationUtility
7
 AnimationUtility
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/HelperUtility.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:34 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 HelperUtility
7
 HelperUtility
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/Led3D.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Led3D
7
 Led3D
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/allclasses-frame.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 All Classes
7
 All Classes
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/allclasses-noframe.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 All Classes
7
 All Classes
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/constant-values.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Constant Field Values
7
 Constant Field Values
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/cubeWorker.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:33 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:39 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 cubeWorker
7
 cubeWorker
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/deprecated-list.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Deprecated List
7
 Deprecated List
8
 </TITLE>
8
 </TITLE>

+ 19
- 1
Cube Control/doc/frame.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:33 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:39 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Frame
7
 Frame
8
 </TITLE>
8
 </TITLE>
184
 <BR>
184
 <BR>
185
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
185
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
186
 </TR>
186
 </TR>
187
+<TR BGCOLOR="white" CLASS="TableRowColor">
188
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
189
+<CODE>&nbsp;<A HREF="cubeWorker.html" title="class in &lt;Unnamed&gt;">cubeWorker</A></CODE></FONT></TD>
190
+<TD><CODE><B><A HREF="Frame.html#worker">worker</A></B></CODE>
191
+
192
+<BR>
193
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
194
+</TR>
187
 </TABLE>
195
 </TABLE>
188
 &nbsp;<A NAME="fields_inherited_from_class_javax.swing.JFrame"><!-- --></A>
196
 &nbsp;<A NAME="fields_inherited_from_class_javax.swing.JFrame"><!-- --></A>
189
 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
197
 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
532
 <DL>
540
 <DL>
533
 </DL>
541
 </DL>
534
 </DL>
542
 </DL>
543
+<HR>
544
+
545
+<A NAME="worker"><!-- --></A><H3>
546
+worker</H3>
547
+<PRE>
548
+public <A HREF="cubeWorker.html" title="class in &lt;Unnamed&gt;">cubeWorker</A> <B>worker</B></PRE>
549
+<DL>
550
+<DL>
551
+</DL>
552
+</DL>
535
 
553
 
536
 <!-- ========= CONSTRUCTOR DETAIL ======== -->
554
 <!-- ========= CONSTRUCTOR DETAIL ======== -->
537
 
555
 

+ 1
- 1
Cube Control/doc/help-doc.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 API Help
7
 API Help
8
 </TITLE>
8
 </TITLE>

+ 4
- 1
Cube Control/doc/index-all.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Index
7
 Index
8
 </TITLE>
8
 </TITLE>
398
 <A NAME="_W_"><!-- --></A><H2>
398
 <A NAME="_W_"><!-- --></A><H2>
399
 <B>W</B></H2>
399
 <B>W</B></H2>
400
 <DL>
400
 <DL>
401
+<DT><A HREF="./Frame.html#worker"><B>worker</B></A> - 
402
+Variable in class <A HREF="./Frame.html" title="class in &lt;Unnamed&gt;">Frame</A>
403
+<DD>&nbsp;
401
 <DT><A HREF="./AnimationUtility.html#writeFile(java.lang.String, java.util.ArrayList)"><B>writeFile(String, ArrayList&lt;Animation&gt;)</B></A> - 
404
 <DT><A HREF="./AnimationUtility.html#writeFile(java.lang.String, java.util.ArrayList)"><B>writeFile(String, ArrayList&lt;Animation&gt;)</B></A> - 
402
 Static method in class <A HREF="./AnimationUtility.html" title="class in &lt;Unnamed&gt;">AnimationUtility</A>
405
 Static method in class <A HREF="./AnimationUtility.html" title="class in &lt;Unnamed&gt;">AnimationUtility</A>
403
 <DD>Write a file with all Animations of an ArrayList
406
 <DD>Write a file with all Animations of an ArrayList

+ 1
- 1
Cube Control/doc/index.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc on Mon Dec 05 20:09:35 CET 2011-->
5
+<!-- Generated by javadoc on Mon Dec 05 21:22:40 CET 2011-->
6
 <TITLE>
6
 <TITLE>
7
 Generated Documentation (Untitled)
7
 Generated Documentation (Untitled)
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/layerEditFrame.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:34 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 layerEditFrame
7
 layerEditFrame
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/overview-tree.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Class Hierarchy
7
 Class Hierarchy
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/package-frame.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 &lt;Unnamed&gt;
7
 &lt;Unnamed&gt;
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/package-summary.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 
7
 
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/package-tree.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
  Class Hierarchy
7
  Class Hierarchy
8
 </TITLE>
8
 </TITLE>

+ 1
- 1
Cube Control/doc/serialized-form.html 查看文件

2
 <!--NewPage-->
2
 <!--NewPage-->
3
 <HTML>
3
 <HTML>
4
 <HEAD>
4
 <HEAD>
5
-<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 20:09:35 CET 2011 -->
5
+<!-- Generated by javadoc (build 1.6.0_29) on Mon Dec 05 21:22:40 CET 2011 -->
6
 <TITLE>
6
 <TITLE>
7
 Serialized Form
7
 Serialized Form
8
 </TITLE>
8
 </TITLE>

+ 4
- 2
Cube Control/serialHelper.c 查看文件

51
 int main(int argc, char *argv[]) {
51
 int main(int argc, char *argv[]) {
52
 	size_t length, written;
52
 	size_t length, written;
53
 
53
 
54
-		printf("Debugging Worker... Ignore me!\n");
54
+		// printf("Debugging Worker... Ignore me!\n");
55
 
55
 
56
 		if (argc < 2) {
56
 		if (argc < 2) {
57
 			usage(argv[0]);
57
 			usage(argv[0]);
93
 				written = serialWrite(fileData, length);
93
 				written = serialWrite(fileData, length);
94
 			}
94
 			}
95
 
95
 
96
-		} else {
96
+		} else if (argv[1][0] == 'r') {
97
 
97
 
98
 			if (argc != 4) {
98
 			if (argc != 4) {
99
 				usage(argv[0]);
99
 				usage(argv[0]);
120
 
120
 
121
 			printFileData(length);
121
 			printFileData(length);
122
 
122
 
123
+		} else {
124
+			printf("Unrecognized Option: %s\n", argv[1]);
123
 		}
125
 		}
124
 
126
 
125
 		free(fileData);
127
 		free(fileData);

正在加载...
取消
保存