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)
                {
                    DataPackageScope incomingDataPackage = scope.GetScopeData();
                    if (incomingDataPackage != null)
                    {
                        LatestDataPackage = incomingDataPackage;
                        this.fireDataAvailableEvents();
                    }
                }
            }
            catch (ThreadInterruptedException tie)
            {
                Logger.Info("Data fetch thread interrupted");
            }
            Logger.Debug("Data fetch thread stopped");
        }
Exemple #2
0
        private void Record(DataPackageScope dataPackage, EventArgs e)
        {
            //Only do the whole acquisitions per interval checking if the interval
            //and acqs per interval is greater than zero
            if (RecordingInterval > TimeSpan.Zero && RecordingAcquisitionsPerInterval > 0)
            {
                DateTime now = DateTime.Now;
                if (now.Subtract(RecordingLastAcquisitionTimestamp) > RecordingInterval)
                {
                    this.RecordingAcquisitionsThisInterval = 0;
                    this.RecordingLastAcquisitionTimestamp = now;
                }

                //exit in case enough acquisitions have already been stored this interval
                if (++this.RecordingAcquisitionsThisInterval > this.RecordingAcquisitionsPerInterval)
                {
                    return;
                }
            }
            Recording.Record(dataPackage, e);
        }
Exemple #3
0
        public void Record(DataPackageScope ScopeData, EventArgs e)
        {
            lock (busyLock)
            {
                if (!Busy)
                {
                    throw new Exception("Can't record because the Busy flag is false");
                }
                foreach (var kvp in channelBuffers)
                {
                    if (ScopeData.GetData(DataSourceType.Viewport, kvp.Key) != null)
                    {
                        kvp.Value.AddData(ScopeData.GetData(DataSourceType.Viewport, kvp.Key).array);
                    }
                }
                DataStorageSize = channelBuffers.Select(x => x.Value.BytesStored()).Sum();

                acqInfo.Add(
                    new AcquisitionInfo()
                {
                    firstSampleTime = (ulong)(DateTime.Now.TimeOfDay.TotalMilliseconds * 1000000.0),
                    samples         = ScopeData.ViewportSamples,
                    samplePeriod    = ScopeData.samplePeriod[DataSourceType.Viewport]
                });
                foreach (var kvp in ScopeData.Settings)
                {
                    if (!settings.Keys.Contains(kvp.Key))
                    {
                        settings.Add(kvp.Key, new List <double>());
                    }

                    settings[kvp.Key].Add(kvp.Value);
                }

                AcquisitionsRecorded++;
            }
        }