Simple single-color 8x8x8 LED Cube with AVRs
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

cubeWorker.java 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * cubeWorker.java
  3. *
  4. * Copyright 2011 Thomas Buck <xythobuz@me.com>
  5. * Copyright 2011 Max Nuding <max.nuding@gmail.com>
  6. * Copyright 2011 Felix Bäder <baeder.felix@gmail.com>
  7. *
  8. * This file is part of LED-Cube.
  9. *
  10. * LED-Cube is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * LED-Cube is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with LED-Cube. If not, see <http://www.gnu.org/licenses/>.
  22. */
  23. public class cubeWorker {
  24. final int UP = 0;
  25. final int DOWN = 1;
  26. cubeWorker() {
  27. }
  28. // Adds a new Animation
  29. // Returns id if ok, -1 if error or not enough space for
  30. // another animation
  31. public int addAnimation() {
  32. return -1;
  33. }
  34. // Removes an animation
  35. public void removeAnimation(int index) {
  36. }
  37. // Returns how many animations are defined
  38. public int numOfAnimations() {
  39. return 3;
  40. }
  41. // Selects an animation, on which the frame specific functions operate
  42. // Returns -1 if it does not exist
  43. public int selectAnimation(int index) {
  44. System.out.println("Animation " + index + " selected");
  45. return -1;
  46. }
  47. public String getAnimationName(int index) {
  48. return "TestAnim";
  49. }
  50. public void setAnimationName(int index, String s) {
  51. }
  52. public void moveAnimation(int dir){
  53. if (dir == UP){
  54. //animation moved up
  55. } else if (dir == DOWN){
  56. //animation moved down
  57. }
  58. }
  59. // Returns how many frames are in the current animation
  60. public int numOfFrames() {
  61. return 3;
  62. }
  63. public String getFrameName(int index) {
  64. return "Test";
  65. }
  66. public void setFrameName(int index, String s) {
  67. }
  68. // Adds a Frame to the current animation.
  69. // Returns id if okay, -1 if error
  70. public int addFrame() {
  71. return -1;
  72. }
  73. // Remove a frame
  74. public void removeFrame(int index) {
  75. }
  76. // Returns array with 64 bytes with led values
  77. public byte[] getFrame(int index) {
  78. return null;
  79. }
  80. public void setFrame(int index, byte[] data) {
  81. }
  82. public void moveFrame(int dir){
  83. if (dir == UP){
  84. //animation moved up
  85. } else if (dir == DOWN){
  86. //animation moved down
  87. }
  88. }
  89. // Loads an animation file into this object
  90. public int loadState(String path) {
  91. return 0;
  92. }
  93. // Saves the state of this object in an animation file
  94. public int saveState(String path) {
  95. System.out.println("Saving to " + path);
  96. return 0;
  97. }
  98. // sends state of object to led cube
  99. public int uploadState(String port) {
  100. return 0;
  101. }
  102. // loads all state from the cube into this object
  103. public int downloadState(String port) {
  104. return 0;
  105. }
  106. // Tells how many Frames you can add until you reached 1 Mbit...
  107. public int framesRemaining() {
  108. return 0;
  109. }
  110. public String[] getSerialPorts() {
  111. String[] sPorts = {"Select serial port..."};
  112. return sPorts;
  113. }
  114. // Returns true if last saved state != current state
  115. public boolean changedStateSinceSave() {
  116. return true;
  117. }
  118. }