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" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="TrackerSerialNumber" value="" /> <add key="TrackerSerialNumber" value="TPSP1-010108442534" />
<add key="TrackerFrequency_Hz" value="600" /> <add key="TrackerFrequency_Hz" value="120" />
<add key="WebSocketPort" value="8001" /> <add key="WebSocketPort" value="8001" />
<add key="WebSocketEndpoint" value="/gaze" /> <add key="WebSocketEndpoint" value="/gaze" />
<add key="DebugFlag" value="false" /> <add key="DebugFlag" value="false" />
......
...@@ -30,7 +30,7 @@ namespace GazeWebSocketServer ...@@ -30,7 +30,7 @@ namespace GazeWebSocketServer
public static void InitializeUnexistingWithDefaults() public static void InitializeUnexistingWithDefaults()
{ {
InitializeSetting("TrackerSerialNumber", ""); InitializeSetting("TrackerSerialNumber", "TPSP1-");
InitializeSetting("TrackerFrequency_Hz", "600"); InitializeSetting("TrackerFrequency_Hz", "600");
InitializeSetting("WebSocketPort", "8001"); InitializeSetting("WebSocketPort", "8001");
InitializeSetting("WebSocketEndpoint", "/gaze"); InitializeSetting("WebSocketEndpoint", "/gaze");
......
...@@ -17,10 +17,10 @@ namespace GazeWebSocketServer ...@@ -17,10 +17,10 @@ namespace GazeWebSocketServer
eyeTrackerClient.Start(this); eyeTrackerClient.Start(this);
} }
~GazeCoordinateBehavior() //~GazeCoordinateBehavior()
{ //{
eyeTrackerClient.Stop(); // eyeTrackerClient.Stop();
} //}
//protected override void OnOpen() //protected override void OnOpen()
//{ //{
......
...@@ -13,17 +13,23 @@ namespace GazeWebSocketServer ...@@ -13,17 +13,23 @@ namespace GazeWebSocketServer
public readonly float rightX; public readonly float rightX;
public readonly float rightY; 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.leftX = leftX;
this.leftY = leftY; this.leftY = leftY;
this.rightX = rightX; this.rightX = rightX;
this.rightY = rightY; this.rightY = rightY;
} this.trackerTimeStamp = trackerTimeStamp;
this.systemTimeStamp = systemTimeStamp;
}
public override string ToString() 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 ...@@ -24,7 +24,9 @@ namespace GazeWebSocketServer
GazeData data = new GazeData(e.LeftEye.GazePoint.PositionOnDisplayArea.X*screenWidth, GazeData data = new GazeData(e.LeftEye.GazePoint.PositionOnDisplayArea.X*screenWidth,
e.LeftEye.GazePoint.PositionOnDisplayArea.Y*screenHeight, e.LeftEye.GazePoint.PositionOnDisplayArea.Y*screenHeight,
e.RightEye.GazePoint.PositionOnDisplayArea.X*screenWidth, e.RightEye.GazePoint.PositionOnDisplayArea.X*screenWidth,
e.RightEye.GazePoint.PositionOnDisplayArea.Y*screenHeight); e.RightEye.GazePoint.PositionOnDisplayArea.Y*screenHeight,
e.DeviceTimeStamp,
e.SystemTimeStamp);
return data; return data;
} }
} }
......
...@@ -13,9 +13,10 @@ namespace GazeWebSocketServer ...@@ -13,9 +13,10 @@ namespace GazeWebSocketServer
ConfigurationData config = ConfigurationData.ParseToObject(); ConfigurationData config = ConfigurationData.ParseToObject();
var wssv = new WebSocketServer(config.WebSocketPort); var wssv = new WebSocketServer(config.WebSocketPort);
wssv.KeepClean = true;
GazeCoordinateBehavior behavior = new GazeCoordinateBehavior(config); GazeCoordinateBehavior behavior = new GazeCoordinateBehavior(config);
wssv.AddWebSocketService(config.WebSocketEndpoint, () => behavior); wssv.AddWebSocketService(config.WebSocketEndpoint, () => behavior);
wssv.Start(); wssv.Start();
Console.ReadKey(true); Console.ReadKey(true);
wssv.Stop(); 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