本文整理汇总了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;
}
}
示例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);
}
示例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");
}
示例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);
}
示例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");
}
示例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);
}
示例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");
}
示例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");
}
}
示例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");
}