Exemplo n.º 1
0
void QBluetoothLocalDevicePrivate::setHostMode(QBluetoothLocalDevice::HostMode mode)
{
    if (!isValid())
        return;

    QBluetoothLocalDevice::HostMode currentHostMode = hostMode();
    if (currentHostMode == mode)
        return;
    // If the device is in PowerOff state and the profile is changed then the power has to be turned on
    if (currentHostMode == QBluetoothLocalDevice::HostPoweredOff) {
        qCDebug(QT_BT_QNX) << "Powering on";
        powerOn();
    }

    if (mode == QBluetoothLocalDevice::HostPoweredOff)
        powerOff();
    else if (mode == QBluetoothLocalDevice::HostDiscoverable)   // General discoverable and connectable.
        setAccess(1);
    else if (mode == QBluetoothLocalDevice::HostConnectable)   // Connectable but not discoverable.
        setAccess(3);
    else if (mode == QBluetoothLocalDevice::HostDiscoverableLimitedInquiry)   // Limited discoverable and connectable.
        setAccess(2);
}
void QBluetoothLocalDevicePrivate::setHostMode(QBluetoothLocalDevice::HostMode mode)
{
    //if (m_currentMode==mode){
    //    return;
    //}
    //If the device is in PowerOff state and the profile is changed then the power has to be turned on
    //if (m_currentMode == QBluetoothLocalDevice::HostPoweredOff) {
    //    powerOn();

    //}

    if (mode == QBluetoothLocalDevice::HostPoweredOff) {
        powerOff();
    }
    else if (mode == QBluetoothLocalDevice::HostDiscoverable) { //General discoverable and connectable.
        setAccess(1);
    }
    else if (mode == QBluetoothLocalDevice::HostConnectable) { //Connectable but not discoverable.
        setAccess(3);
    }
    else if (mode == QBluetoothLocalDevice::HostDiscoverableLimitedInquiry) { //Limited discoverable and connectable.
        setAccess(2);
    }
}
Exemplo n.º 3
0
	SpeedProfile::SpeedProfile()
	{
		highways.clear();
		wayModificators.clear();
		nodeModificators.clear();

		acceleration = 2.78;
		decceleration = 2.78;
		tangentialAcceleration = 1.0;
		pedestrian = 10;
		otherCars = 10;

		loadAccessTree( ":/speed profiles/accessTree" );
		setAccess( "motorcar" );

		defaultCitySpeed = true;
		ignoreOneway = false;
		ignoreMaxspeed = false;
	}
Exemplo n.º 4
0
	bool SpeedProfile::load( QString filename )
	{
		QSettings settings( filename, QSettings::IniFormat );

		defaultCitySpeed =  settings.value( "defaultCitySpeed" ).toBool();
		ignoreOneway = settings.value( "ignoreOneway" ).toBool();
		ignoreMaxspeed = settings.value( "ignoreMaxspeed" ).toBool();
		acceleration = settings.value( "acceleration" ).toDouble();
		decceleration = settings.value( "decceleration" ).toDouble();
		tangentialAcceleration = settings.value( "tangentialAcceleration" ).toDouble();
		pedestrian = settings.value( "pedestrian" ).toInt();
		otherCars = settings.value( "otherCars" ).toInt();

		QString accessType = settings.value( "accessType" ).toString();
		if ( !setAccess( accessType ) )
			return false;

		highways.clear();
		int highwayCount = settings.value( "highwayCount" ).toInt();
		for ( int i = 0; i < highwayCount; i++ ) {
			Highway highway;
			highway.priority = settings.value( QString( "highway.%1.priority" ).arg( i ) ).toInt();
			highway.value = settings.value( QString( "highway.%1.value" ).arg( i ) ).toString();
			highway.maxSpeed = settings.value( QString( "highway.%1.maxSpeed" ).arg( i ) ).toInt();
			highway.defaultCitySpeed = settings.value( QString( "highway.%1.defaultCitySpeed" ).arg( i ) ).toInt();
			highway.averageSpeed = settings.value( QString( "highway.%1.averageSpeed" ).arg( i ) ).toInt();
			highway.pedestrian = settings.value( QString( "highway.%1.pedestrian" ).arg( i ) ).toBool();
			highway.otherLeftPenalty = settings.value( QString( "highway.%1.otherLeftPenalty" ).arg( i ) ).toBool();
			highway.otherRightPenalty = settings.value( QString( "highway.%1.otherRightPenalty" ).arg( i ) ).toBool();
			highway.otherStraightPenalty = settings.value( QString( "highway.%1.otherStraightPenalty" ).arg( i ) ).toBool();
			highway.otherLeftEqual = settings.value( QString( "highway.%1.otherLeftEqual" ).arg( i ) ).toBool();
			highway.otherRightEqual = settings.value( QString( "highway.%1.otherRightEqual" ).arg( i ) ).toBool();
			highway.otherStraightEqual = settings.value( QString( "highway.%1.otherStraightEqual" ).arg( i ) ).toBool();
			highway.leftPenalty = settings.value( QString( "highway.%1.leftPenalty" ).arg( i ) ).toInt();
			highway.rightPenalty = settings.value( QString( "highway.%1.rightPenalty" ).arg( i ) ).toInt();

			highways.push_back( highway );
		}

		wayModificators.clear();
		int wayModificatorCount = settings.value( "wayModificatorsCount" ).toInt();
		for ( int i = 0; i < wayModificatorCount; i++ ) {
			WayModificator mod;
			mod.key = settings.value( QString( "wayModificator.%1.key" ).arg( i ) ).toString();
			mod.checkValue = settings.value( QString( "wayModificator.%1.checkValue" ).arg( i ) ).toBool();
			if ( mod.checkValue )
				mod.value = settings.value( QString( "wayModificator.%1.value" ).arg( i ) ).toString();
			mod.invert = settings.value( QString( "wayModificator.%1.invert" ).arg( i ) ).toBool();
			mod.type = ( MoNav::WayModificatorType ) settings.value( QString( "wayModificator.%1.type" ).arg( i ) ).toInt();
			mod.modificatorValue = settings.value( QString( "wayModificator.%1.modificatorValue" ).arg( i ) );

			wayModificators.push_back( mod);
		}

		nodeModificators.clear();
		int nodeModificatorCount = settings.value( "nodeModificatorsCount" ).toInt();
		for ( int i = 0; i < nodeModificatorCount; i++ ) {
			NodeModificator mod;
			mod.key = settings.value( QString( "nodeModificator.%1.key" ).arg( i ) ).toString();
			mod.checkValue = settings.value( QString( "nodeModificator.%1.checkValue" ).arg( i ) ).toBool();
			if ( mod.checkValue )
				mod.value = settings.value( QString( "nodeModificator.%1.value" ).arg( i ) ).toString();
			mod.invert = settings.value( QString( "nodeModificator.%1.invert" ).arg( i ) ).toBool();
			mod.type = ( MoNav::NodeModificatorType ) settings.value( QString( "nodeModificator.%1.type" ).arg( i ) ).toInt();
			mod.modificatorValue = settings.value( QString( "nodeModificator.%1.modificatorValue" ).arg( i ) );

			nodeModificators.push_back( mod );
		}

		if ( !settings.status() == QSettings::NoError ) {
			qCritical() << "error accessing file:" << filename << settings.status();
			return false;
		}

		qDebug() << "OSM Importer:: loaded speed profile:" << filename;
		return true;
	}