Vladimir Kruglov
Vladimir Kruglov

Reputation: 298

Emulating Steering Wheel

Is it possible to emulate steering wheel? I mean say to windows like I'm pressing 30% of left button? Or do I need to write some driver which will communicate with my application? So that windows will think that it is a real device.

If I need driver, then what commands I need to send to windows to do right things, maybe I can send them directly from my application.

I have small experience writing application which communicate with card reader using virtual com port, but there was real device :/

Maybe I can use some real steering wheel driver, install it in windows and then send command to some com port to make windows think that it's real device?

Please help, or at least show direction where I can find some information.

Upvotes: 1

Views: 2596

Answers (1)

Vladimir Kruglov
Vladimir Kruglov

Reputation: 298

Found a solution on http://vjoystick.sourceforge.net/site/. Now I have written the server and the client on my phone and started testing, but it's working somehow slow. I open socket and send from phone 3-5 bytes, but server reads 3-4 messages. Sample("x-100;x-4;x45;")

TcpClient tcpClient = (TcpClient)client;
NetworkStream clientStream = tcpClient.GetStream();

byte[] message = new byte[1000];
int bytesRead;

while (ThreadsRun) {
    bytesRead = 0;
    try {
        bytesRead = clientStream.Read(message, 0, 1000);
        var stringMsg = "";
        for (int i = 0; i < bytesRead; i++) {
            stringMsg += (char)message[i];
        }
        queue.Enqueue(stringMsg);//conqurentqueue
    } catch {
        break;
    }
    Thread.Sleep(1);
}
tcpClient.Close();

Code is very simple and should be fast, ping from phone is 40ms sending 56 bytes.

What is wrong here or is there another faster way to send small amount of data very frequently?

Upvotes: 1

Related Questions