This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
YASMIN/ipin/StepLoggerWrapperAndroid.h
kazu 44f9b6ac80 performance enhancements
memory enhancements
prevent starting sensors more than once
fix for wifi lag issues
map scaling for huge buildings
2016-10-01 10:21:15 +02:00

62 lines
1.4 KiB
C++

#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("invalid return code while sending the current position to StepLogger.\nService Down?");}
#endif
}
};
#endif // STEPLOGGERWRAPPERANDROID_H