Skip to content

Commit

Permalink
Merge pull request #42 from ChrisVeigl/museTimeout
Browse files Browse the repository at this point in the history
 this adds a timeout parameter to the brainflow element
  • Loading branch information
ChrisVeigl authored Jul 14, 2023
2 parents 4b32e32 + 2a9d0e3 commit 0d1b356
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
Binary file modified bin/brainBay.exe
Binary file not shown.
28 changes: 15 additions & 13 deletions src/brainbay.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1465,20 +1465,20 @@ BEGIN
CONTROL "send only changing values",IDC_ONLY_CHANGING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,133,96,10
END

IDD_BRAINFLOWBOX DIALOGEX 0, 0, 323, 234
IDD_BRAINFLOWBOX DIALOGEX 0, 0, 323, 252
STYLE DS_ABSALIGN | DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_STATICEDGE
CAPTION "Brainflow-Compatible Biosignal Device"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "Apply Configuration",IDC_BF_APPLY_DEVICE,70,137,211,15,BS_FLAT
GROUPBOX "Brainflow-Compatible Device Selection and Configuration",-1,6,3,310,155
PUSHBUTTON "Open",IDC_OPEN_BF_ARCHIVE,70,204,39,14,BS_FLAT
PUSHBUTTON "Create Archive",IDC_REC_BF_ARCHIVE,148,204,70,14,BS_FLAT
PUSHBUTTON "Close ",IDC_CLOSE_BF_ARCHIVE,112,204,34,14,BS_FLAT
LTEXT "Filename:",-1,29,186,36,8
GROUPBOX "Archive File",-1,6,168,310,61
PUSHBUTTON "End Recording",IDC_END_BF_RECORDING,221,204,62,14,BS_FLAT
PUSHBUTTON "Apply Configuration",IDC_BF_APPLY_DEVICE,70,155,211,15,BS_FLAT
GROUPBOX "Brainflow-Compatible Device Selection and Configuration",-1,6,3,310,175
PUSHBUTTON "Open",IDC_OPEN_BF_ARCHIVE,70,222,39,14,BS_FLAT
PUSHBUTTON "Create Archive",IDC_REC_BF_ARCHIVE,148,222,70,14,BS_FLAT
PUSHBUTTON "Close ",IDC_CLOSE_BF_ARCHIVE,112,222,34,14,BS_FLAT
LTEXT "Filename:",-1,29,205,36,8
GROUPBOX "Archive File",-1,6,185,310,61
PUSHBUTTON "End Recording",IDC_END_BF_RECORDING,221,222,62,14,BS_FLAT
COMBOBOX IDC_BF_DEVICECOMBO,69,22,213,191,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
LTEXT "Device:",-1,40,24,26,8
EDITTEXT IDC_BF_SERIALPORT,69,59,48,12,ES_AUTOHSCROLL | WS_DISABLED
Expand All @@ -1492,9 +1492,11 @@ BEGIN
LTEXT "(e.g. COM5 on Windows or /dev/ttyUSB0 on Linux)",-1,120,60,178,8
CONTROL "show extra channels",IDC_SHOW_EXTRACHANNELS,"Button",BS_AUTOCHECKBOX,189,36,94,15
CONTROL "show electrode positions",IDC_SHOW_POSITION,"Button",BS_AUTOCHECKBOX,70,37,94,15
EDITTEXT IDC_BF_ARCHIVEFILE,70,185,212,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Config-String (optional, advanced use):",-1,21,116,124,8
EDITTEXT IDC_BF_CONFIG,147,114,133,12,ES_AUTOHSCROLL
EDITTEXT IDC_BF_ARCHIVEFILE,70,203,212,12,ES_AUTOHSCROLL | ES_READONLY
LTEXT "Config-String (optional, advanced use):",-1,21,136,124,8
EDITTEXT IDC_BF_CONFIG,147,134,133,12,ES_AUTOHSCROLL
LTEXT "Timeout: ",-1,110,119,32,8
EDITTEXT IDC_BF_TIMEOUT,147,117,59,12,ES_AUTOHSCROLL
END


Expand Down Expand Up @@ -1851,7 +1853,7 @@ BEGIN
LEFTMARGIN, 6
RIGHTMARGIN, 316
TOPMARGIN, 6
BOTTOMMARGIN, 229
BOTTOMMARGIN, 247
END
END
#endif // APSTUDIO_INVOKED
Expand Down
7 changes: 6 additions & 1 deletion src/ob_brainflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void bf_setparams(BRAINFLOWOBJ* st) {
params.serial_port = std::string(st->serialport);
params.ip_address = std::string(st->ipaddress);
params.mac_address = std::string(st->macaddress);
params.timeout = st->timeout;
params.ip_port = st->ipport;
}

Expand Down Expand Up @@ -287,6 +288,7 @@ LRESULT CALLBACK BrainflowDlgHandler(HWND hDlg, UINT message, WPARAM wParam, LPA
SetDlgItemText(hDlg, IDC_BF_MACADDRESS, st->macaddress);
SetDlgItemText(hDlg, IDC_BF_IPADDRESS, st->ipaddress);
SetDlgItemInt(hDlg, IDC_BF_IPPORT, st->ipport,FALSE);
SetDlgItemInt(hDlg, IDC_BF_TIMEOUT, st->timeout, FALSE);

SetDlgItemText(hDlg, IDC_BF_CONFIG, st->bfConfigString);

Expand Down Expand Up @@ -330,7 +332,7 @@ LRESULT CALLBACK BrainflowDlgHandler(HWND hDlg, UINT message, WPARAM wParam, LPA
GetDlgItemText(hDlg, IDC_BF_IPADDRESS, st->ipaddress, sizeof(st->ipaddress)-1);
st->ipport = GetDlgItemInt(hDlg, IDC_BF_IPPORT, NULL, false);
GetDlgItemText(hDlg, IDC_BF_MACADDRESS, st->macaddress, sizeof(st->macaddress)-1);

st->timeout = GetDlgItemInt(hDlg, IDC_BF_TIMEOUT, NULL, false);
GetDlgItemText(hDlg, IDC_BF_CONFIG, st->bfConfigString, sizeof(st->bfConfigString) - 1);

try
Expand Down Expand Up @@ -443,6 +445,7 @@ BRAINFLOWOBJ::BRAINFLOWOBJ(int num) : BASE_CL()
strcpy(serialport, "COM4");
strcpy(ipaddress, "192.168.4.1");
ipport = 4567;
timeout = 0;
strcpy(macaddress, "");
strcpy(bfConfigString, "");

Expand Down Expand Up @@ -485,6 +488,7 @@ void BRAINFLOWOBJ::load(HANDLE hFile)
load_property("macaddress", P_STRING, macaddress);
load_property("show_position", P_INT, &show_position);
load_property("show_extrachannels", P_INT, &show_extrachannels);
load_property("timeout", P_INT, &timeout);
load_property("bfConfigString", P_STRING, bfConfigString);


Expand Down Expand Up @@ -520,6 +524,7 @@ void BRAINFLOWOBJ::save(HANDLE hFile)
save_property(hFile, "macaddress", P_STRING, macaddress);
save_property(hFile, "show_position", P_INT, &show_position);
save_property(hFile, "show_extrachannels", P_INT, &show_extrachannels);
save_property(hFile, "timeout", P_INT, &timeout);
save_property(hFile, "bfConfigString", P_STRING, bfConfigString);

save_property(hFile, "archivefile", P_STRING, archivefile);
Expand Down
1 change: 1 addition & 0 deletions src/ob_brainflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class BRAINFLOWOBJ : public BASE_CL
int board_selection,board_id,channels;
int show_position, show_extrachannels;
char ipaddress[40], macaddress[40], serialport[40];
int timeout;
char bfConfigString[250];
int channelMap[MAX_PORTS];
int bf_channels;
Expand Down
4 changes: 3 additions & 1 deletion src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,8 @@
#define IDC_SHOW_POSITIONS2 1578
#define IDC_SHOW_POSITION 1578
#define IDC_BF_CONFIG 1579
#define IDC_BF_CONFIG2 1580
#define IDC_BF_TIMEOUT 1580
#define IDM_SETTINGS 32771
#define IDM_LOADCONFIG 32779
#define IDM_SAVECONFIG 32780
Expand Down Expand Up @@ -989,7 +991,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 268
#define _APS_NEXT_RESOURCE_VALUE 270
#define _APS_NEXT_COMMAND_VALUE 32970
#define _APS_NEXT_CONTROL_VALUE 1580
#define _APS_NEXT_SYMED_VALUE 110
Expand Down

0 comments on commit 0d1b356

Please sign in to comment.