added basic ouya input

This commit is contained in:
Diego Waxemberg
2013-09-21 19:51:17 -04:00
parent 3433ab1ccc
commit ca3758106a
9 changed files with 181 additions and 32 deletions
@@ -0,0 +1,41 @@
package com.limelight.nvstream.input;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
public class NvController {
public final static int PORT = 35043;
private Socket s;
private OutputStream out;
public NvController(String host) throws UnknownHostException, IOException
{
s = new Socket(host, PORT);
out = s.getOutputStream();
}
// Example
public void sendLeftButton() throws IOException
{
out.write(new NvInputPacket(NvInputPacket.LEFT_FLAG, (byte)0, (byte)0, (short)0, (short)0).toWire());
}
// Example
public void sendRightButton() throws IOException
{
out.write(new NvInputPacket(NvInputPacket.RIGHT_FLAG, (byte)0, (byte)0, (short)0, (short)0).toWire());
}
// Example
public void clearButtons() throws IOException
{
out.write(new NvInputPacket((short)0, (byte)0, (byte)0, (short)0, (short)0).toWire());
}
}