brainflow: AAVAA board: native BLE does not connect to device on MacOS
Description
When compiled from source, the library connects to the board using BLE on Windows, but the same code compiled on MacOS does not connect to the same board and gets stuck in this method: simpleble_peripheral_connect().
To Reproduce
Please refer to this fork to see the changes:
Code:
BoardShim.enable_dev_board_logger()
params = BrainFlowInputParams()
params.mac_address = "8CE5F615-5CEA-35A3-499C-B85EC91B5802"
board = BoardShim(board_id=BoardIds.AAVAA_V3_BOARD, input_params=params)
board.enable_dev_board_logger()
board.set_log_level(log_level=LogLevels.LEVEL_TRACE)
board.set_log_file(log_file="test.log")
Logs:
[2023-08-17 16:33:12.267] [board_logger] [info] incoming json: {
"file": "",
"file_anc": "",
"file_aux": "",
"ip_address": "",
"ip_address_anc": "",
"ip_address_aux": "",
"ip_port": 0,
"ip_port_anc": 0,
"ip_port_aux": 0,
"ip_protocol": 0,
"mac_address": "8CE5F615-5CEA-35A3-499C-B85EC91B5802",
"master_board": -100,
"other_info": "",
"serial_number": "",
"serial_port": "",
"timeout": 0
}
[2023-08-17 16:33:12.267] [board_logger] [trace] Board object created 53
[2023-08-17 16:33:12.267] [board_logger] [info] Use timeout for discovery: 5
[2023-08-17 16:33:12.267] [board_logger] [debug] use dyn lib: ~/AAVAAflow/python_package/brainflow/lib/libsimpleble-c.dylib
[2023-08-17 16:33:13.532] [board_logger] [trace] Scan started
[2023-08-17 16:33:13.557] [board_logger] [trace] address 960817F6-1B5B-BD03-C3F3-3DF9EC4318A0
[2023-08-17 16:33:13.557] [board_logger] [trace] identifier
[2023-08-17 16:33:13.559] [board_logger] [trace] address EBC182A6-C158-D76B-6482-0E57B2C40A1E
[2023-08-17 16:33:13.559] [board_logger] [trace] identifier
[2023-08-17 16:33:13.563] [board_logger] [trace] address 8CE5F615-5CEA-35A3-499C-B85EC91B5802
[2023-08-17 16:33:13.563] [board_logger] [trace] identifier AAVAA001
[2023-08-17 16:33:13.563] [board_logger] [info] Found AAVAAv3 device
[2023-08-17 16:33:13.621] [board_logger] [trace] Scan stopped
Info (please complete the following information):
- Board Id : AAVAA V3 (53 in the fork)
- OS running on your PC: MacOS (13.5)
- Programming Language and its version: python3.10
- Architecture(x86, x64, ARM, etc): ARM64
- pip list:
brainflow 0.0.1 ~/AAVAAFlow/python_package
nptyping 1.4.4
numpy 1.25.2
pip 23.1.2
setuptools 67.8.0
typish 1.9.3
wheel 0.40.0
Expected behavior The same compiled code works great on Windows, but not on MacOS
Additional context
The code on MacOS is compile using cmake and Ninja:
cmake -DCMAKE_INSTALL_PREFIX=~/AAVAAFlow/tools/../installed -DBRAINFLOW_VERSION=4.9.2 -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_BLE=ON ~/AAVAAFlow/tools/..
ninja
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 1
- Comments: 23 (22 by maintainers)
Commits related to this issue
- added loop to connect to peripheral and sleep before connection #667 — committed to AAVAA-Inc/AAVAAflow by aavaa-farnood 10 months ago
We are not seeing similar issues with BrainFlow 5.9.0 and OpenBCI Ganglion using Native Bluetooth on multiple Macs.
@aavaa-farnood can we rename this issue to include the name for the board you are using?
#671 this may help
Since you brought up SimpleBLE, I tested with their code on their repo and without BrainFlow and only SimpleBLE everything looks good, I can scan and connect really fast. Does that help?
Also on the permissions side, I have already checked all those and I have the right permissions. I changed the
sleeptimes in the code and now it connects every once in 10 trials. But still not reliable.I can easily connect and stream using
BleakandSimpleBLE.