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

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

% Authors: JDP
% Copyright 2009-2010 The MathWorks, Inc.

methods
    
    function obj = ChannelInfo(channelIndex)
    % ChannelInfo Construct an object containing information on a Kvaser device channel.
        
        % Get the channel data for the given channel index.
        channelData = can.kvaser.CANLib.canGetChannelData(channelIndex);
        
        % Set the device name based on its type and an adjusted
        % device index.
        device = [can.kvaser.Utility.translateDeviceName(channelData.DeviceName) ...
            ' ' num2str(channelData.CardNumber + 1)];
        
        % Set the adjusted device channel index.
        deviceChannelIndex = channelData.ChannelNumberOnCard + 1;
        
        % Set the serial number.
        deviceSerialNumber = channelData.CardSerialNumber;
        
        % Set the constructor string for this channel.
        objectConstructor = ['canChannel(''Kvaser'', ''' device ''', ' num2str(deviceChannelIndex) ')'];
        
        % Call the superclass constructor.
        obj@can.ChannelInfo(...
            device,...
            deviceChannelIndex,...
            deviceSerialNumber,...
            objectConstructor);
    end
    
end
    
end