From 0d27eaa44b748935f881fdb266cec3ee09db8fab Mon Sep 17 00:00:00 2001 From: Andrey Parfenov Date: Mon, 6 Nov 2023 01:49:38 +0100 Subject: [PATCH] try default dllimport name resolution Signed-off-by: Andrey Parfenov --- .github/workflows/run_unix.yml | 21 +- .../brainflow/board_controller_library.cs | 168 +++++++-------- .../brainflow/data_handler_library.cs | 204 +++++++++--------- .../brainflow/brainflow/ml_module_library.cs | 32 +-- 4 files changed, 216 insertions(+), 209 deletions(-) diff --git a/.github/workflows/run_unix.yml b/.github/workflows/run_unix.yml index 94587fc98..a8afbe8dd 100644 --- a/.github/workflows/run_unix.yml +++ b/.github/workflows/run_unix.yml @@ -153,6 +153,20 @@ jobs: # start testing - name: Run unit tests run: $GITHUB_WORKSPACE/build/tests/brainflow_tests + - name: Synthetic C# Test + run: | + cd $GITHUB_WORKSPACE/csharp_package/brainflow/examples/brainflow_get_data/bin/Release/netcoreapp3.1 + ./brainflow_get_data --board-id -1 + env: + DYLD_PRINT_LIBRARIES: 1 + LD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib + - name: EEG Metrics C# Test + run: | + cd $GITHUB_WORKSPACE/csharp_package/brainflow/examples/eeg_metrics/bin/Release/netcoreapp3.1 + ./eeg_metrics --board-id -1 + env: + DYLD_PRINT_LIBRARIES: 1 + LD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib - name: Run All Julia Tests run: | export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/installed/lib:$LD_LIBRARY_PATH @@ -330,13 +344,6 @@ jobs: mvn exec:java -Dexec.mainClass="brainflow.examples.EEGMetrics" -Dexec.args="--board-id -1" env: LD_LIBRARY_PATH: ${{ github.workspace }}/installed/lib - - name: Synthetic C# Test - run: | - cd $GITHUB_WORKSPACE/csharp_package/brainflow/examples/brainflow_get_data/bin/Release/netcoreapp3.1 - ./brainflow_get_data --board-id -1 - env: - LD_DEBUG: all - DYLD_PRINT_LIBRARIES: 1 - name: Synthetic Node run: | cd $GITHUB_WORKSPACE/nodejs_package/tests diff --git a/csharp_package/brainflow/brainflow/board_controller_library.cs b/csharp_package/brainflow/brainflow/board_controller_library.cs index 92c0d8e4f..2f7596b4f 100644 --- a/csharp_package/brainflow/brainflow/board_controller_library.cs +++ b/csharp_package/brainflow/brainflow/board_controller_library.cs @@ -298,177 +298,177 @@ public static class BoardControllerLibrary32 public static class BoardControllerLibraryLinux { - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int prepare_session (int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int start_stream (int buffer_size, string streamer_params, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int stop_stream (int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release_session (int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_current_board_data (int num_samples, int preset, [In, Out][MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.R8)] double[,] data_buf, int[] returned_samples, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_data_count (int preset, int[] result, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_data (int data_count, int preset, [In, Out][MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.R8)] double[,] data_buf, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_level_board_controller (int log_level); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int log_message_board_controller (int log_level, string message); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int config_board (string config, byte[] response, int[] len, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_file_board_controller (string log_file); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_sampling_rate (int board_id, int preset, int[] sampling_rate); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_timestamp_channel (int board_id, int preset, int[] timestamp_channel); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_marker_channel (int board_id, int preset, int[] marker_channel); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_package_num_channel (int board_id, int preset, int[] package_num_channel); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_battery_channel (int board_id, int preset, int[] battery_channel); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_num_rows (int board_id, int preset, int[] num_rows); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eeg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_emg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_ecg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eog_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eda_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_ppg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_accel_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_rotation_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_analog_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_gyro_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_other_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_temperature_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int is_prepared (int[] prepared, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eeg_names (int board_id, int preset, byte[] eeg_names, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_resistance_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_exg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_device_name (int board_id, int preset, byte[] name, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int insert_marker (double value, int preset, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_descr (int board_id, int preset, byte[] board_descr, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release_all_sessions (); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_version_board_controller (byte[] version, int[] len, int max_len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_presets (int board_id, int[] names, int[] len); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int add_streamer (string streamer, int preset, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int delete_streamer (string streamer, int preset, int board_id, string input_json); - [DllImport ("libBoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("BoardController.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_magnetometer_channels (int board_id, int preset, int[] channels, int[] len); } public static class BoardControllerLibraryMac { - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int prepare_session (int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int start_stream (int buffer_size, string streamer_params, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int insert_marker (double value, int preset, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int stop_stream (int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release_session (int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_current_board_data (int num_samples, int preset, [In, Out][MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.R8)] double[,] data_buf, int[] returned_samples, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_data_count (int preset, int[] result, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_data (int data_count, int preset, [In, Out][MarshalAs (UnmanagedType.LPArray, ArraySubType = UnmanagedType.R8)] double[,] data_buf, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_level_board_controller (int log_level); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int log_message_board_controller (int log_level, string message); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int config_board (string config, byte[] response, int[] len, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_file_board_controller (string log_file); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_sampling_rate (int board_id, int preset, int[] sampling_rate); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_timestamp_channel (int board_id, int preset, int[] timestamp_channel); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_marker_channel (int board_id, int preset, int[] marker_channel); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_package_num_channel (int board_id, int preset, int[] package_num_channel); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_battery_channel (int board_id, int preset, int[] battery_channel); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_num_rows (int board_id, int preset, int[] num_rows); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eeg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_emg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_ecg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eog_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eda_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_ppg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_accel_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_rotation_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_analog_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_gyro_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_other_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_temperature_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int is_prepared (int[] prepared, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_eeg_names (int board_id, int preset, byte[] eeg_names, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_resistance_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_exg_channels (int board_id, int preset, int[] channels, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_device_name (int board_id, int preset, byte[] name, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_descr (int board_id, int preset, byte[] board_descr, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release_all_sessions (); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_version_board_controller (byte[] version, int[] len, int max_len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_board_presets (int board_id, int[] names, int[] len); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int add_streamer (string streamer, int preset, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int delete_streamer (string streamer, int preset, int board_id, string input_json); - [DllImport ("libBoardController.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libBoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_magnetometer_channels (int board_id, int preset, int[] channels, int[] len); } diff --git a/csharp_package/brainflow/brainflow/data_handler_library.cs b/csharp_package/brainflow/brainflow/data_handler_library.cs index 99c50ce96..f0876212f 100644 --- a/csharp_package/brainflow/brainflow/data_handler_library.cs +++ b/csharp_package/brainflow/brainflow/data_handler_library.cs @@ -337,221 +337,221 @@ public static unsafe extern int perform_wavelet_denoising (double* data, int dat class DataHandlerLibraryLinux { - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_file_data_handler (string log_file); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int log_message_data_handler (int log_level, string message); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_level_data_handler (int log_level); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_lowpass (double[] data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_highpass (double[] data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_bandpass (double[] data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_bandstop (double[] data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_rolling_filter (double[] data, int len, int period, int operation); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_downsampling (double[] data, int len, int period, int operation, double[] downsampled_data); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int write_file (double[] data, int num_rows, int num_cols, string file_name, string file_mode); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int read_file (double[] data, int[] num_rows, int[] num_cols, string file_name, int max_elements); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_num_elements_in_file (string file_name, int[] num_elements); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_wavelet_transform (double[] data, int data_len, int wavelet, int decomposition_level, int extension, double[] output_data, int[] decomposition_lengths); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_inverse_wavelet_transform (double[] wavelet_coeffs, int original_data_len, int wavelet, int decomposition_level, int extension, int[] decomposition_lengths, double[] output_data); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_wavelet_denoising (double[] data, int data_len, int wavelet, int decomposition_level, int wavelet_denoising, int threshold, int extenstion_type, int noise_level); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_csp (double[] data, double[] labels, int n_epochs, int n_channels, int n_times, double[] output_filters, double[] output_eigenvalues); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_window (int window_function, int window_len, double[] window_data); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_fft (double[] data, int data_len, int window, double[] re, double[] im); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_ifft (double[] re, double[] im, int data_len, double[] data); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_nearest_power_of_two (int value, int[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_psd (double[] data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_band_power (double[] ampls, double[] freqs, int data_len, double freq_start, double freq_end, double[] res); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_psd_welch (double[] data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int detrend (double[] data, int len, int operation); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_custom_band_powers (double[] data, int rows, int cols, double[] start_freqs, double[] stop_freqs, int num_bands, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int remove_environmental_noise (double[] data, int len, int sampling_rate, int noise_type); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int calc_stddev (double[] data, int start_pos, int end_pos, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_version_data_handler (byte[] version, int[] len, int max_len); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_railed_percentage (double[] data, int len, int gain, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_oxygen_level (double[] ppg_ir, double[] ppg_red, int data_size, int sampling_rate, double coef1, double coef2, double coef3, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int restore_data_from_wavelet_detailed_coeffs (double[] data, int data_len, int wavelet, int decomposition_level, int level_to_restore, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int detect_peaks_z_score (double[] data, int data_len, int lag, double threshold, double influence, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_heart_rate (double[] ppg_ir, double[] ppg_red, int data_size, int sampling_rate, int fft_size, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_ica (double[] data, int rows, int cols, int num_components, double[] w, double[] k, double[] a, double[] s); // unsafe methods working with pointers - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_lowpass (double* data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_highpass (double* data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_bandpass (double* data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_bandstop (double* data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_rolling_filter (double* data, int len, int period, int operation); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_downsampling (double* data, int len, int period, int operation, double[] downsampled_data); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_wavelet_transform (double* data, int data_len, int wavelet, int decomposition_level, int extension, double[] output_data, int[] decomposition_lengths); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_wavelet_denoising (double* data, int data_len, int wavelet, int decomposition_level, int wavelet_denoising, int threshold, int extenstion_type, int noise_level); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_fft (double* data, int data_len, int window, double[] re, double[] im); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_psd (double* data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_psd_welch (double* data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int detrend (double* data, int len, int operation); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int remove_environmental_noise (double* data, int len, int sampling_rate, int noise_type); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_custom_band_powers (double* data, int rows, int cols, double[] start_freqs, double[] stop_freqs, int num_bands, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int calc_stddev (double* data, int start_pos, int end_pos, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_railed_percentage (double* data, int len, int gain, double[] output); - [DllImport ("libDataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("DataHandler.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int detect_peaks_z_score (double* data, int data_len, int lag, double threshold, double influence, double[] output); } class DataHandlerLibraryMac { - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_file_data_handler (string log_file); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int log_message_data_handler (int log_level, string message); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_level_data_handler (int log_level); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_lowpass (double[] data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_highpass (double[] data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_bandpass (double[] data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_bandstop (double[] data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_rolling_filter (double[] data, int len, int period, int operation); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_downsampling (double[] data, int len, int period, int operation, double[] downsampled_data); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int write_file (double[] data, int num_rows, int num_cols, string file_name, string file_mode); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int read_file (double[] data, int[] num_rows, int[] num_cols, string file_name, int max_elements); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_num_elements_in_file (string file_name, int[] num_elements); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_wavelet_transform (double[] data, int data_len, int wavelet, int decomposition_level, int extension, double[] output_data, int[] decomposition_lengths); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_inverse_wavelet_transform (double[] wavelet_coeffs, int original_data_len, int wavelet, int decomposition_level, int extension, int[] decomposition_lengths, double[] output_data); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_wavelet_denoising (double[] data, int data_len, int wavelet, int decomposition_level, int wavelet_denoising, int threshold, int extenstion_type, int noise_level); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_csp (double[] data, double[] labels, int n_epochs, int n_channels, int n_times, double[] output_filters, double[] output_eigenvalues); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_window (int window_function, int window_len, double[] window_data); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_fft (double[] data, int data_len, int window, double[] re, double[] im); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_ifft (double[] re, double[] im, int data_len, double[] data); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_nearest_power_of_two (int value, int[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_psd (double[] data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_band_power (double[] ampls, double[] freqs, int data_len, double freq_start, double freq_end, double[] res); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_psd_welch (double[] data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int detrend (double[] data, int len, int operation); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_custom_band_powers (double[] data, int rows, int cols, double[] start_freqs, double[] stop_freqs, int num_bands, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int remove_environmental_noise (double[] data, int len, int sampling_rate, int noise_type); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int calc_stddev (double[] data, int start_pos, int end_pos, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_version_data_handler (byte[] version, int[] len, int max_len); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_railed_percentage (double[] data, int len, int gain, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_oxygen_level (double[] ppg_ir, double[] ppg_red, int data_size, int sampling_rate, double coef1, double coef2, double coef3, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int restore_data_from_wavelet_detailed_coeffs (double[] data, int data_len, int wavelet, int decomposition_level, int level_to_restore, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int detect_peaks_z_score (double[] data, int data_len, int lag, double threshold, double influence, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_heart_rate (double[] ppg_ir, double[] ppg_red, int data_size, int sampling_rate, int fft_size, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int perform_ica (double[] data, int rows, int cols, int num_components, double[] w, double[] k, double[] a, double[] s); // unsafe methods working with pointers - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_lowpass (double* data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_highpass (double* data, int len, int sampling_rate, double cutoff, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_bandpass (double* data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_bandstop (double* data, int len, int sampling_rate, double start_freq, double stop_freq, int order, int filter_type, double ripple); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_rolling_filter (double* data, int len, int period, int operation); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_downsampling (double* data, int len, int period, int operation, double[] downsampled_data); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_wavelet_transform (double* data, int data_len, int wavelet, int decomposition_level, int extension, double[] output_data, int[] decomposition_lengths); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_wavelet_denoising (double* data, int data_len, int wavelet, int decomposition_level, int wavelet_denoising, int threshold, int extenstion_type, int noise_level); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int perform_fft (double* data, int data_len, int window, double[] re, double[] im); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_psd (double* data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_psd_welch (double* data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int detrend (double* data, int len, int operation); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int remove_environmental_noise (double* data, int len, int sampling_rate, int noise_type); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_custom_band_powers (double* data, int rows, int cols, double[] start_freqs, double[] stop_freqs, int num_bands, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int calc_stddev (double* data, int start_pos, int end_pos, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int get_railed_percentage (double* data, int len, int gain, double[] output); - [DllImport ("libDataHandler.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libDataHandler", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static unsafe extern int detect_peaks_z_score (double* data, int data_len, int lag, double threshold, double influence, double[] output); } diff --git a/csharp_package/brainflow/brainflow/ml_module_library.cs b/csharp_package/brainflow/brainflow/ml_module_library.cs index 8c2697803..b4dc10436 100644 --- a/csharp_package/brainflow/brainflow/ml_module_library.cs +++ b/csharp_package/brainflow/brainflow/ml_module_library.cs @@ -64,41 +64,41 @@ public static class MLModuleLibrary32 public static class MLModuleLibraryLinux { - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_file_ml_module (string log_file); - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int log_message_ml_module (int log_level, string message); - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_level_ml_module (int log_level); - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int prepare (string input_json); - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release (string input_json); - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int predict (double[] data, int data_len, double[] output, int[] output_len, string input_json); - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release_all (); - [DllImport ("libMLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("MLModule.so", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_version_ml_module (byte[] version, int[] len, int max_len); } public static class MLModuleLibraryMac { - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_file_ml_module (string log_file); - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int log_message_ml_module (int log_level, string message); - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int set_log_level_ml_module (int log_level); - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int prepare (string input_json); - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release (string input_json); - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int predict (double[] data, int data_len, double[] output, int[] output_len, string input_json); - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int release_all (); - [DllImport ("libMLModule.dylib", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] + [DllImport ("libMLModule", SetLastError = true, CallingConvention = CallingConvention.Cdecl)] public static extern int get_version_ml_module (byte[] version, int[] len, int max_len); }