Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
a644ab68
Commit
a644ab68
authored
5 years ago
by
terry-norbraten
Browse files
Options
Downloads
Patches
Plain Diff
remove the added listener
parent
52e7f3a5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/edu/nps/moves/dis7/utilities/stream/PduRecorder.java
+28
-19
28 additions, 19 deletions
src/edu/nps/moves/dis7/utilities/stream/PduRecorder.java
with
28 additions
and
19 deletions
src/edu/nps/moves/dis7/utilities/stream/PduRecorder.java
+
28
−
19
View file @
a644ab68
...
...
@@ -48,25 +48,10 @@ public class PduRecorder implements PduReceiver
private
static
String
pduLogEncoding
=
ENCODING_PLAINTEXT
;
// TODO use Java enumerations, generalize/share across library
/**
* TODO change this to enumeration type for strictness
* @return the pduLogEncoding
*/
public
static
String
getEncoding
()
{
return
pduLogEncoding
;
}
/**
* @param aEncoding the pduLogEncoding to set
*/
public
static
void
setEncoding
(
String
aEncoding
)
{
pduLogEncoding
=
aEncoding
;
}
private
Writer
writer
;
private
File
logFile
;
private
DisThreadedNetIF
disThreadedNetIF
;
private
DisThreadedNetIF
.
RawPduListener
lis
;
/**
* Default constructor that uses default values for output directory, multicast
...
...
@@ -106,12 +91,34 @@ public class PduRecorder implements PduReceiver
writer
=
new
PrintWriter
(
new
BufferedWriter
(
new
FileWriter
(
logFile
)));
disThreadedNetIF
=
new
DisThreadedNetIF
(
port
,
mcastaddr
);
disThreadedNetIF
.
addRawListener
(
bAndL
->
{
receivePdu
(
bAndL
.
buff
,
bAndL
.
length
);
});
lis
=
new
DisThreadedNetIF
.
RawPduListener
()
{
@Override
public
void
incomingPdu
(
DisThreadedNetIF
.
BuffAndLength
bAndL
)
{
receivePdu
(
bAndL
.
buff
,
bAndL
.
length
);
}
};
disThreadedNetIF
.
addRawListener
(
lis
);
System
.
out
.
println
(
getClass
()
+
" listening to IP address "
+
mcastaddr
+
" on port: "
+
port
);
}
/**
* TODO change this to enumeration type for strictness
*
* @return the pduLogEncoding
*/
public
static
String
getEncoding
()
{
return
pduLogEncoding
;
}
/**
* @param aEncoding the pduLogEncoding to set
*/
public
static
void
setEncoding
(
String
aEncoding
)
{
pduLogEncoding
=
aEncoding
;
}
public
void
startResume
()
{
doSave
=
true
;
...
...
@@ -124,6 +131,8 @@ public class PduRecorder implements PduReceiver
public
File
end
()
{
doSave
=
false
;
disThreadedNetIF
.
removeRawListener
(
lis
);
disThreadedNetIF
.
kill
();
writeFooter
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment