--- a/group/bld.inf Thu Apr 01 08:30:34 2010 +0300
+++ b/group/bld.inf Thu Apr 15 08:16:03 2010 +0300
@@ -25,12 +25,7 @@
TOOLS2
PRJ_EXPORTS
-qtextensionsconfig.xml /epoc32/tools/makefile_templates/qt/qtextensionsconfig.xml
-qtextensionsconfig.flm /epoc32/tools/makefile_templates/qt/qtextensionsconfig.flm
-qtextensionsconfig.mk /epoc32/tools/makefile_templates/qt/qtextensionsconfig.mk
-qtextensionsconfig.meta /epoc32/tools/makefile_templates/qt/qtextensionsconfig.meta
-
-../qtmobility/features/mobility.prf /epoc32/tools/qt/mkspecs/features/mobility.prf
+../qtmobility/features/mobility.prf /epoc32/tools/qt/mkspecs/features/mobility.prf
//For UDA image
../qtmobility/confml/qtmobility.confml CONFML_EXPORT_PATH(qtmobility.confml,uda_content)
@@ -45,10 +40,4 @@
PRJ_EXTENSIONS
-START EXTENSION qt/qtextensionsconfig
-OPTION MODULES bearer
-OPTION TESTS -tests
-OPTION EXAMPLES -examples
-OPTION DOCS -no-docs
-END
--- a/group/cmaker/config/export.mk Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, version 2.1 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not,
-# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-#
-# Description: makefile_templates, actual build configuration export makefile
-#
-
-MAKEFILE = /sf/mw/qtextensions/group/cmaker/config/export.mk
-
-
-$(call push,MAKEFILE_STACK,$(MAKEFILE))
-
-
-TEMPLATEMAKEFILES = /sf/mw/qtextensions/group/qtextensionsconfig.meta /epoc32/tools/makefile_templates/qt/
-
-
-template_makefiles :: template_makefiles_config
-
-
-$(call addfiles, $(TEMPLATEMAKEFILES), template_makefiles_config)
-
-
-$(call popout,MAKEFILE_STACK)
-
--- a/group/cmaker/makefile Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, version 2.1 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not,
-# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-#
-# Description: exporting of *.meta file via cmaker
-#
-
-MAKEFILE = /sf/mw/qtextensions/group/cmaker/makefile
-
-# Place the first target as the default target which is executed from this level
-
-export_template_files :: template_makefiles
-
-include include_template.mk
--- a/group/qtextensionsconfig.flm Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-# /****************************************************************************
-# **
-# ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# ** Contact:
-# **
-# ****************************************************************************/
-
-# FLM to configure QtMobility.
-
-QT_ROOT := $(EPOCROOT)/epoc32/tools/qt/
-QTMOBILITY_ROOT := $(subst group,,$(subst \,/,$(EXTENSION_ROOT)qtmobility/))
-
-# Determine which platform we are building on
-ifeq ($(OSTYPE),unix)
-DOTBAT :=
-else
-DOTBAT := .bat
-endif
-
-define QtExtensionsConfiguration
-QTMOBILITY:
- $(call startrule,qtextensionsconf) \
- echo Configuring QtMobility && \
- echo EPOCROOT $(EPOCROOT) && \
- echo QT_ROOT $(QT_ROOT) && \
- echo QTMOBILITY_ROOT $(QTMOBILITY_ROOT) && \
- echo DOTBAT $(DOTBAT) && \
- echo MODULES $(MODULES) && \
- echo TESTS $(TESTS) && \
- echo EXAMPLES $(EXAMPLES) && \
- echo DOCS $(DOCS) && \
- cd $(QTMOBILITY_ROOT) && \
- $(QTMOBILITY_ROOT)configure$(DOTBAT) -qt $(QT_ROOT) -prefix $(QTMOBILITY_ROOT) -modules "$(MODULES)" $(TESTS) $(EXAMPLES) $(DOCS) \
- $(call endrule,qtextensionsconf)
-endef
-
-ALL:: QTMOBILITY
-$(eval $(call QtExtensionsConfiguration))
--- a/group/qtextensionsconfig.meta Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# Meta information for Python Py2exe
-#
-# Copyright (c) 2007 Symbian Software Ltd. All rights reserved.
-#
-
-platform tools2
-makefile gnumake
-techstream qt
--- a/group/qtextensionsconfig.mk Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, version 2.1 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program. If not,
-# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-#
-# Description:
-#
-
-# All paths used in this file end with the path delimiter '/'
-
-include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk
-
-EPOC_ROOT := $(subst \,/,$(EPOCROOT))
-QT_ROOT := $(EPOC_ROOT)epoc32/tools/qt/
-QTMOBILITY_ROOT := $(subst group,,$(subst \,/,$(EXTENSION_ROOT)qtmobility/))
-
-# Determine which platform we are building on
-ifeq ($(OSTYPE),unix)
-DOTBAT :=
-else
-QTMOBILITY_ROOT:= $(subst /,\,$(QTMOBILITY_ROOT))
-QT_ROOT:= $(subst /,\,$(QT_ROOT))
-DOTBAT := .bat
-endif
-
-QTMOBILITY:
- echo Configuring QtMobility
- echo EPOCROOT $(EPOCROOT)
- echo EPOC_ROOT $(EPOC_ROOT)
- echo EXTENSION_ROOT $(EXTENSION_ROOT)
- echo QT_ROOT $(QT_ROOT)
- echo QTMOBILITY_ROOT $(QTMOBILITY_ROOT)
- echo DOTBAT $(DOTBAT)
- echo MODULES $(MODULES)
- echo TESTS $(TESTS)
- echo TESTS $(TESTS)
- echo DOCS $(DOCS)
- cd $(QTMOBILITY_ROOT) && $(QTMOBILITY_ROOT)configure$(DOTBAT) -qt $(QT_ROOT) -prefix $(QTMOBILITY_ROOT) -modules "$(MODULES)" $(TESTS) $(EXAMPLES) $(DOCS)
-
-do_nothing:
-
-MAKMAKE : do_nothing
-
-BLD : QTMOBILITY
-
-FINAL : do_nothing
-
-CLEAN : do_nothing
-
-RELEASABLES : do_nothing
-
-SAVESPACE : BLD
-
-FREEZE : do_nothing
-
-LIB : do_nothing
-
-CLEANLIB : do_nothing
-
-RESOURCE : do_nothing
-
-
-
--- a/group/qtextensionsconfig.xml Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<build xmlns="http://symbian.com/xml/build"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://symbian.com/xml/build http://symbian.com/xml/build/2_0.xsd">
-
- <!-- Tools interfaces -->
-
- <interface name="qt.qtextensionsconfig" extends="Symbian.UserFLM" flm="qtextensionsconfig.flm">
- <param name='MODULES' default='' />
- <param name='TESTS' default='' />
- <param name='EXAMPLES' default='' />
- <param name='DOCS' default='' />
- </interface>
-
- <interface name="qt.qtextensions_pre_targetdep.export" extends="Symbian.UserFLM"
- flm="qtextensions_pre_targetdep.flm">
- <param name='PREDEP_TARGET' />
- <param name='DEPS' default = '' />
- <param name='COMMAND' default = '' />
- </interface>
-
-</build>
--- a/qtmobility/common.pri Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/common.pri Thu Apr 15 08:16:03 2010 +0300
@@ -13,6 +13,11 @@
include(staticconfig.pri)
+symbian:contains(symbian_symbols_unfrozen,1) {
+ #see configure.bat for details
+ MMP_RULES+="EXPORTUNFROZEN"
+}
+
mac {
contains(QT_CONFIG, qt_framework):contains(TEMPLATE, lib) {
#MacOSX always builds debug and release libs when using mac framework
@@ -74,7 +79,7 @@
contains(QT_CONFIG, reduce_exports):CONFIG+=hide_symbols
#export more symbols if we build the unit tests
-#contains(build_unit_tests, yes):DEFINES+=QTM_BUILD_UNITTESTS
+contains(build_unit_tests, yes):DEFINES+=QTM_BUILD_UNITTESTS
#test whether we have a unit test
!testcase {
@@ -108,11 +113,6 @@
QMAKE_RPATHDIR += $$OUTPUT_DIR/lib
}
-# On Symbian, we are freezing libraryies only
-#symbian:!isEmpty(defFilePath) {
-# MMP_RULES += "EXPORTUNFROZEN"
-#}
-
contains(TEMPLATE,.*lib):DEFINES += QT_SHARED
maemo6 {
@@ -123,7 +123,7 @@
}
maemo5 {
DEFINES+= Q_WS_MAEMO_5
-}
+ LIBS += -lgconf-2 -lrtcom-eventlogger -lmodest-dbus-client-1.0 -losso -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 -ltpsession -ltelepathy-qt4}
maemo* {
LIBS += -L/opt/qt4-maemo5/lib
QMAKE_LFLAGS += -Wl,-rpath,/opt/qt4-maemo5/lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtmobility/config.pri Thu Apr 15 08:16:03 2010 +0300
@@ -0,0 +1,14 @@
+build_unit_tests = no
+build_examples = no
+build_docs = no
+qmf_enabled = no
+isEmpty($$QT_MOBILITY_INCLUDE):QT_MOBILITY_INCLUDE=$$QT_MOBILITY_PREFIX/include
+isEmpty($$QT_MOBILITY_LIB):QT_MOBILITY_LIB=$$QT_MOBILITY_PREFIX/lib
+isEmpty($$QT_MOBILITY_BIN):QT_MOBILITY_BIN=$$QT_MOBILITY_PREFIX/bin
+mobility_modules = bearer
+maemo5|maemo6:mobility_modules -= systeminfo
+contains(mobility_modules,versit): mobility_modules *= contacts
+lbt_enabled = yes
+snap_enabled = yes
+occ_enabled = yes
+symbiancntsim_enabled = yes
--- a/qtmobility/configure Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/configure Thu Apr 15 08:16:03 2010 +0300
@@ -209,10 +209,29 @@
findframeworks
+findUniversal()
+{
+ if [ -e "mac.inc" ]; then
+ rm mac.inc
+ fi
+ echo "contains(QT_CONFIG,x86): system(echo CONFIG+=x86 >> mac.inc)" > 2.pro
+ echo "contains(QT_CONFIG,ppc): system(echo CONFIG+=ppc >> mac.inc)" >> 2.pro
+ echo "contains(QT_CONFIG,ppc64): system(echo CONFIG+=ppc64 >> mac.inc)" >> 2.pro
+ echo "contains(QT_CONFIG,x86_64): system(echo CONFIG+=x86_64 >> mac.inc)" >> 2.pro
+ SOMETIME=`qmake 2.pro 2>&1`
+ rm 2.pro
+ if [ -e "mac.inc" ]; then
+ echo "exists(mac.inc): include(mac.inc)" >> "$CONFIG_IN"
+ fi
+}
+
+
if [ -n "$BUILD_SILENT" ]; then
echo "CONFIG += silent" > "$CONFIG_IN"
fi
+findUniversal
+
if [ -z "$RELEASEMODE" ]; then
RELEASEMODE="debug"
fi
@@ -348,7 +367,7 @@
cd config.tests/$2
fi
- qmake "$relpath/config.tests/$2/$2.pro" >> "$CONFIG_LOG"
+ qmake "$relpath/config.tests/$2/$2.pro" 2>> "$CONFIG_LOG" >> "$CONFIG_LOG"
printf " ."
"$MAKE" clean >> "$CONFIG_LOG"
printf "."
@@ -368,6 +387,7 @@
compileTest QMF qmf
compileTest NetworkManager networkmanager
compileTest "CoreWLAN (MacOS 10.6)" corewlan
+compileTest "Maemo ICD" maemo-icd
# Now module selection
# using 'expr match ....' should help a bit
@@ -379,6 +399,7 @@
# It's a lot easier to make qmake do the dependency checking...
echo "mobility_modules = $MOBILITY_MODULES" >> "$CONFIG_IN"
echo "contains(mobility_modules,versit): mobility_modules *= contacts" >> "$CONFIG_IN"
+echo "maemo5|maemo6:contains(maemo-icd_enabled, no): mobility_modules -= bearer" >> "$CONFIG_IN"
# Ideally we'd skip generating headers for modules that are not enabled
echo "Generating Mobility Headers..."
@@ -410,7 +431,6 @@
;;
multimedia)
$relpath/bin/syncheaders $shadowpath/include $relpath/src/multimedia
- $relpath/bin/syncheaders $shadowpath/include $relpath/src/multimedia/experimental
;;
messaging)
$relpath/bin/syncheaders $shadowpath/include $relpath/src/messaging
@@ -434,7 +454,9 @@
mv "$CONFIG_IN" config.pri
mkdir -p "$shadowpath/features"
-cp -f "$relpath/features/strict_flags.prf" "$shadowpath/features"
+if [ "$shadowpath" != "$relpath" ]; then
+ cp -f "$relpath/features/strict_flags.prf" "$shadowpath/features"
+fi
echo "Running qmake..."
if qmake -recursive "$relpath/qtmobility.pro"; then
--- a/qtmobility/configure.bat Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/configure.bat Thu Apr 15 08:16:03 2010 +0300
@@ -66,33 +66,30 @@
if exist "%PROJECT_LOG%" del %PROJECT_LOG%
if exist "%PROJECT_CONFIG%" del %PROJECT_CONFIG%
-set MOD_SOURCE_PATH=%SOURCE_PATH:\=/%
-set MOD_BUILD_PATH=%BUILD_PATH:\=/%
-echo QT_MOBILITY_SOURCE_TREE = $${EPOCROOT}%MOD_SOURCE_PATH:~3%
-REM echo QT_MOBILITY_SOURCE_TREE = $${EPOCROOT}%MOD_SOURCE_PATH:~3% > %QMAKE_CACHE%
-echo QT_MOBILITY_BUILD_TREE = $${EPOCROOT}%MOD_BUILD_PATH:~3%
-REM echo QT_MOBILITY_BUILD_TREE = $${EPOCROOT}%MOD_BUILD_PATH:~3% >> %QMAKE_CACHE%
+echo QT_MOBILITY_SOURCE_TREE = %SOURCE_PATH% > %QMAKE_CACHE%
+echo QT_MOBILITY_BUILD_TREE = %BUILD_PATH% >> %QMAKE_CACHE%
set QMAKE_CACHE=
:cmdline_parsing
-if "%1" == "" goto startProcessing
-if "%1" == "-debug" goto debugTag
-if "%1" == "-release" goto releaseTag
-if "%1" == "-silent" goto silentTag
-if "%1" == "-prefix" goto prefixTag
-if "%1" == "-libdir" goto libTag
-if "%1" == "-bindir" goto binTag
-if "%1" == "-headerdir" goto headerTag
-if "%1" == "-tests" goto testTag
-if "%1" == "-examples" goto exampleTag
-if "%1" == "-qt" goto qtTag
-if "%1" == "-vc" goto vcTag
-if "%1" == "-no-docs" goto nodocsTag
-if "%1" == "-modules" goto modulesTag
-if "%1" == "/?" goto usage
-if "%1" == "-h" goto usage
-if "%1" == "-help" goto usage
-if "%1" == "--help" goto usage
+if "%1" == "" goto startProcessing
+if "%1" == "-debug" goto debugTag
+if "%1" == "-release" goto releaseTag
+if "%1" == "-silent" goto silentTag
+if "%1" == "-prefix" goto prefixTag
+if "%1" == "-libdir" goto libTag
+if "%1" == "-bindir" goto binTag
+if "%1" == "-headerdir" goto headerTag
+if "%1" == "-tests" goto testTag
+if "%1" == "-examples" goto exampleTag
+if "%1" == "-qt" goto qtTag
+if "%1" == "-vc" goto vcTag
+if "%1" == "-no-docs" goto nodocsTag
+if "%1" == "-modules" goto modulesTag
+if "%1" == "/?" goto usage
+if "%1" == "-h" goto usage
+if "%1" == "-help" goto usage
+if "%1" == "--help" goto usage
+if "%1" == "-symbian-unfrozen" goto unfrozenTag
echo Unknown option: "%1"
@@ -124,6 +121,7 @@
echo -modules ^<list^> ... Build only the specified modules (default all)
echo Choose from: bearer contacts location publishsubscribe
echo messaging multimedia systeminfo serviceframework versit
+ echo sensors
echo Modules should be separated by a space and surrounded
echo by double quotation. If a
echo selected module depends on other modules dependencies
@@ -181,6 +179,18 @@
shift
goto cmdline_parsing
+:unfrozenTag
+REM Should never be used in release builds
+REM Some SDK's seem to exclude Q_AUTOTEST_EXPORT symbols if the
+REM libraries are frozen. This breaks unit tests relying on the auto test exports
+REM This flag unfreezes the SYMBIAN libraries for the purpose of unit test building.
+REM Ideally this should be connected to '-tests' option but that would prevent
+REM integration testing for frozen symbols as the CI system should test unit tests
+REM and frozen symbol compliance.
+echo symbian_symbols_unfrozen = 1 >> %PROJECT_CONFIG%
+shift
+goto cmdline_parsing
+
:testTag
set BUILD_UNITTESTS=yes
shift
@@ -290,17 +300,12 @@
goto :exitTag
:prefixExists
-set MOD_QT_MOBILITY_PREFIX=%QT_MOBILITY_PREFIX:/=\%
-cd /D %MOD_QT_MOBILITY_PREFIX%
+cd /D %QT_MOBILITY_PREFIX%
set QT_MOBILITY_PREFIX=%CD%
cd /D %CURRENTDIR%
:endprefixProcessing
-echo QT_MOBILITY_SOURCE_TREE = $${EPOCROOT}%MOD_SOURCE_PATH:~3% > %PROJECT_CONFIG%
-echo QT_MOBILITY_BUILD_TREE = $${EPOCROOT}%MOD_BUILD_PATH:~3% >> %PROJECT_CONFIG%
-set MOD_QT_MOBILITY_PREFIX=%QT_MOBILITY_PREFIX:\=/%
-echo QT_MOBILITY_PREFIX = $${EPOCROOT}%MOD_QT_MOBILITY_PREFIX:~3%
-echo QT_MOBILITY_PREFIX = $${EPOCROOT}%MOD_QT_MOBILITY_PREFIX:~3% >> %PROJECT_CONFIG%
+echo QT_MOBILITY_PREFIX = %QT_MOBILITY_PREFIX% >> %PROJECT_CONFIG%
echo build_unit_tests = %BUILD_UNITTESTS% >> %PROJECT_CONFIG%
set BUILD_UNITTESTS=
@@ -322,9 +327,9 @@
echo maemo5^|maemo6:mobility_modules -= systeminfo >> %PROJECT_CONFIG%
echo contains(mobility_modules,versit): mobility_modules *= contacts >> %PROJECT_CONFIG%
-REM echo Checking available Qt
-REM call %QT_PATH%qmake -v >> %PROJECT_LOG% 2>&1
-REM if errorlevel 1 goto qmakeNotFound
+echo Checking available Qt
+call %QT_PATH%qmake -v >> %PROJECT_LOG% 2>&1
+if errorlevel 1 goto qmakeNotFound
goto qmakeFound
:qmakeNotFound
echo ... Not found >> %PROJECT_LOG% 2>&1
@@ -338,7 +343,7 @@
goto errorTag
:qmakeFound
-REM call %QT_PATH%qmake -query QT_VERSION
+call %QT_PATH%qmake -query QT_VERSION
goto checkMake
@@ -388,10 +393,9 @@
call endlocal&set %1=%MAKE%&set %2=%BUILDSYSTEM%&goto :EOF
:checkMake
-REM echo Checking make
-REM call :makeTest MOBILITY_MAKE MOBILITY_BUILDSYSTEM
-REM if not "%MOBILITY_MAKE%" == "" goto compileTests
-goto compileTests
+echo Checking make
+call :makeTest MOBILITY_MAKE MOBILITY_BUILDSYSTEM
+if not "%MOBILITY_MAKE%" == "" goto compileTests
echo >&2Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH
echo >&2Aborting.
@@ -440,12 +444,10 @@
echo.
echo Start of compile tests
REM compile tests go here.
-REM call :compileTest LBT lbt
-echo lbt_enabled = yes >> %PROJECT_CONFIG%
-REM call :compileTest SNAP snap
-echo snap_enabled = yes >> %PROJECT_CONFIG%
-REM call :compileTest SymbianContactSIM symbiancntsim
-echo symbiancntsim_enabled = yes >> %PROJECT_CONFIG%
+call :compileTest LBT lbt
+call :compileTest SNAP snap
+call :compileTest OCC occ
+call :compileTest SymbianContactSIM symbiancntsim
echo End of compile tests
echo.
echo.
@@ -454,7 +456,7 @@
if not exist "%BUILD_PATH%\features" mkdir %BUILD_PATH%\features
copy %SOURCE_PATH%\features\strict_flags.prf %BUILD_PATH%\features
echo Generating Mobility Headers...
-if exist "%BUILD_PATH%\include" rd /s /q %BUILD_PATH%\include
+rd /s /q %BUILD_PATH%\include
mkdir %BUILD_PATH%\include
perl -S %SOURCE_PATH%\bin\syncheaders %BUILD_PATH%\include %SOURCE_PATH%\src\global
@@ -513,12 +515,11 @@
ren %PROJECT_CONFIG% config.pri
echo.
-REM echo Running qmake...
-REM call %QT_PATH%qmake -recursive %VC_TEMPLATE_OPTION% %SOURCE_PATH%\qtmobility.pro
-REM if errorlevel 1 goto qmakeRecError
-REM echo.
-echo configure has finished.
-REM You may run %MOBILITY_MAKE% to build the project now.
+echo Running qmake...
+call %QT_PATH%qmake -recursive %VC_TEMPLATE_OPTION% %SOURCE_PATH%\qtmobility.pro
+if errorlevel 1 goto qmakeRecError
+echo.
+echo configure has finished. You may run %MOBILITY_MAKE% to build the project now.
goto exitTag
:qmakeRecError
Binary file qtmobility/data/qtmobility.sisx has changed
--- a/qtmobility/examples/bearercloud/cloud.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/examples/bearercloud/cloud.h Thu Apr 15 08:16:03 2010 +0300
@@ -56,7 +56,7 @@
Q_INTERFACES(QGraphicsItem)
public:
- Cloud(const QNetworkConfiguration &config, QGraphicsItem *parent = 0);
+ explicit Cloud(const QNetworkConfiguration &config, QGraphicsItem *parent = 0);
~Cloud();
enum { Type = UserType + 1 };
--- a/qtmobility/examples/bearermonitor/sessionwidget.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/examples/bearermonitor/sessionwidget.h Thu Apr 15 08:16:03 2010 +0300
@@ -53,7 +53,7 @@
Q_OBJECT
public:
- SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
+ explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
~SessionWidget();
private:
--- a/qtmobility/examples/examples.pri Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/examples/examples.pri Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,6 @@
include(../staticconfig.pri)
-!contains(build_examples, yes):error(Please use the -examples configure switch to enable building of examples)
+#!contains(build_examples, yes):error(Please use the -examples configure switch to enable building of examples)
win32:contains(CONFIG_WIN32,build_all):Win32DebugAndRelease=yes
mac | contains(Win32DebugAndRelease,yes) {
--- a/qtmobility/examples/examples.pro Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/examples/examples.pro Thu Apr 15 08:16:03 2010 +0300
@@ -6,5 +6,7 @@
contains(mobility_modules,bearer) {
SUBDIRS += bearermonitor bearercloud
}
-#BLD_INF_RULES.prj_exports += "./rom/qtmobilityexamples.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(qtmobilityexamples.iby)"
+symbian {
+ SUBDIRS += s60installs/s60installs.pro
+}
--- a/qtmobility/examples/rom/qtmobilityexamples.iby Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program. If not,
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-#ifndef __QT_MOBILITYEXAMPLES_IBY__
-#define __QT_MOBILITYEXAMPLES_IBY__
-
-#include <bldvariant.hrh>
-
-#define UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc
-
-S60_APP_EXE(bearercloud)
-S60_APP_RESOURCE(bearercloud)
-UPGRADABLE_APP_REG_RSC(bearercloud)
-
-S60_APP_EXE(bearermonitor)
-S60_APP_RESOURCE(bearermonitor)
-UPGRADABLE_APP_REG_RSC(bearermonitor)
-
-#endif //__QT_MOBILITYEXAMPLES_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtmobility/examples/s60installs/qtmobilityexamples.iby Thu Apr 15 08:16:03 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+
+#ifndef __QT_MOBILITYEXAMPLES_IBY__
+#define __QT_MOBILITYEXAMPLES_IBY__
+
+#include <bldvariant.hrh>
+
+#define UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc
+
+S60_APP_EXE(bearercloud)
+S60_APP_RESOURCE(bearercloud)
+UPGRADABLE_APP_REG_RSC(bearercloud)
+
+S60_APP_EXE(bearermonitor)
+S60_APP_RESOURCE(bearermonitor)
+UPGRADABLE_APP_REG_RSC(bearermonitor)
+
+#endif //__QT_MOBILITYEXAMPLES_IBY__
--- a/qtmobility/examples/s60installs/s60installs.pro Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/examples/s60installs/s60installs.pro Thu Apr 15 08:16:03 2010 +0300
@@ -1,12 +1,8 @@
!symbian:error(This example is for Symbian packaging purposes only.)
-TEMPLATE = app
-TARGET = S60Examples
-
-include(../../staticconfig.pri)
-
TEMPLATE = subdirs
+include(../../staticconfig.pri)
load(data_caging_paths)
#BearerManagement examples
@@ -41,3 +37,5 @@
# ensure that dependency to QtMobility sis package is added
CONFIG+=mobility
+
+#BLD_INF_RULES.prj_exports += "./qtmobilityexamples.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(qtmobilityexamples.iby)"
--- a/qtmobility/features/mobility.prf Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/features/mobility.prf Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,3 @@
-MOBILITY_PREFIX=$${EPOCROOT}sf/mw/qtextensions/qtmobility
-MOBILITY_INCLUDE=$${EPOCROOT}sf/mw/qtextensions/qtmobility/include
-MOBILITY_LIB=$${EPOCROOT}sf/mw/qtextensions/qtmobility/lib
!symbian {
INCLUDEPATH += $${MOBILITY_INCLUDE}
@@ -10,7 +7,7 @@
INCLUDEPATH+=$$APP_LAYER_SYSTEMINCLUDE
}
- contains(MOBILITY,bearer|location|publishsubscribe|systeminfo|multimedia|messaging|serviceframework) {
+ contains(MOBILITY,bearer|location|publishsubscribe|systeminfo|multimedia|messaging|serviceframework|sensors) {
INCLUDEPATH+=$$MW_LAYER_SYSTEMINCLUDE
}
}
--- a/qtmobility/features/mobility.prf.template Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/features/mobility.prf.template Thu Apr 15 08:16:03 2010 +0300
@@ -7,7 +7,7 @@
INCLUDEPATH+=$$APP_LAYER_SYSTEMINCLUDE
}
- contains(MOBILITY,bearer|location|publishsubscribe|systeminfo|multimedia|messaging|serviceframework) {
+ contains(MOBILITY,bearer|location|publishsubscribe|systeminfo|multimedia|messaging|serviceframework|sensors) {
INCLUDEPATH+=$$MW_LAYER_SYSTEMINCLUDE
}
}
--- a/qtmobility/qtmobility.pro Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/qtmobility.pro Thu Apr 15 08:16:03 2010 +0300
@@ -32,13 +32,13 @@
}
}
-#lessThan(QT_MAJOR_VERSION, 4) {
-# error(Qt Mobility requires Qt 4.6 or higher. Qt $${QT_VERSION} was found.);
-#}
+lessThan(QT_MAJOR_VERSION, 4) {
+ error(Qt Mobility requires Qt 4.6 or higher. Qt $${QT_VERSION} was found.);
+}
-#contains(QT_MAJOR_VERSION, 4):lessThan(QT_MINOR_VERSION, 6) {
-# error(Qt Mobility requires Qt 4.6 or higher. Qt $${QT_VERSION} was found.);
-#}
+contains(QT_MAJOR_VERSION, 4):lessThan(QT_MINOR_VERSION, 6) {
+ error(Qt Mobility requires Qt 4.6 or higher. Qt $${QT_VERSION} was found.);
+}
#generate prf file for Qt integration
@@ -48,16 +48,16 @@
#system(echo MOBILITY_INCLUDE=$${QT_MOBILITY_INCLUDE} >> $$PRF_OUTPUT)
#system(echo MOBILITY_LIB=$${QT_MOBILITY_LIB} >> $$PRF_OUTPUT)
-#MOD_QT_MOBILITY_SOURCE_TREE=$$replace(QT_MOBILITY_SOURCE_TREE, /, \\)
#unix:!symbian:system(cat $${QT_MOBILITY_SOURCE_TREE}/features/mobility.prf.template >> $$PRF_OUTPUT)
#win32:system(type $${QT_MOBILITY_SOURCE_TREE}\features\mobility.prf.template >> $$PRF_OUTPUT)
-#symbian:system(type $${MOD_QT_MOBILITY_SOURCE_TREE}\features\mobility.prf.template >> $$PRF_OUTPUT)
+#symbian:system(type $${QT_MOBILITY_SOURCE_TREE}\features\mobility.prf.template >> $$PRF_OUTPUT)
-#MOD_QT_MOBILITY_BUILD_TREE=$$replace(QT_MOBILITY_BUILD_TREE, /, \\)
-#INSTALL_DATA=$$[QT_INSTALL_DATA]
-#MOD_QT_INSTALL_DATA=$$replace(INSTALL_DATA, /, \\)
#symbian does not generate make install rule. we have to copy prf manually
-#symbian:system(copy $${MOD_QT_MOBILITY_BUILD_TREE}\features\mobility.prf $${MOD_QT_INSTALL_DATA}\mkspecs\features)
+#symbian {
+# FORMATDIR=$$[QT_INSTALL_DATA]\mkspecs\features\
+# FORMATDIR=$$replace(FORMATDIR,/,\\ )
+# system(copy "$${QT_MOBILITY_BUILD_TREE}\features\mobility.prf $$FORMATDIR")
+#}
# install feature file
#feature.path = $$[QT_INSTALL_DATA]/mkspecs/features
@@ -69,15 +69,11 @@
SUBDIRS += src
-#contains(build_unit_tests, yes):SUBDIRS+=tests
-#contains(build_examples, yes):SUBDIRS+=examples
+contains(build_unit_tests, yes):SUBDIRS+=tests
+contains(build_examples, yes):SUBDIRS+=examples
# install Qt style headers
qtmheaders.path = $${QT_MOBILITY_INCLUDE}
qtmheaders.files = $${QT_MOBILITY_BUILD_TREE}/include/*
INSTALLS += qtmheaders
-
-symbian {
-#BLD_INF_RULES.prj_exports += "./rom/qtmobility.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qtmobility.iby)"
-}
--- a/qtmobility/rom/qtmobility.iby Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program. If not,
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-#ifndef __QT_MOBILITY_IBY__
-#define __QT_MOBILITY_IBY__
-
-#include <bldvariant.hrh>
-
-#ifdef FF_QT_BEARER_MANAGEMENT
-file=ABI_DIR\BUILD_DIR\qtbearer.dll SHARED_LIB_DIR\qtbearer.dll PAGED
-data=ZSYSTEM\install\qtmobility_stub.sis \system\install\qtmobility_stub.sis
-#endif // FF_QT_BEARER_MANAGEMENT
-
-#endif // __QT_MOBILITY_IBY__
--- a/qtmobility/src/bearer/bearer.pro Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/bearer.pro Thu Apr 15 08:16:03 2010 +0300
@@ -19,6 +19,13 @@
qnetworkconfiguration.cpp
symbian: {
+ contains (occ_enabled, yes) {
+ message("Building with OCC enabled")
+ DEFINES += OCC_FUNCTIONALITY_AVAILABLE=1
+ LIBS += -lextendedconnpref
+ } else {
+ message("Building without OCC support")
+ }
contains(snap_enabled, yes) {
message("Building with SNAP support")
DEFINES += SNAP_FUNCTIONALITY_AVAILABLE=1
@@ -54,32 +61,33 @@
QtBearerManagement.path = /sys/bin
DEPLOYMENT += QtBearerManagement
} else {
- maemo6 {
- CONFIG += link_pkgconfig
+ maemo6|maemo5 {
+ CONFIG += link_pkgconfig
+ QT += dbus
- exists(../debug) {
- message("Enabling debug messages.")
- DEFINES += BEARER_MANAGEMENT_DEBUG
- }
+ exists(../debug) {
+ message("Enabling debug messages.")
+ DEFINES += BEARER_MANAGEMENT_DEBUG
+ }
HEADERS += qnetworksession_maemo_p.h \
qnetworkconfigmanager_maemo_p.h \
qnetworkconfiguration_maemo_p.h
SOURCES += qnetworkconfigmanager_maemo.cpp \
- qnetworksession_maemo.cpp
+ qnetworksession_maemo.cpp
- documentation.path = $$QT_MOBILITY_PREFIX/doc
+ documentation.path = $$QT_MOBILITY_PREFIX/doc
documentation.files = doc/html
- PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet
+ PKGCONFIG += glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet
- CONFIG += create_pc create_prl
- QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet
- pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig
- pkgconfig.files = QtBearer.pc
+ CONFIG += create_pc create_prl
+ QMAKE_PKGCONFIG_REQUIRES = glib-2.0 dbus-glib-1 gconf-2.0 osso-ic conninet
+ pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig
+ pkgconfig.files = QtBearer.pc
- INSTALLS += pkgconfig documentation
+ INSTALLS += pkgconfig documentation
} else {
--- a/qtmobility/src/bearer/qcorewlanengine_mac.mm Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qcorewlanengine_mac.mm Thu Apr 15 08:16:03 2010 +0300
@@ -49,11 +49,14 @@
#include <QtCore/qdebug.h>
+#include <QDir>
#if defined(MAC_SDK_10_6) //not much functionality without this
#include <CoreWLAN/CoreWLAN.h>
#include <CoreWLAN/CWInterface.h>
#include <CoreWLAN/CWNetwork.h>
#include <CoreWLAN/CWNetwork.h>
+#include <CoreWLAN/CW8021XProfile.h>
+
#endif
#include <Foundation/NSEnumerator.h>
@@ -69,7 +72,7 @@
NSNotificationCenter *center;
CWInterface * currentInterface;
}
-- (void)notificationHandler:(NSNotification *)notification;
+- (void)notificationHandler;//:(NSNotification *)notification;
- (void)remove;
@end
@@ -97,7 +100,7 @@
[center removeObserver:self];
}
-- (void)notificationHandler:(NSNotification *)notification
+- (void)notificationHandler;//:(NSNotification *)notification
{
QTM_NAMESPACE::QCoreWlanEngine::instance()->requestUpdate();
}
@@ -165,10 +168,17 @@
getAllScInterfaces();
startNetworkChangeLoop();
#ifdef MAC_SDK_10_6
- QNSListener *listener;
- listener = [[QNSListener alloc] init];
+ if([[CWInterface supportedInterfaces] count] > 0 ) {
+ QNSListener *listener;
+ listener = [[QNSListener alloc] init];
+ hasWifi = true;
+ } else {
+ hasWifi = false;
+ }
#endif
+ getUserConfigurations();
requestUpdate();
+ [pool release];
}
QCoreWlanEngine::~QCoreWlanEngine()
@@ -261,73 +271,87 @@
void QCoreWlanEngine::connectToId(const QString &id)
{
- NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
QString interfaceString = getInterfaceFromId(id);
if(networkInterfaces.value(interfaceString) == "WLAN") {
#if defined(MAC_SDK_10_6)
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)];
- CWConfiguration *userConfig = [ wifiInterface configuration];
- NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile
+ if([wifiInterface power]) {
+ NSError *err = nil;
+ NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
- NSEnumerator *enumerator = [remNets objectEnumerator];
- CWWirelessProfile *wProfile;
- NSUInteger index=0;
+ NSString *wantedSsid = 0;
+ bool okToProceed = true;
- NSDictionary *parametersDict;
- NSArray* apArray;
+ if(getNetworkNameFromSsid(id) != id) {
+ NSArray *array = [CW8021XProfile allUser8021XProfiles];
+ for (NSUInteger i=0; i<[array count]; ++i) {
+ if(id == nsstringToQString([[array objectAtIndex:i] userDefinedName])
+ || id == nsstringToQString([[array objectAtIndex:i] ssid]) ) {
+ QString thisName = getSsidFromNetworkName(id);
+ if(thisName.isEmpty()) {
+ wantedSsid = qstringToNSString(id);
+ } else {
+ wantedSsid = qstringToNSString(thisName);
+ }
+ okToProceed = false;
+ [params setValue: [array objectAtIndex:i] forKey:kCWAssocKey8021XProfile];
+ break;
+ }
+ }
+ }
- CW8021XProfile *user8021XProfile;
- NSError *err;
- NSMutableDictionary *params;
-
- while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile
-
- if(id == nsstringToQString([wProfile ssid])) {
- user8021XProfile = nil;
- user8021XProfile = [ wProfile user8021XProfile];
+ if(okToProceed) {
+ NSUInteger index = 0;
- err = nil;
- params = [NSMutableDictionary dictionaryWithCapacity:0];
+ CWConfiguration *userConfig = [ wifiInterface configuration];
+ NSSet *remNets = [userConfig rememberedNetworks];
+ NSEnumerator *enumerator = [remNets objectEnumerator];
+ CWWirelessProfile *wProfile;
- if(user8021XProfile) {
- [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile];
- } else {
- [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase];
- }
-
- parametersDict = nil;
- apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]];
+ while ((wProfile = [enumerator nextObject])) {
+ if(id == nsstringToQString([wProfile ssid])) {
- if(!err) {
+ wantedSsid = [wProfile ssid];
+ [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase];
+ break;
+ }
+ index++;
+ }
+ }
- for(uint row=0; row < [apArray count]; row++ ) {
- CWNetwork *apNetwork = [apArray objectAtIndex:row];
- if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) {
+ NSDictionary *parametersDict = nil;
+ NSArray *apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]];
- bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err];
+ if(!err) {
+ for(uint row=0; row < [apArray count]; row++ ) {
+ CWNetwork *apNetwork = [apArray objectAtIndex:row];
+ if([[apNetwork ssid] compare:wantedSsid] == NSOrderedSame) {
+ bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err];
- if(!result) {
- emit connectionError(id, ConnectError);
- } else {
- [autoreleasepool release];
- return;
- }
+ if(!result) {
+ emit connectionError(id, ConnectError);
+ } else {
+ [autoreleasepool release];
+ return;
}
}
}
+ } else {
+ qDebug() <<"ERROR"<< nsstringToQString([err localizedDescription ]);
}
- index++;
- }
- emit connectionError(id, InterfaceLookupError);
+ emit connectionError(id, InterfaceLookupError);
+ [autoreleasepool release];
+
+ } else {
+ // not wifi
+ }
#endif
- } else {
- // not wifi
}
emit connectionError(id, OperationNotSupported);
- [autoreleasepool release];
}
void QCoreWlanEngine::disconnectFromId(const QString &id)
@@ -353,6 +377,7 @@
void QCoreWlanEngine::requestUpdate()
{
getAllScInterfaces();
+ getUserConfigurations();
emit configurationsChanged();
}
@@ -361,13 +386,53 @@
return coreWlanEngine();
}
+QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
+{
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ if(name == i.key()) {
+ return ij.key();
+ }
+ }
+ }
+ return QString();
+}
+
+QString QCoreWlanEngine::getNetworkNameFromSsid(const QString &ssid)
+{
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ if(ij.key() == ssid) {
+ return i.key();
+ }
+
+ }
+ return map.key(ssid);
+ }
+ return QString();
+}
+
QList<QNetworkConfigurationPrivate *> QCoreWlanEngine::scanForSsids(const QString &interfaceName)
{
QList<QNetworkConfigurationPrivate *> foundConfigs;
+ if(!hasWifi) {
+ return foundConfigs;
+ }
#if defined(MAC_SDK_10_6)
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)];
+ QStringList addedConfigs;
- CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)];
if([currentInterface power]) {
NSError *err = nil;
NSDictionary *parametersDict = nil;
@@ -376,11 +441,11 @@
CWNetwork *apNetwork;
if(!err) {
for(uint row=0; row < [apArray count]; row++ ) {
- NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
+ apNetwork = [apArray objectAtIndex:row];
- apNetwork = [apArray objectAtIndex:row];
+ QString networkSsid = nsstringToQString([apNetwork ssid]);
+
QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
- QString networkSsid = nsstringToQString([apNetwork ssid]);
cpPriv->name = networkSsid;
cpPriv->isValid = true;
cpPriv->id = networkSsid;
@@ -388,32 +453,74 @@
cpPriv->bearer = QLatin1String("WLAN");
cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(interfaceName);
-
+ bool known = isKnownSsid(networkSsid);
if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
- QString interfaceSsidString = nsstringToQString( [currentInterface ssid]);
- if( cpPriv->name == interfaceSsidString) {
+ if( cpPriv->name == nsstringToQString( [currentInterface ssid])) {
cpPriv->state |= QNetworkConfiguration::Active;
}
}
+
if(!cpPriv->state) {
- if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) {
+ if(known) {
cpPriv->state = QNetworkConfiguration::Discovered;
} else {
- cpPriv->state = QNetworkConfiguration::Defined;
+ cpPriv->state = QNetworkConfiguration::Undefined;
}
}
- if(!cpPriv->state) {
- cpPriv->state = QNetworkConfiguration::Undefined;
- }
if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen)
cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
else
cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
+
foundConfigs.append(cpPriv);
- [looppool release];
+ addedConfigs << networkSsid;
+
+ } //end scanned row
+ }
+ } //end power
+
+
+ // add known configurations that are not around.
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QString networkName = i.key();
+
+ if(!addedConfigs.contains(networkName)) {
+ QString interfaceName;
+ QMapIterator<QString, QString> ij(i.value());
+ while (ij.hasNext()) {
+ ij.next();
+ interfaceName = ij.value();
+ }
+
+ QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
+ cpPriv->name = networkName;
+ cpPriv->isValid = true;
+ cpPriv->id = networkName;
+ cpPriv->internet = true;
+ cpPriv->bearer = QLatin1String("WLAN");
+ cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
+ cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(interfaceName);
+ QString ssid = getSsidFromNetworkName(networkName);
+ if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) {
+ if( ssid == nsstringToQString( [currentInterface ssid])) {
+ cpPriv->state |= QNetworkConfiguration::Active;
+ }
}
+
+ if( addedConfigs.contains(ssid)) {
+ cpPriv->state |= QNetworkConfiguration::Discovered;
+ }
+
+ if(!cpPriv->state) {
+ cpPriv->state = QNetworkConfiguration::Defined;
+ }
+
+ foundConfigs.append(cpPriv);
}
}
+
[autoreleasepool drain];
#else
Q_UNUSED(interfaceName);
@@ -424,27 +531,29 @@
bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
{
#if defined(MAC_SDK_10_6)
- CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)];
- if([defaultInterface power])
- return true;
+ if([[CWInterface supportedInterfaces] count] > 0 ) {
+ CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)];
+ if([defaultInterface power])
+ return true;
+ }
#else
Q_UNUSED(wifiDeviceName);
#endif
return false;
}
-bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &ssid)
+bool QCoreWlanEngine::isKnownSsid( const QString &ssid)
{
#if defined(MAC_SDK_10_6)
- CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceName)];
- CWConfiguration *userConfig = [wifiInterface configuration];
- NSSet *remNets = [userConfig rememberedNetworks];
- for (CWWirelessProfile *wProfile in remNets) {
- if(ssid == nsstringToQString([wProfile ssid]))
+ QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
+ while (i.hasNext()) {
+ i.next();
+ QMap<QString,QString> map = i.value();
+ if(map.keys().contains(ssid)) {
return true;
+ }
}
#else
- Q_UNUSED(interfaceName);
Q_UNUSED(ssid);
#endif
return false;
@@ -544,8 +653,76 @@
return;
}
+void QCoreWlanEngine::getUserConfigurations()
+{
+#ifdef MAC_SDK_10_6
+ NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
+ userProfiles.clear();
+
+ NSArray *wifiInterfaces = [CWInterface supportedInterfaces];
+ for(uint row=0; row < [wifiInterfaces count]; row++ ) {
+
+ CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
+ NSString *nsInterfaceName = [wifiInterface name];
+// add user configured system networks
+ SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
+ CFDictionaryRef airportPlist = (const __CFDictionary*)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);
+ CFRelease(dynRef);
+
+ NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"];
+
+ NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"];
+ for(NSString *ssidkey in thisSsidarray) {
+ QString thisSsid = nsstringToQString(ssidkey);
+ if(!userProfiles.contains(thisSsid)) {
+ QMap <QString,QString> map;
+ map.insert(thisSsid, nsstringToQString(nsInterfaceName));
+ userProfiles.insert(thisSsid, map);
+ }
+ }
+ CFRelease(airportPlist);
+
+ // 802.1X user profiles
+ QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist";
+ NSDictionary* eapDict = [[NSMutableDictionary alloc] initWithContentsOfFile:qstringToNSString(userProfilePath)];
+ NSString *profileStr= @"Profiles";
+ NSString *nameStr = @"UserDefinedName";
+ NSString *networkSsidStr = @"Wireless Network";
+ for (id profileKey in eapDict) {
+ if ([profileStr isEqualToString:profileKey]) {
+ NSDictionary *itemDict = [eapDict objectForKey:profileKey];
+ for (id itemKey in itemDict) {
+
+ NSInteger dictSize = [itemKey count];
+ id objects[dictSize];
+ id keys[dictSize];
+
+ [itemKey getObjects:objects andKeys:keys];
+ QString networkName;
+ QString ssid;
+ for(int i = 0; i < dictSize; i++) {
+ if([nameStr isEqualToString:keys[i]]) {
+ networkName = nsstringToQString(objects[i]);
+ }
+ if([networkSsidStr isEqualToString:keys[i]]) {
+ ssid = nsstringToQString(objects[i]);
+ }
+ if(!userProfiles.contains(networkName)
+ && !ssid.isEmpty()) {
+ QMap<QString,QString> map;
+ map.insert(ssid, nsstringToQString(nsInterfaceName));
+ userProfiles.insert(networkName, map);
+ }
+ }
+ }
+ }
+ }
+ }
+ [autoreleasepool release];
+#endif
+
+}
#include "moc_qcorewlanengine_mac_p.cpp"
QTM_END_NAMESPACE
-
--- a/qtmobility/src/bearer/qcorewlanengine_mac_p.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qcorewlanengine_mac_p.h Thu Apr 15 08:16:03 2010 +0300
@@ -90,14 +90,20 @@
QTimer pollTimer;
QList<QNetworkConfigurationPrivate *> scanForSsids(const QString &interfaceName);
- bool isKnownSsid(const QString &interfaceName, const QString &ssid);
+ bool isKnownSsid(const QString &ssid);
QList<QNetworkConfigurationPrivate *> foundConfigurations;
SCDynamicStoreRef storeSession;
CFRunLoopSourceRef runloopSource;
+ bool hasWifi;
+
+protected:
+ QMap<QString, QMap<QString,QString> > userProfiles;
void startNetworkChangeLoop();
-
+ void getUserConfigurations();
+ QString getNetworkNameFromSsid(const QString &ssid);
+ QString getSsidFromNetworkName(const QString &name);
};
QTM_END_NAMESPACE
--- a/qtmobility/src/bearer/qnetworkconfigmanager.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkconfigmanager.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,7 +43,7 @@
#ifdef Q_OS_SYMBIAN
#include "qnetworkconfigmanager_s60_p.h"
-#elif Q_WS_MAEMO_6
+#elif (defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5))
#include "qnetworkconfigmanager_maemo_p.h"
#else
#include "qnetworkconfigmanager_p.h"
@@ -162,6 +162,8 @@
sockets.
\value DataStatistics If this flag is set QNetworkSession can provide statistics
about transmitted and received data.
+ \value NetworkSessionRequired If this flag is set the platform requires that a network
+ session is created before network operations can be performed.
*/
/*!
@@ -234,10 +236,9 @@
{
QList<QNetworkConfiguration> result;
QNetworkConfigurationManagerPrivate* conPriv = connManager();
- QList<QString> cpsIdents = conPriv->accessPointConfigurations.keys();
//find all InternetAccessPoints
- foreach( QString ii, cpsIdents) {
+ foreach (const QString &ii, conPriv->accessPointConfigurations.keys()) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> p =
conPriv->accessPointConfigurations.value(ii);
if ( (p->state & filter) == filter ) {
@@ -248,8 +249,7 @@
}
//find all service networks
- cpsIdents = conPriv->snapConfigurations.keys();
- foreach( QString ii, cpsIdents) {
+ foreach (const QString &ii, conPriv->snapConfigurations.keys()) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> p =
conPriv->snapConfigurations.value(ii);
if ( (p->state & filter) == filter ) {
--- a/qtmobility/src/bearer/qnetworkconfigmanager.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkconfigmanager.h Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,7 +64,8 @@
SystemSessionSupport = 0x00000004,
ApplicationLevelRoaming = 0x00000008,
ForcedRoaming = 0x00000010,
- DataStatistics = 0x00000020
+ DataStatistics = 0x00000020,
+ NetworkSessionRequired = 0x00000040
};
Q_DECLARE_FLAGS(Capabilities, Capability)
--- a/qtmobility/src/bearer/qnetworkconfigmanager_maemo.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkconfigmanager_maemo.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -206,15 +206,44 @@
d->deleteConfiguration(id);
}
-
-
void QNetworkConfigurationManagerPrivate::registerPlatformCapabilities()
{
capFlags |= QNetworkConfigurationManager::CanStartAndStopInterfaces;
capFlags |= QNetworkConfigurationManager::DataStatistics;
capFlags |= QNetworkConfigurationManager::ForcedRoaming;
+ capFlags |= QNetworkConfigurationManager::NetworkSessionRequired;
}
+void QNetworkConfigurationManagerPrivate::init()
+{
+ // Setup DBus Interface for ICD
+ m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE,
+ ICD_DBUS_API_PATH,
+ ICD_DBUS_API_INTERFACE,
+ QDBusConnection::systemBus(),
+ this);
+ connect(&m_scanTimer, SIGNAL(timeout()), this, SLOT(finishAsyncConfigurationUpdate()));
+ m_scanTimer.setSingleShot(true);
+
+ /* Turn on IAP state monitoring */
+ startListeningStateSignalsForAllConnections();
+
+ /* Turn on IAP add/remove monitoring */
+ iapMonitor()->setup(this);
+
+ /* We create a default configuration which is a pseudo config */
+ QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
+ cpPriv->name = "UserChoice";
+ cpPriv->state = QNetworkConfiguration::Discovered;
+ cpPriv->isValid = true;
+ cpPriv->id = OSSO_IAP_ANY;
+ cpPriv->type = QNetworkConfiguration::UserChoice;
+ cpPriv->purpose = QNetworkConfiguration::UnknownPurpose;
+ cpPriv->roamingSupported = false;
+ cpPriv->manager = this;
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr(cpPriv);
+ userChoiceConfigurations.insert(cpPriv->id, ptr);
+}
static inline QString network_attrs_to_security(uint network_attrs)
{
@@ -262,7 +291,6 @@
QNetworkConfiguration item;
item.d = priv;
emit configurationRemoved(item);
- configChanged(priv.data(), false);
} else
qWarning("Configuration not found for IAP %s", iap_id.toAscii().data());
} else {
@@ -274,7 +302,7 @@
uint32_t QNetworkConfigurationManagerPrivate::getNetworkAttrs(bool is_iap_id,
- QString& iap_id,
+ const QString& iap_id,
QString& iap_type,
QString security_method)
{
@@ -320,43 +348,81 @@
void QNetworkConfigurationManagerPrivate::addConfiguration(QString& iap_id)
{
+ // Note: When new IAP is created, this function gets called multiple times
+ // in a row.
+ // For example: Empty type & name for WLAN was stored into newly
+ // created IAP data in gconf when this function gets
+ // called for the first time.
+ // WLAN type & name are updated into IAP data in gconf
+ // as soon as WLAN connection is up and running.
+ // => And this function gets called again.
+
if (!accessPointConfigurations.contains(iap_id)) {
Maemo::IAPConf saved_iap(iap_id);
- QString iap_type = saved_iap.value("type").toString();
- if (!iap_type.isEmpty()) {
- QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
- cpPriv->name = saved_iap.value("name").toString();
- if (cpPriv->name.isEmpty())
- cpPriv->name = iap_id;
- cpPriv->isValid = true;
- cpPriv->id = iap_id;
- cpPriv->iap_type = iap_type;
- cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
- cpPriv->service_id = saved_iap.value("service_id").toString();
- cpPriv->service_type = saved_iap.value("service_type").toString();
- if (iap_type.startsWith("WLAN")) {
- QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray();
- if (ssid.isEmpty()) {
- qWarning() << "Cannot get ssid for" << iap_id;
- }
- }
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
- cpPriv->state = QNetworkConfiguration::Defined;
+ QString iap_type = saved_iap.value("type").toString();
+ QString iap_name = saved_iap.value("name").toString();
+ QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray();
+ if (!iap_type.isEmpty() && !iap_name.isEmpty()) {
+ // Check if new IAP is actually Undefined WLAN configuration
+ // Note: SSID is used as an iap id for Undefined WLAN configurations
+ // => configuration must be searched using SSID
+ if (!ssid.isEmpty() && accessPointConfigurations.contains(ssid)) {
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr = accessPointConfigurations.take(ssid);
+ if (ptr.data()) {
+ QString iap_type = saved_iap.value("type").toString();
+ ptr->id = iap_id;
+ ptr->iap_type = iap_type;
+ ptr->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
+ ptr->network_id = ssid;
+ ptr->service_id = saved_iap.value("service_id").toString();
+ ptr->service_type = saved_iap.value("service_type").toString();
+ if (m_onlineIapId == iap_id) {
+ ptr->state = QNetworkConfiguration::Active;
+ } else {
+ ptr->state = QNetworkConfiguration::Defined;
+ }
+ accessPointConfigurations.insert(iap_id, ptr);
+ configurationChanged(ptr.data());
+ }
+ } else {
+ QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
+ cpPriv->name = saved_iap.value("name").toString();
+ if (cpPriv->name.isEmpty())
+ cpPriv->name = iap_id;
+ cpPriv->isValid = true;
+ cpPriv->id = iap_id;
+ cpPriv->iap_type = iap_type;
+ cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
+ cpPriv->service_id = saved_iap.value("service_id").toString();
+ cpPriv->service_type = saved_iap.value("service_type").toString();
+ if (iap_type.startsWith("WLAN")) {
+ QByteArray ssid = saved_iap.value("wlan_ssid").toByteArray();
+ if (ssid.isEmpty()) {
+ qWarning() << "Cannot get ssid for" << iap_id;
+ }
+ cpPriv->network_id = ssid;
+ }
+ cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
+ if (m_onlineIapId == iap_id) {
+ cpPriv->state = QNetworkConfiguration::Active;
+ } else {
+ cpPriv->state = QNetworkConfiguration::Defined;
+ }
+ cpPriv->manager = this;
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr(cpPriv);
- accessPointConfigurations.insert(iap_id, ptr);
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr(cpPriv);
+ accessPointConfigurations.insert(iap_id, ptr);
#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug("IAP: %s, name: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data());
+ qDebug("IAP: %s, name: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data());
#endif
-
- QNetworkConfiguration item;
- item.d = ptr;
- emit configurationAdded(item);
- configChanged(ptr.data(), true);
- } else {
- qWarning("IAP %s does not have \"type\" field defined, skipping this IAP.", iap_id.toAscii().data());
- }
+ QNetworkConfiguration item;
+ item.d = ptr;
+ emit configurationAdded(item);
+ }
+ } else {
+ qWarning("IAP %s does not have \"type\" or \"name\" fields defined, skipping this IAP.", iap_id.toAscii().data());
+ }
} else {
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug() << "IAP" << iap_id << "already in db.";
@@ -364,7 +430,7 @@
/* Check if the data in db changed and update configuration accordingly
*/
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr = accessPointConfigurations.take(iap_id);
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr = accessPointConfigurations.value(iap_id);
if (ptr.data()) {
Maemo::IAPConf changed_iap(iap_id);
QString iap_type = changed_iap.value("type").toString();
@@ -383,24 +449,28 @@
ptr->iap_type = iap_type;
update_needed = true;
}
- if (iap_type.startsWith("WLAN")) {
+ if (iap_type.startsWith(QLatin1String("WLAN"))) {
QByteArray ssid = changed_iap.value("wlan_ssid").toByteArray();
if (ssid.isEmpty()) {
qWarning() << "Cannot get ssid for" << iap_id;
}
if (ptr->network_id != ssid) {
- ptr->network_id = ssid;
- update_needed = true;
+ ptr->network_id = ssid;
+ update_needed = true;
}
}
}
- accessPointConfigurations.insert(iap_id, ptr);
if (update_needed) {
- ptr->type = QNetworkConfiguration::InternetAccessPoint;
- if (ptr->state != QNetworkConfiguration::Defined) {
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ if (m_onlineIapId == iap_id) {
+ if (ptr->state < QNetworkConfiguration::Active) {
+ ptr->state = QNetworkConfiguration::Active;
+ configurationChanged(ptr.data());
+ }
+ } else if (ptr->state < QNetworkConfiguration::Defined) {
ptr->state = QNetworkConfiguration::Defined;
- configurationChanged(ptr.data());
- }
+ configurationChanged(ptr.data());
+ }
}
} else {
qWarning("Cannot find IAP %s from current configuration although it should be there.", iap_id.toAscii().data());
@@ -408,45 +478,28 @@
}
}
-
void QNetworkConfigurationManagerPrivate::updateConfigurations()
{
- /* Contains known network id (like ssid) from storage */
- QMultiHash<QByteArray, SSIDInfo* > knownConfigs;
-
- /* All the scanned access points */
- QList<Maemo::IcdScanResult> scanned;
-
- /* Turn on IAP monitoring */
- iapMonitor()->setup(this);
+ doUpdateConfigurations();
+}
- if (firstUpdate) {
- /* We create a default configuration which is a pseudo config */
- QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
- cpPriv->name = "UserChoice";
- cpPriv->state = QNetworkConfiguration::Discovered;
- cpPriv->isValid = true;
- cpPriv->id = OSSO_IAP_ANY;
- cpPriv->type = QNetworkConfiguration::UserChoice;
- cpPriv->purpose = QNetworkConfiguration::UnknownPurpose;
- cpPriv->roamingSupported = false;
- cpPriv->manager = this;
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr(cpPriv);
- userChoiceConfigurations.insert(cpPriv->id, ptr);
- }
+void QNetworkConfigurationManagerPrivate::doUpdateConfigurations(QList<Maemo::IcdScanResult> scanned)
+{
+ /* Contains all known iap_ids from storage */
+ QList<QString> knownConfigs = accessPointConfigurations.keys();
- /* We return currently configured IAPs in the first run and do the WLAN
- * scan in subsequent runs.
- */
+ /* Contains all known WLAN network ids (like ssid) from storage */
+ QMultiHash<QByteArray, SSIDInfo* > notDiscoveredWLANConfigs;
+
QList<QString> all_iaps;
Maemo::IAPConf::getAll(all_iaps);
- foreach (QString iap_id, all_iaps) {
+ foreach (const QString &iap_id, all_iaps) {
QByteArray ssid;
Maemo::IAPConf saved_ap(iap_id);
bool is_temporary = saved_ap.value("temporary").toBool();
- if (is_temporary) {
+ if (is_temporary) {
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug() << "IAP" << iap_id << "is temporary, skipping it.";
#endif
@@ -454,7 +507,7 @@
}
QString iap_type = saved_ap.value("type").toString();
- if (iap_type.startsWith("WLAN")) {
+ if (iap_type.startsWith(QLatin1String("WLAN"))) {
ssid = saved_ap.value("wlan_ssid").toByteArray();
if (ssid.isEmpty()) {
qWarning() << "Cannot get ssid for" << iap_id;
@@ -465,7 +518,7 @@
SSIDInfo *info = new SSIDInfo;
info->iap_id = iap_id;
info->wlan_security = security_method;
- knownConfigs.insert(ssid, info);
+ notDiscoveredWLANConfigs.insert(ssid, info);
} else if (iap_type.isEmpty()) {
qWarning() << "IAP" << iap_id << "network type is not set! Skipping it";
continue;
@@ -485,7 +538,7 @@
else
cpPriv->name = iap_id;
}
- cpPriv->isValid = true;
+ cpPriv->isValid = true;
cpPriv->id = iap_id;
cpPriv->network_id = ssid;
cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString());
@@ -503,35 +556,13 @@
qDebug("IAP: %s, name: %s, ssid: %s, added to known list", iap_id.toAscii().data(), cpPriv->name.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-");
#endif
} else {
+ knownConfigs.removeOne(iap_id);
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("IAP: %s, ssid: %s, already exists in the known list", iap_id.toAscii().data(), !ssid.isEmpty() ? ssid.data() : "-");
#endif
}
}
- if (!firstUpdate) {
- QStringList scannedNetworkTypes;
- QStringList networkTypesToScan;
- QString error;
- Maemo::Icd icd(ICD_SHORT_SCAN_TIMEOUT);
-
- scannedNetworkTypes = icd.scan(ICD_SCAN_REQUEST_ACTIVE,
- networkTypesToScan,
- scanned,
- error);
- if (!error.isEmpty()) {
- qWarning() << "Network scanning failed" << error;
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- if (!scanned.isEmpty())
- qDebug() << "Scan returned" << scanned.size() << "networks";
- else
- qDebug() << "Scan returned nothing.";
-#endif
- }
- }
-
-
/* This is skipped in the first update as scanned size is zero */
if (!scanned.isEmpty())
for (int i=0; i<scanned.size(); ++i) {
@@ -540,27 +571,33 @@
if (ap.scan.network_attrs & ICD_NW_ATTR_IAPNAME) {
/* The network_id is IAP id, so the IAP is a known one */
QString iapid = ap.scan.network_id.data();
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.take(iapid);
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.value(iapid);
if (priv.data()) {
- priv->state = QNetworkConfiguration::Discovered; /* Defined is set automagically */
+ bool stateChanged = false;
+ // Check if state is not already Discovered or Active
+ if (priv->state < QNetworkConfiguration::Discovered) {
+ priv->state = QNetworkConfiguration::Discovered; /* Defined is set automagically */
+ stateChanged = true;
+ }
priv->network_attrs = ap.scan.network_attrs;
priv->service_id = ap.scan.service_id;
priv->service_type = ap.scan.service_type;
priv->service_attrs = ap.scan.service_attrs;
- configurationChanged(priv.data());
- accessPointConfigurations.insert(iapid, priv);
+ if (stateChanged) {
+ configurationChanged(priv.data());
+ }
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug("IAP: %s, ssid: %s, discovered", iapid.toAscii().data(), priv->network_id.data());
#endif
- if (!ap.scan.network_type.startsWith("WLAN"))
+ if (!ap.scan.network_type.startsWith(QLatin1String("WLAN")))
continue; // not a wlan AP
- /* Remove scanned AP from known configurations so that we can
+ /* Remove scanned AP from discovered WLAN configurations so that we can
* emit configurationRemoved signal later
*/
- QList<SSIDInfo* > known_iaps = knownConfigs.values(priv->network_id);
+ QList<SSIDInfo* > known_iaps = notDiscoveredWLANConfigs.values(priv->network_id);
rescan_list:
if (!known_iaps.isEmpty()) {
for (int k=0; k<known_iaps.size(); ++k) {
@@ -573,7 +610,7 @@
if (iap->wlan_security ==
network_attrs_to_security(ap.scan.network_attrs)) {
/* Remove IAP from the list */
- knownConfigs.remove(priv->network_id, iap);
+ notDiscoveredWLANConfigs.remove(priv->network_id, iap);
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug() << "Removed IAP" << iap->iap_id << "from unknown config";
#endif
@@ -588,68 +625,78 @@
}
} else {
- /* Non saved access point data */
+ /* Non saved access point data */
QByteArray scanned_ssid = ap.scan.network_id;
- QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
- QString hrs = scanned_ssid.data();
+ if (!accessPointConfigurations.contains(scanned_ssid)) {
+ QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
+ QString hrs = scanned_ssid.data();
- cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name;
- cpPriv->isValid = true;
- cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved
- cpPriv->network_id = scanned_ssid;
- cpPriv->iap_type = ap.scan.network_type;
- cpPriv->network_attrs = ap.scan.network_attrs;
- cpPriv->service_id = ap.scan.service_id;
- cpPriv->service_type = ap.scan.service_type;
- cpPriv->service_attrs = ap.scan.service_attrs;
- cpPriv->manager = this;
+ cpPriv->name = ap.network_name.isEmpty() ? hrs : ap.network_name;
+ cpPriv->isValid = true;
+ cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved
+ cpPriv->network_id = scanned_ssid;
+ cpPriv->iap_type = ap.scan.network_type;
+ cpPriv->network_attrs = ap.scan.network_attrs;
+ cpPriv->service_id = ap.scan.service_id;
+ cpPriv->service_type = ap.scan.service_type;
+ cpPriv->service_attrs = ap.scan.service_attrs;
+ cpPriv->manager = this;
+
+ cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
+ cpPriv->state = QNetworkConfiguration::Undefined;
- cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
- cpPriv->state = QNetworkConfiguration::Undefined;
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr(cpPriv);
+ accessPointConfigurations.insert(cpPriv->id, ptr);
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr(cpPriv);
- accessPointConfigurations.insert(cpPriv->id, ptr);
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan.";
-#endif
+ #ifdef BEARER_MANAGEMENT_DEBUG
+ qDebug() << "IAP with network id" << cpPriv->id << "was found in the scan.";
+ #endif
- QNetworkConfiguration item;
- item.d = ptr;
- emit configurationAdded(item);
- }
- }
+ QNetworkConfiguration item;
+ item.d = ptr;
+ emit configurationAdded(item);
+ } else {
+ knownConfigs.removeOne(scanned_ssid);
+ }
+ }
+ }
-
- /* Remove non existing iaps since last update */
if (!firstUpdate) {
- QHashIterator<QByteArray, SSIDInfo* > i(knownConfigs);
+ // Update Defined status to all defined WLAN IAPs which
+ // could not be found when access points were scanned
+ QHashIterator<QByteArray, SSIDInfo* > i(notDiscoveredWLANConfigs);
while (i.hasNext()) {
i.next();
SSIDInfo *iap = i.value();
QString iap_id = iap->iap_id;
//qDebug() << i.key() << ": " << iap_id;
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.take(iap_id);
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.value(iap_id);
if (priv.data()) {
- priv->isValid = false;
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "was removed as it was not found in scan.";
-#endif
+ // WLAN AccessPoint configuration could not be Discovered
+ // => Make sure that configuration state is Defined
+ if (priv->state > QNetworkConfiguration::Defined) {
+ priv->state = QNetworkConfiguration::Defined;
+ configurationChanged(priv.data());
+ }
+ }
+ }
- QNetworkConfiguration item;
- item.d = priv;
- emit configurationRemoved(item);
- configChanged(priv.data(), false);
-
+ /* Remove non existing iaps since last update */
+ foreach (QString oldIface, knownConfigs) {
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.take(oldIface);
+ if (priv.data()) {
+ priv->isValid = false;
+ QNetworkConfiguration item;
+ item.d = priv;
+ emit configurationRemoved(item);
//if we would have SNAP support we would have to remove the references
//from existing ServiceNetworks to the removed access point configuration
- }
- }
+ }
+ }
}
-
- QMutableHashIterator<QByteArray, SSIDInfo* > i(knownConfigs);
+ QMutableHashIterator<QByteArray, SSIDInfo* > i(notDiscoveredWLANConfigs);
while (i.hasNext()) {
i.next();
SSIDInfo *iap = i.value();
@@ -664,7 +711,6 @@
firstUpdate = false;
}
-
QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration()
{
/* Here we just return [ANY] request to icd and let the icd decide which
@@ -676,39 +722,189 @@
return item;
}
+void QNetworkConfigurationManagerPrivate::startListeningStateSignalsForAllConnections()
+{
+ // Start listening ICD_DBUS_API_STATE_SIG signals
+ m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE,
+ ICD_DBUS_API_PATH,
+ ICD_DBUS_API_INTERFACE,
+ ICD_DBUS_API_STATE_SIG,
+ this, SLOT(connectionStateSignalsSlot(QDBusMessage)));
+
+ // Calling ICD_DBUS_API_STATE_REQ makes sure that initial state will be updated immediately
+ m_gettingInitialConnectionState = true;
+ m_dbusInterface->call(ICD_DBUS_API_STATE_REQ);
+}
+
+void QNetworkConfigurationManagerPrivate::connectionStateSignalsSlot(QDBusMessage msg)
+{
+ QList<QVariant> arguments = msg.arguments();
+ if (arguments[1].toUInt() != 0 || arguments.count() < 8) {
+ return;
+ }
+
+ QString iapid = arguments[5].toByteArray().data();
+ uint icd_connection_state = arguments[7].toUInt();
+
+ switch (icd_connection_state) {
+ case ICD_STATE_CONNECTED:
+ {
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr = accessPointConfigurations.value(iapid);
+ if (ptr.data()) {
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ if (ptr->state != QNetworkConfiguration::Active) {
+ ptr->state = QNetworkConfiguration::Active;
+ if (!m_gettingInitialConnectionState) {
+ configurationChanged(ptr.data());
+ if (m_onlineIapId.isEmpty()) {
+ emit onlineStateChanged(true);
+ }
+ }
+ m_onlineIapId = iapid;
+ }
+ } else {
+ // This gets called when new WLAN IAP is created using Connection dialog
+ // At this point Undefined WLAN configuration has SSID as iap id
+ // => Because of that configuration can not be found from
+ // accessPointConfigurations using correct iap id
+ emit onlineStateChanged(true);
+ m_onlineIapId = iapid;
+ }
+ break;
+ }
+ case ICD_STATE_DISCONNECTED:
+ {
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr = accessPointConfigurations.value(iapid);
+ if (ptr.data()) {
+ ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ if (ptr->state == QNetworkConfiguration::Active) {
+ ptr->state = QNetworkConfiguration::Discovered;
+ if (!m_gettingInitialConnectionState) {
+ configurationChanged(ptr.data());
+
+ // Note: If ICD switches used IAP from one to another:
+ // 1) new IAP is reported to be online first
+ // 2) old IAP is reported to be offline then
+ // => Device can be reported to be offline only
+ // if last known online IAP is reported to be disconnected
+ if (iapid == m_onlineIapId) {
+ // It's known that there is only one global ICD connection
+ // => Because ICD state was reported to be DISCONNECTED, Device is offline
+ m_onlineIapId = QString();
+ emit onlineStateChanged(false);
+ }
+ }
+ }
+ } else {
+ // Disconnected IAP was not found from accessPointConfigurations
+ // => Reason: Online IAP was removed which resulted ICD to disconnect
+ if (iapid == m_onlineIapId) {
+ // It's known that there is only one global ICD connection
+ // => Because ICD state was reported to be DISCONNECTED, Device is offline
+ m_onlineIapId = QString();
+ emit onlineStateChanged(false);
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ emit iapStateChanged(iapid, icd_connection_state);
+
+ m_gettingInitialConnectionState = false;
+}
void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate()
{
- QTimer::singleShot(0, this, SLOT(updateConfigurations()));
+ if (m_scanGoingOn) {
+ return;
+ }
+ m_scanGoingOn = true;
+
+ m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE,
+ ICD_DBUS_API_PATH,
+ ICD_DBUS_API_INTERFACE,
+ ICD_DBUS_API_SCAN_SIG,
+ this, SLOT(asyncUpdateConfigurationsSlot(QDBusMessage)));
+
+ QDBusMessage msg = m_dbusInterface->call(ICD_DBUS_API_SCAN_REQ,
+ (uint)ICD_SCAN_REQUEST_ACTIVE);
+ m_typesToBeScanned = msg.arguments()[0].value<QStringList>();
+ m_scanTimer.start(ICD_SHORT_SCAN_TIMEOUT);
}
+void QNetworkConfigurationManagerPrivate::cancelAsyncConfigurationUpdate()
+{
+ if (!m_scanGoingOn) {
+ return;
+ }
+ m_scanGoingOn = false;
+
+ if (m_scanTimer.isActive()) {
+ m_scanTimer.stop();
+ }
+
+ m_dbusInterface->connection().disconnect(ICD_DBUS_API_INTERFACE,
+ ICD_DBUS_API_PATH,
+ ICD_DBUS_API_INTERFACE,
+ ICD_DBUS_API_SCAN_SIG,
+ this, SLOT(asyncUpdateConfigurationsSlot(QDBusMessage)));
+
+ // Stop scanning rounds by calling ICD_DBUS_API_SCAN_CANCEL
+ // <=> If ICD_DBUS_API_SCAN_CANCEL is not called, new scanning round will
+ // be started after the module scan timeout.
+ m_dbusInterface->call(ICD_DBUS_API_SCAN_CANCEL);
+}
+
+void QNetworkConfigurationManagerPrivate::finishAsyncConfigurationUpdate()
+{
+ cancelAsyncConfigurationUpdate();
+ doUpdateConfigurations(m_scanResult);
+ m_scanResult.clear();
+}
+
+void QNetworkConfigurationManagerPrivate::asyncUpdateConfigurationsSlot(QDBusMessage msg)
+{
+ QList<QVariant> arguments = msg.arguments();
+ uint icd_scan_status = arguments.takeFirst().toUInt();
+ if (icd_scan_status == ICD_SCAN_COMPLETE) {
+ m_typesToBeScanned.removeOne(arguments[6].toString());
+ if (!m_typesToBeScanned.count()) {
+ finishAsyncConfigurationUpdate();
+ }
+ } else {
+ Maemo::IcdScanResult scanResult;
+ scanResult.status = icd_scan_status;
+ scanResult.timestamp = arguments.takeFirst().toUInt();
+ scanResult.scan.service_type = arguments.takeFirst().toString();
+ scanResult.service_name = arguments.takeFirst().toString();
+ scanResult.scan.service_attrs = arguments.takeFirst().toUInt();
+ scanResult.scan.service_id = arguments.takeFirst().toString();
+ scanResult.service_priority = arguments.takeFirst().toInt();
+ scanResult.scan.network_type = arguments.takeFirst().toString();
+ scanResult.network_name = arguments.takeFirst().toString();
+ scanResult.scan.network_attrs = arguments.takeFirst().toUInt();
+ scanResult.scan.network_id = arguments.takeFirst().toByteArray();
+ scanResult.network_priority = arguments.takeFirst().toInt();
+ scanResult.signal_strength = arguments.takeFirst().toInt();
+ scanResult.station_id = arguments.takeFirst().toString();
+ scanResult.signal_dB = arguments.takeFirst().toInt();
+
+ m_scanResult.append(scanResult);
+ }
+}
void QNetworkConfigurationManagerPrivate::cleanup()
{
+ if (m_scanGoingOn) {
+ m_scanTimer.stop();
+ m_dbusInterface->call(ICD_DBUS_API_SCAN_CANCEL);
+ }
iapMonitor()->cleanup();
}
-
-void QNetworkConfigurationManagerPrivate::configChanged(QNetworkConfigurationPrivate *ptr, bool added)
-{
- if (added) {
- if (ptr && ptr->state == QNetworkConfiguration::Active) {
- onlineConfigurations++;
- if (!firstUpdate && onlineConfigurations == 1)
- emit onlineStateChanged(true);
- }
- } else {
- if (ptr && ptr->state == QNetworkConfiguration::Active) {
- onlineConfigurations--;
- if (!firstUpdate && onlineConfigurations == 0)
- emit onlineStateChanged(false);
- if (onlineConfigurations < 0)
- onlineConfigurations = 0;
- }
- }
-}
-
-
#include "qnetworkconfigmanager_maemo.moc"
#include "moc_qnetworkconfigmanager_maemo_p.cpp"
--- a/qtmobility/src/bearer/qnetworkconfigmanager_maemo_p.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkconfigmanager_maemo_p.h Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -55,6 +55,8 @@
#include <QHash>
#include <QStringList>
+#include <QDBusInterface>
+#include <maemo_icd.h>
#include "qnetworkconfigmanager.h"
#include "qnetworkconfiguration_maemo_p.h"
@@ -69,10 +71,11 @@
Q_OBJECT
public:
QNetworkConfigurationManagerPrivate()
- : QObject(0), capFlags(0), firstUpdate(true), onlineConfigurations(0)
+ : QObject(0), capFlags(0), firstUpdate(true), onlineConfigurations(0), m_scanGoingOn(false)
{
registerPlatformCapabilities();
updateConfigurations();
+ init();
}
virtual ~QNetworkConfigurationManagerPrivate()
@@ -103,10 +106,14 @@
QNetworkConfiguration defaultConfiguration();
+ void init();
+
QNetworkConfigurationManager::Capabilities capFlags;
void registerPlatformCapabilities();
void performAsyncConfigurationUpdate();
+ void doUpdateConfigurations(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>());
+ void startListeningStateSignalsForAllConnections();
//this table contains an up to date list of all configs at any time.
//it must be updated if configurations change, are added/removed or
@@ -121,20 +128,36 @@
void deleteConfiguration(QString &iap_id);
void addConfiguration(QString &iap_id);
void configurationChanged(QNetworkConfigurationPrivate *ptr);
- uint32_t getNetworkAttrs(bool is_iap_id, QString& iap_id,
+ uint32_t getNetworkAttrs(bool is_iap_id, const QString& iap_id,
QString& iap_type, QString security_method);
- void configChanged(QNetworkConfigurationPrivate *ptr, bool added);
+
+ QDBusInterface *m_dbusInterface;
+ QTimer m_scanTimer;
+ bool m_gettingInitialConnectionState;
+ bool m_scanGoingOn;
+ QStringList m_typesToBeScanned;
+ QList<Maemo::IcdScanResult> m_scanResult;
+ QString m_onlineIapId;
+
friend class QNetworkSessionPrivate;
public slots:
void updateConfigurations();
+private slots:
+ void cancelAsyncConfigurationUpdate();
+ void finishAsyncConfigurationUpdate();
+ void asyncUpdateConfigurationsSlot(QDBusMessage msg);
+ void connectionStateSignalsSlot(QDBusMessage msg);
+
Q_SIGNALS:
void configurationAdded(const QNetworkConfiguration& config);
void configurationRemoved(const QNetworkConfiguration& config);
void configurationUpdateComplete();
void configurationChanged(const QNetworkConfiguration& config);
void onlineStateChanged(bool isOnline);
+
+ void iapStateChanged(const QString& iapid, uint icd_connection_state);
};
QTM_END_NAMESPACE
--- a/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,6 +44,16 @@
#include <commdb.h>
#include <cdbcols.h>
#include <d32dbms.h>
+#include <QEventLoop>
+#include <QTimer>
+#include <QTime> // For randgen seeding
+#include <QtCore> // For randgen seeding
+
+// #define QT_BEARERMGMT_CONFIGMGR_DEBUG
+
+#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
+#include <QDebug>
+#endif
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
#include <cmdestination.h>
@@ -64,10 +74,16 @@
static const int KUserChoiceIAPId = 0;
QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate()
- : QObject(0), CActive(CActive::EPriorityIdle), capFlags(0), iFirstUpdate(true), iInitOk(true)
+ : QObject(0), CActive(CActive::EPriorityIdle), capFlags(0),
+ iFirstUpdate(true), iInitOk(true), iIgnoringUpdates(false),
+ iTimeToWait(0), iIgnoreEventLoop(0)
{
CActiveScheduler::Add(this);
+ // Seed the randomgenerator
+ qsrand(QTime(0,0,0).secsTo(QTime::currentTime()) + QCoreApplication::applicationPid());
+ iIgnoreEventLoop = new QEventLoop(this);
+
registerPlatformCapabilities();
TRAPD(error, ipCommsDB = CCommsDatabase::NewL(EDatabaseTypeIAP));
if (error != KErrNone) {
@@ -100,12 +116,9 @@
cpPriv->manager = this;
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr(cpPriv);
userChoiceConfigurations.insert(cpPriv->id, ptr);
-
updateConfigurations();
updateStatesToSnaps();
-
updateAvailableAccessPoints(); // On first time updates synchronously (without WLAN scans)
-
// Start monitoring IAP and/or SNAP changes in Symbian CommsDB
startCommsDatabaseNotifications();
iFirstUpdate = false;
@@ -115,22 +128,19 @@
{
Cancel();
- QList<QString> configIdents = snapConfigurations.keys();
- foreach(QString oldIface, configIdents) {
+ foreach (const QString &oldIface, snapConfigurations.keys()) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = snapConfigurations.take(oldIface);
priv->isValid = false;
priv->id.clear();
}
- configIdents = accessPointConfigurations.keys();
- foreach(QString oldIface, configIdents) {
+ foreach (const QString &oldIface, accessPointConfigurations.keys()) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.take(oldIface);
priv->isValid = false;
priv->id.clear();
}
- configIdents = userChoiceConfigurations.keys();
- foreach(QString oldIface, configIdents) {
+ foreach (const QString &oldIface, userChoiceConfigurations.keys()) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = userChoiceConfigurations.take(oldIface);
priv->isValid = false;
priv->id.clear();
@@ -166,6 +176,7 @@
capFlags |= QNetworkConfigurationManager::ForcedRoaming;
#endif
capFlags |= QNetworkConfigurationManager::DataStatistics;
+ capFlags |= QNetworkConfigurationManager::NetworkSessionRequired;
}
void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate()
@@ -193,7 +204,7 @@
{
QList<QString> knownConfigs = accessPointConfigurations.keys();
QList<QString> knownSnapConfigs = snapConfigurations.keys();
-
+
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
// S60 version is >= Series60 3rd Edition Feature Pack 2
TInt error = KErrNone;
@@ -350,7 +361,7 @@
#endif
updateActiveAccessPoints();
- foreach (QString oldIface, knownConfigs) {
+ foreach (const QString &oldIface, knownConfigs) {
//remove non existing IAP
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.take(oldIface);
priv->isValid = false;
@@ -360,8 +371,7 @@
emit configurationRemoved(item);
}
// Remove non existing IAP from SNAPs
- QList<QString> snapConfigIdents = snapConfigurations.keys();
- foreach (QString iface, snapConfigIdents) {
+ foreach (const QString &iface, snapConfigurations.keys()) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv2 = snapConfigurations.value(iface);
// => Check if one of the IAPs of the SNAP is active
for (int i=0; i<priv2->serviceNetworkMembers.count(); i++) {
@@ -372,7 +382,7 @@
}
}
}
- foreach (QString oldIface, knownSnapConfigs) {
+ foreach (const QString &oldIface, knownSnapConfigs) {
//remove non existing SNAPs
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = snapConfigurations.take(oldIface);
priv->isValid = false;
@@ -619,7 +629,7 @@
}
// Make sure that state of rest of the IAPs won't be Active
- foreach (QString iface, inactiveConfigs) {
+ foreach (const QString &iface, inactiveConfigs) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.value(iface);
if (priv.data()) {
// Configuration is either Defined or Discovered
@@ -665,7 +675,7 @@
}
// Make sure that state of rest of the IAPs won't be Discovered or Active
- foreach (QString iface, unavailableConfigs) {
+ foreach (const QString &iface, unavailableConfigs) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.value(iface);
if (priv.data()) {
// Configuration is Defined
@@ -685,8 +695,7 @@
void QNetworkConfigurationManagerPrivate::updateStatesToSnaps()
{
// Go through SNAPs and set correct state to SNAPs
- QList<QString> snapConfigIdents = snapConfigurations.keys();
- foreach (QString iface, snapConfigIdents) {
+ foreach (const QString &iface, snapConfigurations.keys()) {
bool discovered = false;
bool active = false;
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = snapConfigurations.value(iface);
@@ -798,23 +807,45 @@
void QNetworkConfigurationManagerPrivate::RunL()
{
+ if (iIgnoringUpdates) {
+#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
+ qDebug("CommsDB event handling postponed (postpone-timer running because IAPs/SNAPs were updated very recently).");
+#endif
+ return;
+ }
if (iStatus != KErrCancel) {
RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
switch (event) {
-// case RDbNotifier::EUnlock: /** All read locks have been removed. */
+ case RDbNotifier::EUnlock: /** All read locks have been removed. */
case RDbNotifier::ECommit: /** A transaction has been committed. */
case RDbNotifier::ERollback: /** A transaction has been rolled back */
case RDbNotifier::ERecover: /** The database has been recovered */
- // Note that if further database events occur while a client is handling
- // a request completion, the notifier records the most significant database
- // event and this is signalled as soon as the client issues the next
- // RequestNotification() request.
- // => Stop recording notifications
- stopCommsDatabaseNotifications();
- TRAPD(error, updateConfigurationsL());
- if (error == KErrNone) {
- updateStatesToSnaps();
+#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
+ qDebug("CommsDB event (of type RDbNotifier::TEvent) received: %d", iStatus.Int());
+#endif
+ iIgnoringUpdates = true;
+ // Other events than ECommit get lower priority. In practice with those events,
+ // we delay_before_updating methods, whereas
+ // with ECommit we _update_before_delaying the reaction to next event.
+ // Few important notes: 1) listening to only ECommit does not seem to be adequate,
+ // but updates will be missed. Hence other events are reacted upon too.
+ // 2) RDbNotifier records the most significant event, and that will be returned once
+ // we issue new RequestNotification, and hence updates will not be missed even
+ // when we are 'not reacting to them' for few seconds.
+ if (event == RDbNotifier::ECommit) {
+ TRAPD(error, updateConfigurationsL());
+ if (error == KErrNone) {
+ updateStatesToSnaps();
+ }
+ waitRandomTime();
+ } else {
+ waitRandomTime();
+ TRAPD(error, updateConfigurationsL());
+ if (error == KErrNone) {
+ updateStatesToSnaps();
+ }
}
+ iIgnoringUpdates = false; // Wait time done, allow updating again
iWaitingCommsDatabaseNotifications = true;
break;
default:
@@ -822,7 +853,6 @@
break;
}
}
-
if (iWaitingCommsDatabaseNotifications) {
if (!IsActive()) {
SetActive();
@@ -882,8 +912,7 @@
}
bool online = false;
- QList<QString> iapConfigs = accessPointConfigurations.keys();
- foreach (QString iface, iapConfigs) {
+ foreach (const QString &iface, accessPointConfigurations.keys()) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.value(iface);
if (priv.data()->state == QNetworkConfiguration::Active) {
online = true;
@@ -912,7 +941,7 @@
unDiscoveredConfigs.removeOne(ident);
}
}
- foreach (QString iface, unDiscoveredConfigs) {
+ foreach (const QString &iface, unDiscoveredConfigs) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = accessPointConfigurations.value(iface);
if (priv.data()) {
// Configuration is Defined
@@ -928,6 +957,20 @@
}
}
+// Waits for 1..4 seconds.
+void QNetworkConfigurationManagerPrivate::waitRandomTime()
+{
+ iTimeToWait = (qAbs(qrand()) % 5) * 1000;
+ if (iTimeToWait < 1000) {
+ iTimeToWait = 1000;
+ }
+#ifdef QT_BEARERMGMT_CONFIGMGR_DEBUG
+ qDebug("QNetworkConfigurationManager waiting random time: %d ms", iTimeToWait);
+#endif
+ QTimer::singleShot(iTimeToWait, iIgnoreEventLoop, SLOT(quit()));
+ iIgnoreEventLoop->exec();
+}
+
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> QNetworkConfigurationManagerPrivate::dataByConnectionId(TUint aConnectionId)
{
QNetworkConfiguration item;
--- a/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkconfigmanager_s60_p.h Thu Apr 15 08:16:03 2010 +0300
@@ -63,6 +63,7 @@
#endif
class CCommsDatabase;
+class QEventLoop;
QT_BEGIN_NAMESPACE
class QTimer;
@@ -118,6 +119,7 @@
void accessPointScanningReady(TBool scanSuccessful, TConnMonIapInfo iapInfo);
void startCommsDatabaseNotifications();
void stopCommsDatabaseNotifications();
+ void waitRandomTime();
QNetworkConfiguration defaultConfigurationL();
TBool GetS60PlatformVersion(TUint& aMajor, TUint& aMinor) const;
@@ -149,8 +151,10 @@
TBool iOnline;
TBool iInitOk;
TBool iUpdateGoingOn;
+ TBool iIgnoringUpdates;
+ TUint iTimeToWait;
+ QEventLoop* iIgnoreEventLoop;
-
AccessPointsAvailabilityScanner* ipAccessPointsAvailabilityScanner;
friend class QNetworkSessionPrivate;
--- a/qtmobility/src/bearer/qnetworkconfiguration.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkconfiguration.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -43,7 +43,7 @@
#ifdef Q_OS_SYMBIAN
#include "qnetworkconfiguration_s60_p.h"
-#elif Q_WS_MAEMO_6
+#elif (defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5))
#include "qnetworkconfiguration_maemo_p.h"
#else
#include "qnetworkconfiguration_p.h"
--- a/qtmobility/src/bearer/qnetworkmanagerservice_p.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworkmanagerservice_p.h Thu Apr 15 08:16:03 2010 +0300
@@ -208,7 +208,7 @@
Q_DECLARE_FLAGS(ApSecurityFlags, ApSecurityFlag);
- QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent = 0);
~QNetworkManagerInterfaceAccessPoint();
QDBusInterface *connectionInterface() const;
@@ -241,7 +241,7 @@
public:
- QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent = 0);
~QNetworkManagerInterfaceDevice();
QString udi() const;
@@ -270,7 +270,8 @@
public:
- QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath,
+ QObject *parent = 0);
~QNetworkManagerInterfaceDeviceWired();
QDBusInterface *connectionInterface() const;
@@ -304,7 +305,8 @@
Rsn = 0x20
};
- QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent = 0);
+ explicit QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath,
+ QObject *parent = 0);
~QNetworkManagerInterfaceDeviceWireless();
QDBusObjectPath path() const;
@@ -335,7 +337,7 @@
public:
- QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0);
+ explicit QNetworkManagerSettings(const QString &settingsService, QObject *parent = 0);
~QNetworkManagerSettings();
QDBusInterface *connectionInterface() const;
@@ -395,7 +397,7 @@
Activated = 2
};
- QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0);
+ explicit QNetworkManagerConnectionActive(const QString &dbusPathName, QObject *parent = 0);
~ QNetworkManagerConnectionActive();
QDBusInterface *connectionInterface() const;
@@ -423,7 +425,7 @@
Q_OBJECT
public:
- QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0);
+ explicit QNetworkManagerIp4Config(const QString &dbusPathName, QObject *parent = 0);
~QNetworkManagerIp4Config();
QStringList domains() const;
--- a/qtmobility/src/bearer/qnetworksession.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworksession.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -46,7 +46,7 @@
#ifdef Q_OS_SYMBIAN
#include "qnetworksession_s60_p.h"
-#elif Q_WS_MAEMO_6
+#elif (defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5))
#include "qnetworksession_maemo_p.h"
#else
#include "qnetworksession_p.h"
--- a/qtmobility/src/bearer/qnetworksession.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworksession.h Thu Apr 15 08:16:03 2010 +0300
@@ -79,7 +79,7 @@
InvalidConfigurationError
};
- QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0);
+ explicit QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0);
virtual ~QNetworkSession();
bool isOpen() const;
--- a/qtmobility/src/bearer/qnetworksession_maemo.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworksession_maemo.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -42,16 +42,12 @@
#include <QHash>
#include "qnetworksession_maemo_p.h"
-#include <dbus/dbus.h>
-#include <dbus/dbus-glib-lowlevel.h>
#include <maemo_icd.h>
#include <iapconf.h>
#include <proxyconf.h>
-#include <sys/types.h>
#include <ifaddrs.h>
-#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -60,262 +56,73 @@
static QHash<QString, QVariant> properties;
static QString get_network_interface();
-static DBusConnection *dbus_connection;
-static DBusHandlerResult signal_handler(DBusConnection *connection,
- DBusMessage *message,
- void *user_data);
-#define ICD_DBUS_MATCH "type='signal'," \
- "interface='" ICD_DBUS_INTERFACE "'," \
- "path='" ICD_DBUS_PATH "'"
-
-
-static inline DBusConnection *get_dbus_conn(DBusError *error)
-{
- DBusConnection *conn = dbus_bus_get(DBUS_BUS_SYSTEM, error);
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Listening to bus" << dbus_bus_get_unique_name(conn);
-#endif
-
- return conn;
-}
-
-
-/* Helper class that monitors the Icd status messages and
- * can change the IAP status accordingly. This is a singleton.
- */
-class IcdListener : public QObject
+void QNetworkSessionPrivate::iapStateChanged(const QString& iapid, uint icd_connection_state)
{
- Q_OBJECT
-
-public:
- IcdListener() : first_call(true) { }
- friend DBusHandlerResult signal_handler(DBusConnection *connection,
- DBusMessage *message,
- void *user_data);
- void setup(QNetworkSessionPrivate *d);
- void cleanup();
- void cleanupSession(QNetworkSessionPrivate *ptr);
-
- enum IapConnectionStatus {
- /* The IAP was connected */
- CONNECTED = 0,
- /* The IAP was disconnected */
- DISCONNECTED,
- /* The IAP is disconnecting */
- DISCONNECTING,
- /* The IAP has a network address, but is not yet fully connected */
- NETWORK_UP
- };
-
-private:
- void icdSignalReceived(QString&, QString&, QString&);
- bool first_call;
- QHash<QString, QNetworkSessionPrivate* > sessions;
-};
-
-Q_GLOBAL_STATIC(IcdListener, icdListener);
-
-
-static DBusHandlerResult signal_handler(DBusConnection *,
- DBusMessage *message,
- void *user_data)
-{
- if (dbus_message_is_signal(message,
- ICD_DBUS_INTERFACE,
- ICD_STATUS_CHANGED_SIG)) {
-
- IcdListener *icd = (IcdListener *)user_data;
- DBusError error;
- dbus_error_init(&error);
-
- char *iap_id = 0;
- char *network_type = 0;
- char *state = 0;
-
- if (dbus_message_get_args(message, &error,
- DBUS_TYPE_STRING, &iap_id,
- DBUS_TYPE_STRING, &network_type,
- DBUS_TYPE_STRING, &state,
- DBUS_TYPE_INVALID) == FALSE) {
- qWarning() << QString("Failed to parse icd status signal: %1").arg(error.message);
- } else {
- QString _iap_id(iap_id);
- QString _network_type(network_type);
- QString _state(state);
-
- icd->icdSignalReceived(_iap_id, _network_type, _state);
- }
-
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_HANDLED;
+ if ((publicConfig.type() == QNetworkConfiguration::UserChoice) && opened) {
+ updateIdentifier(iapid);
}
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-
-void IcdListener::setup(QNetworkSessionPrivate *d)
-{
- if (first_call) {
- // We use the old Icd dbus interface like in ConIC
- DBusError error;
- dbus_error_init(&error);
-
- dbus_connection = get_dbus_conn(&error);
- if (dbus_error_is_set(&error)) {
- qWarning() << "Cannot get dbus connection.";
- dbus_error_free(&error);
- return;
- }
-
- static struct DBusObjectPathVTable icd_vtable;
- icd_vtable.message_function = signal_handler;
-
- dbus_bus_add_match(dbus_connection, ICD_DBUS_MATCH, &error);
- if (dbus_error_is_set(&error)) {
- qWarning() << "Cannot add match" << ICD_DBUS_MATCH;
- dbus_error_free(&error);
- return;
- }
-
- if (dbus_connection_register_object_path(dbus_connection,
- ICD_DBUS_PATH,
- &icd_vtable,
- (void*)this) == FALSE) {
- qWarning() << "Cannot register dbus signal handler, interface"<< ICD_DBUS_INTERFACE << "path" << ICD_DBUS_PATH;
- dbus_error_free(&error);
- return;
- }
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Listening" << ICD_STATUS_CHANGED_SIG << "signal from" << ICD_DBUS_SERVICE;
-#endif
- first_call = false;
- dbus_error_free(&error);
- }
-
- QString id = d->activeConfig.identifier();
- if (!sessions.contains(id)) {
- QNetworkSessionPrivate *ptr = d;
- sessions.insert(id, ptr);
+ if (((publicConfig.type() == QNetworkConfiguration::UserChoice) && (activeConfig.d->id == iapid)) ||
+ (publicConfig.d->id == iapid)) {
+ switch (icd_connection_state) {
+ case ICD_STATE_CONNECTING:
+ updateState(QNetworkSession::Connecting);
+ break;
+ case ICD_STATE_CONNECTED:
+ updateState(QNetworkSession::Connected);
+ break;
+ case ICD_STATE_DISCONNECTING:
+ updateState(QNetworkSession::Closing);
+ break;
+ case ICD_STATE_DISCONNECTED:
+ updateState(QNetworkSession::Disconnected);
+ break;
+ default:
+ break;
+ }
}
}
-
-void IcdListener::icdSignalReceived(QString& iap_id,
-#ifdef BEARER_MANAGEMENT_DEBUG
- QString& network_type,
-#else
- QString&,
-#endif
- QString& state)
-{
- if (iap_id == OSSO_IAP_SCAN) // icd sends scan status signals which we will ignore
- return;
-
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Status received:" << iap_id << "type" << network_type << "state" << state;
-#endif
-
- if (!sessions.contains(iap_id)) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "No session for IAP" << iap_id;
-#endif
- return;
- }
-
- QNetworkSessionPrivate *session = sessions.value(iap_id);
- QNetworkConfiguration ap_conf = session->manager.configurationFromIdentifier(iap_id);
- if (!ap_conf.isValid()) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Unknown IAP" << iap_id;
-#endif
- return;
- }
-
- IapConnectionStatus status;
-
- if (state == "IDLE") {
- status = DISCONNECTED;
- } else if (state == "CONNECTED") {
- status = CONNECTED;
- } else if (state == "NETWORKUP") {
- status = NETWORK_UP;
- } else {
- //qDebug() << "Unknown state" << state;
- return;
- }
-
- if (status == DISCONNECTED) {
- if (ap_conf.state() == QNetworkConfiguration::Active) {
- /* The IAP was just disconnected by Icd */
- session->updateState(QNetworkSession::Disconnected);
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "Got a network disconnect when in state" << ap_conf.state();
-#endif
- }
- } else if (status == CONNECTED) {
- /* The IAP was just connected by Icd */
- session->updateState(QNetworkSession::Connected);
- session->updateIdentifier(iap_id);
-
- if (session->publicConfig.identifier() == OSSO_IAP_ANY) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "connected when connecting to" << OSSO_IAP_ANY;
-#endif
- } else {
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "IAP" << iap_id << "connected";
-#endif
- }
- }
-
- return;
-}
-
-
-void IcdListener::cleanup()
-{
- if (!first_call) {
- dbus_bus_remove_match(dbus_connection, ICD_DBUS_MATCH, NULL);
- dbus_connection_unref(dbus_connection);
- }
-}
-
-
-void IcdListener::cleanupSession(QNetworkSessionPrivate *ptr)
-{
- if (ptr->publicConfig.type() == QNetworkConfiguration::UserChoice)
- (void)sessions.take(ptr->activeConfig.identifier());
- else
- (void)sessions.take(ptr->publicConfig.identifier());
-}
-
-
void QNetworkSessionPrivate::cleanupSession(void)
{
- icdListener()->cleanupSession(this);
-
QObject::disconnect(q, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateProxies(QNetworkSession::State)));
}
void QNetworkSessionPrivate::updateState(QNetworkSession::State newState)
{
- if( newState != state) {
- state = newState;
-
- if (state == QNetworkSession::Disconnected) {
+ if (newState != state) {
+ if (newState == QNetworkSession::Disconnected) {
+ if (isOpen) {
+ // The Session was aborted by the user or system
+ lastError = QNetworkSession::SessionAbortedError;
+ emit q->error(lastError);
+ emit q->closed();
+ }
+ if (m_stopTimer.isActive()) {
+ // Session was closed by calling stop()
+ m_stopTimer.stop();
+ }
isOpen = false;
+ opened = false;
currentNetworkInterface.clear();
- if (publicConfig.type() == QNetworkConfiguration::UserChoice)
- activeConfig.d->state = QNetworkConfiguration::Defined;
- publicConfig.d->state = QNetworkConfiguration::Defined;
-
- } else if (state == QNetworkSession::Connected) {
- isOpen = true;
+ if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
+ copyConfig(publicConfig, activeConfig);
+ activeConfig.d->state = QNetworkConfiguration::Defined;
+ } else {
+ if (!activeConfig.isValid()) {
+ // Active configuration (IAP) was removed from system
+ // => Connection was disconnected and configuration became
+ // invalid
+ // => Also Session state must be changed to invalid
+ newState = QNetworkSession::Invalid;
+ }
+ }
+ } else if (newState == QNetworkSession::Connected) {
+ if (opened) {
+ isOpen = true;
+ }
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
activeConfig.d->state = QNetworkConfiguration::Active;
activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint;
@@ -323,12 +130,15 @@
publicConfig.d->state = QNetworkConfiguration::Active;
}
- emit q->stateChanged(newState);
+ if (newState != state) {
+ state = newState;
+ emit q->stateChanged(newState);
+ }
}
}
-void QNetworkSessionPrivate::updateIdentifier(QString &newId)
+void QNetworkSessionPrivate::updateIdentifier(const QString &newId)
{
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
activeConfig.d->network_attrs |= ICD_NW_ATTR_IAPNAME;
@@ -357,7 +167,7 @@
return 0;
}
- foreach (Maemo::IcdStatisticsResult res, stats_results) {
+ foreach (const Maemo::IcdStatisticsResult &res, stats_results) {
if (res.params.network_attrs & ICD_NW_ATTR_IAPNAME) {
/* network_id is the IAP UUID */
if (QString(res.params.network_id.data()) == activeConfig.identifier()) {
@@ -433,9 +243,6 @@
*/
void QNetworkSessionPrivate::syncStateWithInterface()
{
- /* Start to listen Icd status messages. */
- icdListener()->setup(this);
-
/* Initially we are not active although the configuration might be in
* connected state.
*/
@@ -447,10 +254,10 @@
if (publicConfig.d.data()) {
QNetworkConfigurationManagerPrivate* mgr = (QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager;
if (mgr) {
- QObject::connect(mgr, SIGNAL(configurationChanged(QNetworkConfiguration)),
- this, SLOT(configurationChanged(QNetworkConfiguration)));
+ connect(mgr, SIGNAL(iapStateChanged(const QString&, uint)),
+ this, SLOT(iapStateChanged(const QString&, uint)));
} else {
- qWarning()<<"Manager object not set when trying to connect configurationChanged signal. Your configuration object is not correctly setup, did you remember to call manager.updateConfigurations() before creating session object?";
+ qWarning()<<"Manager object not set when trying to connect iapStateChanged signal. Your configuration object is not correctly setup, did you remember to call manager.updateConfigurations() before creating session object?";
state = QNetworkSession::Invalid;
lastError = QNetworkSession::UnknownSessionError;
return;
@@ -464,14 +271,14 @@
switch (publicConfig.type()) {
case QNetworkConfiguration::InternetAccessPoint:
- activeConfig = publicConfig;
+ activeConfig = publicConfig;
break;
case QNetworkConfiguration::ServiceNetwork:
- serviceConfig = publicConfig;
+ serviceConfig = publicConfig;
break;
case QNetworkConfiguration::UserChoice:
// active config will contain correct data after open() has succeeded
- copyConfig(publicConfig, activeConfig);
+ copyConfig(publicConfig, activeConfig);
/* We create new configuration that holds the actual configuration
* returned by icd. This way publicConfig still contains the
@@ -505,7 +312,6 @@
* supports only one connection anyway.
*/
if (icd.state(state_results) && !state_results.isEmpty()) {
-
/* If we did not get full state back, then we are not
* connected and can skip the next part.
*/
@@ -518,46 +324,44 @@
*/
if (publicConfig.type() == QNetworkConfiguration::UserChoice ||
publicConfig.d->id == state_results.first().params.network_id) {
-
switch (state_results.first().state) {
case ICD_STATE_DISCONNECTED:
- state = QNetworkSession::Disconnected;
+ state = QNetworkSession::Disconnected;
if (activeConfig.d.data())
activeConfig.d->isValid = true;
break;
case ICD_STATE_CONNECTING:
- state = QNetworkSession::Connecting;
+ state = QNetworkSession::Connecting;
if (activeConfig.d.data())
activeConfig.d->isValid = true;
break;
case ICD_STATE_CONNECTED:
{
- if (!state_results.first().error.isEmpty())
+ if (!state_results.first().error.isEmpty())
break;
-
+
const QString id = state_results.first().params.network_id;
- QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager;
+ QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager;
if (mgr->accessPointConfigurations.contains(id)) {
//we don't want the copied data if the config is already known by the manager
//just reuse it so that existing references to the old data get the same update
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = mgr->accessPointConfigurations.value(activeConfig.d->id);
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = mgr->accessPointConfigurations.value(id);
activeConfig.d = priv;
}
-
state = QNetworkSession::Connected;
- activeConfig.d->network_id = state_results.first().params.network_id;
- activeConfig.d->id = activeConfig.d->network_id;
- activeConfig.d->network_attrs = state_results.first().params.network_attrs;
- activeConfig.d->iap_type = state_results.first().params.network_type;
- activeConfig.d->service_type = state_results.first().params.service_type;
- activeConfig.d->service_id = state_results.first().params.service_id;
- activeConfig.d->service_attrs = state_results.first().params.service_attrs;
- activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint;
- activeConfig.d->state = QNetworkConfiguration::Active;
- activeConfig.d->isValid = true;
- currentNetworkInterface = get_network_interface();
+ activeConfig.d->network_id = state_results.first().params.network_id;
+ activeConfig.d->id = activeConfig.d->network_id;
+ activeConfig.d->network_attrs = state_results.first().params.network_attrs;
+ activeConfig.d->iap_type = state_results.first().params.network_type;
+ activeConfig.d->service_type = state_results.first().params.service_type;
+ activeConfig.d->service_id = state_results.first().params.service_id;
+ activeConfig.d->service_attrs = state_results.first().params.service_attrs;
+ activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint;
+ activeConfig.d->state = QNetworkConfiguration::Active;
+ activeConfig.d->isValid = true;
+ currentNetworkInterface = get_network_interface();
Maemo::IAPConf iap_name(activeConfig.d->id);
QString name_value = iap_name.value("name").toString();
@@ -566,7 +370,6 @@
else
activeConfig.d->name = activeConfig.d->id;
-
// Add the new active configuration to manager or update the old config
mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager;
if (!(mgr->accessPointConfigurations.contains(activeConfig.d->id))) {
@@ -581,23 +384,17 @@
//qDebug()<<"New configuration"<<activeConfig.d->id<<"added to manager in sync";
#endif
- } else {
- mgr->configurationChanged((QNetworkConfigurationPrivate*)(activeConfig.d.data()));
-#ifdef BEARER_MANAGEMENT_DEBUG
- //qDebug()<<"Existing configuration"<<activeConfig.d->id<<"updated in manager in sync";
-#endif
- }
-
+ }
}
break;
case ICD_STATE_DISCONNECTING:
- state = QNetworkSession::Closing;
+ state = QNetworkSession::Closing;
if (activeConfig.d.data())
activeConfig.d->isValid = true;
break;
default:
- break;
+ break;
}
}
} else {
@@ -686,7 +483,6 @@
state = QNetworkSession::NotAvailable;
} else if ((activeConfig.state() & QNetworkConfiguration::Undefined) == QNetworkConfiguration::Undefined) {
state = QNetworkSession::NotAvailable;
- clearConfiguration(activeConfig);
}
bool oldActive = isOpen;
@@ -701,7 +497,7 @@
if (oldState != state) {
emit q->stateChanged(state);
- if (state == QNetworkSession::Disconnected) {
+ if (state == QNetworkSession::Disconnected && oldActive) {
#ifdef BEARER_MANAGEMENT_DEBUG
//qDebug()<<"session aborted error emitted for"<<activeConfig.identifier();
#endif
@@ -715,16 +511,6 @@
#endif
}
-
-void QNetworkSessionPrivate::configurationChanged(const QNetworkConfiguration &config)
-{
- if (serviceConfig.isValid() && (config == serviceConfig || config == activeConfig))
- updateStateFromServiceNetwork();
- else if (config == activeConfig)
- updateStateFromActiveConfig();
-}
-
-
static QString get_network_interface()
{
Maemo::Icd icd;
@@ -761,14 +547,16 @@
}
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
- family = ifa->ifa_addr->sa_family;
- if (family != AF_INET) {
- continue; /* Currently only IPv4 is supported by icd dbus interface */
- }
- if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) {
- iface = QString(ifa->ifa_name);
- break;
- }
+ if (ifa->ifa_addr) {
+ family = ifa->ifa_addr->sa_family;
+ if (family != AF_INET) {
+ continue; /* Currently only IPv4 is supported by icd dbus interface */
+ }
+ if (((struct sockaddr_in *)ifa->ifa_addr)->sin_addr.s_addr == addr.s_addr) {
+ iface = QString(ifa->ifa_name);
+ break;
+ }
+ }
}
freeifaddrs(ifaddr);
@@ -778,11 +566,18 @@
void QNetworkSessionPrivate::open()
{
+ if (m_stopTimer.isActive()) {
+ m_stopTimer.stop();
+ }
+ if (!publicConfig.isValid()) {
+ lastError = QNetworkSession::InvalidConfigurationError;
+ emit q->error(lastError);
+ return;
+ }
if (serviceConfig.isValid()) {
lastError = QNetworkSession::OperationNotSupportedError;
emit q->error(lastError);
} else if (!isOpen) {
-
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
/* Caller is trying to connect to default IAP.
* At this time we will not know the IAP details so we just
@@ -893,7 +688,7 @@
updateState(QNetworkSession::Disconnected);
emit q->error(QNetworkSession::InvalidConfigurationError);
if (publicConfig.type() == QNetworkConfiguration::UserChoice)
- cleanupAnyConfiguration();
+ copyConfig(publicConfig, activeConfig);
return;
}
@@ -969,8 +764,7 @@
}
#endif
#endif
-
- QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)config.d.data()->manager;
+ QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)publicConfig.d.data()->manager;
if (!mgr->accessPointConfigurations.contains(result)) {
QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> ptr = config.d;
mgr->accessPointConfigurations.insert(result, ptr);
@@ -984,13 +778,13 @@
#endif
} else {
- QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = mgr->accessPointConfigurations.value(result);
+ QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> priv = mgr->accessPointConfigurations.value(result);
QNetworkConfiguration reference;
reference.d = priv;
copyConfig(config, reference, false);
+ reference.d.data()->id = result; // Note: Id was not copied in copyConfig() function
config = reference;
activeConfig = reference;
- mgr->configurationChanged((QNetworkConfigurationPrivate*)(config.d.data()));
#ifdef BEARER_MANAGEMENT_DEBUG
//qDebug()<<"Existing configuration"<<result<<"updated in manager in open";
@@ -1006,21 +800,11 @@
#endif
updateState(QNetworkSession::Disconnected);
if (publicConfig.type() == QNetworkConfiguration::UserChoice)
- cleanupAnyConfiguration();
+ copyConfig(publicConfig, activeConfig);
emit q->error(QNetworkSession::UnknownSessionError);
}
}
-
-void QNetworkSessionPrivate::cleanupAnyConfiguration()
-{
-#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug()<<"Removing configuration created for" << activeConfig.d->id;
-#endif
- activeConfig = publicConfig;
-}
-
-
void QNetworkSessionPrivate::close()
{
if (serviceConfig.isValid()) {
@@ -1041,28 +825,29 @@
emit q->error(lastError);
} else {
if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
- state = QNetworkSession::Closing;
- emit q->stateChanged(state);
-
- Maemo::Icd icd;
+ if (!m_stopTimer.isActive()) {
+ Maemo::Icd icd;
#ifdef BEARER_MANAGEMENT_DEBUG
- qDebug() << "stopping session" << publicConfig.identifier();
+ qDebug() << "stopping session" << publicConfig.identifier();
#endif
- icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT);
- startTime = QDateTime();
+ state = QNetworkSession::Closing;
+ emit q->stateChanged(state);
+
+ opened = false;
+ isOpen = false;
- /* Note that the state will go disconnected in
- * updateStateFromActiveConfig() which gets called after
- * configurationChanged is emitted (below).
- */
+ icd.disconnect(ICD_CONNECTION_FLAG_APPLICATION_EVENT);
+ startTime = QDateTime();
- activeConfig.d->state = QNetworkConfiguration::Discovered;
- QNetworkConfigurationManagerPrivate *mgr = (QNetworkConfigurationManagerPrivate*)activeConfig.d.data()->manager;
- mgr->configurationChanged((QNetworkConfigurationPrivate*)activeConfig.d.data());
+ /* Note: Session state will change to disconnected
+ * as soon as QNetworkConfigurationManager sends
+ * corresponding iapStateChanged signal.
+ */
- opened = false;
- isOpen = false;
-
+ // Make sure that this Session will send closed signal
+ // even though ICD connection will not ever get closed
+ m_stopTimer.start(ICD_SHORT_CONNECT_TIMEOUT); // 10 seconds wait
+ }
} else {
opened = false;
isOpen = false;
@@ -1071,6 +856,14 @@
}
}
+void QNetworkSessionPrivate::finishStopBySendingClosedSignal()
+{
+ if ((activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
+ state = QNetworkSession::Connected;
+ emit q->stateChanged(state);
+ }
+ emit q->closed();
+}
void QNetworkSessionPrivate::migrate()
{
@@ -1186,7 +979,6 @@
}
-#include "qnetworksession_maemo.moc"
#include "moc_qnetworksession_maemo_p.cpp"
QTM_END_NAMESPACE
--- a/qtmobility/src/bearer/qnetworksession_maemo_p.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworksession_maemo_p.h Thu Apr 15 08:16:03 2010 +0300
@@ -58,10 +58,9 @@
#include <qnetworksession.h>
#include <QNetworkInterface>
#include <QDateTime>
+#include <QTimer>
-#ifdef Q_WS_MAEMO_6
#include <icd/dbus_api.h>
-#endif
QTM_BEGIN_NAMESPACE
@@ -71,13 +70,11 @@
public:
QNetworkSessionPrivate() :
tx_data(0), rx_data(0), m_activeTime(0), isOpen(false),
-#ifdef Q_WS_MAEMO_6
connectFlags(ICD_CONNECTION_FLAG_USER_EVENT),
-#else
- connectFlags(0),
-#endif
currentState(QNetworkSession::Invalid)
{
+ m_stopTimer.setSingleShot(true);
+ connect(&m_stopTimer, SIGNAL(timeout()), this, SLOT(finishStopBySendingClosedSignal()));
}
~QNetworkSessionPrivate()
@@ -121,8 +118,9 @@
private Q_SLOTS:
void do_open();
void networkConfigurationsChanged();
- void configurationChanged(const QNetworkConfiguration &config);
+ void iapStateChanged(const QString& iapid, uint icd_connection_state);
void updateProxies(QNetworkSession::State newState);
+ void finishStopBySendingClosedSignal();
private:
QNetworkConfigurationManager manager;
@@ -145,7 +143,6 @@
QNetworkConfiguration& copyConfig(QNetworkConfiguration &fromConfig, QNetworkConfiguration &toConfig, bool deepCopy = true);
void clearConfiguration(QNetworkConfiguration &config);
- void cleanupAnyConfiguration();
QNetworkSession::State state;
bool isOpen;
@@ -161,13 +158,15 @@
QString currentNetworkInterface;
friend class IcdListener;
void updateState(QNetworkSession::State);
- void updateIdentifier(QString &newId);
+ void updateIdentifier(const QString &newId);
quint64 getStatistics(bool sent) const;
void cleanupSession(void);
void updateProxyInformation();
void clearProxyInformation();
QNetworkSession::State currentState;
+
+ QTimer m_stopTimer;
};
QTM_END_NAMESPACE
--- a/qtmobility/src/bearer/qnetworksession_p.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworksession_p.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -495,38 +495,33 @@
startTime = QDateTime();
return;
}
- QString connectionIdent = q->configuration().identifier();
QString interface = currentInterface().hardwareAddress().toLower();
- QString devicePath = "/org/freedesktop/Hal/devices/net_" + interface.replace(":","_");
+ const QString devicePath = QLatin1String("/org/freedesktop/Hal/devices/net_") +
+ interface.replace(QLatin1Char(':'), QLatin1Char('_'));
QString path;
QString serviceName;
- QNetworkManagerInterface * ifaceD;
- ifaceD = new QNetworkManagerInterface();
+ QScopedPointer<QNetworkManagerInterface> ifaceD(new QNetworkManagerInterface());
- QList<QDBusObjectPath> connections = ifaceD->activeConnections();
- foreach(QDBusObjectPath conpath, connections) {
- QNetworkManagerConnectionActive *conDetails;
- conDetails = new QNetworkManagerConnectionActive(conpath.path());
- QDBusObjectPath connection = conDetails->connection();
+ foreach (const QDBusObjectPath &conpath, ifaceD->activeConnections()) {
+ QScopedPointer<QNetworkManagerConnectionActive> conDetails(new QNetworkManagerConnectionActive(conpath.path()));
+ const QDBusObjectPath connection = conDetails->connection();
serviceName = conDetails->serviceName();
- QList<QDBusObjectPath> so = conDetails->devices();
- foreach(QDBusObjectPath device, so) {
-
+ foreach (const QDBusObjectPath &device, conDetails->devices()) {
if(device.path() == devicePath) {
path = connection.path();
}
break;
}
}
-if(serviceName.isEmpty())
- return;
- QNetworkManagerSettings *settingsiface;
- settingsiface = new QNetworkManagerSettings(serviceName);
- QList<QDBusObjectPath> list = settingsiface->listConnections();
- foreach(QDBusObjectPath path, list) {
- QNetworkManagerSettingsConnection *sysIface;
- sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path());
+
+ if(serviceName.isEmpty())
+ return;
+
+ QScopedPointer<QNetworkManagerSettings> settingsiface(new QNetworkManagerSettings(serviceName));
+ foreach (const QDBusObjectPath &path, settingsiface->listConnections()) {
+ QScopedPointer<QNetworkManagerSettingsConnection> sysIface;
+ sysIface.reset(new QNetworkManagerSettingsConnection(serviceName, path.path()));
startTime = QDateTime::fromTime_t(sysIface->getTimestamp());
// isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
}
--- a/qtmobility/src/bearer/qnetworksession_s60_p.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworksession_s60_p.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -54,16 +54,10 @@
QNetworkSessionPrivate::QNetworkSessionPrivate()
: CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid),
isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError),
- iALREnabled(0)
+ iALREnabled(0), iConnectInBackground(false)
{
CActiveScheduler::Add(this);
- // Try to load "Open C" dll dynamically and
- // try to attach to setdefaultif function dynamically.
- if (iOpenCLibrary.Load(_L("libc")) == KErrNone) {
- iDynamicSetdefaultif = (TOpenCSetdefaultifFunction)iOpenCLibrary.Lookup(564);
- }
-
TRAP_IGNORE(iConnectionMonitor.ConnectL());
}
@@ -89,14 +83,12 @@
iConnection.Close();
iSocketServ.Close();
- if (iDynamicSetdefaultif) {
- iDynamicSetdefaultif(0);
- }
+
+ // Close global 'Open C' RConnection
+ setdefaultif(0);
iConnectionMonitor.CancelNotifications();
iConnectionMonitor.Close();
-
- iOpenCLibrary.Close();
}
void QNetworkSessionPrivate::syncStateWithInterface()
@@ -202,13 +194,24 @@
return activeInterface;
}
-QVariant QNetworkSessionPrivate::sessionProperty(const QString& /*key*/) const
+QVariant QNetworkSessionPrivate::sessionProperty(const QString& key) const
{
+ if (key == "ConnectInBackground") {
+ return QVariant(iConnectInBackground);
+ }
return QVariant();
}
-void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QVariant& /*value*/)
+void QNetworkSessionPrivate::setSessionProperty(const QString& key, const QVariant& value)
{
+ // Valid value means adding property, invalid means removing it.
+ if (key == "ConnectInBackground") {
+ if (value.isValid()) {
+ iConnectInBackground = value.toBool();
+ } else {
+ iConnectInBackground = EFalse;
+ }
+ }
}
QString QNetworkSessionPrivate::errorString() const
@@ -244,15 +247,24 @@
// => RConnection::ProgressNotification will be used for IAP/SNAP monitoring
iConnectionMonitor.CancelNotifications();
- // Configuration must be at least in Discovered - state for connecting purposes.
- if ((publicConfig.state() & QNetworkConfiguration::Discovered) !=
- QNetworkConfiguration::Discovered) {
+ // Configuration may have been invalidated after session creation by platform
+ // (e.g. configuration has been deleted).
+ if (!publicConfig.isValid()) {
newState(QNetworkSession::Invalid);
iError = QNetworkSession::InvalidConfigurationError;
emit q->error(iError);
syncStateWithInterface();
return;
}
+ // If opening a (un)defined configuration, session emits error and enters
+ // NotAvailable -state.
+ if (publicConfig.state() == QNetworkConfiguration::Undefined ||
+ publicConfig.state() == QNetworkConfiguration::Defined) {
+ newState(QNetworkSession::NotAvailable);
+ iError = QNetworkSession::InvalidConfigurationError;
+ emit q->error(iError);
+ return;
+ }
TInt error = iSocketServ.Connect();
if (error != KErrNone) {
@@ -301,14 +313,12 @@
activeInterface = interface(activeConfig.d.data()->numericId);
connected = ETrue;
startTime = QDateTime::currentDateTime();
- if (iDynamicSetdefaultif) {
- // Use name of the IAP to set default IAP
- QByteArray nameAsByteArray = publicConfig.name().toUtf8();
- ifreq ifr;
- strcpy(ifr.ifr_name, nameAsByteArray.constData());
-
- error = iDynamicSetdefaultif(&ifr);
- }
+ // Use name of the IAP to open global 'Open C' RConnection
+ QByteArray nameAsByteArray = publicConfig.name().toUtf8();
+ ifreq ifr;
+ memset(&ifr, 0, sizeof(struct ifreq));
+ strcpy(ifr.ifr_name, nameAsByteArray.constData());
+ error = setdefaultif(&ifr);
isOpen = true;
// Make sure that state will be Connected
newState(QNetworkSession::Connected);
@@ -320,9 +330,21 @@
}
}
if (!connected) {
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ // With One Click Connectivity (Symbian^3 onwards) it is possible
+ // to connect silently, without any popups.
+ TConnPrefList pref;
+ TExtendedConnPref prefs;
+ prefs.SetIapId(publicConfig.d.data()->numericId);
+ if (iConnectInBackground) {
+ prefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnSilent );
+ }
+ pref.AppendL(&prefs);
+#else
TCommDbConnPref pref;
pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
pref.SetIapId(publicConfig.d.data()->numericId);
+#endif
iConnection.Start(pref, iStatus);
if (!IsActive()) {
SetActive();
@@ -330,7 +352,17 @@
newState(QNetworkSession::Connecting);
}
} else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ TConnPrefList snapPref;
+ TExtendedConnPref prefs;
+ prefs.SetSnapId(publicConfig.d.data()->numericId);
+ if (iConnectInBackground) {
+ prefs.SetNoteBehaviour( TExtendedConnPref::ENoteBehaviourConnSilent );
+ }
+ snapPref.AppendL(&prefs);
+#else
TConnSnapPref snapPref(publicConfig.d.data()->numericId);
+#endif
iConnection.Start(snapPref, iStatus);
if (!IsActive()) {
SetActive();
@@ -408,9 +440,9 @@
iConnection.Close();
iSocketServ.Close();
- if (iDynamicSetdefaultif) {
- iDynamicSetdefaultif(0);
- }
+
+ // Close global 'Open C' RConnection
+ setdefaultif(0);
#ifdef Q_CC_NOKIAX86
if ((allowSignals && iapClientCount(activeIap) <= 0) ||
@@ -432,20 +464,53 @@
void QNetworkSessionPrivate::stop()
{
- if (!isOpen) {
- return;
+ if (!isOpen &&
+ publicConfig.isValid() &&
+ publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
+ // If the publicConfig is type of IAP, enumerate through connections at
+ // connection monitor. If publicConfig is active in that list, stop it.
+ // Otherwise there is nothing to stop. Note: because this QNetworkSession is not open,
+ // activeConfig is not usable.
+ TUint count;
+ TRequestStatus status;
+ iConnectionMonitor.GetConnectionCount(count, status);
+ User::WaitForRequest(status);
+ if (status.Int() != KErrNone) {
+ return;
+ }
+ TUint numSubConnections; // Not used but needed by GetConnectionInfo i/f
+ TUint connectionId;
+ for (TInt i = 1; i <= count; ++i) {
+ // Get (connection monitor's assigned) connection ID
+ TInt ret = iConnectionMonitor.GetConnectionInfo(i, connectionId, numSubConnections);
+ if (ret == KErrNone) {
+ // See if connection Id matches with our Id. If so, stop() it.
+ if (publicConfig.d.data()->connectionId == connectionId) {
+ ret = iConnectionMonitor.SetBoolAttribute(connectionId,
+ 0, // subConnectionId don't care
+ KConnectionStop,
+ ETrue);
+ }
+ }
+ }
+ } else if (isOpen) {
+ // Since we are open, use RConnection to stop the interface
+ isOpen = false;
+ newState(QNetworkSession::Closing);
+ iConnection.Stop(RConnection::EStopAuthoritative);
+ isOpen = true;
+ close(false);
+ emit q->closed();
}
- isOpen = false;
- newState(QNetworkSession::Closing);
- iConnection.Stop(RConnection::EStopAuthoritative);
- isOpen = true;
- close(false);
- emit q->closed();
}
void QNetworkSessionPrivate::migrate()
{
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
+ // Close global 'Open C' RConnection
+ setdefaultif(0);
+
+ // Start migrating to new IAP
iMobility->MigrateToPreferredCarrier();
#endif
}
@@ -466,14 +531,16 @@
{
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
iMobility->NewCarrierAccepted();
- if (iDynamicSetdefaultif) {
- // Use name of the IAP to set default IAP
- QByteArray nameAsByteArray = activeConfig.name().toUtf8();
- ifreq ifr;
- strcpy(ifr.ifr_name, nameAsByteArray.constData());
+
+ QNetworkConfiguration newActiveConfig = activeConfiguration(iNewRoamingIap);
- iDynamicSetdefaultif(&ifr);
- }
+ // Use name of the new IAP to open global 'Open C' RConnection
+ QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
+ ifreq ifr;
+ memset(&ifr, 0, sizeof(struct ifreq));
+ strcpy(ifr.ifr_name, nameAsByteArray.constData());
+ setdefaultif(&ifr);
+
newState(QNetworkSession::Connected, iNewRoamingIap);
#endif
}
@@ -482,9 +549,19 @@
{
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
iMobility->NewCarrierRejected();
+
if (!iALRUpgradingConnection) {
newState(QNetworkSession::Disconnected);
} else {
+ QNetworkConfiguration newActiveConfig = activeConfiguration(iOldRoamingIap);
+
+ // Use name of the old IAP to open global 'Open C' RConnection
+ QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
+ ifreq ifr;
+ memset(&ifr, 0, sizeof(struct ifreq));
+ strcpy(ifr.ifr_name, nameAsByteArray.constData());
+ setdefaultif(&ifr);
+
newState(QNetworkSession::Connected, iOldRoamingIap);
}
#endif
@@ -748,19 +825,19 @@
TInt statusCode = iStatus.Int();
switch (statusCode) {
- case KErrNone: // Connection created succesfully
+ case KErrNone: // Connection created successfully
{
TInt error = KErrNone;
QNetworkConfiguration newActiveConfig = activeConfiguration();
if (!newActiveConfig.isValid()) {
error = KErrGeneral;
- } else if (iDynamicSetdefaultif) {
- // Use name of the IAP to set default IAP
- QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
+ } else {
+ // Use name of the IAP to open global 'Open C' RConnection
ifreq ifr;
+ memset(&ifr, 0, sizeof(struct ifreq));
+ QByteArray nameAsByteArray = newActiveConfig.name().toUtf8();
strcpy(ifr.ifr_name, nameAsByteArray.constData());
-
- error = iDynamicSetdefaultif(&ifr);
+ error = setdefaultif(&ifr);
}
if (error != KErrNone) {
--- a/qtmobility/src/bearer/qnetworksession_s60_p.h Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnetworksession_s60_p.h Thu Apr 15 08:16:03 2010 +0300
@@ -58,25 +58,25 @@
#include <QDateTime>
#include <e32base.h>
-#include <CommDbConnPref.h>
+#include <commdbconnpref.h>
#include <es_sock.h>
#include <rconnmon.h>
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
#include <comms-infras/cs_mobility_apiext.h>
#endif
-
-typedef int(*TOpenCSetdefaultifFunction)(const struct ifreq*);
+#ifdef OCC_FUNCTIONALITY_AVAILABLE
+ #include <extendedconnpref.h>
+#endif
QTM_BEGIN_NAMESPACE
class ConnectionProgressNotifier;
+class QNetworkSessionPrivate : public QObject, public CActive,
#ifdef SNAP_FUNCTIONALITY_AVAILABLE
-class QNetworkSessionPrivate : public QObject, public CActive, public MMobilityProtocolResp,
+ public MMobilityProtocolResp,
+#endif
public MConnectionMonitorObserver
-#else
-class QNetworkSessionPrivate : public QObject, public CActive, public MConnectionMonitorObserver
-#endif
{
Q_OBJECT
public:
@@ -162,9 +162,6 @@
QNetworkSession* q;
QDateTime startTime;
- RLibrary iOpenCLibrary;
- TOpenCSetdefaultifFunction iDynamicSetdefaultif;
-
mutable RSocketServ iSocketServ;
mutable RConnection iConnection;
mutable RConnectionMonitor iConnectionMonitor;
@@ -176,6 +173,7 @@
QNetworkSession::SessionError iError;
TInt iALREnabled;
TBool iALRUpgradingConnection;
+ TBool iConnectInBackground;
QList<QString> iKnownConfigsBeforeConnectionStart;
--- a/qtmobility/src/bearer/qnmwifiengine_unix.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/bearer/qnmwifiengine_unix.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -75,17 +75,14 @@
connect(iface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
this, SLOT(slotActivationFinished(QDBusPendingCallWatcher*)));
- QList<QDBusObjectPath> list = iface->getDevices();
-
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, iface->getDevices())
addDevice(path);
- }
QStringList connectionServices;
connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS;
connectionServices << NM_DBUS_SERVICE_USER_SETTINGS;
QNetworkManagerSettings *settingsiface;
- foreach (QString service, connectionServices) {
+ foreach (const QString &service, connectionServices) {
settingsiface = new QNetworkManagerSettings(service, this);
settingsiface->setConnections();
connect(settingsiface,SIGNAL(newConnection(QDBusObjectPath)),
@@ -146,13 +143,12 @@
QString connPath;
QScopedPointer<QNetworkManagerSettings> settingsiface;
- foreach (QString service, connectionServices) {
+ foreach (const QString &service, connectionServices) {
QString ident;
settingsiface.reset(new QNetworkManagerSettings(service));
- QList<QDBusObjectPath> list = settingsiface->listConnections();
QNetworkManagerSettingsConnection *sysIface;
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, settingsiface->listConnections()) {
ident = path.path();
bool addIt = false;
QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate();
@@ -218,12 +214,11 @@
void QNmWifiEngine::accessPointConnections()
{
- QList<QDBusObjectPath> list = iface->getDevices();
QScopedPointer<QNetworkManagerInterfaceDevice> devIface;
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, iface->getDevices()) {
devIface.reset(new QNetworkManagerInterfaceDevice(path.path()));
if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) {
- QList<QString> apList = availableAccessPoints.uniqueKeys();
+ const QList<QString> apList = availableAccessPoints.uniqueKeys();
QList<QString>::const_iterator i;
for (i = apList.constBegin(); i != apList.constEnd(); ++i) {
@@ -256,8 +251,7 @@
{
QString interface = getInterfaceFromId(id);
QScopedPointer<QNetworkManagerInterfaceDevice> devIface;
- QList<QDBusObjectPath> list = iface->getDevices();
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, iface->getDevices()) {
devIface.reset(new QNetworkManagerInterfaceDevice(path.path()));
if(interface == devIface->networkInterface().name()) {
@@ -355,10 +349,9 @@
connectionServices << NM_DBUS_SERVICE_USER_SETTINGS;
QScopedPointer<QNetworkManagerSettings> settingsiface;
- foreach (QString service, connectionServices) {
+ foreach (const QString &service, connectionServices) {
settingsiface.reset(new QNetworkManagerSettings(service));
- QList<QDBusObjectPath> list = settingsiface->listConnections();
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, settingsiface->listConnections()) {
QNetworkManagerSettingsConnection sysIface(service, path.path());
knownSsids << sysIface.getSsid();
}
@@ -370,10 +363,8 @@
QScopedPointer<QNetworkManagerInterface> dbIface;
activeConnectionPaths.clear();
dbIface.reset(new QNetworkManagerInterface);
- QList <QDBusObjectPath> connections = dbIface->activeConnections();
- foreach(QDBusObjectPath conpath, connections) {
- activeConnectionPaths << conpath.path();
- }
+ foreach (const QDBusObjectPath &conpath, dbIface->activeConnections())
+ activeConnectionPaths << conpath.path();
}
QNetworkConfigurationPrivate * QNmWifiEngine::addAccessPoint( const QString &iPath, QDBusObjectPath path)
@@ -462,9 +453,8 @@
{
QStringList connectionSettings = getConnectionPathForId(id);
QNetworkManagerInterface ifaceD;
- QList<QDBusObjectPath> connections = ifaceD.activeConnections();
QScopedPointer<QNetworkManagerConnectionActive> conDetailsD;
- foreach(QDBusObjectPath path, connections) {
+ foreach (const QDBusObjectPath &path, ifaceD.activeConnections()) {
conDetailsD.reset(new QNetworkManagerConnectionActive( path.path()));
if(conDetailsD->connection().path() == connectionSettings.at(1)
&& conDetailsD->serviceName() == connectionSettings.at(0))
@@ -623,11 +613,9 @@
//active connection
QNetworkManagerConnectionActive aConn(aconpath);
- QList <QDBusObjectPath> devs = aConn.devices();
-
QScopedPointer<QNetworkManagerInterfaceDevice> ifaceDevice;
QScopedPointer<QNetworkManagerInterfaceDeviceWired> devWiredIface;
- foreach(QDBusObjectPath dev, devs) {
+ foreach (const QDBusObjectPath &dev, aConn.devices()) {
ifaceDevice.reset(new QNetworkManagerInterfaceDevice(dev.path()));
if(ifaceDevice->deviceType() == DEVICE_TYPE_802_3_ETHERNET) {
@@ -663,7 +651,7 @@
bool ok = false;
if(knownSsids.contains(ssid, Qt::CaseSensitive)) {
- foreach(QString onessid, knownSsids) {
+ foreach (const QString &onessid, knownSsids) {
if(onessid == ssid && availableAccessPoints.contains(ssid)) {
ok = true;
break;
@@ -693,8 +681,7 @@
QScopedPointer<QNetworkManagerConnectionActive> aConn;
aConn.reset(new QNetworkManagerConnectionActive(aConPath));
QScopedPointer<QNetworkManagerInterfaceDevice> ifaceDevice;
- QList<QDBusObjectPath> devices = aConn->devices();
- foreach(QDBusObjectPath device, devices) {
+ foreach (const QDBusObjectPath &device, aConn->devices()) {
ifaceDevice.reset(new QNetworkManagerInterfaceDevice(device.path()));
if(ifaceDevice->ip4Address() == ipaddress) {
return true;
@@ -711,7 +698,7 @@
QNetworkInterface interface;
QScopedPointer<QNetworkManagerConnectionActive> aConn;
- foreach(QString conpath, activeConnectionPaths) {
+ foreach (const QString &conpath, activeConnectionPaths) {
aConn.reset(new QNetworkManagerConnectionActive(conpath));
if(aConn->connection().path() == conIdPath.at(1)
&& aConn->serviceName() == conIdPath.at(0)) {
@@ -723,9 +710,8 @@
}
//try guessing
- QList<QDBusObjectPath> list = iface->getDevices();
QScopedPointer<QNetworkManagerInterfaceDevice> devIface;
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, iface->getDevices()) {
devIface.reset(new QNetworkManagerInterfaceDevice(path.path()));
if(devIface->deviceType() == type ) {
if(devIface->state() == NM_DEVICE_STATE_DISCONNECTED) {
@@ -793,23 +779,21 @@
void QNmWifiEngine::scanForAccessPoints()
{
availableAccessPoints.clear();
- QList<QDBusObjectPath> list = iface->getDevices();
QScopedPointer<QNetworkManagerInterfaceDevice> devIface;
QScopedPointer<QNetworkManagerInterfaceDeviceWireless> devWirelessIface;
QScopedPointer<QNetworkManagerInterfaceAccessPoint> accessPointIface;
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, iface->getDevices()) {
devIface.reset(new QNetworkManagerInterfaceDevice(path.path()));
if(devIface->deviceType() == DEVICE_TYPE_802_11_WIRELESS) {
devWirelessIface.reset(new QNetworkManagerInterfaceDeviceWireless(devIface->connectionInterface()->path()));
////////////// AccessPoints
- QList<QDBusObjectPath> apList = devWirelessIface->getAccessPoints();
- foreach(QDBusObjectPath path, apList) {
+ foreach (const QDBusObjectPath &path, devWirelessIface->getAccessPoints()) {
accessPointIface.reset(new QNetworkManagerInterfaceAccessPoint(path.path()));
- QString ssid = accessPointIface->ssid();
+ const QString ssid = accessPointIface->ssid();
availableAccessPoints.insert(ssid, path);
}
}
@@ -818,11 +802,11 @@
QString QNmWifiEngine::deviceConnectionPath(const QString &mac)
{
- QString newMac = mac;
- newMac = newMac.replace(":","_").toLower();
+ QString newMac = mac.toLower();
+ newMac.replace(QLatin1Char(':'), QLatin1Char('_'));
//device object path might not contain just mac address
//might contain extra numbers on the end. thanks HAL
- foreach(QString device, devicePaths) {
+ foreach (const QString &device, devicePaths) {
if(device.contains(newMac)) {
newMac = device;
break;
@@ -837,11 +821,10 @@
connectionServices << NM_DBUS_SERVICE_SYSTEM_SETTINGS;
connectionServices << NM_DBUS_SERVICE_USER_SETTINGS;
QScopedPointer<QNetworkManagerSettings> settingsiface;
- foreach (QString service, connectionServices) {
+ foreach (const QString &service, connectionServices) {
settingsiface.reset(new QNetworkManagerSettings(service));
- QList<QDBusObjectPath> list = settingsiface->listConnections();
QScopedPointer<QNetworkManagerSettingsConnection> sysIface;
- foreach(QDBusObjectPath path, list) {
+ foreach (const QDBusObjectPath &path, settingsiface->listConnections()) {
sysIface.reset(new QNetworkManagerSettingsConnection(service, path.path()));
if(sysIface->getUuid() == uuid)
return QStringList() << service << sysIface->connectionInterface()->path();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtmobility/src/s60installs/qtmobility.iby Thu Apr 15 08:16:03 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+
+#ifndef __QT_MOBILITY_IBY__
+#define __QT_MOBILITY_IBY__
+
+#include <bldvariant.hrh>
+
+#ifdef FF_QT_BEARER_MANAGEMENT
+file=ABI_DIR\BUILD_DIR\qtbearer.dll SHARED_LIB_DIR\qtbearer.dll PAGED
+data=ZSYSTEM\install\qtmobility_stub.sis \system\install\qtmobility_stub.sis
+#endif // FF_QT_BEARER_MANAGEMENT
+
+#endif // __QT_MOBILITY_IBY__
--- a/qtmobility/src/s60installs/s60installs.pro Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/src/s60installs/s60installs.pro Thu Apr 15 08:16:03 2010 +0300
@@ -24,9 +24,9 @@
qtmobilitydeployment.pkg_prerules += vendorinfo
epoc31 = $$(EPOCROOT31)
- epoc32 = $$(EPOCROOT32)
+ epoc32 = $$(EPOCROOT32)
epoc50 = $$(EPOCROOT50)
-
+
# default to EPOCROOT if EPOCROOTxy not defined
isEmpty(epoc31) {
EPOCROOT31 = $${EPOCROOT}
@@ -44,20 +44,24 @@
EPOCROOT50 = $$(EPOCROOT50)
}
- bearer = \
- "IF package(0x1028315F)" \
- " \"$$EPOCROOT50\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
- "ELSEIF package(0x102752AE)" \
- " \"$$EPOCROOT50\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
- "ELSEIF package(0x102032BE)" \
- " \"$$EPOCROOT31\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
- "ELSE" \
- " \"$$EPOCROOT50\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
- "ENDIF"
+ contains(mobility_modules, bearer) {
+ bearer = \
+ "IF package(0x1028315F)" \
+ " \"$$EPOCROOT50\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
+ "ELSEIF package(0x102752AE)" \
+ " \"$$EPOCROOT50\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
+ "ELSEIF package(0x102032BE)" \
+ " \"$$EPOCROOT31\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
+ "ELSE" \
+ " \"$$EPOCROOT50\epoc32/release/armv5/urel/QtBearer.dll\" - \"!:\\sys\\bin\\QtBearer.dll\"" \
+ "ENDIF"
- qtmobilitydeployment.pkg_postrules += bearer
+ qtmobilitydeployment.pkg_postrules += bearer
+ }
qtmobilitydeployment.path = /sys/bin
+
+ DEPLOYMENT += qtmobilitydeployment
- DEPLOYMENT += qtmobilitydeployment
+ #BLD_INF_RULES.prj_exports += "./qtmobility.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(qtmobility.iby)"
}
--- a/qtmobility/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -44,7 +44,7 @@
#include "qnetworkconfiguration.h"
#include "qnetworkconfigmanager.h"
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -66,7 +66,7 @@
void configurationFromIdentifier();
private:
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -78,7 +78,7 @@
void tst_QNetworkConfigurationManager::initTestCase()
{
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -152,7 +152,7 @@
void tst_QNetworkConfigurationManager::cleanupTestCase()
{
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
iapconf->clear();
delete iapconf;
iapconf2->clear();
@@ -285,14 +285,12 @@
QNetworkConfiguration defaultConfig = manager.defaultConfiguration();
bool confirm = configs.contains(defaultConfig);
- bool isUserChoice = (defaultConfig.type() == QNetworkConfiguration::UserChoice);
- //user choice config is not part of allConfigurations()
- QVERIFY(isUserChoice != confirm);
- if (!isUserChoice) {
+ if (defaultConfig.type() != QNetworkConfiguration::UserChoice) {
QVERIFY(confirm || !defaultConfig.isValid());
QVERIFY(!(confirm && !defaultConfig.isValid()));
} else {
+ QVERIFY(!confirm); // user choice config is not part of allConfigurations()
QVERIFY(defaultConfig.isValid());
QCOMPARE(defaultConfig.name(), QString("UserChoice"));
QCOMPARE(defaultConfig.children().count(), 0);
--- a/qtmobility/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -44,7 +44,7 @@
#include "qnetworkconfiguration.h"
#include "qnetworkconfigmanager.h"
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -65,7 +65,7 @@
void isRoamingAvailable();
private:
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -77,7 +77,7 @@
void tst_QNetworkConfiguration::initTestCase()
{
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -150,7 +150,7 @@
void tst_QNetworkConfiguration::cleanupTestCase()
{
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
iapconf->clear();
delete iapconf;
iapconf2->clear();
--- a/qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp Thu Apr 15 08:16:03 2010 +0300
@@ -42,17 +42,21 @@
#include <QtTest/QtTest>
#include <QLocalServer>
#include <QLocalSocket>
+#include <QTimer>
#include "../../qbearertestcommon.h"
#include <qnetworkconfigmanager.h>
#include <qnetworksession.h>
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
#include <stdio.h>
#include <iapconf.h>
#endif
QTM_USE_NAMESPACE
+// Can be used to configure tests that require manual attention (such as roaming)
+//#define QNETWORKSESSION_MANUAL_TESTS 1
+
Q_DECLARE_METATYPE(QNetworkConfiguration)
Q_DECLARE_METATYPE(QNetworkConfiguration::Type);
Q_DECLARE_METATYPE(QNetworkSession::State);
@@ -75,6 +79,9 @@
void repeatedOpenClose();
void roamingErrorCodes();
+
+ void sessionStop_data();
+ void sessionStop();
void sessionProperties_data();
void sessionProperties();
@@ -90,7 +97,7 @@
uint inProcessSessionManagementCount;
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -103,6 +110,7 @@
// Helper functions
bool openSession(QNetworkSession *session);
bool closeSession(QNetworkSession *session, bool lastSessionOnConfiguration = true);
+void updateConfigurations();
QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfiguration::Type configType);
void tst_QNetworkSession::initTestCase()
@@ -112,7 +120,7 @@
qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration");
qRegisterMetaType<QNetworkConfiguration::Type>("QNetworkConfiguration::Type");
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -198,7 +206,7 @@
"tests in inProcessSessionManagement()");
}
-#ifdef Q_WS_MAEMO_6
+#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
iapconf->clear();
delete iapconf;
iapconf2->clear();
@@ -223,13 +231,12 @@
void tst_QNetworkSession::invalidSession()
{
- // Verify that session created with invalid configuration remains in invalid state
+ // 1. Verify that session created with invalid configuration remains in invalid state
QNetworkSession session(QNetworkConfiguration(), 0);
QVERIFY(!session.isOpen());
QVERIFY(session.state() == QNetworkSession::Invalid);
- // Verify that opening session with invalid configuration both 1) emits invalidconfigurationerror
- // and 2) sets session's state as invalid.
+ // 2. Verify that opening session with invalid configuration both 1) emits invalidconfigurationerror and 2) sets session's state as invalid.
QSignalSpy errorSpy(&session, SIGNAL(error(QNetworkSession::SessionError)));
session.open();
session.waitForOpened(1000); // Should bail out right away
@@ -239,24 +246,56 @@
QVERIFY(error == QNetworkSession::InvalidConfigurationError);
QVERIFY(session.state() == QNetworkSession::Invalid);
- // Check same thing with a config from platform (there are subtle differences
- // because emtpy configuration does not have private pointer). Test with config
- // in '(un)defined' state
- QList<QNetworkConfiguration> allConfigs = manager.allConfigurations();
- foreach(QNetworkConfiguration config, allConfigs) {
- if ((config.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) {
- QNetworkSession session2(config);
- QSignalSpy errorSpy2(&session2, SIGNAL(error(QNetworkSession::SessionError)));
- session2.open();
- session2.waitForOpened(1000); // Should bail out right away
- QVERIFY(errorSpy2.count() == 1);
- QNetworkSession::SessionError error2 =
- qvariant_cast<QNetworkSession::SessionError> (errorSpy2.first().at(0));
- QVERIFY(error2 == QNetworkSession::InvalidConfigurationError);
- QVERIFY(session2.state() == QNetworkSession::Invalid);
- break; // Once is enough
- }
+#ifdef QNETWORKSESSION_MANUAL_TESTS
+ QNetworkConfiguration definedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint);
+ if (definedConfig.isValid()) {
+ // 3. Verify that opening a session with defined configuration emits error and enters notavailable-state
+ // TODO these timer waits should be changed to waiting appropriate signals, now these wait excessively
+ qDebug() << "Shutdown WLAN IAP (waiting 60 seconds): " << definedConfig.name();
+ QTest::qWait(60000);
+ // Shutting down WLAN should bring back to defined -state.
+ QVERIFY((definedConfig.state() & QNetworkConfiguration::Defined) == QNetworkConfiguration::Defined);
+ QNetworkSession definedSession(definedConfig);
+ QSignalSpy errorSpy(&definedSession, SIGNAL(error(QNetworkSession::SessionError)));
+ QNetworkSession::SessionError sessionError;
+
+ definedSession.open();
+
+ QVERIFY(definedConfig.isValid()); // Session remains valid
+ QVERIFY(definedSession.state() == QNetworkSession::NotAvailable); // State is not available because WLAN is not in coverage
+ QVERIFY(!errorSpy.isEmpty()); // Session tells with error about invalidated configuration
+ sessionError = qvariant_cast<QNetworkSession::SessionError> (errorSpy.first().at(0));
+ qDebug() << "Error code is: " << sessionError;
+ QVERIFY(sessionError == QNetworkSession::InvalidConfigurationError);
+
+ qDebug() << "Turn the WLAN IAP back on (waiting 60 seconds): " << definedConfig.name();
+ QTest::qWait(60000);
+ updateConfigurations();
+
+ QVERIFY(definedConfig.state() == QNetworkConfiguration::Discovered);
}
+
+ QNetworkConfiguration invalidatedConfig = suitableConfiguration("WLAN",QNetworkConfiguration::InternetAccessPoint);
+ if (invalidatedConfig.isValid()) {
+ // 4. Verify that invalidating a session after its successfully configured works
+ QNetworkSession invalidatedSession(invalidatedConfig);
+ QSignalSpy errorSpy(&invalidatedSession, SIGNAL(error(QNetworkSession::SessionError)));
+ QNetworkSession::SessionError sessionError;
+
+ qDebug() << "Delete the WLAN IAP from phone now (waiting 60 seconds): " << invalidatedConfig.name();
+ QTest::qWait(60000);
+
+ invalidatedSession.open();
+ QVERIFY(!invalidatedConfig.isValid());
+ QVERIFY(invalidatedSession.state() == QNetworkSession::Invalid);
+ QVERIFY(!errorSpy.isEmpty());
+
+ sessionError = qvariant_cast<QNetworkSession::SessionError> (errorSpy.first().at(0));
+ QVERIFY(sessionError == QNetworkSession::InvalidConfigurationError);
+ qDebug() << "Add the WLAN IAP back (waiting 60 seconds): " << invalidatedConfig.name();
+ QTest::qWait(60000);
+ }
+#endif
}
void tst_QNetworkSession::sessionProperties_data()
@@ -372,7 +411,6 @@
}
void tst_QNetworkSession::roamingErrorCodes() {
-
#ifndef Q_OS_SYMBIAN
QSKIP("Roaming supported on Symbian.", SkipAll);
#else
@@ -400,8 +438,9 @@
QVERIFY(iapSession.state() == QNetworkSession::Disconnected);
QVERIFY(adminIapSession.state() == QNetworkSession::Disconnected);
#endif // Q_OS_SYMBIAN
- /*
- // Check for roaming error. Challenging to automate, therefore commented out.
+
+#ifdef QNETWORKSESSION_MANUAL_TESTS
+ // Check for roaming error.
// Case requires that you have controllable WLAN in Internet SNAP (only).
QNetworkConfiguration snapConfig = suitableConfiguration("bearer_not_relevant_with_snaps", QNetworkConfiguration::ServiceNetwork);
if (!snapConfig.isValid()) {
@@ -429,7 +468,144 @@
error = qvariant_cast<QNetworkSession::SessionError>(errorSpy2.first().at(0));
QVERIFY(error == QNetworkSession::SessionAbortedError);
QVERIFY(iapSession2.state() == QNetworkSession::Disconnected);
- */
+#endif
+}
+
+
+void tst_QNetworkSession::sessionStop_data() {
+ QTest::addColumn<QString>("bearerType");
+ QTest::addColumn<QNetworkConfiguration::Type>("configurationType");
+
+ QTest::newRow("SNAP") << "bearer_type_not_relevant_with_SNAPs" << QNetworkConfiguration::ServiceNetwork;
+ QTest::newRow("WLAN_IAP") << "WLAN" << QNetworkConfiguration::InternetAccessPoint;
+ QTest::newRow("Cellular_IAP") << "cellular" << QNetworkConfiguration::InternetAccessPoint;
+}
+
+void tst_QNetworkSession::sessionStop()
+{
+#ifndef Q_OS_SYMBIAN
+ QSKIP("Testcase contains mainly Symbian specific checks, because it is only platform to really support interface (IAP-level) Stop.", SkipAll);
+#endif
+ QFETCH(QString, bearerType);
+ QFETCH(QNetworkConfiguration::Type, configurationType);
+
+ int configWaitdelayInMs = 2000;
+
+ QNetworkConfiguration config = suitableConfiguration(bearerType, configurationType);
+ if (!config.isValid()) {
+ QSKIP("No suitable configurations, skipping this round of session stop test.", SkipSingle);
+ }
+ qDebug() << "Using following configuration to open and stop a session: " << config.name();
+
+ QNetworkSession openedSession(config);
+ QNetworkSession closedSession(config);
+ QNetworkSession innocentSession(config);
+ QNetworkConfigurationManager mgr;
+
+ QSignalSpy closedSessionOpenedSpy(&closedSession, SIGNAL(opened()));
+ QSignalSpy closedSessionClosedSpy(&closedSession, SIGNAL(closed()));
+ QSignalSpy closedSessionStateChangedSpy(&closedSession, SIGNAL(stateChanged(QNetworkSession::State)));
+ QSignalSpy closedErrorSpy(&closedSession, SIGNAL(error(QNetworkSession::SessionError)));
+
+ QSignalSpy innocentSessionClosedSpy(&innocentSession, SIGNAL(closed()));
+ QSignalSpy innocentSessionStateChangedSpy(&innocentSession, SIGNAL(stateChanged(QNetworkSession::State)));
+ QSignalSpy innocentErrorSpy(&innocentSession, SIGNAL(error(QNetworkSession::SessionError)));
+ QNetworkSession::SessionError sessionError;
+
+ // 1. Verify that stopping an opened session works (the simplest usecase).
+ qDebug("----------1. Verify that stopping an opened session works (the simplest usecase)");
+ QSignalSpy configChangeSpy(&mgr, SIGNAL(configurationChanged(QNetworkConfiguration)));
+ QVERIFY(openSession(&openedSession));
+ qDebug("Waiting for %d ms to get all configurationChange signals from platform.", configWaitdelayInMs);
+ // Clear signals caused by opening
+ closedSessionOpenedSpy.clear();
+ closedSessionClosedSpy.clear();
+ closedSessionStateChangedSpy.clear();
+ closedErrorSpy.clear();
+ openedSession.stop();
+
+ QVERIFY(openedSession.state() == QNetworkSession::Disconnected);
+ QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals
+ QVERIFY(config.state() != QNetworkConfiguration::Active);
+
+ // 2. Verify that stopping a session based on non-connected configuration does nothing
+ qDebug("----------2. Verify that stopping a session based on non-connected configuration does nothing");
+ QNetworkSession::State closedSessionOriginalState = closedSession.state();
+ // Clear all possible signals
+ configChangeSpy.clear();
+ closedSessionOpenedSpy.clear();
+ closedSessionClosedSpy.clear();
+ closedSessionStateChangedSpy.clear();
+ closedErrorSpy.clear();
+
+ closedSession.stop();
+ qDebug("Waiting for %d ms to get all configurationChange signals from platform.", configWaitdelayInMs);
+ QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals
+
+ QVERIFY(closedSessionOpenedSpy.isEmpty());
+ QVERIFY(closedSessionClosedSpy.isEmpty());
+ QVERIFY(closedSessionStateChangedSpy.isEmpty());
+ QVERIFY(closedErrorSpy.isEmpty());
+ QVERIFY(closedSession.state() == closedSessionOriginalState); // State remains
+
+ // 3. Check that stopping a opened session affects also other opened session based on the same configuration.
+ if (config.type() == QNetworkConfiguration::InternetAccessPoint) {
+ qDebug("----------3. Check that stopping a opened session affects also other opened session based on the same configuration.");
+ QVERIFY(openSession(&openedSession));
+ QVERIFY(openSession(&innocentSession));
+
+ configChangeSpy.clear();
+ innocentSessionClosedSpy.clear();
+ innocentSessionStateChangedSpy.clear();
+ innocentErrorSpy.clear();
+
+ openedSession.stop();
+ qDebug("Waiting for %d ms to get all configurationChange signals from platform.", configWaitdelayInMs);
+ QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals
+
+ QVERIFY(!innocentSessionClosedSpy.isEmpty());
+ QVERIFY(!innocentSessionStateChangedSpy.isEmpty());
+ QVERIFY(!innocentErrorSpy.isEmpty());
+ QVERIFY(innocentSession.state() == QNetworkSession::Disconnected);
+ QVERIFY(openedSession.state() == QNetworkSession::Disconnected);
+ sessionError = qvariant_cast<QNetworkSession::SessionError>(innocentErrorSpy.first().at(0));
+ QVERIFY(sessionError == QNetworkSession::SessionAbortedError);
+
+ innocentSessionClosedSpy.clear();
+ innocentSessionStateChangedSpy.clear();
+ innocentErrorSpy.clear();
+ } else {
+ qDebug("----------3. Skip for SNAP configuration.");
+ }
+ // 4. Check that stopping a non-opened session stops the other session based on the
+ // same configuration if configuration is IAP. Stopping closed SNAP session has no impact on other opened SNAP session.
+ if (config.type() == QNetworkConfiguration::ServiceNetwork) {
+ qDebug("----------4. Skip for SNAP configuration.");
+ } else if (config.type() == QNetworkConfiguration::InternetAccessPoint) {
+ qDebug("----------4. Check that stopping a non-opened session stops the other session based on the same configuration");
+ QVERIFY(openSession(&innocentSession));
+ qDebug("Waiting for %d ms after open to make sure all platform indications are propagated", configWaitdelayInMs);
+ QTest::qWait(configWaitdelayInMs);
+ closedSession.stop();
+ qDebug("Waiting for %d ms to get all configurationChange signals from platform..", configWaitdelayInMs);
+ QTest::qWait(configWaitdelayInMs); // Wait to get all relevant configurationChange() signals
+
+ QVERIFY(!innocentSessionClosedSpy.isEmpty());
+ QVERIFY(!innocentSessionStateChangedSpy.isEmpty());
+ QVERIFY(!innocentErrorSpy.isEmpty());
+ QVERIFY(innocentSession.state() == QNetworkSession::Disconnected);
+ QVERIFY(closedSession.state() == QNetworkSession::Disconnected);
+ sessionError = qvariant_cast<QNetworkSession::SessionError>(innocentErrorSpy.first().at(0));
+ QVERIFY(sessionError == QNetworkSession::SessionAbortedError);
+ QVERIFY(config.state() == QNetworkConfiguration::Discovered);
+ }
+
+ // 5. Sanity check that stopping invalid session does not crash
+ qDebug("----------5. Sanity check that stopping invalid session does not crash");
+ QNetworkSession invalidSession(QNetworkConfiguration(), 0);
+ QVERIFY(invalidSession.state() == QNetworkSession::Invalid);
+ invalidSession.stop();
+ QVERIFY(invalidSession.state() == QNetworkSession::Invalid);
}
void tst_QNetworkSession::userChoiceSession_data()
@@ -1042,6 +1218,7 @@
// Ignores configurations in other than 'discovered' -state. Returns invalid (QNetworkConfiguration())
// if none found.
QNetworkConfiguration suitableConfiguration(QString bearerType, QNetworkConfiguration::Type configType) {
+
// Refresh configurations and derive configurations matching given parameters.
QNetworkConfigurationManager mgr;
QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted()));
@@ -1082,6 +1259,15 @@
}
}
+// A convinience-function: updates configurations and waits that they are updated.
+void updateConfigurations()
+{
+ QNetworkConfigurationManager mgr;
+ QSignalSpy updateSpy(&mgr, SIGNAL(updateCompleted()));
+ mgr.updateConfigurations();
+ QTRY_NOOP(updateSpy.count() == 1);
+}
+
// A convinience function for test-cases: opens the given configuration and return
// true if it was done gracefully.
bool openSession(QNetworkSession *session) {
@@ -1181,16 +1367,13 @@
return false;
}
if (lastSessionOnConfiguration &&
- session->configuration().state() != QNetworkConfiguration::Discovered) {
- qDebug("tst_QNetworkSession::closeSession() failure: session's configuration is not back in 'Discovered' -state.");
+ session->configuration().state() == QNetworkConfiguration::Active) {
+ qDebug("tst_QNetworkSession::closeSession() failure: session's configuration is still in active state.");
return false;
}
return true;
}
-
-
QTEST_MAIN(tst_QNetworkSession)
#include "tst_qnetworksession.moc"
-
--- a/qtmobility/tests/rom/qtmobilitytests.iby Thu Apr 01 08:30:34 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published by
-* the Free Software Foundation, version 2.1 of the License.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program. If not,
-* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
-*
-* Description:
-*
-*/
-
-#ifndef __QT_MOBILITYTESTS_IBY__
-#define __QT_MOBILITYTESTS_IBY__
-
-#include <bldvariant.hrh>
-
-#define UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc
-
-S60_APP_EXE(bearerex)
-S60_APP_RESOURCE(bearerex)
-UPGRADABLE_APP_REG_RSC(bearerex)
-
-#endif //__QT_MOBILITYTESTS_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtmobility/tests/s60installs/qtmobilitytests.iby Thu Apr 15 08:16:03 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
+*
+* Description:
+*
+*/
+
+#ifndef __QT_MOBILITYTESTS_IBY__
+#define __QT_MOBILITYTESTS_IBY__
+
+#include <bldvariant.hrh>
+
+#define UPGRADABLE_APP_REG_RSC(NAME) data=DATAZ_\PRIVATE\10003A3F\IMPORT\APPS\ ## NAME ## _reg.rsc Private\10003a3f\import\apps\ ## NAME ## _reg.rsc
+
+S60_APP_EXE(bearerex)
+S60_APP_RESOURCE(bearerex)
+UPGRADABLE_APP_REG_RSC(bearerex)
+
+#endif //__QT_MOBILITYTESTS_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qtmobility/tests/s60installs/s60installs.pro Thu Apr 15 08:16:03 2010 +0300
@@ -0,0 +1,7 @@
+!symbian:error(This test is for Symbian packaging purposes only.)
+
+TEMPLATE = subdirs
+
+include(../../staticconfig.pri)
+
+#BLD_INF_RULES.prj_exports += "./qtmobilitytests.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(qtmobilitytests.iby)"
--- a/qtmobility/tests/tests.pro Thu Apr 01 08:30:34 2010 +0300
+++ b/qtmobility/tests/tests.pro Thu Apr 15 08:16:03 2010 +0300
@@ -10,4 +10,6 @@
symbian:SUBDIRS += bearerex
}
-#BLD_INF_RULES.prj_exports += "./rom/qtmobilitytests.iby $$CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH(qtmobilitytests.iby)"
+symbian {
+ SUBDIRS += s60installs/s60installs.pro
+}