Skip to content

Commit 2a9e142

Browse files
authored
Merge pull request #66 from sync2brain/feat_marker
Add event to listen to received markers.
2 parents 5f6b5b1 + f0da294 commit 2a9e142

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

tests/commonSetupTests.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,4 @@ function rebootTarget(testCase)
5757
end
5858
end
5959

60-
methods (TestMethodTeardown)
61-
function clearBossdeviceObj(testCase)
62-
if ~isempty(testCase.bd) && testCase.bd.isConnected
63-
testCase.bd.stop;
64-
end
65-
end
66-
end
67-
6860
end

tests/exampleTests.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@ function runExampleScript(~, exName)
1515
function closeFigures(~)
1616
close all;
1717
end
18+
19+
function clearBossdeviceObj(testCase)
20+
if ~isempty(testCase.bd) && testCase.bd.isConnected
21+
testCase.bd.stop;
22+
end
23+
end
1824
end
1925
end

toolbox/dependencies/+bossapi

toolbox/src/bossdevice.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
appName = 'bossdevice_main';
5353
end
5454

55+
events
56+
MarkerReceived
57+
end
58+
5559
methods (Static)
5660
function clearPersonalSettings()
5761
s = settings;
@@ -74,6 +78,17 @@ function initOscillationProps(obj)
7478
obj.alpha = bossdevice_oscillation(obj.targetObject, 'alpha', obj.logObj);
7579
obj.beta = bossdevice_oscillation(obj.targetObject, 'beta', obj.logObj);
7680
end
81+
82+
function addCustomInst(obj)
83+
% Initialize instrument object
84+
instObj = slrealtime.Instrument(obj.firmwareFilepath);
85+
86+
% Remote marker
87+
instObj.connectCallback(@(src, event) bossapi.inst.notifyMarkerReceived(obj,src,event,{'biosignal','BusElement','MRK'}));
88+
89+
% Add instrument objects to target
90+
obj.targetObject.addInstrument(instObj);
91+
end
7792
end
7893

7994
methods
@@ -266,6 +281,9 @@ function initialize(obj)
266281

267282
% Figure out some oscillation values
268283
initOscillationProps(obj);
284+
285+
% Add custom instrumentation
286+
obj.addCustomInst;
269287
end
270288

271289
function start(obj)
@@ -579,6 +597,7 @@ function restoreInstrument(obj)
579597
hInst = slrealtime.Instrument(obj.firmwareFilepath);
580598
hInst.addInstrumentedSignals;
581599
obj.addInstrument(hInst);
600+
obj.addCustomInst;
582601
end
583602

584603
function bufObj = createAsyncBuffer(obj, signalName, bufferLen, options)

0 commit comments

Comments
 (0)