Example #1
0
        public async Task StartRecording()
        {
            StartStream();
            _filemanage = new Util.FileManage(
                Path.Combine(
                    _dataAccessFacade.GetGeneralSettings().GetSceneInUseDirectory(),
                    "openbci_" + _person.PersonId + ".csv"));
            _isRecording = true;

            foreach (var module in ProcessingLoader.Instance.ProcessingModules)
            {
                if (module.IsEnabled)
                {
                    if (module is IEegProcessingModule eegModule)
                    {
                        EegFrameArrived += eegModule.EegListener();
                    }

                    if (module is IAccelerometerProcessingModule accModule)
                    {
                        AccelerometerFrameArrived += accModule.AccelerometerListener();
                    }
                }
            }
        }
Example #2
0
 private void StopStream()
 {
     if (!ReferenceEquals(null, _filemanage))
     {
         _filemanage.CloseFile();
         _filemanage = null;
     }
     if (ReferenceEquals(null, _serialPort))
     {
         return;
     }
     char[] buff = new char[1];
     buff[0] = 's';
     _serialPort.Write(buff, 0, 1);
 }