TUIO C++ Developer API
TuioServer.h
1 /*
2  TUIO C++ Library
3  Copyright (c) 2005-2017 Martin Kaltenbrunner <martin@tuio.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 3.0 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library.
17 */
18 
19 #ifndef INCLUDED_TuioServer_H
20 #define INCLUDED_TuioServer_H
21 
22 #include "TuioManager.h"
23 #include "UdpSender.h"
24 #include "TcpSender.h"
25 #include "WebSockSender.h"
26 #include "FlashSender.h"
27 #include <iostream>
28 #include <vector>
29 #include <stdio.h>
30 #ifndef WIN32
31 #include <netdb.h>
32 #include <arpa/inet.h>
33 #include <unistd.h>
34 #endif
35 
36 namespace TUIO {
71  class LIBDECL TuioServer : public TuioManager {
72 
73  public:
74 
78  TuioServer();
79 
86  TuioServer(const char *host, int port);
87 
93  TuioServer(OscSender *sender);
94 
98  ~TuioServer();
99 
103  void sendFullMessages();
104 
110  full_update = true;
111  }
112 
117  full_update = false;
118  }
119 
125  return full_update;
126  }
127 
133  void enablePeriodicMessages(int interval=1) {
134  periodic_update = true;
135  update_interval = interval;
136  }
137 
142  periodic_update = false;
143  }
144 
150  return periodic_update;
151  }
152 
158  return update_interval;
159  }
160 
165  void commitFrame();
166 
177  void setSourceName(const char *name);
178 
179 
186  void setSourceName(const char *name, const char *ip);
187 
188 
189 
190  void addOscSender(OscSender *sender);
191 
192  void enableObjectProfile(bool flag) { objectProfileEnabled = flag; };
193  void enableCursorProfile(bool flag) { cursorProfileEnabled = flag; };
194  void enableBlobProfile(bool flag) { blobProfileEnabled = flag; };
195 
196  private:
197 
198  void initialize(OscSender *oscsend);
199 
200  std::vector<OscSender*> senderList;
201  void deliverOscPacket(osc::OutboundPacketStream *packet);
202 
203  osc::OutboundPacketStream *oscPacket;
204  char *oscBuffer;
205  osc::OutboundPacketStream *fullPacket;
206  char *fullBuffer;
207 
208  void startObjectBundle();
209  void addObjectMessage(TuioObject *tobj);
210  void sendObjectBundle(long fseq);
211  void sendEmptyObjectBundle();
212 
213  void startCursorBundle();
214  void addCursorMessage(TuioCursor *tcur);
215  void sendCursorBundle(long fseq);
216  void sendEmptyCursorBundle();
217 
218  void startBlobBundle();
219  void addBlobMessage(TuioBlob *tblb);
220  void sendBlobBundle(long fseq);
221  void sendEmptyBlobBundle();
222 
223  int update_interval;
224  bool full_update, periodic_update;
225  TuioTime objectUpdateTime, cursorUpdateTime, blobUpdateTime ;
226  bool objectProfileEnabled, cursorProfileEnabled, blobProfileEnabled;
227  char *source_name;
228  };
229 }
230 #endif /* INCLUDED_TuioServer_H */
void enableFullUpdate()
Definition: TuioServer.h:109
Definition: TuioTime.h:48
bool periodicMessagesEnabled()
Definition: TuioServer.h:149
Definition: FlashSender.h:166
void disablePeriodicMessages()
Definition: TuioServer.h:141
Definition: OscSender.h:37
Definition: TuioManager.h:62
Definition: TuioObject.h:32
bool fullUpdateEnabled()
Definition: TuioServer.h:124
void disableFullUpdate()
Definition: TuioServer.h:116
Definition: TuioServer.h:71
Definition: TuioBlob.h:32
Definition: TuioCursor.h:32
void enablePeriodicMessages(int interval=1)
Definition: TuioServer.h:133
int getUpdateInterval()
Definition: TuioServer.h:157