Skip to content

Commit 0d1b356

Browse files
authored
Merge pull request #42 from ChrisVeigl/museTimeout
this adds a timeout parameter to the brainflow element
2 parents 4b32e32 + 2a9d0e3 commit 0d1b356

File tree

5 files changed

+25
-15
lines changed

5 files changed

+25
-15
lines changed

bin/brainBay.exe

-3 KB
Binary file not shown.

src/brainbay.rc

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,20 +1465,20 @@ BEGIN
14651465
CONTROL "send only changing values",IDC_ONLY_CHANGING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,100,133,96,10
14661466
END
14671467

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

15001502

@@ -1851,7 +1853,7 @@ BEGIN
18511853
LEFTMARGIN, 6
18521854
RIGHTMARGIN, 316
18531855
TOPMARGIN, 6
1854-
BOTTOMMARGIN, 229
1856+
BOTTOMMARGIN, 247
18551857
END
18561858
END
18571859
#endif // APSTUDIO_INVOKED

src/ob_brainflow.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ void bf_setparams(BRAINFLOWOBJ* st) {
162162
params.serial_port = std::string(st->serialport);
163163
params.ip_address = std::string(st->ipaddress);
164164
params.mac_address = std::string(st->macaddress);
165+
params.timeout = st->timeout;
165166
params.ip_port = st->ipport;
166167
}
167168

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

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

@@ -330,7 +332,7 @@ LRESULT CALLBACK BrainflowDlgHandler(HWND hDlg, UINT message, WPARAM wParam, LPA
330332
GetDlgItemText(hDlg, IDC_BF_IPADDRESS, st->ipaddress, sizeof(st->ipaddress)-1);
331333
st->ipport = GetDlgItemInt(hDlg, IDC_BF_IPPORT, NULL, false);
332334
GetDlgItemText(hDlg, IDC_BF_MACADDRESS, st->macaddress, sizeof(st->macaddress)-1);
333-
335+
st->timeout = GetDlgItemInt(hDlg, IDC_BF_TIMEOUT, NULL, false);
334336
GetDlgItemText(hDlg, IDC_BF_CONFIG, st->bfConfigString, sizeof(st->bfConfigString) - 1);
335337

336338
try
@@ -443,6 +445,7 @@ BRAINFLOWOBJ::BRAINFLOWOBJ(int num) : BASE_CL()
443445
strcpy(serialport, "COM4");
444446
strcpy(ipaddress, "192.168.4.1");
445447
ipport = 4567;
448+
timeout = 0;
446449
strcpy(macaddress, "");
447450
strcpy(bfConfigString, "");
448451

@@ -485,6 +488,7 @@ void BRAINFLOWOBJ::load(HANDLE hFile)
485488
load_property("macaddress", P_STRING, macaddress);
486489
load_property("show_position", P_INT, &show_position);
487490
load_property("show_extrachannels", P_INT, &show_extrachannels);
491+
load_property("timeout", P_INT, &timeout);
488492
load_property("bfConfigString", P_STRING, bfConfigString);
489493

490494

@@ -520,6 +524,7 @@ void BRAINFLOWOBJ::save(HANDLE hFile)
520524
save_property(hFile, "macaddress", P_STRING, macaddress);
521525
save_property(hFile, "show_position", P_INT, &show_position);
522526
save_property(hFile, "show_extrachannels", P_INT, &show_extrachannels);
527+
save_property(hFile, "timeout", P_INT, &timeout);
523528
save_property(hFile, "bfConfigString", P_STRING, bfConfigString);
524529

525530
save_property(hFile, "archivefile", P_STRING, archivefile);

src/ob_brainflow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class BRAINFLOWOBJ : public BASE_CL
2626
int board_selection,board_id,channels;
2727
int show_position, show_extrachannels;
2828
char ipaddress[40], macaddress[40], serialport[40];
29+
int timeout;
2930
char bfConfigString[250];
3031
int channelMap[MAX_PORTS];
3132
int bf_channels;

src/resource.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,8 @@
809809
#define IDC_SHOW_POSITIONS2 1578
810810
#define IDC_SHOW_POSITION 1578
811811
#define IDC_BF_CONFIG 1579
812+
#define IDC_BF_CONFIG2 1580
813+
#define IDC_BF_TIMEOUT 1580
812814
#define IDM_SETTINGS 32771
813815
#define IDM_LOADCONFIG 32779
814816
#define IDM_SAVECONFIG 32780
@@ -989,7 +991,7 @@
989991
//
990992
#ifdef APSTUDIO_INVOKED
991993
#ifndef APSTUDIO_READONLY_SYMBOLS
992-
#define _APS_NEXT_RESOURCE_VALUE 268
994+
#define _APS_NEXT_RESOURCE_VALUE 270
993995
#define _APS_NEXT_COMMAND_VALUE 32970
994996
#define _APS_NEXT_CONTROL_VALUE 1580
995997
#define _APS_NEXT_SYMED_VALUE 110

0 commit comments

Comments
 (0)