Ginga  0.13.6
 All Classes Namespaces Functions Variables
PresentationEngineManager.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef PRESENTATIONENGINEMANAGER_H_
51 #define PRESENTATIONENGINEMANAGER_H_
52 
53 #include "util/functions.h"
54 using namespace ::br::pucrio::telemidia::util;
55 
56 #include "system/thread/Thread.h"
57 using namespace ::br::pucrio::telemidia::ginga::core::system::thread;
58 
59 #include "mb/IInputManager.h"
60 #include "mb/ILocalScreenManager.h"
61 #include "mb/interface/IInputEventListener.h"
62 using namespace ::br::pucrio::telemidia::ginga::core::mb;
63 
64 #include "player/IShowButton.h"
65 #include "player/IProgramAV.h"
66 #include "player/IPlayerListener.h"
67 #include "player/IApplicationPlayer.h"
68 using namespace ::br::pucrio::telemidia::ginga::core::player;
69 
70 #include "ncl/layout/LayoutRegion.h"
71 using namespace ::br::pucrio::telemidia::ncl::layout;
72 
73 #include "ncl/components/ContentTypeManager.h"
74 #include "ncl/NclDocument.h"
75 using namespace ::br::pucrio::telemidia::ncl;
76 
77 #include "gingancl/privatebase/IPrivateBaseManager.h"
78 using namespace ::br::pucrio::telemidia::ginga::ncl;
79 
80 #include "IPresentationEngineManager.h"
81 
82 #include <pthread.h>
83 #include <iostream>
84 #include <fstream>
85 #include <string>
86 #include <vector>
87 #include <map>
88 using namespace std;
89 
90 namespace br {
91 namespace pucrio {
92 namespace telemidia {
93 namespace ginga {
94 namespace lssm {
97  public IPlayerListener,
98  public IInputEventListener,
99  public ICmdEventListener,
100  Thread {
101 
102  private:
103  static const short UC_BACKGROUND = 0;
104  static const short UC_PRINTSCREEN = 1;
105  static const short UC_STOP = 2;
106  static const short UC_PAUSE = 3;
107  static const short UC_RESUME = 4;
108  static const short UC_SHIFT = 5;
109 
110  int devClass;
111  int x;
112  int y;
113  int w;
114  int h;
115  bool enableGfx;
116 
117  GingaScreenID myScreen;
118  IPrivateBaseManager* privateBaseManager;
119  map<string, INCLPlayer*> formatters;
120  set<INCLPlayer*> formattersToRelease;
121  bool paused;
122  string iconPath;
123  bool isEmbedded;
124  bool standAloneApp;
125  bool isLocalNcl;
126  bool disableAV;
127  void* dsmccListener;
128  void* tuner;
129  bool closed;
130  bool hasTMPNotification;
131  bool hasInteractivity;
132 
133  bool enableMulticast;
134 
135  bool exitOnEnd;
136  bool disableFKeys;
137 
138  ITimeBaseProvider* timeBaseProvider;
139  int currentPrivateBaseId;
140  static bool autoProcess;
141  vector<string> commands;
142  static ILocalScreenManager* dm;
143  IInputManager* im;
144  IShowButton* sb;
145  bool debugWindow;
146 
147  public:
149  int devClass,
150  int xOffset,
151  int yOffset,
152  int width,
153  int height,
154  bool disableGfx,
155  bool useMulticast,
156  GingaScreenID screenId);
157 
158  virtual ~PresentationEngineManager();
159 
160  void setDebugWindow(bool debugWindow);
161  void setExitOnEnd(bool exitOnEnd);
162  void setDisableFKeys(bool disableFKeys);
163 
164  set<string>* createPortIdList(string nclFile);
165  short getMappedInterfaceType(string nclFile, string portId);
166 
167  void disableMainAV(bool disableAV);
168  void autoMountOC(bool autoMountIt);
169  void setCurrentPrivateBaseId(unsigned int baseId);
170  void setTimeBaseProvider(ITimeBaseProvider* tmp);
171 
172  private:
173  void printGingaWindows();
174  bool nclEdit(string nclEditApi);
175  bool editingCommand(string commandTag, string commandPayload);
176 
177  public:
178  bool editingCommand(string editingCmd);
179  void setBackgroundImage(string uri);
180 
181  private:
182  void close();
183  void registerKeys();
184  void setTimeBaseInfo(INCLPlayer* nclPlayer);
185 
186  public:
187  void getScreenShot();
188  bool getIsLocalNcl();
189  void setEmbedApp(bool isEmbedded);
190  void setIsLocalNcl(bool isLocal, void* tuner=NULL);
191  void setInteractivityInfo(bool hasInt);
192 
193  private:
194  INCLPlayer* createNclPlayer(string baseId, string fname);
195 
196  public:
197  NclPlayerData* createNclPlayerData();
198 
199  void addPlayerListener(string nclFile, IPlayerListener* listener);
200  void removePlayerListener(string nclFile, IPlayerListener* listener);
201 
202  bool openNclFile(string nclFile);
203  bool startPresentation(string nclFile, string interfId);
204  bool pausePresentation(string nclFile);
205  bool resumePresentation(string nclFile);
206  bool stopPresentation(string nclFile);
207  bool setPropertyValue(string nclFile, string interfaceId, string value);
208  string getPropertyValue(string nclFile, string interfaceId);
209  bool stopAllPresentations();
210  bool abortPresentation(string nclFile);
211 
212  private:
213  //#if HAVE_GINGAJ
214  void openNclDocument(string docUri, int x, int y, int w, int h);
215 
216  //#if HAVE_DSMCC
217  void* getDsmccListener();
218  void pausePressed();
219 
220  public:
221  void setCmdFile(string cmdFile);
222  static void* processAutoCmd(void* ptr);
223  void waitUnlockCondition();
224 
225  private:
226  void presentationCompleted(string formatterId);
227  void releaseFormatter(string formatterId);
228  bool checkStatus();
229 
230  void updateStatus(
231  short code, string parameter, short type, string value);
232 
233  bool userEventReceived(IInputEvent* ev);
234  bool cmdEventReceived(string command, string args);
235 
236  static void* eventReceived(void* ptr);
237  void readCommand(string command);
238 
239  bool getNclPlayer(string docLocation, INCLPlayer** player);
240  bool getNclPlayer(string baseId, string docId, INCLPlayer** p);
241 
242  void updateFormatters(short command, string parameter="");
243  void run();
244  };
245 }
246 }
247 }
248 }
249 }
250 
251 #endif /*PRESENTATIONENGINEMANAGER_H_*/
Definition: PresentationEngineManager.h:95
Definition: INCLPlayer.h:63
Definition: IPresentationEngineManager.h:70