www.gusucode.com > ros 工具箱 matlab源码程序 > ros/+robotics/+ros/+msggen/+mavros/RadioStatus.m

    classdef RadioStatus < robotics.ros.Message
    %RadioStatus MATLAB implementation of mavros/RadioStatus
    %   This class was automatically generated by
    %   robotics.ros.msg.internal.gen.MessageClassGenerator.
    
    %   Copyright 2014-2016 The MathWorks, Inc.
    
    %#ok<*INUSD>
    
    properties (Constant)
        MessageType = 'mavros/RadioStatus' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = '6f756e25cbec426b98a822e4ecb53638' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant, Access = protected)
        StdMsgsHeaderClass = robotics.ros.msg.internal.MessageFactory.getClassForType('std_msgs/Header') % Dispatch to MATLAB class for message type std_msgs/Header
    end
    
    properties (Dependent)
        Header
        Rssi
        Remrssi
        Txbuf
        Noise
        Remnoise
        Rxerrors
        Fixed
    end
    
    properties (Access = protected)
        Cache = struct('Header', []) % The cache for fast data access
    end
    
    properties (Constant, Hidden)
        PropertyList = {'Fixed', 'Header', 'Noise', 'Remnoise', 'Remrssi', 'Rssi', 'Rxerrors', 'Txbuf'} % List of non-constant message properties
        ROSPropertyList = {'fixed', 'header', 'noise', 'remnoise', 'remrssi', 'rssi', 'rxerrors', 'txbuf'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = RadioStatus(msg)
            %RadioStatus Construct the message object RadioStatus
            import com.mathworks.toolbox.robotics.ros.message.MessageInfo;
            
            % Support default constructor
            if nargin == 0
                obj.JavaMessage = obj.createNewJavaMessage;
                return;
            end
            
            % Construct appropriate empty array
            if isempty(msg)
                obj = obj.empty(0,1);
                return;
            end
            
            % Make scalar construction fast
            if isscalar(msg)
                % Check for correct input class
                if ~MessageInfo.compareTypes(msg(1), obj.MessageType)
                    error(message('robotics:ros:message:NoTypeMatch', obj.MessageType, ...
                        char(MessageInfo.getType(msg(1))) ));
                end
                obj.JavaMessage = msg(1);
                return;
            end
            
            % Check that this is a vector of scalar messages. Since this
            % is an object array, use arrayfun to verify.
            if ~all(arrayfun(@isscalar, msg))
                error(message('robotics:ros:message:MessageArraySizeError'));
            end
            
            % Check that all messages in the array have the correct type
            if ~all(arrayfun(@(x) MessageInfo.compareTypes(x, obj.MessageType), msg))
                error(message('robotics:ros:message:NoTypeMatchArray', obj.MessageType));
            end
            
            % Construct array of objects if necessary
            objType = class(obj);
            for i = 1:length(msg)
                obj(i,1) = feval(objType, msg(i)); %#ok<AGROW>
            end
        end
        
        function header = get.Header(obj)
            %get.Header Get the value for property Header
            if isempty(obj.Cache.Header)
                obj.Cache.Header = feval(obj.StdMsgsHeaderClass, obj.JavaMessage.getHeader);
            end
            header = obj.Cache.Header;
        end
        
        function set.Header(obj, header)
            %set.Header Set the value for property Header
            validateattributes(header, {obj.StdMsgsHeaderClass}, {'nonempty', 'scalar'}, 'RadioStatus', 'Header');
            
            obj.JavaMessage.setHeader(header.getJavaObject);
            
            % Update cache if necessary
            if ~isempty(obj.Cache.Header)
                obj.Cache.Header.setJavaObject(header.getJavaObject);
            end
        end
        
        function rssi = get.Rssi(obj)
            %get.Rssi Get the value for property Rssi
            rssi = typecast(int8(obj.JavaMessage.getRssi), 'uint8');
        end
        
        function set.Rssi(obj, rssi)
            %set.Rssi Set the value for property Rssi
            validateattributes(rssi, {'numeric'}, {'nonempty', 'scalar'}, 'RadioStatus', 'Rssi');
            
            obj.JavaMessage.setRssi(rssi);
        end
        
        function remrssi = get.Remrssi(obj)
            %get.Remrssi Get the value for property Remrssi
            remrssi = typecast(int8(obj.JavaMessage.getRemrssi), 'uint8');
        end
        
        function set.Remrssi(obj, remrssi)
            %set.Remrssi Set the value for property Remrssi
            validateattributes(remrssi, {'numeric'}, {'nonempty', 'scalar'}, 'RadioStatus', 'Remrssi');
            
            obj.JavaMessage.setRemrssi(remrssi);
        end
        
        function txbuf = get.Txbuf(obj)
            %get.Txbuf Get the value for property Txbuf
            txbuf = typecast(int8(obj.JavaMessage.getTxbuf), 'uint8');
        end
        
        function set.Txbuf(obj, txbuf)
            %set.Txbuf Set the value for property Txbuf
            validateattributes(txbuf, {'numeric'}, {'nonempty', 'scalar'}, 'RadioStatus', 'Txbuf');
            
            obj.JavaMessage.setTxbuf(txbuf);
        end
        
        function noise = get.Noise(obj)
            %get.Noise Get the value for property Noise
            noise = typecast(int8(obj.JavaMessage.getNoise), 'uint8');
        end
        
        function set.Noise(obj, noise)
            %set.Noise Set the value for property Noise
            validateattributes(noise, {'numeric'}, {'nonempty', 'scalar'}, 'RadioStatus', 'Noise');
            
            obj.JavaMessage.setNoise(noise);
        end
        
        function remnoise = get.Remnoise(obj)
            %get.Remnoise Get the value for property Remnoise
            remnoise = typecast(int8(obj.JavaMessage.getRemnoise), 'uint8');
        end
        
        function set.Remnoise(obj, remnoise)
            %set.Remnoise Set the value for property Remnoise
            validateattributes(remnoise, {'numeric'}, {'nonempty', 'scalar'}, 'RadioStatus', 'Remnoise');
            
            obj.JavaMessage.setRemnoise(remnoise);
        end
        
        function rxerrors = get.Rxerrors(obj)
            %get.Rxerrors Get the value for property Rxerrors
            rxerrors = typecast(int16(obj.JavaMessage.getRxerrors), 'uint16');
        end
        
        function set.Rxerrors(obj, rxerrors)
            %set.Rxerrors Set the value for property Rxerrors
            validateattributes(rxerrors, {'numeric'}, {'nonempty', 'scalar'}, 'RadioStatus', 'Rxerrors');
            
            obj.JavaMessage.setRxerrors(rxerrors);
        end
        
        function fixed = get.Fixed(obj)
            %get.Fixed Get the value for property Fixed
            fixed = typecast(int16(obj.JavaMessage.getFixed), 'uint16');
        end
        
        function set.Fixed(obj, fixed)
            %set.Fixed Set the value for property Fixed
            validateattributes(fixed, {'numeric'}, {'nonempty', 'scalar'}, 'RadioStatus', 'Fixed');
            
            obj.JavaMessage.setFixed(fixed);
        end
    end
    
    methods (Access = protected)
        function resetCache(obj)
            %resetCache Resets any cached properties
            obj.Cache.Header = [];
        end
        
        function cpObj = copyElement(obj)
            %copyElement Implements deep copy behavior for message
            
            % Call default copy method for shallow copy
            cpObj = copyElement@robotics.ros.Message(obj);
            
            % Clear any existing cached properties
            cpObj.resetCache;
            
            % Create a new Java message object
            cpObj.JavaMessage = obj.createNewJavaMessage;
            
            % Iterate over all primitive properties
            cpObj.Rssi = obj.Rssi;
            cpObj.Remrssi = obj.Remrssi;
            cpObj.Txbuf = obj.Txbuf;
            cpObj.Noise = obj.Noise;
            cpObj.Remnoise = obj.Remnoise;
            cpObj.Rxerrors = obj.Rxerrors;
            cpObj.Fixed = obj.Fixed;
            
            % Recursively copy compound properties
            cpObj.Header = copy(obj.Header);
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.Rssi = strObj.Rssi;
            obj.Remrssi = strObj.Remrssi;
            obj.Txbuf = strObj.Txbuf;
            obj.Noise = strObj.Noise;
            obj.Remnoise = strObj.Remnoise;
            obj.Rxerrors = strObj.Rxerrors;
            obj.Fixed = strObj.Fixed;
            obj.Header = feval([obj.StdMsgsHeaderClass '.loadobj'], strObj.Header);
        end
    end
    
    methods (Access = ?robotics.ros.Message)
        function strObj = saveobj(obj)
            %saveobj Implements saving of message to MAT file
            
            % Return an empty element if object array is empty
            if isempty(obj)
                strObj = struct.empty;
                return
            end
            
            strObj.Rssi = obj.Rssi;
            strObj.Remrssi = obj.Remrssi;
            strObj.Txbuf = obj.Txbuf;
            strObj.Noise = obj.Noise;
            strObj.Remnoise = obj.Remnoise;
            strObj.Rxerrors = obj.Rxerrors;
            strObj.Fixed = obj.Fixed;
            strObj.Header = saveobj(obj.Header);
        end
    end
    
    methods (Static, Access = {?matlab.unittest.TestCase, ?robotics.ros.Message})
        function obj = loadobj(strObj)
            %loadobj Implements loading of message from MAT file
            
            % Return an empty object array if the structure element is not defined
            if isempty(strObj)
                obj = robotics.ros.msggen.mavros.RadioStatus.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.mavros.RadioStatus;
            obj.reload(strObj);
        end
    end
end