|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.pc.comm.NXTCommand
public class NXTCommand
Sends LCP requests to the NXT and receives replies. Uses an object that implements the NXTComm interface for low-level communication.
Field Summary |
---|
Method Summary | |
---|---|
void |
addLogListener(NXTCommLogListener listener)
register log listener |
void |
close()
Call the close() command when your program ends, otherwise you will have to turn the NXT brick off/on before you run another program. |
byte |
closeFile(byte handle)
Closes an open file. |
byte |
defrag()
|
byte |
delete(java.lang.String fileName)
|
FileInfo |
findFirst(java.lang.String wildCard)
|
FileInfo |
findNext(byte handle)
|
int |
getBatteryLevel()
|
java.lang.String |
getFriendlyName()
|
InputValues |
getInputValues(int port)
|
java.lang.String |
getLocalAddress()
|
OutputState |
getOutputState(int port)
Retrieves the current output state for a port. |
static NXTCommand |
getSingleton()
|
byte[] |
messageRead(byte remoteInbox,
byte localInbox,
boolean remove)
|
boolean |
open(NXTInfo nxt)
|
FileInfo |
openRead(java.lang.String fileName)
Opens a file on the NXT for reading. |
byte |
openWrite(java.lang.String fileName,
int size)
Opens a file on the NXT for writing. |
byte[] |
readFile(byte handle,
int length)
Returns requested number of bytes from a file. |
void |
removeLogListener(NXTCommLogListener listener)
unregister log listener |
NXTInfo[] |
search(java.lang.String name,
int protocol)
|
byte |
setFriendlyName(java.lang.String name)
|
void |
setNXTCommBlueTooth()
|
void |
setVerify(boolean verify)
|
byte |
startProgram(java.lang.String fileName)
Starts a program already on the NXT. |
byte |
writeFile(byte handle,
byte[] data)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public NXTInfo[] search(java.lang.String name, int protocol) throws NXTCommException
NXTCommException
public void setNXTCommBlueTooth() throws NXTCommException
NXTCommException
public boolean open(NXTInfo nxt) throws NXTCommException
NXTCommException
public void setVerify(boolean verify)
public byte startProgram(java.lang.String fileName) throws java.io.IOException
fileName
-
java.io.IOException
public FileInfo openRead(java.lang.String fileName) throws java.io.IOException
fileName
- e.g. "Woops.wav"
java.io.IOException
public byte openWrite(java.lang.String fileName, int size) throws java.io.IOException
fileName
- e.g. "Woops.rso"
java.io.IOException
public byte closeFile(byte handle) throws java.io.IOException
handle
- File handle number.
java.io.IOException
public byte delete(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public FileInfo findFirst(java.lang.String wildCard) throws java.io.IOException
wildCard
- [filename].[extension], *.[extension], [filename].*, *.*
java.io.IOException
public FileInfo findNext(byte handle) throws java.io.IOException
handle
- Handle number from the previous found file or fromthe Find
First command.
java.io.IOException
public int getBatteryLevel() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public byte writeFile(byte handle, byte[] data) throws java.io.IOException
java.io.IOException
public byte[] readFile(byte handle, int length) throws java.io.IOException
handle
- File handle number (from openRead method)length
- Number of bytes to read.
java.io.IOException
public byte defrag() throws java.io.IOException
java.io.IOException
public java.lang.String getFriendlyName() throws java.io.IOException
java.io.IOException
public byte setFriendlyName(java.lang.String name) throws java.io.IOException
java.io.IOException
public java.lang.String getLocalAddress() throws java.io.IOException
java.io.IOException
public InputValues getInputValues(int port) throws java.io.IOException
java.io.IOException
public OutputState getOutputState(int port) throws java.io.IOException
port
- - 0 to 3
java.io.IOException
public byte[] messageRead(byte remoteInbox, byte localInbox, boolean remove) throws java.io.IOException
remoteInbox
- 0-9localInbox
- 0-9remove
- True clears the message from the remote inbox.
java.io.IOException
public static NXTCommand getSingleton()
public void addLogListener(NXTCommLogListener listener)
listener
- public void removeLogListener(NXTCommLogListener listener)
listener
-
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |