4#ifndef QOHOSPOSITIONCOMMON_H
5#define QOHOSPOSITIONCOMMON_H
7#include <QtCore/private/qcore_ohos_p.h>
8#include <QtCore/private/qnapi_p.h>
9#include <QtCore/qtimer.h>
14QNapi::Object getGeoLocationManagerObject(QOhosJsState &jsState);
18std::unique_ptr<QTimer> makeSingleShotUpdateTimeoutTimer(
19 int timeoutMs,
std::function<
void()> timeoutCallback);
void setPreferredPositioningMethods(PositioningMethods methods) override
~QOhosGeoPositionInfoSource() override
void startUpdates() override
Starts emitting updates at regular intervals as specified by setUpdateInterval().
PositioningMethods supportedPositioningMethods() const override
Returns the positioning methods available to this source.
void setUpdateInterval(int msec) override
void requestUpdate(int timeout) override
Attempts to get the current position and emit positionUpdated() with this information.
static QOhosGeoPositionInfoSource * tryMakeInstance(QObject *parent)
Error error() const override
Returns the type of error that last occurred.
QOhosGeoPositionInfoSource(QObject *parent)
QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const override
Returns an update containing the last known position, or a null update if none is available.
int minimumUpdateInterval() const override
void stopUpdates() override
Stops emitting updates at regular intervals.
Combined button and popup list for selecting options.
std::shared_ptr< void > registerLocationChangeUpdateHandler(QObject *contextObject, long intervalSec, UserActivityScenario userActivityScenario, QOhosConsumer< const QGeoPositionInfo & > positionInfoUpdateConsumer)
std::shared_ptr< void > registerLocationErrorHandler(QObject *contextObject, QOhosConsumer< LocationError > errorConsumer)
std::optional< UserActivityScenario > tryMapPositioningMethodsToUserActivityScenario(QGeoPositionInfoSource::PositioningMethods positioningMethods)
const char * toStaticString(UserActivityScenario scenario)
@ LOCATING_FAILED_DEFAULT
@ LOCATING_FAILED_INTERNET_ACCESS_FAILURE
@ LOCATING_FAILED_LOCATION_SWITCH_OFF
@ LOCATING_FAILED_BACKGROUND_PERMISSION_DENIED
@ LOCATING_FAILED_LOCATION_PERMISSION_DENIED
QGeoPositionInfo convertLocationObjectToPositionInfo(const QNapi::Object &locationObject)
QGeoPositionInfoSource::Error convertLocationErrorToQtError(LocationError error)
const char * toStaticString(LocationError locationError)
std::shared_ptr< void > makeContinuousPositionInfoUpdateProducer(QObject *contextObject, int intervalMs, QGeoPositionInfoSource::PositioningMethods positioningMethods, QOhosConsumer< const QGeoPositionInfo &, QGeoPositionInfoSource::PositioningMethods > positionInfoUpdateConsumer)
std::shared_ptr< void > makeSinglePositionInfoUpdateProducer(QObject *contextObject, int timeoutMs, QGeoPositionInfoSource::PositioningMethods positioningMethods, QOhosConsumer< std::optional< QGeoPositionInfo >, QGeoPositionInfoSource::PositioningMethods > positionInfoUpdateConsumer)
QGeoPositionInfoSource * tryMakeQOhosGeoPositionInfoSource(QObject *parent)
bool checkLocationOrApproximatelyLocationPermissionGranted()