├── Unicorn Speller
├── Unity
│ ├── Images
│ │ ├── step1.PNG
│ │ ├── step10.PNG
│ │ ├── step11.PNG
│ │ ├── step12.PNG
│ │ ├── step2.PNG
│ │ ├── step3.PNG
│ │ ├── step4.png
│ │ ├── step5.png
│ │ ├── step6.png
│ │ ├── step7.png
│ │ ├── step8.PNG
│ │ └── step9.png
│ ├── Assets
│ │ └── UnicornSpellerInterface
│ │ │ ├── Unity.ItemReceiver.dll
│ │ │ ├── UnicornSpellerInterface.cs
│ │ │ ├── SpellerReceiver.cs
│ │ │ └── Unity.ItemReceiver.xml
│ ├── LICENSE.txt
│ └── README.md
└── README.md
├── Unicorn Linux C API
└── x64
│ ├── Lib
│ ├── libunicorn.so
│ └── unicorn.h
│ ├── UnicornLinuxCAPI.pdf
│ ├── UnicornCAPIAcquisitionExample
│ ├── README.md
│ ├── .project
│ ├── .autotools
│ └── main.cpp
│ └── LICENSE.txt
├── Unicorn Windows C API (x86)
├── Lib
│ ├── unicorn.h
│ ├── Unicorn.dll
│ ├── Unicorn.lib
│ └── LICENSE.txt
└── README.md
├── Unicorn .NET API
├── UnicornLSL
│ ├── UnicornLSL
│ │ ├── unicorn.ico
│ │ ├── Resources
│ │ │ ├── Icons
│ │ │ │ └── unicorn.ico
│ │ │ └── liblsl-Csharp-1.11
│ │ │ │ └── liblsl64.dll
│ │ ├── App.config
│ │ ├── Properties
│ │ │ ├── Settings.settings
│ │ │ ├── Settings.Designer.cs
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ └── Resources.resx
│ │ ├── Program.cs
│ │ ├── UnicornLSL.csproj
│ │ ├── MainUI.resx
│ │ └── MainUI.Designer.cs
│ ├── README.md
│ ├── UnicornLSL.sln
│ └── LICENSE.txt
├── UnicornUnityRawDataInterface
│ ├── Images
│ │ └── 1.png
│ ├── UnicornUnity.cs
│ ├── README.md
│ └── LICENSE.txt
├── UnicornUDP
│ ├── UnicornUDP
│ │ ├── App.config
│ │ ├── Properties
│ │ │ ├── Settings.settings
│ │ │ ├── Settings.Designer.cs
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ └── Resources.resx
│ │ ├── Program.cs
│ │ ├── UnicornUDP.csproj
│ │ ├── MainUI.resx
│ │ ├── MainUI.cs
│ │ └── MainUI.Designer.cs
│ ├── UnicornUDPReceiver
│ │ ├── App.config
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Program.cs
│ │ └── UnicornUDPReceiver.csproj
│ ├── README.md
│ ├── LICENSE.txt
│ └── UnicornUDP.sln
└── README.md
├── Unicorn Raspberry Pi Zero W C API
├── Lib
│ ├── libunicorn.so
│ └── unicorn.h
└── UnicornCAPIAcquisitionExample
│ ├── README.txt
│ └── main.cpp
├── Unicorn Bluetooth Protocol
└── UnicornBluetoothProtocol.pdf
├── Unicorn Recorder
└── README.md
└── README.md
/Unicorn Speller/Unity/Images/step1.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step1.PNG
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step10.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step10.PNG
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step11.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step11.PNG
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step12.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step12.PNG
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step2.PNG
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step3.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step3.PNG
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step4.png
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step5.png
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step6.png
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step7.png
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step8.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step8.PNG
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Images/step9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Images/step9.png
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/Lib/libunicorn.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Linux C API/x64/Lib/libunicorn.so
--------------------------------------------------------------------------------
/Unicorn Windows C API (x86)/Lib/unicorn.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Windows C API (x86)/Lib/unicorn.h
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/UnicornLinuxCAPI.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Linux C API/x64/UnicornLinuxCAPI.pdf
--------------------------------------------------------------------------------
/Unicorn Windows C API (x86)/Lib/Unicorn.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Windows C API (x86)/Lib/Unicorn.dll
--------------------------------------------------------------------------------
/Unicorn Windows C API (x86)/Lib/Unicorn.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Windows C API (x86)/Lib/Unicorn.lib
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/unicorn.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn .NET API/UnicornLSL/UnicornLSL/unicorn.ico
--------------------------------------------------------------------------------
/Unicorn Raspberry Pi Zero W C API/Lib/libunicorn.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Raspberry Pi Zero W C API/Lib/libunicorn.so
--------------------------------------------------------------------------------
/Unicorn Bluetooth Protocol/UnicornBluetoothProtocol.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Bluetooth Protocol/UnicornBluetoothProtocol.pdf
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUnityRawDataInterface/Images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn .NET API/UnicornUnityRawDataInterface/Images/1.png
--------------------------------------------------------------------------------
/Unicorn Speller/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn Speller Examples
2 |
3 | [Unicorn Speller Unity Interface](https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/tree/master/Unicorn%20Speller/Unity)
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUnityRawDataInterface/UnicornUnity.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn .NET API/UnicornUnityRawDataInterface/UnicornUnity.cs
--------------------------------------------------------------------------------
/Unicorn Recorder/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn Recorder Examples
2 |
3 | [Unicorn Recorder Example Datasets](https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/tree/master/Unicorn%20Recorder/Datasets)
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Resources/Icons/unicorn.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn .NET API/UnicornLSL/UnicornLSL/Resources/Icons/unicorn.ico
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Assets/UnicornSpellerInterface/Unity.ItemReceiver.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn Speller/Unity/Assets/UnicornSpellerInterface/Unity.ItemReceiver.dll
--------------------------------------------------------------------------------
/Unicorn Windows C API (x86)/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn Windows C API (x86)
2 | This folder contains the 32-bit libraries for the Unicorn C API. The C-API reference of the Unicorn Suite Hybrid Black manual applies for these libraries.
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Resources/liblsl-Csharp-1.11/liblsl64.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/HEAD/Unicorn .NET API/UnicornLSL/UnicornLSL/Resources/liblsl-Csharp-1.11/liblsl64.dll
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDPReceiver/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Unicorn .NET API/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn .NET Examples
2 |
3 | [Unicorn LSL](https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/tree/master/Unicorn%20.NET%20API/UnicornLSL)
4 | [Unicorn UDP](https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/tree/master/Unicorn%20.NET%20API/UnicornUDP)
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Unicorn Raspberry Pi Zero W C API/UnicornCAPIAcquisitionExample/README.txt:
--------------------------------------------------------------------------------
1 | 1. compile the example (change PATHTOLIBFOLDER to your individual folderpath e.g. /home/pi/Desktop/Lib)
2 | g++ main.cpp -I PATHTOLIBFOLDER -L PATHTOLIBFOLDER -lunicorn -o UnicornAcquisitionExample
3 |
4 | 2. add library to environment variable
5 | export LD_LIBRARY_PATH=PATHTOLIBFOLDER:$LD_LIBRARY_PATH
6 |
7 | 3. execute the exemple
8 | ./UnicornAcquisitionExample
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace UnicornLSL
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new MainUI());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace UnicornUDP
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new MainUI());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/UnicornCAPIAcquisitionExample/README.md:
--------------------------------------------------------------------------------
1 | ## Howto Compile
2 |
3 | ### Compile the example
4 |
5 | `g++ main.cpp -I ../Lib -L ../Lib -lunicorn -o UnicornAcquisitionExample`
6 |
7 | or if you run into problems try:
8 |
9 | `g++ main.cpp -Wno-narrowing -I ../Lib -L ../Lib -lunicorn -o UnicornAcquisitionExample`
10 |
11 | ### Add Unicorn C-Lib to LD_LIBRARY PATH
12 | Put this into you .bashrc and replace PATHTOLIBFOLDER with the absolute path to the `../Lib` relative to this directory.
13 | e.g. /home/youruser/Desktop/Unicorn\ Linux\ C\ API\x64\Lib
14 |
15 | `export LD_LIBRARY_PATH=PATHTOLIBFOLDER:$LD_LIBRARY_PATH`
16 |
17 | ### Execute the Example
18 | `./UnicornAcquisitionExample`
19 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn LSL
2 |
3 | Prerequisites:
4 | - Microsoft Windows 10 Pro, 64-bit, English
5 | - Unicorn Suite Hybrid Black 1.18.00
6 | - Microsoft Visual Studio
7 | -- Microsoft .NET framework 4.7.1
8 |
9 | 1. Ensure that the Unicorn Suite Hybrid Black is installed on your computer.
10 | 2. Copy the files in this folder to C:\Users\\Documents\gtec\Unicorn Suite\Hybrid Black\Unicorn DotNet\Examples\UnicornLSL
11 | 3. Open the solution 'UnicornLSL.sln' in Visual Studio
12 | 4. Select the desired configuration (Release/Debug) and build the project
13 |
14 | ATTENTION: If the build fails the prerequisites have not been installed properly or the project has not been copied to the appropriate path (post build scripts will fail).
15 | Check the paths to the referenced Unicorn Suite libraries in the project file settings, as well as in the post build action.
16 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn UDP
2 |
3 | Prerequisites:
4 | - Microsoft Windows 10 Pro, 64-bit, English
5 | - Unicorn Suite Hybrid Black 1.18.00
6 | - Microsoft Visual Studio
7 | -- Microsoft .NET framework 4.7.1
8 |
9 | 1. Ensure that the Unicorn Suite Hybrid Black is installed on your computer.
10 | 2. Copy the files in this folder to C:\Users\\Documents\gtec\Unicorn Suite\Hybrid Black\Unicorn DotNet\Examples\UnicornUDP
11 | 3. Open the solution 'UnicornUDP.sln' in Visual Studio
12 | 4. Select the desired configuration (Release/Debug) and build the project
13 |
14 | ATTENTION: If the build fails the prerequisites have not been installed properly or the project has not been copied to the appropriate path (post build scripts will fail).
15 | Check the paths to the referenced Unicorn Suite libraries in the project file settings, as well as in the post build action.
16 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUnityRawDataInterface/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn Unity Raw Data Interface
2 |
3 | The Unicorn Unity Raw Data Interface implements a basic data acquisition loop in Unity. It allows to acquire raw EEG data in realtime.
4 |
5 | Prerequisites:
6 | - Microsoft Windows 10 Pro, 64-bit, English
7 | - Unicorn Suite Hybrid Black 1.18.00
8 | - Microsoft Visual Studio
9 | -- Microsoft .NET framework 4.7.1
10 | - Unity 2019.1.0f2
11 |
12 | [screenshot]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20.NET%20API/UnicornUnityRawDataInterface/Images/1.png "Screenshot"
13 |
14 | 1. Create a new Unity Project
15 | 2. Create a "Plugins" folder in the "Assets" folder
16 | 3. Copy "Unicorn.dll" and "UnicornDotNet.dll" from "C:\Users\\Documents\gtec\Unicorn Suite\Hybrid Black\Unicorn DotNet\Lib" to the "Plugins" folder
17 | 4. Copy "UnicornUnity.cs" to the Assets folder
18 | 5. Attach the script to a gameobject in Unity
19 | ![alt text][screenshot]
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicornLSL", "UnicornLSL\UnicornLSL.csproj", "{3021D30D-5B81-4666-9178-B14347AAB636}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Release|x64 = Release|x64
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {3021D30D-5B81-4666-9178-B14347AAB636}.Debug|x64.ActiveCfg = Debug|x64
15 | {3021D30D-5B81-4666-9178-B14347AAB636}.Debug|x64.Build.0 = Debug|x64
16 | {3021D30D-5B81-4666-9178-B14347AAB636}.Release|x64.ActiveCfg = Release|x64
17 | {3021D30D-5B81-4666-9178-B14347AAB636}.Release|x64.Build.0 = Release|x64
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 g.tec neurotechnology GmbH
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 g.tec neurotechnology GmbH
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 g.tec neurotechnology GmbH
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUnityRawDataInterface/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2023 g.tec medical engineering GmbH
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Unicorn Windows C API (x86)/Lib/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 g.tec neurotechnology GmbH
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/UnicornCAPIAcquisitionExample/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | UnicornCAPIAcquisitionExample
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.autotools.core.genmakebuilderV2
10 |
11 |
12 |
13 |
14 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
15 | clean,full,incremental,
16 |
17 |
18 |
19 |
20 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
21 | full,incremental,
22 |
23 |
24 |
25 |
26 |
27 | org.eclipse.cdt.core.cnature
28 | org.eclipse.cdt.core.ccnature
29 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
30 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
31 | org.eclipse.cdt.autotools.core.autotoolsNatureV2
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace UnicornLSL.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace UnicornUDP.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicornUDP", "UnicornUDP\UnicornUDP.csproj", "{3021D30D-5B81-4666-9178-B14347AAB636}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicornUDPReceiver", "UnicornUDPReceiver\UnicornUDPReceiver.csproj", "{EC9F0FCE-A448-48EE-8771-EB335B560910}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|x64 = Debug|x64
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {3021D30D-5B81-4666-9178-B14347AAB636}.Debug|x64.ActiveCfg = Debug|x64
17 | {3021D30D-5B81-4666-9178-B14347AAB636}.Debug|x64.Build.0 = Debug|x64
18 | {3021D30D-5B81-4666-9178-B14347AAB636}.Release|x64.ActiveCfg = Release|x64
19 | {3021D30D-5B81-4666-9178-B14347AAB636}.Release|x64.Build.0 = Release|x64
20 | {EC9F0FCE-A448-48EE-8771-EB335B560910}.Debug|x64.ActiveCfg = Debug|x64
21 | {EC9F0FCE-A448-48EE-8771-EB335B560910}.Debug|x64.Build.0 = Debug|x64
22 | {EC9F0FCE-A448-48EE-8771-EB335B560910}.Release|x64.ActiveCfg = Release|x64
23 | {EC9F0FCE-A448-48EE-8771-EB335B560910}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Assets/UnicornSpellerInterface/UnicornSpellerInterface.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using System.Net;
4 | using Unity.ItemRecever;
5 |
6 | public class UnicornSpellerInterface : MonoBehaviour
7 | {
8 | // Start is called before the first frame update
9 | void Start()
10 | {
11 | try
12 | {
13 | //IP settings
14 | string ips = "127.0.0.1";
15 | int port = 1000;
16 | IPAddress ip = IPAddress.Parse(ips);
17 |
18 | //Start listening for Unicorn Speller network messages
19 | SpellerReceiver r = new SpellerReceiver(ip, port);
20 |
21 | //attach items received event
22 | r.OnItemReceived += OnItemReceived;
23 |
24 | Debug.Log(String.Format("Listening to {0} on port {1}.", ip, port));
25 | }
26 | catch (Exception ex)
27 | {
28 | Debug.Log(ex.Message);
29 | }
30 | }
31 |
32 | // Update is called once per frame
33 | void Update()
34 | {
35 | //Do something...
36 | }
37 |
38 | // OnItemReceived is called if a classified item is received from Unicorn Speller via udp.
39 | private void OnItemReceived(object sender, EventArgs args)
40 | {
41 | ItemReceivedEventArgs eventArgs = (ItemReceivedEventArgs) args;
42 | Debug.Log(String.Format("Received BoardItem:\tName: {0}\tOutput Text: {1}", eventArgs.BoardItem.Name, eventArgs.BoardItem.OutputText));
43 |
44 | //Do something...
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("UnicornLSL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("UnicornLSL")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3021d30d-5b81-4666-9178-b14347aab636")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("UnicornLSL")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("UnicornLSL")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3021d30d-5b81-4666-9178-b14347aab636")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDPReceiver/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("UDPReceiver")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("UDPReceiver")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("ec9f0fce-a448-48ee-8771-eb335b560910")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 g.tec neurotechnology GmbH
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 | --------------------------
10 |
11 | Liblsl - Labstreaminglayer
12 |
13 | Copyright (C) 2012 Christian A. Kothe
14 |
15 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16 |
17 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
18 |
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDPReceiver/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Net.Sockets;
4 |
5 | namespace UnicornUDPReceiver
6 | {
7 | class Program
8 | {
9 | static void Main(string[] args)
10 | {
11 | Console.WriteLine("Unicorn UDP Receiver Example");
12 | Console.WriteLine("----------------------------");
13 | Console.WriteLine();
14 | try
15 | {
16 | //define an IP endpoint
17 | Console.Write("Destination port: ");
18 | int port = Convert.ToInt32(Console.ReadLine());
19 | IPAddress ip = IPAddress.Any;
20 | IPEndPoint endPoint = new IPEndPoint(ip, port);
21 | Console.WriteLine("Listening on port '{0}'...",port);
22 |
23 | //initialize upd socket
24 | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
25 | socket.Bind(endPoint);
26 | byte[] receiveBufferByte = new byte[1024];
27 | float[] receiveBufferFloat= new float[receiveBufferByte.Length / sizeof(float)];
28 |
29 | //acquisition loop
30 | while (true)
31 | {
32 | int numberOfBytesReceived = socket.Receive(receiveBufferByte);
33 | if (numberOfBytesReceived > 0)
34 | {
35 | //convert byte array to float array
36 | for (int i = 0; i < numberOfBytesReceived / sizeof(float); i++)
37 | {
38 | receiveBufferFloat[i] = BitConverter.ToSingle(receiveBufferByte, i * sizeof(float));
39 | if(i+1< numberOfBytesReceived / sizeof(float))
40 | Console.Write("{0},", receiveBufferFloat[i].ToString("n2"));
41 | else
42 | Console.WriteLine("{0}", receiveBufferFloat[i].ToString("n2"));
43 | }
44 | }
45 | }
46 | }
47 | catch(Exception ex)
48 | {
49 | Console.WriteLine("Error: {0}", ex.Message);
50 | Console.WriteLine("Press ENTER to terminate the application.");
51 | Console.ReadLine();
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Assets/UnicornSpellerInterface/SpellerReceiver.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using Intendix.Board;
4 |
5 | namespace Unity.ItemRecever
6 | {
7 | public class ItemReceivedEventArgs : EventArgs
8 | {
9 | public BoardItem BoardItem { get; set; }
10 | }
11 |
12 | public class SpellerReceiver : ItemReceiver.ItemReceiver
13 | {
14 | #region Events...
15 |
16 | ///
17 | /// This method is called if a classified item is received from Unicorn Speller.
18 | ///
19 | public event EventHandler OnItemReceived;
20 |
21 | #endregion
22 |
23 | #region Private members...
24 |
25 | private int _port = 0;
26 | private IPAddress _ip = null;
27 | private ItemReceivedEventArgs _eventArgs;
28 |
29 | #endregion
30 |
31 | ///
32 | /// Creates a new instance of .
33 | ///
34 | /// The is listening for network messages on this ip address.
35 | /// The is listening for network messages on this port.
36 | public SpellerReceiver(IPAddress ip, int port)
37 | {
38 | _ip = ip;
39 | _port = port;
40 | _eventArgs = new ItemReceivedEventArgs();
41 | Start();
42 | }
43 |
44 | ///
45 | /// This method is called if a classified item is received from Unicorn Speller.
46 | ///
47 | /// represents one item of the speller board.
48 | public override void ItemReceived(BoardItem item)
49 | {
50 | _eventArgs.BoardItem = item;
51 | OnItemReceived(this, _eventArgs);
52 | }
53 |
54 | ///
55 | /// Starts listening for network messages from speller on the defined ip and port.
56 | ///
57 | public void Start()
58 | {
59 | if (!IsRunning)
60 | {
61 | BeginReceiving(_ip, _port);
62 | }
63 | else
64 | throw new InvalidOperationException(String.Format("Receiver is already running."));
65 | }
66 |
67 | ///
68 | /// Stopps listening for network messages from speller.
69 | ///
70 | public void Stop()
71 | {
72 | if (IsRunning)
73 | {
74 | BeginReceiving(_ip, _port);
75 | }
76 | else
77 | throw new InvalidOperationException(String.Format("Receiver is not running yet."));
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDPReceiver/UnicornUDPReceiver.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {EC9F0FCE-A448-48EE-8771-EB335B560910}
8 | Exe
9 | Properties
10 | UnicornUDPReceiver
11 | UnicornUDPReceiver
12 | v4.7.1
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | ..\Debug\x64\
20 | DEBUG;TRACE
21 | full
22 | x64
23 | prompt
24 | MinimumRecommendedRules.ruleset
25 | true
26 |
27 |
28 | ..\Release\x64\
29 | TRACE
30 | true
31 | pdbonly
32 | x64
33 | prompt
34 | MinimumRecommendedRules.ruleset
35 | true
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
62 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace UnicornLSL.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UnicornLSL.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace UnicornUDP.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UnicornUDP.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/UnicornCAPIAcquisitionExample/.autotools:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn Speller Unity Interface
2 |
3 | Prerequisites:
4 | - Microsoft Windows 10 Pro, 64-bit, English
5 | - Unicorn Suite Hybrid Black 1.18.00
6 | - Microsoft Visual Studio
7 | -- Microsoft .NET framework 4.7.1
8 | - Unity 2019.1.0f2
9 |
10 | [step1]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step1.PNG "Step 1"
11 | [step2]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step2.PNG "Step 2"
12 | [step3]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step3.PNG "Step 3"
13 | [step4]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step4.png "Step 4"
14 | [step5]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step5.png "Step 5"
15 | [step6]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step6.png "Step 6"
16 | [step7]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step7.png "Step 7"
17 | [step8]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step8.PNG "Step 8"
18 | [step9]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step9.png "Step 9"
19 | [step10]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step10.PNG "Step 10"
20 | [step11]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step11.PNG "Step 11"
21 | [step12]: https://github.com/unicorn-bi/Unicorn-Suite-Hybrid-Black/blob/master/Unicorn%20Speller/Unity/Images/step12.PNG "Step 12"
22 |
23 | 1. Ensure that all prerequisites are installed on your computer.
24 | 2. Create a new Unity project.
25 | ![alt text][step1]
26 | ![alt text][step2]
27 | 3. Copy the 'UnicornSpellerInterface' folder to the 'Assets' folder of your Unity project.
28 | ![alt text][step3]
29 | 4. Create a new Unity Game Object and add the 'Unicorn Speller Interface' with 'Add Component'.
30 | ![alt text][step4]
31 | ![alt text][step5]
32 | ![alt text][step6]
33 | 5. Run your Unity project. Open the debug console. The debug console should feature an entry mentioning that the Unicorn Speller interface is listening to 127.0.0.1 on port 1000 (loop-back address if data is exchanged between programs on one machine). You can modify ip and port in the 'UnicornSpellerInterface.cs'. 7. Ensure that your firewall is not blocking data from Unicorn Speller and Unity.
34 | ![alt text][step7]
35 | 6. Start the Unicorn Speller from Unicorn Suite Hybrid Black.
36 | ![alt text][step8]
37 | 7. Open the 'Network output...' dialog to send test-data from Unicorn Speller to Unity. Ensure that the network configuration (ip and port) fit the settings defined in 'UnicornSpellerInterface.cs' (default ip 127.0.0.1 default port 1000).
38 | ![alt text][step9]
39 | 8. Modify the 'Item name' and press 'Send Item...'.
40 | ![alt text][step10]
41 | 9. Switch back to Unity. The debug console should feature an entry mentioning that an item was received.
42 | ![alt text][step11]
43 | 10. You can modify the Board Items of in the 'Board Configuration' dialog. You can create your individual items that can be used within Unity using this interface.
44 | ![alt text][step12]
45 | 11. You can modify 'UnicornSpellerInterface.cs' to add your game logic or change the network settings.
46 |
47 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/UnicornUDP.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3021D30D-5B81-4666-9178-B14347AAB636}
8 | WinExe
9 | Properties
10 | UnicornUDP
11 | UnicornUDP
12 | v4.7.1
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | ..\Debug\x64\
20 | DEBUG;TRACE
21 | full
22 | x64
23 | prompt
24 | MinimumRecommendedRules.ruleset
25 | true
26 |
27 |
28 | ..\Release\x64\
29 | TRACE
30 | true
31 | pdbonly
32 | x64
33 | prompt
34 | MinimumRecommendedRules.ruleset
35 | true
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | ..\..\..\Lib\UnicornDotNet.dll
51 |
52 |
53 |
54 |
55 | Form
56 |
57 |
58 | MainUI.cs
59 |
60 |
61 |
62 |
63 | MainUI.cs
64 |
65 |
66 | ResXFileCodeGenerator
67 | Resources.Designer.cs
68 | Designer
69 |
70 |
71 | True
72 | Resources.resx
73 | True
74 |
75 |
76 | SettingsSingleFileGenerator
77 | Settings.Designer.cs
78 |
79 |
80 | True
81 | Settings.settings
82 | True
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 | echo Copying native Unicorn library..
91 | .
92 | copy "$(ProjectDir)..\..\..\..\Unicorn CAPI\Lib\Unicorn.dll" "$(TargetDir)"
93 |
94 |
101 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/UnicornLSL.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {3021D30D-5B81-4666-9178-B14347AAB636}
8 | WinExe
9 | Properties
10 | UnicornLSL
11 | UnicornLSL
12 | v4.7.1
13 | 512
14 | true
15 |
16 |
17 |
18 | true
19 | bin\x64\Debug\
20 | DEBUG;TRACE
21 | full
22 | x64
23 | prompt
24 | MinimumRecommendedRules.ruleset
25 | true
26 |
27 |
28 | bin\x64\Release\
29 | TRACE
30 | true
31 | pdbonly
32 | x64
33 | prompt
34 | MinimumRecommendedRules.ruleset
35 | true
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | ..\..\..\Lib\UnicornDotNet.dll
51 |
52 |
53 |
54 |
55 |
56 | Form
57 |
58 |
59 | MainUI.cs
60 |
61 |
62 |
63 |
64 | MainUI.cs
65 |
66 |
67 | ResXFileCodeGenerator
68 | Resources.Designer.cs
69 | Designer
70 |
71 |
72 | True
73 | Resources.resx
74 | True
75 |
76 |
77 | SettingsSingleFileGenerator
78 | Settings.Designer.cs
79 |
80 |
81 | True
82 | Settings.settings
83 | True
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | echo Copying native Unicorn library...
92 | copy "$(ProjectDir)..\..\..\..\Unicorn CAPI\Lib\Unicorn.dll" "$(TargetDir)"
93 |
94 | echo Copying native LSL library...
95 | copy "$(ProjectDir)Resources\liblsl-Csharp-1.11\liblsl64.dll" "$(TargetDir)"
96 |
97 |
104 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Unicorn Suite Hybrid Black
2 | The Unicorn Brain Interface is a high-quality wireless EEG-headset for brain-computer interface (BCI) applications to perfectly acquire brain waves. The Unicorn Brain Interface allows developers, artists and makers to acquire and process brain signals, ranging from simple display of the signals, to design and control attached devices or interact e.g. with artistic installations, toys, computer programs or applications. Unicorn Brain Interface acquires EEG from eight Unicorn Hybrid EEG Electrodes and comes with the Unicorn Suite, the main software application for the Unicorn Brain Interface. The data is sampled with 24 Bit and sampled with 250 Hz per channel. The unique Unicorn hybrid EEG electrodes allow users to record dry or with gel which enables the usage for many different applications.
3 |
4 | # Unicorn Hybrid Black Video Tutorials
5 | ### Unicorn Hybrid Black Tutorial: Unicorn Suite
6 | [](https://youtu.be/LOfIr2F7-Tc "Unicorn Hybrid Black Tutorial: Unicorn Suite")
7 |
8 | ### Unicorn Hybrid Black Tutorial: Hardware Setup and Handling
9 | [](https://youtu.be/UVVUJTwvGnw "Unicorn Hybrid Black Tutorial: Hardware Setup and Handling")
10 |
11 | ### Unicorn Hybrid Black Tutorial: Unicorn Recorder
12 | [](https://youtu.be/s6mOv4nyBHk "Unicorn Hybrid Black Tutorial: Unicorn Recorder")
13 |
14 | ### Unicorn Hybrid Black Tutorial: Unicorn Speller
15 | [](https://youtu.be/aB60zmmTLq0 "Unicorn Hybrid Black Tutorial: Unicorn Speller")
16 |
17 | ### Unicorn Hybrid Black Tutorial: Unicorn Speller - Painting add-on
18 | [](https://youtu.be/b60qF-tX5vY "Unicorn Hybrid Black Tutorial: Unicorn Speller - Painting add-on")
19 |
20 | ### Unicorn Hybrid Black Tutorial: Unicorn Speller - Sphero add-on
21 | [](https://youtu.be/FmSKfg4SZq0 "Unicorn Hybrid Black Tutorial: Unicorn Speller - Sphero add-on")
22 |
23 | ### Unicorn Hybrid Black Tutorial: Unicorn Blondy Check
24 | [](https://youtu.be/RkLV8xzerfg "Unicorn Hybrid Black Tutorial: Unicorn Blondy Check")
25 |
26 | ### Unicorn Hybrid Black Tutorial: Unicorn Bandpower
27 | [](https://youtu.be/_VtA9E0hgUA "Unicorn Hybrid Black Tutorial: Unicorn Bandpower")
28 |
29 | ### Unicorn Hybrid Black Tutorial: Python API
30 | [](https://youtu.be/N0d_B0jergs "Unicorn Hybrid Black Tutorial: Python API")
31 |
32 | ### Unicorn Hybrid Black Tutorial: Simulink Interface
33 | [](https://youtu.be/erYtpEJ_dYc "Unicorn Hybrid Black Tutorial: Simulink Interface")
34 |
35 | ### Unicorn Hybrid Black Tutorial: Dev Tools - C API
36 | [](https://youtu.be/ylbpKTY1Awg "Unicorn Hybrid Black Tutorial: Dev Tools - C API")
37 |
38 | ### Unicorn Hybrid Black Tutorial: Dev Tools - .NET API
39 | [](https://youtu.be/U8xWlIyY4DI "Unicorn Hybrid Black Tutorial: Dev Tools - .NET API")
40 |
41 | ### Unicorn Hybrid Black Tutorial: Android API
42 | [](https://youtu.be/2Oi7AAHapNw "Unicorn Hybrid Black Tutorial: Android API")
43 |
44 | ### Unicorn Hybrid Black Tutorial: Lab Streaming Layer (LSL)
45 | [](https://youtu.be/l18lJ7MGU38 "Unicorn Hybrid Black Tutorial: Lab Streaming Layer (LSL)")
46 |
47 | ### Unicorn Hybrid Black Tutorial: User Dataprogram Protocol (UDP)
48 | [](https://youtu.be/Wh_C299mCyU "Unicorn Hybrid Black Tutorial: User Dataprogram Protocol (UDP)")
49 |
50 | ### Unicorn Hybrid Black Tutorial: Speller Unity Interface
51 | [](https://youtu.be/fAVcfhJZksc "Unicorn Hybrid Black Tutorial: Unity")
52 |
53 | ### Unicorn Hybrid Black Tutorial: Unicorn Unity Interface
54 | [](https://youtu.be/rzqhs7_-RgI "Unicorn Hybrid Black Tutorial: Unity Unity Interface")
55 |
56 | ### BR41N.IO Hackathon inspiration
57 | [](https://www.youtube.com/c/BR41NIO/videos "BR41N.IO Hackathon inspiration")
58 |
59 | FAQ:
60 | [Unicorn FAQs](https://www.unicorn-bi.com/faq/)
61 |
62 | Issues:
63 | [Unicorn Suite Issues](https://github.com/unicorn-bi/Unicorn-Suite-1.18/issues)
64 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/MainUI.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/MainUI.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/UnicornCAPIAcquisitionExample/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | // Include unicorn header-file.
5 | #include "unicorn.h"
6 |
7 | // Specifications for the data acquisition.
8 | //-------------------------------------------------------------------------------------
9 | #define DATA_FILE "data.bin" // The name of the file which is storing acquired data.
10 | #define ACQUISITION_DURATION_S 10.0f // The acquisition duration in seconds.
11 | #define FRAME_LENGTH 1 // The number of samples acquired per get data call.
12 | #define TESTSIGNAL_ENABLED true // Flag to enable or disable testsignal.
13 |
14 | // Function declarations.
15 | //-------------------------------------------------------------------------------------
16 | void HandleError(int errorCode);
17 | void PrintErrorMessage(int errorCode);
18 |
19 | //-------------------------------------------------------------------------------------
20 | // Main. Program entry point.
21 | //-------------------------------------------------------------------------------------
22 | int main(int argc, char** argv)
23 | {
24 | std::cout << "Unicorn Acquisition Example" << std::endl;
25 | std::cout << "---------------------------" << std::endl << std::endl;
26 |
27 | // Variable to store error codes.
28 | int errorCode = UNICORN_ERROR_SUCCESS;
29 |
30 | // Structure that holds the handle for the currecnt session.
31 | UNICORN_HANDLE deviceHandle = 0;
32 |
33 | try
34 | {
35 | // Get available devices.
36 | //-------------------------------------------------------------------------------------
37 |
38 | // Get number of available devices.
39 | unsigned int availableDevicesCount = 0;
40 | errorCode = UNICORN_GetAvailableDevices(NULL, &availableDevicesCount, TRUE);
41 | HandleError(errorCode);
42 |
43 | if (availableDevicesCount < 1)
44 | {
45 | std::cout << "No device available. Please pair with a Unicorn device first.";
46 | errorCode = UNICORN_ERROR_GENERAL_ERROR;
47 | }
48 |
49 | //Get available device serials.
50 | UNICORN_DEVICE_SERIAL *availableDevices = new UNICORN_DEVICE_SERIAL[availableDevicesCount];
51 | errorCode = UNICORN_GetAvailableDevices(availableDevices, &availableDevicesCount, true);
52 | HandleError(errorCode);
53 |
54 | //Print available device serials.
55 | std::cout << "Available devices:" << std::endl;
56 | for (unsigned int i = 0; i> deviceSelection;
65 | if (deviceSelection >= availableDevicesCount || deviceSelection < 0)
66 | errorCode = UNICORN_ERROR_GENERAL_ERROR;
67 |
68 | HandleError(errorCode);
69 |
70 | // Open selected device.
71 | //-------------------------------------------------------------------------------------
72 | std::cout << "Trying to connect to '" << availableDevices[deviceSelection] << "'." << std::endl;
73 | errorCode = UNICORN_OpenDevice(availableDevices[deviceSelection],&deviceHandle);
74 | HandleError(errorCode);
75 |
76 | std::cout << "Connected to '" << availableDevices[deviceSelection] << "'." << std::endl;
77 | std::cout << "Device Handle: " << deviceHandle << std::endl;
78 |
79 | // Create a file to store data.
80 | std::ofstream file(DATA_FILE, std::ios_base::binary);
81 |
82 | float* acquisitionBuffer = NULL;
83 | try
84 | {
85 | // Initialize acquisition members.
86 | //-------------------------------------------------------------------------------------
87 | unsigned int numberOfChannelsToAcquire;
88 | UNICORN_GetNumberOfAcquiredChannels(deviceHandle, &numberOfChannelsToAcquire);
89 |
90 | UNICORN_AMPLIFIER_CONFIGURATION configuration;
91 | errorCode = UNICORN_GetConfiguration(deviceHandle, &configuration);
92 | HandleError(errorCode);
93 |
94 | // Print acquisition configuration
95 | std::cout << std::endl << "Acquisition Configuration:" << std::endl;
96 | std::cout << "Frame Length: " << FRAME_LENGTH << std::endl;
97 | std::cout << "Number Of Acquired Channels: " << numberOfChannelsToAcquire << std::endl;
98 | std::cout << "Data Acquisition Length: " << ACQUISITION_DURATION_S << "s" << std::endl;
99 |
100 | // Allocate memory for the acquisition buffer.
101 | int acquisitionBufferLength = numberOfChannelsToAcquire * FRAME_LENGTH;
102 | acquisitionBuffer = new float[acquisitionBufferLength];
103 |
104 | // Start data acquisition.
105 | //-------------------------------------------------------------------------------------
106 | errorCode = UNICORN_StartAcquisition(deviceHandle, TESTSIGNAL_ENABLED);
107 | HandleError(errorCode);
108 | std::cout << std::endl << "Data acquisition started." << std::endl;
109 |
110 | // Calculate number of get data calls.
111 | int numberOfGetDataCalls = (int) (ACQUISITION_DURATION_S * (UNICORN_SAMPLING_RATE / FRAME_LENGTH));
112 |
113 | // Limit console update rate to max. 25Hz or slower.
114 | int consoleUpdateRate = (int) ((UNICORN_SAMPLING_RATE / FRAME_LENGTH) / 25.0f);
115 | if (consoleUpdateRate == 0)
116 | consoleUpdateRate = 1;
117 |
118 | // Acquisition loop.
119 | //-------------------------------------------------------------------------------------
120 | for (int i = 0; i < numberOfGetDataCalls; i++)
121 | {
122 | // Receives the configured number of samples from the Unicorn device and writes it to the acquisition buffer.
123 | errorCode = UNICORN_GetData(deviceHandle, FRAME_LENGTH, acquisitionBuffer, acquisitionBufferLength * sizeof(float));
124 | HandleError(errorCode);
125 |
126 | // Write data to file.
127 | file.write((const char*) acquisitionBuffer, acquisitionBufferLength * sizeof(float));
128 |
129 | // Update console to indicate that the data acquisition is running.
130 | if (i%consoleUpdateRate == 0)
131 | std::cout << ".";
132 | }
133 |
134 | // Stop data acquisition.
135 | //-------------------------------------------------------------------------------------
136 | errorCode = UNICORN_StopAcquisition(deviceHandle);
137 | HandleError(errorCode);
138 | std::cout << std::endl << "Data acquisition stopped." << std::endl;
139 | }
140 | catch (int errorCode)
141 | {
142 | // Write error code to console if something goes wrong.
143 | PrintErrorMessage(errorCode);
144 | }
145 | catch (...)
146 | {
147 | // Write error code to console if something goes wrong.
148 | std::cout << std::endl << "An unknown error occurred." << std::endl;
149 | }
150 |
151 | // Free memory of the acquisition buffer if necessary.
152 | if (acquisitionBuffer != NULL)
153 | {
154 | delete[] acquisitionBuffer;
155 | acquisitionBuffer = NULL;
156 | }
157 |
158 | // Free memory of the device buffer if necessary.
159 | if (availableDevices != NULL)
160 | {
161 | delete[] availableDevices;
162 | availableDevices = NULL;
163 | }
164 |
165 | // Close file.
166 | file.close();
167 |
168 | // Close device.
169 | //-------------------------------------------------------------------------------------
170 | errorCode = UNICORN_CloseDevice(&deviceHandle);
171 | HandleError(errorCode);
172 | std::cout << "Disconnected from Unicorn." << std::endl;
173 | }
174 | catch (int errorCode)
175 | {
176 | // Write error code to console if something goes wrong.
177 | PrintErrorMessage(errorCode);
178 | }
179 | catch (...)
180 | {
181 | // Write error code to console if something goes wrong.
182 | std::cout << std::endl << "An unknown error occurred." << std::endl;
183 | }
184 |
185 | std::cout << std::endl << "Press ENTER to terminate the application.";
186 | std::cin.clear();
187 | std::cin.ignore();
188 | getchar();
189 | return 0;
190 | }
191 |
192 | // The method throws an exception and forwards the error code if something goes wrong.
193 | //-------------------------------------------------------------------------------------
194 | void HandleError(int errorCode)
195 | {
196 | if (errorCode != UNICORN_ERROR_SUCCESS)
197 | {
198 | throw errorCode;
199 | }
200 | }
201 |
202 | // The method prints an error messag to the console according to the error code.
203 | //-------------------------------------------------------------------------------------
204 | void PrintErrorMessage(int errorCode)
205 | {
206 | std::cout << std::endl << "An error occurred. Error Code: " << errorCode << " - ";
207 | switch (errorCode)
208 | {
209 | case UNICORN_ERROR_INVALID_PARAMETER:
210 | std::cout << "One of the specified parameters does not contain a valid value.";
211 | break;
212 | case UNICORN_ERROR_BLUETOOTH_INIT_FAILED:
213 | std::cout << "The initialization of the Bluetooth adapter failed.";
214 | break;
215 | case UNICORN_ERROR_BLUETOOTH_SOCKET_FAILED:
216 | std::cout << "The operation could not be performed because the Bluetooth socket failed.";
217 | break;
218 | case UNICORN_ERROR_OPEN_DEVICE_FAILED:
219 | std::cout << "The device could not be opened.";
220 | break;
221 | case UNICORN_ERROR_INVALID_CONFIGURATION:
222 | std::cout << "The configuration is invalid.";
223 | break;
224 | case UNICORN_ERROR_BUFFER_OVERFLOW:
225 | std::cout << "The acquisition buffer is full.";
226 | break;
227 | case UNICORN_ERROR_BUFFER_UNDERFLOW:
228 | std::cout << "The acquisition buffer is empty.";
229 | break;
230 | case UNICORN_ERROR_OPERATION_NOT_ALLOWED:
231 | std::cout << "The operation is not allowed.";
232 | break;
233 | case UNICORN_ERROR_INVALID_HANDLE:
234 | std::cout << "The specified connection handle is invalid.";
235 | break;
236 | case UNICORN_ERROR_GENERAL_ERROR:
237 | std::cout << "An unspecified error occurred.";
238 | break;
239 | default:
240 | break;
241 | }
242 | std::cout << std::endl;
243 | }
244 |
245 |
246 |
247 |
--------------------------------------------------------------------------------
/Unicorn Raspberry Pi Zero W C API/UnicornCAPIAcquisitionExample/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | // Include unicorn header-file.
5 | #include "unicorn.h"
6 |
7 | // Specifications for the data acquisition.
8 | //-------------------------------------------------------------------------------------
9 | #define DATA_FILE "data.bin" // The name of the file which is storing acquired data.
10 | #define ACQUISITION_DURATION_S 10.0f // The acquisition duration in seconds.
11 | #define FRAME_LENGTH 1 // The number of samples acquired per get data call.
12 | #define TESTSIGNAL_ENABLED true // Flag to enable or disable testsignal.
13 |
14 | // Function declarations.
15 | //-------------------------------------------------------------------------------------
16 | void HandleError(int errorCode);
17 | void PrintErrorMessage(int errorCode);
18 |
19 | //-------------------------------------------------------------------------------------
20 | // Main. Program entry point.
21 | //-------------------------------------------------------------------------------------
22 | int main(int argc, char** argv)
23 | {
24 | std::cout << "Unicorn Acquisition Example" << std::endl;
25 | std::cout << "---------------------------" << std::endl << std::endl;
26 |
27 | // Variable to store error codes.
28 | int errorCode = UNICORN_ERROR_SUCCESS;
29 |
30 | // Structure that holds the handle for the currecnt session.
31 | UNICORN_HANDLE deviceHandle = 0;
32 |
33 | try
34 | {
35 | // Get available devices.
36 | //-------------------------------------------------------------------------------------
37 |
38 | // Get number of available devices.
39 | unsigned int availableDevicesCount = 0;
40 | errorCode = UNICORN_GetAvailableDevices(NULL, &availableDevicesCount, TRUE);
41 | HandleError(errorCode);
42 |
43 | if (availableDevicesCount < 1)
44 | {
45 | std::cout << "No device available. Please pair with a Unicorn device first.";
46 | errorCode = UNICORN_ERROR_GENERAL_ERROR;
47 | }
48 |
49 | //Get available device serials.
50 | UNICORN_DEVICE_SERIAL *availableDevices = new UNICORN_DEVICE_SERIAL[availableDevicesCount];
51 | errorCode = UNICORN_GetAvailableDevices(availableDevices, &availableDevicesCount, true);
52 | HandleError(errorCode);
53 |
54 | //Print available device serials.
55 | std::cout << "Available devices:" << std::endl;
56 | for (unsigned int i = 0; i> deviceSelection;
65 | if (deviceSelection >= availableDevicesCount || deviceSelection < 0)
66 | errorCode = UNICORN_ERROR_GENERAL_ERROR;
67 |
68 | HandleError(errorCode);
69 |
70 | // Open selected device.
71 | //-------------------------------------------------------------------------------------
72 | std::cout << "Trying to connect to '" << availableDevices[deviceSelection] << "'." << std::endl;
73 | errorCode = UNICORN_OpenDevice(availableDevices[deviceSelection],&deviceHandle);
74 | HandleError(errorCode);
75 |
76 | std::cout << "Connected to '" << availableDevices[deviceSelection] << "'." << std::endl;
77 | std::cout << "Device Handle: " << deviceHandle << std::endl;
78 |
79 | // Create a file to store data.
80 | std::ofstream file(DATA_FILE, std::ios_base::binary);
81 |
82 | float* acquisitionBuffer = NULL;
83 | try
84 | {
85 | // Initialize acquisition members.
86 | //-------------------------------------------------------------------------------------
87 | unsigned int numberOfChannelsToAcquire;
88 | UNICORN_GetNumberOfAcquiredChannels(deviceHandle, &numberOfChannelsToAcquire);
89 |
90 | UNICORN_AMPLIFIER_CONFIGURATION configuration;
91 | errorCode = UNICORN_GetConfiguration(deviceHandle, &configuration);
92 | HandleError(errorCode);
93 |
94 | // Print acquisition configuration
95 | std::cout << std::endl << "Acquisition Configuration:" << std::endl;
96 | std::cout << "Frame Length: " << FRAME_LENGTH << std::endl;
97 | std::cout << "Number Of Acquired Channels: " << numberOfChannelsToAcquire << std::endl;
98 | std::cout << "Data Acquisition Length: " << ACQUISITION_DURATION_S << "s" << std::endl;
99 |
100 | // Allocate memory for the acquisition buffer.
101 | int acquisitionBufferLength = numberOfChannelsToAcquire * FRAME_LENGTH;
102 | acquisitionBuffer = new float[acquisitionBufferLength];
103 |
104 | // Start data acquisition.
105 | //-------------------------------------------------------------------------------------
106 | errorCode = UNICORN_StartAcquisition(deviceHandle, TESTSIGNAL_ENABLED);
107 | HandleError(errorCode);
108 | std::cout << std::endl << "Data acquisition started." << std::endl;
109 |
110 | // Calculate number of get data calls.
111 | int numberOfGetDataCalls = (int) (ACQUISITION_DURATION_S * (UNICORN_SAMPLING_RATE / FRAME_LENGTH));
112 |
113 | // Limit console update rate to max. 25Hz or slower.
114 | int consoleUpdateRate = (int) ((UNICORN_SAMPLING_RATE / FRAME_LENGTH) / 25.0f);
115 | if (consoleUpdateRate == 0)
116 | consoleUpdateRate = 1;
117 |
118 | // Acquisition loop.
119 | //-------------------------------------------------------------------------------------
120 | for (int i = 0; i < numberOfGetDataCalls; i++)
121 | {
122 | // Receives the configured number of samples from the Unicorn device and writes it to the acquisition buffer.
123 | errorCode = UNICORN_GetData(deviceHandle, FRAME_LENGTH, acquisitionBuffer, acquisitionBufferLength * sizeof(float));
124 | HandleError(errorCode);
125 |
126 | // Write data to file.
127 | file.write((const char*) acquisitionBuffer, acquisitionBufferLength * sizeof(float));
128 |
129 | // Update console to indicate that the data acquisition is running.
130 | if (i%consoleUpdateRate == 0)
131 | std::cout << ".";
132 | }
133 |
134 | // Stop data acquisition.
135 | //-------------------------------------------------------------------------------------
136 | errorCode = UNICORN_StopAcquisition(deviceHandle);
137 | HandleError(errorCode);
138 | std::cout << std::endl << "Data acquisition stopped." << std::endl;
139 | }
140 | catch (int errorCode)
141 | {
142 | // Write error code to console if something goes wrong.
143 | PrintErrorMessage(errorCode);
144 | }
145 | catch (...)
146 | {
147 | // Write error code to console if something goes wrong.
148 | std::cout << std::endl << "An unknown error occurred." << std::endl;
149 | }
150 |
151 | // Free memory of the acquisition buffer if necessary.
152 | if (acquisitionBuffer != NULL)
153 | {
154 | delete[] acquisitionBuffer;
155 | acquisitionBuffer = NULL;
156 | }
157 |
158 | // Free memory of the device buffer if necessary.
159 | if (availableDevices != NULL)
160 | {
161 | delete[] availableDevices;
162 | availableDevices = NULL;
163 | }
164 |
165 | // Close file.
166 | file.close();
167 |
168 | // Close device.
169 | //-------------------------------------------------------------------------------------
170 | errorCode = UNICORN_CloseDevice(&deviceHandle);
171 | HandleError(errorCode);
172 | std::cout << "Disconnected from Unicorn." << std::endl;
173 | }
174 | catch (int errorCode)
175 | {
176 | // Write error code to console if something goes wrong.
177 | PrintErrorMessage(errorCode);
178 | }
179 | catch (...)
180 | {
181 | // Write error code to console if something goes wrong.
182 | std::cout << std::endl << "An unknown error occurred." << std::endl;
183 | }
184 |
185 | std::cout << std::endl << "Press ENTER to terminate the application.";
186 | std::cin.clear();
187 | std::cin.ignore();
188 | getchar();
189 | return 0;
190 | }
191 |
192 | // The method throws an exception and forwards the error code if something goes wrong.
193 | //-------------------------------------------------------------------------------------
194 | void HandleError(int errorCode)
195 | {
196 | if (errorCode != UNICORN_ERROR_SUCCESS)
197 | {
198 | throw errorCode;
199 | }
200 | }
201 |
202 | // The method prints an error messag to the console according to the error code.
203 | //-------------------------------------------------------------------------------------
204 | void PrintErrorMessage(int errorCode)
205 | {
206 | std::cout << std::endl << "An error occurred. Error Code: " << errorCode << " - ";
207 | switch (errorCode)
208 | {
209 | case UNICORN_ERROR_INVALID_PARAMETER:
210 | std::cout << "One of the specified parameters does not contain a valid value.";
211 | break;
212 | case UNICORN_ERROR_BLUETOOTH_INIT_FAILED:
213 | std::cout << "The initialization of the Bluetooth adapter failed.";
214 | break;
215 | case UNICORN_ERROR_BLUETOOTH_SOCKET_FAILED:
216 | std::cout << "The operation could not be performed because the Bluetooth socket failed.";
217 | break;
218 | case UNICORN_ERROR_OPEN_DEVICE_FAILED:
219 | std::cout << "The device could not be opened.";
220 | break;
221 | case UNICORN_ERROR_INVALID_CONFIGURATION:
222 | std::cout << "The configuration is invalid.";
223 | break;
224 | case UNICORN_ERROR_BUFFER_OVERFLOW:
225 | std::cout << "The acquisition buffer is full.";
226 | break;
227 | case UNICORN_ERROR_BUFFER_UNDERFLOW:
228 | std::cout << "The acquisition buffer is empty.";
229 | break;
230 | case UNICORN_ERROR_OPERATION_NOT_ALLOWED:
231 | std::cout << "The operation is not allowed.";
232 | break;
233 | case UNICORN_ERROR_INVALID_HANDLE:
234 | std::cout << "The specified connection handle is invalid.";
235 | break;
236 | case UNICORN_ERROR_GENERAL_ERROR:
237 | std::cout << "An unspecified error occurred.";
238 | break;
239 | default:
240 | break;
241 | }
242 | std::cout << std::endl;
243 | }
244 |
245 |
246 |
247 |
--------------------------------------------------------------------------------
/Unicorn Speller/Unity/Assets/UnicornSpellerInterface/Unity.ItemReceiver.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Unity.ItemReceiver
5 |
6 |
7 |
8 |
9 | Represents one item of the speller board.
10 |
11 |
12 |
13 |
14 | Event that will be triggered when a property changes its value.
15 |
16 |
17 |
18 |
19 | Triggers a new -Event.
20 |
21 | exact name of the property that has been changed.
22 |
23 |
24 |
25 | Gets or sets the enabled state of the item.
26 |
27 |
28 |
29 |
30 | Gets or sets the removable state of the item.
31 | If , item can be removed from the board.
32 | If , item cannot be removed from the board.
33 |
34 |
35 |
36 |
37 | Gets or sets if the item should support double security.
38 |
39 |
40 | Double security means, that an item has to be selected twice before it was actually selected.
41 | If , the item will be selected at once after one selection.
42 |
43 |
44 |
45 |
46 | Gets or sets the name of the item.
47 |
48 |
49 |
50 |
51 | Gets or sets the text that should be displayed on the item.
52 |
53 |
54 |
55 |
56 | Gets or sets the text that should be written when according control will be selected by the user.
57 |
58 |
59 |
60 |
61 | Gets or sets the filename to the picture that should be displayed on the speller board when flashing and loads the image.
62 | When the image couldn't be loaded (e.g. because of wrong filename or wrong file format) the value will be set to String.Empty and will return a null reference.
63 |
64 |
65 |
66 |
67 | Gets or sets the filename to the picture that should be displayed on the speller board when not flashing and loads the image.
68 | When the image couldn't be loaded (e.g. because of wrong filename or wrong file format) the value will be set to String.Empty and will return a null reference.
69 |
70 |
71 |
72 |
73 | Gets the image loaded from .
74 | If the image couldn't be loaded, a null reference will be returned.
75 |
76 |
77 |
78 |
79 | Gets the image loaded from .
80 | If the image couldn't be loaded, a null reference will be returned.
81 |
82 |
83 |
84 |
85 | Creates an empty configuration for a cell of the speller board.
86 |
87 |
88 |
89 |
90 | Creates a user defined configuration for a cell.
91 |
92 | Indicates whether the item should be displayed in the board.
93 | Indicates whether the item can be removed from the board.
94 | Indicates whether the item has to be selected twice to be chosen actually.
95 | A name identifying the item.
96 | The text to be displayed on the speller board representing the item.
97 | The text that will be written into the output window if the item is chosen.
98 | The path to the picture to be displayed on the speller board representing the item when it is not flashing.
99 | The path to the picture to be displayed on the speller board representing the item when it is flashing.
100 | If an image specified in or couldn't be loaded (e.g. because of wrong filename or wrong file format), the path value will be set to and the object ( or ) will return a null reference.
101 |
102 |
103 |
104 | Will be executed if this item was selected by the user.
105 | Override this method if an item has to execute specific commands on selection.
106 |
107 | Data needed by the method.
108 |
109 |
110 |
111 | Represents a collection of arguments to pass to the method.
112 |
113 |
114 |
115 |
116 | Gets the textbox containing the output text.
117 |
118 |
119 |
120 |
121 | Creates a new instance of the class.
122 |
123 |
124 |
125 |
126 |
127 | Allows the to deserialize received objects from a class whose interface is not necessarily defined in the original assembly it was created from before sending.
128 |
129 |
130 |
131 |
132 | Receives classified items from the network that intendiX has sent and performs a user-defined custom action being implmented in a derived class.
133 |
134 | This is the base class of all extendiX applications. It provides simple reception of intendiX items from the network. Custom user-defined action can be implemented by overriding the method.
135 |
136 |
137 |
138 | Represents the method that will handle the event.
139 |
140 | The source of the event.
141 | The log message.
142 |
143 |
144 |
145 | Occurs when a new log message of the should be populated.
146 |
147 |
148 |
149 |
150 | Occurs after the receiver has started.
151 |
152 |
153 |
154 |
155 | Occurs after the receiver has stopped.
156 |
157 |
158 |
159 |
160 | Raises the event.
161 |
162 | The log message.
163 |
164 |
165 |
166 | Raises the event.
167 |
168 | The event data.
169 |
170 |
171 |
172 | Raises the event.
173 |
174 | The event data.
175 |
176 |
177 |
178 | Gets a flag indicating if data reception is running currently.
179 |
180 |
181 |
182 |
183 | Wait handle to synchronize asynchronous receiving of items.
184 |
185 |
186 |
187 |
188 | Creates a new instance of the .
189 |
190 |
191 |
192 |
193 | Starts a UDP client receiving objects sent from intendiX in a seperate thread.
194 |
195 | The IP address of the sending intendiX PC.
196 | The number of the port where intendiX sends the data to.
197 | If the specified is invalid.
198 |
199 |
200 |
201 | Stops receiving objects from the network.
202 |
203 |
204 |
205 |
206 | Receives objects sent from intendiX as long as equals true.
207 |
208 | An object containing the IP address and the port at which the data should be received.
209 |
210 |
211 |
212 | Callback of the UDP client on reception of data.
213 | If a has been received, the method will be called.
214 |
215 |
216 |
217 |
218 |
219 | When an item has been received, this method will be executed.
220 |
221 | The received .
222 | Any exception thrown by this method will be caught and a log message will be populated through the event.
223 |
224 |
225 |
226 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/MainUI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using Gtec.Unicorn;
5 | using System.Collections.Generic;
6 | using System.Threading;
7 | using System.Runtime.InteropServices;
8 | using System.Net;
9 | using System.Net.Sockets;
10 |
11 | namespace UnicornUDP
12 | {
13 | public partial class MainUI : Form
14 | {
15 | ///
16 | /// The frame length data is acquired with.
17 | ///
18 | private const int FrameLength = 1;
19 |
20 | ///
21 | /// Available UI states.
22 | ///
23 | private enum DeviceStates { NotConnected, Connecting, Connected, Acquiring };
24 |
25 | ///
26 | /// The current device.
27 | ///
28 | private Unicorn _device = null;
29 |
30 | ///
31 | /// Flag indicating the acquisition state.
32 | ///
33 | private bool _acquisitionRunning = false;
34 |
35 | ///
36 | /// The acquisition thread.
37 | ///
38 | private Thread _acquisitionThread = null;
39 |
40 | ///
41 | /// The udp socket.
42 | ///
43 | private Socket _socket = null;
44 |
45 | ///
46 | /// The ip endpoint.
47 | ///
48 | IPEndPoint _endPoint;
49 |
50 | public MainUI()
51 | {
52 | InitializeComponent();
53 | UpdateUIElements(DeviceStates.NotConnected);
54 | }
55 |
56 | ///
57 | /// Update available devices when UI is shown.
58 | ///
59 | ///
60 | ///
61 | private void MainUI_Shown(object sender, EventArgs e)
62 | {
63 | try
64 | {
65 | GetAvailableDevices();
66 | }
67 | catch (DeviceException ex)
68 | {
69 | ShowErrorBox(ex.Message);
70 | }
71 | catch (Exception ex)
72 | {
73 | ShowErrorBox(String.Format("Could not determine number of available devices. {0}", ex.Message));
74 | }
75 | }
76 |
77 | ///
78 | /// The refresh button click event.
79 | ///
80 | ///
81 | ///
82 | private void btnRefresh_Click(object sender, EventArgs e)
83 | {
84 | try
85 | {
86 | GetAvailableDevices();
87 | }
88 | catch (DeviceException ex)
89 | {
90 | ShowErrorBox(ex.Message);
91 | }
92 | catch (Exception ex)
93 | {
94 | ShowErrorBox(String.Format("Could not determine number of available devices. {0}", ex.Message));
95 | }
96 | }
97 |
98 | ///
99 | /// The open/close button click event.
100 | ///
101 | ///
102 | ///
103 | private void btnOpenClose_Click(object sender, EventArgs e)
104 | {
105 | //if no device opened
106 | if(_device == null)
107 | {
108 | try
109 | {
110 | //connect to currently selected device
111 | string serial = cbDevices.SelectedItem.ToString();
112 |
113 | IPAddress ip = IPAddress.Parse(tbIP.Text);
114 | int port = Int32.Parse(tbPort.Text);
115 |
116 | Thread connectionThread = new Thread(() => ConnectionThread_DoWork(serial, ip, port));
117 | connectionThread.Start();
118 | }
119 | catch (DeviceException ex)
120 | {
121 | _device = null;
122 | UpdateUIElements(DeviceStates.NotConnected);
123 | ShowErrorBox(ex.Message);
124 | }
125 | catch (Exception ex)
126 | {
127 | _device = null;
128 | UpdateUIElements(DeviceStates.NotConnected);
129 | ShowErrorBox(String.Format("Could not open device. {0}", ex.Message));
130 | }
131 | }
132 | //if device opened
133 | else
134 | {
135 | try
136 | {
137 | //stop acquisition thread if running
138 | if (_acquisitionRunning)
139 | {
140 | _acquisitionRunning = false;
141 | _acquisitionThread.Join();
142 | }
143 |
144 | //close device
145 | _device.Dispose();
146 | _device = null;
147 |
148 | UpdateUIElements(DeviceStates.NotConnected);
149 | }
150 | catch
151 | {
152 | _device = null;;
153 | UpdateUIElements(DeviceStates.NotConnected);
154 | }
155 | finally
156 | {
157 | try
158 | {
159 | //close socket connection
160 | _socket.Shutdown(SocketShutdown.Both);
161 | _socket.Close();
162 | }
163 | catch(Exception ex)
164 | {
165 | ShowErrorBox(String.Format("Could not close socket. {0}", ex.Message));
166 | }
167 | }
168 | }
169 | }
170 |
171 | ///
172 | /// The start/stop button click event.
173 | ///
174 | ///
175 | ///
176 | private void btnStartStop_Click(object sender, EventArgs e)
177 | {
178 | if(!_acquisitionRunning)
179 | {
180 | //start acquisition thread
181 | _acquisitionThread = new Thread(() => AcquisitionThread_DoWork());
182 | _acquisitionThread.Start();
183 | }
184 | else
185 | {
186 | //stop acquisition thread
187 | _acquisitionRunning = false;
188 | _acquisitionThread.Join();
189 | UpdateUIElements(DeviceStates.Connected);
190 | }
191 | }
192 |
193 | ///
194 | /// Determines available device serials and writes them to the available devices box.
195 | ///
196 | private void GetAvailableDevices()
197 | {
198 | List devices = new List(Unicorn.GetAvailableDevices(true));
199 | if (devices.Count > 0 && cbDevices != null)
200 | {
201 | cbDevices.DataSource = devices;
202 | }
203 | }
204 |
205 | ///
206 | /// Connects to a Unicorn.
207 | ///
208 | /// The serial of the device to connect.
209 | private void ConnectionThread_DoWork(string serial, IPAddress ip, int port)
210 | {
211 | try
212 | {
213 | UpdateUIElements(DeviceStates.Connecting);
214 |
215 | //Open device
216 | _device = new Unicorn(serial);
217 |
218 | //Initialize upd socket
219 | _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
220 | _endPoint = new IPEndPoint(ip, port);
221 | _socket.Connect(_endPoint);
222 |
223 | UpdateUIElements(DeviceStates.Connected);
224 | }
225 | catch (DeviceException ex)
226 | {
227 | _device = null;
228 | UpdateUIElements(DeviceStates.NotConnected);
229 | ShowErrorBox(ex.Message);
230 | }
231 | catch (Exception ex)
232 | {
233 | _device = null;
234 | UpdateUIElements(DeviceStates.NotConnected);
235 | ShowErrorBox(String.Format("Could not open device. {0}", ex.Message));
236 | }
237 | }
238 |
239 | ///
240 | /// The acquisition thread.
241 | /// Acquires data from the Unicorn and sends it to LSL.
242 | ///
243 | private void AcquisitionThread_DoWork()
244 | {
245 | try
246 | {
247 | //Initialize Unicorn acquisition members
248 | uint numberOfAcquiredChannels = _device.GetNumberOfAcquiredChannels();
249 | byte[] receiveBuffer = new byte[FrameLength * sizeof(float) * numberOfAcquiredChannels];
250 | GCHandle receiveBufferHandle = GCHandle.Alloc(receiveBuffer, GCHandleType.Pinned);
251 |
252 | //Start acquisition
253 | _device.StartAcquisition(false);
254 | _acquisitionRunning = true;
255 | UpdateUIElements(DeviceStates.Acquiring);
256 |
257 | //acquisition loop
258 | while (_acquisitionRunning)
259 | {
260 | //get data
261 | _device.GetData(FrameLength, receiveBufferHandle.AddrOfPinnedObject(), (uint) (receiveBuffer.Length / sizeof(float)));
262 |
263 | // send sample via UDP
264 | _socket.SendTo(receiveBuffer, _endPoint);
265 | }
266 | }
267 | finally
268 | {
269 | try
270 | {
271 | _device.StopAcquisition();
272 | }
273 | catch
274 | {
275 | _device.Dispose();
276 | _device = null;
277 | UpdateUIElements(DeviceStates.NotConnected);
278 | }
279 | }
280 | }
281 |
282 | #region UI Methods...
283 |
284 | private void UpdateUIElements(DeviceStates state)
285 | {
286 | if (this.InvokeRequired)
287 | {
288 | this.Invoke((MethodInvoker) delegate
289 | {
290 | UpdateUIElements(state);
291 | });
292 | }
293 | else
294 | {
295 | if (state == DeviceStates.NotConnected)
296 | {
297 | cbDevices.Enabled = true;
298 | btnRefresh.Enabled = true;
299 | btnOpenClose.Text = "Open";
300 | btnOpenClose.Enabled = true;
301 | btnStartStop.Text = "Start";
302 | btnStartStop.Enabled = false;
303 | tbIP.Enabled = true;
304 | tbPort.Enabled = true;
305 | }
306 | else if (state == DeviceStates.Connecting)
307 | {
308 | cbDevices.Enabled = false;
309 | btnRefresh.Enabled = false;
310 | btnOpenClose.Text = "Open";
311 | btnOpenClose.Enabled = false;
312 | btnStartStop.Text = "Start";
313 | btnStartStop.Enabled = false;
314 | tbIP.Enabled = false;
315 | tbPort.Enabled = false;
316 | }
317 | else if (state == DeviceStates.Connected)
318 | {
319 | cbDevices.Enabled = false;
320 | btnRefresh.Enabled = false;
321 | btnOpenClose.Text = "Close";
322 | btnOpenClose.Enabled = true;
323 | btnStartStop.Text = "Start";
324 | btnStartStop.Enabled = true;
325 | tbIP.Enabled = false;
326 | tbPort.Enabled = false;
327 | }
328 | else if (state == DeviceStates.Acquiring)
329 | {
330 | cbDevices.Enabled = false;
331 | btnRefresh.Enabled = false;
332 | btnOpenClose.Text = "Close";
333 | btnOpenClose.Enabled = true;
334 | btnStartStop.Text = "Stop";
335 | btnStartStop.Enabled = true;
336 | tbIP.Enabled = false;
337 | tbPort.Enabled = false;
338 | }
339 | else
340 | {
341 | cbDevices.Enabled = false;
342 | btnRefresh.Enabled = false;
343 | btnOpenClose.Text = "Open";
344 | btnOpenClose.Enabled = false;
345 | btnStartStop.Text = "Start";
346 | btnStartStop.Enabled = false;
347 | tbIP.Enabled = false;
348 | tbPort.Enabled = false;
349 | }
350 | }
351 | }
352 |
353 | private void ShowErrorBox(string message)
354 | {
355 | if (this.InvokeRequired)
356 | {
357 | this.Invoke((MethodInvoker) delegate
358 | {
359 | ShowErrorBox(message);
360 | });
361 | }
362 | else
363 | {
364 | MessageBox.Show(this, message, "Unicorn UDP - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
365 | }
366 | }
367 |
368 | private void btnRefresh_EnabledChanged(object sender, EventArgs e)
369 | {
370 | if (sender is Button)
371 | ApplyButtonStyle((Button) sender);
372 | }
373 |
374 | private void btnStartStop_EnabledChanged(object sender, EventArgs e)
375 | {
376 | if (sender is Button)
377 | ApplyButtonStyle((Button) sender);
378 | }
379 |
380 | private void btnOpenClose_EnabledChanged(object sender, EventArgs e)
381 | {
382 | if (sender is Button)
383 | ApplyButtonStyle((Button) sender);
384 | }
385 |
386 | private void ApplyButtonStyle(Button btn)
387 | {
388 | btn.ForeColor = Color.White;
389 | if (btn.Enabled)
390 | btn.BackColor = Color.FromArgb(255, 64, 64, 64);
391 | else
392 | btn.BackColor = Color.LightGray;
393 | }
394 |
395 | private void pnlLayout_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
396 | {
397 | if (e.Row == 0)
398 | e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(255, 44, 44, 44)), e.CellBounds);
399 | }
400 |
401 | #endregion
402 | }
403 | }
404 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornUDP/UnicornUDP/MainUI.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace UnicornUDP
2 | {
3 | partial class MainUI
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pnlLayout = new System.Windows.Forms.TableLayoutPanel();
32 | this.gbUnicorn = new System.Windows.Forms.GroupBox();
33 | this.btnStartStop = new System.Windows.Forms.Button();
34 | this.btnOpenClose = new System.Windows.Forms.Button();
35 | this.btnRefresh = new System.Windows.Forms.Button();
36 | this.lblDevices = new System.Windows.Forms.Label();
37 | this.cbDevices = new System.Windows.Forms.ComboBox();
38 | this.groupBox2 = new System.Windows.Forms.GroupBox();
39 | this.tbPort = new System.Windows.Forms.TextBox();
40 | this.lblPort = new System.Windows.Forms.Label();
41 | this.tbIP = new System.Windows.Forms.TextBox();
42 | this.lblIP = new System.Windows.Forms.Label();
43 | this.lblTitle = new System.Windows.Forms.Label();
44 | this.pnlLayout.SuspendLayout();
45 | this.gbUnicorn.SuspendLayout();
46 | this.groupBox2.SuspendLayout();
47 | this.SuspendLayout();
48 | //
49 | // pnlLayout
50 | //
51 | this.pnlLayout.ColumnCount = 1;
52 | this.pnlLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
53 | this.pnlLayout.Controls.Add(this.gbUnicorn, 0, 1);
54 | this.pnlLayout.Controls.Add(this.groupBox2, 0, 2);
55 | this.pnlLayout.Controls.Add(this.lblTitle, 0, 0);
56 | this.pnlLayout.Dock = System.Windows.Forms.DockStyle.Fill;
57 | this.pnlLayout.Location = new System.Drawing.Point(0, 0);
58 | this.pnlLayout.Name = "pnlLayout";
59 | this.pnlLayout.RowCount = 3;
60 | this.pnlLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 80F));
61 | this.pnlLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
62 | this.pnlLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
63 | this.pnlLayout.Size = new System.Drawing.Size(284, 301);
64 | this.pnlLayout.TabIndex = 0;
65 | this.pnlLayout.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.pnlLayout_CellPaint);
66 | //
67 | // gbUnicorn
68 | //
69 | this.gbUnicorn.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
70 | | System.Windows.Forms.AnchorStyles.Left)
71 | | System.Windows.Forms.AnchorStyles.Right)));
72 | this.gbUnicorn.AutoSize = true;
73 | this.gbUnicorn.Controls.Add(this.btnStartStop);
74 | this.gbUnicorn.Controls.Add(this.btnOpenClose);
75 | this.gbUnicorn.Controls.Add(this.btnRefresh);
76 | this.gbUnicorn.Controls.Add(this.lblDevices);
77 | this.gbUnicorn.Controls.Add(this.cbDevices);
78 | this.gbUnicorn.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
79 | this.gbUnicorn.Location = new System.Drawing.Point(10, 90);
80 | this.gbUnicorn.Margin = new System.Windows.Forms.Padding(10);
81 | this.gbUnicorn.Name = "gbUnicorn";
82 | this.gbUnicorn.Size = new System.Drawing.Size(264, 90);
83 | this.gbUnicorn.TabIndex = 0;
84 | this.gbUnicorn.TabStop = false;
85 | this.gbUnicorn.Text = "Unicorn Settings";
86 | //
87 | // btnStartStop
88 | //
89 | this.btnStartStop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
90 | this.btnStartStop.FlatAppearance.BorderSize = 0;
91 | this.btnStartStop.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Silver;
92 | this.btnStartStop.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
93 | this.btnStartStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
94 | this.btnStartStop.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
95 | this.btnStartStop.ForeColor = System.Drawing.Color.White;
96 | this.btnStartStop.Location = new System.Drawing.Point(135, 59);
97 | this.btnStartStop.Name = "btnStartStop";
98 | this.btnStartStop.Size = new System.Drawing.Size(120, 23);
99 | this.btnStartStop.TabIndex = 4;
100 | this.btnStartStop.Text = "Start";
101 | this.btnStartStop.UseVisualStyleBackColor = false;
102 | this.btnStartStop.EnabledChanged += new System.EventHandler(this.btnStartStop_EnabledChanged);
103 | this.btnStartStop.Click += new System.EventHandler(this.btnStartStop_Click);
104 | //
105 | // btnOpenClose
106 | //
107 | this.btnOpenClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
108 | this.btnOpenClose.FlatAppearance.BorderSize = 0;
109 | this.btnOpenClose.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Silver;
110 | this.btnOpenClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
111 | this.btnOpenClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
112 | this.btnOpenClose.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
113 | this.btnOpenClose.ForeColor = System.Drawing.Color.White;
114 | this.btnOpenClose.Location = new System.Drawing.Point(9, 59);
115 | this.btnOpenClose.Name = "btnOpenClose";
116 | this.btnOpenClose.Size = new System.Drawing.Size(120, 23);
117 | this.btnOpenClose.TabIndex = 3;
118 | this.btnOpenClose.Text = "Open";
119 | this.btnOpenClose.UseVisualStyleBackColor = false;
120 | this.btnOpenClose.EnabledChanged += new System.EventHandler(this.btnOpenClose_EnabledChanged);
121 | this.btnOpenClose.Click += new System.EventHandler(this.btnOpenClose_Click);
122 | //
123 | // btnRefresh
124 | //
125 | this.btnRefresh.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
126 | this.btnRefresh.FlatAppearance.BorderSize = 0;
127 | this.btnRefresh.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Silver;
128 | this.btnRefresh.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
129 | this.btnRefresh.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
130 | this.btnRefresh.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
131 | this.btnRefresh.ForeColor = System.Drawing.Color.White;
132 | this.btnRefresh.Location = new System.Drawing.Point(135, 32);
133 | this.btnRefresh.Name = "btnRefresh";
134 | this.btnRefresh.Size = new System.Drawing.Size(120, 23);
135 | this.btnRefresh.TabIndex = 2;
136 | this.btnRefresh.Text = "Refresh";
137 | this.btnRefresh.UseVisualStyleBackColor = false;
138 | this.btnRefresh.EnabledChanged += new System.EventHandler(this.btnRefresh_EnabledChanged);
139 | this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
140 | //
141 | // lblDevices
142 | //
143 | this.lblDevices.AutoSize = true;
144 | this.lblDevices.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
145 | this.lblDevices.Location = new System.Drawing.Point(6, 16);
146 | this.lblDevices.Name = "lblDevices";
147 | this.lblDevices.Size = new System.Drawing.Size(94, 13);
148 | this.lblDevices.TabIndex = 1;
149 | this.lblDevices.Text = "Available Devices";
150 | //
151 | // cbDevices
152 | //
153 | this.cbDevices.Font = new System.Drawing.Font("Segoe UI", 8F);
154 | this.cbDevices.FormattingEnabled = true;
155 | this.cbDevices.Location = new System.Drawing.Point(9, 32);
156 | this.cbDevices.Name = "cbDevices";
157 | this.cbDevices.Size = new System.Drawing.Size(120, 21);
158 | this.cbDevices.TabIndex = 0;
159 | //
160 | // groupBox2
161 | //
162 | this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
163 | | System.Windows.Forms.AnchorStyles.Left)
164 | | System.Windows.Forms.AnchorStyles.Right)));
165 | this.groupBox2.AutoSize = true;
166 | this.groupBox2.Controls.Add(this.tbPort);
167 | this.groupBox2.Controls.Add(this.lblPort);
168 | this.groupBox2.Controls.Add(this.tbIP);
169 | this.groupBox2.Controls.Add(this.lblIP);
170 | this.groupBox2.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
171 | this.groupBox2.Location = new System.Drawing.Point(10, 200);
172 | this.groupBox2.Margin = new System.Windows.Forms.Padding(10);
173 | this.groupBox2.Name = "groupBox2";
174 | this.groupBox2.Size = new System.Drawing.Size(264, 91);
175 | this.groupBox2.TabIndex = 1;
176 | this.groupBox2.TabStop = false;
177 | this.groupBox2.Text = "UDP Settings";
178 | //
179 | // tbPort
180 | //
181 | this.tbPort.Location = new System.Drawing.Point(50, 41);
182 | this.tbPort.Name = "tbPort";
183 | this.tbPort.Size = new System.Drawing.Size(205, 22);
184 | this.tbPort.TabIndex = 3;
185 | this.tbPort.Text = "1000";
186 | //
187 | // lblPort
188 | //
189 | this.lblPort.AutoSize = true;
190 | this.lblPort.Location = new System.Drawing.Point(6, 44);
191 | this.lblPort.Name = "lblPort";
192 | this.lblPort.Size = new System.Drawing.Size(28, 13);
193 | this.lblPort.TabIndex = 2;
194 | this.lblPort.Text = "Port";
195 | //
196 | // tbIP
197 | //
198 | this.tbIP.Location = new System.Drawing.Point(50, 15);
199 | this.tbIP.Name = "tbIP";
200 | this.tbIP.Size = new System.Drawing.Size(205, 22);
201 | this.tbIP.TabIndex = 1;
202 | this.tbIP.Text = "127.0.0.1";
203 | //
204 | // lblIP
205 | //
206 | this.lblIP.AutoSize = true;
207 | this.lblIP.Location = new System.Drawing.Point(6, 18);
208 | this.lblIP.Name = "lblIP";
209 | this.lblIP.Size = new System.Drawing.Size(16, 13);
210 | this.lblIP.TabIndex = 0;
211 | this.lblIP.Text = "IP";
212 | //
213 | // lblTitle
214 | //
215 | this.lblTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
216 | | System.Windows.Forms.AnchorStyles.Left)));
217 | this.lblTitle.AutoSize = true;
218 | this.lblTitle.BackColor = System.Drawing.Color.Transparent;
219 | this.lblTitle.Font = new System.Drawing.Font("Segoe UI", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
220 | this.lblTitle.ForeColor = System.Drawing.Color.White;
221 | this.lblTitle.Location = new System.Drawing.Point(3, 0);
222 | this.lblTitle.Name = "lblTitle";
223 | this.lblTitle.Size = new System.Drawing.Size(170, 80);
224 | this.lblTitle.TabIndex = 2;
225 | this.lblTitle.Text = "Unicorn UDP";
226 | this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
227 | //
228 | // MainUI
229 | //
230 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
231 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
232 | this.BackColor = System.Drawing.Color.White;
233 | this.ClientSize = new System.Drawing.Size(284, 301);
234 | this.Controls.Add(this.pnlLayout);
235 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
236 | this.MaximizeBox = false;
237 | this.MinimumSize = new System.Drawing.Size(300, 340);
238 | this.Name = "MainUI";
239 | this.Text = "Unicorn UDP";
240 | this.Shown += new System.EventHandler(this.MainUI_Shown);
241 | this.pnlLayout.ResumeLayout(false);
242 | this.pnlLayout.PerformLayout();
243 | this.gbUnicorn.ResumeLayout(false);
244 | this.gbUnicorn.PerformLayout();
245 | this.groupBox2.ResumeLayout(false);
246 | this.groupBox2.PerformLayout();
247 | this.ResumeLayout(false);
248 |
249 | }
250 |
251 | #endregion
252 |
253 | private System.Windows.Forms.TableLayoutPanel pnlLayout;
254 | private System.Windows.Forms.GroupBox gbUnicorn;
255 | private System.Windows.Forms.Label lblDevices;
256 | private System.Windows.Forms.ComboBox cbDevices;
257 | private System.Windows.Forms.GroupBox groupBox2;
258 | private System.Windows.Forms.Label lblTitle;
259 | private System.Windows.Forms.Button btnStartStop;
260 | private System.Windows.Forms.Button btnOpenClose;
261 | private System.Windows.Forms.Button btnRefresh;
262 | private System.Windows.Forms.TextBox tbPort;
263 | private System.Windows.Forms.Label lblPort;
264 | private System.Windows.Forms.TextBox tbIP;
265 | private System.Windows.Forms.Label lblIP;
266 | }
267 | }
268 |
269 |
--------------------------------------------------------------------------------
/Unicorn .NET API/UnicornLSL/UnicornLSL/MainUI.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace UnicornLSL
2 | {
3 | partial class MainUI
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pnlLayout = new System.Windows.Forms.TableLayoutPanel();
32 | this.gbUnicorn = new System.Windows.Forms.GroupBox();
33 | this.btnStartStop = new System.Windows.Forms.Button();
34 | this.btnOpenClose = new System.Windows.Forms.Button();
35 | this.btnRefresh = new System.Windows.Forms.Button();
36 | this.lblDevices = new System.Windows.Forms.Label();
37 | this.cbDevices = new System.Windows.Forms.ComboBox();
38 | this.groupBox2 = new System.Windows.Forms.GroupBox();
39 | this.rbSplitSignals = new System.Windows.Forms.RadioButton();
40 | this.rbCombineSigbnals = new System.Windows.Forms.RadioButton();
41 | this.label1 = new System.Windows.Forms.Label();
42 | this.tbStreamName = new System.Windows.Forms.TextBox();
43 | this.lblTitle = new System.Windows.Forms.Label();
44 | this.pnlLayout.SuspendLayout();
45 | this.gbUnicorn.SuspendLayout();
46 | this.groupBox2.SuspendLayout();
47 | this.SuspendLayout();
48 | //
49 | // pnlLayout
50 | //
51 | this.pnlLayout.ColumnCount = 1;
52 | this.pnlLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
53 | this.pnlLayout.Controls.Add(this.gbUnicorn, 0, 1);
54 | this.pnlLayout.Controls.Add(this.groupBox2, 0, 2);
55 | this.pnlLayout.Controls.Add(this.lblTitle, 0, 0);
56 | this.pnlLayout.Dock = System.Windows.Forms.DockStyle.Fill;
57 | this.pnlLayout.Location = new System.Drawing.Point(0, 0);
58 | this.pnlLayout.Name = "pnlLayout";
59 | this.pnlLayout.RowCount = 3;
60 | this.pnlLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 80F));
61 | this.pnlLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
62 | this.pnlLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
63 | this.pnlLayout.Size = new System.Drawing.Size(284, 355);
64 | this.pnlLayout.TabIndex = 0;
65 | this.pnlLayout.CellPaint += new System.Windows.Forms.TableLayoutCellPaintEventHandler(this.pnlLayout_CellPaint);
66 | //
67 | // gbUnicorn
68 | //
69 | this.gbUnicorn.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
70 | | System.Windows.Forms.AnchorStyles.Left)
71 | | System.Windows.Forms.AnchorStyles.Right)));
72 | this.gbUnicorn.AutoSize = true;
73 | this.gbUnicorn.Controls.Add(this.btnStartStop);
74 | this.gbUnicorn.Controls.Add(this.btnOpenClose);
75 | this.gbUnicorn.Controls.Add(this.btnRefresh);
76 | this.gbUnicorn.Controls.Add(this.lblDevices);
77 | this.gbUnicorn.Controls.Add(this.cbDevices);
78 | this.gbUnicorn.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
79 | this.gbUnicorn.Location = new System.Drawing.Point(10, 90);
80 | this.gbUnicorn.Margin = new System.Windows.Forms.Padding(10);
81 | this.gbUnicorn.Name = "gbUnicorn";
82 | this.gbUnicorn.Size = new System.Drawing.Size(264, 117);
83 | this.gbUnicorn.TabIndex = 0;
84 | this.gbUnicorn.TabStop = false;
85 | this.gbUnicorn.Text = "Unicorn Settings";
86 | //
87 | // btnStartStop
88 | //
89 | this.btnStartStop.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
90 | this.btnStartStop.FlatAppearance.BorderSize = 0;
91 | this.btnStartStop.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Silver;
92 | this.btnStartStop.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
93 | this.btnStartStop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
94 | this.btnStartStop.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
95 | this.btnStartStop.ForeColor = System.Drawing.Color.White;
96 | this.btnStartStop.Location = new System.Drawing.Point(135, 59);
97 | this.btnStartStop.Name = "btnStartStop";
98 | this.btnStartStop.Size = new System.Drawing.Size(120, 23);
99 | this.btnStartStop.TabIndex = 4;
100 | this.btnStartStop.Text = "Start";
101 | this.btnStartStop.UseVisualStyleBackColor = false;
102 | this.btnStartStop.EnabledChanged += new System.EventHandler(this.btnStartStop_EnabledChanged);
103 | this.btnStartStop.Click += new System.EventHandler(this.btnStartStop_Click);
104 | //
105 | // btnOpenClose
106 | //
107 | this.btnOpenClose.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
108 | this.btnOpenClose.FlatAppearance.BorderSize = 0;
109 | this.btnOpenClose.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Silver;
110 | this.btnOpenClose.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
111 | this.btnOpenClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
112 | this.btnOpenClose.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
113 | this.btnOpenClose.ForeColor = System.Drawing.Color.White;
114 | this.btnOpenClose.Location = new System.Drawing.Point(9, 59);
115 | this.btnOpenClose.Name = "btnOpenClose";
116 | this.btnOpenClose.Size = new System.Drawing.Size(120, 23);
117 | this.btnOpenClose.TabIndex = 3;
118 | this.btnOpenClose.Text = "Open";
119 | this.btnOpenClose.UseVisualStyleBackColor = false;
120 | this.btnOpenClose.EnabledChanged += new System.EventHandler(this.btnOpenClose_EnabledChanged);
121 | this.btnOpenClose.Click += new System.EventHandler(this.btnOpenClose_Click);
122 | //
123 | // btnRefresh
124 | //
125 | this.btnRefresh.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
126 | this.btnRefresh.FlatAppearance.BorderSize = 0;
127 | this.btnRefresh.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Silver;
128 | this.btnRefresh.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray;
129 | this.btnRefresh.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
130 | this.btnRefresh.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
131 | this.btnRefresh.ForeColor = System.Drawing.Color.White;
132 | this.btnRefresh.Location = new System.Drawing.Point(135, 32);
133 | this.btnRefresh.Name = "btnRefresh";
134 | this.btnRefresh.Size = new System.Drawing.Size(120, 23);
135 | this.btnRefresh.TabIndex = 2;
136 | this.btnRefresh.Text = "Refresh";
137 | this.btnRefresh.UseVisualStyleBackColor = false;
138 | this.btnRefresh.EnabledChanged += new System.EventHandler(this.btnRefresh_EnabledChanged);
139 | this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
140 | //
141 | // lblDevices
142 | //
143 | this.lblDevices.AutoSize = true;
144 | this.lblDevices.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
145 | this.lblDevices.Location = new System.Drawing.Point(6, 16);
146 | this.lblDevices.Name = "lblDevices";
147 | this.lblDevices.Size = new System.Drawing.Size(94, 13);
148 | this.lblDevices.TabIndex = 1;
149 | this.lblDevices.Text = "Available Devices";
150 | //
151 | // cbDevices
152 | //
153 | this.cbDevices.Font = new System.Drawing.Font("Segoe UI", 8F);
154 | this.cbDevices.FormattingEnabled = true;
155 | this.cbDevices.Location = new System.Drawing.Point(9, 32);
156 | this.cbDevices.Name = "cbDevices";
157 | this.cbDevices.Size = new System.Drawing.Size(120, 21);
158 | this.cbDevices.TabIndex = 0;
159 | //
160 | // groupBox2
161 | //
162 | this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
163 | | System.Windows.Forms.AnchorStyles.Left)
164 | | System.Windows.Forms.AnchorStyles.Right)));
165 | this.groupBox2.AutoSize = true;
166 | this.groupBox2.Controls.Add(this.rbSplitSignals);
167 | this.groupBox2.Controls.Add(this.rbCombineSigbnals);
168 | this.groupBox2.Controls.Add(this.label1);
169 | this.groupBox2.Controls.Add(this.tbStreamName);
170 | this.groupBox2.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
171 | this.groupBox2.Location = new System.Drawing.Point(10, 227);
172 | this.groupBox2.Margin = new System.Windows.Forms.Padding(10);
173 | this.groupBox2.Name = "groupBox2";
174 | this.groupBox2.Size = new System.Drawing.Size(264, 118);
175 | this.groupBox2.TabIndex = 1;
176 | this.groupBox2.TabStop = false;
177 | this.groupBox2.Text = "LSL Settings";
178 | //
179 | // rbSplitSignals
180 | //
181 | this.rbSplitSignals.AutoSize = true;
182 | this.rbSplitSignals.Location = new System.Drawing.Point(7, 89);
183 | this.rbSplitSignals.Name = "rbSplitSignals";
184 | this.rbSplitSignals.Size = new System.Drawing.Size(184, 17);
185 | this.rbSplitSignals.TabIndex = 7;
186 | this.rbSplitSignals.TabStop = true;
187 | this.rbSplitSignals.Text = "send each signal in one stream";
188 | this.rbSplitSignals.UseVisualStyleBackColor = true;
189 | //
190 | // rbCombineSigbnals
191 | //
192 | this.rbCombineSigbnals.AutoSize = true;
193 | this.rbCombineSigbnals.Location = new System.Drawing.Point(7, 68);
194 | this.rbCombineSigbnals.Name = "rbCombineSigbnals";
195 | this.rbCombineSigbnals.Size = new System.Drawing.Size(177, 17);
196 | this.rbCombineSigbnals.TabIndex = 6;
197 | this.rbCombineSigbnals.TabStop = true;
198 | this.rbCombineSigbnals.Text = "send all signals in one stream";
199 | this.rbCombineSigbnals.UseVisualStyleBackColor = true;
200 | //
201 | // label1
202 | //
203 | this.label1.AutoSize = true;
204 | this.label1.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
205 | this.label1.Location = new System.Drawing.Point(6, 16);
206 | this.label1.Name = "label1";
207 | this.label1.Size = new System.Drawing.Size(70, 13);
208 | this.label1.TabIndex = 5;
209 | this.label1.Text = "Streamname";
210 | //
211 | // tbStreamName
212 | //
213 | this.tbStreamName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
214 | | System.Windows.Forms.AnchorStyles.Right)));
215 | this.tbStreamName.Font = new System.Drawing.Font("Segoe UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
216 | this.tbStreamName.Location = new System.Drawing.Point(6, 40);
217 | this.tbStreamName.Name = "tbStreamName";
218 | this.tbStreamName.Size = new System.Drawing.Size(246, 22);
219 | this.tbStreamName.TabIndex = 0;
220 | //
221 | // lblTitle
222 | //
223 | this.lblTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
224 | | System.Windows.Forms.AnchorStyles.Left)));
225 | this.lblTitle.AutoSize = true;
226 | this.lblTitle.BackColor = System.Drawing.Color.Transparent;
227 | this.lblTitle.Font = new System.Drawing.Font("Segoe UI", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
228 | this.lblTitle.ForeColor = System.Drawing.Color.White;
229 | this.lblTitle.Location = new System.Drawing.Point(3, 0);
230 | this.lblTitle.Name = "lblTitle";
231 | this.lblTitle.Size = new System.Drawing.Size(157, 80);
232 | this.lblTitle.TabIndex = 2;
233 | this.lblTitle.Text = "Unicorn LSL";
234 | this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
235 | //
236 | // MainUI
237 | //
238 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
239 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
240 | this.BackColor = System.Drawing.Color.White;
241 | this.ClientSize = new System.Drawing.Size(284, 355);
242 | this.Controls.Add(this.pnlLayout);
243 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
244 | this.MaximizeBox = false;
245 | this.MinimumSize = new System.Drawing.Size(300, 340);
246 | this.Name = "MainUI";
247 | this.Text = "Unicorn LSL";
248 | this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainUI_FormClosed);
249 | this.Shown += new System.EventHandler(this.MainUI_Shown);
250 | this.pnlLayout.ResumeLayout(false);
251 | this.pnlLayout.PerformLayout();
252 | this.gbUnicorn.ResumeLayout(false);
253 | this.gbUnicorn.PerformLayout();
254 | this.groupBox2.ResumeLayout(false);
255 | this.groupBox2.PerformLayout();
256 | this.ResumeLayout(false);
257 |
258 | }
259 |
260 | #endregion
261 |
262 | private System.Windows.Forms.TableLayoutPanel pnlLayout;
263 | private System.Windows.Forms.GroupBox gbUnicorn;
264 | private System.Windows.Forms.Label lblDevices;
265 | private System.Windows.Forms.ComboBox cbDevices;
266 | private System.Windows.Forms.GroupBox groupBox2;
267 | private System.Windows.Forms.Label lblTitle;
268 | private System.Windows.Forms.Button btnStartStop;
269 | private System.Windows.Forms.Button btnOpenClose;
270 | private System.Windows.Forms.Button btnRefresh;
271 | private System.Windows.Forms.Label label1;
272 | private System.Windows.Forms.TextBox tbStreamName;
273 | private System.Windows.Forms.RadioButton rbSplitSignals;
274 | private System.Windows.Forms.RadioButton rbCombineSigbnals;
275 | }
276 | }
277 |
278 |
--------------------------------------------------------------------------------
/Unicorn Linux C API/x64/Lib/unicorn.h:
--------------------------------------------------------------------------------
1 | #ifndef UNICORN_H
2 | #define UNICORN_H
3 |
4 | #include
5 | #include
6 |
7 | // The following ifdef block is the standard way of creating macros which make exporting
8 | // from a DLL simpler. All files within this DLL are compiled with the UNICORN_EXPORTS
9 | // symbol defined on the command line. This symbol should not be defined on any project
10 | // that uses this DLL. This way any other project whose source files include this file see
11 | // UNICORN_API functions as being imported from a DLL, whereas this DLL sees symbols
12 | // defined with this macro as being exported.
13 | #if defined _WIN32 || defined __CYGWIN__
14 | #if defined _MSC_VER //Windows && MS Visual C
15 | #ifdef UNICORN_EXPORTS
16 | #define UNICORN_API __declspec(dllexport)
17 | #else
18 | #define UNICORN_API __declspec(dllimport)
19 | #endif
20 | #elif defined __GNUC__ //Windows && GNU C compiler
21 | #ifdef UNICORN_EXPORTS
22 | #define UNICORN_API __attribute__((dllexport))
23 | #else
24 | #define UNICORN_API __attribute__((dllexport))
25 | #endif
26 | #endif
27 | #elif defined __linux__ || __APPLE__
28 | #if __GNUC__ >= 4 //Linux && GNU C compiler version 4.0 and higher
29 | #ifdef UNICORN_EXPORTS
30 | #define UNICORN_API __attribute__((visibility("default")))
31 | #else
32 | #define UNICORN_API __attribute__((visibility("default")))
33 | #endif
34 | #else
35 | #define UNICORN_API
36 | #endif
37 | #endif
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | // ========================================================================================
44 | // Type definitions
45 | // ========================================================================================
46 | #ifndef NULL
47 | //! The null pointer.
48 | #define NULL 0
49 | #endif
50 |
51 | #ifndef BOOL
52 | //! The boolean data type, whose values can be \ref TRUE or \ref FALSE.
53 | typedef int32_t BOOL;
54 | #endif
55 |
56 | #ifndef FALSE
57 | //! The \ref FALSE value for the \ref BOOL type.
58 | #define FALSE 0
59 | #endif
60 |
61 | #ifndef TRUE
62 | //! The \ref TRUE value for the \ref BOOL type.
63 | #define TRUE 1
64 | #endif
65 |
66 | // ========================================================================================
67 | // Error Codes
68 | // ========================================================================================
69 |
70 | //! The operation completed successfully. No error occurred.
71 | #define UNICORN_ERROR_SUCCESS 0
72 |
73 | //! One of the specified parameters does not contain a valid value.
74 | #define UNICORN_ERROR_INVALID_PARAMETER 1
75 |
76 | //! The initialization of the Bluetooth adapter failed.
77 | #define UNICORN_ERROR_BLUETOOTH_INIT_FAILED 2
78 |
79 | //! The operation could not be performed because the Bluetooth socket failed.
80 | #define UNICORN_ERROR_BLUETOOTH_SOCKET_FAILED 3
81 |
82 | //! The device could not be opened.
83 | #define UNICORN_ERROR_OPEN_DEVICE_FAILED 4
84 |
85 | //! The configuration is invalid.
86 | #define UNICORN_ERROR_INVALID_CONFIGURATION 5
87 |
88 | //! The acquisition buffer is full.
89 | #define UNICORN_ERROR_BUFFER_OVERFLOW 6
90 |
91 | //! The acquisition buffer is empty.
92 | #define UNICORN_ERROR_BUFFER_UNDERFLOW 7
93 |
94 | //! The operation is not allowed.
95 | #define UNICORN_ERROR_OPERATION_NOT_ALLOWED 8
96 |
97 | //! The operation could not complete because of connection problems.
98 | #define UNICORN_ERROR_CONNECTION_PROBLEM 9
99 |
100 | //! The device is not supported with this API (\ref UNICORN_SUPPORTED_DEVICE_VERSION)
101 | #define UNICORN_ERROR_UNSUPPORTED_DEVICE 10
102 |
103 | //! The specified connection handle is invalid.
104 | #define UNICORN_ERROR_INVALID_HANDLE 0xFFFFFFFE
105 |
106 | //! An unspecified error occurred.
107 | #define UNICORN_ERROR_GENERAL_ERROR 0xFFFFFFFF
108 |
109 | // ========================================================================================
110 | // Amplifier Properties
111 | // ========================================================================================
112 |
113 | //! The maximum length of the serial number.
114 | #define UNICORN_SERIAL_LENGTH_MAX 14
115 |
116 | //! The maximum length of the device version.
117 | #define UNICORN_DEVICE_VERSION_LENGTH_MAX 6
118 |
119 | //! The maximum length of the firmware version.
120 | #define UNICORN_FIRMWARE_VERSION_LENGTH_MAX 12
121 |
122 | //! The sampling rate of the amplifier.
123 | #define UNICORN_SAMPLING_RATE 250
124 |
125 | //! The maximum string length.
126 | #define UNICORN_STRING_LENGTH_MAX 255
127 |
128 | //! The number of available EEG channels.
129 | #define UNICORN_EEG_CHANNELS_COUNT 8
130 |
131 | //! The number of available accelerometer channels.
132 | #define UNICORN_ACCELEROMETER_CHANNELS_COUNT 3
133 |
134 | //! The number of available gyroscope channels.
135 | #define UNICORN_GYROSCOPE_CHANNELS_COUNT 3
136 |
137 | //! The total number of available channels.
138 | #define UNICORN_TOTAL_CHANNELS_COUNT 17
139 |
140 | //! Index of the first EEG \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
141 | #define UNICORN_EEG_CONFIG_INDEX 0
142 |
143 | //! Index of the first Accelerometer \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
144 | #define UNICORN_ACCELEROMETER_CONFIG_INDEX 8
145 |
146 | //! Index of the first gyroscope \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
147 | #define UNICORN_GYROSCOPE_CONFIG_INDEX 11
148 |
149 | //! Index of the battery level \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
150 | #define UNICORN_BATTERY_CONFIG_INDEX 14
151 |
152 | //! Index of the counter \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
153 | #define UNICORN_COUNTER_CONFIG_INDEX 15
154 |
155 | //! Index of the validation indicator \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
156 | #define UNICORN_VALIDATION_CONFIG_INDEX 16
157 |
158 | //! The number of digital output channels.
159 | #define UNICORN_NUMBER_OF_DIGITAL_OUTPUTS 8
160 |
161 | // ========================================================================================
162 | // Type definitions
163 | // ========================================================================================
164 |
165 | //! Type that holds the handle associated with a device.
166 | typedef uint64_t UNICORN_HANDLE;
167 |
168 | //! Type that holds device serial.
169 | typedef char UNICORN_DEVICE_SERIAL[UNICORN_SERIAL_LENGTH_MAX];
170 |
171 | //! Type that holds device version.
172 | typedef char UNICORN_DEVICE_VERSION[UNICORN_DEVICE_VERSION_LENGTH_MAX];
173 |
174 | //! Type that holds firmware version.
175 | typedef char UNICORN_FIRMWARE_VERSION[UNICORN_FIRMWARE_VERSION_LENGTH_MAX];
176 |
177 | // ========================================================================================
178 | // Structures
179 | // ========================================================================================
180 |
181 | //! The type containing information about a single channel of the amplifier.
182 | typedef struct _UNICORN_AMPLIFIER_CHANNEL
183 | {
184 | //! The channel name.
185 | char name[32];
186 | //! The channel unit.
187 | char unit[32];
188 | //! The channel range as float array. First entry min value; Second max value.
189 | float range[2];
190 | //! The channel enabled flag. \ref TRUE to enable channel; \ref FALSE to disable channel.
191 | BOOL enabled;
192 | } UNICORN_AMPLIFIER_CHANNEL;
193 |
194 | //! The type containing an amplifier configuration.
195 | typedef struct _UNICORN_AMPLIFIER_CONFIGURATION
196 | {
197 |
198 | //! The array holding a configuration for each available \ref UNICORN_AMPLIFIER_CHANNEL.
199 | UNICORN_AMPLIFIER_CHANNEL Channels[UNICORN_TOTAL_CHANNELS_COUNT];
200 |
201 | } UNICORN_AMPLIFIER_CONFIGURATION;
202 |
203 | //! Type that holds additional information about the device.
204 | typedef struct _UNICORN_DEVICE_INFORMATION
205 | {
206 | //! The number of EEG channels.
207 | uint16_t numberOfEegChannels;
208 | //! The serial number of the device.
209 | UNICORN_DEVICE_SERIAL serial;
210 | //! The firmware version number.
211 | UNICORN_FIRMWARE_VERSION firmwareVersion;
212 | //!The device version number.
213 | UNICORN_DEVICE_VERSION deviceVersion;
214 | //! The PCB version number.
215 | uint8_t pcbVersion[4];
216 | //! The enclosure version number.
217 | uint8_t enclosureVersion[4];
218 | } UNICORN_DEVICE_INFORMATION;
219 |
220 |
221 | // ========================================================================================
222 | // API Methods
223 | // ========================================================================================
224 |
225 | //! Returns the current API version.
226 | /*!
227 | \return The current API version.
228 | */
229 | UNICORN_API float UNICORN_GetApiVersion();
230 |
231 | //! Returns the last error text.
232 | /*!
233 | \return The last error text.
234 | */
235 | UNICORN_API const char *UNICORN_GetLastErrorText();
236 |
237 | //! Scans for available devices.
238 | /*!
239 | Discovers available paired or unpaired devices. Estimates the number of available paired or unpaired devices and returns information about discovered devices.
240 |
241 | \param availableDevices A pointer to the beginning of an array of
242 | \ref UNICORN_DEVICE_SERIAL, which receives available
243 | devices when the method returns. If NULL is passed, the
244 | number of available devices is returned only to determine
245 | the amount of memory to allocate.
246 | \param availableDevicesCount A pointer to a variable that receives the number of
247 | available devices.
248 | \param rescan A flag determining whether a full device scan should be performed or not.
249 | A quick-scan returns the result of the last scan an is faster than a rescan.
250 | A rescan lasts about 10 seconds.
251 | \ref TRUE to perform a rescan.
252 | \ref FALSE to perform a quick-scan.
253 |
254 | \return An error code is returned as integer if scanning for available devices fails.
255 | */
256 | UNICORN_API int UNICORN_GetAvailableDevices(UNICORN_DEVICE_SERIAL* availableDevices, uint32_t* availableDevicesCount, BOOL rescan);
257 |
258 | //! Opens a device.
259 | /*!
260 | Connects to a certain Unicorn device and assigns a Unicorn handle if the connection attempt succeeded.
261 |
262 | \param serial The serial number of the device to connect to.
263 | \param hDevice A pointer to a \ref UNICORN_HANDLE that receives the handle associated with the current session if the device could be opened successfully.
264 |
265 | \return An error code is returned as integer if the device could not be opened.
266 | */
267 | UNICORN_API int UNICORN_OpenDevice(const char* serial, UNICORN_HANDLE *hDevice);
268 |
269 | //! Closes a device.
270 | /*!
271 | Disconnects from a device by a given session handle.
272 |
273 | \param hDevice A pointer to the handle associated with the session.
274 |
275 | \return An error code is returned as integer if the disconnection attempt fails.
276 | */
277 | UNICORN_API int UNICORN_CloseDevice(UNICORN_HANDLE *hDevice);
278 |
279 | //! Initiates a data acquisition in testsignal or measurement mode.
280 | /*!
281 | Starts data acquisition in test signal or measurement mode.
282 |
283 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
284 | \param testSignalEnabled Enables or disables the test signal mode. \ref TRUE to start the data
285 | acquisition in test signal mode; \ref FALSE to start the data
286 | acquisition in measurement mode.
287 |
288 | \return An error code is returned as integer if the data acquisition could not be started.
289 | */
290 | UNICORN_API int UNICORN_StartAcquisition(UNICORN_HANDLE hDevice, BOOL testSignalEnabled);
291 |
292 | //! Terminates a running data acquisition.
293 | /*!
294 | Stops a currently running data acquisition session.
295 |
296 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
297 |
298 | \return An error code is returned as integer if the acquisition could not be terminated.
299 | */
300 | UNICORN_API int UNICORN_StopAcquisition(UNICORN_HANDLE hDevice);
301 |
302 | //! Sets an amplifier configuration.
303 | /*!
304 | Sets an amplifier configuration.
305 |
306 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
307 | \param configuration A pointer to \ref UNICORN_AMPLIFIER_CONFIGURATION to set.
308 |
309 | \return An error code is returned as integer if configuration is invalid or could not be set.
310 | */
311 | UNICORN_API int UNICORN_SetConfiguration(UNICORN_HANDLE hDevice, UNICORN_AMPLIFIER_CONFIGURATION *configuration);
312 |
313 | //! Gets the amplifier configuration.
314 | /*!
315 | Retrieves the current amplifier configuration from the device as \ref UNICORN_AMPLIFIER_CONFIGURATION.
316 |
317 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
318 | \param configuration A pointer to a \ref UNICORN_AMPLIFIER_CONFIGURATION which stores the configuration of the amplifier.
319 |
320 | \return An error code is returned as integer if configuration could not be read.
321 | */
322 | UNICORN_API int UNICORN_GetConfiguration(UNICORN_HANDLE hDevice, UNICORN_AMPLIFIER_CONFIGURATION* configuration);
323 |
324 | //! Reads specific number of scans to a specified destination buffer with known length.
325 | /*!
326 | Reads a specific number of scans into the specified destination buffer of known length. Checks
327 | whether the destination buffer is big enough to hold the requested number of scans.
328 |
329 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
330 | \param numberOfScans The number of scans to read. The number of scans must be
331 | greater than zero. A scan consists of one 32-bit floating point
332 | number for each currently acquired channel.
333 | \param destinationBuffer A pointer to the destination buffer that receives the acquired data. The destination buffer must
334 | provide enough memory to hold the requested number of scans multiplied by the number of acquired channels.
335 | Call \ref UNICORN_GetNumberOfAcquiredChannels to determine the number of acquired channels.
336 | Call \ref UNICORN_GetChannelIndex to determine the index of a channel within a scan.
337 | Example:
338 | The sample of the battery level channel in the n-th scan is:
339 | n* \ref UNICORN_GetNumberOfAcquiredChannels()+ \ref UNICORN_GetChannelIndex(\93Battery Level\94)
340 | \param destinationBufferLength Number of floats fitting into destination buffer.
341 |
342 | \return An error code is returned as integer if data could not be read.
343 | */
344 | UNICORN_API int UNICORN_GetData(UNICORN_HANDLE hDevice, uint32_t numberOfScans, float* destinationBuffer, uint32_t destinationBufferLength);
345 |
346 | //! Determines number of acquired channels.
347 | /*!
348 | Uses the currently set \ref UNICORN_AMPLIFIER_CONFIGURATION to get the number of acquired channels.
349 |
350 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
351 | \param numberOfAcquiredChannels A pointer to a varialbe that receives the number of acquired channels.
352 |
353 | \return An error code is returned as integer if the number of acquired channels could not be determined.
354 | */
355 | UNICORN_API int UNICORN_GetNumberOfAcquiredChannels(UNICORN_HANDLE hDevice, uint32_t* numberOfAcquiredChannels);
356 |
357 | //! Determines the index of the requested channel in an acquired scan.
358 | /*!
359 | Uses the currently set \ref UNICORN_AMPLIFIER_CONFIGURATION to get the index of the requested channel within an acquired scan.
360 |
361 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
362 | \param name The name of the requested channel.
363 | \param channelIndex A pointer to a variable that receives the channel index.
364 |
365 | The default names are:
366 | EEG 1|2|3|4|5|6|7|8
367 | Accelerometer X|Y|Z
368 | Gyroscope X|Y|Z
369 | Counter
370 | Battery Level
371 | Validation Indicator
372 |
373 | \return An error code is returned as integer if the index could not be determined.
374 | */
375 | UNICORN_API int UNICORN_GetChannelIndex(UNICORN_HANDLE hDevice, const char *name, uint32_t* channelIndex);
376 |
377 | //! Reads the device information.
378 | /*!
379 | Reads the device information by a given \ref UNICORN_HANDLE.
380 |
381 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
382 | \param deviceInformation A pointer to a \ref UNICORN_DEVICE_INFORMATION that receives information about the device.
383 |
384 | \return An error code is returned as integer if the device information could not be read.
385 | */
386 | UNICORN_API int UNICORN_GetDeviceInformation(UNICORN_HANDLE hDevice, UNICORN_DEVICE_INFORMATION* deviceInformation);
387 |
388 | //! Sets the digital outputs.
389 | /*!
390 | Sets the digital outputs to high or low.
391 |
392 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
393 | \param digitalOutputs A pointer to a variable that receives the states of the digital
394 | output channels. Each bit represents one digital output channel.
395 | If a bit is set, the corresponding digital output channel\92s value is
396 | set to high. If a bit is cleared, the corresponding digital output
397 | channel\92s value is set to low.
398 | Examples (the binary representation of each decimal value is
399 | shown in parentheses):
400 | 0 (0b00000000) -> all digital outputs set to low.
401 | 170 (0b10101010) -> digital outputs 2,4,6,8 are set to high.
402 | 255 (0b11111111) -> all digital outputs set to high.
403 |
404 | \return An error code is returned as integer if the status of the digital output pin could not be set.
405 | */
406 | UNICORN_API int UNICORN_SetDigitalOutputs(UNICORN_HANDLE hDevice, uint8_t digitalOutputs);
407 |
408 | //! Reads the digital output states.
409 | /*!
410 | Reads the digital output states.
411 |
412 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
413 | \param digitalOutputs The state of the digital output channels to set in bits. Each bit
414 | represents one digital output channel. Set a bit to set the
415 | corresponding digital output channel\92s value to high. Clear a bit to
416 | set the corresponding digital output channel\92s value to low.
417 | Examples (the binary representation of each decimal value is
418 | shown in parentheses):
419 | 0 (0b00000000) -> all digital outputs set to low.
420 | 170 (0b10101010) -> digital outputs 2,4,6,8 are set to high.
421 | 255 (0b11111111) -> all digital outputs set to high.
422 |
423 | \return An error code is returned as integer if the status of the digital output pin could not be read.
424 | */
425 | UNICORN_API int UNICORN_GetDigitalOutputs(UNICORN_HANDLE hDevice, uint8_t* digitalOutputs);
426 | #ifdef __cplusplus
427 | }
428 | #endif
429 |
430 | #endif //UNICORN_H
431 |
--------------------------------------------------------------------------------
/Unicorn Raspberry Pi Zero W C API/Lib/unicorn.h:
--------------------------------------------------------------------------------
1 | #ifndef UNICORN_H
2 | #define UNICORN_H
3 |
4 | #include
5 | #include
6 |
7 | // The following ifdef block is the standard way of creating macros which make exporting
8 | // from a DLL simpler. All files within this DLL are compiled with the UNICORN_EXPORTS
9 | // symbol defined on the command line. This symbol should not be defined on any project
10 | // that uses this DLL. This way any other project whose source files include this file see
11 | // UNICORN_API functions as being imported from a DLL, whereas this DLL sees symbols
12 | // defined with this macro as being exported.
13 | #if defined _WIN32 || defined __CYGWIN__
14 | #if defined _MSC_VER //Windows && MS Visual C
15 | #ifdef UNICORN_EXPORTS
16 | #define UNICORN_API __declspec(dllexport)
17 | #else
18 | #define UNICORN_API __declspec(dllimport)
19 | #endif
20 | #elif defined __GNUC__ //Windows && GNU C compiler
21 | #ifdef UNICORN_EXPORTS
22 | #define UNICORN_API __attribute__((dllexport))
23 | #else
24 | #define UNICORN_API __attribute__((dllexport))
25 | #endif
26 | #endif
27 | #elif defined __linux__ || __APPLE__
28 | #if __GNUC__ >= 4 //Linux && GNU C compiler version 4.0 and higher
29 | #ifdef UNICORN_EXPORTS
30 | #define UNICORN_API __attribute__((visibility("default")))
31 | #else
32 | #define UNICORN_API __attribute__((visibility("default")))
33 | #endif
34 | #else
35 | #define UNICORN_API
36 | #endif
37 | #endif
38 |
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | // ========================================================================================
44 | // Type definitions
45 | // ========================================================================================
46 | #ifndef NULL
47 | //! The null pointer.
48 | #define NULL 0
49 | #endif
50 |
51 | #ifndef BOOL
52 | //! The boolean data type, whose values can be \ref TRUE or \ref FALSE.
53 | typedef int32_t BOOL;
54 | #endif
55 |
56 | #ifndef FALSE
57 | //! The \ref FALSE value for the \ref BOOL type.
58 | #define FALSE 0
59 | #endif
60 |
61 | #ifndef TRUE
62 | //! The \ref TRUE value for the \ref BOOL type.
63 | #define TRUE 1
64 | #endif
65 |
66 | // ========================================================================================
67 | // Error Codes
68 | // ========================================================================================
69 |
70 | //! The operation completed successfully. No error occurred.
71 | #define UNICORN_ERROR_SUCCESS 0
72 |
73 | //! One of the specified parameters does not contain a valid value.
74 | #define UNICORN_ERROR_INVALID_PARAMETER 1
75 |
76 | //! The initialization of the Bluetooth adapter failed.
77 | #define UNICORN_ERROR_BLUETOOTH_INIT_FAILED 2
78 |
79 | //! The operation could not be performed because the Bluetooth socket failed.
80 | #define UNICORN_ERROR_BLUETOOTH_SOCKET_FAILED 3
81 |
82 | //! The device could not be opened.
83 | #define UNICORN_ERROR_OPEN_DEVICE_FAILED 4
84 |
85 | //! The configuration is invalid.
86 | #define UNICORN_ERROR_INVALID_CONFIGURATION 5
87 |
88 | //! The acquisition buffer is full.
89 | #define UNICORN_ERROR_BUFFER_OVERFLOW 6
90 |
91 | //! The acquisition buffer is empty.
92 | #define UNICORN_ERROR_BUFFER_UNDERFLOW 7
93 |
94 | //! The operation is not allowed.
95 | #define UNICORN_ERROR_OPERATION_NOT_ALLOWED 8
96 |
97 | //! The operation could not complete because of connection problems.
98 | #define UNICORN_ERROR_CONNECTION_PROBLEM 9
99 |
100 | //! The device is not supported with this API (\ref UNICORN_SUPPORTED_DEVICE_VERSION)
101 | #define UNICORN_ERROR_UNSUPPORTED_DEVICE 10
102 |
103 | //! The specified connection handle is invalid.
104 | #define UNICORN_ERROR_INVALID_HANDLE 0xFFFFFFFE
105 |
106 | //! An unspecified error occurred.
107 | #define UNICORN_ERROR_GENERAL_ERROR 0xFFFFFFFF
108 |
109 | // ========================================================================================
110 | // Amplifier Properties
111 | // ========================================================================================
112 |
113 | //! The maximum length of the serial number.
114 | #define UNICORN_SERIAL_LENGTH_MAX 14
115 |
116 | //! The maximum length of the device version.
117 | #define UNICORN_DEVICE_VERSION_LENGTH_MAX 6
118 |
119 | //! The maximum length of the firmware version.
120 | #define UNICORN_FIRMWARE_VERSION_LENGTH_MAX 12
121 |
122 | //! The sampling rate of the amplifier.
123 | #define UNICORN_SAMPLING_RATE 250
124 |
125 | //! The maximum string length.
126 | #define UNICORN_STRING_LENGTH_MAX 255
127 |
128 | //! The number of available EEG channels.
129 | #define UNICORN_EEG_CHANNELS_COUNT 8
130 |
131 | //! The number of available accelerometer channels.
132 | #define UNICORN_ACCELEROMETER_CHANNELS_COUNT 3
133 |
134 | //! The number of available gyroscope channels.
135 | #define UNICORN_GYROSCOPE_CHANNELS_COUNT 3
136 |
137 | //! The total number of available channels.
138 | #define UNICORN_TOTAL_CHANNELS_COUNT 17
139 |
140 | //! Index of the first EEG \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
141 | #define UNICORN_EEG_CONFIG_INDEX 0
142 |
143 | //! Index of the first Accelerometer \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
144 | #define UNICORN_ACCELEROMETER_CONFIG_INDEX 8
145 |
146 | //! Index of the first gyroscope \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
147 | #define UNICORN_GYROSCOPE_CONFIG_INDEX 11
148 |
149 | //! Index of the battery level \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
150 | #define UNICORN_BATTERY_CONFIG_INDEX 14
151 |
152 | //! Index of the counter \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
153 | #define UNICORN_COUNTER_CONFIG_INDEX 15
154 |
155 | //! Index of the validation indicator \ref UNICORN_AMPLIFIER_CHANNEL in the \ref UNICORN_AMPLIFIER_CONFIGURATION Channels array.
156 | #define UNICORN_VALIDATION_CONFIG_INDEX 16
157 |
158 | //! The number of digital output channels.
159 | #define UNICORN_NUMBER_OF_DIGITAL_OUTPUTS 8
160 |
161 | // ========================================================================================
162 | // Type definitions
163 | // ========================================================================================
164 |
165 | //! Type that holds the handle associated with a device.
166 | typedef uint64_t UNICORN_HANDLE;
167 |
168 | //! Type that holds device serial.
169 | typedef char UNICORN_DEVICE_SERIAL[UNICORN_SERIAL_LENGTH_MAX];
170 |
171 | //! Type that holds device version.
172 | typedef char UNICORN_DEVICE_VERSION[UNICORN_DEVICE_VERSION_LENGTH_MAX];
173 |
174 | //! Type that holds firmware version.
175 | typedef char UNICORN_FIRMWARE_VERSION[UNICORN_FIRMWARE_VERSION_LENGTH_MAX];
176 |
177 | // ========================================================================================
178 | // Structures
179 | // ========================================================================================
180 |
181 | //! The type containing information about a single channel of the amplifier.
182 | typedef struct _UNICORN_AMPLIFIER_CHANNEL
183 | {
184 | //! The channel name.
185 | char name[32];
186 | //! The channel unit.
187 | char unit[32];
188 | //! The channel range as float array. First entry min value; Second max value.
189 | float range[2];
190 | //! The channel enabled flag. \ref TRUE to enable channel; \ref FALSE to disable channel.
191 | BOOL enabled;
192 | } UNICORN_AMPLIFIER_CHANNEL;
193 |
194 | //! The type containing an amplifier configuration.
195 | typedef struct _UNICORN_AMPLIFIER_CONFIGURATION
196 | {
197 |
198 | //! The array holding a configuration for each available \ref UNICORN_AMPLIFIER_CHANNEL.
199 | UNICORN_AMPLIFIER_CHANNEL Channels[UNICORN_TOTAL_CHANNELS_COUNT];
200 |
201 | } UNICORN_AMPLIFIER_CONFIGURATION;
202 |
203 | //! Type that holds additional information about the device.
204 | typedef struct _UNICORN_DEVICE_INFORMATION
205 | {
206 | //! The number of EEG channels.
207 | uint16_t numberOfEegChannels;
208 | //! The serial number of the device.
209 | UNICORN_DEVICE_SERIAL serial;
210 | //! The firmware version number.
211 | UNICORN_FIRMWARE_VERSION firmwareVersion;
212 | //!The device version number.
213 | UNICORN_DEVICE_VERSION deviceVersion;
214 | //! The PCB version number.
215 | uint8_t pcbVersion[4];
216 | //! The enclosure version number.
217 | uint8_t enclosureVersion[4];
218 | } UNICORN_DEVICE_INFORMATION;
219 |
220 |
221 | // ========================================================================================
222 | // API Methods
223 | // ========================================================================================
224 |
225 | //! Returns the current API version.
226 | /*!
227 | \return The current API version.
228 | */
229 | UNICORN_API float UNICORN_GetApiVersion();
230 |
231 | //! Returns the last error text.
232 | /*!
233 | \return The last error text.
234 | */
235 | UNICORN_API const char *UNICORN_GetLastErrorText();
236 |
237 | //! Scans for available devices.
238 | /*!
239 | Discovers available paired or unpaired devices. Estimates the number of available paired or unpaired devices and returns information about discovered devices.
240 |
241 | \param availableDevices A pointer to the beginning of an array of
242 | \ref UNICORN_DEVICE_SERIAL, which receives available
243 | devices when the method returns. If NULL is passed, the
244 | number of available devices is returned only to determine
245 | the amount of memory to allocate.
246 | \param availableDevicesCount A pointer to a variable that receives the number of
247 | available devices.
248 | \param rescan A flag determining whether a full device scan should be performed or not.
249 | A quick-scan returns the result of the last scan an is faster than a rescan.
250 | A rescan lasts about 10 seconds.
251 | \ref TRUE to perform a rescan.
252 | \ref FALSE to perform a quick-scan.
253 |
254 | \return An error code is returned as integer if scanning for available devices fails.
255 | */
256 | UNICORN_API int UNICORN_GetAvailableDevices(UNICORN_DEVICE_SERIAL* availableDevices, uint32_t* availableDevicesCount, BOOL rescan);
257 |
258 | //! Opens a device.
259 | /*!
260 | Connects to a certain Unicorn device and assigns a Unicorn handle if the connection attempt succeeded.
261 |
262 | \param serial The serial number of the device to connect to.
263 | \param hDevice A pointer to a \ref UNICORN_HANDLE that receives the handle associated with the current session if the device could be opened successfully.
264 |
265 | \return An error code is returned as integer if the device could not be opened.
266 | */
267 | UNICORN_API int UNICORN_OpenDevice(const char* serial, UNICORN_HANDLE *hDevice);
268 |
269 | //! Closes a device.
270 | /*!
271 | Disconnects from a device by a given session handle.
272 |
273 | \param hDevice A pointer to the handle associated with the session.
274 |
275 | \return An error code is returned as integer if the disconnection attempt fails.
276 | */
277 | UNICORN_API int UNICORN_CloseDevice(UNICORN_HANDLE *hDevice);
278 |
279 | //! Initiates a data acquisition in testsignal or measurement mode.
280 | /*!
281 | Starts data acquisition in test signal or measurement mode.
282 |
283 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
284 | \param testSignalEnabled Enables or disables the test signal mode. \ref TRUE to start the data
285 | acquisition in test signal mode; \ref FALSE to start the data
286 | acquisition in measurement mode.
287 |
288 | \return An error code is returned as integer if the data acquisition could not be started.
289 | */
290 | UNICORN_API int UNICORN_StartAcquisition(UNICORN_HANDLE hDevice, BOOL testSignalEnabled);
291 |
292 | //! Terminates a running data acquisition.
293 | /*!
294 | Stops a currently running data acquisition session.
295 |
296 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
297 |
298 | \return An error code is returned as integer if the acquisition could not be terminated.
299 | */
300 | UNICORN_API int UNICORN_StopAcquisition(UNICORN_HANDLE hDevice);
301 |
302 | //! Sets an amplifier configuration.
303 | /*!
304 | Sets an amplifier configuration.
305 |
306 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
307 | \param configuration A pointer to \ref UNICORN_AMPLIFIER_CONFIGURATION to set.
308 |
309 | \return An error code is returned as integer if configuration is invalid or could not be set.
310 | */
311 | UNICORN_API int UNICORN_SetConfiguration(UNICORN_HANDLE hDevice, UNICORN_AMPLIFIER_CONFIGURATION *configuration);
312 |
313 | //! Gets the amplifier configuration.
314 | /*!
315 | Retrieves the current amplifier configuration from the device as \ref UNICORN_AMPLIFIER_CONFIGURATION.
316 |
317 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
318 | \param configuration A pointer to a \ref UNICORN_AMPLIFIER_CONFIGURATION which stores the configuration of the amplifier.
319 |
320 | \return An error code is returned as integer if configuration could not be read.
321 | */
322 | UNICORN_API int UNICORN_GetConfiguration(UNICORN_HANDLE hDevice, UNICORN_AMPLIFIER_CONFIGURATION* configuration);
323 |
324 | //! Reads specific number of scans to a specified destination buffer with known length.
325 | /*!
326 | Reads a specific number of scans into the specified destination buffer of known length. Checks
327 | whether the destination buffer is big enough to hold the requested number of scans.
328 |
329 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
330 | \param numberOfScans The number of scans to read. The number of scans must be
331 | greater than zero. A scan consists of one 32-bit floating point
332 | number for each currently acquired channel.
333 | \param destinationBuffer A pointer to the destination buffer that receives the acquired data. The destination buffer must
334 | provide enough memory to hold the requested number of scans multiplied by the number of acquired channels.
335 | Call \ref UNICORN_GetNumberOfAcquiredChannels to determine the number of acquired channels.
336 | Call \ref UNICORN_GetChannelIndex to determine the index of a channel within a scan.
337 | Example:
338 | The sample of the battery level channel in the n-th scan is:
339 | n* \ref UNICORN_GetNumberOfAcquiredChannels()+ \ref UNICORN_GetChannelIndex(\93Battery Level\94)
340 | \param destinationBufferLength Number of floats fitting into destination buffer.
341 |
342 | \return An error code is returned as integer if data could not be read.
343 | */
344 | UNICORN_API int UNICORN_GetData(UNICORN_HANDLE hDevice, uint32_t numberOfScans, float* destinationBuffer, uint32_t destinationBufferLength);
345 |
346 | //! Determines number of acquired channels.
347 | /*!
348 | Uses the currently set \ref UNICORN_AMPLIFIER_CONFIGURATION to get the number of acquired channels.
349 |
350 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
351 | \param numberOfAcquiredChannels A pointer to a varialbe that receives the number of acquired channels.
352 |
353 | \return An error code is returned as integer if the number of acquired channels could not be determined.
354 | */
355 | UNICORN_API int UNICORN_GetNumberOfAcquiredChannels(UNICORN_HANDLE hDevice, uint32_t* numberOfAcquiredChannels);
356 |
357 | //! Determines the index of the requested channel in an acquired scan.
358 | /*!
359 | Uses the currently set \ref UNICORN_AMPLIFIER_CONFIGURATION to get the index of the requested channel within an acquired scan.
360 |
361 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
362 | \param name The name of the requested channel.
363 | \param channelIndex A pointer to a variable that receives the channel index.
364 |
365 | The default names are:
366 | EEG 1|2|3|4|5|6|7|8
367 | Accelerometer X|Y|Z
368 | Gyroscope X|Y|Z
369 | Counter
370 | Battery Level
371 | Validation Indicator
372 |
373 | \return An error code is returned as integer if the index could not be determined.
374 | */
375 | UNICORN_API int UNICORN_GetChannelIndex(UNICORN_HANDLE hDevice, const char *name, uint32_t* channelIndex);
376 |
377 | //! Reads the device information.
378 | /*!
379 | Reads the device information by a given \ref UNICORN_HANDLE.
380 |
381 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
382 | \param deviceInformation A pointer to a \ref UNICORN_DEVICE_INFORMATION that receives information about the device.
383 |
384 | \return An error code is returned as integer if the device information could not be read.
385 | */
386 | UNICORN_API int UNICORN_GetDeviceInformation(UNICORN_HANDLE hDevice, UNICORN_DEVICE_INFORMATION* deviceInformation);
387 |
388 | //! Sets the digital outputs.
389 | /*!
390 | Sets the digital outputs to high or low.
391 |
392 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
393 | \param digitalOutputs A pointer to a variable that receives the states of the digital
394 | output channels. Each bit represents one digital output channel.
395 | If a bit is set, the corresponding digital output channel\92s value is
396 | set to high. If a bit is cleared, the corresponding digital output
397 | channel\92s value is set to low.
398 | Examples (the binary representation of each decimal value is
399 | shown in parentheses):
400 | 0 (0b00000000) -> all digital outputs set to low.
401 | 170 (0b10101010) -> digital outputs 2,4,6,8 are set to high.
402 | 255 (0b11111111) -> all digital outputs set to high.
403 |
404 | \return An error code is returned as integer if the status of the digital output pin could not be set.
405 | */
406 | UNICORN_API int UNICORN_SetDigitalOutputs(UNICORN_HANDLE hDevice, uint8_t digitalOutputs);
407 |
408 | //! Reads the digital output states.
409 | /*!
410 | Reads the digital output states.
411 |
412 | \param hDevice The \ref UNICORN_HANDLE associated with the session.
413 | \param digitalOutputs The state of the digital output channels to set in bits. Each bit
414 | represents one digital output channel. Set a bit to set the
415 | corresponding digital output channel\92s value to high. Clear a bit to
416 | set the corresponding digital output channel\92s value to low.
417 | Examples (the binary representation of each decimal value is
418 | shown in parentheses):
419 | 0 (0b00000000) -> all digital outputs set to low.
420 | 170 (0b10101010) -> digital outputs 2,4,6,8 are set to high.
421 | 255 (0b11111111) -> all digital outputs set to high.
422 |
423 | \return An error code is returned as integer if the status of the digital output pin could not be read.
424 | */
425 | UNICORN_API int UNICORN_GetDigitalOutputs(UNICORN_HANDLE hDevice, uint8_t* digitalOutputs);
426 | #ifdef __cplusplus
427 | }
428 | #endif
429 |
430 | #endif //UNICORN_H
431 |
--------------------------------------------------------------------------------