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

    classdef GNSSChannelStatus < robotics.ros.Message
    %GNSSChannelStatus MATLAB implementation of applanix_msgs/GNSSChannelStatus
    %   This class was automatically generated by
    %   robotics.ros.msg.internal.gen.MessageClassGenerator.
    
    %   Copyright 2014-2016 The MathWorks, Inc.
    
    %#ok<*INUSD>
    
    properties (Constant)
        MessageType = 'applanix_msgs/GNSSChannelStatus' % The ROS message type
    end
    
    properties (Constant, Hidden)
        MD5Checksum = 'e704e6e58bbc7d5b1e03c4dc44b6ebbf' % The MD5 Checksum of the message definition
    end
    
    properties (Access = protected)
        JavaMessage % The Java message object
    end
    
    properties (Constant)
        STATUSL1IDLE = uint16(0)
        STATUSL1ACQUISITION = uint16(1)
        STATUSL1CODELOCK = uint16(3)
        STATUSL1PHASELOCK = uint16(5)
        STATUSL2IDLE = uint16(6)
        STATUSL2ACQUISITION = uint16(8)
        STATUSL2CODELOCK = uint16(9)
        STATUSL2PHASELOCK = uint16(11)
    end
    
    properties (Dependent)
        SvPrn
        Status
        SvAzimuth
        SvElevation
        SvL1Snr
        SvL2Snr
    end
    
    properties (Constant, Hidden)
        PropertyList = {'Status', 'SvAzimuth', 'SvElevation', 'SvL1Snr', 'SvL2Snr', 'SvPrn'} % List of non-constant message properties
        ROSPropertyList = {'status', 'sv_azimuth', 'sv_elevation', 'sv_l1_snr', 'sv_l2_snr', 'sv_prn'} % List of non-constant ROS message properties
    end
    
    methods
        function obj = GNSSChannelStatus(msg)
            %GNSSChannelStatus Construct the message object GNSSChannelStatus
            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 svprn = get.SvPrn(obj)
            %get.SvPrn Get the value for property SvPrn
            svprn = typecast(int16(obj.JavaMessage.getSvPrn), 'uint16');
        end
        
        function set.SvPrn(obj, svprn)
            %set.SvPrn Set the value for property SvPrn
            validateattributes(svprn, {'numeric'}, {'nonempty', 'scalar'}, 'GNSSChannelStatus', 'SvPrn');
            
            obj.JavaMessage.setSvPrn(svprn);
        end
        
        function status = get.Status(obj)
            %get.Status Get the value for property Status
            status = typecast(int16(obj.JavaMessage.getStatus), 'uint16');
        end
        
        function set.Status(obj, status)
            %set.Status Set the value for property Status
            validateattributes(status, {'numeric'}, {'nonempty', 'scalar'}, 'GNSSChannelStatus', 'Status');
            
            obj.JavaMessage.setStatus(status);
        end
        
        function svazimuth = get.SvAzimuth(obj)
            %get.SvAzimuth Get the value for property SvAzimuth
            svazimuth = single(obj.JavaMessage.getSvAzimuth);
        end
        
        function set.SvAzimuth(obj, svazimuth)
            %set.SvAzimuth Set the value for property SvAzimuth
            validateattributes(svazimuth, {'numeric'}, {'nonempty', 'scalar'}, 'GNSSChannelStatus', 'SvAzimuth');
            
            obj.JavaMessage.setSvAzimuth(svazimuth);
        end
        
        function svelevation = get.SvElevation(obj)
            %get.SvElevation Get the value for property SvElevation
            svelevation = single(obj.JavaMessage.getSvElevation);
        end
        
        function set.SvElevation(obj, svelevation)
            %set.SvElevation Set the value for property SvElevation
            validateattributes(svelevation, {'numeric'}, {'nonempty', 'scalar'}, 'GNSSChannelStatus', 'SvElevation');
            
            obj.JavaMessage.setSvElevation(svelevation);
        end
        
        function svl1snr = get.SvL1Snr(obj)
            %get.SvL1Snr Get the value for property SvL1Snr
            svl1snr = single(obj.JavaMessage.getSvL1Snr);
        end
        
        function set.SvL1Snr(obj, svl1snr)
            %set.SvL1Snr Set the value for property SvL1Snr
            validateattributes(svl1snr, {'numeric'}, {'nonempty', 'scalar'}, 'GNSSChannelStatus', 'SvL1Snr');
            
            obj.JavaMessage.setSvL1Snr(svl1snr);
        end
        
        function svl2snr = get.SvL2Snr(obj)
            %get.SvL2Snr Get the value for property SvL2Snr
            svl2snr = single(obj.JavaMessage.getSvL2Snr);
        end
        
        function set.SvL2Snr(obj, svl2snr)
            %set.SvL2Snr Set the value for property SvL2Snr
            validateattributes(svl2snr, {'numeric'}, {'nonempty', 'scalar'}, 'GNSSChannelStatus', 'SvL2Snr');
            
            obj.JavaMessage.setSvL2Snr(svl2snr);
        end
    end
    
    methods (Access = protected)
        function cpObj = copyElement(obj)
            %copyElement Implements deep copy behavior for message
            
            % Call default copy method for shallow copy
            cpObj = copyElement@robotics.ros.Message(obj);
            
            % Create a new Java message object
            cpObj.JavaMessage = obj.createNewJavaMessage;
            
            % Iterate over all primitive properties
            cpObj.SvPrn = obj.SvPrn;
            cpObj.Status = obj.Status;
            cpObj.SvAzimuth = obj.SvAzimuth;
            cpObj.SvElevation = obj.SvElevation;
            cpObj.SvL1Snr = obj.SvL1Snr;
            cpObj.SvL2Snr = obj.SvL2Snr;
        end
        
        function reload(obj, strObj)
            %reload Called by loadobj to assign properties
            obj.SvPrn = strObj.SvPrn;
            obj.Status = strObj.Status;
            obj.SvAzimuth = strObj.SvAzimuth;
            obj.SvElevation = strObj.SvElevation;
            obj.SvL1Snr = strObj.SvL1Snr;
            obj.SvL2Snr = strObj.SvL2Snr;
        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.SvPrn = obj.SvPrn;
            strObj.Status = obj.Status;
            strObj.SvAzimuth = obj.SvAzimuth;
            strObj.SvElevation = obj.SvElevation;
            strObj.SvL1Snr = obj.SvL1Snr;
            strObj.SvL2Snr = obj.SvL2Snr;
        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.applanix_msgs.GNSSChannelStatus.empty(0,1);
                return
            end
            
            % Create an empty message object
            obj = robotics.ros.msggen.applanix_msgs.GNSSChannelStatus;
            obj.reload(strObj);
        end
    end
end