public class NxtCommand extends Object
The class allows sending commands to the NXT in order to control the motors and sensors. The NXT application must be running before initializing the class.
NxtApplication
,
NxtOperation
Modifier and Type | Field and Description |
---|---|
(package private) static NXTConnector |
connection |
(package private) static boolean |
isMock |
(package private) static ArrayList<byte[]> |
mockCommands |
Constructor and Description |
---|
NxtCommand() |
Modifier and Type | Method and Description |
---|---|
static void |
close()
Close connection to the NXT
|
static ArrayList<byte[]> |
getMockedCommands()
Get mocked commands
|
static void |
init()
Initialize connection to the NXT
|
static void |
initMock()
Initialize mock version of NXT
|
static byte[] |
sendCommand(byte operationType,
int port,
byte operationId,
int argument,
int expectedReturnSize)
Send command to the NXT
|
static NXTConnector connection
static boolean isMock
static ArrayList<byte[]> mockCommands
public static void init()
NXT application must be running before initialization
public static void initMock()
public static ArrayList<byte[]> getMockedCommands()
public static void close()
public static byte[] sendCommand(byte operationType, int port, byte operationId, int argument, int expectedReturnSize)
operationType
- The operation typeport
- Port of the motor or sensor if relevantoperationId
- The operation IDargument
- Argument for the requested operationexpectedReturnSize
- The expected return size of the operation (bytes)