lejos.remote.ev3.RMIRemoteKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lejos-ev3-api Show documentation
Show all versions of lejos-ev3-api Show documentation
leJOS (pronounced like the Spanish word "lejos" for "far") is a tiny Java Virtual Machine. In 2013 it was ported to the LEGO EV3 brick.
The newest version!
package lejos.remote.ev3;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import lejos.hardware.Button;
import lejos.hardware.Key;
import lejos.hardware.KeyListener;
import lejos.hardware.ev3.LocalEV3;
public class RMIRemoteKey extends UnicastRemoteObject implements RMIKey {
private Key key;
private static final long serialVersionUID = -752148808854653746L;
protected RMIRemoteKey() throws RemoteException {
super(0);
}
@Override
public int getId() throws RemoteException {
return key.getId();
}
@Override
public boolean isDown() throws RemoteException {
return key.isDown();
}
@Override
public boolean isUp() throws RemoteException {
return key.isUp();
}
@Override
public void waitForPress() throws RemoteException {
key.waitForPress();
}
@Override
public void waitForPressAndRelease() throws RemoteException {
key.waitForPressAndRelease();
}
@Override
public void addKeyListener(KeyListener listener) throws RemoteException {
key.addKeyListener(listener);
}
@Override
public void simulateEvent(int event) throws RemoteException {
key.simulateEvent(event);
}
public void setId(String name) {
key = LocalEV3.get().getKey(name);
}
}