コード例 #1
0
 public Task WaitForDataWritten()
 {
     try
     {
         record = false;
         LockSlim.EnterWriteLock();
         if (!RPositionSamplesData.Any())
         {
             Logger.LogWarning("No R Position events to write to H5 file");
             return(Task.CompletedTask);
         }
         var dataToWrite = RPositionSamplesData;
         RPositionSamplesData = new List <RPositionEvent>();
         Logger.LogInformation("Start write of RPosition events");
         Hdf5RPositionEvents events = new Hdf5RPositionEvents(dataToWrite);
         var status = Hdf5.WriteObject(GroupRoot, events, Constants.EventGroupName);
         Logger.LogInformation("End write of RPosition with status " + status);
     }
     catch (Exception e)
     {
         Logger.LogError(e, $"Error writing RPosition Events: {e.Message}");
     }
     finally
     {
         LockSlim.ExitWriteLock();
     }
     return(Task.CompletedTask);
 }
コード例 #2
0
        public Task WaitForDataWritten()
        {
            try
            {
                record = false;
                LockSlim.EnterWriteLock();
                if (!SystemEventSamplesData.Any())
                {
                    Logger.LogWarning("No system events to write to H5 file");
                    return(Task.CompletedTask);
                }

                var dataToWrite = SystemEventSamplesData;
                SystemEventSamplesData = new List <SystemEvent>();
                Logger.LogInformation("Start write of system events");
                Hdf5SystemEvents events = new Hdf5SystemEvents(dataToWrite);
                var status = Hdf5.WriteObject(GroupRoot, events, Constants.EventGroupName);
                Logger.LogInformation("End write of system events with status " + status);
                return(Task.CompletedTask);
            }
            finally
            {
                LockSlim.ExitWriteLock();
            }
        }
コード例 #3
0
 public void Enqueue(SystemEventModel systemEvent)
 {
     if (record)
     {
         SystemEvent hdf5SystemEvent = new SystemEvent(systemEvent.TimeStamp, systemEvent.SystemEventType.ToString(), "", systemEvent.EventData);
         LockSlim.EnterWriteLock();
         SystemEventSamplesData.Add(hdf5SystemEvent);
         LockSlim.ExitWriteLock();
     }
 }
コード例 #4
0
 public void Enqueue(RPositionsMessagePack rPosition)
 {
     if (record)
     {
         var positions = rPosition.NavigationData.SelectMany(r =>
                                                             r.Points.Select(p => new RPositionEvent(rPosition.Timestamp, r.Name, p.x, p.y, p.z, r.Trajectory.x, r.Trajectory.y, r.Trajectory.z))).ToList();
         try
         {
             LockSlim.EnterWriteLock();
             RPositionSamplesData.AddRange(positions);
         }
         catch (Exception e)
         {
             Logger.LogError(e, $"Error adding RPosition: {e.Message}");
         }
         finally
         {
             LockSlim.ExitWriteLock();
         }
     }
 }