we are now able to record bluetooth fingerprints
for this, we use the same ui interface and fingerprint positions as wifi. if wifi has done 30 scans, also the ble scans will be stopped. this is just a quick and dirte solution, as changing the gui completely for this two options was to time consuming
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "../sensors/SensorFactory.h"
|
||||
#include "../tools/calibration/WiFiCalibrationDataModel.h"
|
||||
|
||||
#include "../tools/calibration/BLECalibrationDataModel.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -33,20 +33,20 @@ private:
|
||||
} scan;
|
||||
|
||||
/** the measurements model to fill with scan-entries */
|
||||
WiFiFingerprint& model;
|
||||
//BeaconFingerprint& blemodel;
|
||||
WiFiFingerprint& wifiModel;
|
||||
BeaconFingerprint& bleModel;
|
||||
|
||||
public:
|
||||
|
||||
static void get(WiFiFingerprint& model) {
|
||||
WiFiCalibrationScanDialog dlg(model);
|
||||
static void get(WiFiFingerprint& wifiModel, BeaconFingerprint& bleModel) {
|
||||
WiFiCalibrationScanDialog dlg(wifiModel, bleModel);
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/** ctor */
|
||||
WiFiCalibrationScanDialog(WiFiFingerprint& model);
|
||||
WiFiCalibrationScanDialog(WiFiFingerprint& wifiModel, BeaconFingerprint& bleModel);
|
||||
|
||||
void show() {
|
||||
refresh();
|
||||
@@ -63,28 +63,39 @@ private:
|
||||
}
|
||||
|
||||
Q_INVOKABLE void refresh() {
|
||||
lblPoint->setText(QString(model.pos_m.asString().c_str()));
|
||||
lblStats->setText( QString::number(model.measurements.entries.size()) + " RSSI measurements\n" + QString::number(scan.recordsDone) + " scans");
|
||||
lblPoint->setText(QString(wifiModel.pos_m.asString().c_str()));
|
||||
lblStats->setText( QString::number(wifiModel.measurements.entries.size()) + " RSSI measurements\n" + QString::number(scan.recordsDone) + " scans");
|
||||
barProg->setValue(scan.recordsDone);
|
||||
barProg->setMaximum(scan.numRecords);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
model.measurements.entries.clear();
|
||||
wifiModel.measurements.entries.clear();
|
||||
bleModel.measurements.entries.clear();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
void startRecord() {
|
||||
scan.recordsDone = 0;
|
||||
|
||||
//add wifi
|
||||
SensorFactory::get().getWiFi().addListener(this);
|
||||
if (!SensorFactory::get().getWiFi().isRunning()) {
|
||||
SensorFactory::get().getWiFi().start();
|
||||
}
|
||||
|
||||
//add ble
|
||||
SensorFactory::get().getBLE().addListener(this);
|
||||
if (!SensorFactory::get().getBLE().isRunning()) {
|
||||
SensorFactory::get().getBLE().start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void stopRecord() {
|
||||
SensorFactory::get().getWiFi().removeListener(this);
|
||||
SensorFactory::get().getBLE().removeListener(this);
|
||||
}
|
||||
|
||||
virtual void onSensorData(Sensor<WiFiMeasurements>* sensor, const Timestamp ts, const WiFiMeasurements& data) override {
|
||||
@@ -92,7 +103,7 @@ private:
|
||||
(void) ts;
|
||||
++scan.recordsDone;
|
||||
if (scan.recordsDone >= scan.numRecords) {stopRecord();}
|
||||
model.measurements.entries.insert(model.measurements.entries.end(), data.entries.begin(), data.entries.end());
|
||||
wifiModel.measurements.entries.insert(wifiModel.measurements.entries.end(), data.entries.begin(), data.entries.end());
|
||||
QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
@@ -100,8 +111,7 @@ private:
|
||||
virtual void onSensorData(Sensor<BeaconMeasurement>* sensor, const Timestamp ts, const BeaconMeasurement& data) override {
|
||||
(void) sensor;
|
||||
(void) ts;
|
||||
|
||||
|
||||
bleModel.measurements.entries.push_back(data);
|
||||
QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user