|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cubeWorker
public class cubeWorker
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.
Method Summary | |
---|---|
int |
addAnimation()
Add an animation. |
int |
addFrame(int anim)
Add a Frame to an animation. |
boolean |
changedStateSinceSave()
Check if something changed after loading/saving. |
int |
downloadState(java.lang.String port)
Get all animations from the cube, place it in this object |
int |
framesRemaining()
Get the number of frames you can add until the Cubes memory is full. |
java.lang.String |
getAnimationName(int selectedAnimation)
Get the name of an animation |
short[] |
getFrame(int anim,
int frame)
Get the data of a frame. |
java.lang.String |
getFrameName(int anim,
int frame)
Get the name of a frame. |
short |
getFrameTime(int anim,
int frame)
Get frame duration. |
java.lang.String[] |
getSerialPorts()
Get the names of all available serial ports. |
int |
loadState(java.lang.String path)
Loads an animation file into this worker. |
void |
moveAnimation(int dir,
int selectedAnimation)
Move an animation UP or DOWN. |
void |
moveFrame(int dir,
int anim,
int frame)
Move a frame. |
int |
numOfAnimations()
Get the number of animations in this worker. |
int |
numOfFrames(int selectedAnimation)
Get the number of frames in an animation. |
boolean |
probeCubeConnected(java.lang.String port)
Try to speak with the cube. |
void |
removeAnimation(int selectedAnimation)
Remove an animation. |
void |
removeFrame(int anim,
int frame)
Remove a frame. |
int |
saveState(java.lang.String path)
Save the state of this object into a file. |
void |
setAnimationName(java.lang.String s,
int selectedAnimation)
Set the name of an animation @param s New name |
void |
setFrame(short[] data,
int anim,
int frame)
Set the data of a frame |
void |
setFrameName(java.lang.String s,
int anim,
int frame)
Set the name of a frame. |
void |
setFrameTime(short time,
int anim,
int frame)
Set the frames duration. |
int |
uploadState(java.lang.String port)
Send all animations to the cube. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public int numOfAnimations()
public int numOfFrames(int selectedAnimation)
selectedAnimation
- the animation you want to check
public int framesRemaining()
public int addAnimation()
public void removeAnimation(int selectedAnimation)
selectedAnimation
- the animation you want to deletepublic java.lang.String getAnimationName(int selectedAnimation)
selectedAnimation
- The animation you want to get the name from
public void setAnimationName(java.lang.String s, int selectedAnimation)
selectedAnimation
- Index of the animation you want to changepublic void moveAnimation(int dir, int selectedAnimation)
dir
- Direction. Use UP and DOWN defined in cubeWorkerselectedAnimation
- Animation you want to movepublic java.lang.String getFrameName(int anim, int frame)
anim
- Animation the frame is inframe
- Index of the framepublic void setFrameName(java.lang.String s, int anim, int frame)
s
- New nameanim
- Animation Indexframe
- Frame Indexpublic int addFrame(int anim)
anim
- Animation Index
public void removeFrame(int anim, int frame)
anim
- Animation Indexframe
- Frame you want to removepublic short[] getFrame(int anim, int frame)
anim
- Animation Index
@param frame Frame Index
public void setFrame(short[] data, int anim, int frame)
data
- 64 byte array with dataanim
- Animation Indexframe
- Frame IndexgetFrame()
public short getFrameTime(int anim, int frame)
anim
- Animation Indexframe
- Frame Index
public void setFrameTime(short time, int anim, int frame)
time
- New durationanim
- Animation Indexframe
- Frame IndexgetFrameTime()
public void moveFrame(int dir, int anim, int frame)
dir
- Direction to move. Use UP and DOWN from cubeWorkeranim
- Animation Indexframe
- Frame IndexmoveAnimation()
public int loadState(java.lang.String path)
path
- Path of file to load
public int saveState(java.lang.String path)
path
- Path to save file in
public boolean changedStateSinceSave()
public int uploadState(java.lang.String port)
port
- Name of serial port to use
public int downloadState(java.lang.String port)
port
- Name of serial port to use
@return 0 on success, -1 on errorpublic boolean probeCubeConnected(java.lang.String port)
port
- Name of serial port
public java.lang.String[] getSerialPorts()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |