started to add ble functions

added ble as sensor to java and c++
added sensorlistener for ble
added ble to observation and onDataSensor in filter
started to work on ble fingerprints for optimization
This commit is contained in:
mail@toni-fetzer.de
2019-06-05 18:04:31 +02:00
parent b9b9d8f9ac
commit 20ae2f5c2a
23 changed files with 1341 additions and 1152 deletions

View File

@@ -8,6 +8,9 @@
#include "linux/WiFiSensorLinux.h"
#include "android/WiFiSensorAndroid.h"
#include "BLESensor.h"
#include "android/BLESensorAndroid.h"
#include "AccelerometerSensor.h"
#include "dummy/AccelerometerSensorDummy.h"
#include "android/AccelerometerSensorAndroid.h"
@@ -37,58 +40,61 @@ class SensorFactory {
private:
/** this one is a dirty hack, as static class member variables do not work header-only */
static SensorFactory** getPtr() {
static SensorFactory* ptr = nullptr;
return &ptr;
}
/** this one is a dirty hack, as static class member variables do not work header-only */
static SensorFactory** getPtr() {
static SensorFactory* ptr = nullptr;
return &ptr;
}
public:
/** set the to-be-used sensor-fatory */
static void set(SensorFactory* fac) {
Assert::isNull(*getPtr(), "SensorFactory::set() was already called. currentely this is not intended");
*getPtr() = fac;
}
/** set the to-be-used sensor-fatory */
static void set(SensorFactory* fac) {
Assert::isNull(*getPtr(), "SensorFactory::set() was already called. currentely this is not intended");
*getPtr() = fac;
}
/** get the currently configured sensory factory */
static SensorFactory& get() {
Assert::isNotNull(*getPtr(), "call SensorFactory::set() first to set an actual factory instance!");
return **getPtr();
}
/** get the currently configured sensory factory */
static SensorFactory& get() {
Assert::isNotNull(*getPtr(), "call SensorFactory::set() first to set an actual factory instance!");
return **getPtr();
}
public:
/** get the WiFi sensor */
virtual WiFiSensor& getWiFi() = 0;
/** get the WiFi sensor */
virtual WiFiSensor& getWiFi() = 0;
/** get the Accelerometer sensor */
virtual AccelerometerSensor& getAccelerometer() = 0;
/** get the Accelerometer sensor */
virtual AccelerometerSensor& getAccelerometer() = 0;
/** get the Gyroscope sensor */
virtual GyroscopeSensor& getGyroscope() = 0;
/** get the Gyroscope sensor */
virtual GyroscopeSensor& getGyroscope() = 0;
/** get the Barometer sensor */
virtual BarometerSensor& getBarometer() = 0;
/** get the Barometer sensor */
virtual BarometerSensor& getBarometer() = 0;
/** get the compass sensor */
virtual CompassSensor& getCompass() = 0;
/** get the compass sensor */
virtual CompassSensor& getCompass() = 0;
/** get the gps sensor */
virtual GPSSensor& getGPS() = 0;
/** get the gps sensor */
virtual GPSSensor& getGPS() = 0;
/** get the bluetooth low energy sensor */
virtual BLESensor& getBLE() = 0;
/** get the Step sensor */
StepSensor& getSteps() {
static StepSensor steps(getAccelerometer());
return steps;
}
/** get the Step sensor */
StepSensor& getSteps() {
static StepSensor steps(getAccelerometer());
return steps;
}
/** get the Turn sensor */
TurnSensor& getTurns() {
static TurnSensor turns(getAccelerometer(), getGyroscope());
return turns;
}
/** get the Turn sensor */
TurnSensor& getTurns() {
static TurnSensor turns(getAccelerometer(), getGyroscope());
return turns;
}
/** get the Activity sensor */
ActivitySensor& getActivity() {