classdef RTIOStreamAppSvc < coder.internal.connectivity.TgtConnAppSvc
    % RTIOStreamAppSvc - Implements the rtIOStream Application Service for
    % Target Connectivity (see coder.internal.connectivity.TgtConnMgr for 
    % more information).
    %
    
    % Copyright 2015-2017 The MathWorks, Inc.
    
    properties(Access=public)
        topModelName;
    end
    
    % Service objects should only be instantiated by TgtConnMgr at build-time.
    %
    methods(Access={?coder.internal.connectivity.TgtConnMgr})
        function obj = RTIOStreamAppSvc()
            [topMdlName, ~] = coder.internal.connectivity.TgtConnMgr.getTopModelAndBuildArgs();
            obj.topModelName = topMdlName;
        end
    end
    
    methods(Access=public)
        function isNeeded = isNeeded(obj) %#ok            
            [topMdlName, topMdlBuildArgs] = coder.internal.connectivity.TgtConnMgr.getTopModelAndBuildArgs();
            isMdlRefBuild = ~strcmp(topMdlBuildArgs.ModelReferenceTargetType, 'NONE');
                  
            isSupportedCoderTarget = ~isempty(topMdlName) && ...
							codertarget.attributes.supportTargetServicesFeature(topMdlName, 'RTIOStreamAppSvc');
            
            isNeeded = ~isMdlRefBuild && isSupportedCoderTarget;
        end
        
        function setupBeforeTLC(obj, mdl) %#ok
        end
        
        function cleanupAfterTLC(obj, mdl) %#ok
        end
        
        function codeStr = getIncludesAndDefinesCode(obj) %#ok
            codeStr = '';
        end
        
        function codeStr = getBackgroundTaskCode(obj) %#ok
            codeStr = '';
        end
        
        function codeStr = getMdlInitCode(obj) %#ok
            codeStr = '';
        end
        
        function codeStr = getMdlTermCode(obj) %#ok
            codeStr = '';
        end
        
        function codeStr = getPreStepCode(obj) %#ok
            codeStr = '';
        end
        
        function codeStr = getPostStepCode(obj) %#ok
            codeStr = '';
        end
        
        function start(obj, argMap) %#ok
            coder.internal.connectivity.ConnectRTIOStreamAppSvc(...
                obj.tgtConnMgr.getTargetConnection());
        end
        
        function stop(obj) %#ok
        end
    end
end
