Skip to content
9 changes: 7 additions & 2 deletions docs/SupportedBoards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ Unlike Ganglion board this BrainFlow board does not use BLED112 dongle, so you n
To create such board you need to specify the following board ID and fields of BrainFlowInputParams object:

- :code:`BoardIds.GANGLION_NATIVE_BOARD`
- *optoinal:* :code:`mac_address`, if not provided BrainFlow will try to autodiscover the device
- *optoinal:* :code:`serial_number`, if not provided BrainFlow will try to autodiscover the device
- *optional:* :code:`mac_address`, if not provided BrainFlow will try to autodiscover the device
- *optional:* :code:`serial_number`, if not provided BrainFlow will try to autodiscover the device

Initialization Example:

Expand Down Expand Up @@ -1026,6 +1026,11 @@ Ant Neuro has many devices and all of them are supported by BrainFlow:
- :code:`ANT_NEURO_EE_225_BOARD`
- :code:`ANT_NEURO_EE_511_BOARD`

The following fields of BrainFlowInputParams object are supported:

- *optional:* :code:`serial_number`, important if you have multiple devices in the same place, can be found on the amplifier label (if not provided, BrainFlow will try to autodiscover the device)


Initialization example:

.. code-block:: python
Expand Down
1 change: 1 addition & 0 deletions python_package/examples/tests/eego_impedances_and_eeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

if __name__ == '__main__':
params = BrainFlowInputParams()
# params.serial_number = '123456' # optional, useful if multiple devices are connected
board = BoardShim(BoardIds.ANT_NEURO_EE_411_BOARD, params) # 8 channel amplifier
board.prepare_session()

Expand Down
65 changes: 55 additions & 10 deletions src/board_controller/ant_neuro/ant_neuro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,60 @@ int AntNeuroBoard::prepare_session ()
safe_logger (spdlog::level::info, "eego sdk version is: {}.{}.{}.{}",
fact->getVersion ().major, fact->getVersion ().minor, fact->getVersion ().micro,
fact->getVersion ().build);
amp = fact->getAmplifier ();

// Iterate through connected amplifiers
std::vector<amplifier *> amplifier_list = fact->getAmplifiers ();
if (amplifier_list.empty ())
{
throw exceptions::notFound ("no ANT amplifiers found.");
}

std::string expected_board_name = board_descr["default"]["name"];
std::string expected_serial_number = params.serial_number;

std::vector<amplifier *>::iterator iter = amplifier_list.begin ();
for (; iter != amplifier_list.end (); ++iter)
{
amplifier *current_amp = *iter;
std::string current_board_name = "AntNeuro" + current_amp->getType ();
std::string current_serial = current_amp->getSerialNumber ();

if ((!expected_board_name.empty () && current_board_name != expected_board_name) ||
(!expected_serial_number.empty () && current_serial != expected_serial_number))
{
safe_logger (spdlog::level::info,
"Found non-matching amplifier (board name {}, serial {})", current_board_name,
current_serial);
delete current_amp;
continue;
}

// Found the matching amplifier
safe_logger (spdlog::level::info, "Found amplifier (board name {}, serial {})!",
current_board_name, current_serial);
amp = current_amp;
break;
}

// Check if amplifier is found
if (amp == NULL)
{
throw exceptions::notFound (
"no amplifier matched the given board name and serial number.");
}

// Clean up remaining amplifiers after the selected one
while (++iter != amplifier_list.end ())
{
amplifier *current_amp = *iter;
std::string current_board_name = "AntNeuro" + current_amp->getType ();
std::string current_serial = current_amp->getSerialNumber ();
safe_logger (spdlog::level::info,
"Found non-matching amplifier (board name {}, serial {})", current_board_name,
current_serial);
delete current_amp;
}

reference_range = amp->getReferenceRangesAvailable ()[0];
bipolar_range = amp->getBipolarRangesAvailable ()[0];
if (sampling_rate < 0)
Expand All @@ -105,18 +158,10 @@ int AntNeuroBoard::prepare_session ()
}
impedance_mode = false;
impedance_package_num = 0;
std::string board_name = "AntNeuro" + amp->getType ();
std::string expected_board_name = board_descr["default"]["name"];
if (expected_board_name != board_name)
{
std::string err_msg = "Board name " + expected_board_name +
" does not match board name of connected device " + board_name;
throw exceptions::notFound (err_msg);
}
}
catch (const exceptions::notFound &e)
{
safe_logger (spdlog::level::err, "No devices found, {}", e.what ());
safe_logger (spdlog::level::err, "Device not found, {}", e.what ());
return (int)BrainFlowExitCodes::BOARD_NOT_READY_ERROR;
}
catch (const std::runtime_error &e)
Expand Down
Loading