Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
jnipositioning.cpp File Reference
#include "jnipositioning.h"
#include "qgeopositioninfosource_android_p.h"
#include "qgeosatelliteinfosource_android_p.h"
#include <QtPositioning/QGeoPositionInfo>
#include <QtCore/QDateTime>
#include <QtCore/QMap>
#include <QtCore/QRandomGenerator>
#include <QtCore/QJniEnvironment>
#include <QtCore/QJniObject>
#include <QtCore/QLoggingCategory>
#include <QtCore/QPermission>
#include <QtCore/QCoreApplication>
#include <QtCore/QTimeZone>
#include <android/log.h>
+ Include dependency graph for jnipositioning.cpp:

Go to the source code of this file.

Classes

class  GlobalClassRefWrapper< T >
 

Namespaces

namespace  AndroidPositioning
 

Macros

#define GET_AND_CHECK_STATIC_METHOD(VAR, METHOD_NAME, ...)
 

Typedefs

typedef QMap< int, QGeoPositionInfoSourceAndroid * > AndroidPositioning::PositionSourceMap
 
typedef QMap< int, QGeoSatelliteInfoSourceAndroid * > AndroidPositioning::SatelliteSourceMap
 

Enumerations

enum  AndroidPositioning::PositionProvider { AndroidPositioning::PROVIDER_GPS = 0 , AndroidPositioning::PROVIDER_NETWORK = 1 , AndroidPositioning::PROVIDER_PASSIVE = 2 }
 

Functions

int AndroidPositioning::registerPositionInfoSource (QObject *obj)
 
void AndroidPositioning::unregisterPositionInfoSource (int key)
 
QGeoPositionInfoSource::PositioningMethods AndroidPositioning::availableProviders ()
 
QGeoPositionInfo AndroidPositioning::positionInfoFromJavaLocation (const jobject &location)
 
QList< QGeoSatelliteInfoAndroidPositioning::satelliteInfoFromJavaLocation (JNIEnv *jniEnv, jobjectArray satellites, QList< QGeoSatelliteInfo > *usedInFix)
 
QList< QGeoSatelliteInfoAndroidPositioning::satelliteInfoFromJavaGnssStatus (jobject gnssStatus, QList< QGeoSatelliteInfo > *usedInFix)
 
QGeoPositionInfo AndroidPositioning::lastKnownPosition (bool fromSatellitePositioningMethodsOnly)
 
int AndroidPositioning::positioningMethodToInt (QGeoPositionInfoSource::PositioningMethods m)
 
QGeoPositionInfoSource::Error AndroidPositioning::startUpdates (int androidClassKey)
 
void AndroidPositioning::stopUpdates (int androidClassKey)
 
QGeoPositionInfoSource::Error AndroidPositioning::requestUpdate (int androidClassKey, int timeout)
 
QGeoSatelliteInfoSource::Error AndroidPositioning::startSatelliteUpdates (int androidClassKey, bool isSingleRequest, int requestTimeout)
 
bool AndroidPositioning::hasPositioningPermissions ()
 
static void positionUpdated (JNIEnv *env, jobject thiz, QtJniTypes::Location location, jint androidClassKey, jboolean isSingleUpdate)
 
static void locationProvidersDisabled (JNIEnv *env, jobject thiz, jint androidClassKey)
 
static void locationProvidersChanged (JNIEnv *env, jobject thiz, jint androidClassKey)
 
static void notifySatelliteInfoUpdated (const QList< QGeoSatelliteInfo > &inView, const QList< QGeoSatelliteInfo > &inUse, jint androidClassKey, jboolean isSingleUpdate)
 
static void satelliteGpsUpdated (JNIEnv *env, jobject thiz, jobjectArray satellites, jint androidClassKey, jboolean isSingleUpdate)
 
static void satelliteGnssUpdated (JNIEnv *env, jobject thiz, QtJniTypes::GnssStatus gnssStatus, jint androidClassKey, jboolean isSingleUpdate)
 
static bool registerNatives ()
 
Q_DECL_EXPORT jint JNICALL JNI_OnLoad (JavaVM *, void *)
 

Variables

static GlobalClassRefWrapper< QtJniTypes::QtPositioning > positioningClass
 
static jmethodID providerListMethodId
 
static jmethodID lastKnownPositionMethodId
 
static jmethodID startUpdatesMethodId
 
static jmethodID stopUpdatesMethodId
 
static jmethodID requestUpdateMethodId
 
static jmethodID startSatelliteUpdatesMethodId
 
static const char logTag [] = "qt.positioning.android"
 
static const char methodErrorMsg [] = "Can't find method \"%s%s\""
 

Macro Definition Documentation

◆ GET_AND_CHECK_STATIC_METHOD

#define GET_AND_CHECK_STATIC_METHOD (   VAR,
  METHOD_NAME,
  ... 
)
Value:
VAR = env.findStaticMethod<__VA_ARGS__>(positioningClass(), METHOD_NAME); \
if (!VAR) { \
__android_log_print(ANDROID_LOG_FATAL, logTag, methodErrorMsg, METHOD_NAME, \
QtJniTypes::methodSignature<__VA_ARGS__>().data()); \
return false; \
}
static const char logTag[]
static GlobalClassRefWrapper< QtJniTypes::QtPositioning > positioningClass
static const char methodErrorMsg[]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data

Definition at line 644 of file jnipositioning.cpp.

Function Documentation

◆ JNI_OnLoad()

Q_DECL_EXPORT jint JNICALL JNI_OnLoad ( JavaVM *  ,
void  
)

Definition at line 688 of file jnipositioning.cpp.

References logTag, and registerNatives().

+ Here is the call graph for this function:

◆ locationProvidersChanged()

static void locationProvidersChanged ( JNIEnv *  env,
jobject  thiz,
jint  androidClassKey 
)
static

Definition at line 587 of file jnipositioning.cpp.

References Qt::AutoConnection, QMetaObject::invokeMethod(), Q_UNUSED, and qCWarning.

Referenced by registerNatives().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ locationProvidersDisabled()

static void locationProvidersDisabled ( JNIEnv *  env,
jobject  thiz,
jint  androidClassKey 
)
static

Definition at line 571 of file jnipositioning.cpp.

References Qt::AutoConnection, QMetaObject::invokeMethod(), Q_UNUSED, and qCWarning.

Referenced by registerNatives().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ notifySatelliteInfoUpdated()

static void notifySatelliteInfoUpdated ( const QList< QGeoSatelliteInfo > &  inView,
const QList< QGeoSatelliteInfo > &  inUse,
jint  androidClassKey,
jboolean  isSingleUpdate 
)
static

Definition at line 601 of file jnipositioning.cpp.

References Qt::AutoConnection, QMetaObject::invokeMethod(), Q_ARG, and qCWarning.

Referenced by satelliteGnssUpdated(), and satelliteGpsUpdated().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ positionUpdated()

static void positionUpdated ( JNIEnv *  env,
jobject  thiz,
QtJniTypes::Location  location,
jint  androidClassKey,
jboolean  isSingleUpdate 
)
static

Definition at line 548 of file jnipositioning.cpp.

References Qt::AutoConnection, info, QMetaObject::invokeMethod(), AndroidPositioning::positionInfoFromJavaLocation(), Q_ARG, Q_UNUSED, and qCWarning.

Referenced by registerNatives().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerNatives()

static bool registerNatives ( )
static

Definition at line 652 of file jnipositioning.cpp.

References GET_AND_CHECK_STATIC_METHOD, lastKnownPositionMethodId, locationProvidersChanged(), locationProvidersDisabled(), logTag, positioningClass, positionUpdated(), providerListMethodId, requestUpdateMethodId, satelliteGnssUpdated(), satelliteGpsUpdated(), startSatelliteUpdatesMethodId, startUpdatesMethodId, and stopUpdatesMethodId.

Referenced by JNI_OnLoad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ satelliteGnssUpdated()

static void satelliteGnssUpdated ( JNIEnv *  env,
jobject  thiz,
QtJniTypes::GnssStatus  gnssStatus,
jint  androidClassKey,
jboolean  isSingleUpdate 
)
static

Definition at line 630 of file jnipositioning.cpp.

References notifySatelliteInfoUpdated(), Q_UNUSED, and AndroidPositioning::satelliteInfoFromJavaGnssStatus().

Referenced by registerNatives().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ satelliteGpsUpdated()

static void satelliteGpsUpdated ( JNIEnv *  env,
jobject  thiz,
jobjectArray  satellites,
jint  androidClassKey,
jboolean  isSingleUpdate 
)
static

Definition at line 617 of file jnipositioning.cpp.

References notifySatelliteInfoUpdated(), Q_UNUSED, and AndroidPositioning::satelliteInfoFromJavaLocation().

Referenced by registerNatives().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ lastKnownPositionMethodId

jmethodID lastKnownPositionMethodId
static

Definition at line 62 of file jnipositioning.cpp.

Referenced by AndroidPositioning::lastKnownPosition(), and registerNatives().

◆ logTag

const char logTag[] = "qt.positioning.android"
static

Definition at line 68 of file jnipositioning.cpp.

Referenced by JNI_OnLoad(), and registerNatives().

◆ methodErrorMsg

const char methodErrorMsg[] = "Can't find method \"%s%s\""
static

Definition at line 69 of file jnipositioning.cpp.

◆ positioningClass

◆ providerListMethodId

jmethodID providerListMethodId
static

Definition at line 61 of file jnipositioning.cpp.

Referenced by AndroidPositioning::availableProviders(), and registerNatives().

◆ requestUpdateMethodId

jmethodID requestUpdateMethodId
static

Definition at line 65 of file jnipositioning.cpp.

Referenced by registerNatives(), and AndroidPositioning::requestUpdate().

◆ startSatelliteUpdatesMethodId

jmethodID startSatelliteUpdatesMethodId
static

◆ startUpdatesMethodId

jmethodID startUpdatesMethodId
static

Definition at line 63 of file jnipositioning.cpp.

Referenced by registerNatives(), and AndroidPositioning::startUpdates().

◆ stopUpdatesMethodId

jmethodID stopUpdatesMethodId
static

Definition at line 64 of file jnipositioning.cpp.

Referenced by registerNatives(), and AndroidPositioning::stopUpdates().