Readded Wifi RTT Sensor
This commit is contained in:
@@ -40,6 +40,7 @@ import de.fhws.indoor.sensorreadout.sensors.PedestrianActivity;
|
|||||||
import de.fhws.indoor.sensorreadout.sensors.PedestrianActivityButton;
|
import de.fhws.indoor.sensorreadout.sensors.PedestrianActivityButton;
|
||||||
import de.fhws.indoor.sensorreadout.sensors.PhoneSensors;
|
import de.fhws.indoor.sensorreadout.sensors.PhoneSensors;
|
||||||
import de.fhws.indoor.sensorreadout.sensors.WiFi;
|
import de.fhws.indoor.sensorreadout.sensors.WiFi;
|
||||||
|
import de.fhws.indoor.sensorreadout.sensors.WiFiRTT;
|
||||||
import de.fhws.indoor.sensorreadout.sensors.iBeacon;
|
import de.fhws.indoor.sensorreadout.sensors.iBeacon;
|
||||||
import de.fhws.indoor.sensorreadout.sensors.mySensor;
|
import de.fhws.indoor.sensorreadout.sensors.mySensor;
|
||||||
import de.fhws.indoor.sensorreadout.sensors.SensorType;
|
import de.fhws.indoor.sensorreadout.sensors.SensorType;
|
||||||
@@ -449,14 +450,24 @@ public class MainActivity extends Activity {
|
|||||||
@Override public void onData(final SensorType id, final long timestamp, final String csv) {return; }
|
@Override public void onData(final SensorType id, final long timestamp, final String csv) {return; }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// if(activeSensors.contains("WIFI")) {
|
||||||
|
// // log wifi using sensor number 8
|
||||||
|
// final WiFi wifi = new WiFi(this);
|
||||||
|
// sensors.add(wifi);
|
||||||
|
// wifi.setListener(new mySensor.SensorListener() {
|
||||||
|
// @Override public void onData(final long timestamp, final String csv) { add(SensorType.WIFI, csv, timestamp); }
|
||||||
|
// @Override public void onData(final SensorType id, final long timestamp, final String csv) {return; }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
if(activeSensors.contains("WIFI")) {
|
if(activeSensors.contains("WIFI")) {
|
||||||
// log wifi using sensor number 8
|
// log wifi RTT using sensor number 17
|
||||||
final WiFi wifi = new WiFi(this);
|
final WiFiRTT wifirtt = new WiFiRTT(this);
|
||||||
sensors.add(wifi);
|
sensors.add(wifirtt);
|
||||||
wifi.setListener(new mySensor.SensorListener() {
|
wifirtt.setListener(new mySensor.SensorListener() {
|
||||||
@Override public void onData(final long timestamp, final String csv) { add(SensorType.WIFI, csv, timestamp); }
|
@Override public void onData(final long timestamp, final String csv) { add(SensorType.WIFIRTT, csv, timestamp); }
|
||||||
@Override public void onData(final SensorType id, final long timestamp, final String csv) {return; }
|
@Override public void onData(final SensorType id, final long timestamp, final String csv) {return; }
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
if(activeSensors.contains("BLUETOOTH")) {
|
if(activeSensors.contains("BLUETOOTH")) {
|
||||||
// bluetooth permission
|
// bluetooth permission
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ public class WiFiRTT extends mySensor {
|
|||||||
for (final RangingResult res : list) {
|
for (final RangingResult res : list) {
|
||||||
|
|
||||||
int success = 0;
|
int success = 0;
|
||||||
|
long timeStampInNS = 0;
|
||||||
MacAddress mac = res.getMacAddress();
|
MacAddress mac = res.getMacAddress();
|
||||||
int dist = 0;
|
int dist = 0;
|
||||||
int stdDevDist = 0;
|
int stdDevDist = 0;
|
||||||
@@ -128,6 +129,7 @@ public class WiFiRTT extends mySensor {
|
|||||||
|
|
||||||
if (res.getStatus() == RangingResult.STATUS_SUCCESS) {
|
if (res.getStatus() == RangingResult.STATUS_SUCCESS) {
|
||||||
success = 1;
|
success = 1;
|
||||||
|
timeStampInNS = res.getRangingTimestampMillis() * 1000;
|
||||||
dist = res.getDistanceMm();
|
dist = res.getDistanceMm();
|
||||||
stdDevDist = res.getDistanceStdDevMm();
|
stdDevDist = res.getDistanceStdDevMm();
|
||||||
rssi = res.getRssi();
|
rssi = res.getRssi();
|
||||||
@@ -152,7 +154,7 @@ public class WiFiRTT extends mySensor {
|
|||||||
sb.append(numSuccessfulMeas);
|
sb.append(numSuccessfulMeas);
|
||||||
|
|
||||||
|
|
||||||
listener.onData(SensorType.WIFIRTT,res.getRangingTimestampMillis()*1000, sb.toString());
|
listener.onData(SensorType.WIFIRTT,timeStampInNS, sb.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user