Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TULIP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
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
NUI
TULIP
Commits
16ba572e
Commit
16ba572e
authored
May 07, 2015
by
Nicolas Gilmard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue
#22
. Closing socket problem
parent
ebd6f453
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
31 deletions
+26
-31
TULIP/src/lu/list/itis/dkd/tui/adapter/TuioAdapter.java
TULIP/src/lu/list/itis/dkd/tui/adapter/TuioAdapter.java
+7
-8
TULIP/src/lu/list/itis/dkd/tui/network/adapter/BluetoothClient.java
...lu/list/itis/dkd/tui/network/adapter/BluetoothClient.java
+6
-6
TULIP/src/lu/list/itis/dkd/tui/network/adapter/BluetoothServer.java
...lu/list/itis/dkd/tui/network/adapter/BluetoothServer.java
+3
-13
TULIP/src/lu/list/itis/dkd/tui/network/adapter/TcpServer.java
...P/src/lu/list/itis/dkd/tui/network/adapter/TcpServer.java
+9
-3
TULIP/test/lu/list/itis/dkd/tui/TangibleApplicationTest2.java
...P/test/lu/list/itis/dkd/tui/TangibleApplicationTest2.java
+1
-1
No files found.
TULIP/src/lu/list/itis/dkd/tui/adapter/TuioAdapter.java
View file @
16ba572e
...
...
@@ -124,29 +124,28 @@ public class TuioAdapter extends TuiAdapter implements TuioListener {
Vector
<
Point
>
tempPath
=
new
Vector
<>();
tuioObject
.
getPath
().
forEach
(
path
->
tempPath
.
addElement
(
new
Point
(
path
.
getX
(),
path
.
getY
(),
path
.
getAngle
(
tuioObject
))));
tuioObject
.
getPath
().
forEach
(
path
->
tempPath
.
addElement
(
new
Point
(
path
.
getX
(),
path
.
getY
(),
tuioObject
.
getAngle
(
))));
// path.getAngle(tuioObject)
TangibleObject
convertedTangibleObject
=
new
TangibleObjectBuilder
(
tuioObject
.
getSymbolID
(),
Type
.
OBJECT
,
tuioObject
.
getPath
().
lastElement
().
getX
(),
tuioObject
.
getPath
().
lastElement
().
getY
()).
withSeconds
(
tuioObject
.
getTuioTime
().
getSeconds
()).
withMicroSeconds
(
tuioObject
.
getTuioTime
().
getMicroseconds
()).
withxSpeed
(
tuioObject
.
getXSpeed
()).
withySpeed
(
tuioObject
.
getYSpeed
()).
withMotionSpeed
(
tuioObject
.
getMotionSpeed
()).
withMotionAccel
(
tuioObject
.
getMotionAccel
()).
withRotationSpeed
(
tuioObject
.
getRotationSpeed
()).
withRotationAccel
(
tuioObject
.
getRotationAccel
()).
withPath
(
tempPath
).
withState
(
tuioObject
.
getTuioState
()).
build
();
return
convertedTangibleObject
;
}
/**
* Convert a TUIO cursor into a tangibleObject
*
* @param t
angible
Cursor
* @param t
uio
Cursor
* != null
* @pre tangibleCursor != null
* @return tangibleObject with TuioCursor's values
*/
private
TangibleObject
convertTuioCursorToTangibleObject
(
TuioCursor
t
angible
Cursor
)
{
Preconditions
.
checkArgument
(
t
angible
Cursor
!=
null
,
"The passed tangible cursor cannot be null!"
);
//$NON-NLS-1$
private
TangibleObject
convertTuioCursorToTangibleObject
(
TuioCursor
t
uio
Cursor
)
{
Preconditions
.
checkArgument
(
t
uio
Cursor
!=
null
,
"The passed tangible cursor cannot be null!"
);
//$NON-NLS-1$
Vector
<
Point
>
tempPath
=
new
Vector
<>();
t
angible
Cursor
.
getPath
().
forEach
(
path
->
tempPath
.
addElement
(
new
Point
(
path
.
getX
(),
path
.
getY
(),
0
)));
t
uio
Cursor
.
getPath
().
forEach
(
path
->
tempPath
.
addElement
(
new
Point
(
path
.
getX
(),
path
.
getY
(),
0
)));
TangibleObject
convertedTangibleObject
=
new
TangibleObjectBuilder
(
IDMapper
.
remapCursorID
(
t
angibleCursor
.
getCursorID
()),
Type
.
CURSOR
,
tangibleCursor
.
getPath
().
lastElement
().
getX
(),
tangibleCursor
.
getPath
().
lastElement
().
getY
()).
withSeconds
(
tangibleCursor
.
getTuioTime
().
getSeconds
()).
withMicroSeconds
(
tangibleCursor
.
getTuioTime
().
getMicroseconds
()).
withxSpeed
(
tangibleCursor
.
getXSpeed
()).
withySpeed
(
tangibleCursor
.
getYSpeed
()).
withMotionSpeed
(
tangibleCursor
.
getMotionSpeed
()).
withMotionAccel
(
tangibleCursor
.
getMotionAccel
()).
withPath
(
tempPath
).
withState
(
tangible
Cursor
.
getTuioState
()).
build
();
TangibleObject
convertedTangibleObject
=
new
TangibleObjectBuilder
(
IDMapper
.
remapCursorID
(
t
uioCursor
.
getCursorID
()),
Type
.
CURSOR
,
tuioCursor
.
getPath
().
lastElement
().
getX
(),
tuioCursor
.
getPath
().
lastElement
().
getY
()).
withSeconds
(
tuioCursor
.
getTuioTime
().
getSeconds
()).
withMicroSeconds
(
tuioCursor
.
getTuioTime
().
getMicroseconds
()).
withxSpeed
(
tuioCursor
.
getXSpeed
()).
withySpeed
(
tuioCursor
.
getYSpeed
()).
withMotionSpeed
(
tuioCursor
.
getMotionSpeed
()).
withMotionAccel
(
tuioCursor
.
getMotionAccel
()).
withPath
(
tempPath
).
withState
(
tuio
Cursor
.
getTuioState
()).
build
();
return
convertedTangibleObject
;
}
...
...
TULIP/src/lu/list/itis/dkd/tui/network/adapter/BluetoothClient.java
View file @
16ba572e
...
...
@@ -45,10 +45,10 @@ public class BluetoothClient extends ClientAdapter {
protected
String
uuidService
;
/**
* Default constructor
* Default constructor
which assign uuidService.
*
* @param uuidService
*
!= null
*
is the uuid of the service to connect to.
*/
public
BluetoothClient
(
String
uuidService
)
{
this
.
uuidService
=
uuidService
;
...
...
@@ -66,10 +66,10 @@ public class BluetoothClient extends ClientAdapter {
DiscoveryAgent
discoveryAgent
;
discoveryAgent
=
LocalDevice
.
getLocalDevice
().
getDiscoveryAgent
();
String
m
Connect
=
null
;
m
Connect
=
discoveryAgent
.
selectService
(
serviceId
,
ServiceRecord
.
NOAUTHENTICATE_NOENCRYPT
,
false
);
if
(
m
Connect
!=
null
)
{
client
=
(
StreamConnection
)
Connector
.
open
(
m
Connect
);
String
service
Connect
=
null
;
service
Connect
=
discoveryAgent
.
selectService
(
serviceId
,
ServiceRecord
.
NOAUTHENTICATE_NOENCRYPT
,
false
);
if
(
service
Connect
!=
null
)
{
client
=
(
StreamConnection
)
Connector
.
open
(
service
Connect
);
inputStream
=
client
.
openInputStream
();
outputStream
=
client
.
openOutputStream
();
}
...
...
TULIP/src/lu/list/itis/dkd/tui/network/adapter/BluetoothServer.java
View file @
16ba572e
...
...
@@ -51,10 +51,10 @@ public class BluetoothServer extends ServerAdapter {
protected
String
uuidService
;
/**
* Default constructor
* Default constructor
which assign uuidService.
*
* @param uuidService
*
!= null
*
is the uuid of the service to connect to.
* @throws IOException
*/
public
BluetoothServer
(
String
uuidService
)
throws
IOException
{
...
...
@@ -84,17 +84,7 @@ public class BluetoothServer extends ServerAdapter {
*/
@Override
public
void
closeServer
()
throws
IOException
{
// TODO Auto-generated method stub
if
(
outputStream
!=
null
)
{
outputStream
.
close
();
}
if
(
inputStream
!=
null
)
{
inputStream
.
close
();
}
if
(
client
!=
null
)
{
client
.
close
();
}
closeClient
();
if
(
server
!=
null
)
{
server
.
close
();
}
...
...
TULIP/src/lu/list/itis/dkd/tui/network/adapter/TcpServer.java
View file @
16ba572e
...
...
@@ -66,9 +66,15 @@ public class TcpServer extends ServerAdapter {
*/
@Override
public
void
acceptClient
()
throws
IOException
{
client
=
server
.
accept
();
outputStream
=
client
.
getOutputStream
();
inputStream
=
client
.
getInputStream
();
try
{
client
=
server
.
accept
();
outputStream
=
client
.
getOutputStream
();
inputStream
=
client
.
getInputStream
();
}
catch
(
IOException
e
)
{
if
(
server
!=
null
)
{
server
.
close
();
}
}
}
/**
...
...
TULIP/test/lu/list/itis/dkd/tui/TangibleApplicationTest2.java
View file @
16ba572e
...
...
@@ -92,7 +92,7 @@ public class TangibleApplicationTest2 {
try
{
application
=
new
TestTangibleApplication
(
propertiesLocation
);
fail
(
"Expected exit
25
"
);
//$NON-NLS-1$
fail
(
"Expected exit"
);
//$NON-NLS-1$
}
catch
(
ExitSecurityException
e
)
{
int
status
=
e
.
getStatus
();
assertEquals
(
42
,
status
);
...
...
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