/* 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_ICDDA_HPP
#define NMM_ICDDA_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 "nmm/multimedia/IDevice.hpp"

#include "visibility.hpp"

namespace NMM
{
  /** Interface for configuring and managing playback of audio cds.
   */  

  class DLLEXPORT ICDDA : virtual public IDevice { 
  public:
    ICDDA() : NMM::Interface(ICDDA::ICDDA_type, "NMM") { };

    ICDDA(NMM::NMMObject& parent) : NMM::Interface (parent, ICDDA::ICDDA_type, "NMM") { };

    virtual ~ICDDA() {};

    static const char* ICDDA_type;

    virtual  string getInterfaceType() const { return ICDDA_type; }

    NMM::Interface* copy() const { return new ICDDA(*this); }
    static void used(); 
    static const char* setTrack_event;
    static const char* getTrack_event;
    static const char* getTotalTracks_event;
    static const char* numberTracks_event;
    static const char* getTrackDuration_event;
    static const char* getTotalDuration_event;
    static const char* isFinished_event;
    static const char* setRepeat_event;
    static const char* getRepeat_event;
    static const char* setOneTrackOnly_event;
    static const char* getOneTrackOnly_event;
    /** Sets track to play.
     *  @param track id of track to be played
     *  @return SUCCESS if setting of track number was successful, FAILURE otherwise.
     *
     */

    virtual Result setTrack(const nmm_int32& track)
      throw(const NMM::SerializedException&);
    /** Returns track to play.
     *
     * @return Number of current track.
     */

    virtual nmm_int32 getTrack()
      throw(const NMM::SerializedException&);
     /** Returns total number of tracks.
     *
     * @return Total number of tracks.
     */

    virtual nmm_int32 getTotalTracks()
      throw(const NMM::SerializedException&);

    virtual void numberTracks(const nmm_bool& number)
      throw(const NMM::SerializedException&);
    /**
     *  @brief get duration of track with given id
     *  @param id of track
     *  @return duration of track with id given as parameter
     *
     */

    virtual Interval getTrackDuration(const nmm_int32& track)
      throw(const NMM::SerializedException&);
    /**
     *  @brief get duration of complete CD
     *  @return duration of complete CD
     *
     */

    virtual Interval getTotalDuration()
      throw(const NMM::SerializedException&);
    /** Tests if playback is finished.
     *
     * @return True if playback of current CD is enabled, false otherwise.
     */

    virtual nmm_bool isFinished()
      throw(const NMM::SerializedException&);
     /** Switches repeat mode on/off.
     *
     *  @param  repeat If true repeat mode gets enabled and disabled otherwise.
     *
     * If repeat mode and oneTrackOnly mode are enabled, repeat this track infinitely.
     * If repeat mode is enabled and oneTrackOnly mode is disabled, repeat the complete CD.
     */

    virtual void setRepeat(const nmm_bool& repeat)
      throw(const NMM::SerializedException&);
     /** Returns repeat mode state.
     *
     * @return True if repeat mode is enabled, false otherwise.
     */

    virtual nmm_bool getRepeat()
      throw(const NMM::SerializedException&);
     /** Switches status of one track only mode.
     *
     * If one track only mode is enabled, playback stops after playback of current track.
     *
     * @param enable True if one track only is enabled, false otherwise.
     */

    virtual void setOneTrackOnly(const nmm_bool& enable)
      throw(const NMM::SerializedException&);
     /** Returns state of one track only mode.
     *
     * @return true if one track only is enabled, false otherwise.
     */

    virtual nmm_bool getOneTrackOnly()
      throw(const NMM::SerializedException&);


  };

  typedef auto_ptr<ICDDA> ICDDA_var;




}

#include "nmm/nmm_suffix.hpp"

#endif
