Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
EncounterBasedCommunication
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
encounters
EncounterBasedCommunication
Commits
ea8d9437
Commit
ea8d9437
authored
Jul 06, 2018
by
LIly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a couple bugs
parent
fa5f3f03
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
testapp/src/main/java/org/mpisws/testapp/simulator/SimulationClientBT.java
...java/org/mpisws/testapp/simulator/SimulationClientBT.java
+3
-2
testapp/src/main/java/org/mpisws/testapp/simulator/SimulationServerBT.java
...java/org/mpisws/testapp/simulator/SimulationServerBT.java
+4
-4
testapp/src/main/java/org/mpisws/testapp/simulator/SimulatorEncounterFormationCore.java
...ws/testapp/simulator/SimulatorEncounterFormationCore.java
+4
-1
No files found.
testapp/src/main/java/org/mpisws/testapp/simulator/SimulationClientBT.java
View file @
ea8d9437
...
...
@@ -29,13 +29,14 @@ import java.util.UUID;
*/
public
class
SimulationClientBT
{
Context
context
;
protected
static
final
int
NUM_SIMULATED_DEVICES
=
10
;
protected
static
final
int
NUM_SIMULATED_EPOCHS
=
10
;
private
static
final
String
TAG
=
SimulationClientBT
.
class
.
getSimpleName
();
private
static
final
UUID
MY_UUID
=
UUID
.
fromString
(
"fa87c0d0-afac-11de-8a39-0800200c9a66"
);
private
final
BluetoothAdapter
mAdapter
;
static
private
SimulatorEncounterFormationCore
core
;
protected
static
final
int
NUM_SIMULATED_DEVICES
=
10
;
protected
static
final
int
NUM_SIMULATED_EPOCHS
=
10
;
protected
static
List
<
Identifier
>
mDHPubKeys
=
new
ArrayList
<>(
NUM_SIMULATED_EPOCHS
);
protected
static
List
<
Identifier
>
mDHNonces
=
new
ArrayList
<>(
NUM_SIMULATED_EPOCHS
);
protected
static
List
<
Identifier
>
mDHFullKeys
=
new
ArrayList
<>(
NUM_SIMULATED_EPOCHS
);
...
...
testapp/src/main/java/org/mpisws/testapp/simulator/SimulationServerBT.java
View file @
ea8d9437
...
...
@@ -114,7 +114,7 @@ public class SimulationServerBT {
Log
.
d
(
TAG
,
"Runnable!"
);
int
lowEpoch
=
currentEpoch
>
3
?
currentEpoch
-
3
:
0
;
List
<
Identifier
>
sses
=
sharedSecrets
.
subList
(
lowEpoch
*
NUM_SIMULATED_DEVICES
,
currentEpoch
*
NUM_SIMULATED_DEVICES
);
List
<
Identifier
>
eids
=
new
ArrayList
<>();
List
<
Identifier
>
eids
=
new
ArrayList
<>(
sses
.
size
()
);
for
(
Identifier
ss
:
sses
)
{
eids
.
add
(
Coder
.
convertSharedSecretToID
(
ss
));
}
...
...
@@ -122,9 +122,9 @@ public class SimulationServerBT {
List
<
ESMessage
>
msgsToSend
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
NUM_SIMULATED_DEVICES
;
i
++)
{
for
(
int
j
=
currentEpoch
+
1
;
j
>
lowEpoch
+
1
;
j
--)
{
int
oldIndex
=
(
j
-
1
-
lowEpoch
)
*
NUM_SIMULATED_DEVICES
+
i
;
int
newIndex
=
(
j
-
lowEpoch
)
*
NUM_SIMULATED_DEVICES
+
i
;
for
(
int
j
=
currentEpoch
;
j
>
lowEpoch
;
j
--)
{
int
oldIndex
=
(
(
j
-
1
-
lowEpoch
)
*
NUM_SIMULATED_DEVICES
)
+
i
;
int
newIndex
=
(
(
j
-
lowEpoch
)
*
NUM_SIMULATED_DEVICES
)
+
i
;
if
(
topicHandles
.
get
(
oldIndex
)
==
null
||
topicHandles
.
get
(
oldIndex
).
compareTo
(
""
)
==
0
)
{
continue
;
}
...
...
testapp/src/main/java/org/mpisws/testapp/simulator/SimulatorEncounterFormationCore.java
View file @
ea8d9437
...
...
@@ -89,7 +89,10 @@ public class SimulatorEncounterFormationCore implements Runnable {
if
(
changeEpochTime
<
System
.
currentTimeMillis
())
{
Log
.
d
(
TAG
,
"CHANGING EPOCH"
);
CURRENT_EPOCH
++;
assert
(
CURRENT_EPOCH
<=
NUM_SIMULATED_EPOCHS
);
if
(
CURRENT_EPOCH
<=
NUM_SIMULATED_EPOCHS
)
{
// hack
CURRENT_EPOCH
--;
}
changeEpochTime
+=
CHANGE_EPOCH_TIME
;
startAdvertisingAndUpdateAdvert
();
...
...
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