/DotsX/classes/hardware/@dXPMDHID/dXPMDHID.m
http://dotsx.googlecode.com/ · MATLAB · 1 lines · 1 code · 0 blank · 0 comment · 0 complexity · e9d14b27d474af20295007541e020457 MD5 · raw file
- function [p_, attributes_, batchMethods_] = dXPMDHID(num_objects)
% function [p_, attributes_, batchMethods_] = dXPMDHID(num_objects)
%
% Constructor method for class dXPMDHID
% works with PMD-1208FS/USB-1208FS USB/HID digital-analog converter box
%
% Input:
% num_objects ... ignored -- always creates just one
%
% Output:
% p_ ... created object
% attributes_ ... default object attributes
% batchMethods_ ... methods that can be run in a batch (e.g., draw)
% dependencies_ ... not used
% Copyright 2005 by Joshua I. Gold
% University of Pennsylvania
global ROOT_STRUCT
% look for mex function
available = exist('HIDx');
% return empty matrix if not available, which
% will automatically remove PMDHID devices from the ui queue
% if called from rInit
if isfield(ROOT_STRUCT, 'dXPMDHID') || ~available
p_ = [];
attributes_ = [];
batchMethods_ = [];
return
end
% how to find compatible device
% the master device of the PMD-1208FS/USB-1208FS composite device
HIDCriteria.manufacturer = 'MCC';
HIDCriteria.vendorID = 2523;
HIDCriteria.productID = 130;
HIDCriteria.totalElements = 89;
% default channelizer: make one useless channel
HIDChannelizer.gain = 1;
HIDChannelizer.offset = 0;
HIDChannelizer.high = nan;
HIDChannelizer.low = nan;
HIDChannelizer.delta = 0;
HIDChannelizer.freq = 1;
[resetReport, resetID] = formatPMDReport('Reset');
% default object attributes
attributes = { ...
% name type ranges(?) default
'available', 'boolean', [], available; ...
'active', 'boolean', [], false; ...
'FIRAdataType', 'string', [], 'PMDHIDData'; ...
'HIDClass', 'string', [], 'dXPMDHID'; ...
'HIDCriteria', 'struct', [], HIDCriteria; ...
'HIDChannelizer','struct', [], HIDChannelizer; ...
'HIDIndex', 'scalar', [], nan; ...
'HIDDeviceInfo','struct', [], []; ...
'HIDElementsInfo','struct', [], []; ...
'resetID', 'scalar', [], resetID; ...
'resetReport', 'uint8', [], resetReport;...
'loadID', 'scalar', [], []; ...
'loadReport', 'uint8', [], []; ...
'startID', 'scalar', [], []; ...
'startReport', 'uint8', [], []; ...
'stopID', 'scalar', [], []; ...
'stopReport', 'uint8', [], []; ...
'mappings', 'cell', [], []; ...
'startScanTime','auto', [], 0; ...
'offsetTime', 'auto', [], 0; ...
'default', 'auto', [], []; ...
'other', 'auto', [], []; ...
'checkList', 'auto', [], []; ...
'checkRet', 'auto', [], []; ...
'values', 'auto', [], []; ...
'recentVal', 'auto', [], 1};
% make an array of objects from structs made from the attributes
p_ = class(cell2struct(attributes(:,4), attributes(:,1), 1), 'dXPMDHID');
% return the attributes, if necessary
if nargout > 1
attributes_ = attributes;
end
% return list of batch methods
if nargout > 2
batchMethods_ = {'reset', 'saveToFIRA', 'root', 'getJump'};
end