|
28
|
1 |
/* |
|
15
|
2 |
* This file is part of the TraKERS\Middleware package. |
|
|
3 |
* |
|
|
4 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
|
5 |
* |
|
27
|
6 |
* For the full copyright and license information, please view the LICENSE |
|
15
|
7 |
* file that was distributed with this source code. |
|
|
8 |
*/ |
|
|
9 |
|
|
|
10 |
/* |
|
|
11 |
* Projet : TraKERS |
|
|
12 |
* Module : MIDDLEWARE |
|
|
13 |
* Sous-Module : Communication |
|
|
14 |
* Classe : Server |
|
|
15 |
* |
|
|
16 |
* Auteur : alexandre.bastien@iri.centrepompidou.fr |
|
|
17 |
* |
|
|
18 |
* Fonctionnalités : Reçoit des notifications du module sous-module Tracking. |
|
29
|
19 |
* Centralise les deux serveurs TUIO et WS et permettent aux autres modules de faire appel |
|
|
20 |
* à eux via cette classe. |
|
15
|
21 |
*/ |
|
|
22 |
|
|
|
23 |
using System; |
|
|
24 |
using System.Collections.Generic; |
|
|
25 |
using System.Linq; |
|
|
26 |
using System.Text; |
|
|
27 |
using System.Windows.Media.Media3D; |
|
|
28 |
|
|
|
29 |
namespace Trakers.Communication |
|
|
30 |
{ |
|
|
31 |
public class Server |
|
|
32 |
{ |
|
29
|
33 |
private TUIOServer TUIOserver; |
|
|
34 |
private WSServer WSserver; |
|
15
|
35 |
|
|
|
36 |
public Server(String host, int port, int _timerElapsing) |
|
|
37 |
{ |
|
29
|
38 |
TUIOserver = new TUIOServer(host, 8080, _timerElapsing); |
|
|
39 |
WSserver = new WSServer(host, 8090, _timerElapsing); |
|
15
|
40 |
} |
|
|
41 |
|
|
|
42 |
/* |
|
|
43 |
* Méthode appelée lors d'une notification de type : main gauche entrée dans le champ. |
|
|
44 |
*/ |
|
|
45 |
public void LeftHandTracked(Point3D pt) |
|
|
46 |
{ |
|
29
|
47 |
TUIOserver.LeftHandTracked(pt); |
|
|
48 |
WSserver.LeftHandTracked(pt); |
|
15
|
49 |
} |
|
|
50 |
|
|
|
51 |
/* |
|
|
52 |
* Méthode appelée lors d'une notification de type : main droite entrée dans le champ. |
|
|
53 |
*/ |
|
|
54 |
public void RightHandTracked(Point3D pt) |
|
|
55 |
{ |
|
29
|
56 |
TUIOserver.RightHandTracked(pt); |
|
|
57 |
WSserver.RightHandTracked(pt); |
|
15
|
58 |
} |
|
|
59 |
|
|
|
60 |
/* |
|
|
61 |
* Méthode appelée lors d'une notification de type : main gauche sortie du champ. |
|
|
62 |
*/ |
|
|
63 |
public void LeftHandQuit() |
|
|
64 |
{ |
|
29
|
65 |
TUIOserver.LeftHandQuit(); |
|
|
66 |
WSserver.LeftHandQuit(); |
|
15
|
67 |
} |
|
|
68 |
|
|
|
69 |
/* |
|
|
70 |
* Méthode appelée lors d'une notification de type : main droite sortie du champ. |
|
|
71 |
*/ |
|
|
72 |
public void RightHandQuit() |
|
|
73 |
{ |
|
29
|
74 |
TUIOserver.RightHandQuit(); |
|
|
75 |
WSserver.RightHandQuit(); |
|
15
|
76 |
} |
|
|
77 |
|
|
|
78 |
/* |
|
|
79 |
* Méthode appelée lorsqu'une gesture a été détectée et que l'événement approprié a été lancé. |
|
|
80 |
*/ |
|
|
81 |
public void GesturePerformed(String code) |
|
|
82 |
{ |
|
29
|
83 |
TUIOserver.GesturePerformed(code); |
|
|
84 |
WSserver.GesturePerformed(code); |
|
15
|
85 |
} |
|
|
86 |
|
|
|
87 |
/* |
|
|
88 |
* Méthode appelée lorsqu'on doit entrer dans un autre mode. |
|
|
89 |
*/ |
|
|
90 |
public void ModeNotification(String code) |
|
|
91 |
{ |
|
29
|
92 |
TUIOserver.ModeNotification(code); |
|
|
93 |
WSserver.ModeNotification(code); |
|
16
|
94 |
} |
|
15
|
95 |
} |
|
|
96 |
} |