gusucode.com > vnt工具箱matlab源码程序 > vnt/vnt/+can/+vector/ChannelInfo.m

    classdef (Hidden) ChannelInfo < can.ChannelInfo
% ChannelInfo Retrieve channel specific Vector CAN device information.
%
%   This class contains information pertaining to a specific channel on
%   a Vector CAN device. This information includes data needed 
%   to access and use the channel.
%
%   See also VNT.

% Authors: JDP
% Copyright 2007-2013 The MathWorks, Inc.

methods
    
    function obj = ChannelInfo(vendorDriverData)
    % ChannelInfo Construct an object containing information on a Vector device channel.
        
        % Retrieve the device name in string form.
        deviceString = can.vector.Utility.deviceCodeToString(vendorDriverData.hwType);
        
        % Set the device name based on its type and index. Also adjust
        % indexing as the Vector devices indexes begin at 0.
        device = [deviceString ' ' num2str(vendorDriverData.hwIndex + 1)];
        
        % Set the channel index and adjust indexing. Note that the index
        % should not be adjusted for VN8900 devices as they have a stream
        % channel for channel 0. If we do not halt the increment
        % adjustment, the channel numbers reported will not match up with
        % the channel numbers printed on the device.
        if vendorDriverData.hwType == 45
            deviceChannelIndex = vendorDriverData.hwChannel;
        else
            deviceChannelIndex = vendorDriverData.hwChannel + 1;
        end
        
        % Set the serial number.
        deviceSerialNumber = vendorDriverData.serialNumber;
        
        % Set the constructor string for this channel.
        objectConstructor = ['canChannel(''Vector'', ''' device ''', ' num2str(deviceChannelIndex) ')'];
        
        % Call the superclass constructor.
        obj@can.ChannelInfo(...
            device,...
            deviceChannelIndex,...
            deviceSerialNumber,...
            objectConstructor);
    end
    
end
    
end