Remove dependency from CPlaybackView to CPlaybackController.
[profile/tv/apps/native/musicplayer.git] / src / playback / MusicControllerImpl.h
1 /*
2 * Copyright (c) 2014 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
17 #ifndef __MUSIC_CONTROLLER_IMPL_H__
18 #define __MUSIC_CONTROLLER_IMPL_H__
19
20
21 class CMusicControllerImpl :
22         public CUsbListener,
23         public ICompleteListener {
24 private:
25         struct SMusicControllerImpl *m;
26
27 private:
28         enum EDirectionType {
29                 DIR_PREVIOUS,
30                 DIR_NEXT
31         };
32
33         enum ENextType {
34                 E_ON_COMPLETE,
35                 E_BUTTON_CLICK
36         };
37
38 private:
39         static void sm_CbContentUpdated(void *dt);
40         void m_OnContentUpdated(void);
41
42         void m_InvokeErrorCallback(SMusicControllerImpl *m, int type);
43
44 protected:
45         bool t_PlayNext(int direction, int playnext_type);
46
47 public:
48         CMusicControllerImpl() {}
49         virtual ~CMusicControllerImpl() {}
50
51         bool Create(void);
52         virtual void Destroy(void);
53
54         bool Start(void);
55         bool Stop(void);
56         bool Resume(void);
57         bool Pause(void);
58
59         bool AddListener(IMusicControllerListener *listener);
60         bool RemoveListener(IMusicControllerListener *listener);
61
62         bool GetCurrentSongIndex(int *ind);
63         bool GetTotalSongs(int *ts);
64         bool GetSonginfoFromIndex(int index, CSongInfo **const csinfo);
65
66         bool SetPosition(int milsec);
67         bool GetPosition(int *const milseconds);
68
69         bool SetCurrentSong(char *mediaid);
70         bool GetCurrentSong(CSongInfo **const sinfo);
71
72         bool UpdatePlaylist(Eina_List *slist, int addmode);
73         bool EmptyPlaylist(void);
74
75         bool PlayPreviousSong(void);
76         bool PlayNextSong(void);
77         bool PlayIndexSong(int index);
78
79         bool RemoveSong(CSongInfo *sinfo, int index);
80
81         bool MediaGetList(int EListType, void *info, Eina_List **list);
82         bool MediaInsertPlaylist(const char *name, Eina_List *idlist);
83         bool MediaExistPlaylist(const char *name);
84         bool MediaDeletePlaylist(int id);
85         bool MediaRenamePlaylist(int id, const char *name);
86         bool MediaAddmediaPlaylist(int id, Eina_List *idlist);
87         bool MediaRemovemediaPlaylist(int id, Eina_List *idlist);
88         bool MediaAddsongsPlaylist(int lid, Eina_List *list);
89
90         CSongInfo *MediaSongByUri(char *uri);
91
92         bool SetPlayState(EPlayStatus state);
93         EPlayStatus PlayState(void);
94
95         bool SetShuffleState(EShuffleStatus state);
96         EShuffleStatus ShuffleState(void);
97
98         bool SetRepeatState(ERepeatStatus state);
99         ERepeatStatus RepeatState(void);
100
101         void ChangePlayerMode(EPlayerMode mode);
102         void HandlePlaylistEditButtons(EPlayerEditBtns btnId);
103         void HandleRemoteButtons(Evas_Object *eoBtn, EPlayerBtnsEvent ev);
104         void UpdatePlayerUI(void);
105
106 public:
107         virtual void OnStatusChanged(SUsbHostDeviceInfo *changedDevice,
108                 SUsbHostDeviceStatus status);
109
110         virtual void t_OnPlayComplete(void);
111 };
112
113
114 #endif /* __MUSIC_CONTROLLER_IMPL_H__ */