classdef Client < handle
    %This class is for internal use only. It may be removed in the future.

    %Client internal MAVLink client information that tracks component
    %identifications
    
    %   Copyright 2018-2020 The MathWorks, Inc.
    
    properties (SetAccess = private)
        %SystemID MAVLink System ID
        SystemID
        %ComponentID MAVLink Component ID
        ComponentID
    end
    
    properties
        %ComponentType MAVLink component type, could be Multirotor,
        %FixedWing, GCS, etc.
        ComponentType
        %AutopilotType MAVLink Autopilot type
        AutopilotType 
    end
    
    methods
        function obj = Client(sysid, compid, type, autopilot)
            %Client construct a MAVLink client instance
            
            narginchk(2,4);
            
            obj.SystemID = uint8(sysid);
            obj.ComponentID = uint8(compid);
            
            if nargin < 3
                % default type is set to unknown
                type = "Unknown";
            end
            
            if nargin < 4
                % default autopilot is set to unknown
                autopilot = "Unknown";
            end
            
            obj.ComponentType = type;
            obj.AutopilotType = autopilot;
        end
        
        function s = toStruct(obj)
            %toStruct converts this client into structure
            s = struct('SystemID', obj.SystemID, ...
                'ComponentID', obj.ComponentID, ...
                'ComponentType', obj.ComponentType, ...
                'AutopilotType', obj.AutopilotType);
        end
    end
    
end

