/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef NMM_ISourceController_HPP
#define NMM_ISourceController_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/Interface.hpp"
#include "nmm/comm/messaging/Event.hpp"
#include "nmm/comm/messaging/IllegalStateException.hpp"
#include <memory>

#include "IController.hpp"

#include "visibility.hpp"

namespace NMM
{

  class ISourceSynchronizer;
  /** Interface of a source controller.
   * This is the interface of a controller which provides synchronization for a source node.
   */

  class DLLEXPORT ISourceController : virtual public IController { 
  public:
    ISourceController() : NMM::Interface(ISourceController::ISourceController_type, "NMM") { };

    ISourceController(NMM::NMMObject& parent) : NMM::Interface (parent, ISourceController::ISourceController_type, "NMM") { };

    virtual ~ISourceController() {};

    static const char* ISourceController_type;

    virtual  string getInterfaceType() const { return ISourceController_type; }

    NMM::Interface* copy() const { return new ISourceController(*this); }
    static void used(); 
    static const char* setMasterSkew_event;
    static const char* setStartTime_event;
    static const char* setSourceSynchronizer_event;
    static const char* setSyncMaster_event;
    /** Set the master skew.
     * This method sets the skew between audio and video output.
     * The video output is presented later than the audio output by the given skew interval.
     *
     * @param skew Master skew
     * @return SUCCESS
     */

    virtual void setMasterSkew(const Interval& skew)
      throw(const NMM::SerializedException&);
    /** Set the start time for this controller.
     * This method sets the start time for the controller. With the help of a start time, the nodes
     * can be told to start at e.g. 1 seconds after instantiating the Clock. This avoids scheduling
     * problems as one node would always be started some time after the other.
     */

    virtual void setStartTime(const Time& time)
      throw(const NMM::SerializedException&);
    /** Set the source synchronizer.
     * This method is called by the synchronizer when a controller has been added.
     * The controller uses the given interface to communicate with the synchronizer.
     *
     * @param value Interface to the synchronizer
     * @return SUCCESS
     */

    virtual Result setSourceSynchronizer(const ISourceSynchronizer* value)
      throw(const NMM::SerializedException&);
    /** Set whether this controller is the source synchronization master.
     * This method is called by the synchronizer when a controller has been added.
     *
     * @param master @c true if the controller is the source synchronization master, @c false otherwise
     */

    virtual void setSyncMaster(const nmm_bool& master)
      throw(const NMM::SerializedException&);


  };

  typedef auto_ptr<ISourceController> ISourceController_var;




}

#include "nmm/nmm_suffix.hpp"

#endif
