当前位置: 首页>>代码示例>>C#>>正文


C# Connector.ConnectScan方法代码示例

本文整理汇总了C#中Connector.ConnectScan方法的典型用法代码示例。如果您正苦于以下问题:C# Connector.ConnectScan方法的具体用法?C# Connector.ConnectScan怎么用?C# Connector.ConnectScan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Connector的用法示例。


在下文中一共展示了Connector.ConnectScan方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btn_connect_Click

        private void btn_connect_Click(object sender, EventArgs e)
        {
            // Initialize a new Connector and add event handlers
            connector = new Connector();

            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceFound += new EventHandler(OnDeviceFound);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);

            connector.DeviceDisconnected += new EventHandler(OnDeviceDisconnected);
            // Scan for devices across COM ports
            // The COM port named will be the first COM port that is checked.
            //string COM12 = null;

            connector.ConnectScan("COM40");
            //Thread.Sleep(45000);
            if (true)
            {
                progressBar2.Value = 0;
                Thread.Sleep(2000);
                progressBar2.Value = 20;
                Thread.Sleep(2000);
                progressBar2.Value = 40;
                Thread.Sleep(2000);
                progressBar2.Value = 60;
                Thread.Sleep(2000);
                progressBar2.Value = 80;
                Thread.Sleep(2000);
                progressBar2.Value = 100;
            }
        }
开发者ID:andrehendriks,项目名称:WindowsFormApplication1,代码行数:31,代码来源:Form1.cs

示例2: Main

 static void Main(string[] args)
 {
     Console.WriteLine("HelloEEG!");
     Connector connector = new Connector();
     connector.DeviceConnected += new EventHandler(OnDeviceConnected);
     connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
     connector.DeviceValidating += new EventHandler(OnDeviceValidating);
     connector.ConnectScan("COM13");
     Thread.Sleep(450000);
     System.Console.WriteLine("Goodbye.");
     connector.Close();
     Environment.Exit(0);
 }
开发者ID:andrehendriks,项目名称:EEG-EEG,代码行数:13,代码来源:Program.cs

示例3: Form1

        public Form1()
        {
            InitializeComponent();
            Timer.Enabled = true;
            GoFullscreen(true);
            Cursor.Hide();

            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            connector.ConnectScan("COM40");
        }
开发者ID:SCEED,项目名称:neurosky-mindwave-survey-applications,代码行数:14,代码来源:Form1.cs

示例4: btn_connect_Click

        private void btn_connect_Click(object sender, EventArgs e)
        {
            // Initialize a new Connector and add event handlers
            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceDisconnected += new EventHandler(OnDeviceDisconnected);

            // Scan for devices across COM ports
            // The COM port named will be the first COM port that is checked.
            connector.ConnectScan("COM4");

            connector.setBlinkDetectionEnabled(true);
        }
开发者ID:khuongav,项目名称:NeuroSky-APIs,代码行数:14,代码来源:Form1.cs

示例5: Form1

        public Form1()
        {
            InitializeComponent();

            if (input == "")
            {
                Close();
            }

            GoFullscreen(true);
            Cursor.Hide();

            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            connector.ConnectScan("COM40");
        }
开发者ID:SCEED,项目名称:neurosky-mindwave-survey-applications,代码行数:19,代码来源:Form1.cs

示例6: Main

        public static void Main(string[] args)
        {
            Console.WriteLine("HelloEEG!");

            // Initialize a new Connector and add event handlers

            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            // Scan for devices across COM ports
            // The COM port named will be the first COM port that is checked.
            connector.ConnectScan("COM40");

            // Blink detection needs to be manually turned on
            connector.setBlinkDetectionEnabled(true);
            Thread.Sleep(450000);

            System.Console.WriteLine("Goodbye.");
            connector.Close();
            Environment.Exit(0);
        }
开发者ID:zhangziran-ucb,项目名称:MindSurf,代码行数:23,代码来源:HelloEEG.cs

示例7: Form1

        public Form1()
        {
            InitializeComponent();

            TcpClient client;
            Stream stream;
            byte[] buffer = new byte[2048];
            int bytesRead;
            // Building command to enable JSON output from ThinkGear Connector (TGC)
	    //Сначала инициализируем подключение через серверного клиента
	    //Потом сразу сбросим его, чтобы подключиться через COM порт
            byte[] myWriteBuffer = Encoding.ASCII.GetBytes(@"{""enableRawOutput"": true, ""format"": ""Json""}");
     		  try
            {
                client = new TcpClient("127.0.0.1", 13854);
                stream = client.GetStream();

                // Sending configuration packet to TGC
                if (stream.CanWrite)
                {
                    stream.Write(myWriteBuffer, 0, myWriteBuffer.Length);
                }

                System.Threading.Thread.Sleep(5000);
                client.Close();
            }
            catch (SocketException se) { }

            System.Threading.Thread.Sleep(3000);
            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            connector.ConnectScan("COM5");
        }
开发者ID:ZlodeiBaal,项目名称:MindReader,代码行数:36,代码来源:Form1.cs

示例8: Main

        public void Main()
        {
            Regex regex = new Regex(@"</?\w+((\s+\w+(\s*=\s*(?:"".*?""|'.*?'|[^'"">\s]+))?)+\s*|\s*)/?>", RegexOptions.Singleline);
            SpeechRecognitionEngine speechEngine = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));
            speechEngine.LoadGrammar(new Grammar(new GrammarBuilder("quit")));

            speechEngine.SpeechRecognized += speechEngine_SpeechRecognized;
            speechEngine.SetInputToDefaultAudioDevice(); // set input to default audio device

            speechEngine.RecognizeAsync(RecognizeMode.Multiple); // recognize speech
            speechEngine.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(speechEngine_SpeechRecognized);

            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceFound += new EventHandler(OnDeviceFound);
            connector.DeviceNotFound += new EventHandler(OnDeviceNotFound);
            connector.DeviceConnectFail += new EventHandler(OnDeviceNotFound);
            connector.DeviceDisconnected += new EventHandler(OnDeviceDisconnected);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            connector.setMentalEffortEnable(true);
            connector.setAppreciationEnabled(true);
            connector.setBlinkDetectionEnabled(false);
            connector.setMentalEffortRunContinuous(true);
            connector.setPositivityEnable(true);
            connector.setRespirationRateEnable(true);

            AvatarDescription.CreateRandom(AvatarBodyType.Female);

            //connector.Find();
            //connector.thinkGearPorts("COM5");
            //connector.Connect("COM5");
            //connector.Connect("COM6");
            // Scan for devices across COM ports
            // The COM port named will be the first COM port that is checked.
            connector.ConnectScan("COM29");

            // Blink detection needs to be manually turned on
            // connector.setBlinkDetectionEnabled(true);
            // Thread.Sleep(450000);

            if (connector.setMentalEffortEnable(true))
            {     // return true, means success
                Console.WriteLine("HelloEEG: MentalEffort is Enabled");
            }
            else
            {
                // return false, meaning not supported because:
                //  + connected hardware doesn't support
                //  + conflict with another option already set
                Console.WriteLine("Connected hardware doesn't support, or a conflict with another option already set.");
            }
            if (connector.getMentalEffortEnable())
            {     // return true, means it is enabled
                Console.WriteLine("HelloEEG: MentalEffort is configured");
            }
            else
            {     // return false, meaning not currently configured
                Console.WriteLine("HelloEEG: MentalEffort is NOT configured");

            }
            if (connector.setMentalEffortRunContinuous(true))
            {     // return true, means success
                Console.WriteLine("HelloEEG: MentalEffort Continuous operation");
            }
            else
            {     // return false, meaning not supported because:     //  + connected hardware doesn't support     //  + conflict with another option already set     //  + not support by this version of the SDK
                Console.WriteLine("HelloEEG: MentalEffort normal operation ");
            }
            if (connector.getMentalEffortRunContinuous())
            {     // return true, means it is enabled
                Console.WriteLine("HelloEEG: MentalEffort Continuous operation");
            }
            else
            {
                // return false, meaning not currently configured
                Console.WriteLine("HelloEEG: MentalEffort normal operation");
            }
        }
开发者ID:andrehendriks,项目名称:AutonomousComputerProgram-Missy,代码行数:79,代码来源:MainWindow.xaml.cs

示例9: MainWindow

        //Instance of object which contains configuration for sending data.
        //ULoader_JSON config;
        //Instacje of object which sends data.
        //USender uSender;
        public MainWindow()
        {
            InitializeComponent();

            attentionValuesCollection = new DataCollection();

            var attentionDataSource = new EnumerableDataSource<Data>(attentionValuesCollection);
            attentionDataSource.SetXMapping(x => dateAttention.ConvertToDouble(x.Date));
            attentionDataSource.SetYMapping(y => y.Value);
            plotterAttention.AddLineGraph(attentionDataSource, Colors.Red, 2, "Attetion");

            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            connector.ConnectScan("COM3");

            //Stworzenie obiektu typu Random do wyboru losowego słowa ze słownika.
            randomWordNumber = new Random();

            wordNumber = 0;

            attentionComingCounter = 0;
            attentionValueSum = 0;
            puzzlesSolved = 0;
            wordStatList = new List<WordStat>();
            currentWord = "";

            //config = new ULoader_JSON(@"..\..\config.json");
            //uSender = config.GetSender("output1");
        }
开发者ID:Sektu,项目名称:MindwaveApp,代码行数:36,代码来源:MainWindow.xaml.cs


注:本文中的Connector.ConnectScan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。