private void DataFetchThreadStart() { //main starting point for the thread which fetches the data from file Logger.Debug("DataFetchThread spawn"); if (!running) { Logger.Error("Device not started as device.Start() didn't return true"); } //looping until device is stopped try { while (running && scope.Ready) { LatestDataPackage = scope.GetScopeData(); if (LatestDataPackage != null) { this.fireDataAvailableEvents(); } } } catch (ThreadInterruptedException tie) { Logger.Info("Data fetch thread interrupted"); } Logger.Debug("Data fetch thread stopped"); }
public static DataPackageScope FetchLastFrame(IScope scope) { DateTime oldFetchTime = DateTime.Now; DataPackageScope oldPackage = null; while (oldPackage == null) { oldPackage = scope.GetScopeData(); } DataPackageScope p = null; do { scope.ForceTrigger(); p = scope.GetScopeData(); if (p == null) { p = oldPackage; } } while ((p.Identifier == oldPackage.Identifier) && (DateTime.Now.Subtract(oldFetchTime).TotalMilliseconds < 3000)); return(p); }
public static DataPackageScope FetchLastFrame(IScope scope) { DateTime oldFetchTime = DateTime.Now; DataPackageScope oldPackage = null; while (oldPackage == null) oldPackage = scope.GetScopeData(); DataPackageScope p = null; do { scope.ForceTrigger(); p = scope.GetScopeData(); if (p == null) p = oldPackage; } while ((p.Identifier == oldPackage.Identifier) && (DateTime.Now.Subtract(oldFetchTime).TotalMilliseconds < 3000)); return p; }