Thanks. It works!
Now, attempting to hack STK...
LONG POST!

I'm going for the subclass option. Make MobileDevice as a subclass of InputDevice (or should it be a subclass of GamepadDevice?).
The problem is that the input I need is from the network. (I don't know how to bluetooth

)
Here is a general algorithm for the game. I am going to use UDP (Should I use TCP?)
1. InputManager makes a thread that will listen for incoming UDP messages.
2. Thread is listening for messages.
3. Something (probably the Android phone) sends a UDP message containing control messages and name to the host computer.
4. Thread gets the message, then calls dispatchInput(...).
5. Go to 2.
(name is for identification of the phone)
About pairing...
1. User clicks "Add Android Device."
2. Game GUI shows IP address of the computer (or QR code of IP address) and waits for confirmation.
3. User enters IP address into the phone (or scans QR code on the screen).
4. Phone sends confirmation and name to the computer.
5. Game receives confirmation and makes a MobileConfig and MobileDevice for the phone.
Phone's name is stored in MobileConfig and MobileDevice.
Now about mapping the phone's messages to MobileDevice...
I have a problem.
This is roughly how InputManager will receive control messages:
"lean 0 LEFT 38" <name button direction value>
"tux 0 RIGHT 4487"
"tux 0 RIGHT 22"
"lean 3 LEFT 1223"
...
Upon receiving a message, InputManager needs to call dispatchInput(...).
Parameters of dispatchInput are (Input::InputType type, int deviceID, int button, Input::AxisDirection axisDirection, int value).
I can pass button, axisDirection, value, and type; those are given.
I cannot pass deviceID. I somehow need to convert phone's name to integer.
The problem is getting id from a name then mapping that id back to the original name. InputDevice id is arbitrary.
name --?-> id (random) ----> name
Please comment. Did I get something wrong?
