コード例 #1
0
QGeoPositionInfoSourceAndroidGms::QGeoPositionInfoSourceAndroidGms(QObject * parent) :
	QGeoPositionInfoSource(parent),
	m_error(NoError),
	regularProvider_(NULL),
	updatesRunning_(false),
	activeProvidersDisabled_(false)
{
	qRegisterMetaType<QGeoPositionInfo>();

	providersListener_ = new QLocationManagerProvidersListener(this);
	regularProvider_ = new QAndroidGmsLocationProvider(this);
	setPreferredPositioningMethods(NonSatellitePositioningMethods);

	if (providersListener_)
	{
		QObject::connect(providersListener_, &QLocationManagerProvidersListener::providersChange,
							this, &QGeoPositionInfoSourceAndroidGms::onProvidersChange);

		onProvidersChange(providersListener_->isActiveProvidersEnabled());
	}

	if (regularProvider_)
	{
		QObject::connect(regularProvider_, &QAndroidGmsLocationProvider::locationRecieved,
						  this, &QGeoPositionInfoSourceAndroidGms::processRegularPositionUpdate);

		QObject::connect(regularProvider_, &QAndroidGmsLocationProvider::statusChanged,
						  this, &QGeoPositionInfoSourceAndroidGms::onStatusChanged);
	}
}
コード例 #2
0
QGeoPositionInfoSourceAndroid::QGeoPositionInfoSourceAndroid(QObject *parent) :
    QGeoPositionInfoSource(parent), updatesRunning(false), m_error(NoError)
{
    qRegisterMetaType< QGeoPositionInfo >();
    androidClassKeyForUpdate = AndroidPositioning::registerPositionInfoSource(this);
    androidClassKeyForSingleRequest = AndroidPositioning::registerPositionInfoSource(this);

    //qDebug() << "androidClassKey: "  << androidClassKeyForUpdate << androidClassKeyForSingleRequest;
    //by default use all methods
    setPreferredPositioningMethods(AllPositioningMethods);

    m_requestTimer.setSingleShot(true);
    QObject::connect(&m_requestTimer, SIGNAL(timeout()), this, SLOT(requestTimeout()));
}
コード例 #3
0
void QGeoPositionInfoSourceBb::setProvider(const QString &provider)
{
    setPreferredPositioningMethods(positioningMethodsToProviderMap.key(provider));
}