current revision
This commit is contained in:
61
ipin/StepLoggerWrapperAndroid.h
Normal file
61
ipin/StepLoggerWrapperAndroid.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef STEPLOGGERWRAPPERANDROID_H
|
||||
#define STEPLOGGERWRAPPERANDROID_H
|
||||
|
||||
#include "Scaler.h"
|
||||
#include "../nav/NavControllerListener.h"
|
||||
#include <Indoor/misc/Debug.h>
|
||||
|
||||
#ifdef Android
|
||||
#include <QtAndroidExtras>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* sends the position-estimation-result to the step-logger service
|
||||
*/
|
||||
class StepLoggerWrapperAndroid : public NavControllerListener {
|
||||
|
||||
public:
|
||||
|
||||
/** convert from our position-format to ipin position-format */
|
||||
IPINScaler& scaler;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
StepLoggerWrapperAndroid(IPINScaler& scaler) : scaler(scaler) {
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* event fired every 500ms from the navigation controller.
|
||||
* convert from our format to IPIN format
|
||||
* and pass it to the logger
|
||||
*/
|
||||
void onNewEstimation(const Point3 pos_m) override {
|
||||
|
||||
// convert from our coordinate system (meter relative to (0,0,0)) to the WGS84 format
|
||||
const IPIN ipin = scaler.toIPIN3(pos_m);
|
||||
|
||||
// inform the logger
|
||||
log(ipin.lon, ipin.lat, ipin.floorNr);
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/** call java */
|
||||
void log(const double x, const double y, const double z) {
|
||||
|
||||
#ifdef Android
|
||||
Log::add("SLWA", "calling android with lon/lat/floor");
|
||||
int res = QAndroidJniObject::callStaticMethod<int>("indoor/java/StepLoggerClient", "log", "(DDD)I", x, y, z);
|
||||
if (res != 1337) {throw Exception("error while logging");}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // STEPLOGGERWRAPPERANDROID_H
|
||||
Reference in New Issue
Block a user