tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / MMPlayer / IManager.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 #ifndef WRTDEVICEAPIS_MMPLAYER_IMANAGER_H_
17 #define WRTDEVICEAPIS_MMPLAYER_IMANAGER_H_
18
19 #include <dpl/noncopyable.h>
20 #include <MMPlayer/EventOpen.h>
21 #include <MMPlayer/EventPlay.h>
22 #include <MMPlayer/EventPause.h>
23 #include <MMPlayer/EventResume.h>
24 #include <MMPlayer/EventStop.h>
25 #include <MMPlayer/EventIsPlaying.h>
26 #include <MMPlayer/EventSetWindow.h>
27 #include <MMPlayer/EventGetVolume.h>
28
29 namespace WrtDeviceApis {
30 namespace MMPlayer {
31 namespace Api {
32
33 class IManager :
34     public Commons::EventRequestReceiver<EventOpen>,
35     public Commons::EventRequestReceiver<EventPlay>,
36     public Commons::EventRequestReceiver<EventPause>,
37     public Commons::EventRequestReceiver<EventResume>,
38     public Commons::EventRequestReceiver<EventStop>,
39     public Commons::EventRequestReceiver<EventIsPlaying>,
40     public Commons::EventRequestReceiver<EventSetWindow>,
41     public Commons::EventRequestReceiver<EventGetVolume>
42 {
43   public:
44     static IManager &getInstance();
45     virtual ~IManager();
46
47     /**
48      * Opens a file
49      * @param event @see WrtDeviceApis::Api::MMPlayer::EventOpen.
50      * @exception Commons::PlatformException when platform error occurs
51      */
52     virtual void openFile(const EventOpenPtr& event) = 0;
53     /**
54      * Plays current file. If file is already playing player starts from the beginning
55      * @param event @see WrtDeviceApis::Api::MMPlayer::EventPlay.
56      * @exception Commons::PlatformException when platform error occurs
57      */
58     virtual void play(const EventPlayPtr& event) = 0;
59     /**
60      * Pauses current playing file. If no file is currently playing noting happens
61      * @param event @see WrtDeviceApis::Api::MMPlayer::EventPause.
62      * @exception Commons::PlatformException when platform error occurs
63      * @exception Commons::InvalidArgumentException when fileName is empty
64      */
65     virtual void pause(const EventPausePtr& event) = 0;
66     /**
67      * Resumes after pause. If file is not paused nothing happens
68      * @param event @see WrtDeviceApis::Api::MMPlayer::EventResume.
69      * @exception Commons::PlatformException when platform error occurs
70      */
71     virtual void resume(const EventResumePtr& event) = 0;
72     /**
73      * Stops current playing file. If file is not playing nothing happens
74      * @param event @see WrtDeviceApis::Api::MMPlayer::EventStop.
75      * @exception Commons::PlatformException when platform error occurs
76      */
77     virtual void stop(const EventStopPtr& event) = 0;
78     /**
79      * Sets window for video files
80      * @param event @see WrtDeviceApis::Api::MMPlayer::EventSetWindow.
81      * @exception Commons::PlatformException when platform error occurs
82      */
83     virtual void setWindow(const EventSetWindowPtr& event) = 0;
84     /**
85      * Returns current playing state
86      * @param event @see WrtDeviceApis::Api::MMPlayer::EventIsPlaying.
87      * @return True if player is in playing state
88      * @exception Commons::PlatformException when platform error occurs
89      */
90     virtual void isPlaying(const EventIsPlayingPtr& event) = 0;
91     /**
92      * Returns current playing state
93      * @param [out] event @see WrtDeviceApis::Api::MMPlayer::EventIsPlaying.
94      * @exception Commons::PlatformException when platform error occurs
95      */
96     virtual void getVolume(const EventGetVolumePtr& event) = 0;
97
98   protected:
99     IManager();
100
101     virtual void OnRequestReceived(const EventOpenPtr& event) = 0;
102     virtual void OnRequestReceived(const EventPlayPtr& event) = 0;
103     virtual void OnRequestReceived(const EventPausePtr& event) = 0;
104     virtual void OnRequestReceived(const EventResumePtr& event) = 0;
105     virtual void OnRequestReceived(const EventStopPtr& event) = 0;
106     virtual void OnRequestReceived(const EventIsPlayingPtr& event) = 0;
107     virtual void OnRequestReceived(const EventSetWindowPtr& event) = 0;
108     virtual void OnRequestReceived(const EventGetVolumePtr& event) = 0;
109 };
110 }
111 }
112 }
113
114 #endif // WRTDEVICEAPIS_MMPLAYER_IMANAGER_H_