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

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

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

properties (GetAccess = 'public', SetAccess = 'private')
    DeviceType
    TransceiverType
end

methods
    
    function obj = ChannelInfo(channelIndex)
        % ChannelInfo Construct an object containing information on an NI-XNET device channel.
        
        % Get the channel data.
        channels = can.ni.xnet.Utility.getAllChannelInfo();
        
        % Set the device name based on its type.
        device = channels(channelIndex).Interface.Name;
        
        % Set the adjusted device channel index.
        deviceChannelIndex = channels(channelIndex).Interface.PortNumber;
        
        % Set the serial number.
        deviceSerialNumber = dec2hex(channels(channelIndex).Device.SerialNumber);
        
        % Set the constructor string for this channel.
        objectConstructor = ['canChannel(''NI'', ''' device ''')'];
        
        % Call the superclass constructor.
        obj@can.ChannelInfo(...
            device,...
            deviceChannelIndex,...
            deviceSerialNumber,...
            objectConstructor);
        
        % Set the other properties.
        obj.DeviceType = channels(channelIndex).Device.ProductName;
        obj.TransceiverType = channels(channelIndex).Interface.TransceiverCapability;
    end
    
    function display(obj)
        % display Display array.
        
        % Display is overridden to prevent the 'var =' screen print in
        % general and especially for invalid objects.
        disp(obj);
    end
    
end
    
end