pb_runLSL.m 1.64 KB
Newer Older
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function ses = pb_runLSL()
% PB_RUNLSL()
%
% PB_RUNLSL()  ...
%
% See also ...

% PBToolbox (2018): JJH: j.heckman@donders.ru.nl

   streams  = {'type=''Digital Events @ lslder00'' and name=''Digital Events 1''', ...
               'type=''Pupil Capture @ pupil-hpdesktop'' and name=''Pupil Primitive Data - Eye 0''', ...
               'type=''Optitrack @ MOTIVE'' and name=''Motive Data'''};
         
   ses      = lsl_session();
Jesse Heckman's avatar
add LSL    
Jesse Heckman committed
15
   str      = lsl_istream.empty(0,3);
Jesse Heckman's avatar
add LSL  
Jesse Heckman committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

   for iStrm = 1:length(streams)
      % Find, select and make streams for LSL.
      
      info  = lsl_streaminfos(streams{iStrm});
      l     = info.list();
      if isempty(l); error('No streams found'); end

      for iList = 1:size(l ,1)
        fprintf('%d: name: ''%s'' type: ''%s''\n',iList,l{iList}.name,l{iList}.type);
      end

      str(iStrm) = lsl_istream(info{1});
      ses.add_stream(str(iStrm));
   end
   
   addlistener(str(1),'DataAvailable',@ev_listener);
   addlistener(str(2),'DataAvailable',@pl_listener);
   % addlistener(str(3),'DataAvailable',@ot_listener);
end

function ev_listener(src, event)
%    disp('ev_listener called')
   event
end

function pl_listener(src, event)
%    disp('pl_listener called');
%    event
end

function ot_listener(src, event)
%    disp('ot_listener called');
%    event
end

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % 
%                                                           %
%       Part of Programmeer Beer Toolbox (PBToolbox)        %
%       Written by: Jesse J. Heckman (2018)                 %
%                                                           %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %