Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
encounters
EncounterBasedCommunication
Commits
3ab31510
Commit
3ab31510
authored
Jul 01, 2018
by
LIly
Browse files
editing time to be from scan result
parent
69d59bd2
Changes
4
Hide whitespace changes
Inline
Side-by-side
ebclibrary/src/main/jni/c_SDDRRadio.cpp
View file @
3ab31510
...
...
@@ -98,17 +98,18 @@ JNIEXPORT void JNICALL Java_org_mpisws_encounters_encounterformation_SDDR_1Nativ
* Signature: ([BI[B)V
*/
JNIEXPORT
jlong
JNICALL
Java_org_mpisws_encounters_encounterformation_SDDR_1Native_c_1processScanResult
(
JNIEnv
*
env
,
jobject
obj
,
jint
jrssi
,
jbyteArray
jadvert
)
{
(
JNIEnv
*
env
,
jobject
obj
,
jint
jrssi
,
jbyteArray
jadvert
,
jlong
jscantime
)
{
SDDRRadio
*
radioPtr
=
getRadioPtr
(
env
,
obj
);
if
(
jadvert
!=
NULL
)
{
int
advert_len
=
env
->
GetArrayLength
(
jadvert
);
char
*
advert
=
new
char
[
advert_len
];
env
->
GetByteArrayRegion
(
jadvert
,
0
,
advert_len
,
reinterpret_cast
<
jbyte
*>
(
advert
));
return
radioPtr
->
processScanResponse
((
int
)
jrssi
,
std
::
string
(
advert
,
SHA_DIGEST_LENGTH
));
return
radioPtr
->
processScanResponse
((
int
)
jrssi
,
std
::
string
(
advert
,
SHA_DIGEST_LENGTH
),
(
long
)
jscantime
);
}
else
{
// we're confirming an encounter via BLE
return
radioPtr
->
processScanResponse
((
int
)
jrssi
,
std
::
string
(
""
));
return
radioPtr
->
processScanResponse
((
int
)
jrssi
,
std
::
string
(
""
)
,
(
long
)
jscantime
);
}
}
...
...
ebclibrary/src/main/jni/c_SDDRRadio.h
View file @
3ab31510
...
...
@@ -106,7 +106,7 @@ JNIEXPORT void JNICALL Java_org_mpisws_encounters_encounterformation_SDDR_1Nativ
* Signature: ([BI[B)V
*/
JNIEXPORT
jlong
JNICALL
Java_org_mpisws_encounters_encounterformation_SDDR_1Native_c_1processScanResult
(
JNIEnv
*
,
jobject
,
jint
,
jbyteArray
);
(
JNIEnv
*
,
jobject
,
jint
,
jbyteArray
,
jlong
);
/*
* Class: org_mpisws_encounters_encounterformation_SDDR_1Native
...
...
ebclibrary/src/main/jni/include/SDDRRadio.h
View file @
3ab31510
...
...
@@ -106,7 +106,7 @@ public: // to be called via JNI
void
preDiscovery
();
std
::
vector
<
std
::
string
>
postDiscoveryGetEncounters
();
void
changeEpoch
();
long
processScanResponse
(
int8_t
rssi
,
std
::
string
advert
);
long
processScanResponse
(
int8_t
rssi
,
std
::
string
advert
,
long
scantime
);
std
::
string
computeSecretKey
(
std
::
string
myDHKey
,
std
::
string
sha1OtherDHKey
,
std
::
string
otherDHKey
);
ActionInfo
getNextAction
();
void
changeMessagingDHKey
();
...
...
ebclibrary/src/main/jni/source/SDDRRadio.cpp
View file @
3ab31510
...
...
@@ -48,11 +48,11 @@ void SDDRRadio::preDiscovery()
discovered_
.
clear
();
}
long
SDDRRadio
::
processScanResponse
(
int8_t
rssi
,
std
::
string
advert
)
long
SDDRRadio
::
processScanResponse
(
int8_t
rssi
,
std
::
string
advert
,
long
scanTime
)
{
LOG_P
(
TAG
,
"Processing scan response with rssi %d, and data %s"
,
rssi
,
advert
.
c_str
());
uint64_t
scanTime
=
getTimeMS
();
//
uint64_t scanTime = getTimeMS();
EbNDevice
*
device
=
deviceMap_
.
get
(
advert
);
if
(
device
==
NULL
)
{
...
...
@@ -91,7 +91,7 @@ std::vector<std::string> SDDRRadio::postDiscoveryGetEncounters()
for
(
auto
discIt
=
discovered_
.
begin
();
discIt
!=
discovered_
.
end
();
discIt
++
)
{
EncounterEvent
event
(
getTimeMS
()
);
EncounterEvent
event
(
discIt
->
time
);
if
(
getDeviceEvent
(
event
,
discIt
->
id
,
rssiReportInterval_
))
{
encounters
.
push_back
(
event
);
...
...
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