This file is indexed.

/usr/share/psychtoolbox-3/PsychHardware/iViewXToolbox/iViewX.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 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
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
function [result, ivx]=iViewX(cstr, ivx, params)

% USAGE: [result, ivx]=iViewX(cstr, ivx [, params])
%
% iViewX requires as input:
% 1. a command string
% 2. a structure with iViewX default values.
% cstr:  command to execute
% ivx: structure holding default information
% params: optional parameters to pass on with the command
%
% returns:
% result: any result produced by the command
% ivx: structure with default information (that may have been modified)

% History
% 011204    fwc added additional commands based on manual
% 020105    fwc added sendcalibrationpoints

result=-1;

if ~exist('cstr', 'var') || isempty(cstr)
    %     txt=[ mfilename ' requires a command string as input.'];
    %     error(txt);
    help iViewX
    return
end

switch lower(cstr)
    case {'help', '?'},
        help iViewX
        return
end

if ~exist('ivx', 'var') || isempty(ivx)
    txt=[ mfilename ' requires a structure with iViewX default values as input.'];
    error(txt);
end

if ~exist('params', 'var') || isempty(params)
    params=[];
end

switch lower(cstr)
    case 'command',
        % --> check that input is a text string
        % send string as command
        result=iViewXComm('send', ivx, params);
        %     case 'initialize',
        %         [result, ivx]=iViewXComm('open', ivx);
    % connecting
    case 'openconnection',
        [result, ivx]=iViewXComm('open', ivx);
    case 'closeconnection',
        [result, ivx]=iViewXComm('close', ivx);
    case 'checkconnection',
        [result, ivx]=iViewXComm('check', ivx);
    case 'receivedata',
        % check port for commands or gaze data from iView
        [result, ivx]=iViewXComm('receive', ivx);   
    case 'datafile',
        % saves current data buffer content to a datafile. Data is saved in
        % binary format. Use the IDF Converter to convert to ASCII format. 
        % If the given filename already exists, the existing
        % file will not be overwritten and the command is not executed.
        % params should contain a datafile
        result=iViewXComm('send', ivx, ['ET_SAV ' params]);
    % calibration
    case 'calibrate',
        [result, ivx]=iViewXCalibrate(ivx);
    case {'cancelcalibration', 'break'},
        result=iViewXComm('send', ivx, 'ET_BRK');
    case 'defaultcalibrationpoints',
        result=iViewXComm('send', ivx, 'ET_DEF'); % restores default calibration positions
    case 'sendcalibrationpoints',
        % we could check for the presence of the ivx.absCalPos array
        for i=1:ivx.nCalPoints
            message=['ET_PNT ' num2str(i) ' ' num2str(ivx.absCalPos(i,1)) ' ' num2str(ivx.absCalPos(i,2))];
%             message
            result=iViewXComm('send', ivx, message);
        end
    case 'setpoint',
        % params should contain three digits, 
        % point number, x and y locations
        result=iViewXComm('send', ivx, ['ET_PNT ' num2str(params(1)) ' ' num2str(params(2)) ' ' num2str(params(3))]);

    case 'setcalibration',
        % send calibration type
        % check params contains a single valid digit
        result=iViewXComm('send', ivx, ['ET_CAL ' num2str(params)]);
        %     case 'getcalibrationpoints',
        %         [result, ivx]=iViewXGetCalibrationPoints(ivx); 
    case {'setscreensize', 'setcalibrationarea'},
        % send screen size
        if ~isempty(ivx.window)
            [ivx.screenHSize, ivx.screenVSize]=WindowSize(ivx.window);
        end
        message=['ET_CSZ ' num2str(ivx.screenHSize) ' ' num2str(ivx.screenVSize) ];
        % check params contains a single valid digit
        result=iViewXComm('send', ivx, message);
    case 'accept',
        result=iViewXComm('send', ivx, 'ET_ACC');
    case 'setchecklevel',
        % params should contain a single digit, the new level
        % runs from 0 (weak) to 3 (strong)
        result=iViewXComm('send', ivx, ['ET_LEV ' num2str(params)]);
    case 'driftcorrection',
        result=iViewXComm('send', ivx, 'ET_RCL');
        % this must require more, probably a routine similar to calibration
%         % params can hold position for drift correction
%         [result, ivx]=iViewXDriftCorrection(ivx, params);
    case 'validation',
        fprintf('%s: Sorry, command ''%s'' not implemented yet.\n', mfilename, command );
% recording
    case 'startrecording',
        result=iViewXComm('send', ivx, 'ET_REC');
    case 'pauserecording',
        result=iViewXComm('send', ivx, 'ET_PSE');
    case 'continuerecording',
        result=iViewXComm('send', ivx, 'ET_CNT');
    case 'stoprecording',
        result=iViewXComm('send', ivx, 'ET_STP');
    case 'clearbuffer',
        result=iViewXComm('send', ivx, 'ET_CLR');
    case 'incrementsetnumber',
        % params should contain a single digit, the new set number
        result=iViewXComm('send', ivx, ['ET_INC ' num2str(params)]); 
% streaming
    case 'datastreamingon',
        result=iViewXComm('send', ivx, 'ET_STR');
        % we could/should include ability to specify subsampling
    case 'datastreamingoff',
        result=iViewXComm('send', ivx, 'ET_EST');
    case 'setdataformat',
        % set data format for streaming output
        result=iViewXComm('send', ivx, ['ET_FRM ' params ]);
% drawing
    case 'erasescreen',
        iViewXEraseScreen(ivx);
    case 'drawcalibrationpoint',
        % check params should contain two valid ints
        % that are within the screen bounds
        iViewXDrawCalibrationPoint(ivx, params);
 % miscellaneous
    case 'sendconfiguration',
        result=iViewXComm('send', ivx, 'ET_CFG');
        % not very useful in this manner, as we need to read it out of
        % course
    % message
    case 'message',
        % --> check that input is single text string
        result=iViewXComm('send', ivx, ['ET_REM ' params ]);
    case 'auxdata',
        % --> check that input is single text string
        result=iViewXComm('send', ivx, ['ET_AUX ' params ]);
    case 'loadbitmap',
        % --> check that input is a file location on iviewx
        result=iViewXComm('send', ivx, ['ET_BMP ' params ]);
otherwise,

        fprintf('%s: unknown command ''%s''\n', mfilename, command );
end

%---------------------------

% function result=iViewXSend(ivx, sendstr)
%
% switch ivx.connection
%     case 1, % ethernet
%
%         % open udp connection, and send command string
%         % if this is too time consuming, we should open a port and keep it open
%         % for the time of the experiment
%         % code stolen from udp_send_demo.m
%         result=-1;
%         udp=pnet('udpsocket',ivx.socket);
%         if udp~=-1,
%             try, % Failsafe
%                 pnet(udp,'udpconnect',ivx.host,ivx.port);
%                 %         [ip,port]=pnet(udp,'gethost')
%                 %         stat=pnet(udp,'status')
%                 pnet(udp,'write',[sendstr char(10)]);        % Write to write buffer
%                 pnet(udp,'writepacket',ivx.host,ivx.port);   % Send buffer as UDP packet
%
%             catch,
%                 pnet('closeall');
%                 disp(lasterr)
%             end
%             %     [ip,port]=pnet(udp,'gethost')
%             %     stat=pnet(udp,'status')
%             pnet(udp,'close');
%             result=1;
%         end
%
%     case 2,
%         % assume we use serial communication
%         error([mfilename ': serial communication not implemented yet']);
%
%
%     otherwise,
%         error([mfilename ': unknown connection type']);
% end
%

% ET_ACC  accepts calibration point
% ET_BRK  cancels calibration
% ET_CAL  starts calibration
% ET_CHG  indicates calibration point change
% ET_CSZ  sets size of calibration area
% ET_DEF  resets calibration points to default positions
% ET_FIN  indicates end of calibration
% ET_LEV  sets check level for calibration
% ET_PNT  sets position of calibration point
% ET_RCL  starts drift correction