Commit 3ab31510 authored by LIly's avatar LIly
Browse files

editing time to be from scan result

parent 69d59bd2
......@@ -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);
}
}
......
......@@ -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
......
......@@ -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();
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment