Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
multitouch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
multitouch
Commits
7ea7d1e4
Commit
7ea7d1e4
authored
Jun 02, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split TUIO server into input server and TUIO server.
parent
423b5dd8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
24 deletions
+45
-24
src/input_server.py
src/input_server.py
+34
-0
src/server.py
src/server.py
+3
-4
src/tuio_server.py
src/tuio_server.py
+8
-20
No files found.
src/input_server.py
0 → 100644
View file @
7ea7d1e4
from
logger
import
Logger
class
InputServer
(
Logger
):
"""
Abstract class for input servers. An input server translates driver
events to point 'down', 'move' and 'up' events. An input server
implementation should define the methods 'start' and 'stop', which
starts/stops some event loop that triggers on_point_up, on_point_move and
on_point_down methods on the 'handler_obj' object.
"""
def
__init__
(
self
,
handler_obj
):
self
.
handler_obj
=
handler_obj
def
start
(
self
):
raise
NotImplementedError
def
stop
(
self
):
raise
NotImplementedError
class
InputServerHandler
(
Logger
):
"""
Interface for gesture server. Defines empty on_point_up, on_point_move and
on_point_down handlers.
"""
def
on_point_down
(
self
,
sid
,
x
,
y
):
return
NotImplemented
def
on_point_move
(
self
,
sid
,
x
,
y
):
return
NotImplemented
def
on_point_up
(
self
,
sid
):
return
NotImplemented
src/server.py
View file @
7ea7d1e4
from
logger
import
Logg
er
from
input_server
import
InputServerHandl
er
from
tuio_server
import
TuioServer2D
from
window
import
FullscreenWindow
from
window
import
FullscreenWindow
from
tuio_server
import
TuioServer2D
,
TuioServerHandler
from
point
import
TouchPoint
from
point
import
TouchPoint
from
screen
import
pixel_coords
from
screen
import
pixel_coords
class
GestureServer
(
TuioServerHandler
,
Logg
er
):
class
GestureServer
(
InputServerHandl
er
):
"""
"""
Multi-touch gesture server. This uses a TUIO server to receive basic touch
Multi-touch gesture server. This uses a TUIO server to receive basic touch
events, which are translated to gestures using gesture trackers. Trackers
events, which are translated to gestures using gesture trackers. Trackers
...
...
src/tuio_server.py
View file @
7ea7d1e4
...
@@ -2,13 +2,15 @@
...
@@ -2,13 +2,15 @@
from
OSC
import
OSCServer
from
OSC
import
OSCServer
OSCServer
.
print_tracebacks
=
True
OSCServer
.
print_tracebacks
=
True
from
logger
import
Logg
er
from
input_server
import
InputServ
er
class
TuioServer2D
(
Logg
er
):
class
TuioServer2D
(
InputServ
er
):
__tuio_address__
=
'localhost'
,
3333
__tuio_address__
=
'localhost'
,
3333
def
__init__
(
self
,
handler_obj
):
def
__init__
(
self
,
handler_obj
):
super
(
TuioServer2D
,
self
).
__init__
(
handler_obj
)
# OSC server that listens to incoming TUIO events
# OSC server that listens to incoming TUIO events
self
.
server
=
OSCServer
(
self
.
__tuio_address__
)
self
.
server
=
OSCServer
(
self
.
__tuio_address__
)
self
.
server
.
addDefaultHandlers
()
self
.
server
.
addDefaultHandlers
()
...
@@ -23,8 +25,6 @@ class TuioServer2D(Logger):
...
@@ -23,8 +25,6 @@ class TuioServer2D(Logger):
# event
# event
self
.
down
=
set
()
self
.
down
=
set
()
self
.
handler_obj
=
handler_obj
def
_receive
(
self
,
addr
,
tags
,
data
,
source
):
def
_receive
(
self
,
addr
,
tags
,
data
,
source
):
surface
=
addr
[
8
:]
surface
=
addr
[
8
:]
#self.debug('Received message <surface=%s tags="%s" '
#self.debug('Received message <surface=%s tags="%s" '
...
@@ -74,25 +74,13 @@ class TuioServer2D(Logger):
...
@@ -74,25 +74,13 @@ class TuioServer2D(Logger):
self
.
server
.
close
()
self
.
server
.
close
()
class
TuioServerHandler
(
object
):
"""
Interface for touch servers. Defines point_up, point_move and point_down
handlers.
"""
def
on_point_down
(
self
,
sid
,
x
,
y
):
return
NotImplemented
def
on_point_move
(
self
,
sid
,
x
,
y
):
return
NotImplemented
def
on_point_up
(
self
,
sid
):
return
NotImplemented
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
argparse
import
argparse
import
logging
import
logging
from
logger
import
Logger
from
input_server
import
InputServerHandler
parser
=
argparse
.
ArgumentParser
(
description
=
'TUIO server test.'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'TUIO server test.'
)
parser
.
add_argument
(
'--log'
,
metavar
=
'LOG_LEVEL'
,
default
=
'INFO'
,
parser
.
add_argument
(
'--log'
,
metavar
=
'LOG_LEVEL'
,
default
=
'INFO'
,
choices
=
[
'DEBUG'
,
'INFO'
,
'WARNING'
],
help
=
'Global log level.'
)
choices
=
[
'DEBUG'
,
'INFO'
,
'WARNING'
],
help
=
'Global log level.'
)
...
@@ -109,7 +97,7 @@ if __name__ == '__main__':
...
@@ -109,7 +97,7 @@ if __name__ == '__main__':
Logger
.
configure
(
**
log_config
)
Logger
.
configure
(
**
log_config
)
# Define handlers
# Define handlers
class
Handler
(
Tuio
ServerHandler
,
Logger
):
class
Handler
(
Input
ServerHandler
,
Logger
):
def
on_point_down
(
self
,
sid
,
x
,
y
):
def
on_point_down
(
self
,
sid
,
x
,
y
):
self
.
info
(
'Point down: sid=%d (%s, %s)'
%
(
sid
,
x
,
y
))
self
.
info
(
'Point down: sid=%d (%s, %s)'
%
(
sid
,
x
,
y
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment