Commit 4dca5182 by Stefan Schreistetter

Added new default value for TrackerSerialNumber. Changed the App.config for…

Added new default value for TrackerSerialNumber. Changed the App.config for debugging on Neil. Added Tobii timestamps to message. Activated KeepClean feature of WebSocketServer.
parent 3c0d2389
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="TrackerSerialNumber" value="" />
<add key="TrackerFrequency_Hz" value="600" />
<add key="TrackerSerialNumber" value="TPSP1-010108442534" />
<add key="TrackerFrequency_Hz" value="120" />
<add key="WebSocketPort" value="8001" />
<add key="WebSocketEndpoint" value="/gaze" />
<add key="DebugFlag" value="false" />
......
......@@ -30,7 +30,7 @@ namespace GazeWebSocketServer
public static void InitializeUnexistingWithDefaults()
{
InitializeSetting("TrackerSerialNumber", "");
InitializeSetting("TrackerSerialNumber", "TPSP1-");
InitializeSetting("TrackerFrequency_Hz", "600");
InitializeSetting("WebSocketPort", "8001");
InitializeSetting("WebSocketEndpoint", "/gaze");
......
......@@ -17,10 +17,10 @@ namespace GazeWebSocketServer
eyeTrackerClient.Start(this);
}
~GazeCoordinateBehavior()
{
eyeTrackerClient.Stop();
}
//~GazeCoordinateBehavior()
//{
// eyeTrackerClient.Stop();
//}
//protected override void OnOpen()
//{
......
......@@ -13,17 +13,23 @@ namespace GazeWebSocketServer
public readonly float rightX;
public readonly float rightY;
public GazeData(float leftX, float leftY, float rightX, float rightY)
public readonly long trackerTimeStamp;
public readonly long systemTimeStamp;
public GazeData(float leftX, float leftY, float rightX, float rightY, long trackerTimeStamp, long systemTimeStamp)
{
this.leftX = leftX;
this.leftY = leftY;
this.rightX = rightX;
this.rightY = rightY;
}
this.trackerTimeStamp = trackerTimeStamp;
this.systemTimeStamp = systemTimeStamp;
}
public override string ToString()
{
return $"\"{leftX}\", \"{leftY}\", \"{rightX}\", \"{rightY}\"";
FormattableString message = $"{leftX};{leftY};{rightX};{rightY};{trackerTimeStamp};{systemTimeStamp}";
return FormattableString.Invariant(message);
}
}
}
......@@ -24,7 +24,9 @@ namespace GazeWebSocketServer
GazeData data = new GazeData(e.LeftEye.GazePoint.PositionOnDisplayArea.X*screenWidth,
e.LeftEye.GazePoint.PositionOnDisplayArea.Y*screenHeight,
e.RightEye.GazePoint.PositionOnDisplayArea.X*screenWidth,
e.RightEye.GazePoint.PositionOnDisplayArea.Y*screenHeight);
e.RightEye.GazePoint.PositionOnDisplayArea.Y*screenHeight,
e.DeviceTimeStamp,
e.SystemTimeStamp);
return data;
}
}
......
......@@ -13,9 +13,10 @@ namespace GazeWebSocketServer
ConfigurationData config = ConfigurationData.ParseToObject();
var wssv = new WebSocketServer(config.WebSocketPort);
wssv.KeepClean = true;
GazeCoordinateBehavior behavior = new GazeCoordinateBehavior(config);
wssv.AddWebSocketService(config.WebSocketEndpoint, () => behavior);
wssv.Start();
Console.ReadKey(true);
wssv.Stop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment