Ginga  0.13.6
 All Classes Namespaces Functions Variables
FormatterActiveDevice.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 _FormatterActiveDevice_H_
51 #define _FormatterActiveDevice_H_
52 #include "FormatterMultiDevice.h"
53 
54 #include "util/functions.h"
55 #include "util/Base64.h"
56 using namespace ::br::pucrio::telemidia::util;
57 
58 
59 #include "player/INCLPlayer.h"
60 using namespace ::br::pucrio::telemidia::ginga::core::player;
61 
62 #include "system/compat/SystemCompat.h"
63 #include "system/compat/PracticalSocket.h"
64 using namespace ::br::pucrio::telemidia::ginga::core::system::compat;
65 
66 #include "gingancl/privatebase/IPrivateBaseManager.h"
67 using namespace ::br::pucrio::telemidia::ginga::ncl;
68 
69 #include <stdio.h>
70 #include <stdlib.h>
71 #include <ctype.h>
72 #include <sys/stat.h>
73 #include <sys/types.h>
74 
75 #include <errno.h>
76 
77 namespace br {
78 namespace pucrio {
79 namespace telemidia {
80 namespace ginga {
81 namespace ncl {
82 namespace multidevice {
84  public:
85  //TODO: here?
86  static const unsigned int ADD_DOCUMENT = 10081;
87  static const unsigned int REMOVE_DOCUMENT = 10082;
88  static const unsigned int START_DOCUMENT = 10083;
89  static const unsigned int STOP_DOCUMENT = 10084;
90  static const unsigned int PAUSE_DOCUMENT = 10085;
91  static const unsigned int RESUME_DOCUMENT = 10086;
92  static const unsigned int SET_VAR = 10087;
93  static const unsigned int SELECTION = 10088;
94 
95  //static const unsigned int COMMAND_SERVER_PORT = 22222;
96  static const unsigned int RCVBUFSIZE = 100;
97 
98  static const string IMG_DIR;
99  static const string IMG_DEV;
100  static const string IMG_RESET;
101  static string TMP_DIR;
102 
103  private:
104  TCPSocket* tcpSocket;
105  int deviceServicePort;
106 
107  ISurface* s;
108 
109  map<string, string>* contentsInfo;
110  map<string, string> initVars;
111 
112  string currentDocUri;
113  IPrivateBaseManager* privateBaseManager;
114  INCLPlayer* formatter;
115 
116  bool listening;
117 
118  public:
120  GingaScreenID screenId,
121  IDeviceLayout* deviceLayout,
122  int x, int y, int w, int h, bool useMulticast, int srvPort);
123 
124  virtual ~FormatterActiveDevice();
125 
126  protected:
127  bool newDeviceConnected(int newDevClass, int w, int h) {
128  return false;
129  };
130 
131  bool socketSend(TCPSocket* sock, string payload);
132  void connectedToBaseDevice(unsigned int domainAddr);
133  bool receiveRemoteEvent(
134  int remoteDevClass,
135  int eventType,
136  string eventContent);
137 
138  bool receiveRemoteContent(
139  int remoteDevClass,
140  char *stream, int streamSize) {
141 
142  return false;
143  };
144 
145  bool receiveRemoteContent(int remoteDevClass, string contentUri);
146  bool receiveRemoteContentInfo(string contentId, string contentUri);
147  bool userEventReceived(IInputEvent* ev);
148 
149  bool openDocument(string contentUri);
150  INCLPlayer* createNCLPlayer();
151  NclPlayerData* createNclPlayerData();
152 
153  int getCommandCode(string *com);
154  void handleTCPClient(TCPSocket *sock);
155  bool handleTCPCommand(
156  string sid,
157  string snpt,
158  string scommand,
159  string spayload_desc,
160  string payload);
161  };
162 }
163 }
164 }
165 }
166 }
167 }
168 
169 #endif /* _FormatterActiveDevice_H_ */
Definition: IPrivateBaseManager.h:61
Definition: INCLPlayer.h:63
HAVE_MULTIDEVICE.
Definition: FormatterMultiDevice.h:121