Skip to content

Commit 5f95517

Browse files
committed
Update example code
1 parent d004120 commit 5f95517

7 files changed

Lines changed: 42 additions & 42 deletions

File tree

examples/HandleMetaData/HandleMetaData.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
using System;
22
using LSL;
33

4-
namespace ConsoleApplication1
4+
namespace LSLExamples
55
{
6-
class Program
6+
static class HandleMetaData
77
{
8-
static void Main(string[] args)
8+
public static void Main(string[] args)
99
{
1010
{
11-
using liblsl.StreamInfo inf_ = new liblsl.StreamInfo("Test", "EEG", 8, 100, liblsl.channel_format_t.cf_double64, "test1234");
11+
using StreamInfo inf_ = new StreamInfo("Test", "EEG", 8, 100, channel_format_t.cf_double64, "test1234");
1212
Console.Out.WriteLine("Test");
1313
}
1414
// create a new StreamInfo and declare some meta-data (in accordance with XDF format)
15-
using liblsl.StreamInfo info = new liblsl.StreamInfo("MetaTester", "EEG", 8, 100, liblsl.channel_format_t.cf_float32, "myuid323457");
16-
liblsl.XMLElement chns = info.desc().append_child("channels");
15+
using StreamInfo info = new StreamInfo("MetaTester", "EEG", 8, 100, channel_format_t.cf_float32, "myuid323457");
16+
XMLElement chns = info.desc().append_child("channels");
1717
String[] labels = { "C3", "C4", "Cz", "FPz", "POz", "CPz", "O1", "O2" };
1818
for (int k = 0; k < labels.Length; k++)
1919
chns.append_child("channel")
@@ -27,23 +27,23 @@ static void Main(string[] args)
2727
.append_child_value("labelscheme", "10-20");
2828

2929
// create outlet for the stream
30-
liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);
30+
StreamOutlet outlet = new StreamOutlet(info);
3131

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

3434
// resolve the stream and open an inlet
35-
liblsl.StreamInfo[] results = liblsl.resolve_stream("name", "MetaTester");
36-
using liblsl.StreamInlet inlet = new liblsl.StreamInlet(results[0]);
35+
StreamInfo[] results = LSL.LSL.resolve_stream("name", "MetaTester");
36+
using StreamInlet inlet = new StreamInlet(results[0]);
3737
results.DisposeArray();
3838

3939
// get the full stream info (including custom meta-data) and dissect it
40-
using liblsl.StreamInfo inf = inlet.info();
40+
using StreamInfo inf = inlet.info();
4141
Console.WriteLine("The stream's XML meta-data is: ");
4242
Console.WriteLine(inf.as_xml());
4343
Console.WriteLine("The manufacturer is: " + inf.desc().child_value("manufacturer"));
4444
Console.WriteLine("The cap circumference is: " + inf.desc().child("cap").child_value("size"));
4545
Console.WriteLine("The channel labels are as follows:");
46-
liblsl.XMLElement ch = inf.desc().child("channels").child("channel");
46+
XMLElement ch = inf.desc().child("channels").child("channel");
4747
for (int k = 0; k < info.channel_count(); k++)
4848
{
4949
Console.WriteLine(" " + ch.child_value("label"));

examples/ReceiveData/ReceiveData.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
using LSL;
22

3-
namespace ConsoleApplication1
3+
namespace LSLExamples
44
{
5-
class Program
5+
static class ReceiveData
66
{
7-
static void Main(string[] args)
7+
public static void Main(string[] args)
88
{
99
// wait until an EEG stream shows up
10-
liblsl.StreamInfo[] results = liblsl.resolve_stream("type", "EEG");
10+
StreamInfo[] results = LSL.LSL.resolve_stream("type", "EEG");
1111

1212
// open an inlet and print some interesting info about the stream (meta-data, etc.)
13-
using liblsl.StreamInlet inlet = new liblsl.StreamInlet(results[0]);
13+
using StreamInlet inlet = new StreamInlet(results[0]);
1414
results.DisposeArray();
1515
System.Console.Write(inlet.info().as_xml());
1616

examples/ReceiveDataInChunks/ReceiveDataInChunks.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
using System;
22
using LSL;
33

4-
namespace ConsoleApplication1
4+
namespace LSLExamples
55
{
6-
class Program
6+
static class ReceiveDataInChunks
77
{
8-
static void Main(string[] args)
8+
public static void Main(string[] args)
99
{
1010
// wait until an EEG stream shows up
11-
liblsl.StreamInfo[] results = liblsl.resolve_stream("type", "EEG");
11+
StreamInfo[] results = LSL.LSL.resolve_stream("type", "EEG");
1212

1313
// open an inlet, with post-processing enabled, and print meta-data
1414
// Note: The use of post-processing makes it impossible to recover
1515
// the original timestamps and is not recommended for applications
1616
// that store data to disk.
17-
using liblsl.StreamInlet inlet = new liblsl.StreamInlet(results[0],
18-
postproc_flags: liblsl.processing_options_t.proc_ALL);
17+
using StreamInlet inlet = new StreamInlet(results[0],
18+
postproc_flags: processing_options_t.proc_ALL);
1919
results.DisposeArray();
2020
System.Console.Write(inlet.info().as_xml());
2121

examples/ReceiveStringMarkers/ReceiveStringMarkers.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
using System;
22
using LSL;
33

4-
namespace ConsoleApplication1
4+
namespace LSLExamples
55
{
6-
class Program
6+
static class ReceiveStringMarkers
77
{
8-
static void Main(string[] args)
8+
public static void Main(string[] args)
99
{
1010
// wait until an EEG stream shows up
11-
liblsl.StreamInfo[] results = liblsl.resolve_stream("type", "Markers");
11+
StreamInfo[] results = LSL.LSL.resolve_stream("type", "Markers");
1212

1313
// open an inlet and print meta-data
14-
using liblsl.StreamInlet inlet = new liblsl.StreamInlet(results[0]);
14+
using StreamInlet inlet = new StreamInlet(results[0]);
1515
results.DisposeArray();
1616
Console.Write(inlet.info().as_xml());
1717

examples/SendData/SendData.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
using System.Threading;
33
using LSL;
44

5-
namespace ConsoleApplication1
5+
namespace LSLExamples
66
{
7-
class Program
7+
static class SendData
88
{
9-
static void Main(string[] args)
9+
public static void Main(string[] args)
1010
{
1111
Random rnd = new Random();
1212

1313
// create stream info and outlet
14-
using liblsl.StreamInfo info = new liblsl.StreamInfo("TestCSharp", "EEG", 8, 100, liblsl.channel_format_t.cf_float32, "sddsfsdf");
15-
using liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);
14+
using StreamInfo info = new StreamInfo("TestCSharp", "EEG", 8, 100, channel_format_t.cf_float32, "sddsfsdf");
15+
using StreamOutlet outlet = new StreamOutlet(info);
1616
float[] data = new float[8];
1717
while (!Console.KeyAvailable)
1818
{

examples/SendDataInChunks/SendDataInChunks.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
using System.Threading;
33
using LSL;
44

5-
namespace ConsoleApplication1
5+
namespace LSLExamples
66
{
7-
class Program
7+
static class SendDataInChunks
88
{
9-
static void Main(string[] args)
9+
public static void Main(string[] args)
1010
{
1111
Random rnd = new Random();
1212
// create stream info and outlet
13-
using liblsl.StreamInfo info = new liblsl.StreamInfo("TestCSharp", "EEG", 8, 100, liblsl.channel_format_t.cf_float32, "sddsfsdf");
14-
using liblsl.StreamOutlet outlet = new liblsl.StreamOutlet(info);
13+
using StreamInfo info = new StreamInfo("TestCSharp", "EEG", 8, 100, channel_format_t.cf_float32, "sddsfsdf");
14+
using StreamOutlet outlet = new StreamOutlet(info);
1515

1616
// send data in chunks of 10 samples and 8 channels
1717
float[,] data = new float[10, 8];

examples/SendStringMarkers/SendStringMarkers.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
using System.Threading;
33
using LSL;
44

5-
namespace ConsoleApplication1
5+
namespace LSLExamples
66
{
7-
class Program
7+
static class SendStringMarkers
88
{
9-
static void Main(string[] args)
9+
public static void Main(string[] args)
1010
{
1111
// create stream info and outlet
12-
using liblsl.StreamInfo inf = new liblsl.StreamInfo("Test1", "Markers", 1, 0, liblsl.channel_format_t.cf_string, "giu4569");
13-
using liblsl.StreamOutlet outl = new liblsl.StreamOutlet(inf);
12+
using StreamInfo inf = new StreamInfo("Test1", "Markers", 1, 0, channel_format_t.cf_string, "giu4569");
13+
using StreamOutlet outl = new StreamOutlet(inf);
1414

1515
Random rnd = new Random();
1616
string[] strings = new string[] { "Test", "ABC", "123" };

0 commit comments

Comments
 (0)