Skip to content

Commit ae6e47e

Browse files
committed
Merge remote-tracking branch 'openbci/master'
2 parents fa668ff + 114b116 commit ae6e47e

File tree

7 files changed

+99
-94
lines changed

7 files changed

+99
-94
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ set (CMAKE_CXX_STANDARD 11)
55
set (CMAKE_VERBOSE_MAKEFILE ON)
66
set (BRAINFLOW_VERSION 2.1.0)
77

8+
# dont export sumbols on unix by default
9+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
10+
set(CMAKE_C_VISIBILITY_PRESET hidden)
11+
812
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
913

1014
macro (configure_msvc_runtime)

docs/BrainFlowDev.rst

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CI and tests
2626

2727
If you want to commit to core module of brainflow project please check that all tests are passed, you can enable `Travis CI <https://travis-ci.com/>`_ and `AppVeyour <https://ci.appveyor.com>`_ for your fork of BrainFlow to run tests automatically, or check CI status directly in your PR.
2828

29-
Also you can run integration tests manually for any board even if you dont have real hardware, check :ref:`emulator-label` page for details.
29+
Also you can run integration tests manually for any board even if you dont have real hardware using BrainFlow Emulator.
3030

3131
Pull Requests
3232
--------------
@@ -93,3 +93,78 @@ Example for Linux(for MacOS it's the same)::
9393
# Run gdb and get backtrace
9494
sudo gdb --args ./brainflow_get_data --board-id 1 --serial-port /dev/ttyACM0 --mac-address e6:73:73:18:09:b1
9595
# In gdb terminal type 'r' to run the program and as soon as error occurs, type 'bt' to see backtrace with exact lines of code and call stack
96+
97+
98+
BrainFlow Emulator
99+
--------------------
100+
101+
BrainFlow Emulator allows you to run all integration tests for all supported boards without real hardware. Our CI uses it for test automation. Also, you can run it on your own PC!
102+
103+
Streaming Board
104+
~~~~~~~~~~~~~~~~~~
105+
106+
Streaming Board emulator works using Python binding for BrainFlow, so **you need to install Python binding first.**
107+
108+
Install emulator package::
109+
110+
cd emulator
111+
python -m pip install -U .
112+
113+
Run tests ::
114+
115+
python emulator\brainflow_emulator\streaming_board_emulator.py python tests\python\brainflow_get_data.py --log --board-id -2 --ip-address 225.1.1.1 --ip-port 6677 --other-info -1
116+
117+
This emulator uses synthetic board as a master board and the IP address and port are hardcoded.
118+
119+
OpenBCI Cyton
120+
~~~~~~~~~~~~~~~
121+
122+
Cyton emulator simulate COM port using:
123+
124+
- `com0com <http://com0com.sourceforge.net/>`_ for Windows
125+
- pty for Linux and MacOS
126+
127+
You should pass test command line directly to cyton_linux.py or to cyton_windows.py. The script will add the port automatically to provided command line and will start an application.
128+
129+
130+
Install emulator package::
131+
132+
cd emulator
133+
python -m pip install -U .
134+
135+
Run tests for Linux\MacOS and Windows (port argument will be added by Emulator!) ::
136+
137+
python brainflow_emulator/cyton_linux.py python ../tests/python/brainflow_get_data.py --log --board-id 0 --serial-port
138+
python brainflow_emulator\cyton_windows.py python ..\tests\python\brainflow_get_data.py --log --board-id 0 --serial-port
139+
140+
141+
OpenBCI NovaXR
142+
~~~~~~~~~~~~~~~~
143+
144+
NovaXR emulator creates socket server and streams data to BrainFlow like it's a real board, but with much lower sampling rate.
145+
146+
Install emulator package::
147+
148+
cd emulator
149+
python -m pip install -U .
150+
151+
Run tests::
152+
153+
python brainflow_emulator/novaxr_udp.py python ../tests/python/brainflow_get_data.py --log --ip-address 127.0.0.1 --board-id 3
154+
155+
OpenBCI Wifi Shield based boards
156+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
157+
158+
Wifi shield emulator starts http server to read commands and creates client socket to stream data.
159+
160+
Install emulator package::
161+
162+
cd emulator
163+
python -m pip install -U .
164+
165+
Run tests for Ganglion, Cyton and Daisy with Wifi Shield::
166+
167+
python brainflow_emulator/wifi_shield_emulator.py python ../tests/python/brainflow_get_data.py --log --ip-address 127.0.0.1 --board-id 4 --ip-protocol 2 --ip-port 17982
168+
python brainflow_emulator/wifi_shield_emulator.py python ../tests/python/brainflow_get_data.py --log --ip-address 127.0.0.1 --board-id 5 --ip-protocol 2 --ip-port 17982
169+
python brainflow_emulator/wifi_shield_emulator.py python ../tests/python/brainflow_get_data.py --log --ip-address 127.0.0.1 --board-id 6 --ip-protocol 2 --ip-port 17982
170+

docs/BrainFlowEmulator.rst

Lines changed: 0 additions & 75 deletions
This file was deleted.

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ It provides a **uniform data acquisition API for all supported boards**, it mean
2020
DataFormatDesc
2121
Examples
2222
BrainFlowDev
23-
BrainFlowEmulator
2423
AskHelp
2524
License
2625

src/board_controller/inc/board_controller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define SHARED_EXPORT __declspec(dllexport)
88
#define CALLING_CONVENTION __cdecl
99
#else
10-
#define SHARED_EXPORT
10+
#define SHARED_EXPORT __attribute__((visibility("default")))
1111
#define CALLING_CONVENTION
1212
#endif
1313

src/board_controller/inc/board_info_getter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#define SHARED_EXPORT __declspec(dllexport)
55
#define CALLING_CONVENTION __cdecl
66
#else
7-
#define SHARED_EXPORT
7+
#define SHARED_EXPORT __attribute__((visibility("default")))
88
#define CALLING_CONVENTION
99
#endif
1010

src/data_handler/inc/data_handler.h

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
#ifdef _WIN32
44
#define SHARED_EXPORT __declspec(dllexport)
5+
#define CALLING_CONVENTION __cdecl
56
#else
6-
#define SHARED_EXPORT
7+
#define SHARED_EXPORT __attribute__((visibility("default")))
8+
#define CALLING_CONVENTION
79
#endif
810

911
#include "brainflow_constants.h"
@@ -33,40 +35,40 @@ extern "C"
3335
#endif
3436
// signal processing methods
3537
// ripple param is used only for chebyshev filter
36-
SHARED_EXPORT int perform_lowpass (double *data, int data_len, int sampling_rate, double cutoff,
38+
SHARED_EXPORT int CALLING_CONVENTION perform_lowpass (double *data, int data_len, int sampling_rate, double cutoff,
3739
int order, int filter_type, double ripple);
38-
SHARED_EXPORT int perform_highpass (double *data, int data_len, int sampling_rate,
40+
SHARED_EXPORT int CALLING_CONVENTION perform_highpass (double *data, int data_len, int sampling_rate,
3941
double cutoff, int order, int filter_type, double ripple);
40-
SHARED_EXPORT int perform_bandpass (double *data, int data_len, int sampling_rate,
42+
SHARED_EXPORT int CALLING_CONVENTION perform_bandpass (double *data, int data_len, int sampling_rate,
4143
double center_freq, double band_width, int order, int filter_type, double ripple);
42-
SHARED_EXPORT int perform_bandstop (double *data, int data_len, int sampling_rate,
44+
SHARED_EXPORT int CALLING_CONVENTION perform_bandstop (double *data, int data_len, int sampling_rate,
4345
double center_freq, double band_width, int order, int filter_type, double ripple);
4446

45-
SHARED_EXPORT int perform_rolling_filter (
47+
SHARED_EXPORT int CALLING_CONVENTION perform_rolling_filter (
4648
double *data, int data_len, int period, int agg_operation);
4749

48-
SHARED_EXPORT int perform_downsampling (
50+
SHARED_EXPORT int CALLING_CONVENTION perform_downsampling (
4951
double *data, int data_len, int period, int agg_operation, double *output_data);
5052

51-
SHARED_EXPORT int perform_wavelet_transform (double *data, int data_len, char *wavelet,
53+
SHARED_EXPORT int CALLING_CONVENTION perform_wavelet_transform (double *data, int data_len, char *wavelet,
5254
int decomposition_level, double *output_data, int *decomposition_lengths);
53-
SHARED_EXPORT int perform_inverse_wavelet_transform (double *wavelet_coeffs,
55+
SHARED_EXPORT int CALLING_CONVENTION perform_inverse_wavelet_transform (double *wavelet_coeffs,
5456
int original_data_len, char *wavelet, int decomposition_level, int *decomposition_lengths,
5557
double *output_data);
56-
SHARED_EXPORT int perform_wavelet_denoising (
58+
SHARED_EXPORT int CALLING_CONVENTION perform_wavelet_denoising (
5759
double *data, int data_len, char *wavelet, int decomposition_level);
58-
SHARED_EXPORT int perform_fft (
60+
SHARED_EXPORT int CALLING_CONVENTION perform_fft (
5961
double *data, int data_len, double *output_re, double *output_im);
60-
SHARED_EXPORT int perform_ifft (
62+
SHARED_EXPORT int CALLING_CONVENTION perform_ifft (
6163
double *input_re, double *input_im, int data_len, double *restored_data);
6264

6365

6466
// file operations
65-
SHARED_EXPORT int write_file (
67+
SHARED_EXPORT int CALLING_CONVENTION write_file (
6668
double *data, int num_rows, int num_cols, char *file_name, char *file_mode);
67-
SHARED_EXPORT int read_file (
69+
SHARED_EXPORT int CALLING_CONVENTION read_file (
6870
double *data, int *num_rows, int *num_cols, char *file_name, int num_elements);
69-
SHARED_EXPORT int get_num_elements_in_file (
71+
SHARED_EXPORT int CALLING_CONVENTION get_num_elements_in_file (
7072
char *file_name, int *num_elements); // its an internal method for bindings its not
7173
// available via high level api
7274
#ifdef __cplusplus

0 commit comments

Comments
 (0)