Commit 3442598c authored by Lily Tsai's avatar Lily Tsai
Browse files

time

parent a6b24548
......@@ -43,6 +43,8 @@ import java.util.List;
*
**/
public class EncounterBasedCommunication {
public static final long CHANGE_EPOCH_TIME = 15*60000;
public static final long SCAN_BATCH_INTERVAL = (long) (2 * 60000);
public static final int REQUEST_ENABLE_BT = 1;
public static final int REQUEST_ACCESS_FINE_LOCATION = 2;
......
......@@ -11,7 +11,6 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.os.Looper;
import android.os.StrictMode;
import android.util.Log;
import org.apache.commons.lang3.tuple.Pair;
......@@ -19,11 +18,11 @@ import org.mpisws.embeddedsocial.ESClient;
import org.mpisws.helpers.Identifier;
import org.mpisws.encounters.encounterhistory.bridges.EncounterEntriesBridge;
import org.mpisws.encounters.encounterhistory.events.EncounterConfirmEvent;
import org.mpisws.helpers.ThreadPoolManager;
import java.util.HashMap;
import java.util.Map;
import static org.mpisws.encounters.EncounterBasedCommunication.CHANGE_EPOCH_TIME;
import static org.mpisws.encounters.encounterformation.GattServerClient.confirmEvents;
/**
......@@ -34,8 +33,6 @@ import static org.mpisws.encounters.encounterformation.GattServerClient.confirmE
* - running epoch changes and confirmation
*/
public class EncounterFormationCore implements Runnable {
public static final long CHANGE_EPOCH_TIME = 15*60000;
public static final long SCAN_BATCH_INTERVAL = (long) (2 * 60000);
private static final String TAG = EncounterFormationCore.class.getSimpleName();
protected static Identifier mDHPubKey;
protected static Identifier mNonce;
......
......@@ -28,6 +28,7 @@ import android.bluetooth.le.ScanSettings;
import android.content.Context;
import android.os.Handler;
import android.os.ParcelUuid;
import android.os.SystemClock;
import android.util.Log;
import com.google.protobuf.ByteString;
......@@ -50,10 +51,10 @@ import java.util.List;
import java.util.Map;
import static android.bluetooth.le.ScanSettings.SCAN_MODE_LOW_POWER;
import static org.mpisws.encounters.EncounterBasedCommunication.SCAN_BATCH_INTERVAL;
import static org.mpisws.encounters.encounterformation.Advertiser.NONCE_LENGTH_IN_ADVERT;
import static org.mpisws.encounters.encounterformation.Advertiser.PUUID_LENGTH;
import static org.mpisws.encounters.encounterformation.Advertiser.SHA1_LENGTH;
import static org.mpisws.encounters.encounterformation.EncounterFormationCore.SCAN_BATCH_INTERVAL;
import static org.mpisws.encounters.encounterformation.EncounterFormationCore.mDHKey;
import static org.mpisws.encounters.encounterformation.EncounterFormationCore.mDHPubKey;
import static org.mpisws.encounters.encounterformation.EncounterFormationCore.mNonce;
......@@ -185,7 +186,9 @@ public class ScannerProcessor {
// get the rssi
int rssi = result.getRssi();
// process the scan result. if this is a new device, pkid is not null
long pkid = SDDR_Native.c_processScanResult(rssi, newnonce);
// TODO check
long pkid = SDDR_Native.c_processScanResult(rssi, newnonce,
System.currentTimeMillis() - SystemClock.elapsedRealtime() + result.getTimestampNanos() / 1000000);
Log.d(TAG, "Processing SDDR_API scanresult with data " + Utils.getHexString(datahead) + Utils.getHexString(datatail) + ":\n"
+ "newNonce " + Utils.getHexString(newnonce) + ", "
......
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