-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Legacy comptatibility for old RF headsets using ThinkGear connector.
- Loading branch information
Showing
7 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Windows.Networking; | ||
using Windows.Networking.Sockets; | ||
using Windows.Storage.Streams; | ||
|
||
namespace MindSetUWA | ||
{ | ||
public partial class MindSetConnection | ||
{ | ||
|
||
public async void ThinkGearConnect(HostName hostname, string port) | ||
{ | ||
StreamSocket socket = new StreamSocket(); | ||
await socket.ConnectAsync(hostname, port); | ||
byte[] buffer = new byte[8192]; | ||
|
||
DataReader reader = new DataReader(socket.InputStream); | ||
DataWriter writer = new DataWriter(socket.OutputStream); | ||
|
||
//Switch ThinkGear Connector to JSON format. | ||
byte[] myWriteBuffer = Encoding.ASCII.GetBytes(@"{""enableRawOutput"": false, ""format"": ""Json""}"); | ||
writer.WriteBytes(myWriteBuffer); | ||
await writer.StoreAsync(); | ||
|
||
//Continuously recieve stream of JSON data. | ||
while (true) | ||
{ | ||
string receivedData = ""; | ||
reader.InputStreamOptions = InputStreamOptions.Partial; | ||
var count = await reader.LoadAsync(1024); | ||
if (count > 0) | ||
receivedData = reader.ReadString(count); | ||
//ThinkGearDeserializer(receivedData); TODO NEW DESERIALIZER | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters