static void Main(string[] args)
        {
            // create stream info and outlet
            liblsl.StreamInfo inf = new liblsl.StreamInfo("Test1", "Markers", 1, 0, liblsl.channel_format_t.cf_string, "giu4569");
            liblsl.StreamOutlet outl = new liblsl.StreamOutlet(inf);

            Random rnd = new Random();
            string[] strings = new string[] { "Test", "ABC", "123" };
            string[] sample = new string[1];
            for (int k = 0; ; k++)
            {
                // send a marker and wait for a random interval
                sample[0] = strings[k % 3];
                outl.push_sample(sample);
                System.Threading.Thread.Sleep(rnd.Next(1000));
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            Random rnd = new Random();
            // create stream info and outlet
            liblsl.StreamInfo info = new liblsl.StreamInfo("BioSemi", "EEG", 8, 100, liblsl.channel_format_t.cf_float32, "sddsfsdf");
            liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);

            // send data in chunks of 10 samples and 8 channels
            float[,] data = new float[10, 8];
            while (true)
            {
                for (int s = 0; s < 10; s++)
                    for (int c = 0; c < 8; c++)
                        data[s, c] = rnd.Next(-100, 100);
                outlet.push_chunk(data);
                System.Threading.Thread.Sleep(100);
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            Random rnd = new Random();

            // create stream info and outlet
            liblsl.StreamInfo info = new liblsl.StreamInfo("BioSemi", "EEG", 8, 100, liblsl.channel_format_t.cf_float32, "sddsfsdf");
            liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);
            float[] data = new float[8];
            while (true)
            {
                // generate random data and send it
                for (int k = 0; k < data.Length; k++)
                    data[k] = rnd.Next(-100, 100);
                outlet.push_sample(data);
                System.Threading.Thread.Sleep(10);
            }

            System.Console.ReadKey();
        }
예제 #4
0
        static void Main(string[] args)
        {
            // create a new StreamInfo and declare some meta-data (in accordance with XDF format)
            liblsl.StreamInfo info = new liblsl.StreamInfo("MetaTester","EEG",8,100,liblsl.channel_format_t.cf_float32,"myuid323457");
            liblsl.XMLElement chns = info.desc().append_child("channels");
            String[] labels = {"C3","C4","Cz","FPz","POz","CPz","O1","O2"};
            for (int k=0;k<labels.Length;k++)
                chns.append_child("channel")
                    .append_child_value("label", labels[k])
                    .append_child_value("unit", "microvolts")
                    .append_child_value("type","EEG");
            info.desc().append_child_value("manufacturer","SCCN");
            info.desc().append_child("cap")
                .append_child_value("name","EasyCap")
                .append_child_value("size","54")
                .append_child_value("labelscheme","10-20");

            // create outlet for the stream
            liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);

            // === the following could run on another computer ===

            // resolve the stream and open an inlet
            liblsl.StreamInfo[] results = liblsl.resolve_stream("name","MetaTester");
            liblsl.StreamInlet inlet = new liblsl.StreamInlet(results[0]);
            // get the full stream info (including custom meta-data) and dissect it
            liblsl.StreamInfo inf = inlet.info();
            Console.WriteLine("The stream's XML meta-data is: ");
            Console.WriteLine(inf.as_xml());
            Console.WriteLine("The manufacturer is: " + inf.desc().child_value("manufacturer"));
            Console.WriteLine("The cap circumference is: " + inf.desc().child("cap").child_value("size"));
            Console.WriteLine("The channel labels are as follows:");
            liblsl.XMLElement ch = inf.desc().child("channels").child("channel");
            for (int k=0;k<info.channel_count();k++) {
                Console.WriteLine("  " + ch.child_value("label"));
                ch = ch.next_sibling();
            }
            Console.ReadKey();
        }
예제 #5
0
        private void start_Click(object sender, EventArgs e)
        {
            string user;
            string pw;
            if (captureStatus == true) MessageBox.Show("Capturer is already running!");
            else
            {
                try
                {
                    usernameString = username.Text;
                    user=usernameString;
                    pw=textBoxPassword.Text;
                    if (!User.login(usernameString,pw)) MessageBox.Show("Invalid username or password!");
                    else
                    {

                        file = new System.IO.StreamWriter(filePath + "\\" + getCurrentTimeMillis() + "_" + usernameString + ".txt");
                        file.WriteLine("# user: "******" #");
                        captureStatus = true;
                        mouseHook.Start();
                        keyboardHook.Start();
                        this.winEventProc = new WinEventDelegate(WinEventProc);
                        m_hhook = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, IntPtr.Zero, this.winEventProc, 0, 0, WINEVENT_OUTOFCONTEXT);
                        start.Enabled = false;
                        stop.Enabled = true;
                        User.recordLogin(usernameString);
                        this.Hide();

                        inf = new liblsl.StreamInfo(streamNameBox.Text, chanelTBox.Text, Convert.ToInt32(chanelCountBox.Text), Convert.ToInt32(nstrateBox.Text), liblsl.channel_format_t.cf_string, sourceIDBox.Text);
                        outl = new liblsl.StreamOutlet(inf);

                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    captureStatus = false;
                }
            }
        }