示例#1
0
        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");
        }
示例#2
0
        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);
        }
示例#3
0
        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;
        }