浏览代码

Add timer for sending and output sending system-times

jost_vincent.schultz 10 年之前
父节点
当前提交
fdb80cab17
共有 5 个文件被更改,包括 23 次插入8 次删除
  1. 2 1
      bbiwarg/Constants.cs
  2. 9 6
      bbiwarg/Server/TUIO/TuioServer.cs
  3. 10 0
      bbiwarg/Server/TUIO/TuioTime.cs
  4. 2 0
      bbiwarg/VideoHandle.cs
  5. 0 1
      bbiwarg/bbiwarg.csproj

+ 2 - 1
bbiwarg/Constants.cs

@@ -10,7 +10,8 @@ namespace bbiwarg
     class Constants
     {
         // BBIWARG
-        public static readonly bool OutputTimerEnabled = true;
+        public static readonly bool OutputTimerEnabled = false;
+        public static readonly bool sendingSystemTimeEnabled = true;
         public static readonly int OutputNumImages = 5;
         public static readonly int OutputNumImagesPerRow = 3;
         public static readonly float OutputScaleFactor = 1f; // output window size is scaled by this factor (from necessary size for images)

+ 9 - 6
bbiwarg/Server/TUIO/TuioServer.cs

@@ -115,12 +115,12 @@ namespace TUIO
                 cursor = cursorList[i];
                 currentMessage = new OSCMessage("/tuio/2Dcur");
                 currentMessage.Append("set");
-                currentMessage.Append((int)cursor.getSessionID());
-                currentMessage.Append((float)cursor.getX());
-                currentMessage.Append((float)cursor.getY());
-                currentMessage.Append((float)cursor.getXSpeed());
-                currentMessage.Append((float)cursor.getYSpeed());
-                currentMessage.Append((float)cursor.getMotionAccel());
+                currentMessage.Append((Int32)cursor.getSessionID());
+                currentMessage.Append(cursor.getX());
+                currentMessage.Append(cursor.getY());
+                currentMessage.Append(cursor.getXSpeed());
+                currentMessage.Append(cursor.getYSpeed());
+                currentMessage.Append(cursor.getMotionAccel());
 
                 /*if (Marshal.SizeOf(packet) + Marshal.SizeOf(currentOscElement) >= MAX_PACKET_SIZE)
                 {
@@ -131,6 +131,9 @@ namespace TUIO
                     addAliveMessagesToBundle(packet);
                 }*/
                 packet.Append(currentMessage);
+
+                if(bbiwarg.Constants.sendingSystemTimeEnabled)
+                    Console.WriteLine("Send Cursor "+cursor.getSessionID()+" at time "+TuioTime.getSystemTime().ToString());
             }
             currentMessage = new OSCMessage("/tuio/2Dcur");
             currentMessage.Append("fseq");

+ 10 - 0
bbiwarg/Server/TUIO/TuioTime.cs

@@ -238,5 +238,15 @@ public class TuioTime {
 		long usec = DateTime.Now.Ticks/10;
 		return new TuioTime(usec/1000000,usec%1000000);
 	}
+
+
+    public String ToString()
+    {
+        int mins = (int)((seconds % 3600) / 60);
+        int secs = (int)(seconds % 60);
+        int msecs = (int)(micro_seconds % 1000);
+
+        return mins + ":" + secs + ":" + msecs;
+    }
 }
 }

+ 2 - 0
bbiwarg/VideoHandle.cs

@@ -208,6 +208,7 @@ namespace bbiwarg
             Timer.stop("touchTracking");
 
 
+            Timer.start("sending touchEvents");
             //send touchevent
             if (palmTouchDetector != null)
             {
@@ -227,6 +228,7 @@ namespace bbiwarg
                 }
                 server.commitFrame();
             }
+            Timer.stop("sending touchEvents");
 
 
             // touch event visualizer

+ 0 - 1
bbiwarg/bbiwarg.csproj

@@ -72,7 +72,6 @@
     <Compile Include="Recognition\FingerRecognition\FingerSliceTrail.cs" />
     <Compile Include="Recognition\FingerRecognition\FingerSlice.cs" />
     <Compile Include="Recognition\FingerRecognition\FingerTracker.cs" />
-    <Compile Include="Recognition\FingerRecognition\TrackedFinger.cs" />
     <Compile Include="Recognition\HandRecognition\Hand.cs" />
     <Compile Include="Recognition\HandRecognition\HandDetector.cs" />
     <Compile Include="Recognition\PalmRecognition\PalmDetector.cs" />