Exemple #1
0
        public MainForm()
        {
            Logger = new Logging();

            InitializeComponent();

            Logger.LogToFile        = true;
            checkBoxLogging.Checked = false;

            SetupDevicesList();

            StartLogging();

            BrainHatServers      = new HatServersMonitor();
            BrainHatServers.Log += OnLog;
            BrainHatServers.HatConnectionStatusUpdate += OnHatStatusUpdate;
            BrainHatServers.HatConnectionChanged      += OnHatConnectionChanged;

            OpenForms = new ConcurrentDictionary <string, Form1>();

            //  start the brainHat servers mointor off the UI thread
            _ = Task.Run(async() =>
            {
                await BrainHatServers.StartMonitorAsync();
            });
        }
Exemple #2
0
        public Form1()
        {
            InitializeComponent();

            FormClosing += OnFormClosing;
            PlatformHelper.PlatformHelper.GetLibraryEnvironment();

            HostName = GpioPinManager.LoadFromConfigFile();
            GpioPinManager.SetupGpio();

            textBoxHostName.Text = HostName;
            ConnectToServer      = false;
            ActiveClient         = null;

            EnableMotor  = true;
            EnableLights = true;

            checkBoxHapticMotor.Checked = true;
            checkBoxLightsAuto.Checked  = true;



            ServersMonitor      = new HatServersMonitor();
            ServersMonitor.Log += OnLog;
            ServersMonitor.HatConnectionStatusUpdate += OnHatStatusUpdate;
            ServersMonitor.HatConnectionChanged      += OnHatConnectionChanged;

            BlinkDetector = new BlinkDetector();
            BlinkDetector.DetectedBlink += OnDetectedBlink;

            SeekingAlpha = new AlphaWaveDetector();
            SeekingAlpha.DetectedBrainWave += OnDetectedBrainWave;


            _ = Task.Run(async() =>
            {
                //await GpioPinManager.TestConfig();

                await ServersMonitor.StartMonitorAsync();
                await SeekingAlpha.StartDetectorAsync();

                await StartLightFlash();
            });
        }