Skip to content

Commit

Permalink
update windows side logics
Browse files Browse the repository at this point in the history
  • Loading branch information
teamclouday committed Dec 9, 2019
1 parent b2d98ba commit 5a7842c
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions Windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,23 @@ This folder contains code for the windows program, which will catch the signals

------

### vJoy
The code relies on the vJoy driver, so [install it](http://vjoystick.sourceforge.net/site/index.php/download-a-install/download) before running this program.
### Program Logics

------
3 main threads:
1. system tray icon thread
2. Bluetooth server thread
3. Wheel driver thread

#### System Tray Thread
This thread will create new thread for 2 UIs if needed, and will also manage when to exit the whole program

#### Bluetooth Thread
This thread will start the Bluetooth listener with unique UUID, try to accept a potential client.
If connected, check the received data to determine whether the connected client is going to send useful data.
Specifically, the input stream will contain `0x7FFFFFFF` as first 4 bytes to indicate a incoming data flow, `0x7FFFFFFF` show again to indicate the closing of the input stream.
For the input stream itself, every 16 bytes (4 int) is regarded as a pack. The started int is always `10086` and the rest 3 ints are real input data. Therefore, the code will check every 16 bytes to make sure the data is received in valid order.

#### Wheel Thread
This thread will aquire a vJoy device and check if the device is valid.
Then it will starts reading data from a global buffer, where data are previously stored by the bluetooth thread. The read and write on global buffer uses object lock to ensure data safety.
Then for each instruction, trigger the device driver to send emulated signals.

0 comments on commit 5a7842c

Please sign in to comment.