public void ToggleSync(bool value) { this.sync = value; //If we are syncing, turn buffer on. if (this.sync) { ISenseLib.ISD_RingBufferStart(handle, station); } else { ISenseLib.ISD_RingBufferStop(handle, station); } }
//========================================================================================== // // Attempts to initialize connection to tracker // //========================================================================================== void AttemptConnection() { DateTime maxWait = System.DateTime.Now; DateTime curTime = System.DateTime.Now; maxWait = maxWait.AddSeconds(10.0); handle = 0; while (maxWait.CompareTo(curTime) > 0 && handle < 1) //check for tracker for 10 seconds { handle = ISenseLib.ISD_OpenTracker(IntPtr.Zero, 0, false, true); if (handle < 1) { Sleep(.1f); } curTime = System.DateTime.Now; } // Check value of handle to see if tracker was located if (handle < 1) { print("Failed to detect"); print(handle); } else { print("Connected to InterSense tracking device!"); tracker = new ISenseLib.ISD_TRACKER_INFO_TYPE(); stationInfo = new ISenseLib.ISD_STATION_INFO_TYPE[8]; data = new ISenseLib.ISD_TRACKING_DATA_TYPE(); // Get tracker configuration info ISenseLib.ISD_GetTrackerConfig(handle, ref tracker, true); ISenseLib.ISD_GetStationConfig(handle, ref stationInfo[station - 1], station, true); ISenseLib.ISD_SetStationConfig(handle, ref stationInfo[station - 1], station, true); trackerModel = (ISenseLib.ISD_SYSTEM_MODEL)tracker.TrackerModel; bufferSize = 180; ISenseLib.ISD_RingBufferSetup(handle, station, null, bufferSize); ISenseLib.ISD_RingBufferStart(handle, station); } }