Simple single-color 8x8x8 LED Cube with AVRs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cubeWorker.html 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!--NewPage-->
  3. <HTML>
  4. <HEAD>
  5. <!-- Generated by javadoc (build 1.6.0_07) on Mon Dec 12 09:47:07 GMT+01:00 2011 -->
  6. <TITLE>
  7. cubeWorker
  8. </TITLE>
  9. <META NAME="date" CONTENT="2011-12-12">
  10. <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
  11. <SCRIPT type="text/javascript">
  12. function windowTitle()
  13. {
  14. if (location.href.indexOf('is-external=true') == -1) {
  15. parent.document.title="cubeWorker";
  16. }
  17. }
  18. </SCRIPT>
  19. <NOSCRIPT>
  20. </NOSCRIPT>
  21. </HEAD>
  22. <BODY BGCOLOR="white" onload="windowTitle();">
  23. <HR>
  24. <!-- ========= START OF TOP NAVBAR ======= -->
  25. <A NAME="navbar_top"><!-- --></A>
  26. <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
  27. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  28. <TR>
  29. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  30. <A NAME="navbar_top_firstrow"><!-- --></A>
  31. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  32. <TR ALIGN="center" VALIGN="top">
  33. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  34. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  35. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  36. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  37. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  38. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  39. </TR>
  40. </TABLE>
  41. </TD>
  42. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  43. </EM>
  44. </TD>
  45. </TR>
  46. <TR>
  47. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  48. &nbsp;<A HREF="AnimationUtility.html" title="class in &lt;Unnamed&gt;"><B>PREV CLASS</B></A>&nbsp;
  49. &nbsp;<A HREF="Frame.html" title="class in &lt;Unnamed&gt;"><B>NEXT CLASS</B></A></FONT></TD>
  50. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  51. <A HREF="index.html?cubeWorker.html" target="_top"><B>FRAMES</B></A> &nbsp;
  52. &nbsp;<A HREF="cubeWorker.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  53. &nbsp;<SCRIPT type="text/javascript">
  54. <!--
  55. if(window==top) {
  56. document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
  57. }
  58. //-->
  59. </SCRIPT>
  60. <NOSCRIPT>
  61. <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
  62. </NOSCRIPT>
  63. </FONT></TD>
  64. </TR>
  65. <TR>
  66. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  67. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  68. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  69. DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  70. </TR>
  71. </TABLE>
  72. <A NAME="skip-navbar_top"></A>
  73. <!-- ========= END OF TOP NAVBAR ========= -->
  74. <HR>
  75. <!-- ======== START OF CLASS DATA ======== -->
  76. <H2>
  77. Class cubeWorker</H2>
  78. <PRE>
  79. java.lang.Object
  80. <IMG SRC="./resources/inherit.gif" ALT="extended by "><B>cubeWorker</B>
  81. </PRE>
  82. <HR>
  83. <DL>
  84. <DT><PRE>public class <B>cubeWorker</B><DT>extends java.lang.Object</DL>
  85. </PRE>
  86. <P>
  87. This class holds all Data of the Application. Additionally it performs the transmission of animation data to/from the cube and saves/loads animations in/from a file.
  88. <P>
  89. <P>
  90. <HR>
  91. <P>
  92. <!-- ========== METHOD SUMMARY =========== -->
  93. <A NAME="method_summary"><!-- --></A>
  94. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  95. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  96. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  97. <B>Method Summary</B></FONT></TH>
  98. </TR>
  99. <TR BGCOLOR="white" CLASS="TableRowColor">
  100. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  101. <CODE>&nbsp;int</CODE></FONT></TD>
  102. <TD><CODE><B><A HREF="cubeWorker.html#addAnimation()">addAnimation</A></B>()</CODE>
  103. <BR>
  104. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add an animation.</TD>
  105. </TR>
  106. <TR BGCOLOR="white" CLASS="TableRowColor">
  107. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  108. <CODE>&nbsp;int</CODE></FONT></TD>
  109. <TD><CODE><B><A HREF="cubeWorker.html#addFrame(int)">addFrame</A></B>(int&nbsp;anim)</CODE>
  110. <BR>
  111. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Add a Frame to an animation.</TD>
  112. </TR>
  113. <TR BGCOLOR="white" CLASS="TableRowColor">
  114. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  115. <CODE>&nbsp;boolean</CODE></FONT></TD>
  116. <TD><CODE><B><A HREF="cubeWorker.html#changedStateSinceSave()">changedStateSinceSave</A></B>()</CODE>
  117. <BR>
  118. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Check if something changed after loading/saving.</TD>
  119. </TR>
  120. <TR BGCOLOR="white" CLASS="TableRowColor">
  121. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  122. <CODE>&nbsp;int</CODE></FONT></TD>
  123. <TD><CODE><B><A HREF="cubeWorker.html#downloadState(java.lang.String)">downloadState</A></B>(java.lang.String&nbsp;port)</CODE>
  124. <BR>
  125. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get all animations from the cube, place it in this object</TD>
  126. </TR>
  127. <TR BGCOLOR="white" CLASS="TableRowColor">
  128. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  129. <CODE>&nbsp;int</CODE></FONT></TD>
  130. <TD><CODE><B><A HREF="cubeWorker.html#framesRemaining()">framesRemaining</A></B>()</CODE>
  131. <BR>
  132. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the number of frames you can add until the Cubes memory is full.</TD>
  133. </TR>
  134. <TR BGCOLOR="white" CLASS="TableRowColor">
  135. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  136. <CODE>&nbsp;java.lang.String</CODE></FONT></TD>
  137. <TD><CODE><B><A HREF="cubeWorker.html#getAnimationName(int)">getAnimationName</A></B>(int&nbsp;selectedAnimation)</CODE>
  138. <BR>
  139. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the name of an animation</TD>
  140. </TR>
  141. <TR BGCOLOR="white" CLASS="TableRowColor">
  142. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  143. <CODE>&nbsp;short[]</CODE></FONT></TD>
  144. <TD><CODE><B><A HREF="cubeWorker.html#getFrame(int, int)">getFrame</A></B>(int&nbsp;anim,
  145. int&nbsp;frame)</CODE>
  146. <BR>
  147. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the data of a frame.</TD>
  148. </TR>
  149. <TR BGCOLOR="white" CLASS="TableRowColor">
  150. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  151. <CODE>&nbsp;java.lang.String</CODE></FONT></TD>
  152. <TD><CODE><B><A HREF="cubeWorker.html#getFrameName(int, int)">getFrameName</A></B>(int&nbsp;anim,
  153. int&nbsp;frame)</CODE>
  154. <BR>
  155. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the name of a frame.</TD>
  156. </TR>
  157. <TR BGCOLOR="white" CLASS="TableRowColor">
  158. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  159. <CODE>&nbsp;short</CODE></FONT></TD>
  160. <TD><CODE><B><A HREF="cubeWorker.html#getFrameTime(int, int)">getFrameTime</A></B>(int&nbsp;anim,
  161. int&nbsp;frame)</CODE>
  162. <BR>
  163. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get frame duration.</TD>
  164. </TR>
  165. <TR BGCOLOR="white" CLASS="TableRowColor">
  166. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  167. <CODE>&nbsp;java.lang.String[]</CODE></FONT></TD>
  168. <TD><CODE><B><A HREF="cubeWorker.html#getSerialPorts()">getSerialPorts</A></B>()</CODE>
  169. <BR>
  170. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the names of all available serial ports.</TD>
  171. </TR>
  172. <TR BGCOLOR="white" CLASS="TableRowColor">
  173. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  174. <CODE>&nbsp;int</CODE></FONT></TD>
  175. <TD><CODE><B><A HREF="cubeWorker.html#loadState(java.lang.String)">loadState</A></B>(java.lang.String&nbsp;path)</CODE>
  176. <BR>
  177. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Loads an animation file into this worker.</TD>
  178. </TR>
  179. <TR BGCOLOR="white" CLASS="TableRowColor">
  180. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  181. <CODE>&nbsp;void</CODE></FONT></TD>
  182. <TD><CODE><B><A HREF="cubeWorker.html#moveAnimation(int, int)">moveAnimation</A></B>(int&nbsp;dir,
  183. int&nbsp;selectedAnimation)</CODE>
  184. <BR>
  185. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Move an animation UP or DOWN.</TD>
  186. </TR>
  187. <TR BGCOLOR="white" CLASS="TableRowColor">
  188. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  189. <CODE>&nbsp;void</CODE></FONT></TD>
  190. <TD><CODE><B><A HREF="cubeWorker.html#moveFrame(int, int, int)">moveFrame</A></B>(int&nbsp;dir,
  191. int&nbsp;anim,
  192. int&nbsp;frame)</CODE>
  193. <BR>
  194. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Move a frame.</TD>
  195. </TR>
  196. <TR BGCOLOR="white" CLASS="TableRowColor">
  197. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  198. <CODE>&nbsp;int</CODE></FONT></TD>
  199. <TD><CODE><B><A HREF="cubeWorker.html#numOfAnimations()">numOfAnimations</A></B>()</CODE>
  200. <BR>
  201. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the number of animations in this worker.</TD>
  202. </TR>
  203. <TR BGCOLOR="white" CLASS="TableRowColor">
  204. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  205. <CODE>&nbsp;int</CODE></FONT></TD>
  206. <TD><CODE><B><A HREF="cubeWorker.html#numOfFrames(int)">numOfFrames</A></B>(int&nbsp;selectedAnimation)</CODE>
  207. <BR>
  208. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the number of frames in an animation.</TD>
  209. </TR>
  210. <TR BGCOLOR="white" CLASS="TableRowColor">
  211. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  212. <CODE>&nbsp;boolean</CODE></FONT></TD>
  213. <TD><CODE><B><A HREF="cubeWorker.html#probeCubeConnected(java.lang.String)">probeCubeConnected</A></B>(java.lang.String&nbsp;port)</CODE>
  214. <BR>
  215. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Try to speak with the cube.</TD>
  216. </TR>
  217. <TR BGCOLOR="white" CLASS="TableRowColor">
  218. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  219. <CODE>&nbsp;void</CODE></FONT></TD>
  220. <TD><CODE><B><A HREF="cubeWorker.html#removeAnimation(int)">removeAnimation</A></B>(int&nbsp;selectedAnimation)</CODE>
  221. <BR>
  222. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Remove an animation.</TD>
  223. </TR>
  224. <TR BGCOLOR="white" CLASS="TableRowColor">
  225. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  226. <CODE>&nbsp;void</CODE></FONT></TD>
  227. <TD><CODE><B><A HREF="cubeWorker.html#removeFrame(int, int)">removeFrame</A></B>(int&nbsp;anim,
  228. int&nbsp;frame)</CODE>
  229. <BR>
  230. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Remove a frame.</TD>
  231. </TR>
  232. <TR BGCOLOR="white" CLASS="TableRowColor">
  233. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  234. <CODE>&nbsp;int</CODE></FONT></TD>
  235. <TD><CODE><B><A HREF="cubeWorker.html#saveState(java.lang.String)">saveState</A></B>(java.lang.String&nbsp;path)</CODE>
  236. <BR>
  237. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Save the state of this object into a file.</TD>
  238. </TR>
  239. <TR BGCOLOR="white" CLASS="TableRowColor">
  240. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  241. <CODE>&nbsp;void</CODE></FONT></TD>
  242. <TD><CODE><B><A HREF="cubeWorker.html#setAnimationName(java.lang.String, int)">setAnimationName</A></B>(java.lang.String&nbsp;s,
  243. int&nbsp;selectedAnimation)</CODE>
  244. <BR>
  245. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the name of an animation
  246.  @param s New name</TD>
  247. </TR>
  248. <TR BGCOLOR="white" CLASS="TableRowColor">
  249. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  250. <CODE>&nbsp;void</CODE></FONT></TD>
  251. <TD><CODE><B><A HREF="cubeWorker.html#setFrame(short[], int, int)">setFrame</A></B>(short[]&nbsp;data,
  252. int&nbsp;anim,
  253. int&nbsp;frame)</CODE>
  254. <BR>
  255. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the data of a frame</TD>
  256. </TR>
  257. <TR BGCOLOR="white" CLASS="TableRowColor">
  258. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  259. <CODE>&nbsp;void</CODE></FONT></TD>
  260. <TD><CODE><B><A HREF="cubeWorker.html#setFrameName(java.lang.String, int, int)">setFrameName</A></B>(java.lang.String&nbsp;s,
  261. int&nbsp;anim,
  262. int&nbsp;frame)</CODE>
  263. <BR>
  264. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the name of a frame.</TD>
  265. </TR>
  266. <TR BGCOLOR="white" CLASS="TableRowColor">
  267. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  268. <CODE>&nbsp;void</CODE></FONT></TD>
  269. <TD><CODE><B><A HREF="cubeWorker.html#setFrameTime(short, int, int)">setFrameTime</A></B>(short&nbsp;time,
  270. int&nbsp;anim,
  271. int&nbsp;frame)</CODE>
  272. <BR>
  273. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the frames duration.</TD>
  274. </TR>
  275. <TR BGCOLOR="white" CLASS="TableRowColor">
  276. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  277. <CODE>&nbsp;int</CODE></FONT></TD>
  278. <TD><CODE><B><A HREF="cubeWorker.html#uploadState(java.lang.String)">uploadState</A></B>(java.lang.String&nbsp;port)</CODE>
  279. <BR>
  280. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Send all animations to the cube.</TD>
  281. </TR>
  282. </TABLE>
  283. &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
  284. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  285. <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
  286. <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
  287. </TR>
  288. <TR BGCOLOR="white" CLASS="TableRowColor">
  289. <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
  290. </TR>
  291. </TABLE>
  292. &nbsp;
  293. <P>
  294. <!-- ============ METHOD DETAIL ========== -->
  295. <A NAME="method_detail"><!-- --></A>
  296. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  297. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  298. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  299. <B>Method Detail</B></FONT></TH>
  300. </TR>
  301. </TABLE>
  302. <A NAME="numOfAnimations()"><!-- --></A><H3>
  303. numOfAnimations</H3>
  304. <PRE>
  305. public int <B>numOfAnimations</B>()</PRE>
  306. <DL>
  307. <DD>Get the number of animations in this worker.
  308. <P>
  309. <DD><DL>
  310. <DT><B>Returns:</B><DD>number of animations</DL>
  311. </DD>
  312. </DL>
  313. <HR>
  314. <A NAME="numOfFrames(int)"><!-- --></A><H3>
  315. numOfFrames</H3>
  316. <PRE>
  317. public int <B>numOfFrames</B>(int&nbsp;selectedAnimation)</PRE>
  318. <DL>
  319. <DD>Get the number of frames in an animation.
  320. <P>
  321. <DD><DL>
  322. <DT><B>Parameters:</B><DD><CODE>selectedAnimation</CODE> - the animation you want to check
  323. <DT><B>Returns:</B><DD>number of frames in this animation</DL>
  324. </DD>
  325. </DL>
  326. <HR>
  327. <A NAME="framesRemaining()"><!-- --></A><H3>
  328. framesRemaining</H3>
  329. <PRE>
  330. public int <B>framesRemaining</B>()</PRE>
  331. <DL>
  332. <DD>Get the number of frames you can add until the Cubes memory is full.
  333. <P>
  334. <DD><DL>
  335. <DT><B>Returns:</B><DD>number of frames remaining</DL>
  336. </DD>
  337. </DL>
  338. <HR>
  339. <A NAME="addAnimation()"><!-- --></A><H3>
  340. addAnimation</H3>
  341. <PRE>
  342. public int <B>addAnimation</B>()</PRE>
  343. <DL>
  344. <DD>Add an animation.
  345. <P>
  346. <DD><DL>
  347. <DT><B>Returns:</B><DD>Index of new animation, or -1 if not enough space remaining.</DL>
  348. </DD>
  349. </DL>
  350. <HR>
  351. <A NAME="removeAnimation(int)"><!-- --></A><H3>
  352. removeAnimation</H3>
  353. <PRE>
  354. public void <B>removeAnimation</B>(int&nbsp;selectedAnimation)</PRE>
  355. <DL>
  356. <DD>Remove an animation.
  357. <P>
  358. <DD><DL>
  359. <DT><B>Parameters:</B><DD><CODE>selectedAnimation</CODE> - the animation you want to delete</DL>
  360. </DD>
  361. </DL>
  362. <HR>
  363. <A NAME="getAnimationName(int)"><!-- --></A><H3>
  364. getAnimationName</H3>
  365. <PRE>
  366. public java.lang.String <B>getAnimationName</B>(int&nbsp;selectedAnimation)</PRE>
  367. <DL>
  368. <DD>Get the name of an animation
  369. <P>
  370. <DD><DL>
  371. <DT><B>Parameters:</B><DD><CODE>selectedAnimation</CODE> - The animation you want to get the name from
  372. <DT><B>Returns:</B><DD>The name</DL>
  373. </DD>
  374. </DL>
  375. <HR>
  376. <A NAME="setAnimationName(java.lang.String, int)"><!-- --></A><H3>
  377. setAnimationName</H3>
  378. <PRE>
  379. public void <B>setAnimationName</B>(java.lang.String&nbsp;s,
  380. int&nbsp;selectedAnimation)</PRE>
  381. <DL>
  382. <DD>Set the name of an animation
  383.  @param s New name
  384. <P>
  385. <DD><DL>
  386. <DT><B>Parameters:</B><DD><CODE>selectedAnimation</CODE> - Index of the animation you want to change</DL>
  387. </DD>
  388. </DL>
  389. <HR>
  390. <A NAME="moveAnimation(int, int)"><!-- --></A><H3>
  391. moveAnimation</H3>
  392. <PRE>
  393. public void <B>moveAnimation</B>(int&nbsp;dir,
  394. int&nbsp;selectedAnimation)</PRE>
  395. <DL>
  396. <DD>Move an animation UP or DOWN.
  397. <P>
  398. <DD><DL>
  399. <DT><B>Parameters:</B><DD><CODE>dir</CODE> - Direction. Use UP and DOWN defined in cubeWorker<DD><CODE>selectedAnimation</CODE> - Animation you want to move</DL>
  400. </DD>
  401. </DL>
  402. <HR>
  403. <A NAME="getFrameName(int, int)"><!-- --></A><H3>
  404. getFrameName</H3>
  405. <PRE>
  406. public java.lang.String <B>getFrameName</B>(int&nbsp;anim,
  407. int&nbsp;frame)</PRE>
  408. <DL>
  409. <DD>Get the name of a frame.
  410. <P>
  411. <DD><DL>
  412. <DT><B>Parameters:</B><DD><CODE>anim</CODE> - Animation the frame is in<DD><CODE>frame</CODE> - Index of the frame</DL>
  413. </DD>
  414. </DL>
  415. <HR>
  416. <A NAME="setFrameName(java.lang.String, int, int)"><!-- --></A><H3>
  417. setFrameName</H3>
  418. <PRE>
  419. public void <B>setFrameName</B>(java.lang.String&nbsp;s,
  420. int&nbsp;anim,
  421. int&nbsp;frame)</PRE>
  422. <DL>
  423. <DD>Set the name of a frame.
  424. <P>
  425. <DD><DL>
  426. <DT><B>Parameters:</B><DD><CODE>s</CODE> - New name<DD><CODE>anim</CODE> - Animation Index<DD><CODE>frame</CODE> - Frame Index</DL>
  427. </DD>
  428. </DL>
  429. <HR>
  430. <A NAME="addFrame(int)"><!-- --></A><H3>
  431. addFrame</H3>
  432. <PRE>
  433. public int <B>addFrame</B>(int&nbsp;anim)</PRE>
  434. <DL>
  435. <DD>Add a Frame to an animation.
  436. <P>
  437. <DD><DL>
  438. <DT><B>Parameters:</B><DD><CODE>anim</CODE> - Animation Index
  439. <DT><B>Returns:</B><DD>Index of new Frame or -1 if not enough space</DL>
  440. </DD>
  441. </DL>
  442. <HR>
  443. <A NAME="removeFrame(int, int)"><!-- --></A><H3>
  444. removeFrame</H3>
  445. <PRE>
  446. public void <B>removeFrame</B>(int&nbsp;anim,
  447. int&nbsp;frame)</PRE>
  448. <DL>
  449. <DD>Remove a frame.
  450. <P>
  451. <DD><DL>
  452. <DT><B>Parameters:</B><DD><CODE>anim</CODE> - Animation Index<DD><CODE>frame</CODE> - Frame you want to remove</DL>
  453. </DD>
  454. </DL>
  455. <HR>
  456. <A NAME="getFrame(int, int)"><!-- --></A><H3>
  457. getFrame</H3>
  458. <PRE>
  459. public short[] <B>getFrame</B>(int&nbsp;anim,
  460. int&nbsp;frame)</PRE>
  461. <DL>
  462. <DD>Get the data of a frame.
  463. <P>
  464. <DD><DL>
  465. <DT><B>Parameters:</B><DD><CODE>anim</CODE> - Animation Index
  466.  @param frame Frame Index
  467. <DT><B>Returns:</B><DD>64 byte array with data (8 bits per byte => 512 bits)</DL>
  468. </DD>
  469. </DL>
  470. <HR>
  471. <A NAME="setFrame(short[], int, int)"><!-- --></A><H3>
  472. setFrame</H3>
  473. <PRE>
  474. public void <B>setFrame</B>(short[]&nbsp;data,
  475. int&nbsp;anim,
  476. int&nbsp;frame)</PRE>
  477. <DL>
  478. <DD>Set the data of a frame
  479. <P>
  480. <DD><DL>
  481. <DT><B>Parameters:</B><DD><CODE>data</CODE> - 64 byte array with data<DD><CODE>anim</CODE> - Animation Index<DD><CODE>frame</CODE> - Frame Index<DT><B>See Also:</B><DD><A HREF="cubeWorker.html#getFrame(int, int)"><CODE>getFrame()</CODE></A></DL>
  482. </DD>
  483. </DL>
  484. <HR>
  485. <A NAME="getFrameTime(int, int)"><!-- --></A><H3>
  486. getFrameTime</H3>
  487. <PRE>
  488. public short <B>getFrameTime</B>(int&nbsp;anim,
  489. int&nbsp;frame)</PRE>
  490. <DL>
  491. <DD>Get frame duration.
  492. <P>
  493. <DD><DL>
  494. <DT><B>Parameters:</B><DD><CODE>anim</CODE> - Animation Index<DD><CODE>frame</CODE> - Frame Index
  495. <DT><B>Returns:</B><DD>Duration. 0 means 1/24th of a second.</DL>
  496. </DD>
  497. </DL>
  498. <HR>
  499. <A NAME="setFrameTime(short, int, int)"><!-- --></A><H3>
  500. setFrameTime</H3>
  501. <PRE>
  502. public void <B>setFrameTime</B>(short&nbsp;time,
  503. int&nbsp;anim,
  504. int&nbsp;frame)</PRE>
  505. <DL>
  506. <DD>Set the frames duration.
  507. <P>
  508. <DD><DL>
  509. <DT><B>Parameters:</B><DD><CODE>time</CODE> - New duration<DD><CODE>anim</CODE> - Animation Index<DD><CODE>frame</CODE> - Frame Index<DT><B>See Also:</B><DD><A HREF="cubeWorker.html#getFrameTime(int, int)"><CODE>getFrameTime()</CODE></A></DL>
  510. </DD>
  511. </DL>
  512. <HR>
  513. <A NAME="moveFrame(int, int, int)"><!-- --></A><H3>
  514. moveFrame</H3>
  515. <PRE>
  516. public void <B>moveFrame</B>(int&nbsp;dir,
  517. int&nbsp;anim,
  518. int&nbsp;frame)</PRE>
  519. <DL>
  520. <DD>Move a frame.
  521. <P>
  522. <DD><DL>
  523. <DT><B>Parameters:</B><DD><CODE>dir</CODE> - Direction to move. Use UP and DOWN from cubeWorker<DD><CODE>anim</CODE> - Animation Index<DD><CODE>frame</CODE> - Frame Index<DT><B>See Also:</B><DD><A HREF="cubeWorker.html#moveAnimation(int, int)"><CODE>moveAnimation()</CODE></A></DL>
  524. </DD>
  525. </DL>
  526. <HR>
  527. <A NAME="loadState(java.lang.String)"><!-- --></A><H3>
  528. loadState</H3>
  529. <PRE>
  530. public int <B>loadState</B>(java.lang.String&nbsp;path)</PRE>
  531. <DL>
  532. <DD>Loads an animation file into this worker.
  533. <P>
  534. <DD><DL>
  535. <DT><B>Parameters:</B><DD><CODE>path</CODE> - Path of file to load
  536. <DT><B>Returns:</B><DD>0 on success, -1 on error.</DL>
  537. </DD>
  538. </DL>
  539. <HR>
  540. <A NAME="saveState(java.lang.String)"><!-- --></A><H3>
  541. saveState</H3>
  542. <PRE>
  543. public int <B>saveState</B>(java.lang.String&nbsp;path)</PRE>
  544. <DL>
  545. <DD>Save the state of this object into a file.
  546. <P>
  547. <DD><DL>
  548. <DT><B>Parameters:</B><DD><CODE>path</CODE> - Path to save file in
  549. <DT><B>Returns:</B><DD>0 on success, -1 on error</DL>
  550. </DD>
  551. </DL>
  552. <HR>
  553. <A NAME="changedStateSinceSave()"><!-- --></A><H3>
  554. changedStateSinceSave</H3>
  555. <PRE>
  556. public boolean <B>changedStateSinceSave</B>()</PRE>
  557. <DL>
  558. <DD>Check if something changed after loading/saving.
  559. <P>
  560. <DD><DL>
  561. <DT><B>Returns:</B><DD>TRUE if something changed, FALSE otherwise</DL>
  562. </DD>
  563. </DL>
  564. <HR>
  565. <A NAME="uploadState(java.lang.String)"><!-- --></A><H3>
  566. uploadState</H3>
  567. <PRE>
  568. public int <B>uploadState</B>(java.lang.String&nbsp;port)</PRE>
  569. <DL>
  570. <DD>Send all animations to the cube.
  571. <P>
  572. <DD><DL>
  573. <DT><B>Parameters:</B><DD><CODE>port</CODE> - Name of serial port to use
  574. <DT><B>Returns:</B><DD>0 on success, -1 on error</DL>
  575. </DD>
  576. </DL>
  577. <HR>
  578. <A NAME="downloadState(java.lang.String)"><!-- --></A><H3>
  579. downloadState</H3>
  580. <PRE>
  581. public int <B>downloadState</B>(java.lang.String&nbsp;port)</PRE>
  582. <DL>
  583. <DD>Get all animations from the cube, place it in this object
  584. <P>
  585. <DD><DL>
  586. <DT><B>Parameters:</B><DD><CODE>port</CODE> - Name of serial port to use
  587.  @return 0 on success, -1 on error</DL>
  588. </DD>
  589. </DL>
  590. <HR>
  591. <A NAME="probeCubeConnected(java.lang.String)"><!-- --></A><H3>
  592. probeCubeConnected</H3>
  593. <PRE>
  594. public boolean <B>probeCubeConnected</B>(java.lang.String&nbsp;port)</PRE>
  595. <DL>
  596. <DD>Try to speak with the cube.
  597. <P>
  598. <DD><DL>
  599. <DT><B>Parameters:</B><DD><CODE>port</CODE> - Name of serial port
  600. <DT><B>Returns:</B><DD>TRUE if cube responds</DL>
  601. </DD>
  602. </DL>
  603. <HR>
  604. <A NAME="getSerialPorts()"><!-- --></A><H3>
  605. getSerialPorts</H3>
  606. <PRE>
  607. public java.lang.String[] <B>getSerialPorts</B>()</PRE>
  608. <DL>
  609. <DD>Get the names of all available serial ports.
  610. <P>
  611. <DD><DL>
  612. <DT><B>Returns:</B><DD>Array of port names. First entry is always "Select serial port..."</DL>
  613. </DD>
  614. </DL>
  615. <!-- ========= END OF CLASS DATA ========= -->
  616. <HR>
  617. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  618. <A NAME="navbar_bottom"><!-- --></A>
  619. <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
  620. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  621. <TR>
  622. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  623. <A NAME="navbar_bottom_firstrow"><!-- --></A>
  624. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  625. <TR ALIGN="center" VALIGN="top">
  626. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  627. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  628. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  629. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  630. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  631. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  632. </TR>
  633. </TABLE>
  634. </TD>
  635. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  636. </EM>
  637. </TD>
  638. </TR>
  639. <TR>
  640. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  641. &nbsp;<A HREF="AnimationUtility.html" title="class in &lt;Unnamed&gt;"><B>PREV CLASS</B></A>&nbsp;
  642. &nbsp;<A HREF="Frame.html" title="class in &lt;Unnamed&gt;"><B>NEXT CLASS</B></A></FONT></TD>
  643. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  644. <A HREF="index.html?cubeWorker.html" target="_top"><B>FRAMES</B></A> &nbsp;
  645. &nbsp;<A HREF="cubeWorker.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  646. &nbsp;<SCRIPT type="text/javascript">
  647. <!--
  648. if(window==top) {
  649. document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
  650. }
  651. //-->
  652. </SCRIPT>
  653. <NOSCRIPT>
  654. <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
  655. </NOSCRIPT>
  656. </FONT></TD>
  657. </TR>
  658. <TR>
  659. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  660. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  661. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  662. DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  663. </TR>
  664. </TABLE>
  665. <A NAME="skip-navbar_bottom"></A>
  666. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  667. <HR>
  668. </BODY>
  669. </HTML>