Revision: 201017 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 11 May 2010 16:14:15 +0300
branchRCL_3
changeset 11 454d022d514b
parent 9 404ad6c9bc20
child 12 aefcba28a3e0
child 13 822c625f7adc
Revision: 201017 Kit: 201019
creator/inc/creator_accesspoint.h
creator/inc/creator_browser.h
creator/inc/creator_phonebook.h
creator/src/creator_accesspoint.cpp
creator/src/creator_browser.cpp
creator/src/creator_factory.cpp
creator/src/creator_phonebook.cpp
creator/src/creator_wepsecuritysettings.cpp
htiui/HtiAdminQt/HtiAdmin.pro
htiui/HtiAdminQt/chtiadminengine.cpp
htiui/HtiAdminQt/chtiadminengine.h
htiui/HtiAdminQt/htienginewrapper.cpp
htiui/HtiAdminQt/htienginewrapper.h
htiui/HtiAdminQt/main.cpp
htiui/HtiAdminQt/mainview.cpp
htiui/HtiAdminQt/mainview.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommInterfaceu.def
htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommServeru.def
htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtSerialComHelperu.def
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialClient.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialEngine.pan
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/HtiBtEngineLogging.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/SocketObserver.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/btservicesearcher.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/btservicesearcher.pan
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/messageprotocolconstants.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/messageservicesearcher.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/sdpattributenotifier.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/sdpattributeparser.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/sdpattributeparser.pan
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/socketsreader.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/socketswriter.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/staticarrayc.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/staticarrayc.inl
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/timeoutnotifier.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/timeouttimer.h
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/BtSerialClient.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/btservicesearcher.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/messageservicesearcher.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/sdpattributeparser.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/socketsreader.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/socketswriter.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/timeouttimer.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/data/200212CB.rss
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/inc/HtiBtCommEcomPlugin.h
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/src/HtiBtCommEcomPlugin.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/src/proxy.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtClientServerCommon.h
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommInterface.h
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommServer.h
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommServerSession.h
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/Logger.h
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/HtiBtCommInterface.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/HtiBtCommServer.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/HtiBtCommServerSession.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/Logger.cpp
htiui/HtiCommPlugins/HtiBtCommPlugin/eabi/HtiBtCommInterfaceu.def
htiui/HtiCommPlugins/HtiBtCommPlugin/eabi/HtiBtCommServeru.def
htiui/HtiCommPlugins/HtiBtCommPlugin/eabi/HtiBtSerialComHelperu.def
htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtComm.cfg
htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtCommEcomPlugin.mmp
htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtCommInterface.mmp
htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtCommServer.mmp
htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtSerialComHelper.mmp
htiui/HtiCommPlugins/HtiBtCommPlugin/group/bld.inf
htiui/HtiDeviceReboot/group/HtiDeviceReboot.mmp
htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp
htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp
htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/HtiKeyEventServicePlugin.mmp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/HtiKeyEventServicePlugin.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/KeyEventHandler.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEvent.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEventHandler.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/PointerEventHandler.h
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/HtiKeyEventServicePlugin.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEvent.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEventHandler.cpp
htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/PointerEventHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/HtiMessagesServicePlugin.mmp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiIAPHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMailboxHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMessagesServicePlugin.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMsgSettingsHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/MessageMgmntHandler.h
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiIAPHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMailboxHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMessagesServicePlugin.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMsgSettingsHandler.cpp
htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/MessageMgmntHandler.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiPIMServicePlugin.mmp
htiui/HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiPIMServicePlugin.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiSimDirHandler.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiSimDirHandlerVPbk.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/PIMHandler.h
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiPIMServicePlugin.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiSimDirHandler.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiSimDirHandlerVPbk.cpp
htiui/HtiServicePlugins/HtiPIMServicePlugin/src/PIMHandler.cpp
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/HtiScreenshotServicePlugin.mmp
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiScreenshotServicePlugin.h
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiScreenshotServicePlugin.cpp
htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiTextRcg.cpp
htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp
htiui/group/bld.inf
htiui/htiui.pro
htiui/rom/htiui_10_1.iby
htiui/sis/HTI_S60-10_1.pkg
htiui/sis/HTI_S60-52.pkg
htiui/sis/HTI_S60_Upgrade-10_1.pkg
htiui/sis/HTI_S60_Upgrade-52.pkg
htiui/sis/HTI_stub.pkg
launcher/inc/launcherappui.h
launcher/inc/launcherdocument.h
launcher/inc/launcherengine.h
launcher/inc/launcherviewapps.h
launcher/inc/launcherviewoutput.h
launcher/src/launcher.cpp
launcher/src/launcherapplication.cpp
launcher/src/launcherappui.cpp
launcher/src/launchercontainerapps.cpp
launcher/src/launchercontaineroutput.cpp
launcher/src/launcherdocument.cpp
launcher/src/launcherengine.cpp
launcher/src/launcherviewapps.cpp
launcher/src/launcherviewoutput.cpp
loadgen/inc/loadgen_appui.h
loadgen/inc/loadgen_document.h
loadgen/inc/loadgen_editors.h
loadgen/inc/loadgen_netconn.h
loadgen/inc/loadgen_photocapture.h
loadgen/inc/loadgen_settingsviewdlg.h
loadgen/src/loadgen_applications.cpp
loadgen/src/loadgen_appui.cpp
loadgen/src/loadgen_bluetooth.cpp
loadgen/src/loadgen_editors.cpp
loadgen/src/loadgen_maincontainer.cpp
loadgen/src/loadgen_mainview.cpp
loadgen/src/loadgen_messages.cpp
loadgen/src/loadgen_model.cpp
loadgen/src/loadgen_photocapture.cpp
loadgen/src/loadgen_settingsviewdlg.cpp
stifui/avkon/group/ReleaseNote.txt
stifui/avkon/sis/Stifui_31.sis
stifui/avkon/stifui/inc/Container.h
stifui/avkon/stifui/inc/version.h
stifui/avkon/stifui/src/Container.cpp
stifui/avkon/stifui/src/StartCasesView.cpp
stifui/avkon/uitestserverstarter/src/AknUiEnvProxy.cpp
stifui/qt/ReleaseNote.txt
--- a/creator/inc/creator_accesspoint.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/inc/creator_accesspoint.h	Tue May 11 16:14:15 2010 +0300
@@ -27,11 +27,11 @@
 
 #include <e32base.h>
 #include <commdb.h>
-#include <apselect.h>
-#include <apdatahandler.h>
-#include <apaccesspointitem.h>
-#include <aputils.h>
-#include <apengineconsts.h>
+#include <ApSelect.h>
+#include <ApDataHandler.h>
+#include <ApAccessPointItem.h>
+#include <ApUtils.h>
+#include <ApEngineConsts.h>
 #include <msvapi.h>
 #include <mtclreg.h>
 #include <mmsclient.h>
--- a/creator/inc/creator_browser.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/inc/creator_browser.h	Tue May 11 16:14:15 2010 +0300
@@ -25,9 +25,9 @@
 #include "creator_modulebase.h"
 
 #include <e32base.h>
-#include <FavouritesItem.h>
-#include <FavouritesDb.h>
-#include <FavouritesFile.h>
+#include <favouritesitem.h>
+#include <favouritesdb.h>
+#include <favouritesfile.h>
 
 
 
--- a/creator/inc/creator_phonebook.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/inc/creator_phonebook.h	Tue May 11 16:14:15 2010 +0300
@@ -31,11 +31,11 @@
 #include <cntitem.h>
 #include <cntfldst.h>
 #include <cntview.h>
-#include <cpbkcontactengine.h>
-#include <cpbkcontactitem.h> 
-#include <cpbkfieldinfo.h> 
-#include <cpbkfieldsinfo.h> 
-#include <pbkfields.hrh>
+#include <CPbkContactEngine.h>
+#include <CPbkContactItem.h> 
+#include <CPbkFieldInfo.h> 
+#include <CPbkFieldsInfo.h> 
+#include <PbkFields.hrh>
 
 
 
--- a/creator/src/creator_accesspoint.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/src/creator_accesspoint.cpp	Tue May 11 16:14:15 2010 +0300
@@ -19,8 +19,8 @@
 
 #include "creator_accesspoint.h" 
 #include "creator_traces.h"
-#include <aplistitemlist.h>
-#include <aplistitem.h> 
+#include <ApListItemList.h>
+#include <ApListItem.h> 
 
 static const TInt KAccessPointsFieldLength = 128;
 
--- a/creator/src/creator_browser.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/src/creator_browser.cpp	Tue May 11 16:14:15 2010 +0300
@@ -20,7 +20,7 @@
 #include "creator_browser.h" 
 #include "creator_traces.h"
 
-#include <FavouritesWapAp.h> 
+#include <favouriteswapap.h> 
 
 
 static const TInt KBrowserFieldLength = 128;
--- a/creator/src/creator_factory.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/src/creator_factory.cpp	Tue May 11 16:14:15 2010 +0300
@@ -20,7 +20,7 @@
 
 #if( defined __SERIES60_30__ || defined __SERIES60_31__ )
     #include "creator_phonebook.h"
-    #include "creator_accessPoint.h"
+    #include "creator_accesspoint.h"
 #else
     #include "creator_virtualphonebook.h"
     #include "creator_connectionmethod.h"
--- a/creator/src/creator_phonebook.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/src/creator_phonebook.cpp	Tue May 11 16:14:15 2010 +0300
@@ -20,7 +20,7 @@
 #include "creator_phonebook.h" 
 #include "creator_traces.h"
 
-#include <cpbkcontactiter.h>
+#include <CPbkContactIter.h>
 
 //----------------------------------------------------------------------------
 
--- a/creator/src/creator_wepsecuritysettings.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/creator/src/creator_wepsecuritysettings.cpp	Tue May 11 16:14:15 2010 +0300
@@ -20,7 +20,7 @@
 #include "creator_wepsecuritysettings.h"
 #include <commdb.h>
 //#include <featmgr.h>
-#include <wlancdbcols.h>
+#include <WlanCdbCols.h>
 
 //#include <commsdattypesv1_1.h>
 //#include <cmmanagertablefields.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/HtiAdmin.pro	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,33 @@
+TEMPLATE = app
+TARGET = HtiAdmin
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += . /epoc32/include/mw/hb/hbcore /epoc32/include/mw/hb/hbwidgets /epoc32/include/mw/hb/hbtools
+LIBS += -lhbcore -lhbwidgets
+
+HEADERS += mainview.h 
+SOURCES += main.cpp mainview.cpp 
+
+symbian: { 
+    
+	LIBS += -lestor -lws32 -lPlatformEnv -limageconversion -leikcore -lfbscli -lapgrfx -lcommonengine -lgdi -lhticfg -lbafl -lecom -lcommdb
+	
+
+    HEADERS += htienginewrapper.h chtiadminengine.h 
+    SOURCES += htienginewrapper.cpp chtiadminengine.cpp 
+    RSS_RULES += "group_name = \"RnD Tools\"";
+    TARGET.CAPABILITY = ALL -TCB
+    TARGET.UID2 = 0x100039CE
+    
+    TARGET.UID3 = 0x1020DEB5
+    
+    
+    # TARGET.SID = 0x1020DEB5
+    TARGET.VID = 0x101FB657 
+        
+    # TARGET.EPOCHEAPSIZE = 0x020000 0x800000 // Min 128Kb, Max 16Mb
+    # TARGET.EPOCSTACKSIZE = 0x5000
+}else {
+    error("Only Symbian supported!")
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/chtiadminengine.cpp	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,905 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of HtiAdmin main.
+*
+*/
+
+#include <coecntrl.h>
+#include <w32std.h>
+#include <commdb.h>
+
+#include <HtiCfg.h>
+#include <HtiCommPluginInterface.h> // for KHTICommInterfaceUid
+
+
+#include "htienginewrapper.h"
+#include "chtiadminengine.h"
+
+
+#ifdef __ENABLE_LOGGING__
+
+#include <flogger.h>
+
+_LIT(KLogFolder, "hti");
+_LIT(KLogFile, "htiadmin.txt");
+#define HTI_LOG_TEXT(a1) {_LIT(temp, a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
+#define HTI_LOG_FORMAT(a1,a2) {_LIT(temp, a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, (a2));}
+#define HTI_LOG_DES(a1) {RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, (a1));}
+
+#else // __ENABLE_LOGGING__
+
+#define HTI_LOG_TEXT(a1)
+#define HTI_LOG_FORMAT(a1,a2)
+#define HTI_LOG_DES(a1)
+
+#endif // __ENABLE_LOGGING__
+
+// CONSTANTS
+_LIT( KHtiWatchDogMatchPattern, "HtiWatchDog*" );
+_LIT( KHtiFrameworkExe, "HtiFramework.exe" );
+_LIT( KHtiMatchPattern, "HtiFramework*" );
+_LIT( KHtiFrameworkCaption, "HTI status: " );
+_LIT( KHtiAutoStartCaption, "AutoStart: " );
+_LIT( KHtiVersionCaption, "Version: " );
+_LIT( KHtiSelectedCommCaption, "Communication: " );
+_LIT( KHtiAdminStartParameter, "admin" );
+_LIT( KHtiAdminVersionFormat, "%u.%u.%u (%uwk%02u)" );
+_LIT( KHtiAdminAboutVersionFormat, "Version %u.%u.%u - " );
+const static TInt KTerminateReason = 1;
+
+const TInt32 KHTIImplUidIsaComm   = {0x1020DEBD};
+const TInt32 KHTIImplUidSerial    = {0x10210CCA};
+const TInt32 KHTIImplUidBluetooth = {0x200212CC};
+const TInt32 KHTIImplUidIPComm    = {0x200212CE};
+const TInt32 KHTIImplUidUsbSerialComm = {0x200212D0};
+const TInt32 KHTIImplUidTraceComm = {0x200212D8};
+
+// configuration file constants
+_LIT( KCfgFilePath,         "\\");
+_LIT( KHtiCfg,              "hti.cfg" );
+_LIT( KHtiBtCommCfg,        "HTIBtComm.cfg" );
+_LIT( KHtiSerialCommCfg ,   "HTISerialComm.cfg" );
+_LIT( KHtiIPCommCfg,        "HTIIPComm.cfg" );
+// hti.cfg
+_LIT8( KCommPlugin,         "CommPlugin" );
+_LIT8( KPriority,           "Priority" );
+_LIT8( KShowConsole,        "ShowConsole" );
+_LIT8( KEnableHtiWatchDog,  "EnableHtiWatchDog" );
+_LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" );
+_LIT8( KShowErrorDialogs,   "ShowErrorDialogs" );
+// HtiBtComm.cfg
+_LIT8( KBtDeviceAddress,    "BtDeviceAddress" );
+_LIT8( KBtDeviceName,       "BtDeviceName" );
+// HtiSerialComm.cfg
+_LIT8( KCommPortNumber,     "CommPort" );
+// HTIIPComm.cfg
+_LIT8( KLocalPort,          "LocalPort" );
+_LIT8( KRemoteHost,         "RemoteHost" );
+_LIT8( KRemotePort,         "RemotePort" );
+_LIT8( KIAPName,            "IAPName");
+
+
+// ---------------------------------------------------------------------------
+
+CHtiAdminEngine::CHtiAdminEngine()
+{
+    iIAPsArray = NULL;
+}
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine* CHtiAdminEngine::NewLC(HtiEngineWrapper *aEngineWrapper)
+    {
+    CHtiAdminEngine* self = new (ELeave) CHtiAdminEngine();
+    CleanupStack::PushL(self);
+    self->ConstructL(aEngineWrapper);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine* CHtiAdminEngine::NewL(HtiEngineWrapper *aEngineWrapper)
+    {
+    CHtiAdminEngine* self = CHtiAdminEngine::NewLC(aEngineWrapper);
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ConstructL(HtiEngineWrapper *aEngineWrapper)
+    {
+    iEngineWrapper = aEngineWrapper;
+    iHtiCfg = CHtiCfg::NewL();
+    
+    CheckStatusesL();
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::CheckStatusesL()
+    {
+    UpdateConsoleStatus();
+    UpdateWatchDogStatus();
+    UpdateAutoStartStatus(); 
+    UpdateSelectedComm();
+    UpdateStatusL();
+    }
+
+
+// ---------------------------------------------------------------------------
+CHtiAdminEngine::~CHtiAdminEngine()
+{
+	KillTimer();	
+	delete iHtiCfg;
+	delete iPluginNameArray;	
+	delete iPluginDataTypeArray;	
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::StartHtiL()
+{
+
+	RProcess prs;
+	TInt err;
+	TBool isRunning = EFalse;
+	if ( OpenHtiProcess( prs ) )
+		{
+		if ( prs.ExitType() == EExitPending )
+			{
+			isRunning = ETrue;
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Running);
+			}
+		prs.Close();
+		}
+
+	if ( !isRunning )
+		{
+		HTI_LOG_TEXT( "create process" );
+		err = prs.Create( KHtiFrameworkExe, KHtiAdminStartParameter );
+		if ( err == KErrNone )
+			{
+			prs.Resume();
+			prs.Close();
+			UpdateStatusL();
+			HTI_LOG_TEXT("create done");
+			}
+		else
+			{
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+			HTI_LOG_TEXT("create error");
+			}
+		}
+
+}
+
+
+// ---------------------------------------------------------------------------
+
+void CHtiAdminEngine::StopHtiL()
+{
+	HTI_LOG_TEXT("Stop");
+
+	// kill the watchdog to prevent it from restarting HTI again
+	KillHtiWatchDogL();
+
+	RProcess prs;
+	if ( OpenHtiProcess( prs ) )
+		{
+		if ( prs.ExitType() == EExitPending )
+			{
+			HTI_LOG_TEXT("try to kill");
+			prs.Kill( KTerminateReason );
+			UpdateStatusL();
+			}
+		else
+			{
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+			}
+		prs.Close();
+		}
+
+}
+
+// ---------------------------------------------------------------------------
+
+void CHtiAdminEngine::EnableBtByAddressL(const TDesC& aAddress)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath,  KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+	
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aAddress);
+	iHtiCfg->SetParameterL( KBtDeviceAddress, value);
+
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg);
+	UpdateSelectedComm();
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableBtByNameL(const TDesC& aAddress)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aAddress);
+	iHtiCfg->SetParameterL( KBtDeviceName, value);
+	
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+	UpdateSelectedComm();
+}
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::BtSearchL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "BTSERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+	iHtiCfg->RemoveParameterL( KBtDeviceName );
+	iHtiCfg->RemoveParameterL( KBtDeviceAddress );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiBtCommCfg );
+	UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::IPListenL(const TDesC& aPort, const TDesC& aIAP)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8("IPCOMM"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+	
+	TBuf8<KMaxParameterValueLength> port;
+	port.Copy(aPort);
+	iHtiCfg->SetParameterL( KLocalPort, port);
+	
+	TBuf8<KMaxParameterValueLength> iap;
+	iap.Copy(aIAP);
+	iHtiCfg->SetParameterL(KIAPName, iap);
+
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiIPCommCfg );
+	UpdateSelectedComm();
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::IPConnectL(const TDesC& aHost, const TDesC& aPort, const TDesC& aIAP)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "IPCOMM" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+	iHtiCfg->RemoveParameterL( KLocalPort );
+
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aHost);
+	iHtiCfg->SetParameterL( KRemoteHost, value);
+	
+	TBuf8<KMaxParameterValueLength> port;
+    port.Copy(aPort);
+    iHtiCfg->SetParameterL(KRemotePort, port);
+
+    TBuf8<KMaxParameterValueLength> iap;
+    iap.Copy(aIAP);
+    iHtiCfg->SetParameterL(KIAPName, iap);
+
+    iHtiCfg->SaveCfgL(KCfgFilePath, KHtiIPCommCfg);
+    UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableSerialL(const TDesC& aComPortNumber)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KCommPlugin, _L8( "SERIAL" ) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+	
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aComPortNumber);
+	iHtiCfg->SetParameterL( KCommPortNumber, value );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiSerialCommCfg );
+	UpdateSelectedComm();
+}
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::EnableOtherCommL(const TDesC& aSelectedPluginName)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	
+	TInt namePosition;
+	iPluginNameArray->Find(aSelectedPluginName, namePosition);
+	
+	//Save correct data type for selected plugin
+	iHtiCfg->SetParameterL( KCommPlugin, iPluginDataTypeArray->MdcaPoint(namePosition) );
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+	UpdateSelectedComm();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityBackgroundL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("1"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityForegroundL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("2"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityHighL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("3"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetPriorityAbsoluteHighL()
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	iHtiCfg->SetParameterL( KPriority, _L8("4"));
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::AutoStartEnableL(TBool aEnableAutoStart)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+	if(aEnableAutoStart)
+		{
+		iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KEnableHtiAutoStart, _L8("0"));
+		}
+	
+	iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+	UpdateAutoStartStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::WatchDogEnableL(TBool aEnableWDog)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    
+	if(aEnableWDog)
+		{
+		iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KEnableHtiWatchDog, _L8("0"));
+		}
+    
+    iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+    UpdateWatchDogStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ConsoleEnableL(TBool aEnableConsole)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    
+	if(aEnableConsole)
+		{
+		iHtiCfg->SetParameterL( KShowConsole, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KShowConsole, _L8("0"));
+		}
+    
+    iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+    UpdateConsoleStatus();
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::ErrorDialogsEnableL(TBool aEnableErrorDialogs)
+{
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    
+	if(aEnableErrorDialogs)
+		{
+		iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("1"));
+		}
+	else
+		{
+		iHtiCfg->SetParameterL( KShowErrorDialogs, _L8("0"));
+		}
+    
+    iHtiCfg->SaveCfgL( KCfgFilePath, KHtiCfg );
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetHtiCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetBtCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiBtCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetSerialCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiSerialCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetIPCfgParamL(const TDesC& aParamName, const TDesC& aParamValue)
+{
+	SetCfgParamL(aParamName, aParamValue, KHtiIPCommCfg);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::SetCfgParamL(const TDesC& aParamName, const TDesC& aParamValue, const TDesC& aFileName)
+{
+	TBuf8<KMaxParameterNameLength> name;
+	name.Copy(aParamName);
+	
+	TBuf8<KMaxParameterValueLength> value;
+	value.Copy(aParamValue);
+	
+	TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, aFileName ) );
+	
+	iHtiCfg->SetParameterL( name, value );
+	iHtiCfg->SaveCfgL( KCfgFilePath, aFileName);
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetHtiCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetBtCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiBtCommCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetSerialCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiSerialCommCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetIPCfgParamL(const TDesC& aParamName, TDes& aParamValue)
+    {
+    GetCfgParamL(aParamName, aParamValue, KHtiIPCommCfg);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetCfgParamL(const TDesC& aParamName, TDes& aParamValue, const TDesC& aFileName)
+    {
+    TBuf8<KMaxParameterNameLength> name;
+    name.Copy(aParamName);
+    
+    TBuf<KMaxParameterValueLength> value;
+
+    TRAP_IGNORE( iHtiCfg->LoadCfgL( KCfgFilePath, aFileName ) );
+    aParamValue.Copy(iHtiCfg->GetParameterL(name));
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::GetSelectedComm(TDes& aPluginName)
+    {
+    TBuf8<KMaxParameterValueLength> commValue;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+        }
+    // Use default if not found from config
+    if ( commValue.Length() == 0 )
+        {
+        commValue.Copy(KCommDefaultImplementation  );        
+        }
+    TInt typePosition;
+    iPluginDataTypeArray->Find(commValue, typePosition);
+    aPluginName.Copy(iPluginNameArray->MdcaPoint(typePosition));
+    }
+
+// ---------------------------------------------------------------------------
+TBool CHtiAdminEngine::OpenHtiProcess( RProcess& aPrs )
+{
+    HTI_LOG_TEXT( "OpenHtiProcess" );
+
+	TFullName processName;
+	TInt err;
+
+	TFindProcess finder( KHtiMatchPattern );
+	err = finder.Next( processName );
+	if ( err == KErrNone )
+		{
+		HTI_LOG_TEXT( "try to open..." );
+		err = aPrs.Open( finder );
+		HTI_LOG_TEXT( "opened" );
+
+		if ( err == KErrNone )
+			{
+			HTI_LOG_TEXT( "OpenHtiProcess OK" );
+			return ETrue;
+			}
+		else
+			{
+			iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+			}
+		}
+	else if ( err == KErrNotFound )
+		{
+		iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+		}
+	else
+		{
+		iEngineWrapper->updateStatus(HtiEngineWrapper::Error);
+		}
+
+	HTI_LOG_TEXT( "OpenHtiProcess NOK" );
+
+	return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateStatusL()
+    {
+    HTI_LOG_TEXT( "UpdateStatusL" );
+    RProcess prs;
+    if ( OpenHtiProcess( prs ) )
+        {
+        HTI_LOG_TEXT( "Update display" );
+        TExitType exT = prs.ExitType();
+
+        switch ( exT )
+            {
+            case EExitPending:
+                {
+                iEngineWrapper->updateStatus(HtiEngineWrapper::Running);
+		
+                // start timer to watch the status
+                if ( !iPeriodic )
+                    {
+                    iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard );
+                    iPeriodic->Start( 5 * 1000 * 1000,
+                                      5 * 1000 * 1000,
+                                      TCallBack( TimerCallBackL, this ) );
+                    }
+                }
+                break;
+
+            case EExitKill:
+            case EExitTerminate:
+                {
+                iEngineWrapper->updateStatus(HtiEngineWrapper::Stopped);
+                KillTimer();
+                }
+                break;
+
+            case EExitPanic:
+                {
+                iEngineWrapper->updateStatus(HtiEngineWrapper::Panic);
+                KillTimer();
+                }
+                break;
+            };
+        prs.Close();
+        }
+    else
+        {
+        KillTimer();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::KillHtiWatchDogL()
+    {
+    TFullName processName;
+    TFindProcess finder( KHtiWatchDogMatchPattern );
+    TInt err = finder.Next( processName );
+    if ( err == KErrNone )
+        {
+        HTI_LOG_TEXT( "HTI watchdog process found. Trying to open and kill it..." );
+        RProcess prs;
+        User::LeaveIfError( prs.Open( finder ) );
+        prs.Kill( KTerminateReason );
+        prs.Close();
+        HTI_LOG_TEXT( "HTI watchdog killed" );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::KillTimer()
+    {
+    if ( iPeriodic )
+        {
+        iPeriodic->Cancel();
+        delete iPeriodic;
+        iPeriodic = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+TInt CHtiAdminEngine::TimerCallBackL( TAny* aPtr )
+    {
+    ( (CHtiAdminEngine*)aPtr )->UpdateStatusL();
+    return ETrue;
+    }
+
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateAutoStartStatus()
+    {
+    HTI_LOG_TEXT( "UpdateAutoStartStatus" );
+    TInt value = KErrNotFound;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiAutoStart) );
+        }
+
+    if ( value == KErrNotFound )
+        {
+        // Use default values if not found from config.
+#ifdef __WINS__
+        value = 0;
+#else
+        value = 1;
+#endif
+        }
+
+    if ( value == 0 )
+        {
+        iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartDisabled );
+        }
+    else if ( value == 1 )
+        {
+        iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartEnabled );
+        }
+    else
+        {
+        iEngineWrapper->updateAutostartStatus( HtiEngineWrapper::AutoStartUnknown );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateConsoleStatus()
+    {
+    HTI_LOG_TEXT( "UpdateConsoleStatus" );
+    TInt value = KErrNotFound;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if(!err)
+        {
+        TRAP( err, value = iHtiCfg->GetParameterIntL(KShowConsole) );
+        }
+    
+    if ( value == KErrNotFound )
+        {
+        value = 0;
+        }
+
+    iEngineWrapper->updateConsoleStatus(value);
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateWatchDogStatus()
+    {
+    HTI_LOG_TEXT( "UpdateWatchDogStatus" );
+    TInt value = KErrNotFound;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if(!err)
+        {
+        TRAP( err, value = iHtiCfg->GetParameterIntL(KEnableHtiWatchDog) );
+        }
+    
+    if ( value == KErrNotFound )
+        {
+        value = 0;
+        }
+
+    iEngineWrapper->updateWatchDogStatus(value);    
+    }
+
+// ---------------------------------------------------------------------------
+void CHtiAdminEngine::UpdateSelectedComm()
+    {
+    HTI_LOG_TEXT( "UpdateSelectedComm" );
+    TBuf<64> commPlugin;
+    TRAPD( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiCfg ) );
+    if ( !err )
+        {
+        TBuf8<KMaxParameterValueLength> commValue;
+        TRAP( err, commValue = iHtiCfg->GetParameterL( KCommPlugin ) );
+        if ( err == KErrNone )
+            {
+            commPlugin.Copy( commValue );
+            }
+        }
+    // Use default if not found from config
+    if ( commPlugin.Length() == 0 )
+        {
+        commPlugin.Copy(KCommDefaultImplementation  );        
+        }
+		iEngineWrapper->updateSelectedComm( commPlugin );
+
+    if ( commPlugin.Compare( _L( "SERIAL" ) ) == 0 )
+        {
+        TInt portNum = 0;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiSerialCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TRAP( err, portNum = iHtiCfg->GetParameterIntL( KCommPortNumber ) );
+            }
+        TBuf<16> portBuf;
+        portBuf.Copy( _L( "Port: " ) );
+        portBuf.AppendNum( portNum );
+        iEngineWrapper->updateCommDetails( portBuf );
+        }
+
+    else if ( commPlugin.Compare( _L( "BTSERIAL" ) ) == 0 )
+        {
+        TBuf<64> hostBuf;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiBtCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TBuf8<KMaxParameterValueLength> hostValue;
+            TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceAddress ) );
+            if ( err != KErrNone )
+                {
+                TRAP( err, hostValue = iHtiCfg->GetParameterL( KBtDeviceName ) );
+                }
+            if ( err == KErrNone )
+                {
+                hostBuf.Copy( hostValue );
+                }
+            }
+        if ( hostBuf.Length() > 0 )
+            {
+            hostBuf.Insert( 0, _L( "Host: " ) );
+            }
+        iEngineWrapper->updateCommDetails(hostBuf);
+        }
+
+    else if ( commPlugin.Compare( _L( "IPCOMM" ) ) == 0 )
+        {
+        TBuf<128> hostBuf;
+        TRAP( err, iHtiCfg->LoadCfgL( KCfgFilePath, KHtiIPCommCfg ) );
+        if ( err == KErrNone )
+            {
+            TInt localPort = 0;
+            TRAP( err, localPort = iHtiCfg->GetParameterIntL( KLocalPort ) );
+            if ( err == KErrNone && localPort > 0 )
+                {
+                hostBuf.Copy( _L( "Listen: " ) );
+                hostBuf.AppendNum( localPort );
+                }
+            else
+                {
+                TBuf8<KMaxParameterValueLength> remoteHost;
+                TInt remotePort = 0;
+                TRAP( err, remoteHost = iHtiCfg->GetParameterL( KRemoteHost ) );
+                if ( err == KErrNone )
+                    {
+                    TRAP( err, remotePort = iHtiCfg->GetParameterIntL(
+                            KRemotePort ) );
+                    }
+                if ( err == KErrNone )
+                    {
+                    hostBuf.Copy( remoteHost );
+                    hostBuf.Insert( 0, _L("Connect: " ) );
+                    hostBuf.Append( ':' );
+                    hostBuf.AppendNum( remotePort );
+                    }
+                else
+                    {
+                    hostBuf.Copy( _L( "Invalid config!" ) );
+                    }
+                }
+            }
+        iEngineWrapper->updateCommDetails(hostBuf);
+        }
+
+    else
+        {
+        iEngineWrapper->updateCommDetails(KNullDesC);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+void CleanupRArray( TAny* object )
+    {
+    ( ( RImplInfoPtrArray* ) object )->ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+CDesCArray* CHtiAdminEngine::SearchCommPluginsL()
+    {
+    const TInt pluginNameArrayGranularity (15);
+	iPluginNameArray = new (ELeave) CDesCArrayFlat(pluginNameArrayGranularity);
+	iPluginDataTypeArray = new (ELeave) CDesC8ArrayFlat(pluginNameArrayGranularity);
+			
+	RImplInfoPtrArray implInfoArray;
+	CleanupStack::PushL( TCleanupItem( CleanupRArray, &implInfoArray ) );
+	
+	REComSession::ListImplementationsL( KHTICommInterfaceUid, implInfoArray );
+
+	for ( TInt i = 0; i < implInfoArray.Count(); ++i )
+		{
+		iPluginNameArray->AppendL(implInfoArray[i]->DisplayName());
+		iPluginDataTypeArray->AppendL(implInfoArray[i]->DataType());
+		}
+    
+	CleanupStack::PopAndDestroy(); //implInfoArray
+		
+	return iPluginNameArray;
+    }
+
+// ---------------------------------------------------------------------------
+CDesCArray* CHtiAdminEngine::SearchIAPsL()
+    {
+    if(iIAPsArray)
+        {
+        return iIAPsArray;
+        }
+    
+    TBuf<KMaxParameterValueLength> name;
+    const TInt arrayGranularity (10);
+    iIAPsArray = new (ELeave) CDesCArrayFlat(arrayGranularity);
+
+    // Get IAP names from the database
+    CCommsDatabase* db = CCommsDatabase::NewL(EDatabaseTypeIAP);;
+    CleanupStack::PushL(db);
+    db->ShowHiddenRecords();
+    CCommsDbTableView* view = db->OpenTableLC(TPtrC(IAP));
+    TInt res = view->GotoFirstRecord();
+
+    while(res == KErrNone)
+        {
+        view->ReadTextL(TPtrC(COMMDB_NAME), name);
+        iIAPsArray->InsertL(0, name);
+        res = view->GotoNextRecord();
+        }
+
+    CleanupStack::PopAndDestroy(view); //view
+    CleanupStack::PopAndDestroy(db); //db   
+    
+    return iIAPsArray;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/chtiadminengine.h	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of HtiAdmin main.
+*
+*/
+
+#ifndef CHTIADMINENGINE_H
+#define CHTIADMINENGINE_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <BADESCA.H> 
+
+
+class HtiEngineWrapper;
+class CPeriodic;
+class CHtiCfg;
+
+
+class CHtiAdminEngine : public CBase
+	{
+	public:
+	
+	/**
+	 * Constructor
+	 */
+	CHtiAdminEngine();
+	
+	/**
+	 * Destructor
+	 */
+	~CHtiAdminEngine();
+	
+	/**
+	 * Two-phased constructor.
+	 */
+	static CHtiAdminEngine* NewL(HtiEngineWrapper *aEngineWrapper);
+
+	/**
+	 * Two-phased constructor.
+	 */
+	static CHtiAdminEngine* NewLC(HtiEngineWrapper *aEngineWrapper);
+	
+	void StartHtiL();
+	
+	void StopHtiL();
+	
+	void EnableBtByAddressL(const TDesC& aAddress);
+	
+	void EnableBtByNameL(const TDesC& aAddress);
+	
+	void BtSearchL();
+	
+	void IPListenL(const TDesC& aPort, const TDesC& aIAP);
+	
+	void IPConnectL(const TDesC& aHost, const TDesC& aPort, const TDesC& aIAP);
+	
+	void EnableSerialL(const TDesC& aComPortNumber);
+	
+	void EnableOtherCommL(const TDesC& aSelectedPluginName);
+	
+	void SetPriorityBackgroundL();
+	
+	void SetPriorityForegroundL();
+	
+	void SetPriorityHighL();
+	
+	void SetPriorityAbsoluteHighL();
+	
+	void AutoStartEnableL(TBool aEnableAutoStart);
+	
+	void ConsoleEnableL(TBool aEnableConsole);
+	
+	void ErrorDialogsEnableL(TBool aEnableErrorDialogs);
+	
+	void SetHtiCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetHtiCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void SetBtCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetBtCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void SetSerialCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetSerialCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void SetIPCfgParamL(const TDesC& aParamName, const TDesC& aParamValue);
+	void GetIPCfgParamL(const TDesC& aParamName, TDes& aParamValue);
+	
+	void GetSelectedComm(TDes& aPluginName);
+	
+	void CheckStatusesL();
+	
+	CDesCArray* SearchCommPluginsL();	
+	
+	CDesCArray* SearchIAPsL();
+	
+	void CHtiAdminEngine::WatchDogEnableL(TBool aEnableWDog);
+	
+	/**
+	* Kills the HtiWatchDog process if it is running.
+	*/
+	void KillHtiWatchDogL();
+
+	/**
+	* Stops the timer issuing the periodical HTI Framework process
+	* status checks.
+	*/
+	void KillTimer();
+
+	/**
+	* The method called by the periodic timer.
+	* @param aPtr pointer to this CHtiAdminAppUi instance
+	* @return zero if the callback function should not be called again,
+	* otherwise non-zero. Current implementation returns always ETrue.
+	*/
+	static TInt TimerCallBackL( TAny* aPtr );
+	
+	/**
+	* Tries to find the HTIFramework.exe process and open a handle to it.
+	* @param aPrs on return contains an open handle to the HTIFramework.exe
+	* process if process found and opened successfully
+	* @return ETrue if process found and opened successfully,
+	* otherwise EFalse
+	*/
+	TBool OpenHtiProcess( RProcess& aPrs );
+	
+	/**
+	* Updates the HTI Framework process status in the display.
+	*/
+	void UpdateStatusL();
+	
+	/**
+	* Updates the HTI auto start status in the display.
+	*/
+	void UpdateAutoStartStatus();
+	
+	
+	void UpdateConsoleStatus();
+	
+	void UpdateWatchDogStatus();
+	
+	/**
+	* Updates the selected communication in the display.
+	*/
+	void UpdateSelectedComm();
+
+	private:
+		void ConstructL(HtiEngineWrapper *aEngineWrapper);
+		
+		void SetCfgParamL(const TDesC& aParamName, const TDesC& aParamValue, const TDesC& aFileName);
+		void GetCfgParamL(const TDesC& aParamName, TDes& aParamValue, const TDesC& aFileName);
+		
+	private:
+		// Enginewrapper that is used for communicating between QT and Symbian
+		HtiEngineWrapper* iEngineWrapper;             
+		
+		// Timer triggering periodic checking of HTIFramework process status
+        CPeriodic*        iPeriodic;
+        
+        // For reading and writing HTI configuration files
+        CHtiCfg*          iHtiCfg;
+        
+        CDesCArrayFlat* iPluginNameArray;
+        
+        CDesC8ArrayFlat* iPluginDataTypeArray;
+
+        CDesCArrayFlat* iIAPsArray;
+	
+		
+	};
+
+#endif //CHTIADMINENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/htienginewrapper.cpp	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,563 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of HtiAdmin main.
+*
+*/
+
+
+#include "htienginewrapper.h"
+#include "chtiadminengine.h"
+
+#include <coecntrl.h>
+#include <QString>
+#include <QLocale.h>
+
+
+#include <HtiVersion.h>
+
+
+
+// ---------------------------------------------------------------------------
+
+HtiEngineWrapper::HtiEngineWrapper():
+	iEngine(0)
+{
+}
+// ---------------------------------------------------------------------------	
+HtiEngineWrapper::~HtiEngineWrapper()
+{
+	delete iEngine;
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::init()
+{
+    TRAPD(error, iEngine = CHtiAdminEngine::NewL(this));
+    
+    if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::startHti()
+{
+	TRAPD(error, iEngine->StartHtiL());
+	
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::stopHti()
+{
+	TRAPD(error, iEngine->StopHtiL());
+	
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableBtByAddress(QString& address)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedAddress(address.utf16());
+	
+	
+	TRAPD(error, iEngine->EnableBtByAddressL(convertedAddress));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::ipListen(QString& port, QString& iap)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedPort(port.utf16());
+	TBuf<64> convertedIAP(iap.utf16());
+	
+	TRAPD(error, iEngine->IPListenL(convertedPort, convertedIAP));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::ipConnect(QString& host, QString& port, QString& iap)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedHostAddress(host.utf16());
+	TBuf<64> convertedPort(port.utf16());
+	TBuf<64> convertedIAP(iap.utf16());
+		
+	TRAPD(error, iEngine->IPConnectL(convertedHostAddress, convertedPort, convertedIAP));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableBtByName(QString& address)
+	{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedAddress(address.utf16());
+	
+	
+	TRAPD(error, iEngine->EnableBtByNameL(convertedAddress));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::btSearch()
+	{
+	TRAPD(error, iEngine->BtSearchL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableSerial(QString& commPort)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedText(commPort.utf16());
+		
+	TRAPD(error, iEngine->EnableSerialL(convertedText));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+	
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::enableOtherComm(QString& pluginName)
+	{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedText(pluginName.utf16());
+	
+	TRAPD(error, iEngine->EnableOtherCommL(convertedText));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityBackground()
+	{
+	TRAPD(error, iEngine->SetPriorityBackgroundL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityForeground()
+	{
+	TRAPD(error, iEngine->SetPriorityForegroundL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityHigh()
+	{
+	TRAPD(error, iEngine->SetPriorityHighL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setPriorityAbsoluteHigh()
+	{
+	TRAPD(error, iEngine->SetPriorityAbsoluteHighL());
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::watchDogEnable(bool enable)
+	{
+	TRAPD(error, iEngine->WatchDogEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::autoStartEnable(bool enable)
+	{
+	TRAPD(error, iEngine->AutoStartEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::consoleEnable(bool enable)
+	{
+	TRAPD(error, iEngine->ConsoleEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::errorDialogsEnable(bool enable)
+	{
+	TRAPD(error, iEngine->ErrorDialogsEnableL(enable));
+		
+		if (error != KErrNone) {
+			return false;
+		}
+		else {
+			return true;
+		}
+	}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setHtiCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetHtiCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getHtiCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetHtiCfgParamL(convertedName, value));
+        
+    paramValue = QString((QChar*)value.Ptr(),value.Length());
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setBtCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetBtCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getBtCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetBtCfgParamL(convertedName, value));
+    paramValue = QString((QChar*)value.Ptr(),value.Length());    
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setSerialCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetSerialCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getSerialCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetSerialCfgParamL(convertedName, value));
+    paramValue = QString((QChar*)value.Ptr(),value.Length());
+    
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::setIPCfgParam(QString& paramName, QString& paramValue)
+{
+	// A conversion between a TBuf and QString is needed here.
+	TBuf<64> convertedName(paramName.utf16());
+	TBuf<64> convertedValue(paramValue.utf16());
+		
+	TRAPD(error, iEngine->SetIPCfgParamL(convertedName, convertedValue));
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getIPCfgParam(QString& paramName, QString& paramValue)
+{
+    // A conversion between a TBuf and QString is needed here.
+    TBuf<64> convertedName(paramName.utf16());
+    TBuf<64> value;
+        
+    TRAPD(error, iEngine->GetIPCfgParamL(convertedName, value));
+    paramValue = QString((QChar*)value.Ptr(),value.Length());    
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        return true;
+    }
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::getVersionIfo(QString& version)
+{
+	version= QString("%1.%2.%3 (%4 wk%5)")
+				.arg(KHtiVersionMajor).arg(KHtiVersionMinor).arg(KHtiVersionBuild)
+				.arg(KHtiVersionYear).arg(KHtiVersionWeek);
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::updateStatuses()
+{
+	TRAPD(error, iEngine->CheckStatusesL());
+	
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateStatus(HtiStatus status)
+{
+	emit statusChanged(status);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateSelectedComm(const TDesC& aText)
+{
+	iSelectedCommText = QString((QChar*)aText.Ptr(),aText.Length());
+
+	emit commSet(iSelectedCommText);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateCommDetails(const TDesC& aText)
+{
+	iCommDetailsText = QString((QChar*)aText.Ptr(),aText.Length());
+
+	emit commDetails(iCommDetailsText);
+}
+
+// ---------------------------------------------------------------------------
+void HtiEngineWrapper::updateAutostartStatus(AutoStartStatus status)
+{
+	emit autostartSet(status);
+}
+
+void HtiEngineWrapper::updateConsoleStatus(bool bEnabled)
+{
+    emit consoleSet(bEnabled);
+}
+
+void HtiEngineWrapper::updateWatchDogStatus(bool bEnabled)
+{
+    emit watchDogSet(bEnabled);
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::listCommPlugins()
+{
+	CDesCArray* pluginsArray = NULL;
+	
+	TRAPD(error, pluginsArray = iEngine->SearchCommPluginsL());
+		
+	if (error != KErrNone) {
+		return false;
+	}
+	else {
+		for(TInt i = 0; i < pluginsArray->Count(); ++i)
+			{
+			TPtrC16 plugin (pluginsArray->MdcaPoint(i));
+			int len = pluginsArray->MdcaPoint(i).Length();
+			
+			QString name ((QChar*)plugin.Ptr(), len);
+			iPluginNames << name;
+			}
+		
+		emit commPluginsRetrieved(iPluginNames);
+		
+		return true;
+	}
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::listIAPs(QStringList& list)
+{
+    CDesCArray* arrayIAPs = NULL;
+    
+    TRAPD(error, arrayIAPs = iEngine->SearchIAPsL());
+        
+    if (error != KErrNone) {
+        return false;
+    }
+    else {
+        for(TInt i = 0; i < arrayIAPs->Count(); ++i)
+            {
+            TPtrC16 iap (arrayIAPs->MdcaPoint(i));
+            int len = arrayIAPs->MdcaPoint(i).Length();
+            
+            QString name ((QChar*)iap.Ptr(), len);
+            list << name;
+            }
+        
+        return true;
+    }
+    return true;
+}
+
+// ---------------------------------------------------------------------------
+bool HtiEngineWrapper::getSelectedComm(QString& commName)
+{
+    TBuf<64> pluginName;
+    iEngine->GetSelectedComm(pluginName);
+    commName = QString((QChar*)pluginName.Ptr(), pluginName.Length());
+    return true;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/htienginewrapper.h	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of HtiAdmin main.
+*
+*/
+
+#ifndef HTIENGINEWRAPPER_H
+#define HTIENGINEWRAPPER_H
+
+#include <e32cmn.h>
+#include <qobject.h>
+#include <QStringList.h>
+
+class CHtiAdminEngine;
+class QString;
+
+
+
+
+/**
+ * class that is used for communicating between Symbian and Qt code.
+ */
+class HtiEngineWrapper : public QObject 
+	{
+	Q_OBJECT
+public:
+	enum AutoStartStatus{
+		AutoStartDisabled,
+		AutoStartEnabled,
+		AutoStartUnknown		
+	};
+	
+	enum HtiStatus{
+		Running,
+		Stopped,
+		Panic,
+		Error
+		};
+	
+	/**
+	 * Constructor
+	 */
+	HtiEngineWrapper();
+	
+	/**
+	 * Destructor
+	 */
+	~HtiEngineWrapper();
+	
+	
+	bool init();
+	bool stopHti();
+	bool startHti();
+	bool enableBtByAddress(QString& address);
+	bool enableBtByName(QString& address);
+	bool ipListen(QString& port, QString& iap);
+	bool ipConnect(QString& host, QString& port, QString& iap);
+	bool enableSerial(QString& commPort);
+	bool btSearch();
+	bool enableOtherComm(QString& pluginName);
+	bool setPriorityBackground();
+	bool setPriorityForeground();
+	bool setPriorityHigh();
+	bool setPriorityAbsoluteHigh();
+	bool watchDogEnable(bool enable);
+	bool autoStartEnable(bool enable);
+	bool consoleEnable(bool enable);
+	bool errorDialogsEnable(bool enable);
+	bool setHtiCfgParam(QString& paramName, QString& paramValue);
+	bool getHtiCfgParam(QString& paramName, QString& paramValue);
+	bool setBtCfgParam(QString& paramName, QString& paramValue);
+	bool getBtCfgParam(QString& paramName, QString& paramValue);
+	bool setSerialCfgParam(QString& paramName, QString& paramValue);
+	bool getSerialCfgParam(QString& paramName, QString& paramValue);
+	bool setIPCfgParam(QString& paramName, QString& paramValue);
+	bool getIPCfgParam(QString& paramName, QString& paramValue);
+	void getVersionIfo(QString& version);
+	bool updateStatuses();
+	bool listCommPlugins();
+	bool listIAPs(QStringList& list);
+	bool getSelectedComm(QString& commName);
+	
+	//Called from engine side
+	void updateStatus(HtiStatus status);
+	void updateSelectedComm(const TDesC& aText);
+	void updateAutostartStatus(AutoStartStatus status);
+	void updateConsoleStatus(bool bEnabled);
+	void updateWatchDogStatus(bool bEnabled);
+	void updateCommDetails(const TDesC& aText);
+	
+		
+
+signals:
+	void statusChanged(HtiEngineWrapper::HtiStatus status);	
+	void commSet(QString& statusText);
+	void commDetails(QString& statusText);
+	void commPluginsRetrieved(QStringList& pluginNames);
+	void autostartSet(HtiEngineWrapper::AutoStartStatus status);
+	void consoleSet(bool enabled);
+	void watchDogSet(bool enabled);
+	
+private:
+		CHtiAdminEngine* iEngine;
+		QString iSelectedCommText;
+		QString iCommDetailsText;
+		QStringList iPluginNames;
+		
+	};
+
+#endif //HTIENGINEWRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/main.cpp	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of HtiAdmin main.
+*
+*/
+
+#include <hbmainwindow.h>
+//#include <hbview.h>
+#include <coecntrl.h>
+#include <hbapplication.h>
+
+
+#include "mainview.h"
+#include "htienginewrapper.h"
+
+
+
+
+
+int main(int argc, char *argv[])
+{
+	// Initialization
+    HbApplication app(argc, argv);
+    
+    // Create HtiEngineWrapper
+    HtiEngineWrapper engineWrapper;
+    
+    if (!engineWrapper.init()) {
+            return EXIT_FAILURE;
+        }
+ 
+    // Main window widget. 
+    // Includes decorators such as signal strength and battery life indicator.
+    HbMainWindow mainWindow;
+
+    //Create main view
+	MainView* view = new MainView(mainWindow, engineWrapper);
+
+	//initialize main view
+	view->init(app);
+	
+	// Add View to main window and reveal it.
+	mainWindow.addView(view);
+
+    // Show widget
+    //mainWindow.show();
+    mainWindow.showFullScreen();
+
+    int result = app.exec();
+      
+    return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/mainview.cpp	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,554 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of HtiAdmin main.
+*
+*/
+
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hblabel.h>
+#include <HbInputDialog.h>
+#include <qgraphicslinearlayout.h>
+#include <HbListDialog.h>
+#include <hbmessagebox.h>
+
+
+
+#include "htienginewrapper.h"
+#include "mainview.h"
+#include "hbtoolbar.h"
+
+// ---------------------------------------------------------------------------
+
+MainView::MainView(HbMainWindow &mainWindow, HtiEngineWrapper& engineWrapper):
+    mMainWindow(mainWindow),
+    mEngineWrapper(engineWrapper)
+{
+}
+
+// ---------------------------------------------------------------------------
+
+MainView::~MainView()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::init(HbApplication &app)
+{
+    this->setTitle("Hti Admin");
+    createToolbar();
+    createMenu(app);
+    createTexts();
+    
+    mEngineWrapper.updateStatuses();
+    
+    QString version;
+    mEngineWrapper.getVersionIfo(version);
+    mEngineWrapper.listCommPlugins();
+    
+    mHtiVersionTxt->setPlainText("Hti Version: " + version);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::createMenu(HbApplication& app)
+{
+    
+    HbMenu* menu = new HbMenu();
+    
+    if (menu != NULL) {
+        
+        mActionExit = menu->addAction("Exit");
+        connect(mActionExit, SIGNAL(triggered()), &app, SLOT( quit() ) );
+
+        connect(mActionStartHti, SIGNAL(triggered()), this, SLOT( startHti() ) );
+        connect(mActionStopHti, SIGNAL(triggered()), this, SLOT( stopHti() ) );
+        
+        mActionSelectComm = menu->addAction("Select Communication");
+        connect(mActionSelectComm, SIGNAL(triggered()), this, SLOT( enableComm() ) );
+        
+        mActionSetPriority = menu->addAction("Set Priority");
+        connect(mActionSetPriority, SIGNAL(triggered()), this, SLOT( setPriority() ) );
+        
+        mActionEnableAuto = menu->addAction("Enable Auto Start");
+        connect(mActionEnableAuto, SIGNAL(triggered()), this, SLOT( enableAutoStart() ) );
+        
+        mActionDisableAuto = menu->addAction("Disable Auto Start");
+        connect(mActionDisableAuto, SIGNAL(triggered()), this, SLOT( disableAutoStart() ) );
+        
+        mActionEnableWdog = menu->addAction("Enable Watchdog");
+        connect(mActionEnableWdog, SIGNAL(triggered()), this, SLOT( enableWatchdog() ) );
+                
+        mActionDisableWdog = menu->addAction("Disable Watchdog");
+        connect(mActionDisableWdog, SIGNAL(triggered()), this, SLOT( disableWatchdog() ) );
+        
+        mActionEnableConsole = menu->addAction("Enable Console");
+        connect(mActionEnableConsole, SIGNAL(triggered()), this, SLOT( enableConsole() ) );
+                        
+		mActionDisableConsole = menu->addAction("Disable Console");
+		connect(mActionDisableConsole, SIGNAL(triggered()), this, SLOT( disableConsole() ) );
+		
+		mActionSetParameter = menu->addAction("Set Parameter");
+		connect(mActionSetParameter, SIGNAL(triggered()), this, SLOT( showParamList() ) );
+        
+        this->setMenu(menu);
+    }
+    
+    
+    connect(&mEngineWrapper, SIGNAL(statusChanged(HtiEngineWrapper::HtiStatus)), this, SLOT(htiStatusChanged(HtiEngineWrapper::HtiStatus)));
+    connect(&mEngineWrapper, SIGNAL(commSet(QString&)), this, SLOT(commStatusChanged(QString&)));
+    connect(&mEngineWrapper, SIGNAL(commDetails(QString&)), this, SLOT(commDetailsChanged(QString&)));
+    connect(&mEngineWrapper, SIGNAL(autostartSet(HtiEngineWrapper::AutoStartStatus)), this, SLOT(autostartStatusChanged(HtiEngineWrapper::AutoStartStatus)));
+    connect(&mEngineWrapper, SIGNAL(consoleSet(bool)), this, SLOT(consoleStatusChanged(bool)));
+    connect(&mEngineWrapper, SIGNAL(watchDogSet(bool)), this, SLOT(watchDogStatusChanged(bool)));
+    connect(&mEngineWrapper, SIGNAL(commPluginsRetrieved(QStringList&)), this, SLOT(updatePluginInfo(QStringList&)));
+    
+    
+}
+
+// ---------------------------------------------------------------------------
+void MainView::createTexts()
+{
+	QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical, this);
+	
+	mCommDetailsTxt = new HbLabel(this);
+	mHtiStatusTxt = new HbLabel(this);
+	mHtiVersionTxt = new HbLabel(this);
+	
+	mHtiAutoStartStatusTxt = new HbLabel(this);
+	mCommunicationTxt = new HbLabel(this);
+	
+	mHtiStatusTxt->setPlainText("Hti Status:");
+	mHtiVersionTxt->setPlainText("Hti Version:");
+	mHtiAutoStartStatusTxt->setPlainText("Auto Start:");
+	mCommunicationTxt->setPlainText("Communication ");
+		
+	layout->addItem(mHtiStatusTxt);
+	layout->addItem(mHtiVersionTxt);
+	layout->addItem(mHtiAutoStartStatusTxt);
+	layout->addItem(mCommunicationTxt);
+	layout->addItem(mCommDetailsTxt);
+
+	layout->setMaximumHeight(300);
+	this->setLayout(layout);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::htiStatusChanged(HtiEngineWrapper::HtiStatus newStatus)
+{
+	switch(newStatus)
+			{
+			case HtiEngineWrapper::Running:
+				mHtiStatusTxt->setPlainText("Hti Status: Running" );
+				break;
+			case HtiEngineWrapper::Stopped:
+				mHtiStatusTxt->setPlainText("Hti Status: Stopped" );
+				break;
+			case HtiEngineWrapper::Panic:
+				mHtiStatusTxt->setPlainText("Hti Status: Panic" );
+				break;
+			default:
+				mHtiStatusTxt->setPlainText("Hti Status: Error" );
+			}
+	
+	// Update menu items status
+	bool isRunning = (newStatus == HtiEngineWrapper::Running);
+    mActionStartHti->setEnabled(!isRunning);
+    mActionStopHti->setEnabled(isRunning);
+    mActionSelectComm->setEnabled(!isRunning);
+    mActionSetPriority->setEnabled(!isRunning);
+    mActionEnableAuto->setEnabled(!isRunning);
+    mActionDisableAuto->setEnabled(!isRunning);
+    mActionEnableWdog->setEnabled(!isRunning);
+    mActionDisableWdog->setEnabled(!isRunning);
+    mActionEnableConsole->setEnabled(!isRunning);
+    mActionDisableConsole->setEnabled(!isRunning);
+    mActionSetParameter->setEnabled(!isRunning);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::commStatusChanged(QString& newStatus)
+{
+	if (mCommunicationTxt) {
+		mCommunicationTxt->setPlainText("Communication: " + newStatus);
+	}
+}
+
+// ---------------------------------------------------------------------------
+void MainView::commDetailsChanged(QString& newStatus)
+{
+	if (mCommDetailsTxt) {
+		mCommDetailsTxt->setPlainText(newStatus);
+	}
+}
+
+// ---------------------------------------------------------------------------
+void MainView::updatePluginInfo(QStringList& pluginList)
+{
+	mPluginList = pluginList;
+}
+
+// ---------------------------------------------------------------------------
+void MainView::autostartStatusChanged(HtiEngineWrapper::AutoStartStatus newStatus)
+{
+	switch(newStatus)
+		{
+		case HtiEngineWrapper::AutoStartDisabled:
+			mHtiAutoStartStatusTxt->setPlainText("Auto Start: Disabled" );
+			break;
+		case HtiEngineWrapper::AutoStartEnabled:
+			mHtiAutoStartStatusTxt->setPlainText("Auto Start: Enabled" );
+			break;
+		default:
+			mHtiAutoStartStatusTxt->setPlainText("Auto Start: Unknown" );
+		}
+	
+	bool isAutoStartEnabled = (newStatus == HtiEngineWrapper::AutoStartEnabled);
+    mActionEnableAuto->setVisible(!isAutoStartEnabled);
+    mActionDisableAuto->setVisible(isAutoStartEnabled);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::consoleStatusChanged(bool enabled)
+{
+    mActionEnableConsole->setVisible(!enabled);
+    mActionDisableConsole->setVisible(enabled);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::watchDogStatusChanged(bool enabled)
+{
+    mActionEnableWdog->setVisible(!enabled);
+    mActionDisableWdog->setVisible(enabled);
+}
+
+
+// ---------------------------------------------------------------------------
+
+void MainView::createToolbar()
+{
+	mActionStartHti = toolBar()->addAction("Start Hti");
+	mActionStopHti = toolBar()->addAction("Stop Hti");
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::startHti()
+{
+	mEngineWrapper.startHti();
+}
+
+// ---------------------------------------------------------------------------
+
+void MainView::stopHti()
+{
+	mEngineWrapper.stopHti();
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableComm()
+{
+    //Get current selection
+	QString currentComm;
+	mEngineWrapper.getSelectedComm(currentComm);
+	int curSelection = mPluginList.indexOf(currentComm, 0);
+	
+	QStringList selection;
+	bool ok = false;
+	selection = HbListDialog::getStringItems("Select Comm", mPluginList, curSelection, &ok, HbAbstractItemView::SingleSelection);
+		
+	if(ok){
+			if(selection[0] == QString("Bt serial comm")){
+				enableBTComm();
+			}
+			else if(selection[0] == QString("IP comm")){
+				enableIPComm();
+			}
+			else if(selection[0] == QString("SERIAL comm")){
+				enableSerialComm();
+			}
+			else{
+				//All other comm plugins
+				mEngineWrapper.enableOtherComm(selection[0]);
+			}	
+		}
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableSerialComm()
+{
+	bool ok = false;
+    QString str = HbInputDialog::getText(
+					"Set Comm Port number ",
+					"",
+					&ok);
+    
+    if(ok){
+    	mEngineWrapper.enableSerial(str);
+    }
+}
+
+
+// ---------------------------------------------------------------------------
+void MainView::enableIPComm()
+{
+    // Get IAPs list
+    QStringList iapsList;
+    mEngineWrapper.listIAPs(iapsList); 
+    if(iapsList.count() == 0)
+    {
+        HbMessageBox msg("No IAPs for selection!", HbMessageBox::MessageTypeWarning);
+        msg.exec();
+        return;
+    }
+    
+    // Get current selection
+    QString curIapName;
+    QString param = "IAPName";
+    mEngineWrapper.getIPCfgParam(param, curIapName);
+    int curSelction = iapsList.indexOf(curIapName, 0);
+    
+    QString iap;
+	QStringList selection;
+	bool ok = false;
+	selection = HbListDialog::getStringItems("Select IAP:", iapsList, curSelction, &ok, HbAbstractItemView::SingleSelection);
+	
+	if(ok)
+	{
+        iap = selection[0];
+	}
+	else
+	{
+        return;
+	}
+	
+	QStringList srcList;
+	srcList <<"Listen" <<"Connect";
+	
+	selection = HbListDialog::getStringItems("Select IP Comm", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+	
+	if(ok){
+		if(selection[0] == srcList[0]){
+			QString port = HbInputDialog::getText(
+								"Local port",
+								"",
+								&ok);	
+		
+			if(ok){
+				mEngineWrapper.ipListen(port, iap);
+			}
+			
+		}
+		else{
+			QString host = HbInputDialog::getText(
+								"Remote Host",
+								"",
+								&ok);	
+					
+			if(ok){
+				QString port = HbInputDialog::getText(
+												"Remote port",
+												"",
+												&ok);	
+			
+				if(ok){
+					mEngineWrapper.ipConnect(host, port, iap);
+				}
+			}
+		}
+			
+	}
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableBTComm()
+{
+	QStringList srcList;
+	QStringList selection;
+	 
+	srcList <<"BT address" <<"BT name" <<"Search when starting" ;
+	
+	bool ok = false;
+	selection = HbListDialog::getStringItems("", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+	
+	if(ok){
+		if(selection[0] == srcList[0]){
+			QString address = HbInputDialog::getText(
+						"BT address",
+						"",
+						&ok);
+		
+			if(ok){
+				mEngineWrapper.enableBtByAddress(address);	
+			}
+		}
+		else if(selection[0] == srcList[1]){
+			QString name = HbInputDialog::getText(
+								"BT name",
+								"",
+								&ok);
+				
+					if(ok){
+						mEngineWrapper.enableBtByName(name);	
+					}
+		}
+		else if(selection[0] == srcList[2]){
+			mEngineWrapper.btSearch();
+		}
+	}
+}
+
+
+// ---------------------------------------------------------------------------
+void MainView::setPriority()
+{
+    // Get current priority
+    bool ok = false;
+    QString curPriority;
+    QString param = "Priority";
+    mEngineWrapper.getHtiCfgParam(param, curPriority);
+    int curSelection = curPriority.toInt(&ok);
+    if(ok){
+        curSelection--;
+    }
+    else{
+    curSelection = 2;
+    }
+    
+	QStringList srcList;
+	QStringList selection;
+	 
+	srcList <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
+	
+	
+	selection = HbListDialog::getStringItems("Select Hti Priority", srcList, curSelection, &ok, HbAbstractItemView::SingleSelection);
+	
+	if(ok){
+		if(selection[0] == srcList[0]){
+			mEngineWrapper.setPriorityBackground();
+		}
+		else if(selection[0] == srcList[1]){
+					mEngineWrapper.setPriorityForeground();
+		}
+		else if(selection[0] == srcList[2]){
+			mEngineWrapper.setPriorityHigh();
+		}
+		else{
+			mEngineWrapper.setPriorityAbsoluteHigh();
+		}	
+	}
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableAutoStart()
+{
+	mEngineWrapper.autoStartEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableAutoStart()
+{
+	mEngineWrapper.autoStartEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableWatchdog()
+{
+	mEngineWrapper.watchDogEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableWatchdog()
+{
+	mEngineWrapper.watchDogEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::enableConsole()
+{
+	mEngineWrapper.consoleEnable(true);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::disableConsole()
+{
+	mEngineWrapper.consoleEnable(false);
+}
+
+// ---------------------------------------------------------------------------
+void MainView::showParamList()
+{
+	QStringList srcList;
+	QStringList selection;
+	QString value;
+	QString name;
+	QString cfgSelection;
+	QString paramSelection;
+	QString cfgHti = "Hti.cfg";
+	QString cfgBtComm ="HtiBtComm.cfg";
+	QString cfgSerialComm = "HtiSerialComm.cfg";
+	QString cfgIPComm = "HtiIPComm.cfg";
+	 
+	srcList <<cfgHti <<cfgBtComm <<cfgSerialComm << cfgIPComm;
+	
+	bool ok = false;
+	selection = HbListDialog::getStringItems("Select cfg file to modify", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+	
+	if(ok){
+        cfgSelection = selection[0];
+        srcList.clear();
+	    if(cfgSelection == cfgHti){
+	    srcList <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
+	            <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
+	            <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
+	    }
+	    else if(cfgSelection == cfgBtComm){
+	        srcList <<"BtDeviceName" <<"BtDeviceName";
+	    }
+	    else if(cfgSelection == cfgSerialComm){
+            srcList <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
+	    }
+	    else{
+	    srcList <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
+	    }
+	    
+	    selection = HbListDialog::getStringItems("Select a parameter name in" + cfgSelection, srcList, 0, &ok, HbAbstractItemView::SingleSelection);
+	}
+    
+    if(ok){
+        name = selection[0];
+        value = HbInputDialog::getText("Value for paramater " + name, "", &ok);
+    }
+    
+    if(ok){
+       if(cfgSelection == cfgHti){
+            mEngineWrapper.setHtiCfgParam(name, value);
+        }
+        else if(cfgSelection == cfgBtComm){
+            mEngineWrapper.setBtCfgParam(name, value);
+        }
+        else if(cfgSelection == cfgSerialComm){
+            mEngineWrapper.setSerialCfgParam(name, value);
+        }
+        else{
+            mEngineWrapper.setIPCfgParam(name, value);
+        }   
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiAdminQt/mainview.h	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of HtiAdmin main.
+*
+*/
+
+#ifndef MAINVIEW_H
+#define MAINVIEW_H
+
+
+#include <hbview.h>
+#include "htienginewrapper.h"
+
+
+class HbMainWindow;
+class HbApplication;
+class SettingsView;
+class HbAction;
+class HbTextEdit;
+class HbTextItem;
+class HbLabel;
+class QGraphicsLinearLayout;
+class QGraphicsGridLayout;
+
+
+/**
+ * Class that implements the main view of Screen Grabber
+  */
+class MainView : public HbView
+{
+    Q_OBJECT
+    
+public:
+    
+    /**
+     * Constructor
+	*/
+    MainView(HbMainWindow &mainWindow, HtiEngineWrapper &engineWrapper);
+    
+    /**
+     * Destructor
+     */
+	~MainView();
+
+	/**
+     * Initializes Engine Wrapper
+     * @param app application class of Screen Grabber
+     */
+    void init(HbApplication &app);
+    
+    void enableSerialComm();
+    void enableBTComm();
+    void enableIPComm();
+    
+
+private slots:
+	void htiStatusChanged(HtiEngineWrapper::HtiStatus newStatus);
+	void commStatusChanged(QString& newStatus);
+	void updatePluginInfo(QStringList& pluginList);
+	void autostartStatusChanged(HtiEngineWrapper::AutoStartStatus newStatus);
+	void consoleStatusChanged(bool enabled);
+	void watchDogStatusChanged(bool enabled);
+	void commDetailsChanged(QString& newStatus);
+	
+	void startHti();
+	void stopHti();
+	void enableComm();
+	void setPriority();
+	void enableAutoStart();
+	void disableAutoStart();
+	void enableWatchdog();
+	void disableWatchdog();
+	void enableConsole();
+	void disableConsole();
+	void showParamList ();
+	
+
+private:
+    
+    /**
+     * Creates menu
+     */
+    void createMenu(HbApplication &app);
+    
+    /**
+     * Creates toolbar components
+     */
+    void createToolbar();
+    
+    void createTexts();
+	
+public:
+    
+private:
+	/* Main windo of Screen Grabber */
+    HbMainWindow &mMainWindow;
+    
+    /* Hti Engine Wrapper */
+    HtiEngineWrapper& mEngineWrapper;
+    
+    /* Actions that are used in toolbars and menus */
+    HbAction* mActionExit;
+    HbAction* mActionStartHti;
+    HbAction* mActionStopHti;
+    HbAction* mActionSelectComm;
+    HbAction* mActionSetPriority;
+    HbAction* mActionEnableAuto;
+    HbAction* mActionDisableAuto;
+    HbAction* mActionEnableWdog;
+    HbAction* mActionDisableWdog;
+    HbAction* mActionEnableConsole;
+	HbAction* mActionDisableConsole;
+	HbAction* mActionSetParameter;
+    
+    HbLabel* mHtiStatusTxt;
+    HbLabel* mHtiVersionTxt;
+    HbLabel* mHtiAutoStartStatusTxt;
+    HbLabel* mCommunicationTxt;
+    HbLabel* mCommDetailsTxt;
+    
+    QStringList mPluginList;
+
+};
+
+#endif // MAINVIEW_H
+
+
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommInterfaceu.def	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-EXPORTS
-	??0RHtiBtCommInterface@@QAE@XZ @ 1 NONAME ; RHtiBtCommInterface::RHtiBtCommInterface(void)
-	?CancelReceive@RHtiBtCommInterface@@QAEXXZ @ 2 NONAME ; void RHtiBtCommInterface::CancelReceive(void)
-	?CancelSend@RHtiBtCommInterface@@QAEXXZ @ 3 NONAME ; void RHtiBtCommInterface::CancelSend(void)
-	?Close@RHtiBtCommInterface@@QAEXXZ @ 4 NONAME ; void RHtiBtCommInterface::Close(void)
-	?Connect@RHtiBtCommInterface@@QAEHAAVTDesC8@@H@Z @ 5 NONAME ; int RHtiBtCommInterface::Connect(class TDesC8 &, int)
-	?GetPortNumber@RHtiBtCommInterface@@QBEHXZ @ 6 NONAME ; int RHtiBtCommInterface::GetPortNumber(void) const
-	?GetReceiveBufferSize@RHtiBtCommInterface@@QBEHXZ @ 7 NONAME ; int RHtiBtCommInterface::GetReceiveBufferSize(void) const
-	?GetSendBufferSize@RHtiBtCommInterface@@QBEHXZ @ 8 NONAME ; int RHtiBtCommInterface::GetSendBufferSize(void) const
-	?Receive@RHtiBtCommInterface@@QAEXAAVTDes8@@AAVTRequestStatus@@@Z @ 9 NONAME ; void RHtiBtCommInterface::Receive(class TDes8 &, class TRequestStatus &)
-	?Send@RHtiBtCommInterface@@QAEXABVTDesC8@@AAVTRequestStatus@@@Z @ 10 NONAME ; void RHtiBtCommInterface::Send(class TDesC8 const &, class TRequestStatus &)
-	?Version@RHtiBtCommInterface@@QBE?AVTVersion@@XZ @ 11 NONAME ; class TVersion RHtiBtCommInterface::Version(void) const
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtCommServeru.def	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
-	?StartThread@@YAHXZ @ 1 NONAME ; int StartThread(void)
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BWINS/HtiBtSerialComHelperu.def	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-EXPORTS
-	??1CBtSerialClient@@UAE@XZ @ 1 NONAME ; CBtSerialClient::~CBtSerialClient(void)
-	?ConnectL@CBtSerialClient@@QAEXABVTDesC16@@H@Z @ 2 NONAME ; void CBtSerialClient::ConnectL(class TDesC16 const &, int)
-	?ConnectL@CBtSerialClient@@QAEXVTBTDevAddr@@H@Z @ 3 NONAME ; void CBtSerialClient::ConnectL(class TBTDevAddr, int)
-	?ConnectL@CBtSerialClient@@QAEXXZ @ 4 NONAME ; void CBtSerialClient::ConnectL(void)
-	?Connected@CBtSerialClient@@QAEHXZ @ 5 NONAME ; int CBtSerialClient::Connected(void)
-	?Connecting@CBtSerialClient@@QAEHXZ @ 6 NONAME ; int CBtSerialClient::Connecting(void)
-	?Disconnect@CBtSerialClient@@QAEXXZ @ 7 NONAME ; void CBtSerialClient::Disconnect(void)
-	?FreeSpaceInSendBuffer@CBtSerialClient@@QAEHXZ @ 8 NONAME ; int CBtSerialClient::FreeSpaceInSendBuffer(void)
-	?NewL@CBtSerialClient@@SAPAV1@AAVMBtSerialClientObserver@@@Z @ 9 NONAME ; class CBtSerialClient * CBtSerialClient::NewL(class MBtSerialClientObserver &)
-	?ReadAsyncL@CBtSerialClient@@QAEXXZ @ 10 NONAME ; void CBtSerialClient::ReadAsyncL(void)
-	?SendBufferMaxSize@CBtSerialClient@@QAEHXZ @ 11 NONAME ; int CBtSerialClient::SendBufferMaxSize(void)
-	?SendL@CBtSerialClient@@QAEXABVTDesC8@@@Z @ 12 NONAME ; void CBtSerialClient::SendL(class TDesC8 const &)
-	?ServerAddressL@CBtSerialClient@@QAE?AVTBTDevAddr@@XZ @ 13 NONAME ; class TBTDevAddr CBtSerialClient::ServerAddressL(void)
-	?ServicePort@CBtSerialClient@@QAEHXZ @ 14 NONAME ; int CBtSerialClient::ServicePort(void)
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialClient.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Bluetooth serial client.
-*
-*/
-
-
-#ifndef __BTSERIALCLIENT_H__
-#define __BTSERIALCLIENT_H__
-
-// INCLUDES
-#include <e32base.h>
-#include <es_sock.h>
-#include <bt_sock.h>
-#include <btextnotifiers.h>
-#include <btsdp.h>
-
-#include "SocketObserver.h"
-
-// FORWARD DECLARATIONS
-class CMessageServiceSearcher;
-class CSocketsReader;
-class CSocketsWriter;
-
-
-class MBtSerialClientObserver
-    {
-public:
-    virtual void ConnectedToServer(TInt aError) = 0;
-    virtual void DisconnectedFromServer() = 0;
-    virtual void DataFromServer(const TDesC8& aData) = 0;
-    virtual void AllBufferedDataSent() = 0;
-    };
-
-/**
-* CBtSerialClient
-* Connects and sends messages to a remote machine using bluetooth
-*/
-class CBtSerialClient : public CActive, public MSocketObserver
-    {
-    public: // Constructors and destructor
-
-        /**
-        * NewL()
-        * Construct a CBtSerialClient
-        * @param aObserver the observer for this BT serial client
-        * @return a pointer to the created instance of CBtSerialClient
-        */
-        IMPORT_C static CBtSerialClient* NewL( MBtSerialClientObserver& aObserver );
-
-        /**
-        * ~CBtSerialClient()
-        * Destroy the object and release all memory objects.
-        * Close any open sockets.
-        */
-        IMPORT_C virtual ~CBtSerialClient();
-
-    public:     // New functions
-
-        /**
-        * ConnectL()
-        * Connect to remote device. Query user for a device.
-        */
-        IMPORT_C void ConnectL();
-
-        /**
-        * ConnectL()
-        * Connect to remote device.
-        */
-        IMPORT_C void ConnectL(const TBTDevAddr aBTServerDevice, const TInt aPort );
-
-        /**
-        * ConnectL()
-        * Connect to remote device by device name.
-        */
-        IMPORT_C void ConnectL( const TDesC& aBTServerDeviceName, const TInt aPort );
-
-        /**
-        * DisconnectL()
-        * Disconnect from remote machine
-        */
-        IMPORT_C void Disconnect();
-
-        /**
-        * IsConnecting()
-        * @return ETrue if the client is establishing a
-        * connection to the server.
-        */
-        IMPORT_C TBool Connecting();
-
-        /**
-        * Connected()
-        * @return ETrue if the client is fully connected to the server.
-        */
-        IMPORT_C TBool Connected();
-
-        /**
-        * ServerAddressL()
-        * @return address of connected server. Leaves with KErrNotReady, if
-        * not connected.
-        */
-        TBTDevAddr ServerAddressL();
-
-        /**
-        * Add data to outgoing buffer and start sending it to client.
-        *
-        * Leaves with KErrOverflow, if the outgoing buffer cannot
-        * be added all of the aData.
-        * Leaves with KErrNotReady, if client is not connected.
-        * When all data in internal buffer has been sent, observer
-        * is notified (AllBufferedDataSent)
-        */
-        IMPORT_C void SendL(const TDesC8& aData);
-
-        /**
-        * Issue read operation. Will complete asyncronously.
-        *
-        * Leaves with KErrNotReady, if client is not connected.
-        * Notifies observer, when some data has been read. Caller
-        * is responsible for calling this method again to receive
-        * more data.
-        */
-        IMPORT_C void ReadAsyncL();
-
-        /**
-        * Query free size of outgoing buffer.
-        */
-        IMPORT_C TInt FreeSpaceInSendBuffer();
-
-        /**
-        * Query max size of outgoing buffer.
-        */
-        IMPORT_C TInt SendBufferMaxSize();
-
-        /**
-        * Query the port of the service we are connected with
-        * @return Port number or KErrDisconnected if not connected to a service
-        */
-        IMPORT_C TInt ServicePort();
-
-    protected:    // from CActive
-
-        /**
-        * DoCancel()
-        * Cancel any outstanding requests
-        */
-        void DoCancel();
-
-        /**
-        * RunL()
-        * Respond to an event
-        */
-        void RunL();
-
-    protected: // from MSocketObserver
-
-        void ReportError( TErrorType aErrorType, TInt aErrorCode );
-        void NewData( const TDesC8& aData );
-        void AllBufferedDataSent();
-
-    private:
-
-        /**
-        * ConnectToServerL
-        * Connects to the service
-        */
-        void ConnectToServerL();
-
-        /**
-        * DisconnectFromServer()
-        * Disconnects from the service
-        */
-        void DisconnectFromServer();
-
-        /**
-        * CBtSerialClient()
-        * Constructs this object
-        */
-        CBtSerialClient( MBtSerialClientObserver& aObserver );
-
-        /**
-        * ConstructL()
-        * Performs second phase construction of this object
-        */
-        void ConstructL();
-
-    private:    // data
-
-        /**
-        * TState
-        * The state of the active object, determines behaviour within
-        * the RunL method.
-        * EWaitingToGetDevice waiting for the user to select a device
-        * EGettingDevice searching for a device
-        * EGettingService searching for a service
-        * EGettingConnection connecting to a service on a remote machine
-        * EConnected connected to a service on a remote machine
-        */
-        enum TState
-            {
-            EWaitingToGetDevice,      // phase 1 of Connect
-            EGettingDevice,           // phase 2 of Connect
-            EGettingService,          // phase 3 of Connect
-            EGettingConnection,       // phase 4 of Connect
-            EConnected, // sending and receiving data
-            EDisconnecting
-            };
-
-        MBtSerialClientObserver& iObserver;
-
-        /** iState the current state of the client */
-        TState iState;
-
-        /**
-        * iServiceSearcher searches for service this
-        * client can connect to.
-        * Owned by CBtSerialClient
-        */
-        CMessageServiceSearcher* iServiceSearcher;
-
-        /**
-        * iCurrentServiceIndex the index number of the service we are
-        * currently connecting/connected to
-        */
-        TInt iCurrentServiceIndex;
-
-        /** iSocketServer a connection to the socket server */
-        RSocketServ iSocketServer;
-
-        /** iSocket a socket to connect with */
-        RSocket iSocket;
-
-        /** iServiceClass the service class UUID to search for */
-        TUUID iServiceClass;
-
-        TBTDevAddr iBTServerDevice;
-
-        CSocketsReader* iSocketReader;
-        CSocketsWriter* iSocketWriter;
-    };
-
-#endif // __BTSERIALCLIENT_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/BtSerialEngine.pan	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Bluetooth serial engine panic codes.
-*
-*/
-
-
-#ifndef __BTSERIALENGINE_PAN__
-#define __BTSERIALENGINE_PAN__
-
-#include <e32def.h>
-#include <e32std.h>
-
-/** Panic Categories */
-_LIT( KPanicSerialEngine, "BTSerialEngine" ); // All engine classes
-_LIT( KPanicBTServiceAdvertiser, "BTServiceAdvertiser" ); // only service advertiser
-
-
-enum TBTSerialEnginePanics
-    {
-    EBTPointToPointReceiverInvalidState = 1,
-    EBTPointToPointSenderExists = 2,
-    EBTPointToPointReceiverExists = 3,
-    EBTPointToPointSenderInvalidState = 4,
-    EBTPointToPointNoSender = 5,
-    EBTPointToPointAddMessage = 6,
-    EBTPointToPointNextRecordRequestComplete = 7,
-    EBTPointToPointAttributeRequestResult = 8,
-    EBTPointToPointAttributeRequestComplete = 9,
-    EBTPointToPointProtocolRead = 10,
-    EBTPointToPointAttributeRequest = 11,
-    EBTPointToPointSdpRecordDelete = 12,
-    EBTPointToPointServerStop = 13,
-    EBTPointToPointInvalidLogicState = 14,
-    EBTPointToPointUnableToDisconnect = 15,
-
-    EBTSerialEngineReadSocketBadState = 16,
-    EBTSerialEngineWriteSocketBadState = 17
-    };
-
-inline void Panic( TBTSerialEnginePanics aReason )
-    {
-    User::Panic( KPanicSerialEngine, aReason );
-    }
-
-
-#endif // __BTSERIALENGINE_PAN__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/HtiBtEngineLogging.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Logging for Bluetooth engine.
-*
-*/
-
-
-#ifndef __HTIBTENGINELOGGING_H__
-#define __HTIBTENGINELOGGING_H__
-
-// INCLUDES
-#include <flogger.h>
-
-/******************************************************/
-/**     LOG SETUP                                    **/
-/******************************************************/
-_LIT(KLogFolder, "Hti");
-_LIT(KLogFile, "BtSerialEngine.log");
-
-#ifdef __ENABLE_LOGGING__
-// Comment out the levels which are marked supported in the build
-// (and which are used runtime).
-//
-#define LOG_LEVEL_ERROR_SUPPORTED
-#define LOG_LEVEL_WARN_SUPPORTED
-#define LOG_LEVEL_INFO_SUPPORTED
-//#define LOG_LEVEL_DEBUG_SUPPORTED
-#endif
-
-/******************************************************/
-/**     MACRO DEFINITIONS                            **/
-/******************************************************/
-
-// Macros:                            Example:                                 Result:
-// LOGFMT_E(formatstring, parameter)  LOGFMT_E("Leave in RunL: %d", -6)        <TIME> ERROR: Leave in RunL: -6
-// LOG_E(string)                      LOG_E("There was an error")              <TIME> ERROR: There was an error
-// LOGFMT_W(formatstring, parameter)  LOGFMT_W("Buffer too small: %d", 12)     <TIME> WARNING: Buffer too small: 12
-// LOG_W(string)                      LOG_W("warmingtext")                     <TIME> WARNING: warningtext
-// LOGFMT_I(formatstring, parameter)  LOGFMT_I("plugin loaded: %S", &myDescr8) <TIME> INFO: plugin loaded: myplugin
-// LOG_I(string)                      LOG_I("abc")                             <TIME> INFO: abc
-// LOGFMT_D(formatstring, parameter)  LOGFMT_D("buffer length: %d", 56)        <TIME> DEBUG: buffer length: 56
-// LOG_D(string)                      LOG_D("abc")                             <TIME> DEBUG: abc
-
-#define ERRORSTR "ERROR: "
-#define WARNSTR  "WARNING: "
-#define INFOSTR  "INFO: "
-#define DEBUGSTR "DEBUG: "
-
-#ifdef LOG_LEVEL_ERROR_SUPPORTED
-    #define LOGFMT_E(a1, a2) {_LIT8(temp, ERRORSTR##a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, a2);}
-    #define LOG_E(a1) {_LIT8(temp, ERRORSTR##a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
-#else
-    #define LOGFMT_E(a1, a2) {}
-    #define LOG_E(a1) {}
-#endif
-
-#ifdef LOG_LEVEL_WARN_SUPPORTED
-    #define LOGFMT_W(a1, a2) {_LIT8(temp, WARNSTR##a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, a2);}
-    #define LOG_W(a1) {_LIT8(temp, WARNSTR##a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
-#else
-    #define LOGFMT_W(a1, a2) {}
-    #define LOG_W(a1) {}
-#endif
-
-#ifdef LOG_LEVEL_INFO_SUPPORTED
-    #define LOGFMT_I(a1, a2) {_LIT8(temp, INFOSTR##a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, a2);}
-    #define LOG_I(a1) {_LIT8(temp, INFOSTR##a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
-#else
-    #define LOGFMT_I(a1, a2) {}
-    #define LOG_I(a1) {}
-#endif
-
-#ifdef LOG_LEVEL_DEBUG_SUPPORTED
-    #define LOGFMT_D(a1, a2) {_LIT8(temp, DEBUGSTR##a1); RFileLogger::WriteFormat(KLogFolder, KLogFile, EFileLoggingModeAppend, temp, a2);}
-    #define LOG_D(a1) {_LIT8(temp, DEBUGSTR##a1); RFileLogger::Write(KLogFolder, KLogFile, EFileLoggingModeAppend, temp);}
-#else
-    #define LOGFMT_D(a1, a2) {}
-    #define LOG_D(a1) {}
-#endif
-
-#endif // __HTIBTENGINELOGGING_H__
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/SocketObserver.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  The error notification interface.
-*
-*/
-
-
-#ifndef __SOCKETOBSERVER_H__
-#define __SOCKETOBSERVER_H__
-
-// CLASS DECLARATION
-
-/**
-* MEngineNotifier.
-* This class specifies the error notification interface.
-*/
-class MSocketObserver
-    {
-    public: // Enumerations
-
-        /**
-        * TErrorType.
-        * Error types encountered when reading/writing to a sockets.
-        *  - EDisconnected.      A disconnected error has been encountered.
-        *  - ETimeOutOnWrite.    A write operation has failed to complete
-        *                        within a predetermined period.
-        *  - EGeneralReadError.  A general error has been encountered
-        *                        during a read.
-        *  - EGeneralWriteError. A general error has been encountered
-        *                        during a write
-        */
-        enum TErrorType
-            {
-            EDisconnected,
-            ETimeOutOnWrite,
-            EGeneralReadError,
-            EGeneralWriteError
-            };
-
-    public: // New functions
-
-        /**
-        * ReportError.
-        * Reports a communication error.
-        * @param aErrorType Error type.
-        * @param aErrorCode Associated error code.
-        */
-        virtual void ReportError( TErrorType aErrorType, TInt aErrorCode ) = 0;
-
-        /**
-        * NewData.
-        * Data has been received on the socket and read into a buffer.
-        * @param aData The data buffer.
-        */
-        virtual void NewData(const TDesC8& aData) = 0;
-
-        virtual void AllBufferedDataSent() = 0;
-    };
-
-#endif // __SOCKETOBSERVER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/btservicesearcher.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,264 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Bluetooth service searcher.
-*
-*/
-
-
-#ifndef __BTSERVICESEARCHER_H__
-#define __BTSERVICESEARCHER_H__
-
-// INCLUDES
-#include <e32base.h>
-#include <bttypes.h>
-#include <btextnotifiers.h>
-
-#include "sdpattributeparser.h"
-#include "sdpattributenotifier.h"
-
-// CONSTANTS
-#include "messageprotocolconstants.h"
-
-// CLASS DECLARATIONS
-/**
-* CBTServiceSearcher
-* Searches for a service on a remote machine
-*/
-
-class CBTServiceSearcher : public CBase,
-                           public MSdpAgentNotifier,
-                           public MSdpAttributeNotifier
-    {
-    public: // Destructor
-
-        /**
-        * ~CBTServiceSearcher()
-        * Destroy the object and release all memory objects
-        */
-        virtual ~CBTServiceSearcher();
-
-    public: // New functions
-
-        /**
-        * SelectDeviceByDiscoveryL()
-        * Select a device
-        * @param aObserverRequestStatus the observer that is to
-        * be notified when the device selection is complete.
-        */
-        void SelectDeviceByDiscoveryL( TRequestStatus&
-                                       aObserverRequestStatus );
-
-       /**
-        * SelectDeviceByNameL()
-        * Select a device by BT device name.
-        * @param aDeviceName the name of the device to search and select.
-        * @param aObserverRequestStatus the observer that is to
-        * be notified when the device selection is complete.
-        */
-        void SelectDeviceByNameL( const TDesC& aDeviceName,
-                                  TRequestStatus& aObserverRequestStatus );
-
-        /**
-        * FindServiceL()
-        * Find a service on the specified device
-        * @param aDeviceAddress the BT address of the device to search for
-        * the service
-        * @param aObserverRequestStatus the observer that is to be notified
-        * when the service search is complete
-        */
-        void FindServiceL( const TBTDevAddr& aDeviceAddress,
-            TRequestStatus& aObserverRequestStatus );
-
-        /**
-        * BTDevAddr()
-        * @return the bluetooth device address
-        */
-        const TBTDevAddr& BTDevAddr();
-
-        /**
-        * ResponseParams()
-        * @return Information about the device selected by the user
-        */
-        const TBTDeviceResponseParams& ResponseParams();
-
-    protected:  // New functions
-
-        /**
-        * CBTServiceSearcher()
-        * Constructs this object
-        */
-        CBTServiceSearcher();
-
-        /**
-        * Finished()
-        * The search has finished. Notify the observer
-        * that the process is complete.
-        */
-        virtual void Finished( TInt aError = KErrNone );
-
-        /**
-        * HasFinishedSearching()
-        * Is the instance still wanting to search.
-        * @return EFalse if the instance wants searching to continue.
-        */
-        virtual TBool HasFinishedSearching() const;
-
-        /**
-        * HasFoundService()
-        * @return ETrue if a service has been found
-        */
-        TBool HasFoundService() const;
-
-    protected: // abstract methods
-
-        /**
-        * ProtocolList()
-        * The list of Protocols required by the service.
-        */
-        virtual const TSdpAttributeParser::TSdpAttributeList&
-                                           ProtocolList() const = 0;
-
-        /**
-        * ServiceClass()
-        * The service class to search for
-        * @return the service class UUID
-        */
-        virtual const TUUID& ServiceClass() const = 0;
-
-        /**
-        * FoundElementL()
-        * Read the data element
-        * @param aKey a key that identifies the element
-        * @param aValue the data element
-        */
-        virtual void FoundElementL( TInt aKey, CSdpAttrValue& aValue ) = 0;
-
-    public: // from MSdpAgentNotifier
-
-        /**
-        * NextRecordRequestComplete()
-        * Process the result of the next record request
-        * @param aError the error code
-        * @param aHandle the handle of the service record
-        * @param aTotalRecordsCount the total number of matching
-        * service records
-        */
-        void NextRecordRequestComplete( TInt aError,
-                                        TSdpServRecordHandle aHandle,
-                                        TInt aTotalRecordsCount );
-
-        /**
-        * AttributeRequestResult()
-        * Process the next attribute requested
-        * @param aHandle the handle of the service record
-        * @param aAttrID the id of the attribute
-        * @param aAttrValue the value of the attribute
-        */
-        void AttributeRequestResult( TSdpServRecordHandle aHandle,
-                                     TSdpAttributeID aAttrID,
-                                     CSdpAttrValue* aAttrValue );
-
-        /**
-        * AttributeRequestComplete()
-        * Process the arrtibute request completion
-        * @param aHandle the handle of the service record
-        * @param aError the error code
-        */
-        void AttributeRequestComplete( TSdpServRecordHandle aHandle,
-                                       TInt aError );
-
-    private:    // Functions from base classes
-
-        /**
-        * NextRecordRequestCompleteL()
-        * Process the result of the next record request
-        * @param aError the error code
-        * @param aHandle the handle of the service record
-        * @param aTotalRecordsCount the total number of
-        * matching service records
-        */
-        void NextRecordRequestCompleteL( TInt aError,
-                                         TSdpServRecordHandle aHandle,
-                                         TInt aTotalRecordsCount );
-
-        /**
-        * AttributeRequestResultL()
-        * Process the next attribute requested
-        * @param aHandle the handle of the service record
-        * @param aAttrID the id of the attribute
-        * @param aAttrValue the value of the attribute
-        */
-        void AttributeRequestResultL( TSdpServRecordHandle aHandle,
-                                      TSdpAttributeID aAttrID,
-                                      CSdpAttrValue* aAttrValue );
-
-        /**
-        * AttributeRequestCompleteL()
-        * Process the arrtibute request completion
-        * @param aHandle the handle of the service record
-        * @param aError the error code
-        */
-        void AttributeRequestCompleteL( TSdpServRecordHandle,
-                                        TInt aError );
-
-    private:    // data
-
-        /**
-        * iStatusObserver pointer to the request status observer
-        * Not owned by CBTServiceSearcher
-        */
-        TRequestStatus* iStatusObserver;
-
-        /**
-        * iIsDeviceSelectorConnected is the device
-        * selector connected?
-        */
-        TBool iIsDeviceSelectorConnected;
-
-        /**
-        * iDeviceSelector
-        * a handle to the bluetooth device selector notifier
-        */
-        RNotifier iDeviceSelector;
-
-        /**
-        * iResponse
-        * the response of the device selection.
-        */
-        TBTDeviceResponseParamsPckg iResponse;
-
-        /**
-        * iSelectionFilter
-        * Request a device selection
-        */
-        TBTDeviceSelectionParamsPckg iSelectionFilter;
-        /**
-        * iAgent a connetction to the SDP client
-        * Owned by CBTServiceSearcher
-        */
-        CSdpAgent* iAgent;
-
-        /**
-        * iSdpSearchPattern a search pattern
-        * Owned by CBTServiceSearcher
-        */
-        CSdpSearchPattern* iSdpSearchPattern;
-
-        /** iHasFoundService has the service been found ? */
-        TBool iHasFoundService;
-    };
-
-#endif // __BTSERVICESEARCHER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/btservicesearcher.pan	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Bluetooth service searcher panic codes.
-*
-*/
-
-
-#ifndef __BTSERVICE_SEARCHER_PAN__
-#define __BTSERVICE_SEARCHER_PAN__
-
-#include <e32std.h>
-
-/** BTServiceSearcher application panic codes */
-enum TBTServiceSearcherPanics
-    {
-    EBTServiceSearcherNextRecordRequestComplete = 1,
-    EBTServiceSearcherAttributeRequestResult,
-    EBTServiceSearcherAttributeRequestComplete,
-    EBTServiceSearcherInvalidControlIndex,
-    EBTServiceSearcherProtocolRead,
-    EBTServiceSearcherAttributeRequest,
-    EBTServiceSearcherSdpRecordDelete
-    };
-
-
-/** Panic Category */
-_LIT( KPanicServiceSearcher, "ServiceSearcher" );
-
-
-inline void Panic( TBTServiceSearcherPanics aReason )
-    {
-    User::Panic( KPanicServiceSearcher, aReason );
-    }
-
-#endif // __BTSERVICE_SEARCHER_PAN__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/messageprotocolconstants.h	Tue Apr 27 16:38:40 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 component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Constants for Bluetooth.
-*
-*/
-
-
-#ifndef __CMESSAGE_PROTOCOL_CONSTANTS__
-#define __CMESSAGE_PROTOCOL_CONSTANTS__
-
-// INCLUDES
-#include <bt_sock.h>
-
-const TInt KRfcommChannel = 1;
-const TInt KServiceClass = 0x1101;    //  SerialPort
-
-const TUid KUidBTPointToPointApp = { 0x10005B8B };
-
-_LIT( KStrRFCOMM,             "RFCOMM" );
-
-const TInt KListeningQueSize = 1;
-
-
-#endif //__CMESSAGE_PROTOCOL_CONSTANTS__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/messageservicesearcher.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Message service searcher.
-*
-*/
-
-
-#ifndef __MESSAGESERVICESEARCHER_H__
-#define __MESSAGESERVICESEARCHER_H__
-
-// INCLUDES
-#include <e32base.h>
-#include "btservicesearcher.h"
-
-// CLASS DECLARATIONS
-/**
-* CMessageServiceSearcher
-* Searches for a message service.
-*/
-class CMessageServiceSearcher : public CBTServiceSearcher
-    {
-    public:     // Constructors and destructor
-
-        /*
-        * NewL()
-        * Create a CMessageServiceSearcher object
-        * @return a pointer to the created instance of
-        * CMessageServiceSearcher
-        */
-        static CMessageServiceSearcher* NewL();
-
-        /**
-        * NewLC()
-        * Create a CMessageServiceSearcher object
-        * @return a pointer to the created instance of
-        * CMessageServiceSearcher
-        */
-        static CMessageServiceSearcher* NewLC();
-
-        /**
-        * ~CMessageServiceSearcher()
-        * Destroy the object and release all memory objects.
-        */
-        virtual ~CMessageServiceSearcher();
-
-    public: // New functions
-
-        /**
-        * Port()
-        * Retrieve the port on which the service is installed
-        * @param aIndex index number of the service whose port number to get
-        * @return the port number or KErrNotFound if aIndex negative or greater
-        * than returned by ServiceCount()
-        */
-        TInt Port( TInt aIndex = 0 );
-
-        /**
-        * AppendPort()
-        * Adds a new port number to the port number array. If the port number
-        * already exists in the array a duplicate is not added.
-        * @param aPort the port number to add
-        * */
-        void AppendPort( TInt aPort );
-
-        /**
-         * ServiceCount()
-         * Get the amount of requested services found from the remote machine
-         * @return the count of services (= ports)
-         */
-         TInt ServiceCount();
-
-    protected:  // New functions
-
-        /**
-        * ServiceClass()
-        * @return the service class uid.
-        */
-        const TUUID& ServiceClass() const;
-
-        /**
-        * ProtocolList()
-        * @return the attribute list.
-        */
-        const TSdpAttributeParser::TSdpAttributeList& ProtocolList() const;
-
-        /**
-        * FoundElementL()
-        * Read the data element
-        * @param aKey a key that identifies the element
-        * @param aValue the data element
-        */
-        virtual void FoundElementL( TInt aKey, CSdpAttrValue& aValue );
-
-    private:    // Constructors
-
-        /**
-        * CMessageServiceSearcher()
-        * Constructs this object
-        * @param aLog the log to send output to
-        */
-        CMessageServiceSearcher();
-
-        /**
-        * ConstructL()
-        * Performs second phase construction of this object
-        */
-        void ConstructL();
-
-    private:    // data
-
-        /** iServiceClass the service class UUID to search for */
-        TUUID iServiceClass;
-
-        /**
-        * iPortNumbers array of port numbers that has the remote
-        * service installed
-        */
-        RArray<TInt> iPortNumbers;
-    };
-
-#endif // __MESSAGESERVICESEARCHER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/sdpattributenotifier.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Reads SDP Attribute elements.
-*
-*/
-
-
-#ifndef __SDP_ATTRIBUTE_NOTIFIER_H__
-#define __SDP_ATTRIBUTE_NOTIFIER_H__
-
-// FORWARD DECLARATIONS
-class CSdpAttrValue;
-
-// CLASS DECLARATIONS
-/**
-* MSdpAttributeNotifier
-* An instance of MSdpAttributeNotifier is used to read selected SDP Attribute
-* elements from an attribute value.
-*/
-class MSdpAttributeNotifier
-    {
-    public: // New functions
-
-        /**
-        * FoundElementL
-        * Read the data element
-        * @param aKey a key that identifies the element
-        * @param aValue the data element
-        */
-        virtual void FoundElementL( TInt aKey, CSdpAttrValue& aValue ) = 0;
-    };
-
-#endif // __SDP_ATTRIBUTE_NOTIFIER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/sdpattributeparser.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Reads selected parts of SDP attribute values.
-*
-*/
-
-
-#ifndef __SDP_ATTRIBUTE_PARSER_H__
-#define __SDP_ATTRIBUTE_PARSER_H__
-
-// INCLUDES
-#include <btsdp.h>
-#include "staticarrayc.h"
-
-// FORWARD DECLARATIONS
-class MSdpAttributeNotifier;
-
-// CLASS DECLARATIONS
-/**
-* TSdpAttributeParser
-* An instance of TSdpAttributeParser is used to check an SDP
-* attribute value, and read selected parts
-*/
-class TSdpAttributeParser : public MSdpAttributeValueVisitor
-    {
-    public:     // Enumerations
-
-        /**
-        * TNodeCommand
-        * The command to be carried out at a node
-        * ECheckType. Check the type of the value
-        * ECheckValue. Check the type and the value
-        * ECheckEnd. Check that a list ends at this point
-        * ESkip. Do not check this value - can not match a list end
-        * EReadValue. Pass the value onto the observer
-        * EFinished. Marks the end of the node list
-        */
-        enum TNodeCommand
-            {
-                ECheckType,
-                ECheckValue,
-                ECheckEnd,
-                ESkip,
-                EReadValue,
-                EFinished
-            };
-
-        /**
-        * SSdpAttributeNode
-        * An instance of SSdpAttributeNode is used to determine how
-        * to parse an SDP attribute value data element
-        */
-        struct SSdpAttributeNode
-        {
-            /** iCommand the command for the node */
-            TNodeCommand iCommand;
-
-            /** iType the expected type */
-            TSdpElementType iType;
-
-            /** iValue the expected value for ECheckValue,the value of aKey
-            * passed to the observer for EReadValue
-            */
-            TInt iValue;
-        };
-
-        typedef const TStaticArrayC< SSdpAttributeNode > TSdpAttributeList;
-
-        /**
-        * TSdpAttributeParser
-        * Construct a TSdpAttributeParser
-        * @param aNodeList the list of expected nodes
-        * @param aObserver an observer to read specified node values
-        */
-        TSdpAttributeParser( TSdpAttributeList& aNodeList,
-                             MSdpAttributeNotifier& aObserver );
-
-        /**
-        * HasFinished
-        * Check if parsing processed the whole list
-        * @return true is the index refers to the EFinished node
-        */
-        TBool HasFinished() const;
-
-    public: // from MSdpAttributeValueVisitor
-
-        /**
-        * VisitAttributeValueL
-        * Process a data element
-        * @param aValue the data element
-        * @param aType the type of the data element
-        */
-        void VisitAttributeValueL( CSdpAttrValue& aValue,
-                                   TSdpElementType aType );
-
-        /**
-        * StartListL
-        * Process the start of a data element list
-        * @param aList the data element list
-        */
-        void StartListL( CSdpAttrValueList& aList );
-
-        /**
-        * EndListL
-        * Process the end of a data element list
-        */
-        void EndListL();
-
-    private:    // Functions from base classes
-
-        /**
-        * CheckTypeL
-        * Check the type of the current node is the same as
-        * the specified type.
-        * @param aElementType the type of the current data element
-        */
-        void CheckTypeL( TSdpElementType aElementType ) const;
-
-        /**
-        * CheckValueL
-        * Check the value of the current node is the same as the specified value
-        * @param aValue the value of the current data element.
-        */
-        void CheckValueL( CSdpAttrValue& aValue ) const;
-
-        /**
-        * ReadValueL
-        * Pass the data element value to the observer
-        * @param aValue the value of the current data element.
-        */
-        void ReadValueL( CSdpAttrValue& aValue ) const;
-
-        /**
-        * CurrentNode
-        * Get the current node
-        * @return the current node
-        */
-        const SSdpAttributeNode& CurrentNode() const;
-
-        /**
-        * AdvanceL
-        * Advance to the next node. Leaves with KErrEof
-        * if at the finished node.
-        */
-        void AdvanceL();
-
-    private:    // data
-
-        /** iObserver the observer to read values */
-        MSdpAttributeNotifier& iObserver;
-
-        /** iNodeList a list defining the expected
-        * structure of the value
-        */
-        TSdpAttributeList& iNodeList;
-
-        /** iCurrentNodeIndex the index of the current node in iNodeList */
-        TInt iCurrentNodeIndex;
-    };
-
-#endif // __SDP_ATTRIBUTE_PARSER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/sdpattributeparser.pan	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Bluetooth SDP attribute parser panic codes.
-*
-*/
-
-
-#ifndef __SDP_ATTRIBUTE_PARSER_PAN__
-#define __SDP_ATTRIBUTE_PARSER_PAN__
-
-/** Panic Category */
-_LIT( KPanicSAP, "SAP" );
-
-/** BTPointToPoint application panic codes */
-enum TSdpAttributeParserPanics
-    {
-    ESdpAttributeParserInvalidCommand = 1,
-    ESdpAttributeParserNoValue,
-    ESdpAttributeParserValueIsList,
-    ESdpAttributeParserValueTypeUnsupported
-    };
-
-inline void Panic( TSdpAttributeParserPanics aReason )
-    {
-    User::Panic( KPanicSAP, aReason );
-    }
-
-
-#endif // __SDP_ATTRIBUTE_PARSER_PAN__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/socketsreader.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Reads from socket.
-*
-*/
-
-
-#ifndef __SOCKETSREADER_H__
-#define __SOCKETSREADER_H__
-
-// INCLUDES
-#include <in_sock.h>
-
-// FORWARD DECLARATIONS
-class MSocketObserver;
-
-// CLASS DECLARATION
-
-const TInt KReadBufferMaxSize = 2 * 1024;
-
-class CSocketsReader : public CActive
-    {
-    public: // Constructors and destructors
-
-        static CSocketsReader* NewL( MSocketObserver& aObserver,
-                                     RSocket& aSocket );
-        virtual ~CSocketsReader();
-
-    public: // New functions
-
-        void ReadAsync(); // Use Cancel() to cancel
-
-    protected: // from CActive
-
-        void DoCancel();
-        void RunL();
-
-    private: // Constructors and destructors
-
-        CSocketsReader( MSocketObserver& aObserver, RSocket& aSocket );
-        void ConstructL();
-
-    private: // New functions
-
-        void IssueRead();
-
-    private: // Data
-
-        RSocket& iSocket;
-        MSocketObserver& iObserver;
-        TBuf8<KReadBufferMaxSize> iBuffer;
-        TSockXfrLength iLen;
-    };
-
-#endif // __SOCKETSREADER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/socketswriter.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Writes to socket.
-*
-*/
-
-
-#ifndef __SOCKETSWRITER_H__
-#define __SOCKETSWRITER_H__
-
-// INCLUDES
-#include <in_sock.h>
-#include "timeoutnotifier.h"
-
-// FORWARD DECLARATIONS
-class CTimeOutTimer;
-class MSocketObserver;
-
-const TInt KSocketWriteBufferSize = 1024;
-const TInt KTransferBufferSize = 8 * 1024;
-
-// CLASS DECLARATION
-class CSocketsWriter : public CActive, public MTimeOutNotifier
-    {
-    public:
-
-        static CSocketsWriter* NewL( MSocketObserver& aEngineNotifier,
-                                     RSocket& aSocket );
-        virtual ~CSocketsWriter();
-
-        /**
-         * Add data to iTransferBuffer and start sending if not already sending
-         * Leaves with KErrOverflow, if there is not enough free space.
-         * This can be called as long as there is space in buffer.
-         */
-        void SendL(const TDesC8& aData);
-
-        void CancelSending();
-
-        /**
-        * Return number of bytes that can be added to iTransferBuffer.
-        */
-        TInt FreeSpaceInSendBuffer();
-
-        TInt SendBufferMaxSize();
-
-    protected: // from CActive
-
-        void DoCancel();
-        void RunL();
-
-    protected: // from MTimeOutNotifier
-
-        void TimerExpired();
-
-    private: // Constructors and destructors
-
-        CSocketsWriter( MSocketObserver& aEngineNotifier, RSocket& aSocket );
-        void ConstructL();
-
-    private: // New functions
-
-        void SendNextPacket();
-
-    private: // Enumerations
-
-        enum TWriteState
-            {
-            ESending,
-            EIdle // nothing to be sent
-            };
-
-    private: // Data
-
-        RSocket& iSocket;
-        MSocketObserver& iObserver;
-        TBuf8<KTransferBufferSize> iTransferBuffer;
-        TBuf8<KSocketWriteBufferSize> iWriteBuffer;
-        CTimeOutTimer* iTimer;
-        TInt iTimeOut; // microseconds
-        TWriteState iWriteStatus;
-    };
-
-#endif // __SOCKETSWRITER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/staticarrayc.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Templated class for using static arrays.
-*
-*/
-
-
-#ifndef __STATIC_ARRAY_C_H__
-#define __STATIC_ARRAY_C_H__
-
-
-// CLASS DECLARATIONS
-
-/**
-* TStaticArrayC
-* This templated class provides a type, and size, safe method of
-* using static arrays.
-*/
-template <class T>
-class TStaticArrayC
-    {
-    public:     // enumerations
-
-        /**
-        * operator[]
-        * Return an element from the array.
-        * @param aIndex the index of the element to return
-        * @return a reference to the object
-        */
-        inline const T& operator[]( TInt aIndex ) const;
-
-        /**
-        * TPanicCode
-        * Panic code
-        * EIndexOutOfBounds index is out of bounds
-        */
-        enum TPanicCode
-            {
-                EIndexOutOfBounds = 1
-            };
-
-        /**
-        * Panic
-        * Generate a panic.
-        * @param aPanicCode the reason code for the panic
-        */
-        inline void Panic( TPanicCode aPanicCode ) const;
-
-    public:     // data
-
-        /** iArray the arrat of elements */
-        const T* iArray;
-
-        /** iCount the number of elements */
-        TInt iCount;
-
-    };
-
-// INCLUDES
-#include "staticarrayc.inl"
-
-/**
-* CONSTRUCT_STATIC_ARRAY_C
-* Initalise a global constant of type TStaticArrayC<>.
-* @param aValue the underlying const array of T
-*/
-#define CONSTRUCT_STATIC_ARRAY_C( aValue ) \
-        {   \
-        aValue,    \
-        sizeof( aValue ) / sizeof( *aValue )  \
-        }  \
-
-#endif //   __STATIC_ARRAY_C_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/staticarrayc.inl	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Inline method implementations of TStaticArrayC.
-*
-*/
-
-
-// CONSTANTS
-_LIT( KStaticArrayPanic,"StaticArray" );
-
-template <class T>
-inline const T& TStaticArrayC<T>::operator[]( TInt aIndex ) const
-    {
-    if ( ( aIndex >= iCount ) || ( aIndex < 0 ) )
-        {
-        Panic( EIndexOutOfBounds );
-        }
-
-    return  iArray[aIndex];
-    }
-
-template <class T>
-inline void TStaticArrayC<T>::Panic( TPanicCode aPanicCode ) const
-    {
-    User::Panic( KStaticArrayPanic, aPanicCode );
-    }
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/timeoutnotifier.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Interface for timeout notification.
-*
-*/
-
-
-#ifndef __TIMEOUTNOTIFIER_H__
-#define __TIMEOUTNOTIFIER_H__
-
-// CLASS DECLARATION
-
-class MTimeOutNotifier
-    {
-    public: // New functions
-
-        /**
-        * The function to be called when a timeout occurs.
-        */
-        virtual void TimerExpired() = 0;
-    };
-
-#endif // __TIMEOUTNOTIFIER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/inc/timeouttimer.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Timer.
-*
-*/
-
-
-#ifndef __TIMEOUTTIMER_H__
-#define __TIMEOUTTIMER_H__
-
-// INCLUDES
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-class MTimeOutNotifier;
-
-// CLASS DECLARATION
-class CTimeOutTimer : public CTimer
-    {
-    public: // Constructors and destructors
-
-        static CTimeOutTimer* NewL( const TInt aPriority,
-                                    MTimeOutNotifier& aObserver);
-        virtual ~CTimeOutTimer();
-
-    protected: // Functions from base classes
-
-        void RunL();
-
-    private: // Constructors and destructors
-
-        CTimeOutTimer( const TInt aPriority,
-                       MTimeOutNotifier& aTimeOutNotify );
-        void ConstructL();
-
-    private: // Data
-
-        MTimeOutNotifier& iObserver;
-    };
-
-#endif // __TIMEOUTTIMER_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/BtSerialClient.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,440 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Bluetooth serial client.
-*
-*/
-
-
-// INCLUDE FILES
-#include <e32std.h>
-#include <btengsettings.h>  // CBTEngSettings
-
-#include "BtSerialClient.h"
-#include "messageservicesearcher.h"
-#include "BtSerialEngine.pan"
-#include "HtiBtEngineLogging.h"
-#include "socketswriter.h"
-#include "socketsreader.h"
-
-const TInt KMaxBtStartWaitLoop   = 5;
-const TInt KBtStateQueryInterval = 1000000; // microseconds
-
-
-// ----------------------------------------------------------------------------
-EXPORT_C CBtSerialClient* CBtSerialClient::NewL(MBtSerialClientObserver& aObserver)
-    {
-    CBtSerialClient* self = new (ELeave) CBtSerialClient(aObserver);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-CBtSerialClient::CBtSerialClient(MBtSerialClientObserver& aObserver)
-: CActive( CActive::EPriorityStandard ), iObserver(aObserver),
-  iState( EWaitingToGetDevice ), iCurrentServiceIndex( 0 )
-    {
-    CActiveScheduler::Add( this );
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C CBtSerialClient::~CBtSerialClient()
-    {
-    delete iSocketReader;
-    delete iSocketWriter;
-
-    Cancel();
-
-    iSocket.Close();
-    iSocketServer.Close();
-
-    delete iServiceSearcher;
-    }
-
-// ----------------------------------------------------------------------------
-void CBtSerialClient::ConstructL()
-    {
-    LOG_D( "CBtSerialClient::ConstructL()" );
-
-   // Check Bluetooth power state
-    TBTPowerStateValue powerState = EBTPowerOff;
-    CBTEngSettings* btSettings = CBTEngSettings::NewLC();
-    TInt err = btSettings->GetPowerState( powerState );
-    if ( err )
-        {
-        LOGFMT_W( "CBtSerialClient::ConstructL(): GetPowerState error %d", err );
-        powerState = EBTPowerOff;
-        }
-
-    // If BT not on - try to set it on
-    if ( powerState == EBTPowerOff )
-        {
-        LOG_I( "CBtSerialClient::ConstructL(): BT not on - setting power on" );
-        err = btSettings->SetPowerState( EBTPowerOn );
-        if ( err )
-            {
-            LOGFMT_E( "CBtSerialClient::ConstructL(): SetPowerState error %d", err );
-            User::Leave( err );
-            }
-
-        // Wait until BT is reported to be on (or waiting time exceeds)
-        TInt loopCounter = 0;
-        while ( powerState == EBTPowerOff && loopCounter < KMaxBtStartWaitLoop )
-            {
-            btSettings->GetPowerState( powerState );
-            LOGFMT_D( "CBtSerialClient::ConstructL(): BT power state %d", powerState );
-            User::After( KBtStateQueryInterval );
-            loopCounter++;
-            }
-
-        if ( powerState == EBTPowerOff )
-            {
-            LOG_E( "CBtSerialClient::ConstructL(): Could not turn BT on" );
-            User::Leave( KErrCouldNotConnect );
-            }
-        LOG_I( "CBtSerialClient::ConstructL(): Continuing BT connect" );
-        }
-    CleanupStack::PopAndDestroy(); // btSettings
-
-    iServiceSearcher = CMessageServiceSearcher::NewL();
-    User::LeaveIfError( iSocketServer.Connect() );
-    iSocketReader = CSocketsReader::NewL( *this, iSocket );
-    iSocketWriter = CSocketsWriter::NewL( *this, iSocket );
-    }
-
-// ----------------------------------------------------------------------------
-void CBtSerialClient::DoCancel()
-    {
-    LOG_W("CBtSerialClient::DoCancel(): Doing nothing");
-    }
-
-// ----------------------------------------------------------------------------
-void CBtSerialClient::RunL()
-    {
-    if ( iStatus != KErrNone )
-        {
-        switch ( iState )
-            {
-            case EGettingDevice:
-                if ( iStatus == KErrCancel )
-                    {
-                    LOG_W( "CBtSerialClient: No device selected" );
-                    }
-                iState = EWaitingToGetDevice;
-                iObserver.ConnectedToServer( iStatus.Int() );
-                break;
-            case EGettingService:
-                LOGFMT_W( "CBtSerialClient: Failed to fetch remote service: %d", iStatus.Int() );
-                iObserver.ConnectedToServer( iStatus.Int() );
-                iState = EWaitingToGetDevice;
-                break;
-            case EGettingConnection:
-                LOGFMT_W( "CBtSerialClient: Failed to connect to remote service: %d", iStatus.Int() );
-                if ( iCurrentServiceIndex < iServiceSearcher->ServiceCount() )
-                    {
-                    // Try another service
-                    iCurrentServiceIndex++;
-                    ConnectToServerL(); // establish RFComm connection
-                    }
-                else
-                    {
-                    iState = EWaitingToGetDevice;
-                    iObserver.ConnectedToServer( iStatus.Int() );
-                    }
-                break;
-            case EConnected:
-                LOGFMT_I( "CBtSerialClient: Lost connection: %d", iStatus.Int() )
-                DisconnectFromServer();
-                iState = EDisconnecting;
-                break;
-            case EDisconnecting:
-                LOGFMT_I("CBtSerialClient: Disconnected from server: %d", iStatus.Int() );
-                iSocket.Close();
-                iState = EWaitingToGetDevice;
-                iObserver.DisconnectedFromServer();
-                break;
-            default:
-                Panic( EBTPointToPointInvalidLogicState );
-                break;
-            }
-        }
-    else // iStatus = KErrNone
-        {
-        switch ( iState )
-            {
-            case EGettingDevice:
-                // found a device now search for a suitable service
-                LOGFMT_I("CBtSerialClient: Found device: %S. Finding correct service.", &(iServiceSearcher->ResponseParams().DeviceName()) );
-                iState = EGettingService;
-                iStatus = KRequestPending;  // this means that the RunL can not
-                                            // be called until this program
-                                            // does something to iStatus
-                iBTServerDevice = iServiceSearcher->BTDevAddr();
-                iServiceSearcher->FindServiceL( iBTServerDevice, iStatus );
-                SetActive();
-                break;
-            case EGettingService:
-                LOGFMT_I("CBtSerialClient: Found %d remote services", iServiceSearcher->ServiceCount());
-                iState = EGettingConnection;
-                ConnectToServerL(); // establish RFComm connection
-                break;
-            case EGettingConnection:
-                LOG_I( "CBtSerialClient: Connected to remote service" );
-                iState = EConnected;
-                iObserver.ConnectedToServer( KErrNone );
-                break;
-            case EDisconnecting:
-                LOG_I( "CBtSerialClient: Disconnecting" );
-                iSocket.Close();
-                iState = EWaitingToGetDevice;
-                iObserver.DisconnectedFromServer();
-                break;
-            default:
-                LOGFMT_E( "CBtSerialClient: Invalid logic state in RunL: %d. Will panic", iState );
-                Panic( EBTPointToPointInvalidLogicState );
-                break;
-            };
-        }
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C void CBtSerialClient::ConnectL()
-    {
-    if ( iState == EWaitingToGetDevice && !IsActive() )
-        {
-        LOG_D( "CBtSerialClient: Connecting by user selection" );
-        iState = EGettingDevice;
-        iServiceSearcher->SelectDeviceByDiscoveryL( iStatus );
-        SetActive();
-        }
-    else
-        {
-        LOG_W( "CBtSerialClient: Already connecting or connected" );
-        User::Leave( KErrInUse );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C void CBtSerialClient::ConnectL( const TBTDevAddr aBTServerDevice,
-                                         const TInt aPort )
-    {
-    if ( iState == EWaitingToGetDevice && !IsActive() )
-        {
-        if ( aPort >= 0 )
-            {
-            // If there was a valid port given, add it as the first port to try
-            iServiceSearcher->AppendPort( aPort );
-            }
-        LOG_D( "CBtSerialClient: Connecting by address" );
-        iBTServerDevice = aBTServerDevice;
-        iServiceSearcher->FindServiceL( iBTServerDevice, iStatus );
-        iState = EGettingService;
-        iStatus = KRequestPending;  // this means that the RunL can not
-                                    // be called until this program
-                                    // does something to iStatus
-        SetActive();
-        }
-    else
-        {
-        LOG_W("CBtSerialClient: Already connecting or connected");
-        User::Leave( KErrInUse );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C void CBtSerialClient::ConnectL( const TDesC& aBTServerDeviceName,
-                                         const TInt aPort )
-    {
-    if ( iState == EWaitingToGetDevice && !IsActive() )
-        {
-        if ( aPort >= 0 )
-            {
-            // If there was a valid port given, add it as the first port to try
-            iServiceSearcher->AppendPort( aPort );
-            }
-        LOG_D( "CBtSerialClient: Connecting by name" );
-        iState = EGettingDevice;
-        iServiceSearcher->SelectDeviceByNameL( aBTServerDeviceName, iStatus );
-        SetActive();
-        }
-    else
-        {
-        LOG_W( "CBtSerialClient: Already connecting or connected" );
-        User::Leave( KErrInUse );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C TBTDevAddr CBtSerialClient::ServerAddressL()
-    {
-    if ( !Connected() )
-        {
-        User::Leave( KErrNotReady );
-        }
-    return iBTServerDevice;
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C void CBtSerialClient::Disconnect()
-    {
-    if ( iState == EConnected )
-        {
-        DisconnectFromServer();
-        iState = EDisconnecting;
-        }
-    else
-        {
-        LOG_W( "CBtSerialClient: Disconnect: Not connected" );
-        User::Leave( KErrDisconnected );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-void CBtSerialClient::DisconnectFromServer()
-    {
-    // Terminate all operations
-    iSocket.CancelAll();
-    Cancel();
-    iSocketReader->Cancel();
-    iSocketWriter->CancelSending();
-
-    LOG_I( "CBtSerialClient: Disconnecting from server" );
-    iSocket.Shutdown( RSocket::ENormal, iStatus );
-    SetActive();
-    }
-
-// ----------------------------------------------------------------------------
-void CBtSerialClient::ConnectToServerL()
-    {
-    LOG_I("CBtSerialClient: ConnectToServerL")
-    User::LeaveIfError( iSocket.Open( iSocketServer, KStrRFCOMM ) );
-
-    TBTSockAddr address;
-    address.SetBTAddr( iServiceSearcher->BTDevAddr() );
-    address.SetPort( iServiceSearcher->Port( iCurrentServiceIndex ) );
-
-    LOGFMT_I("CBtSerialClient: ConnectToServerL: Port = %d", address.Port() );
-    iSocket.Connect( address, iStatus );
-
-#ifdef __WINS__
-    User::After( 1 ); // Needed to allow emulator client to connect to server
-#endif
-
-    SetActive();
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C void CBtSerialClient::SendL(const TDesC8& aData)
-    {
-    if ( !Connected() )
-        {
-        User::Leave( KErrNotReady );
-        }
-
-    LOGFMT_D("CBtSerialClient::SendL: Sending data (max first 32 bytes): \"%S\"", &(aData.Left(32)));
-    iSocketWriter->SendL( aData ); // Add to data queue and start sending
-    LOG_D("CBtSerialClient::SendL: Sent to socket");
-    }
-
-EXPORT_C void CBtSerialClient::ReadAsyncL()
-    {
-    if ( !Connected() )
-        {
-        User::Leave( KErrNotReady );
-        }
-    iSocketReader->ReadAsync();
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C TInt CBtSerialClient::FreeSpaceInSendBuffer()
-    {
-    return iSocketWriter->FreeSpaceInSendBuffer();
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C TInt CBtSerialClient::SendBufferMaxSize()
-    {
-    return iSocketWriter->SendBufferMaxSize();
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C TBool CBtSerialClient::Connected()
-    {
-    return (iState == EConnected);
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C TBool CBtSerialClient::Connecting()
-    {
-    return ( ( iState == EGettingDevice ) ||
-             ( iState == EGettingService ) ||
-             ( iState == EGettingConnection ) );
-    }
-
-// ----------------------------------------------------------------------------
-EXPORT_C TInt CBtSerialClient::ServicePort()
-    {
-    if ( !Connected() )
-        {
-        return KErrDisconnected;
-        }
-    return iServiceSearcher->Port( iCurrentServiceIndex );
-    }
-
-// ----------------------------------------------------------------------------
-void CBtSerialClient::ReportError( TErrorType aErrorType, TInt aErrorCode )
-    {
-    LOGFMT_W( "CBtSerialClient::ReportError: %d", aErrorCode );
-    // From socket reader or writer
-    switch ( aErrorType )
-        {
-        case EDisconnected:
-            {
-            LOG_I( "CBtSerialClient: disconnected" );
-            }
-            break;
-        case ETimeOutOnWrite:
-            {
-            LOG_I( "CBtSerialClient: timout writing data. Disconnecting from server" );
-            }
-            break;
-        case EGeneralReadError:
-            {
-            LOG_I( "CBtSerialClient: general read error. Disconnecting from server" );
-            }
-            break;
-        case EGeneralWriteError:
-            {
-            LOG_I( "CBtSerialClient: general write error. Disconnecting from server" );
-            }
-            break;
-        }
-    Disconnect();
-    aErrorCode = aErrorCode;
-    }
-
-// ----------------------------------------------------------------------------
- void CBtSerialClient::NewData( const TDesC8& aData )
-    {
-    iObserver.DataFromServer( aData );
-    }
-
-// ----------------------------------------------------------------------------
-void CBtSerialClient::AllBufferedDataSent()
-    {
-    iObserver.AllBufferedDataSent();
-    }
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/btservicesearcher.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,382 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Bluetooth service searcher.
-*
-*/
-
-
-// INCLUDE FILES
-#include "btservicesearcher.h"
-#include "btservicesearcher.pan"
-
-#include "HtiBtEngineLogging.h"
-
-// ============================ MEMBER FUNCTIONS ==============================
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::CBTServiceSearcher()
-// Constructor.
-// ----------------------------------------------------------------------------
-//
-CBTServiceSearcher::CBTServiceSearcher()
-:  iIsDeviceSelectorConnected( EFalse )
-    {
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::~CBTServiceSearcher()
-// Destructor.
-// ----------------------------------------------------------------------------
-//
-CBTServiceSearcher::~CBTServiceSearcher()
-    {
-    if ( iIsDeviceSelectorConnected )
-        {
-        iDeviceSelector.CancelNotifier( KDeviceSelectionNotifierUid );
-        iDeviceSelector.Close();
-        }
-    delete iSdpSearchPattern;
-    iSdpSearchPattern = NULL;
-
-    delete iAgent;
-    iAgent = NULL;
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::SelectDeviceByDiscoveryL()
-// Select a device.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::SelectDeviceByDiscoveryL(
-        TRequestStatus& aObserverRequestStatus )
-    {
-    if ( ! iIsDeviceSelectorConnected )
-        {
-        User::LeaveIfError( iDeviceSelector.Connect() );
-        iIsDeviceSelectorConnected = ETrue;
-        }
-
-    iSelectionFilter().SetUUID( ServiceClass() );
-
-    iDeviceSelector.StartNotifierAndGetResponse(
-        aObserverRequestStatus,
-        KDeviceSelectionNotifierUid,
-        iSelectionFilter,
-        iResponse );
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::SelectDeviceByNameL()
-// Select a device by BT device name.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::SelectDeviceByNameL( const TDesC& aDeviceName,
-        TRequestStatus& aObserverRequestStatus )
-    {
-    LOG_D( "CBTServiceSearcher::SelectDeviceByNameL" );
-
-    RSocketServ socketServ;
-    User::LeaveIfError( socketServ.Connect() );
-    CleanupClosePushL( socketServ );
-
-    TProtocolDesc pInfo;
-    _LIT( KL2Cap, "BTLinkManager" );
-    User::LeaveIfError(
-        socketServ.FindProtocol( TProtocolName( KL2Cap ), pInfo ) );
-
-    LOG_D( "CBTServiceSearcher: Found protocol" );
-
-    RHostResolver hr;
-    User::LeaveIfError( hr.Open( socketServ,
-                            pInfo.iAddrFamily, pInfo.iProtocol ) );
-    CleanupClosePushL( hr );
-
-    LOG_D( "CBTServiceSearcher: HostResolver open" );
-
-    TInquirySockAddr addr;
-    TNameEntry entry;
-    addr.SetIAC( KGIAC );
-    addr.SetAction( KHostResName | KHostResInquiry );
-
-    User::LeaveIfError( hr.GetByAddress( addr, entry ) );
-    LOG_D( "CBTServiceSearcher: GetByAddress ok" );
-    TBool isFound = EFalse;
-    TInt err = KErrNone;
-    while ( !isFound && !err )
-        {
-        if ( !aDeviceName.CompareF( entry().iName ) )
-            {
-            LOG_D( "CBTServiceSearcher: Name match" );
-            isFound = ETrue;
-            }
-        else
-            {
-            LOG_D( "CBTServiceSearcher: Not match - getting next" );
-            err = hr.Next( entry );
-            }
-        }
-    CleanupStack::PopAndDestroy( 2 ); // hr, socketServ
-
-    iStatusObserver = &aObserverRequestStatus;
-
-    if ( isFound )
-        {
-        TInquirySockAddr& sa = TInquirySockAddr::Cast( entry().iAddr );
-        iResponse().SetDeviceAddress( sa.BTAddr() );
-        iResponse().SetDeviceName( entry().iName );
-        TBTDeviceClass deviceClass( sa.MajorServiceClass(),
-                                    sa.MajorClassOfDevice(),
-                                    sa.MinorClassOfDevice() );
-        iResponse().SetDeviceClass( deviceClass );
-        User::RequestComplete( iStatusObserver, KErrNone );
-        }
-
-    else
-        {
-        LOG_E( "CBTServiceSearcher: Device not found! Can't connect!" );
-        User::RequestComplete( iStatusObserver, err );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::FindServiceL()
-// Find a service on the specified device.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::FindServiceL( const TBTDevAddr& aDeviceAddress,
-    TRequestStatus& aObserverRequestStatus )
-    {
-    iResponse().SetDeviceAddress( aDeviceAddress );
-    if ( !iResponse().IsValidBDAddr() )
-        {
-        User::Leave( KErrArgument );
-        }
-    iHasFoundService = EFalse;
-
-    // delete any existing agent and search pattern
-    delete iSdpSearchPattern;
-    iSdpSearchPattern = NULL;
-
-    delete iAgent;
-    iAgent = NULL;
-
-    iAgent = CSdpAgent::NewL(*this, BTDevAddr());
-
-    iSdpSearchPattern = CSdpSearchPattern::NewL();
-
-    iSdpSearchPattern->AddL( ServiceClass() );
-    // return code is the position in the list that the UUID is inserted at
-    // and is intentionally ignored
-
-    iAgent->SetRecordFilterL( *iSdpSearchPattern );
-
-    iStatusObserver = &aObserverRequestStatus;
-
-    iAgent->NextRecordRequestL();
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::NextRecordRequestComplete()
-// Process the result of the next record request.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::NextRecordRequestComplete(
-    TInt aError,
-    TSdpServRecordHandle aHandle,
-    TInt aTotalRecordsCount)
-    {
-    TRAPD( error,
-           NextRecordRequestCompleteL( aError, aHandle, aTotalRecordsCount );
-    );
-
-    if ( error != KErrNone )
-        {
-        Panic( EBTServiceSearcherNextRecordRequestComplete );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::NextRecordRequestCompleteL()
-// Process the result of the next record request.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::NextRecordRequestCompleteL(
-    TInt aError,
-    TSdpServRecordHandle aHandle,
-    TInt aTotalRecordsCount )
-    {
-    if ( aError == KErrEof )
-        {
-        Finished();
-        return;
-        }
-
-    if ( aError != KErrNone )
-        {
-        LOGFMT_E("CBTServiceSearcher: NextRecordRequestCompleteL: %d", aError );
-        Finished( aError );
-        return;
-        }
-
-    if ( aTotalRecordsCount == 0 )
-        {
-        LOG_I("CBTServiceSearcher: NextRecordRequestCompleteL: No records found");
-        Finished( KErrNotFound );
-        return;
-        }
-
-    //  Request its attributes
-    iAgent->AttributeRequestL( aHandle, KSdpAttrIdProtocolDescriptorList );
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::AttributeRequestResult()
-// Process the next attribute requested.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::AttributeRequestResult(
-    TSdpServRecordHandle aHandle,
-    TSdpAttributeID aAttrID,
-    CSdpAttrValue* aAttrValue )
-    {
-    TRAPD( error,
-         AttributeRequestResultL( aHandle, aAttrID, aAttrValue );
-         );
-    if ( error != KErrNone )
-        {
-        Panic( EBTServiceSearcherAttributeRequestResult );
-        }
-
-    // Delete obsolete local atribute pointer.
-    delete aAttrValue;
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::AttributeRequestResultL()
-// Process the next attribute requested.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::AttributeRequestResultL(
-    TSdpServRecordHandle /*aHandle*/,
-    TSdpAttributeID aAttrID,
-    CSdpAttrValue* aAttrValue )
-    {
-    __ASSERT_ALWAYS( aAttrID == KSdpAttrIdProtocolDescriptorList,
-                     User::Leave( KErrNotFound ) );
-
-    TSdpAttributeParser parser( ProtocolList(), *this );
-
-    // Validate the attribute value, and extract the RFCOMM channel
-    aAttrValue->AcceptVisitorL( parser );
-
-    if ( parser.HasFinished() )
-        {
-        // Found a suitable record so change state
-        iHasFoundService = ETrue;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CBTServiceSearcher::AttributeRequestComplete()
-// Process the attribute request completion.
-// -----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::AttributeRequestComplete( TSdpServRecordHandle aHandle,
-                                                   TInt aError )
-    {
-    TRAPD( error,
-        AttributeRequestCompleteL( aHandle, aError );
-    );
-    if ( error != KErrNone )
-        {
-        Panic( EBTServiceSearcherAttributeRequestComplete );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::AttributeRequestCompleteL()
-// Process the attribute request completion.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::AttributeRequestCompleteL( TSdpServRecordHandle
-                                                    /*aHandle*/,
-                                                    TInt aError )
-    {
-    if ( aError != KErrNone )
-        {
-        LOGFMT_W("CBTServiceSearcher::AttributeRequestCompleteL: %d", aError);
-        }
-    else
-        {
-        // done with attributes of this service record, request next
-        iAgent->NextRecordRequestL();
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::Finished()
-// The search has finished and notify the observer
-// that the process is complete.
-// ----------------------------------------------------------------------------
-//
-void CBTServiceSearcher::Finished( TInt aError /* default = KErrNone */ )
-    {
-    if ( aError == KErrNone && !HasFoundService() )
-        {
-        aError = KErrNotFound;
-        }
-    User::RequestComplete( iStatusObserver, aError );
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::HasFinishedSearching()
-// Is the instance still wanting to search.
-// ----------------------------------------------------------------------------
-//
-TBool CBTServiceSearcher::HasFinishedSearching() const
-    {
-    return EFalse;
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::BTDevAddr()
-// Returns the bluetooth device address.
-// ----------------------------------------------------------------------------
-//
-const TBTDevAddr& CBTServiceSearcher::BTDevAddr()
-    {
-    return iResponse().BDAddr();
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::ResponseParams()
-// Returns information about the device selected by the user.
-// ----------------------------------------------------------------------------
-//
-const TBTDeviceResponseParams& CBTServiceSearcher::ResponseParams()
-    {
-    return iResponse();
-    }
-
-// ----------------------------------------------------------------------------
-// CBTServiceSearcher::HasFoundService()
-// True if a service has been found.
-// ----------------------------------------------------------------------------
-//
-TBool CBTServiceSearcher::HasFoundService() const
-    {
-    return iHasFoundService;
-    }
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/messageservicesearcher.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Message service searcher.
-*
-*/
-
-
-// INCLUDE FILES
-#include <bt_sock.h>
-
-#include "messageservicesearcher.h"
-#include "btservicesearcher.pan"
-
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// TSdpAttributeParser::SSdpAttributeNode[]
-// Construct a TSdpAttributeParser.
-// -----------------------------------------------------------------------------
-//
-static const TSdpAttributeParser::SSdpAttributeNode gSerialPortProtocolArray[] =
-    {
-        { TSdpAttributeParser::ECheckType, ETypeDES },
-        { TSdpAttributeParser::ECheckType, ETypeDES },
-        { TSdpAttributeParser::ECheckValue, ETypeUUID, KL2CAP },
-        { TSdpAttributeParser::ECheckEnd },
-        { TSdpAttributeParser::ECheckType, ETypeDES },
-        { TSdpAttributeParser::ECheckValue, ETypeUUID, KRFCOMM }, // KRFCOMM defined in bt_sock.h
-        { TSdpAttributeParser::EReadValue, ETypeUint, KRfcommChannel }, // KRfcommChannel is custom key value used in FoundElementL. If there were more than one value to be read, the key value would be usefull
-        { TSdpAttributeParser::ECheckEnd },
-        { TSdpAttributeParser::ECheckEnd },
-        { TSdpAttributeParser::EFinished }
-    };
-
-// ----------------------------------------------------------------------------
-// TStaticArrayC
-// Provides a type and size, safe method of using static arrays.
-// ----------------------------------------------------------------------------
-//
-static const TStaticArrayC<TSdpAttributeParser
-::SSdpAttributeNode> gSerialPortProtocolList = CONSTRUCT_STATIC_ARRAY_C(
-                                               gSerialPortProtocolArray );
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::NewL()
-// Two-phased constructor.
-// ----------------------------------------------------------------------------
-//
-CMessageServiceSearcher* CMessageServiceSearcher::NewL()
-    {
-    CMessageServiceSearcher* self = CMessageServiceSearcher::NewLC();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::NewLC()
-// Two-phased constructor.
-// ----------------------------------------------------------------------------
-//
-CMessageServiceSearcher* CMessageServiceSearcher::NewLC()
-    {
-    CMessageServiceSearcher* self = new (ELeave) CMessageServiceSearcher();
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::CMessageServiceSearcher()
-// Construcor.
-// ----------------------------------------------------------------------------
-//
-CMessageServiceSearcher::CMessageServiceSearcher()
-: CBTServiceSearcher(),
-  iServiceClass( KServiceClass )
-    {
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::~CMessageServiceSearcher()
-// Destructor.
-// ----------------------------------------------------------------------------
-//
-CMessageServiceSearcher::~CMessageServiceSearcher()
-    {
-    iPortNumbers.Close();
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CMessageServiceSearcher::ConstructL()
-    {
-    // no implementation required
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::ServiceClass()
-// The service class to search.
-// ----------------------------------------------------------------------------
-//
-const TUUID& CMessageServiceSearcher::ServiceClass() const
-    {
-    return iServiceClass;
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::ProtocolList()
-// The list of Protocols required by the service.
-// ----------------------------------------------------------------------------
-//
-const TSdpAttributeParser::TSdpAttributeList& CMessageServiceSearcher
-::ProtocolList() const
-    {
-    return gSerialPortProtocolList;
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::FoundElementL()
-// Read the data element.
-// ----------------------------------------------------------------------------
-//
-void CMessageServiceSearcher::FoundElementL( TInt aKey, CSdpAttrValue& aValue )
-    {
-    __ASSERT_ALWAYS( aKey == static_cast<TInt>( KRfcommChannel ),
-        Panic( EBTServiceSearcherProtocolRead ) );
-    AppendPort( aValue.Uint() );
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::Port()
-// Port connection on the remote machine.
-// ----------------------------------------------------------------------------
-//
-TInt CMessageServiceSearcher::Port( TInt aIndex )
-    {
-    if ( aIndex < 0 || aIndex >= iPortNumbers.Count() )
-        {
-        return KErrNotFound;
-        }
-    return iPortNumbers[aIndex];
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::AppendPort()
-// Adds a new port number to the port number array. If the port number
-// already exists in the array a duplicate is not added.
-// ----------------------------------------------------------------------------
-//
-void CMessageServiceSearcher::AppendPort( TInt aPort )
-    {
-    if ( iPortNumbers.Find( aPort ) == KErrNotFound )
-        {
-        iPortNumbers.Append( aPort );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// CMessageServiceSearcher::ServiceCount()
-// The amount of requested services found from the remote machine.
-// ----------------------------------------------------------------------------
-//
-TInt CMessageServiceSearcher::ServiceCount()
-    {
-    return iPortNumbers.Count();
-    }
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/sdpattributeparser.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Reads selected parts of SDP attribute values.
-*
-*/
-
-
-// INCLUDE FILES
-#include <bt_sock.h>
-
-#include "sdpattributeparser.h"
-#include "sdpattributeparser.pan"
-#include "sdpattributenotifier.h"
-
-// ============================ MEMBER FUNCTIONS ==============================
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::TSdpAttributeParser()
-// Construct a TSdpAttributeParser.
-// ----------------------------------------------------------------------------
-//
-
-TSdpAttributeParser::TSdpAttributeParser(
-    TSdpAttributeList& aNodeList,
-    MSdpAttributeNotifier& aObserver
-)
-:   iObserver( aObserver ),
-    iNodeList( aNodeList ),
-    iCurrentNodeIndex( 0 )
-    {
-    // no implementation required
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::HasFinished()
-// Check if parsing processed the whole list.
-// ----------------------------------------------------------------------------
-//
-TBool TSdpAttributeParser::HasFinished() const
-    {
-    return CurrentNode().iCommand == EFinished;
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::VisitAttributeValueL()
-// Process a data element.
-// ----------------------------------------------------------------------------
-//
-void TSdpAttributeParser::VisitAttributeValueL( CSdpAttrValue& aValue,
-                                                TSdpElementType aType )
-    {
-    switch ( CurrentNode().iCommand )
-        {
-        case ECheckType:
-            CheckTypeL( aType );
-            break;
-
-        case ECheckValue:
-            CheckTypeL( aType );
-            CheckValueL( aValue );
-            break;
-
-        case ECheckEnd:
-            User::Leave( KErrGeneral ); //list element contains too many items
-            break;
-
-        case ESkip:
-            break;  // no checking required
-
-        case EReadValue:
-            CheckTypeL( aType );
-            ReadValueL( aValue );
-            break;
-
-        case EFinished:
-            User::Leave( KErrGeneral ); // element is after
-            return;                     // value should have ended
-
-        default:
-            Panic( ESdpAttributeParserInvalidCommand );
-        }
-
-    AdvanceL();
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::StartListL()
-// Process the start of a data element list.
-// ----------------------------------------------------------------------------
-//
-void TSdpAttributeParser::StartListL( CSdpAttrValueList& /*aList*/ )
-    {
-    // no checks done here
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::EndListL()
-// Process the end of a data element list.
-// ----------------------------------------------------------------------------
-//
-void TSdpAttributeParser::EndListL()
-    {
-    // check we are at the end of a list
-    if ( CurrentNode().iCommand != ECheckEnd )
-        {
-        User::Leave( KErrGeneral );
-        }
-
-    AdvanceL();
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::CheckTypeL()
-// Check the type of the current node is the same as the specified type.
-// ----------------------------------------------------------------------------
-//
-void TSdpAttributeParser::CheckTypeL( TSdpElementType aElementType ) const
-    {
-    if ( CurrentNode().iType != aElementType )
-        {
-        User::Leave( KErrGeneral );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::CheckValueL()
-// Check the value of the current node is the same as the specified type.
-// ----------------------------------------------------------------------------
-//
-void TSdpAttributeParser::CheckValueL( CSdpAttrValue& aValue ) const
-    {
-    switch ( aValue.Type() )
-        {
-        case ETypeNil:
-            Panic( ESdpAttributeParserNoValue );
-            break;
-
-        case ETypeUint:
-            if ( aValue.Uint() != ( TUint )CurrentNode().iValue )
-                {
-                User::Leave( KErrArgument );
-                }
-            break;
-
-        case ETypeInt:
-            if ( aValue.Int() != CurrentNode().iValue )
-                {
-                User::Leave( KErrArgument );
-                }
-            break;
-
-        case ETypeBoolean:
-            if ( aValue.Bool() != CurrentNode().iValue )
-                {
-                User::Leave( KErrArgument );
-                }
-            break;
-
-        case ETypeUUID:
-            if ( aValue.UUID() != TUUID( CurrentNode().iValue ) )
-                {
-                User::Leave( KErrArgument );
-                }
-            break;
-
-        // these are lists, so have to check contents
-        case ETypeDES:
-        case ETypeDEA:
-            Panic( ESdpAttributeParserValueIsList );
-            break;
-
-        // these aren't supported - use EReadValue and leave on error
-        //case ETypeString:
-        //case ETypeURL:
-        //case ETypeEncoded:
-        default:
-            Panic( ESdpAttributeParserValueTypeUnsupported );
-            break;
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::ReadValueL()
-// Pass the data element value to the observer.
-// ----------------------------------------------------------------------------
-//
-void TSdpAttributeParser::ReadValueL( CSdpAttrValue& aValue ) const
-    {
-    iObserver.FoundElementL( CurrentNode().iValue, aValue );
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::CurrentNode()
-// Get the current node.
-// ----------------------------------------------------------------------------
-//
-const TSdpAttributeParser::SSdpAttributeNode& TSdpAttributeParser
-::CurrentNode() const
-    {
-    return  iNodeList[iCurrentNodeIndex];
-    }
-
-// ----------------------------------------------------------------------------
-// TSdpAttributeParser::AdvanceL()
-// Advance to the next node.
-// ----------------------------------------------------------------------------
-//
-void TSdpAttributeParser::AdvanceL()
-    {
-    // check not at end
-    if ( CurrentNode().iCommand == EFinished )
-        {
-        User::Leave( KErrEof );
-        }
-
-    // move to the next item
-    ++iCurrentNodeIndex;
-    }
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/socketsreader.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Reads from socket.
-*
-*/
-
-
-// INCLUDE FILES
-#include "BtSerialEngine.pan"
-#include "socketsreader.h"
-#include "SocketObserver.h"
-
-// -----------------------------------------------------------------------------
-CSocketsReader* CSocketsReader::NewL( MSocketObserver& aEngineNotifier,
-                                      RSocket& aSocket )
-    {
-    CSocketsReader* self = new ( ELeave ) CSocketsReader( aEngineNotifier,
-                                                          aSocket );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-CSocketsReader::CSocketsReader( MSocketObserver& aObserver,
-                                RSocket& aSocket )
-: CActive( EPriorityStandard ),
-  iSocket( aSocket ),
-  iObserver( aObserver )
-    {
-    // No implementation required
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsReader::ConstructL()
-    {
-    CActiveScheduler::Add( this );
-    }
-
-// -----------------------------------------------------------------------------
-CSocketsReader::~CSocketsReader()
-    {
-    Cancel();
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsReader::DoCancel()
-    {
-    // Cancel asychronous read request
-    iSocket.CancelRead();
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsReader::RunL()
-    {
-    switch ( iStatus.Int() )
-        {
-        case KErrNone:
-            iObserver.NewData(iBuffer);
-//            IssueRead(); // Immediately start another read
-            break;
-        case KErrDisconnected:
-            iObserver.ReportError( MSocketObserver::EDisconnected,
-                                   iStatus.Int() );
-            break;
-        default:
-            iObserver.ReportError( MSocketObserver::EGeneralReadError,
-                                   iStatus.Int() );
-            break;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsReader::IssueRead()
-    {
-    // Initiate a new read from socket into iBuffer
-    __ASSERT_ALWAYS( !IsActive(), Panic(EBTSerialEngineReadSocketBadState) );
-    iSocket.RecvOneOrMore( iBuffer, 0, iStatus, iLen );
-    SetActive();
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsReader::ReadAsync()
-    {
-    // Initiate a new read from socket into iBuffer
-    if (!IsActive())
-        {
-        IssueRead();
-        }
-    }
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/socketswriter.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Writes to socket.
-*
-*/
-
-
-// INCLUDE FILES
-#include "socketswriter.h"
-#include "timeouttimer.h"
-#include "BtSerialEngine.pan"
-#include "SocketObserver.h"
-#include "HtiBtEngineLogging.h"
-
-// STATIC MEMBER INITIALISATIONS
-const TInt KTimeOut = 10 * 1000 * 1000; // 10 seconds time-out
-
-// ========================= MEMBER FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-CSocketsWriter* CSocketsWriter::NewL( MSocketObserver& aEngineNotifier,
-                                      RSocket& aSocket )
-    {
-    CSocketsWriter* self = new ( ELeave ) CSocketsWriter( aEngineNotifier,
-                                                          aSocket );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-CSocketsWriter::CSocketsWriter( MSocketObserver& aEngineNotifier,
-                                RSocket& aSocket )
-: CActive( EPriorityStandard ),
-  iSocket( aSocket ),
-  iObserver( aEngineNotifier )
-    {
-    // No implementation required
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsWriter::ConstructL()
-    {
-    CActiveScheduler::Add( this );
-    iTimeOut = KTimeOut;
-    iTimer = CTimeOutTimer::NewL( CActive::EPriorityUserInput, *this );
-    iWriteStatus = EIdle;
-    }
-
-// -----------------------------------------------------------------------------
-CSocketsWriter::~CSocketsWriter()
-    {
-    CancelSending();
-    delete iTimer;
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsWriter::DoCancel()
-    {
-    // Cancel asychronous write request
-    iSocket.CancelWrite();
-    iTimer->Cancel();
-    iWriteStatus = EIdle;
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsWriter::RunL()
-    {
-    iTimer->Cancel();
-
-    // Active object request complete handler
-    if ( iStatus == KErrNone )
-        {
-        switch ( iWriteStatus )
-            {
-            // Character has been written to socket
-            case ESending:
-                SendNextPacket();
-                break;
-            default:
-                LOGFMT_E( "CSocketsWriter: Bad write status: %d", iWriteStatus )
-                Panic( EBTSerialEngineWriteSocketBadState );
-                break;
-            };
-        }
-    else
-        {
-        iWriteStatus = EIdle;
-        iWriteBuffer.Zero();
-        iTransferBuffer.Zero();
-        iObserver.ReportError( MSocketObserver::EGeneralWriteError,
-                                     iStatus.Int() );
-        }
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsWriter::TimerExpired()
-    {
-    Cancel();
-    iWriteStatus = EIdle;
-    iObserver.ReportError( MSocketObserver::ETimeOutOnWrite,
-                                 KErrTimedOut );
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsWriter::SendL(const TDesC8& aData)
-    {
-    if ( aData.Length() > FreeSpaceInSendBuffer() )
-        User::Leave( KErrOverflow );
-
-    iTransferBuffer.Append( aData );
-    SendNextPacket();
-    }
-
-// -----------------------------------------------------------------------------
-TInt CSocketsWriter::FreeSpaceInSendBuffer()
-    {
-    return iTransferBuffer.MaxSize() - iTransferBuffer.Size();
-    }
-
-// -----------------------------------------------------------------------------
-TInt CSocketsWriter::SendBufferMaxSize()
-    {
-    return iTransferBuffer.MaxLength();
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsWriter::SendNextPacket()
-    {
-    if ( IsActive() )
-        {
-        return; // already sending
-        }
-    if ( iTransferBuffer.Length() > 0 )
-        {
-        // Move data from transfer buffer to actual write buffer
-        iWriteBuffer.Copy(iTransferBuffer.Left(iWriteBuffer.MaxLength()));
-        iTransferBuffer.Delete(0, iWriteBuffer.MaxLength());
-        iSocket.Write( iWriteBuffer, iStatus ); // Initiate actual write
-
-        iWriteStatus = ESending;
-        iTimer->After( iTimeOut );
-        SetActive();
-        }
-    else
-        {
-        iWriteStatus = EIdle;
-        iObserver.AllBufferedDataSent();
-        }
-    }
-
-// -----------------------------------------------------------------------------
-void CSocketsWriter::CancelSending()
-    {
-    Cancel();
-    iWriteBuffer.Zero();
-    iTransferBuffer.Zero();
-    }
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/BtEngine/src/timeouttimer.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Timer.
-*
-*/
-
-
-// INCLUDE FILES
-#include "timeouttimer.h"
-#include "timeoutnotifier.h"
-#include "HtiBtEngineLogging.h"
-
-// -----------------------------------------------------------------------------
-CTimeOutTimer* CTimeOutTimer::NewL( const TInt aPriority,
-                                    MTimeOutNotifier& aTimeOutNotify )
-    {
-    CTimeOutTimer* self = new ( ELeave ) CTimeOutTimer( aPriority,
-                                                        aTimeOutNotify );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-// -----------------------------------------------------------------------------
-CTimeOutTimer::CTimeOutTimer( const TInt aPriority,
-                              MTimeOutNotifier& aObserver )
-: CTimer( aPriority ), iObserver( aObserver )
-    {
-    // No implementation required
-    }
-
-// -----------------------------------------------------------------------------
-void CTimeOutTimer::ConstructL()
-    {
-    CTimer::ConstructL();
-    CActiveScheduler::Add( this );
-    }
-
-// -----------------------------------------------------------------------------
-CTimeOutTimer::~CTimeOutTimer()
-    {
-    // No implementation required
-    }
-
-// -----------------------------------------------------------------------------
-void CTimeOutTimer::RunL()
-    {
-    // Timer request has completed, so notify the timer's owner
-    if ( iStatus == KErrNone )
-        {
-        iObserver.TimerExpired();
-        }
-    else
-        {
-        LOGFMT_E("CTimeOutTimer: bad completion code: %d", iStatus.Int())
-        }
-    }
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/data/200212CB.rss	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Resource definitions for HtiBtComm ECOM plugin.
-*
-*/
-
-
-// INCLUDES
-#include <ecom/registryinfo.rh>
-
-
-//  RESOURCE DEFINITIONS
-RESOURCE REGISTRY_INFO theInfo
-    {
-    // UID for the DLL
-    dll_uid = 0x200212CB;
-    // Declare array of interface info
-    interfaces =
-        {
-        INTERFACE_INFO
-            {
-            // UID of interface that is implemented
-            interface_uid = 0x1020DEB8;
-            implementations =
-                {
-                IMPLEMENTATION_INFO
-                    {
-                    implementation_uid = 0x200212CC;
-                    version_no         = 1;
-                    display_name       = "Bt serial comm";
-                    default_data       = "BTSERIAL";
-                    opaque_data        = "";
-                    }
-                };
-            }
-        };
-    }
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/inc/HtiBtCommEcomPlugin.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ECOM plugin to communicate over BT serial port
-*
-*/
-
-
-#ifndef CHTIBTCOMMECOMPLUGIN_H
-#define CHTIBTCOMMECOMPLUGIN_H
-
-class CBtSerialClient;
-
-// INCLUDES
-#include <c32comm.h>
-#include <HtiCommPluginInterface.h> // defined in HtiFramework project
-
-#include "HtiBtCommInterface.h" // RHtiBtCommInterface
-
-// FORWARD DECLARATIONS
-class CHtiCfg;
-
-// CLASS DECLARATION
-/**
-* ECOM plugin module for communicating with PC using serial port.
-*
-*/
-class CHtiBtCommEcomPlugin :
-    public CHTICommPluginInterface
-    {
-public:
-
-    /**
-    * Create instance of plugin.
-    * @return Connected plugin instance.
-    */
-    static CHtiBtCommEcomPlugin* NewL();
-
-    /**
-    * Destructor
-    */
-    ~CHtiBtCommEcomPlugin();
-
-public: // CHTICommPluginInterface interface implementation
-
-    /**
-    * Receive data from Bluetooth.
-    * The size of supplied buffer must equal to size given by GetBufferSize.
-    * The number of received bytes may be anything between 1 and GetBufferSize.
-    *
-    * @param aRawdataBuf Buffer where the result is written
-    * @param aStatus Request status
-    */
-    void Receive( TDes8& aRawdataBuf, TRequestStatus& aStatus );
-
-    /**
-    * Send data to Bluetooth. The size of data must not exceed GetBufferSize.
-    * @param aRawdataBuf Buffer where the data is read from.
-    * @param aStatus Request status
-    */
-    void Send( const TDesC8& aRawdataBuf, TRequestStatus& aStatus );
-
-    /**
-    * Cancel read operation
-    */
-    void CancelReceive();
-
-    /**
-    * Cancel send operation
-    */
-    void CancelSend();
-
-    /**
-     *  Return required buffer size for Send operation.
-     */
-    TInt GetSendBufferSize();
-
-    /**
-     *  Return required buffer size for Receive operation.
-     */
-    TInt GetReceiveBufferSize();
-
-private:
-
-    /**
-    * Constructor of this plugin.
-    */
-    CHtiBtCommEcomPlugin();
-
-    /**
-    * Second phase construction. Connects the Bluetooth.
-    */
-    void ConstructL();
-
-    /**
-    * Load configuration file.
-    */
-    void LoadConfigL();
-
-    /**
-    * Read and parse the configuration values.
-    */
-    void ReadConfig();
-
-    /**
-     * Parse the possible port (channel) number value from name or address param
-     */
-     TInt ParsePortNumber();
-
-     /**
-     * StorePortNumberL()
-     * Store the given port number to configuration file
-     * @param aPortNumber the port number to store
-     */
-     void StorePortNumberL( TInt aPortNumber );
-
-private: // Data
-
-    RHtiBtCommInterface iBtCommInterface;
-
-    CHtiCfg* iCfg;
-    HBufC8*  iBtDeviceNameOrAddress;
-    TInt     iPort;
-
-    };
-
-#endif // CHTIBTCOMMECOMPLUGIN_H
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/src/HtiBtCommEcomPlugin.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ECOM plugin for communication over serial port
-*
-*/
-
-
-// INCLUDE FILES
-#include <badesca.h>
-#include <f32file.h>
-
-#include "HtiBtCommEcomPlugin.h"
-#include "BtSerialClient.h"
-#include <HtiCfg.h>
-#include <HtiLogging.h>
-
-// CONSTANTS
-_LIT( KHtiCfgPath,       "\\" ); // root of drive
-_LIT( KHtiBtCommCfg,     "HTIBtComm.cfg" );
-_LIT8( KBtDeviceAddress, "BtDeviceAddress" );
-_LIT8( KBtDeviceName,    "BtDeviceName" );
-
-
-const TInt KBtAddressHexStringLength = 12; // 6 bytes
-const TUint KPortSeparatorChar = 30; // ASCII control char "record separator"
-
-// ----------------------------------------------------------------------------
-CHtiBtCommEcomPlugin* CHtiBtCommEcomPlugin::NewL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiBtCommEcomPlugin::NewL" );
-    CHtiBtCommEcomPlugin* plugin = new (ELeave) CHtiBtCommEcomPlugin();
-    CleanupStack::PushL( plugin );
-    plugin->ConstructL();
-    CleanupStack::Pop( plugin );
-    HTI_LOG_FUNC_OUT( "CHtiBtCommEcomPlugin::NewL" );
-    return plugin;
-    }
-
-// ----------------------------------------------------------------------------
-CHtiBtCommEcomPlugin::~CHtiBtCommEcomPlugin()
-    {
-    HTI_LOG_FUNC_IN( "CHtiBtCommEcomPlugin::~CHtiBtCommEcomPlugin" );
-    iBtCommInterface.CancelReceive();
-    iBtCommInterface.CancelSend();
-    iBtCommInterface.Close();
-    delete iBtDeviceNameOrAddress;
-    delete iCfg;
-    HTI_LOG_FUNC_OUT( "CHtiBtCommEcomPlugin::~CHtiBtCommEcomPlugin" );
-    }
-
-// ----------------------------------------------------------------------------
-CHtiBtCommEcomPlugin::CHtiBtCommEcomPlugin():iPort( -1 )
-    {
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::ConstructL()
-    {
-    TRAPD( err, LoadConfigL() );
-    if ( err == KErrNone )
-        {
-        ReadConfig();
-        }
-    else
-        {
-        TBufC8<1> emptyBuf( KNullDesC8 );
-        iBtDeviceNameOrAddress = emptyBuf.AllocL();
-        iPort = KErrNotFound;
-        }
-     // May take long!
-    User::LeaveIfError( iBtCommInterface.Connect(
-            *iBtDeviceNameOrAddress, iPort ) );
-
-    // Get the connected service port number (channel) and store it if needed
-    TInt connectedPort = iBtCommInterface.GetPortNumber();
-    HTI_LOG_FORMAT( "Connected port number = %d", connectedPort );
-    if ( connectedPort != iPort && connectedPort >= 0 )
-        {
-        TRAP( err, StorePortNumberL( connectedPort ) ); // ignore error
-        }
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::Receive( TDes8& aRawdataBuf,
-                                    TRequestStatus& aStatus )
-    {
-    iBtCommInterface.Receive( aRawdataBuf, aStatus );
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::Send( const TDesC8& aRawdataBuf,
-                                       TRequestStatus& aStatus )
-    {
-    iBtCommInterface.Send( aRawdataBuf, aStatus );
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::CancelReceive()
-    {
-    iBtCommInterface.CancelReceive();
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::CancelSend()
-    {
-    iBtCommInterface.CancelSend();
-    }
-
-// ----------------------------------------------------------------------------
-TInt CHtiBtCommEcomPlugin::GetSendBufferSize()
-    {
-    return iBtCommInterface.GetSendBufferSize();
-    }
-
-// ----------------------------------------------------------------------------
-TInt CHtiBtCommEcomPlugin::GetReceiveBufferSize()
-    {
-    return iBtCommInterface.GetReceiveBufferSize();
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::LoadConfigL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiBtCommEcomPlugin::LoadConfigL" );
-    iCfg = CHtiCfg::NewL();
-    iCfg->LoadCfgL( KHtiCfgPath, KHtiBtCommCfg );
-    HTI_LOG_TEXT( "cfg file loaded" );
-    HTI_LOG_FUNC_OUT( "CHtiBtCommEcomPlugin::LoadConfigL" );
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::ReadConfig()
-    {
-    HTI_LOG_FUNC_IN( "CHtiBtCommEcomPlugin::ReadConfig" );
-    // First try to get address - if found and length is correct it is used
-    TRAPD( paramErr, iBtDeviceNameOrAddress = iCfg->GetParameterL(
-                                                KBtDeviceAddress ).AllocL() );
-
-    if ( paramErr == KErrNone )
-        {
-        TInt port = ParsePortNumber();
-        if ( port >= 0 ) iPort = port;
-        else iPort = KErrNotFound;
-        }
-
-    if ( paramErr ||
-         iBtDeviceNameOrAddress->Length() != KBtAddressHexStringLength )
-        {
-        HTI_LOG_TEXT( "BT address not defined or not valid - getting name" );
-        delete iBtDeviceNameOrAddress;
-        iBtDeviceNameOrAddress = NULL;
-        // Address was not found - try to get name.
-        TRAP( paramErr, iBtDeviceNameOrAddress = iCfg->GetParameterL(
-                                                 KBtDeviceName ).AllocL() );
-        if ( paramErr )
-            {
-            HTI_LOG_TEXT( "BT name not defined either" );
-            TBufC8<1> emptyBuf( KNullDesC8 );
-            iBtDeviceNameOrAddress = emptyBuf.AllocL();
-            iPort = KErrNotFound;
-            }
-        else
-            {
-            TInt port = ParsePortNumber();
-            if ( port >= 0 ) iPort = port;
-            else iPort = KErrNotFound;
-            }
-        }
-    HTI_LOG_TEXT( "BT device name or address:" );
-    HTI_LOG_DES( *iBtDeviceNameOrAddress );
-    HTI_LOG_FORMAT( "Port number: %d", iPort );
-    HTI_LOG_FUNC_OUT( "CHtiBtCommEcomPlugin::ReadConfig" );
-    }
-
-// ----------------------------------------------------------------------------
-TInt CHtiBtCommEcomPlugin::ParsePortNumber()
-    {
-    HTI_LOG_FUNC_IN( "CHtiBtCommEcomPlugin::ParsePortNumber" );
-    TInt port = KErrNotFound;
-    TInt separatorIndex = iBtDeviceNameOrAddress->LocateReverse(
-            TChar( KPortSeparatorChar ) );
-    if ( separatorIndex != KErrNotFound )
-        {
-        TPtrC8 value = iBtDeviceNameOrAddress->Right(
-                iBtDeviceNameOrAddress->Length() - ( separatorIndex + 1 ) );
-        TLex8 lex( value );
-        lex.Val( port );
-        // Strip away the port number
-        iBtDeviceNameOrAddress->Des().SetLength( separatorIndex );
-        }
-    HTI_LOG_FORMAT( "ParsePortNumber returning %d", port );
-    HTI_LOG_FUNC_OUT( "CHtiBtCommEcomPlugin::ParsePortNumber" );
-    return port;
-    }
-
-// ----------------------------------------------------------------------------
-void CHtiBtCommEcomPlugin::StorePortNumberL( TInt aPortNumber )
-    {
-    HTI_LOG_FUNC_IN( "CHtiBtCommEcomPlugin::StorePortNumberL" );
-    if ( !iCfg )
-        {
-        iCfg = CHtiCfg::NewL();
-        }
-    iCfg->LoadCfgL( KHtiCfgPath, KHtiBtCommCfg );
-
-    TBool changesMade = EFalse;
-
-    // Add or replace port number to address parameter if it exists
-    HBufC8* value = NULL;
-    TRAPD( err, value = iCfg->GetParameterL( KBtDeviceAddress ).AllocL() );
-    if ( !err )
-        {
-        HTI_LOG_FORMAT( "Found address param (length = %d)", value->Length() );
-        CleanupStack::PushL( value );
-        TInt separatorIndex = value->Locate( TChar( KPortSeparatorChar ) );
-        if ( separatorIndex != KErrNotFound )
-            {
-            HTI_LOG_FORMAT( "Separator char found from index %d", separatorIndex );
-            value->Des().SetLength( separatorIndex );
-            }
-        value = value->ReAllocL( value->Length() + 5 );
-        // The old value has been deleted by ReAllocL and new allocated,
-        // so update cleanup stack.
-        CleanupStack::Pop();
-        CleanupStack::PushL( value );
-        TPtr8 ptr = value->Des();
-        ptr.Append( TChar( KPortSeparatorChar ) );
-        ptr.AppendNum( aPortNumber );
-        TRAP( err, iCfg->SetParameterL( KBtDeviceAddress, *value ) );
-        if ( !err ) changesMade = ETrue;
-        CleanupStack::PopAndDestroy(); // value
-        }
-
-    // Add or replace port number to name parameter if it exists
-    TRAP( err, value = iCfg->GetParameterL( KBtDeviceName ).AllocL() );
-    if ( !err )
-        {
-        HTI_LOG_FORMAT( "Found name param (length = %d)", value->Length() );
-        CleanupStack::PushL( value );
-        TInt separatorIndex = value->Locate( TChar( KPortSeparatorChar ) );
-        if ( separatorIndex != KErrNotFound )
-            {
-            HTI_LOG_FORMAT( "Separator char found from index %d", separatorIndex );
-            value->Des().SetLength( separatorIndex );
-            }
-        value = value->ReAllocL( value->Length() + 5 );
-        // The old value has been deleted by ReAllocL and new allocated,
-        // so update cleanup stack.
-        CleanupStack::Pop();
-        CleanupStack::PushL( value );
-        TPtr8 ptr = value->Des();
-        ptr.Append( TChar( KPortSeparatorChar ) );
-        ptr.AppendNum( aPortNumber );
-        TRAP( err, iCfg->SetParameterL( KBtDeviceName, *value ) );
-        if ( !err ) changesMade = ETrue;
-        CleanupStack::PopAndDestroy(); // value
-        }
-
-    if ( changesMade )
-        {
-        iCfg->SaveCfgL( KHtiCfgPath, KHtiBtCommCfg );
-        }
-    HTI_LOG_FUNC_OUT( "CHtiBtCommEcomPlugin::StorePortNumberL" );
-    }
-
-// End of file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommEcomPlugin/src/proxy.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ECOM implementations in this dll
-*
-*/
-
-
-// INCLUDE FILES
-#include "HtiBtCommEcomPlugin.h"
-
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-
-
-/*---------------------------------------------------------------------------*/
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-    {
-        IMPLEMENTATION_PROXY_ENTRY( 0x200212CC,  CHtiBtCommEcomPlugin::NewL )
-    };
-
-/*---------------------------------------------------------------------------*/
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
-    {
-    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
-    return ImplementationTable;
-    }
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtClientServerCommon.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Global definitions for BtCommServer and client side interface.
-*
-*/
-
-
-#ifndef __HTIBTCLIENTSERVERCOMMON_H__
-#define __HTIBTCLIENTSERVERCOMMON_H__
-
-//  INCLUDES
-#include <e32base.h>
-
-// CONSTANTS
-
-// The server name (and server thread name)
-_LIT( KBtCommServerName,"HtiBtCommServer" );
-
-// The version of the server
-const TUint KBtCommServerMajorVersionNumber = 1;
-const TUint KBtCommServerMinorVersionNumber = 0;
-const TUint KBtCommServerBuildVersionNumber = 0;
-
-const TInt KClientReceiveBufferMaxSize = 0x1000; // 4096 bytes
-const TInt KClientSendBufferMaxSize = 0x1000; // 4096 bytes
-
-
-// DATA TYPES
-
-// The message ID's of BtCommServer
-// from Symbian side
-enum TBtCommServerRqst
-    {
-    EBtCommServerConnect = 0,
-    EBtCommServerRecv,
-    EBtCommServerSend,
-    ECancelBtCommServerRecv,
-    ECancelBtCommServerSend,
-    EGetServicePortNumber
-    };
-
-
-// FUNCTION PROTOTYPES
-/**
-* Start HtiBtCommServer thread. This is called by client interface.
-*/
-IMPORT_C TInt StartThread();
-
-#endif // __HTIBTCLIENTSERVERCOMMON_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommInterface.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Client side interface to HtiBtCommServer
-*
-*/
-
-
-#ifndef __HTIBTCOMMINTERFACE_H__
-#define __HTIBTCOMMINTERFACE_H__
-
-//  INCLUDES
-#include <e32test.h>
-#include <e32base.h>
-
-// CONSTANTS
-
-// MACROS
-
-// DATA TYPES
-
-// FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// CLASS DECLARATION
-
-/**
- * Remote interface to HtiBtCommServer.
- * HtiBtCommServer runs in separate thread, but always within the
- * client process.
- *
- * The thread is started and session to server created, when the
- * Connect is called for the first time.
- *
- * Server allows only one connection (session) at a time.
- *
- * Library: htibtcomminterface.lib
- */
-class RHtiBtCommInterface : public RSessionBase
-    {
-    public: // Constructor and destructor
-
-        /**
-        * C++ default constructor.
-        */
-        IMPORT_C RHtiBtCommInterface();
-
-    public:
-        /**
-        * Connects and creates session to BtCommServer. Additionally,
-        * connects to remote BT device. This may take a while
-        * and may require user interaction (device selection).
-        *
-        * If the server is not running within this process, it is
-        * started in a new thread. Note that server allows only one
-        * connection (session).
-        * @return Error code
-        */
-        IMPORT_C TInt Connect( TDesC8& aDeviceNameOrAddress, TInt aPort );
-
-        /**
-        * Close the session to server and wait for servers death.
-        * Will disconnect the server from remote BT host, if connected.
-        */
-        IMPORT_C void Close();
-
-        /**
-        * Returns server version
-        * @return Version
-        */
-        IMPORT_C TVersion Version() const;
-
-        /**
-         *  Return required buffer max size for Send operation.
-         */
-        IMPORT_C TInt GetSendBufferSize() const;
-
-        /**
-         *  Return required buffer max size for Receive operation.
-         */
-        IMPORT_C TInt GetReceiveBufferSize() const;
-
-        /**
-        * Receives data from BtCommServer.
-        * Note: The aData buffer size must equal to GetReceiveBufferSize().
-        * (server will write 1 to GetReceiveBufferSize bytes to the buffer).
-        * @param aData Descriptor where data is received
-        * @param aStatus Asynchronous request status
-        */
-        IMPORT_C void Receive( TDes8& aData,
-                           TRequestStatus& aStatus );
-
-        /**
-        * Sends data to BtCommServer.
-        * Note: The aData buffer size must equal to GetSendBufferSize().
-        * (server will read as much as there is data in aData. There must
-        * never be more data than GetSendBufferSize. This is important to notice,
-        * if HBufC is used, because its actual max size can be greater than
-        * initially suggested in its construction)
-        *
-        * @param aData Data to be sent
-        * @param aStatus Asynchronous request status
-        */
-        IMPORT_C void Send( const TDesC8& aData,
-                           TRequestStatus& aStatus );
-
-
-        /**
-        * Cancels pending Receive request on server.
-        */
-        IMPORT_C void CancelReceive();
-
-        /**
-        * Cancels pending Send request on server.
-        */
-        IMPORT_C void CancelSend();
-
-        /**
-        * Gets the port number of the remote service where the server is
-        * connected.
-        * @return Port number or KErrDisconnected if server is not connected
-        */
-         IMPORT_C TInt GetPortNumber() const;
-
-    private:
-
-        /**
-        * During Connect(), connect the server
-        * to remote BT host service.
-        */
-        TInt RHtiBtCommInterface::ConnectBt( TDesC8& aDeviceNameOrAddress,
-                                             TInt aPort );
-
-};
-
-#endif // __HTIBTCOMMINTERFACE_H__
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommServer.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  CHtiBtCommServer declaration
-*
-*/
-
-
-#ifndef __HTIBTCOMMSERVER_H__
-#define __HTIBTCOMMSERVER_H__
-
-//  INCLUDES
-
-#include <e32def.h>
-#include <e32base.h>
-
-//  CONSTANTS
-
-// Reasons for BtCommServer panic
-enum TBtCommServerPanic
-    {
-    EBadRequest,
-    EBadDescriptor,
-    EMainSchedulerError,
-    ESvrCreateServer,
-    ESvrStartServer,
-    ECreateTrapCleanup,
-    ENotImplementedYet,
-    EFailedToInitMessageBox,
-    EFailedToOpenBTconnection,
-    EFailedToOpenPhonetChannel,
-    EFailedToRecPhonetMsg,
-    EFailedToSendPhonetMsg,
-    ETooManyAsyncRequests
-    };
-
-//  FUNCTION PROTOTYPES
-
-// Function to panic the server
-GLREF_C void PanicServer( TBtCommServerPanic aPanic );
-
-// Thread function for server
-GLREF_C TInt BtCommServerThread( TAny * );
-
-//  FORWARD DECLARATIONS
-class CHtiBtCommServerSession;
-class CHtiBtReaderWriter;
-
-// CLASS DECLARATION
-
-/**
-* Server class for BT communication.
-*/
-class CHtiBtCommServer : public CServer2
-    {
-
-    private: // Constructors and destructor
-       /**
-        * C++ default constructor.
-        */
-        CHtiBtCommServer( TInt aPriority );
-
-       /**
-        * Second Phase constructor
-        */
-        void ConstructL();
-
-    public:
-       /**
-        * Symbian Two-phased constructor.
-        */
-        static CHtiBtCommServer* NewL();
-
-       /**
-        * Destructor.
-        */
-        ~CHtiBtCommServer();
-
-    public: // callbacks from session
-
-        /**
-        * Session was deleted notification.
-        * Session notifies server, when client is disconnecting
-        * and session is being deleted. Server will start shutdown.
-        */
-        void SessionFreed();
-
-        /**
-        * Session was created notification.
-        * @param aSession Session, which is notifying server of its creation.
-        */
-        void SessionCreated( CHtiBtCommServerSession* aSession );
-
-    public:
-       /**
-        * Creates a new client session
-        * @param aVersion Version of the server
-        * @param aMessage Client message
-        * @return Pointer to the client session
-        */
-        virtual CSession2* NewSessionL( const TVersion& aVersion,
-            const RMessage2& aMessage ) const;
-
-       /**
-        * Creates server thread
-        * @param aStarted semaphore
-        * @return Error code
-        */
-        static TInt ThreadFunction( TAny* aStarted );
-
-public: // Data
-    // Priority of the server
-    enum TBtServPriority
-        {
-        EBtCommServerPriority = 100
-        };
-
-private:
-
-    CHtiBtCommServerSession* iSession; // Not owned. Only one session allowed!
-
-    };
-
-#endif // __HTIBTCOMMSERVER_H__
-
-// End of file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/HtiBtCommServerSession.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Server side session in HtiBtCommServer.
-*
-*/
-
-
-#ifndef CHTIBTCOMMSERVERSESSION_H
-#define CHTIBTCOMMSERVERSESSION_H
-
-//  INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-#include "BtSerialClient.h" // MBtSerialClientObserver
-
-// FORWARD DECLARATIONS
-
-class CHtiBtCommServer;
-
-// CLASS DECLARATION
-
-/**
-* This class represents a client session in the server.
-*
-* Server owns one instance of session (meaning only one client session
-* is allowed for this server).
-* Session allows only one outstanding read request and write request at a time.
-* Read request and write request may be outstanding simultaneously.
-*/
-class CHtiBtCommServerSession :
-    public CSession2,
-    public MBtSerialClientObserver
-    {
-public:
-
-   /**
-    * Two phase constructor.
-    *
-    * @param aServer Pointer to the server instance
-    */
-    static CHtiBtCommServerSession* NewL( CHtiBtCommServer* aServer );
-
-private: // Construction
-
-   /**
-    * C++ default constructor.
-    *
-    * @param aClient
-    * @param aServer
-    */
-    CHtiBtCommServerSession( CHtiBtCommServer* aServer );
-
-    /**
-     * Second phase construction.
-     */
-    void ConstructL();
-
-   /**
-    * Destructor.
-    */
-    ~CHtiBtCommServerSession();
-
-private: // From MBtSerialClientObserver
-
-    void ConnectedToServer(TInt aError);
-    void DisconnectedFromServer();
-    void DataFromServer(const TDesC8& aData);
-    void AllBufferedDataSent();
-
-private:
-
-    /**
-    * Handle client request. This is invoced by client server framework.
-    * @param aMessage Message object describing client request
-    */
-    virtual void ServiceL(const RMessage2 &aMessage);
-
-    /**
-    * Determine client request type and delegate handling accordingly.
-    * @param aMessage Message object describing client request
-    */
-    void DispatchMessageL(const RMessage2 &aMessage);
-
-    void HandleConnectRequestL(const RMessage2& aMessage);
-
-    /**
-    * Handle client's send request.
-    * Copies data from client address space to internal send buffer and starts
-    * sending it.
-    * @param aMessage Message object describing client request
-    */
-    void HandleSendRequestL(const RMessage2& aMessage);
-
-    /**
-    * Handle client's read request.
-    * Wait for incoming data. Once received, copy its data to client's
-    * address space and complete client's request.
-    * @param aMessage Message object describing client request
-    */
-    void HandleReadRequestL(const RMessage2& aMessage);
-
-    /**
-    * Handle client's cancel requests.
-    * Cancel either read or write operation depending on client request.
-    * @param aMessage Message object describing client request
-    */
-    void HandleCancelRequestL(const RMessage2& aMessage);
-
-    /**
-     * Handle port number request
-     * Write the port number of the currently connected service. If not
-     * connected writes KErrDisconnected.
-     */
-    void HandlePortNumberRequestL(const RMessage2& aMessage);
-
-private: // Helpers
-
-    void PanicClient(TInt aPanic) const;
-    void ResetAll(TInt aCompletionCode);
-    void TryCompleteReadRequest();
-
-private: // Data
-
-    CHtiBtCommServer *iBtCommServer; // referenced
-
-    RMessage2 iReadRequest;
-    RMessage2 iWriteRequest;
-    RMessage2 iConnectRequest;
-    TBool iWriteRequestComplete; // ETrue: no previous pending write request
-    TBool iReadRequestComplete; // ETrue: no previous pending read request
-    TBool iConnectRequestComplete;
-
-    CBtSerialClient* iBtClient;
-
-    HBufC8* iIncomingDataBuf; // Coming from remote host
-    HBufC8* iSendBuffer;      // Sent to remote host
-
-    };
-
-#endif // CHTIBTCOMMSERVERSESSION_H
-
-// End of File
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/inc/Logger.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Logger library
-*
-*/
-
-
-#ifndef __LOGGER_H_____
-#define __LOGGER_H_____
-
-//  INCLUDES
-#include <e32std.h>
-
-// CONSTANTS
-const TInt KLogLevelDebug   = 0;
-const TInt KLogLevelInfo    = 10;
-const TInt KLogLevelWarning = 20;
-const TInt KLogLevelError   = 30;
-
-const TInt KMinimumLogLevel = KLogLevelInfo;
-
-
-// When __ENABLE_LOGGING__ macro is defined, logging functions are
-// compiled to final build.
-//
-// Example usage: LOGFW(DebugLog(_L("Got an error %d"), 5))
-//
-#ifdef __ENABLE_LOGGING__
-
-    #define LOGFW(a) a;
-
-    _LIT(KLogFileName, "c:\\HTI_BtComm.log");
-
-    // panics
-    _LIT(KLogPanicCategory, "CustNotifyLog");
-    static const TInt KPanicFsConnectFailed = 1;
-    static const TInt KPanicFileCreateFailed = 2;
-    static const TInt KPanicFileWriteFailed = 3;
-
-    const TInt KLogEntryMaxLength = 156;
-
-    // Usage example: DOLOG(_L("Logstring"));
-    void DebugLog(TRefByValue<const TDesC> aFmt,...);
-    void InfoLog(TRefByValue<const TDesC> aFmt,...);
-    void WarnLog(TRefByValue<const TDesC> aFmt,...);
-    void ErrLog(TRefByValue<const TDesC> aFmt,...);
-
-    void Log(TInt aLevel, TRefByValue<const TDesC> aFmt, VA_LIST list);
-
-    void LogBytes(const TDesC8& aData, TInt aMaxBytesToLog );
-
-#else  //__ENABLE_LOGGING__
-
-    #define LOGFW(a)
-
-#endif //__ENABLE_LOGGING__
-
-#endif //__LOGGER_H_____
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/HtiBtCommInterface.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Implementation of RHtiBtCommInterface class.
-*              Symbian side component uses this interface to receive and
-*              send HTI data to HtiBtCommServer.
-*              HtiBtCommServer acts as proxy to send and receive data
-*              to and from PC.
-*
-*/
-
-
-// INCLUDE FILES
-#include "HtiBtClientServerCommon.h"
-#include "HtiBtCommInterface.h"
-
-#include <e32uid.h>
-#include <HtiLogging.h>
-
-// CONSTANTS
-const TUint KBtCommServerDefaultMessageSlots = 4; // Read, write, readCancel, writeCancel
-
-// Constants
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C RHtiBtCommInterface::RHtiBtCommInterface()
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::RHtiBtCommInterface()" );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C TInt RHtiBtCommInterface::Connect( TDesC8& aDeviceNameOrAddress,
-                                            TInt aPort )
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::Connect()" );
-
-    TInt error = StartThread(); // see HtiBtClientServerCommon.h
-    if (error == KErrNone)
-        {
-        error = CreateSession( KBtCommServerName,
-                               Version(),
-                               KBtCommServerDefaultMessageSlots );
-        }
-    if ( error )
-        return error;
-
-    return ConnectBt( aDeviceNameOrAddress, aPort );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C void RHtiBtCommInterface::Close()
-    {
-    HTI_LOG_FUNC_IN( "RHtiBtCommInterface::Close" );
-
-    // Use thread finder to find the server thread
-    TFullName threadName;
-    TFullName matchPattern;
-    matchPattern.Append( _L( "*" ) );
-    matchPattern.Append( KBtCommServerName );
-    matchPattern.Append( _L( "*" ) );
-
-    TFindThread threadFinder;
-    threadFinder.Find( matchPattern );
-    TInt err = threadFinder.Next( threadName );
-    if ( err )
-        {
-        HTI_LOG_FORMAT( "RHtiBtCommInterface::Close: Failed to find server thread: %d", err );
-        User::Panic( _L( "BtIf Close, server thread not found" ), err );
-        }
-
-    HTI_LOG_TEXT( "RHtiBtCommInterface::Close: Found server thread:" );
-    HTI_LOG_DES( threadName );
-
-    RThread thread;
-    err = thread.Open( threadName );
-    if ( err )
-        {
-        HTI_LOG_FORMAT( "RHtiBtCommInterface::Close: Failed to open server thread: %d", err );
-        User::Panic( _L( "BtIf Close, error opening server thread" ), err );
-        }
-    else
-        {
-        // initiate server shutdown
-        RSessionBase::Close();
-
-        // For clean server stop, wait for its death
-        HTI_LOG_TEXT( "RHtiBtCommInterface::Close: Waiting for server thread to die..." );
-        TRequestStatus status;
-        thread.Logon( status );
-        User::WaitForRequest( status );
-        HTI_LOG_TEXT( "RHtiBtCommInterface::Close: Server thread dead." );
-        }
-
-    thread.Close();
-    HTI_LOG_FUNC_OUT( "RHtiBtCommInterface::Close" );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C TVersion RHtiBtCommInterface::Version(void) const
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::Connect()" );
-    return ( TVersion( KBtCommServerMajorVersionNumber,
-                       KBtCommServerMinorVersionNumber,
-                       KBtCommServerBuildVersionNumber ) );
-
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C TInt RHtiBtCommInterface::GetSendBufferSize() const
-    {
-    return KClientSendBufferMaxSize;
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C TInt RHtiBtCommInterface::GetReceiveBufferSize() const
-    {
-    return KClientReceiveBufferMaxSize;
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C void RHtiBtCommInterface::Receive(TDes8& aData,
-                                        TRequestStatus& aStatus)
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::Receive()" );
-    SendReceive( EBtCommServerRecv, TIpcArgs( &aData ), aStatus );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C void RHtiBtCommInterface::Send(const TDesC8& aData,
-                                        TRequestStatus& aStatus)
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::Send()" );
-    SendReceive( EBtCommServerSend, TIpcArgs( &aData ), aStatus );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C void RHtiBtCommInterface::CancelReceive()
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::CancelReceive()" );
-    SendReceive( ECancelBtCommServerRecv, TIpcArgs( NULL ) );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C void RHtiBtCommInterface::CancelSend()
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::CancelSend()" );
-    SendReceive( ECancelBtCommServerSend, TIpcArgs( NULL ) );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C TInt RHtiBtCommInterface::GetPortNumber() const
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::GetPortNumber()" );
-    TPckgBuf<TInt> pckg;
-    TInt ret = SendReceive( EGetServicePortNumber, TIpcArgs( &pckg ) );
-    if ( ret == KErrNone )
-        {
-        ret = pckg();
-        }
-    return ret;
-    }
-
-/*---------------------------------------------------------------------------*/
-TInt RHtiBtCommInterface::ConnectBt( TDesC8& aDeviceNameOrAddress, TInt aPort )
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::ConnectBt()" );
-    return SendReceive( EBtCommServerConnect,
-                            TIpcArgs( &aDeviceNameOrAddress, aPort ) );
-    }
-
-/*---------------------------------------------------------------------------*/
-GLDEF_C TInt E32Main()
-    {
-    HTI_LOG_TEXT( "RHtiBtCommInterface::E32Main()" );
-    return KErrNone;
-    }
-
-// End of the file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/HtiBtCommServer.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: This file contains the implementation of the
-*              CHtiBtCommServer class.
-*              CHtiBtCommServer handles Symbian server side operations
-*              such as server starting and client session creation.
-*
-*/
-
-
-// INCLUDE FILES
-#include "HtiBtClientServerCommon.h"
-#include "HtiBtCommServer.h"
-#include "HtiBtCommServerSession.h"
-#include "Logger.h"
-
-#include <e32base.h>
-#include <e32std.h>
-#include <e32svr.h>
-#include <e32uid.h>
-
-// CONSTANTS
-// For memory allocations
-const TUint KBtCommServerHeapSizeMin       = 0x6000;
-const TUint KBtCommServerHeapSizeMax       = 0x20000;
-const TUint KBtCommServerStackSize         = 0x8000;
-
-
-//*****************************************************************************
-//
-// Class CHtiBtCommServer
-//
-//*****************************************************************************
-
-/*---------------------------------------------------------------------------*/
-CHtiBtCommServer::CHtiBtCommServer( TInt aPriority )
-    : CServer2( aPriority, ESharableSessions )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: CHtiBtCommServer()")))
-    __DECLARE_NAME(_S( "CHtiBtCommServer" ));
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServer::ConstructL()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ConstructL()")))
-    }
-
-/*---------------------------------------------------------------------------*/
-CHtiBtCommServer* CHtiBtCommServer::NewL()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: NewL()"));)
-
-    CHtiBtCommServer *pS =
-        new (ELeave) CHtiBtCommServer( EBtCommServerPriority );
-    CleanupStack::PushL( pS );
-    __ASSERT_ALWAYS( pS != NULL, PanicServer( ESvrCreateServer ) );
-
-    pS->ConstructL();
-    CleanupStack::Pop( pS );
-    User::SetProcessCritical( User::ENotCritical );
-    User::SetCritical( User::ENotCritical );
-    LOGFW(InfoLog(_L("Server was started")))
-    return pS;
-    }
-
-/*---------------------------------------------------------------------------*/
-CHtiBtCommServer::~CHtiBtCommServer()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ~CHtiBtCommServer()")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServer::SessionFreed()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: SessionFreed(): Stopping active scheduler"));)
-    iSession = NULL; // iSession is owned by server framework, not deleted here
-    CActiveScheduler::Stop();
-    LOGFW(DebugLog(_L("CHtiBtCommServer: SessionFreed(): Done"));)
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServer::SessionCreated( CHtiBtCommServerSession* aSession )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: SessionCreated()"));)
-    iSession = aSession;
-    }
-
-/*---------------------------------------------------------------------------*/
-CSession2* CHtiBtCommServer::NewSessionL( const TVersion &aVersion,
-    const RMessage2& aMessage ) const
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: NewSessionL() - IPC V2"));)
-    aMessage.IsNull();
-    if ( iSession )
-        User::Leave( KErrAlreadyExists ); // Allow only one session
-
-    // Check that server is the right version
-    TVersion ver( KBtCommServerMajorVersionNumber,
-                  KBtCommServerMinorVersionNumber,
-                  KBtCommServerBuildVersionNumber );
-    if ( !User::QueryVersionSupported( ver, aVersion ) )
-        {
-        User::Leave( KErrNotSupported );
-        }
-    return CHtiBtCommServerSession::NewL( (CHtiBtCommServer*)this );
-    }
-
-/*---------------------------------------------------------------------------*/
-GLDEF_C TInt CHtiBtCommServer::ThreadFunction( TAny* anArg )
-    {
-    LOGFW(_L("CHtiBtCommServer: ThreadFunction(): Starting"));
-
-    __UHEAP_MARK;
-
-    CTrapCleanup* cleanup = CTrapCleanup::New();
-
-    // Convert argument into semaphore reference
-    RSemaphore& semaphore = *(RSemaphore*)anArg;
-
-    // Start scheduler...
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Installing active scheduler"));)
-    CActiveScheduler *pA = new CActiveScheduler;
-    __ASSERT_ALWAYS( pA != NULL, PanicServer( EMainSchedulerError ) );
-    CActiveScheduler::Install( pA );
-
-    CHtiBtCommServer* pS = NULL;
-    TRAPD(err,
-        // ...and server
-        LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Creating server instance"));)
-        pS = CHtiBtCommServer::NewL();
-        )
-
-    if ( err != KErrNone )
-        {
-        LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Failed creating server instance"));)
-        }
-
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Starting server"));)
-    __ASSERT_ALWAYS( pS->Start(KBtCommServerName) == KErrNone,
-        PanicServer( ESvrStartServer ) ); // Make first request pending,
-
-    // Signal that server has started
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Signalling client: server is up and running"));)
-    semaphore.Signal();
-
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Waiting for server's death"));)
-    // Start receiving requests from clients
-    CActiveScheduler::Start();
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Server was stopped"));)
-    LOGFW(InfoLog(_L("Server was stopped")))
-    delete pS;
-    LOGFW(DebugLog(_L("CHtiBtCommServer: ThreadFunction(): Server was deleted"));)
-
-    // Finished
-    delete pA;
-    pA = NULL;
-
-     // Destroy clean-up stack
-    delete cleanup;
-    cleanup = NULL;
-
-    __UHEAP_MARKEND;
-    return KErrNone;
-    }
-
-/*---------------------------------------------------------------------------*/
-GLDEF_C void PanicServer( TBtCommServerPanic aPanic )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer: PanicServer()"));)
-    _LIT( KTxtServerPanic, "BtCommServer panic" );
-    User::Panic( KTxtServerPanic, aPanic );
-    }
-
-/*---------------------------------------------------------------------------*/
-EXPORT_C TInt StartThread()
-    {
-//    LOGFW(_L("CHtiBtCommServer: StartThread()"));
-    TInt res = KErrNone;
-
-    // Create server - if one of this name does not already exist
-    TFindServer findBtCommServer( KBtCommServerName );
-    TFullName name;
-    if ( findBtCommServer.Next( name ) != KErrNone ) // Server doesn't exist
-        {
-         // Create a semaphore to know when thread initialization has finished
-        RSemaphore semaphore;
-        semaphore.CreateLocal(0);
-
-//        LOGFW(_L("CHtiBtCommServer: Created Semaphore...\n"));
-
-        // Create new server thread and thread's main function
-        RThread thread;
-        res = thread.Create( KBtCommServerName,
-                             CHtiBtCommServer::ThreadFunction,
-                             KBtCommServerStackSize,
-                             KBtCommServerHeapSizeMin,
-                             KBtCommServerHeapSizeMax,
-                             &semaphore );
-
-
-        if ( res == KErrNone ) // Thread created ok - now start it going
-            {
-//            LOGFW(_L("CHtiBtCommServer: StartThread() - Create OK"));
-
-            thread.SetPriority( EPriorityNormal );
-//            TRequestStatus stat1;
-//            thread.Logon(stat1);
-
-            thread.Resume();  // Start it going
-
-            semaphore.Wait(); // Wait until it's initialized
-
-            thread.Close();   // No longer interest in the other thread
-            }
-        else // Thread not created ok
-            {
-            // No further interest in it
-//            LOGFW(_L("CHtiBtCommServer: StartThread() - Create FAIL"));
-            thread.Close();
-            }
-        semaphore.Close();
-        }
-    return res;
-    }
-
-/*---------------------------------------------------------------------------*/
-GLDEF_C TInt E32Main()
-    {
-    return KErrNone;
-    }
-
-// End of the file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/HtiBtCommServerSession.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,419 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of CHtiBtCommServerSession class. This class
-*                represents the client session in server.
-*
-*/
-
-
-
-// INCLUDE FILES
-#include "HtiBtClientServerCommon.h"
-#include "HtiBtCommServerSession.h"
-#include "HtiBtCommServer.h"
-#include "BtSerialClient.h"
-#include "Logger.h"
-
-#include <e32base.h>
-#include <e32std.h>
-#include <e32svr.h>
-
-#include <HtiCommPluginInterface.h> // KErrComModuleReset;
-
-// CONSTANTS
- _LIT(KBtComSessPanic, "BtComSessAssrt");
-
-const TInt KBtAddressHexStringLength = 12; // 6 bytes
-const TInt KIncomingDataBufSize = 32 * 1024;
-
-//*****************************************************************************
-//
-// Class CHtiBtCommServerSession
-//
-//*****************************************************************************
-
-/*---------------------------------------------------------------------------*/
-CHtiBtCommServerSession::CHtiBtCommServerSession( CHtiBtCommServer* aServer )
-    : CSession2()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: CHtiBtCommServerSession()")))
-
-    __DECLARE_NAME( _S( "CHtiBtCommServerSession" ) );
-    iBtCommServer = aServer;
-    iReadRequestComplete = ETrue;  // ready to accept read request
-    iWriteRequestComplete = ETrue;
-    iConnectRequestComplete = ETrue;
-    iBtCommServer->SessionCreated(this);
-    }
-
-/*---------------------------------------------------------------------------*/
-CHtiBtCommServerSession* CHtiBtCommServerSession::NewL(
-    CHtiBtCommServer* aServer )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: NewL()")))
-    CHtiBtCommServerSession* session =
-        new (ELeave) CHtiBtCommServerSession( aServer );
-    CleanupStack::PushL( session );
-    session->ConstructL();
-    CleanupStack::Pop( session );
-    return session;
-    }
-
-/*---------------------------------------------------------------------------*/
-
-void CHtiBtCommServerSession::ConstructL()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ConstructL()")))
-    iBtClient = CBtSerialClient::NewL(*this);
-    iIncomingDataBuf = HBufC8::NewL(KIncomingDataBufSize);
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ConstructL(): Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-CHtiBtCommServerSession::~CHtiBtCommServerSession()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ~CHtiBtCommServerSession()")))
-    delete iBtClient;
-    ResetAll(KErrCancel);
-    delete iIncomingDataBuf;
-    if ( iBtCommServer )
-        {
-        iBtCommServer->SessionFreed();
-        }
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ~CHtiBtCommServerSession(): Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::ServiceL( const RMessage2& aMessage )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ServiceL()")))
-
-    TRAPD( error, DispatchMessageL( aMessage ) );
-    if ( error != KErrNone )
-        {
-        LOGFW(DebugLog(_L("CHtiBtCommServerSession::ServiceL error %d"), error);)
-        }
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ServiceL(): Done")))
-    }
-
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::DispatchMessageL( const RMessage2 &aMessage )
-    {
-    LOGFW( DebugLog( _L( "CHtiBtCommServerSession: DispatchMessageL()" ) ) )
-
-    switch ( aMessage.Function() )
-        {
-        case EBtCommServerConnect:
-            {
-            HandleConnectRequestL( aMessage );
-            }
-            break;
-
-        case EBtCommServerSend:
-            {
-            HandleSendRequestL( aMessage );
-            }
-            break;
-        case EBtCommServerRecv:
-            {
-            HandleReadRequestL( aMessage );
-            }
-            break;
-
-        case ECancelBtCommServerRecv:
-        case ECancelBtCommServerSend:
-            {
-            HandleCancelRequestL( aMessage );
-            }
-            break;
-
-        case EGetServicePortNumber:
-            {
-            HandlePortNumberRequestL( aMessage );
-            }
-            break;
-
-        default:
-            {
-            LOGFW(ErrLog(_L("CHtiBtCommServerSession::DispatchMessageL: Unknown request: %d. Panicing Client"), aMessage.Function());)
-            PanicClient( EBadRequest );
-            User::Panic( KBtComSessPanic, 1 );
-            }
-            break;
-        }
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: DispatchMessageL(): Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::HandleConnectRequestL( const RMessage2& aMessage )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL()")))
-    if ( !iConnectRequestComplete )
-        {
-        LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Already connecting")))
-        aMessage.Complete( KErrNotReady );
-        }
-    else
-        {
-        if ( iBtClient->Connected() )
-            {
-            LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Already connected")))
-            aMessage.Complete( KErrNone ); // Already connected. This is not an error?
-            }
-        else
-            {
-            LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Starting to connect to remote host")))
-            iConnectRequest = aMessage;
-            iConnectRequestComplete = EFalse;
-
-            TInt dataLength = (TUint16)aMessage.GetDesLength( 0 ); //first message slot
-            LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Data length = %d"), dataLength));
-
-            TInt port = aMessage.Int1();
-            LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Port = %d"), port));
-
-            if ( dataLength < 1 )
-                {
-                LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): No address or name - need to ask device")))
-                iBtClient->ConnectL(); // Request is completed in ConnectedToServer
-                }
-            else if ( dataLength == KBtAddressHexStringLength )
-                {
-                TBuf8<KBtAddressHexStringLength> addressBuf8;
-                aMessage.ReadL( 0, addressBuf8 );
-                TBuf<KBtAddressHexStringLength> addressBuf;
-                addressBuf.Copy( addressBuf8 );
-                TBTDevAddr address;
-                TInt result = address.SetReadable( addressBuf );
-                LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): SetReadable result = %d"), result));
-                if ( result != KBtAddressHexStringLength )
-                    {
-                    LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Not valid address - use it as name")))
-                    iBtClient->ConnectL( addressBuf, port );
-                    }
-                else
-                    {
-                    LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Valid address - connect")))
-                    iBtClient->ConnectL( address, port );
-                    }
-                }
-            else
-                {
-                LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Using name to connect")))
-                TBTDeviceName8 deviceName8;
-                aMessage.ReadL( 0, deviceName8 );
-                TBTDeviceName deviceName;
-                deviceName.Copy( deviceName8 );
-                iBtClient->ConnectL( deviceName, port );
-                }
-            }
-        }
-    LOGFW(DebugLog(_L("CHtiBtCommServer:HandleConnectRequestL(): Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::HandleReadRequestL( const RMessage2& aMessage )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: HandleReadRequestL()")))
-
-    if ( !iReadRequestComplete )
-        {
-        LOGFW(WarnLog(_L("CHtiBtCommServerSession: HandleReadRequestL(): Pending request. ret=KErrNotReady")))
-        // Two simultaneous read requests are not allowed.
-        aMessage.Complete(KErrNotReady);
-        return;
-        }
-
-    // No data in read buffer. Must wait for new data before completing request
-    iReadRequest = aMessage;
-    iReadRequestComplete = EFalse; // Not ready to complete next request
-    TryCompleteReadRequest(); // if there is something in the readbuffer,
-                              // use it for completion.
-
-    if ( iIncomingDataBuf->Des().Length() == 0 )
-        {
-        // Read some bytes to buffer even before client's request.
-        iBtClient->ReadAsyncL(); // Issue async request to read more data.
-        }
-
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: HandleReadRequestL(): Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::HandleSendRequestL( const RMessage2& aMessage )
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: HandleSendRequestL()")))
-
-    TInt dataLength = (TUint16)aMessage.GetDesLength( 0 ); //first message slot
-    LOGFW( InfoLog( _L( "Framework requested to send data: %d bytes" ), dataLength ) )
-    if ( iBtClient->SendBufferMaxSize() < dataLength )
-        {
-        aMessage.Complete(KErrOverflow);
-        LOGFW(ErrLog(_L("CHtiBtCommServerSession: HandleSendRequestL(): client is giving too big data. Cannot handle.")))
-        }
-    else if ( !iWriteRequestComplete )
-        {
-        LOGFW(WarnLog(_L("CHtiBtCommServerSession: HandleSendRequestL(): Pending request. ret=KErrNotReady")))
-        // Already pending send request. Two simultaneous send requests not allowed.
-        aMessage.Complete( KErrNotReady );
-        }
-    else
-        {
-        if ( iBtClient->FreeSpaceInSendBuffer() < dataLength )
-            {
-            LOGFW(DebugLog(_L("CHtiBtCommServerSession: HandleSendRequestL(): Completing send request delayed")))
-            // No space in the iBtClient's send buffer. Copy the data to internal
-            // buffer and wait for iBtClient to send its data out before adding
-            // data to its send buffer.
-            delete iSendBuffer;
-            iSendBuffer = NULL;
-            iSendBuffer = HBufC8::NewL(dataLength);
-            TPtr8 ptr = iSendBuffer->Des();
-            aMessage.ReadL( 0, ptr );
-            iWriteRequestComplete = EFalse;
-            iWriteRequest = aMessage;
-            // Wait for callback call AllBufferedDataSent. Complete request there.
-            }
-        else
-            {
-            LOGFW(DebugLog(_L("CHtiBtCommServerSession: HandleSendRequestL(): Completing send request immediately")))
-            // All data can be sent immediately, because there is enough space in
-            // iBtClient's send buffer.
-            HBufC8* data = HBufC8::NewLC( dataLength );
-            TPtr8 ptr = data->Des();
-            aMessage.ReadL( 0, ptr );
-            iBtClient->SendL( ptr );
-            CleanupStack::PopAndDestroy( data );
-            aMessage.Complete( KErrNone );
-            }
-        }
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: HandleSendRequestL(): Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::HandleCancelRequestL( const RMessage2& aMessage )
-    {
-    ResetAll( KErrCancel );
-    aMessage.Complete( KErrNone );
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::HandlePortNumberRequestL(const RMessage2& aMessage)
-    {
-    TPckgBuf<TInt> p( iBtClient->ServicePort() );
-    TInt err = aMessage.Write( 0, p, 0 );
-    aMessage.Complete( err );
-    }
-
-/*---------------------------------------------------------------------------*/
-
-void CHtiBtCommServerSession::PanicClient(TInt aPanic) const
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: PanicClient(): %d"), aPanic))
-    LOGFW(WarnLog(_L("CHtiBtCommServerSession: PanicClient(): %d. NOT IMPLEMENTED"), aPanic))
-    aPanic = aPanic;
-    // should be done with RMessage2?
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::ResetAll(TInt aCompletionCode)
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ResetAll()")))
-    if ( !iWriteRequestComplete )
-        iWriteRequest.Complete( aCompletionCode );
-    if ( !iReadRequestComplete )
-        iReadRequest.Complete( aCompletionCode );
-    if ( !iConnectRequestComplete )
-        iConnectRequest.Complete( aCompletionCode ); // error when making connection
-    iWriteRequestComplete = ETrue;
-    iReadRequestComplete = ETrue;
-    iConnectRequestComplete = ETrue;
-    delete iIncomingDataBuf;
-    iIncomingDataBuf = NULL;
-    delete iSendBuffer;
-    iSendBuffer = NULL;
-    iIncomingDataBuf = HBufC8::New(KIncomingDataBufSize);
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: ResetAll(): Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::ConnectedToServer(TInt aError)
-    {
-    // Connected to server. Reading has been started.
-    LOGFW(InfoLog(_L("CHtiBtCommServerSession: ConnectedToServer: connected to remote host")))
-    iConnectRequestComplete = ETrue;
-    iConnectRequest.Complete( aError );
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::DisconnectedFromServer()
-    {
-    LOGFW(InfoLog(_L("CHtiBtCommServerSession: DisconnectedFromServer: disconnected from remote host")))
-    ResetAll( KErrDisconnected );
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::DataFromServer(const TDesC8& aData)
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: DataFromServer: %d bytes"), aData.Length()))
-    TPtr8 ptr = iIncomingDataBuf->Des();
-    if ( aData.Length() > ptr.MaxLength() - ptr.Length() )
-        PanicClient( KErrUnderflow ); // Client is reading too slowly
-
-    ptr.Append( aData );
-    TryCompleteReadRequest();
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: DataFromServer: done"), aData.Length()))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::AllBufferedDataSent()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: AllBufferedDataSent")))
-    if ( !iWriteRequestComplete )
-        {
-        // iBtClient has sent all of its data and is ready to send more.
-        TPtr8 ptr = iSendBuffer->Des();
-        TRAPD( err, iBtClient->SendL( ptr ); )
-        iWriteRequest.Complete( err );
-        iWriteRequestComplete = ETrue;
-        delete iSendBuffer;
-        iSendBuffer = NULL;
-        }
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: AllBufferedDataSent: Done")))
-    }
-
-/*---------------------------------------------------------------------------*/
-void CHtiBtCommServerSession::TryCompleteReadRequest()
-    {
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: TryCompleteReadRequest")))
-    TPtr8 ptr = iIncomingDataBuf->Des();
-
-    if ( iReadRequestComplete || ptr.Length() == 0 )
-        {
-        LOGFW(DebugLog(_L("CHtiBtCommServerSession: TryCompleteReadRequest: Nothing to complete")))
-        return; // No outstanding client request to complete
-        }
-
-    TInt dataMaxLength = (TUint16)iReadRequest.GetDesMaxLength(0); //first message slot
-    TPtrC8 dataToClient = ptr.Left(dataMaxLength);
-    TRAPD(err, iReadRequest.WriteL(0, dataToClient);)
-
-    ptr.Delete(0, dataToClient.Length());
-    iReadRequest.Complete(err);
-    iReadRequestComplete = ETrue;
-    LOGFW(DebugLog(_L("CHtiBtCommServerSession: TryCompleteReadRequest: Done")))
-    }
-
-// End of file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/HtiBtCommServer/src/Logger.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,201 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Logger implementation.
-*
-*/
-
-
-// INCLUDE FILES
-#include "Logger.h"
-#include <f32file.h>
-
-#ifdef __ENABLE_LOGGING__
-
-// CONSTANTS
-_LIT(KDebugStr, "DEBUG: ");
-_LIT(KInfoStr,  "INFO:  ");
-_LIT(KWarnStr,  "WARN:  ");
-_LIT(KErrStr,   "ERROR: ");
-
-
-/*---------------------------------------------------------------------------*/
-void LogBytes( const TDesC8& aData, TInt aMaxBytesToLog )
-    {
-    TInt i = 0;
-    while ( i < aData.Length() && i < aMaxBytesToLog )
-        {
-        TBuf<64> hexbuf;
-        TBuf<32> stringbuf;
-        TInt k=0;
-        while ( i < aMaxBytesToLog && i < aData.Length() && k < 16 )
-            {
-            const TUint8 uint8 = aData[i];
-            hexbuf.AppendFormat( _L( "%02X "), uint8 );
-
-            if ( uint8 == '%' )
-                {
-                stringbuf.Append( _L( "%%" ) ); // escape character in format string
-                }
-            else if ( uint8 < 32 || uint8 > 126 )
-                {
-                stringbuf.Append( _L(".") );
-                }
-            else
-                {
-                stringbuf.Append( ( TChar ) uint8 );
-                }
-            i++;
-            k++;
-            }
-        TBuf<128> finalbuf;
-        finalbuf.Copy( hexbuf );
-        finalbuf.Append( _L(" | " ) );
-        finalbuf.Append( stringbuf );
-        DebugLog( finalbuf );
-        }
-    }
-
-/*---------------------------------------------------------------------------*/
-class TOverflowHandler : public TDes16Overflow
-    {
-    void Overflow( TDes16& aDes )
-        {
-        TBuf<KLogEntryMaxLength> logString( _L("LOG ERROR: overflow: ") );
-        logString.Append( aDes.Left(
-            KLogEntryMaxLength - logString.Length() ) );
-        aDes.Copy( logString );
-        }
-    };
-
-/*---------------------------------------------------------------------------*/
-// Usage example: DOLOG(_L("Logstring"));
-void DebugLog( TRefByValue<const TDesC> aFmt, ... )
-    {
-    VA_LIST list;
-    VA_START( list, aFmt );
-    Log( KLogLevelDebug, aFmt, list );
-    }
-
-/*---------------------------------------------------------------------------*/
-void InfoLog( TRefByValue<const TDesC> aFmt, ... )
-    {
-    VA_LIST list;
-    VA_START( list, aFmt );
-    Log( KLogLevelInfo, aFmt, list );
-    }
-
-/*---------------------------------------------------------------------------*/
-void WarnLog( TRefByValue<const TDesC> aFmt, ... )
-    {
-    VA_LIST list;
-    VA_START( list, aFmt );
-    Log( KLogLevelWarning, aFmt, list );
-    }
-
-/*---------------------------------------------------------------------------*/
-void ErrLog( TRefByValue<const TDesC> aFmt, ...)
-    {
-    VA_LIST list;
-    VA_START( list, aFmt );
-    Log( KLogLevelError, aFmt, list );
-    }
-
-/*---------------------------------------------------------------------------*/
-void Log( TInt aLevel, TRefByValue<const TDesC> aText, VA_LIST list )
-    {
-
-    if ( aLevel < KMinimumLogLevel )
-        return;
-
-    _LIT( KLineFeed, "\n" );
-
-    /**
-     *  Log time format (see TTime) is
-     *  Day-Month-Year Hours:Minutes:Seconds:Milliseconds
-     *
-     *  Example: 30-12-2004 23:00:55:990
-     */
-    _LIT( KLogTimeFormat, "%F%D-%M-%Y %H:%T:%S:%*C3" );
-
-    TBuf8<KLogEntryMaxLength> writeBuffer;
-    TBuf16<KLogEntryMaxLength> logEntry;
-    RFs FileServer;
-    RFile File;
-
-    if ( FileServer.Connect() != KErrNone )
-        {
-        FileServer.Close(); // just in case
-        User::Panic( KLogPanicCategory(), KPanicFsConnectFailed );
-        return;
-        }
-
-    // Open file for writing, if exists. Othervise create new file.
-    if ( File.Open( FileServer, KLogFileName(), EFileWrite ) != KErrNone )
-        {
-        if ( File.Create( FileServer, KLogFileName(), EFileWrite )
-            != KErrNone )
-            {
-            FileServer.Close();
-            User::Panic( KLogPanicCategory(), KPanicFileCreateFailed );
-            }
-        }
-
-    TTime currentTime;
-    currentTime.UniversalTime();
-    TBuf<32> timeString;
-
-    // currentTime is now in universal time. Convert it to home time.
-    TLocale locale;
-    TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
-    TTimeIntervalHours daylightSaving( 0 );
-    if ( locale.QueryHomeHasDaylightSavingOn() )
-        {
-        daylightSaving = 1;
-        }
-    currentTime = currentTime + universalTimeOffset + daylightSaving;
-    currentTime.FormatL( timeString, KLogTimeFormat );
-
-    // Add LogString to the end of file and close the file
-    TInt currentSize = 0, returnCode;
-    writeBuffer.Append( timeString );
-    writeBuffer.Append( _L(": ") );
-
-    if ( aLevel < KLogLevelInfo )
-        writeBuffer.Append(KDebugStr);
-    else if ( aLevel < KLogLevelWarning )
-        writeBuffer.Append(KInfoStr);
-    else if ( aLevel < KLogLevelError )
-        writeBuffer.Append(KWarnStr);
-    else
-        writeBuffer.Append(KErrStr);
-
-    logEntry.AppendFormatList( aText, list ); //, &overFlowHandler );
-    writeBuffer.Append( logEntry.Left(
-        KLogEntryMaxLength - writeBuffer.Length() ) );
-    writeBuffer.Append( KLineFeed );
-    File.Size( currentSize );
-    returnCode = File.Write( currentSize,
-                             writeBuffer,
-                             writeBuffer.Length() );
-    File.Close();
-    // Close file server session
-    FileServer.Close();
-
-    if ( returnCode != KErrNone )
-        {
-        User::Panic( KLogPanicCategory(), KPanicFileWriteFailed );
-        }
-    }
-
-#endif // __ENABLE_LOGGING__
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/eabi/HtiBtCommInterfaceu.def	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-EXPORTS
-	_ZN19RHtiBtCommInterface10CancelSendEv @ 1 NONAME
-	_ZN19RHtiBtCommInterface13CancelReceiveEv @ 2 NONAME
-	_ZN19RHtiBtCommInterface4SendERK6TDesC8R14TRequestStatus @ 3 NONAME
-	_ZN19RHtiBtCommInterface5CloseEv @ 4 NONAME
-	_ZN19RHtiBtCommInterface7ConnectER6TDesC8i @ 5 NONAME
-	_ZN19RHtiBtCommInterface7ReceiveER5TDes8R14TRequestStatus @ 6 NONAME
-	_ZN19RHtiBtCommInterfaceC1Ev @ 7 NONAME
-	_ZN19RHtiBtCommInterfaceC2Ev @ 8 NONAME
-	_ZNK19RHtiBtCommInterface13GetPortNumberEv @ 9 NONAME
-	_ZNK19RHtiBtCommInterface17GetSendBufferSizeEv @ 10 NONAME
-	_ZNK19RHtiBtCommInterface20GetReceiveBufferSizeEv @ 11 NONAME
-	_ZNK19RHtiBtCommInterface7VersionEv @ 12 NONAME
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/eabi/HtiBtCommServeru.def	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-EXPORTS
-	_Z11StartThreadv @ 1 NONAME
-	_ZTI16CHtiBtCommServer @ 2 NONAME ; #<TI>#
-	_ZTI23CHtiBtCommServerSession @ 3 NONAME ; #<TI>#
-	_ZTV16CHtiBtCommServer @ 4 NONAME ; #<VT>#
-	_ZTV23CHtiBtCommServerSession @ 5 NONAME ; #<VT>#
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/eabi/HtiBtSerialComHelperu.def	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-EXPORTS
-	_ZN15CBtSerialClient10ConnectingEv @ 1 NONAME
-	_ZN15CBtSerialClient10DisconnectEv @ 2 NONAME
-	_ZN15CBtSerialClient10ReadAsyncLEv @ 3 NONAME
-	_ZN15CBtSerialClient11ServicePortEv @ 4 NONAME
-	_ZN15CBtSerialClient14ServerAddressLEv @ 5 NONAME
-	_ZN15CBtSerialClient17SendBufferMaxSizeEv @ 6 NONAME
-	_ZN15CBtSerialClient21FreeSpaceInSendBufferEv @ 7 NONAME
-	_ZN15CBtSerialClient4NewLER23MBtSerialClientObserver @ 8 NONAME
-	_ZN15CBtSerialClient5SendLERK6TDesC8 @ 9 NONAME
-	_ZN15CBtSerialClient8ConnectLE10TBTDevAddri @ 10 NONAME
-	_ZN15CBtSerialClient8ConnectLERK7TDesC16i @ 11 NONAME
-	_ZN15CBtSerialClient8ConnectLEv @ 12 NONAME
-	_ZN15CBtSerialClient9ConnectedEv @ 13 NONAME
-	_ZN15CBtSerialClientD0Ev @ 14 NONAME
-	_ZN15CBtSerialClientD1Ev @ 15 NONAME
-	_ZN15CBtSerialClientD2Ev @ 16 NONAME
-	_ZTI13CTimeOutTimer @ 17 NONAME ; #<TI>#
-	_ZTI14CSocketsReader @ 18 NONAME ; #<TI>#
-	_ZTI14CSocketsWriter @ 19 NONAME ; #<TI>#
-	_ZTI15CBtSerialClient @ 20 NONAME ; #<TI>#
-	_ZTI18CBTServiceSearcher @ 21 NONAME ; #<TI>#
-	_ZTI19TSdpAttributeParser @ 22 NONAME ; #<TI>#
-	_ZTI23CMessageServiceSearcher @ 23 NONAME ; #<TI>#
-	_ZTV13CTimeOutTimer @ 24 NONAME ; #<VT>#
-	_ZTV14CSocketsReader @ 25 NONAME ; #<VT>#
-	_ZTV14CSocketsWriter @ 26 NONAME ; #<VT>#
-	_ZTV15CBtSerialClient @ 27 NONAME ; #<VT>#
-	_ZTV18CBTServiceSearcher @ 28 NONAME ; #<VT>#
-	_ZTV19TSdpAttributeParser @ 29 NONAME ; #<VT>#
-	_ZTV23CMessageServiceSearcher @ 30 NONAME ; #<VT>#
-
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtComm.cfg	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-# HTIBtComm communication plugin configuration file
-
-# Following parameters configure the PC where HTI will try to connect.
-# Define only one of them, either PC's Bluetooth name or Bluetooth address.
-# If both are defined, address will be used and name is ignored.
-# If neither is defined the device selection dialog will be shown and user
-# has to select the device where to connect.
-#
-# The BtDeviceAddress must be 12 hex characters.
-
-#BtDeviceName=MyComputer
-#BtDeviceAddress=01A2B3C4D5EF
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtCommEcomPlugin.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ECOM Plugin project to support communication over serial port
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET          HtiBtCommEcomPlugin.dll
-TARGETTYPE      PLUGIN
-
-// ECom Dll recognition UID followed by the unique UID for this dll
-UID             0x10009D8D 0x200212CB
-
-VENDORID        0x101FB657
-
-CAPABILITY      ALL -TCB
-
-SOURCEPATH      ../HtiBtCommEcomPlugin/src
-SOURCE          proxy.cpp
-SOURCE          HtiBtCommEcomPlugin.cpp
-
-USERINCLUDE     ../HtiBtCommEcomPlugin/inc ../BtEngine/inc ../HtiBtCommServer/inc
-APP_LAYER_SYSTEMINCLUDE
-
-START RESOURCE  ../data/200212CB.rss
-TARGET          HtiBtCommEcomPlugin.rsc
-END
-
-LIBRARY         euser.lib
-LIBRARY         ecom.lib
-LIBRARY         c32.lib
-LIBRARY         hticfg.lib
-LIBRARY         htibtcomminterface.lib
-LIBRARY         flogger.lib
-
-SMPSAFE
-
-// End of file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtCommInterface.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  HtiBtCommInterface. Client interface to HtiBtCommServer
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET          HtiBtCommInterface.dll
-TARGETTYPE      DLL
-
-UID             0x200212D2
-DEFFILE         HtiBtCommInterface.def
-
-VENDORID       0x101FB657
-
-CAPABILITY      ALL -TCB
-
-SOURCEPATH      ../HtiBtCommServer/src
-SOURCE          HtiBtCommInterface.cpp
-
-USERINCLUDE     ../HtiBtCommServer/inc
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY         euser.lib
-LIBRARY         htibtcommserver.lib
-LIBRARY         flogger.lib
-
-SMPSAFE
-
-// End of file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtCommServer.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  HtiBtCommServer DLL project
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET          HtiBtCommServer.dll
-TARGETTYPE      DLL
-
-UID             0x200212D1
-DEFFILE         HtiBtCommServer.def
-
-VENDORID        0x101FB657
-
-CAPABILITY      ALL -TCB
-
-SOURCEPATH      ../HtiBtCommServer/src
-SOURCE          HtiBtCommServer.cpp
-SOURCE          HtiBtCommServerSession.cpp
-SOURCE          Logger.cpp
-
-USERINCLUDE     ../HtiBtCommServer/inc  ../BtEngine/inc
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY         euser.lib
-LIBRARY         efsrv.lib
-LIBRARY         bluetooth.lib
-LIBRARY         HtiBtSerialComHelper.lib
-
-SMPSAFE
-
-// End of file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/group/HtiBtSerialComHelper.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  HtiBtSerialComHelper project definition.
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-TARGET          HtiBtSerialComHelper.dll
-TARGETTYPE      DLL
-
-UID             0x1000008d 0x200212D3
-
-VENDORID        0x101FB657
-
-CAPABILITY      ALL -TCB
-
-SOURCEPATH      ../BtEngine/src
-SOURCE          timeouttimer.cpp
-SOURCE          socketsreader.cpp
-SOURCE          socketswriter.cpp
-SOURCE          BtSerialClient.cpp
-SOURCE          messageservicesearcher.cpp
-SOURCE          btservicesearcher.cpp
-SOURCE          sdpattributeparser.cpp
-
-USERINCLUDE     ../BtEngine/inc
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY         apparc.lib
-LIBRARY         avkon.lib
-LIBRARY         eikcoctl.lib
-LIBRARY         eikcore.lib
-LIBRARY         bafl.lib
-LIBRARY         bluetooth.lib
-LIBRARY         btextnotifiers.lib
-LIBRARY         btmanclient.lib
-LIBRARY         btdevice.lib
-LIBRARY         btengsettings.lib
-LIBRARY         cone.lib
-LIBRARY         efsrv.lib
-LIBRARY         esock.lib
-LIBRARY         euser.lib
-LIBRARY         flogger.lib
-LIBRARY         sdpagent.lib
-LIBRARY         sdpdatabase.lib
-
-SMPSAFE
-
-// End of file
--- a/htiui/HtiCommPlugins/HtiBtCommPlugin/group/bld.inf	Tue Apr 27 16:38:40 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 component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  HtiBtCommPlugin build info
-*
-*/
-
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-HtiBtSerialComHelper.mmp
-HtiBtCommServer.mmp
-HtiBtCommInterface.mmp
-HtiBtCommEcomPlugin.mmp
--- a/htiui/HtiDeviceReboot/group/HtiDeviceReboot.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiDeviceReboot/group/HtiDeviceReboot.mmp	Tue May 11 16:14:15 2010 +0300
@@ -20,7 +20,7 @@
 TARGET          HtiDeviceRebootUI.exe
 TARGETTYPE      EXE
 
-UID             0x200212D6
+UID             0x1000008d 0x200212D6
 
 VENDORID        0x101FB657
 
--- a/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiDeviceReboot/src/HtiDeviceReboot.cpp	Tue May 11 16:14:15 2010 +0300
@@ -35,7 +35,7 @@
 
 // LOCAL FUNCTION PROTOTYPES
 LOCAL_C TInt StartL();
-LOCAL_C TInt Reboot();
+LOCAL_C TInt Reboot(RStarterSession::TResetReason aReason);
 LOCAL_C TInt RestoreFactorySettings( TBool aIsDeepRfs );
 
 
@@ -54,12 +54,15 @@
 
     if ( cmdLen == 0 )
         {
-        error = Reboot();
+        error = Reboot(RStarterSession::EUnknownReset);
         }
 
     else
         {
         TLex parser( *cmdLine );
+        TInt input;
+        TInt ret = parser.Val(input);
+        
         parser.SkipCharacters();
         if ( parser.MarkedToken().CompareF( KParamNormalRfs ) == 0 )
             {
@@ -71,7 +74,14 @@
             }
         else
             {
-            error = KErrArgument;  // Unknown argument
+            if(ret != KErrNone )
+                {
+                error = KErrArgument;  // Unknown argument
+                }
+            else
+                {
+                error = Reboot((RStarterSession::TResetReason)input);
+                }
             }
         }
 
@@ -79,13 +89,13 @@
     return error;
     }
 
-LOCAL_C TInt Reboot()
+LOCAL_C TInt Reboot(RStarterSession::TResetReason aReason)
     {
     RStarterSession session;
     TInt error = session.Connect();
     if ( error == KErrNone )
         {
-        session.Reset( RStarterSession::EUnknownReset );
+        session.Reset( aReason );
         session.Close();
         }
     return error;
--- a/htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/group/HtiAppControl.mmp	Tue May 11 16:14:15 2010 +0300
@@ -45,9 +45,7 @@
 LIBRARY     ws32.lib
 LIBRARY     swinstcli.lib
 LIBRARY     sisregistryclient.lib
-#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 LIBRARY     javaregistryclient.lib
-#endif
 LIBRARY     widgetregistryclient.lib
 LIBRARY     flogger.lib
 
--- a/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiAppServicePlugin/src/HtiAppControl.cpp	Tue May 11 16:14:15 2010 +0300
@@ -34,14 +34,10 @@
 #include <SWInstApi.h>
 #include <swi/sisregistrysession.h>
 #include <swi/sisregistrypackage.h>
-#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
-    #include <javaregistryincludes.h>
-#endif
-#include <WidgetRegistryClient.h>
+#include <javaregistryincludes.h>
+#include <widgetregistryclient.h>
 
-#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
-    using namespace Java;
-#endif
+using namespace Java;
 
 // CONSTANTS
 const static TUid KAppServiceUid = { 0x1020DEC7 }; //This is Uid of AppServiceOS
@@ -1638,7 +1634,6 @@
 
     else if ( aMimeIndex > 2 && aMimeIndex < 7 ) // Java
         {
-        #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
             RArray<TUid> uids;
             CleanupClosePushL( uids );
 
@@ -1675,9 +1670,6 @@
             CleanupStack::PopAndDestroy( &uids );
             User::LeaveIfError( uid );
             return uid;
-        #else
-            User::Leave( KErrNotSupported );
-        #endif
         }
 
     else if ( aMimeIndex == 7 ) // Widget
--- a/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/HtiKeyEventServicePlugin.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/group/HtiKeyEventServicePlugin.mmp	Tue May 11 16:14:15 2010 +0300
@@ -33,6 +33,7 @@
 SOURCE          HtiKeyEventServicePlugin.cpp
 SOURCE          KeyEventHandler.cpp
 SOURCE          PointerEventHandler.cpp
+SOURCE			MultiTouchPointerEventHandler.cpp MultiTouchPointerEvent.cpp
 
 USERINCLUDE     ../inc
 APP_LAYER_SYSTEMINCLUDE
--- a/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/HtiKeyEventServicePlugin.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/HtiKeyEventServicePlugin.h	Tue May 11 16:14:15 2010 +0300
@@ -67,6 +67,7 @@
 
     CKeyEventHandler* iKeyHandler;
     CPointerEventHandler* iPointerHandler;
+
     TInt iLightTimeout;
     CRepository* iCenRepSession;
     CCenRepNotifyHandler* iLightTimeoutSettingHandler;
--- a/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/KeyEventHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/KeyEventHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -64,6 +64,7 @@
         ELongKeyPress     = 0x05,
         ETypeTextPassword = 0x06,
         EPressKeySequence = 0x07,
+        EPointer          = 0x10,
         EResultOk = 0xFF // only for response message
         };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEvent.h	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Functional implementation of one touch(pointer sequence) event service.
+*
+*/
+
+#ifndef CMULTITOUCHPOINTER_UNIT_H
+#define CMULTITOUCHPOINTER_UNIT_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+#include <w32std.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CMultiTouchPointerEventHandler;
+
+/**
+*  Functional implentation of pointer event service.
+*/
+class CMultiTouchPointerEvent : public CActive
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMultiTouchPointerEvent* NewL(TUint8 aTouchNumber,
+                CMultiTouchPointerEventHandler* aEventHandler);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMultiTouchPointerEvent();       
+
+
+        /**
+         * Touch active object start function
+         * @param aDelayTime initial wait time to start "finger" down for touch
+         */
+        void StartTouch();
+        
+        void AddPointL(TTimeIntervalMicroSeconds32 aTime,
+        		TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+        
+        void PrintInfo();
+        
+        /**
+         * Insert a dragging event between two given pointers
+         * Interpolate pointer sequence with step aStepCount and dragging time.
+         * @param aX1, aY1, aZ1 3D coordinate of start point
+         * @param aX2, aY2, aZ2 3D coordinate of end point
+         * @param aDragTime dragging time between start point and end point
+         * @param aStepCount step count between two points
+         */
+        void InterpolatePointL(TInt aX1,TInt aY1, TInt aZ1, TInt aX2,TInt aY2, TInt aZ2, 
+                TTimeIntervalMicroSeconds32 aDragTime, TInt aStepCount);
+        
+    protected: // Functions from base classes
+
+        // From CActive
+        void RunL();
+        TInt RunError(TInt aError);
+        void DoCancel();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMultiTouchPointerEvent(TUint8 aTouchNumber, CMultiTouchPointerEventHandler* aEventHandler);
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+        void  SimulatePointerEvent();
+        
+        /**
+         * Insert an advanced pointer to pointer sequence array for a touch
+         * @param aX, aY, aZ pointer 3D coordinate
+         * @param aEventType event type
+         */
+        void InsertPointArrayL(TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+
+        /**
+         * Insert time duration to time array
+         * @param aDelayTime time duation to wait for
+         */
+        void InsertTimeArrayL(TTimeIntervalMicroSeconds32 aDelayTime); 
+        
+    private: // data
+
+        struct TAdvancedPointer
+            {
+            TInt             X;
+            TInt             Y;
+            TInt             Z; 
+            TRawEvent::TType EventType;
+            };  
+        
+        CMultiTouchPointerEventHandler* iEventHandler;
+        TUint8 iTouchNumber;
+
+        RTimer iTimer;
+
+		RPointerArray<TAdvancedPointer> iAdvPointerArray;
+		RPointerArray<TTimeIntervalMicroSeconds32> iTimeArray;
+		};
+
+#endif // CMULTITOUCHPOINTER_UNIT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/MultiTouchPointerEventHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Functional implementation of advanced pointer multitouch service.
+*
+*/
+
+#ifndef CMULTITOUCHPOINTEREVENTHANDLER_H
+#define CMULTITOUCHPOINTEREVENTHANDLER_H
+
+// INCLUDES
+#include <HtiServicePluginInterface.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+class CMultiTouchPointerEvent;
+
+/**
+* Observer interface for Multi touch event.
+*/
+class MHtiMultiTouchObserver
+    {
+public:
+    /**
+    * Notify multi touch event completed
+    */
+    virtual void NotifyMultiTouchComplete() = 0;
+
+    };
+/**
+*  Functional implentation of pointer event service.
+*/
+class CMultiTouchPointerEventHandler
+    {
+    public:
+        /**
+        * Two-phased constructor.
+        */
+        static CMultiTouchPointerEventHandler* NewL(MHtiMultiTouchObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMultiTouchPointerEventHandler();      
+
+
+        TBool HandleMultiTouchL( const TDesC8& aData );
+
+        /**
+         * Callback function called by CMultiTouchPointerEvent to notify CMultiTouchPointerEventHandler 
+         * that this touch action(pointer sequence) is conpleted.
+         * @param aTouchNumber touch number ordinal
+         */
+        void NotifyTouchComplete(TUint8 aTouchNumber);        
+     
+        void SimulateEvent(TUint8 aTouchNumber,TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType);
+        
+        void Clear();
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMultiTouchPointerEventHandler(MHtiMultiTouchObserver& aObserver);
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+        
+        TBool ParsePoint( const TDesC8& aData, TInt& aoffset,
+        		TInt& aX, TInt& aY, TInt& aZ, 
+        		TTimeIntervalMicroSeconds32& aWait, TTimeIntervalMicroSeconds32& aHold );
+        
+        TBool ParseMove( const TDesC8& aData, TInt& aoffset,
+        		TTimeIntervalMicroSeconds32& aDragTime, TInt& aStepCount );
+
+    private: // data
+        RWsSession iWsSession;
+        RPointerArray<CMultiTouchPointerEvent> iTouchPointerArray;
+        TUint8 iFinishedCount;
+        
+        MHtiMultiTouchObserver& iObserver;
+		};
+
+#endif // CKEYEVENTHANDLER_H
--- a/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/PointerEventHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/inc/PointerEventHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 // INCLUDES
 #include <HtiServicePluginInterface.h>
 #include <w32std.h>
-
+#include "MultiTouchPointerEventHandler.h"
 // CONSTANTS
 
 // MACROS
@@ -38,7 +38,9 @@
 /**
 *  Functional implentation of pointer event service.
 */
-class CPointerEventHandler : public CActive
+class CPointerEventHandler : 
+	public CActive,
+	public MHtiMultiTouchObserver
     {
     public:
 
@@ -57,8 +59,9 @@
             ETapAndDragMultipoint = 0x12,
             EPressPointerDown = 0x13,
             ELiftPointerUp = 0x14,
-			EAdvancedTapScreen = 0x15, //for advanced
-			EPinchZoom = 0x16, //for advanced
+			EAdvancedTapScreen = 0x15, //for advanced pointer
+			EPinchZoom = 0x16, //for advanced pointer
+			EMultiTouch = 0x17, //for advanced pointer
             EResultOk = 0xFF // only for response message
             };
 
@@ -111,6 +114,9 @@
         void RunL();
         TInt RunError(TInt aError);
         void DoCancel();
+        
+        // From MHtiMultiTouchObserver
+        void NotifyMultiTouchComplete();
 
     private:
 
@@ -129,8 +135,11 @@
         void HandleTapAndDragL( const TDesC8& aData );
         void HandleTapAndDragMultipointL( const TDesC8& aData );
         void HandlePointerDownOrUpL( const TDesC8& aData );
-		void HandleAdvancedTapScreenL( const TDesC8& aData ); //for advanced
-        void HandlePinchZoomL( const TDesC8& aData ); //for advanced
+        
+        //for advanced pointer
+		void HandleAdvancedTapScreenL( const TDesC8& aData ); 
+        void HandlePinchZoomL( const TDesC8& aData ); 
+        void HandleMultiTouchL( const TDesC8& aData );
 
         void SendOkMsgL();
         void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
@@ -166,6 +175,8 @@
 		
 		RPointerArray<TAdvancedPointer> iAdvPointerMoveArray;
 		RPointerArray<TTimeIntervalMicroSeconds32> iDelayArray;
+		
+		CMultiTouchPointerEventHandler* iMultiTouchHandler;
 		};
 
 #endif // CKEYEVENTHANDLER_H
--- a/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/HtiKeyEventServicePlugin.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/HtiKeyEventServicePlugin.cpp	Tue May 11 16:14:15 2010 +0300
@@ -61,6 +61,7 @@
     HTI_LOG_TEXT( "CHtiKeyEventServicePlugin destroy" );
     delete iKeyHandler;
     delete iPointerHandler;
+
     if ( iLightTimeoutSettingHandler )
         {
         iLightTimeoutSettingHandler->StopListening();
@@ -120,7 +121,7 @@
         iKeyHandler->ProcessMessageL( aMessage, aPriority );
         }
 
-    else
+    else 
         {
         if ( iPointerHandler == NULL )
             {
@@ -128,7 +129,8 @@
             iPointerHandler->SetDispatcher( iDispatcher );
             }
         iPointerHandler->ProcessMessageL( aMessage, aPriority );
-        }
+        }   
+
 
     HTI_LOG_FUNC_OUT( "CHtiKeyEventServicePlugin::ProcessMessageL: Done" );
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEvent.cpp	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Functional implementation of one touch(pointer sequence) event service.
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "MultiTouchPointerEvent.h"
+#include "MultiTouchPointerEventHandler.h"
+
+#include <HtiLogging.h>
+
+
+// CONSTANTS
+_LIT8( KErrorInternalFailure, "Internal pointer command failure" );
+_LIT (KPrintInfoString, "PrintInfo event id=%d time=%d type=%d X=%d Y=%d Z=%d");
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerUnit::NewL()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent* CMultiTouchPointerEvent::NewL(TUint8 aTouchNumber,
+        CMultiTouchPointerEventHandler* aEventHandler)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::NewL" );
+    CMultiTouchPointerEvent* self = new (ELeave) CMultiTouchPointerEvent(aTouchNumber, aEventHandler);
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::CMultiTouchPointerEvent()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent::CMultiTouchPointerEvent(TUint8 aTouchNumber,
+        CMultiTouchPointerEventHandler *aEventHandler)
+    : CActive(CActive::EPriorityStandard),
+      iEventHandler(aEventHandler),
+      iTouchNumber(aTouchNumber)
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEvent constructor" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::~CMultiTouchPointerEvent()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEvent::~CMultiTouchPointerEvent()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEvent destructor" );
+    Cancel();
+    iTimer.Close();
+	
+    iTimeArray.ResetAndDestroy(); 
+	iAdvPointerArray.ResetAndDestroy(); 
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::ConstructL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::ConstructL()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEvent::ConstructL" );
+    iTimeArray.Reset(); 
+
+    User::LeaveIfError( iTimer.CreateLocal() );
+    CActiveScheduler::Add( this );
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::StartTouch()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::StartTouch()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::StartTouch" );
+    TBool bcontinue=ETrue;
+    while (iTimeArray.Count()>0 && bcontinue)
+        {
+        TTimeIntervalMicroSeconds32* time=iTimeArray[0];
+        iTimeArray.Remove(0);        
+    	HTI_LOG_FORMAT( "Event time=%d ", time->Int() );    	
+        if (time->Int()==0) 
+            {
+			// execute immediately            
+			SimulatePointerEvent(); 
+            }
+        else
+        	{
+			// wait for specified time
+			iTimer.After( iStatus, *time );
+			SetActive();        
+			bcontinue=EFalse;
+        	}
+        delete time;
+        }
+    
+    if (iTimeArray.Count()==0)
+    	{
+		HTI_LOG_FORMAT( "Notify touch %d complete", iTouchNumber );
+		iEventHandler->NotifyTouchComplete(iTouchNumber);  
+    	}
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::StartTouch" );
+    }
+
+// ----------------------------------------------------------------------------
+// void CMultiTouchPointerEvent::InsertPointArrayL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InsertPointArrayL(TInt aX,TInt aY,TInt aZ,TRawEvent::TType aEventType)
+    {
+
+    TAdvancedPointer* point = new (ELeave) TAdvancedPointer;
+    CleanupStack::PushL(point);
+    iAdvPointerArray.AppendL(point);
+    CleanupStack::Pop();
+
+    point->X=aX;
+    point->Y=aY;
+    point->Z=aZ;
+    point->EventType=aEventType;
+
+    }
+
+// ----------------------------------------------------------------------------
+// void CMultiTouchPointerEvent::InsertTimeArrayL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InsertTimeArrayL(TTimeIntervalMicroSeconds32 aDelayTime)
+    {
+
+    TTimeIntervalMicroSeconds32* time=new (ELeave) TTimeIntervalMicroSeconds32(aDelayTime);
+    iTimeArray.AppendL(time);
+
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::InterpolatePointL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::InterpolatePointL(TInt aX1,TInt aY1, TInt aZ1, 
+        TInt aX2,TInt aY2, TInt aZ2, TTimeIntervalMicroSeconds32 aDragTime, TInt aStepCount)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::InterpolatePointL" );
+    TInt dx = (aX2-aX1)/aStepCount;
+    TInt dy = (aY2-aY1)/aStepCount;  
+    
+    TTimeIntervalMicroSeconds32 dt = aDragTime.Int()/aStepCount;
+    TInt X,Y,Z;
+    for (TInt i=1;i<=aStepCount;i++)
+        {         
+        if (i<aStepCount)
+            {
+            X=aX1+i*dx;
+            Y=aY1+i*dy;
+            Z=aZ1;
+            }
+        else
+            {
+            X=aX2;
+            Y=aY2;
+            Z=aZ2;
+            }             
+        AddPointL(dt,X,Y,Z,TRawEvent::EPointerMove);        
+        }
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::InterpolatePointL" );
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::RunL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::RunL()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::RunL" );
+    SimulatePointerEvent();
+    StartTouch();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::RunL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::RunError()
+// ----------------------------------------------------------------------------
+TInt CMultiTouchPointerEvent::RunError( TInt aError )
+    {
+    HTI_LOG_FORMAT( "CMultiTouchPointerEvent::RunError %d", aError );
+
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::DoCancel()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::DoCancel()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::DoCancel" );
+    iTimer.Cancel();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::DoCancel" );
+    }
+
+void CMultiTouchPointerEvent::PrintInfo()
+	{
+#ifdef __ENABLE_LOGGING__
+	HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::PrintInfo" );
+	
+	HTI_LOG_FORMAT( "PrintInfo touch number=%d ", iTouchNumber );
+	
+	TInt size=iTimeArray.Count(); 
+	HTI_LOG_FORMAT( "PrintInfo event array=%d ", size );	
+
+	TBuf<255> buf;
+
+	for (TInt i=0;i<size;i++)
+		{
+        buf.Format(KPrintInfoString, 
+                i, iTimeArray[i]->Int(),iAdvPointerArray[i]->EventType ,
+                iAdvPointerArray[i]->X ,iAdvPointerArray[i]->Y, iAdvPointerArray[i]->Z );
+        HTI_LOG_DES(buf);
+		}
+	HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::PrintInfo" );
+#endif
+	}
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEvent::SimulatePointerEvent()
+// Sends the pointer event as a raw event.
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEvent::SimulatePointerEvent()
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEvent::SimulatePointerEvent" );    
+       
+	if (iAdvPointerArray.Count()>0)
+        {
+        TAdvancedPointer* pointer = iAdvPointerArray[0];    
+        iAdvPointerArray.Remove(0);
+        
+        iEventHandler->SimulateEvent(iTouchNumber, pointer->X, pointer->Y, pointer->Z,pointer->EventType);        
+        delete pointer;
+        }
+
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEvent::SimulatePointerEvent" );
+
+    }
+void CMultiTouchPointerEvent::AddPointL(TTimeIntervalMicroSeconds32 aTime,
+		TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType)
+	{
+	InsertPointArrayL( aX, aY, aZ,aEventType);
+	InsertTimeArrayL(aTime);
+	}
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/MultiTouchPointerEventHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Functional implementation of advanced pointer multitouch service
+*
+*/
+
+// INCLUDE FILES
+#include "HtiKeyEventServicePlugin.h"
+#include "MultiTouchPointerEventHandler.h"
+#include "MultiTouchPointerEvent.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+// CONSTANTS
+
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::NewL()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler* CMultiTouchPointerEventHandler::NewL(MHtiMultiTouchObserver& aObserver)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::NewL" );
+    CMultiTouchPointerEventHandler* self = new (ELeave) CMultiTouchPointerEventHandler(aObserver);
+    CleanupStack::PushL ( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::CMultiTouchPointerEventHandler()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler::CMultiTouchPointerEventHandler(MHtiMultiTouchObserver& aObserver)
+	:iFinishedCount(0),	iObserver(aObserver)
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEventHandler constructor" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::~CMultiTouchPointerEventHandler()
+// ----------------------------------------------------------------------------
+CMultiTouchPointerEventHandler::~CMultiTouchPointerEventHandler()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEventHandler destructor" );    
+    Clear();
+    iWsSession.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ConstructL()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::ConstructL()
+    {
+    HTI_LOG_TEXT( "CMultiTouchPointerEventHandler::ConstructL" ); 
+    User::LeaveIfError( iWsSession.Connect() );
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::Clear()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::Clear()
+	{
+	HTI_LOG_TEXT( "CMultiTouchPointerEventHandler::Clear" ); 
+	iTouchPointerArray.ResetAndDestroy();
+	iFinishedCount=0;
+	}
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::NotifyTouchComplete()
+// ----------------------------------------------------------------------------
+void CMultiTouchPointerEventHandler::NotifyTouchComplete(TUint8 aTouchNumber)
+    {
+    HTI_LOG_FUNC_IN("CMultiTouchPointerEventHandler::NotifyTouchComplete");
+    
+    iFinishedCount++;
+    HTI_LOG_FORMAT( "touch number %d finished", aTouchNumber);
+    HTI_LOG_FORMAT( "%d touch finished", iFinishedCount);
+    
+    if(iTouchPointerArray.Count() == iFinishedCount)
+    	{
+		// notify observer
+		iObserver.NotifyMultiTouchComplete();
+    	}
+    
+    HTI_LOG_FUNC_OUT("CMultiTouchPointerEventHandler::NotifyTouchComplete");
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ParsePoint()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::ParsePoint( const TDesC8& aData, TInt& aoffset,
+		TInt& aX, TInt& aY, TInt& aZ, 
+		TTimeIntervalMicroSeconds32& aWait, TTimeIntervalMicroSeconds32& aHold )
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::ParsePoint" );
+    
+    TInt dataLength = aData.Length();
+    if ( dataLength-aoffset < 14 ) 
+        return EFalse ;
+    
+    aX = aData[aoffset] + ( aData[aoffset+1] << 8 );
+    aoffset += 2;
+    
+    aY = aData[aoffset] + ( aData[aoffset+1] << 8 );
+    aoffset += 2;
+
+    aZ = aData[aoffset] + ( aData[aoffset+1] << 8 );
+    aoffset += 2;
+
+    aWait = (aData[aoffset] + ( aData[aoffset+1] << 8 )
+                + ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+    aoffset += 4;      
+    
+    aHold = ( aData[aoffset] + ( aData[aoffset+1] << 8 )
+                + ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+    aoffset += 4;
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::ParsePoint" );
+    return ETrue;
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::ParseMove()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::ParseMove( const TDesC8& aData, TInt& aoffset,
+		TTimeIntervalMicroSeconds32& aDragTime, TInt& aStepCount )
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::ParseMove" );
+    
+    TInt dataLength = aData.Length();
+    if ( dataLength-aoffset < 6 ) 
+        return EFalse ;
+    
+    aDragTime = ( aData[aoffset] + ( aData[aoffset+1] << 8 )
+				+ ( aData[aoffset+2] << 16 ) + (aData[aoffset+3] << 24) ) * 1000;
+    aoffset += 4;
+    
+	aStepCount = aData[aoffset] + ( aData[aoffset+1] << 8 );
+	aoffset += 2;
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::ParseMove" );
+    return ETrue;
+    }
+// ----------------------------------------------------------------------------
+// CMultiTouchPointerEventHandler::HandleMultiTouchL()
+// ----------------------------------------------------------------------------
+TBool CMultiTouchPointerEventHandler::HandleMultiTouchL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::HandleMultiTouchL" );
+    TBool validparameter=EFalse;
+    
+    TInt dataLength = aData.Length();
+    if ( dataLength < 1 )
+        return validparameter;
+	
+    // Parse the parameters - correct length is already verified
+	TInt offset = 0;
+
+    TInt touchCount = aData[offset];
+    offset += 1;
+    HTI_LOG_FORMAT( "Number of touches: %d", touchCount );
+    if (touchCount<=0)
+    	return validparameter;
+
+    for(TInt i=0; i<touchCount; i++)
+        {
+        //check valid data length
+        if(dataLength-offset < 3)
+            return validparameter;
+        
+        TInt pointerNumber = aData[offset];
+        offset += 1;
+        HTI_LOG_FORMAT( "Pointer Number %d", pointerNumber );
+        
+        TInt pointerCount = aData[offset] + ( aData[offset+1] << 8 );
+        offset += 2;
+        HTI_LOG_FORMAT( "Number of points: %d", pointerCount );
+        
+        if (pointerCount == 0 )
+            return validparameter;
+        
+        CMultiTouchPointerEvent* touch = CMultiTouchPointerEvent::NewL(pointerNumber,this);        
+        CleanupStack::PushL(touch);
+        iTouchPointerArray.AppendL(touch);
+        CleanupStack::Pop();
+        
+        TInt lastX, lastY, lastZ, stepCount; 
+        TTimeIntervalMicroSeconds32 dragTime;
+        
+        for (TInt j=0;j<pointerCount;j++)
+        	{
+			// read point
+			TInt X1, Y1, Z1; 
+			TTimeIntervalMicroSeconds32 waitTime, holdTime;
+			if (!ParsePoint( aData, offset,X1, Y1, Z1, waitTime, holdTime))
+				return validparameter;
+			
+			HTI_LOG_FORMAT( "X coord down = %d", X1 );
+			HTI_LOG_FORMAT( "Y coord down = %d", Y1 );
+			HTI_LOG_FORMAT( "Z coord down = %d", Z1 );
+			HTI_LOG_FORMAT( "Event wait time = %d", waitTime.Int() );   
+			HTI_LOG_FORMAT( "Point holding time = %d", holdTime.Int() );
+			
+			if ( waitTime.Int() < 0 || holdTime.Int() < 0 )
+				return validparameter;
+			
+			// add move event from last point to this point 
+			if (j!=0)
+				{
+				HTI_LOG_FORMAT( "Point dragging time = %d", dragTime.Int() );
+				HTI_LOG_FORMAT( "Step count between two points = %d", stepCount );
+				touch->InterpolatePointL(lastX, lastY, lastZ,X1,Y1,Z1,dragTime,stepCount);
+				}				
+			
+			// set last point
+			lastX=X1;
+			lastY=Y1;
+			lastZ=Z1;
+			
+			// wait event
+			touch->AddPointL(waitTime,X1,Y1,Z1,TRawEvent::EButton1Down);
+			
+			// hold event
+			touch->AddPointL(holdTime, X1,Y1,Z1,TRawEvent::EPointerMove);
+			
+			if (j!=pointerCount-1)
+				{
+				// not last point
+				if (!ParseMove(aData, offset, dragTime, stepCount))
+					return validparameter;				
+				if (dragTime.Int() < 0 || stepCount <= 0)
+					return validparameter;        				
+				}
+			else
+				{
+				// last point
+				touch->AddPointL(0,X1,Y1,Z1,TRawEvent::EButton1Up);
+				}
+        	}  
+        
+            touch->PrintInfo();
+
+        } 
+
+    
+    for (TInt i=0;i<touchCount;i++)
+        iTouchPointerArray[i]->StartTouch();
+    
+    validparameter=ETrue;
+    
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::HandleMultiTouchL" );
+    return validparameter;
+    }	
+
+void CMultiTouchPointerEventHandler::SimulateEvent(TUint8 aTouchNumber, 
+		TInt aX, TInt aY, TInt aZ, TRawEvent::TType aEventType)
+    {
+    HTI_LOG_FUNC_IN( "CMultiTouchPointerEventHandler::SimulateEvent" );
+    
+	TRawEvent rawEvent;
+	rawEvent.SetPointerNumber( aTouchNumber ); 
+	rawEvent.Set( aEventType, aX,  aY,  aZ);   
+
+	HTI_LOG_FORMAT( "SimulatePointer touch number=%d ", aTouchNumber );
+	HTI_LOG_FORMAT( "SimulatePointer event=%d ", aEventType );
+	HTI_LOG_FORMAT( "SimulatePointer X=%d ", aX );
+	HTI_LOG_FORMAT( "SimulatePointer Y=%d ", aY );
+	HTI_LOG_FORMAT( "SimulatePointer Z=%d", aZ );
+	
+	iWsSession.SimulateRawEvent( rawEvent );
+	iWsSession.Flush();
+	
+    HTI_LOG_FUNC_OUT( "CMultiTouchPointerEventHandler::SimulateEvent" );
+
+    }
+
+// End of file
--- a/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/PointerEventHandler.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiKeyEventServicePlugin/src/PointerEventHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -19,6 +19,7 @@
 #include "HtiKeyEventServicePlugin.h"
 #include "PointerEventHandler.h"
 
+
 #include <HtiDispatcherInterface.h>
 #include <HtiLogging.h>
 
@@ -56,7 +57,7 @@
 // CPointerEventHandler::CPointerEventHandler()
 // ----------------------------------------------------------------------------
 CPointerEventHandler::CPointerEventHandler()
-    : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ),
+    : CActive( CActive::EPriorityStandard ), iReady( ETrue ), iCommand( 0 ), iMultiTouchHandler(NULL),
       iState( EPointerUp )
     {
     }
@@ -75,6 +76,7 @@
         iCoords->Close();
         }
     delete iCoords;
+    delete iMultiTouchHandler;
 	
 	iAdvancedPointers.ResetAndDestroy();
 	iDelayArray.ResetAndDestroy();  
@@ -134,6 +136,7 @@
             MoveToNextPointL(); // Continuing current line
             }
         }
+    
     else if ( iCommand == EPinchZoom )
         {
         PointerMove();
@@ -145,6 +148,13 @@
             iReady = ETrue;
             }
         }		
+    
+    else if ( iCommand == EMultiTouch )
+        {
+        SendOkMsgL();
+        iMultiTouchHandler->Clear();
+        iReady = ETrue;
+        }		
     HTI_LOG_FUNC_OUT( "CPointerEventHandler::RunL" );
     }
 
@@ -217,7 +227,9 @@
 		case EPinchZoom: 
 		    HandlePinchZoomL( aMessage.Right( aMessage.Length() - 1 ) );
             break;
-		
+		case EMultiTouch:
+			HandleMultiTouchL(aMessage.Right( aMessage.Length() - 1 ));
+			break;
         default:
             SendErrorMessageL( EUnrecognizedCommand,
                 KErrorUnrecognizedCommand );
@@ -601,7 +613,40 @@
 
     HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandlePinchZoomL" );
     }	
-
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::HandleMultiTouchL()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::HandleMultiTouchL( const TDesC8& aData )
+	{
+	HTI_LOG_FUNC_IN( "CPointerEventHandler::HandleMultiTouchL" );	
+	
+	if (iMultiTouchHandler == NULL)
+		iMultiTouchHandler=CMultiTouchPointerEventHandler::NewL(*this);	
+	
+    if ( !iMultiTouchHandler->HandleMultiTouchL ( aData ) )
+    	{
+		iMultiTouchHandler->Clear();
+		SendErrorMessageL( EInvalidParameters, KErrorInvalidParameters );
+    	}
+    else
+		iReady = EFalse;
+	
+	HTI_LOG_FUNC_OUT( "CPointerEventHandler::HandleMultiTouchL" );
+	}
+// ----------------------------------------------------------------------------
+// void CPointerEventHandler::NotifyMultiTouchComplete()
+// ----------------------------------------------------------------------------
+void CPointerEventHandler::NotifyMultiTouchComplete()
+    {
+    HTI_LOG_FUNC_IN("CPointerEventHandler::NotifyMultiTouchComplete"); 
+    
+    // wait for 1000 microsecond then clear multi touch and send ok msg 
+    TTimeIntervalMicroSeconds32 time(1000);
+    iTimer.After( iStatus, time );
+    SetActive();    
+    
+    HTI_LOG_FUNC_OUT("CPointerEventHandler::NotifyMultiTouchComplete");
+    }
 // ----------------------------------------------------------------------------
 // CPointerEventHandler::AdvancedStartDelay()
 // ----------------------------------------------------------------------------
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/HtiMessagesServicePlugin.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/group/HtiMessagesServicePlugin.mmp	Tue May 11 16:14:15 2010 +0300
@@ -54,7 +54,6 @@
 LIBRARY         euser.lib
 LIBRARY         gsmu.lib
 LIBRARY         imcm.lib
-LIBRARY         mmscli.lib
 LIBRARY         msgs.lib
 LIBRARY         smcm.lib
 LIBRARY         etel.lib
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiIAPHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiIAPHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 
 // INCLUDES
 #include <cmpsettingsconsts.h>
-#include <HTIServicePluginInterface.h>
+#include <HtiServicePluginInterface.h>
 
 // CONSTANTS
 
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMailboxHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMailboxHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 // INCLUDES
 #include <cmmanager.h>
 #include <msvapi.h>
-#include <HTIServicePluginInterface.h>
+#include <HtiServicePluginInterface.h>
 
 // CONSTANTS
 
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMessagesServicePlugin.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMessagesServicePlugin.h	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 #define CHTIMESSAGESSERVICEPLUGIN_H
 
 // INCLUDES
-#include <HTIServicePluginInterface.h>
+#include <HtiServicePluginInterface.h>
 
 // CONSTANTS
 const TInt KHtiMessagesServiceUidValue = 0x10210CCF; // ECOM Implementation UID
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMsgSettingsHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/HtiMsgSettingsHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 
 
 // INCLUDES
-#include <HTIServicePluginInterface.h>
+#include <HtiServicePluginInterface.h>
 
 // CONSTANTS
 
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/MessageMgmntHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/inc/MessageMgmntHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 
 // INCLUDES
 #include <msvapi.h>
-#include <HTIServicePluginInterface.h>
+#include <HtiServicePluginInterface.h>
 
 // CONSTANTS
 
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiIAPHandler.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiIAPHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 #include "HtiIAPHandler.h"
 
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 #include <cmconnectionmethodext.h>
 #include <cmconnectionmethoddef.h>
 #include <cmdestinationext.h>
@@ -30,7 +30,7 @@
 #include <cmpluginhscsddef.h>
 #include <cmpluginpacketdatadef.h>
 #include <cmpluginwlandef.h>
-#include <RConnMon.h>
+#include <rconnmon.h>
 
 using namespace CMManager;
 
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMailboxHandler.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMailboxHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -26,13 +26,13 @@
 #include <iapprefs.h>
 #include <imapset.h>
 #include <mtmuibas.h>
-#include <senduiconsts.h>
+#include <SendUiConsts.h>
 #include <pop3set.h>
 #include <smtpset.h>
 #include <txtrich.h>
 
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 #include "HtiMessagesServicePlugin.h"
 #include "HtiMailboxHandler.h"
 
@@ -584,9 +584,48 @@
 void CHtiMailboxHandler::HandleDeleteMailboxL( const TDesC8& aData )
     {
     HTI_LOG_FUNC_IN( "CHtiMailboxHandler::HandleDeleteMailboxL" );
-    // Deprecated
-    aData.Size();
-    User::Leave( KErrNotSupported );
+
+    // Delete by name - name should be unique
+    TInt nameLength = aData[0];
+    if ( nameLength > KEmailAccountNameSize || nameLength == 0 ||
+         aData.Length() != ( nameLength + 1 ) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TBuf<KEmailAccountNameSize> accountName;
+    accountName.Copy( aData.Mid( 1, nameLength ) );
+    HTI_LOG_FORMAT( "Searching account with name: %S", &accountName );
+
+    TSmtpAccount smtpAcc;
+    User::LeaveIfError( FindSmtpAccount( accountName, smtpAcc ) );
+    HTI_LOG_FORMAT( "Found SMTP: %d", smtpAcc.iSmtpAccountId );
+    TMsvId relatedAcc = smtpAcc.iRelatedService;
+
+    CEmailAccounts* accounts = CEmailAccounts::NewLC();
+
+    // Delete the SMTP account
+    accounts->DeleteSmtpAccountL( smtpAcc );
+
+    // Search for related POP & IMAP acconts and delete if found
+    TInt result = KErrNone;
+    TPopAccount popAcc;
+    TRAP( result, accounts->GetPopAccountL( relatedAcc, popAcc ) );
+    if ( result == KErrNone )
+        {
+        HTI_LOG_FORMAT( "Found related POP: %d", popAcc.iPopAccountId );
+        accounts->DeletePopAccountL( popAcc );
+        }
+
+    TImapAccount imapAcc;
+    TRAP( result, accounts->GetImapAccountL( relatedAcc, imapAcc ) );
+    if ( result == KErrNone )
+        {
+        HTI_LOG_FORMAT( "Found related IMAP: %d", imapAcc.iImapAccountId );
+        accounts->DeleteImapAccountL( imapAcc );
+        }
+
+    CleanupStack::PopAndDestroy( 1 ); // accounts
     HTI_LOG_FUNC_OUT( "CHtiMailboxHandler::HandleDeleteMailboxL" );
     }
 
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMessagesServicePlugin.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMessagesServicePlugin.cpp	Tue May 11 16:14:15 2010 +0300
@@ -24,7 +24,7 @@
 #include "HtiMsgSettingsHandler.h"
 
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 
 // CONSTANTS
 _LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMsgSettingsHandler.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/HtiMsgSettingsHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 #include "HtiMsgSettingsHandler.h"
 
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 
 #include <cmconnectionmethod.h>
 #include <cmconnectionmethoddef.h>
@@ -31,7 +31,7 @@
 #include <csmsaccount.h>
 #include <mmssettings.h>
 #include <smutset.h>
-#include <CentralRepository.h>
+#include <centralrepository.h>
 
 // EXTERNAL DATA STRUCTURES
 
--- a/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/MessageMgmntHandler.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiMessagesServicePlugin/src/MessageMgmntHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 #include "MessageMgmntHandler.h"
 
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 #include <mtclreg.h>
 #include <smscmds.h>
 #include <smtcmtm.h>
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiPIMServicePlugin.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/HtiPIMServicePlugin.mmp	Tue May 11 16:14:15 2010 +0300
@@ -32,8 +32,8 @@
 SOURCE          proxy.cpp
 SOURCE          HtiPIMServicePlugin.cpp
 SOURCE          PIMHandler.cpp
-SOURCE          HtiBookmarkHandler.cpp
-SOURCE          HtiSimDirHandlerVPbk.cpp
+SOURCE          HtiBookmarkHandler.cpp 
+SOURCE          HtiSimDirHandler.cpp
 
 USERINCLUDE     ../inc
 APP_LAYER_SYSTEMINCLUDE
@@ -44,7 +44,6 @@
 
 LIBRARY         cmmanager.lib
 LIBRARY         apgrfx.lib
-LIBRARY         calenimp.lib
 LIBRARY         calinterimapi.lib
 LIBRARY         charconv.lib
 LIBRARY         ecom.lib
@@ -52,10 +51,10 @@
 LIBRARY         euser.lib
 LIBRARY         favouritesengine.lib
 LIBRARY         ws32.lib
-LIBRARY         vpbkeng.lib
-LIBRARY         vpbkvcardeng.lib
 LIBRARY         flogger.lib
-
+LIBRARY         cntmodel.lib
+LIBRARY			etelmm.lib
+LIBRARY			etel.lib 
 SMPSAFE
 
 // End of file
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf	Tue May 11 16:14:15 2010 +0300
@@ -14,7 +14,7 @@
 * Description:  Build information file for HtiPIMServicePlugin
 *
 */
-
+#include "../../../symbian_version.hrh"
 
 PRJ_PLATFORMS
 
@@ -22,6 +22,7 @@
 
 PRJ_MMPFILES
 HtiPIMServicePlugin.mmp
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 HtiNpdHlp.mmp
-
+#endif
 // End of file
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiBookmarkHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -21,9 +21,9 @@
 
 // INCLUDES
 #include <e32std.h>
-#include <FavouritesLimits.h>
-#include <FavouritesSession.h>
-#include <HTIServicePluginInterface.h>
+#include <favouriteslimits.h>
+#include <favouritessession.h>
+#include <HtiServicePluginInterface.h>
 
 // CONSTANTS
 const TInt KApMaxConnNameLength = 30;
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiPIMServicePlugin.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiPIMServicePlugin.h	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 #define CHTIPIMSERVICEPLUGIN_H
 
 // INCLUDES
-#include <HTIServicePluginInterface.h>
+#include <HtiServicePluginInterface.h>
 #include <w32std.h>
 
 // CONSTANTS
@@ -31,8 +31,7 @@
 // FORWARD DECLARATIONS
 class CPIMHandler;
 class CHtiBookmarkHandler;
-class CHtiSimDirHandlerVPbk;
-
+class CHtiSimDirHandler;
 // CLASS DECLARATION
 
 /**
@@ -54,6 +53,9 @@
             ENotepadAddMemoFromFile = 0x06,
             ENotepadDeleteAll       = 0x07,
 
+            EOpenCalendarFile       = 0x08,
+            EListCalendarFiles      = 0x09,
+            
             ESimCardInfo            = 0x10,
             EImportSimContact       = 0x11,
             EDeleteSimContact       = 0x12,
@@ -99,7 +101,7 @@
 
         CPIMHandler* iPimHandler;
         CHtiBookmarkHandler* iBookmarkHandler;
-        CHtiSimDirHandlerVPbk* iSimDirHandler;
+        CHtiSimDirHandler* iSimDirHandler;
         };
 
 #endif // CHTIPIMSERVICEPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiSimDirHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class that handles SIM card contacts creation and deletion
+*                using the new Virtual Phonebook API
+*
+*/
+
+
+#ifndef HTISIMDIRHANDLER_H
+#define HTISIMDIRHANDLER_H
+
+
+// INCLUDES
+
+#include <HtiServicePluginInterface.h>
+#include <etelmm.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Class that handles SIM card contacts creation and deletion using the
+*  new Virtual Phonebook API.
+*/
+class CHtiSimDirHandler : public CBase
+    {
+    public:
+
+    enum TContactFieldType
+        {
+        ENameField        = 0x01,
+        ESecondNameField  = 0x02,
+        EPhoneNumberField = 0x03,
+        EEMailField       = 0x04,
+        EAdditNumberField = 0x05
+        };
+
+    public:
+
+        /**
+        * Two-phased constructor.
+        */
+        static CHtiSimDirHandler* NewL();
+
+        /**
+        * Called when there is a message to be processed by this service.
+        * @param aMessage message body destinated to the servive
+        * @param aPriority message priority
+        */
+        void ProcessMessageL( const TDesC8& aMessage,
+            THtiMessagePriority aPriority );
+
+        /**
+        * Indicates whether this handler is ready to receive
+        * a new message or if it's busy processing previous message.
+        * @return ETrue if processing, EFalse if ready for new request
+        */
+        TBool IsBusy();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CHtiSimDirHandler();
+
+        /**
+        * Sets the dispatcher to send outgoing messages to.
+        * @param aDispatcher pointer to dispatcher instance
+        */
+        void SetDispatcher( MHtiDispatcher* aDispatcher );
+
+    private: // constructors
+
+        /**
+        * C++ default constructor.
+        */
+        CHtiSimDirHandler();
+
+        /**
+        * 2nd phase constructor.
+        */
+        void ConstructL();
+
+    private: // helpers
+
+        void HandleSimCardInfoL(const TDesC8& aData);
+        void HandleSimContactImportL(const TDesC8& aData);
+        void HandleSimContactDeleteL(const TDesC8& aData);
+
+        TBool CheckImportMsg(const TDesC8& aData);
+
+        void SendOkMsgL( const TDesC8& aData );
+        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
+
+    private: // data
+
+        // Pointer to the dispatcher (referenced)
+        MHtiDispatcher* iDispatcher;
+
+        // Flag indicating if service is busy processing a request
+        TBool iIsBusy;
+        
+        RTelServer iEtelServer;
+        RMobilePhone iEtelPhone;
+        RMobilePhoneBookStore iEtelStore;
+
+        TBool iStoreIsOpen;
+    };
+
+#endif // HTISIMDIRHANDLER_H
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/HtiSimDirHandlerVPbk.h	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Class that handles SIM card contacts creation and deletion
-*                using the new Virtual Phonebook API
-*
-*/
-
-
-#ifndef HTISIMDIRHANDLERVPBK_H
-#define HTISIMDIRHANDLERVPBK_H
-
-
-// INCLUDES
-#include <MVPbkContactObserver.h>
-#include <MVPbkContactStoreObserver.h>
-#include <MVPbkContactViewObserver.h>
-#include <MVPbkBatchOperationObserver.h>
-//#include <MVPbkContactStoreListObserver.h>
-#include <HTIServicePluginInterface.h>
-
-// CONSTANTS
-
-// MACROS
-
-// DATA TYPES
-
-// FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-class CVPbkContactManager;
-class MVPbkContactStore;
-class MVPbkContactView;
-
-// CLASS DECLARATION
-
-/**
-*  Class that handles SIM card contacts creation and deletion using the
-*  new Virtual Phonebook API.
-*/
-class CHtiSimDirHandlerVPbk : public CBase,
-//                              public MVPbkContactStoreListObserver,
-                              public MVPbkContactStoreObserver,
-                              public MVPbkContactObserver,
-                              public MVPbkContactViewObserver,
-                              public MVPbkBatchOperationObserver
-    {
-    public:
-
-    enum TContactFieldType
-        {
-        ENameField        = 0x01,
-        ESecondNameField  = 0x02,
-        EPhoneNumberField = 0x03,
-        EEMailField       = 0x04,
-        EAdditNumberField = 0x05
-        };
-
-    public:
-
-        /**
-        * Two-phased constructor.
-        */
-        static CHtiSimDirHandlerVPbk* NewL();
-
-        /**
-        * Called when there is a message to be processed by this service.
-        * @param aMessage message body destinated to the servive
-        * @param aPriority message priority
-        */
-        void ProcessMessageL( const TDesC8& aMessage,
-            THtiMessagePriority aPriority );
-
-        /**
-        * Indicates whether this handler is ready to receive
-        * a new message or if it's busy processing previous message.
-        * @return ETrue if processing, EFalse if ready for new request
-        */
-        TBool IsBusy();
-
-        /**
-        * Destructor.
-        */
-        virtual ~CHtiSimDirHandlerVPbk();
-
-        /**
-        * Sets the dispatcher to send outgoing messages to.
-        * @param aDispatcher pointer to dispatcher instance
-        */
-        void SetDispatcher( MHtiDispatcher* aDispatcher );
-
-    public: // Functions from base classes
-
-        // From MVPbkContactStoreListObserver
-
-        /**
-         * Called when the opening process is complete, ie. all stores
-         * have been reported either failed or successful open.
-         */
-        //void OpenComplete();
-
-        // From MVPbkContactStoreObserver
-
-        /**
-         * Called when a contact store is ready to use.
-         */
-        void StoreReady( MVPbkContactStore& aContactStore );
-
-        /**
-         * Called when a contact store becomes unavailable.
-         * @param aContactStore The store that became unavailable.
-         * @param aReason The reason why the store is unavailable.
-         *                This is one of the system wide error codes.
-         */
-        void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason );
-
-        /**
-         * Called when changes occur in the contact store.
-         * @param aContactStore The store the event occurred in.
-         * @param aStoreEvent   Event that has occured.
-         */
-        void HandleStoreEventL( MVPbkContactStore& aContactStore,
-                                TVPbkContactStoreEvent aStoreEvent);
-
-        // From MVPbkContactObserver
-
-        /**
-         * Called when a contact operation has succesfully completed.
-         */
-        void ContactOperationCompleted( TContactOpResult aResult );
-
-        /**
-         * Called when a contact operation has failed.
-         */
-        void ContactOperationFailed( TContactOp aOpCode, TInt aErrorCode,
-                TBool aErrorNotified );
-
-        // From MVPbkContactViewObserver
-
-        /**
-         * Called when a view is ready for use.
-         */
-        void ContactViewReady( MVPbkContactViewBase& aView );
-
-        /**
-         * Called when a view is unavailable for a while.
-         */
-        void ContactViewUnavailable( MVPbkContactViewBase& aView );
-
-        /**
-         * Called when a contact has been added to the view.
-         */
-        void ContactAddedToView( MVPbkContactViewBase& aView,
-                                 TInt aIndex,
-                                 const MVPbkContactLink& aContactLink );
-
-        /**
-         * Called when a contact has been removed from a view.
-         */
-        void ContactRemovedFromView( MVPbkContactViewBase& aView,
-                                     TInt aIndex,
-                                     const MVPbkContactLink& aContactLink );
-
-        /**
-         * Called when an error occurs in the view.
-         */
-        void ContactViewError( MVPbkContactViewBase& aView,
-                               TInt aError,
-                               TBool aErrorNotified );
-
-        // From MVPbkBatchOperationObserver
-
-        /**
-         * Called when one step of the operation is complete
-         */
-        void StepComplete( MVPbkContactOperationBase& aOperation,
-                           TInt aStepSize );
-
-        /**
-         * Called when one step of the operation fails
-         */
-        TBool StepFailed( MVPbkContactOperationBase& aOperation,
-                          TInt aStepSize, TInt aError );
-
-        /**
-         * Called when operation is completed
-         */
-        void OperationComplete( MVPbkContactOperationBase& aOperation );
-
-
-    private: // constructors
-
-        /**
-        * C++ default constructor.
-        */
-        CHtiSimDirHandlerVPbk();
-
-        /**
-        * 2nd phase constructor.
-        */
-        void ConstructL();
-
-    private: // helpers
-
-        void HandleSimCardInfoL();
-        void HandleSimContactImportL();
-        void HandleSimContactDeleteL();
-
-        void DeleteContactsInViewL();
-        TBool CheckImportMsg();
-
-        void SendOkMsgL( const TDesC8& aData );
-        void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
-
-    private: // data
-
-        // Pointer to the dispatcher (referenced)
-        MHtiDispatcher* iDispatcher;
-
-        // The contact manager
-        CVPbkContactManager* iContactManager;
-
-        // The SIM contact store (referenced)
-        MVPbkContactStore* iSimStore;
-
-        // The contact view
-        MVPbkContactViewBase* iContactView;
-
-        // The current/latest contact operation
-        MVPbkContactOperationBase* iCurrentOperation;
-
-        // The latest received command message without the command code
-        HBufC8* iMessage;
-
-        // The command code of the latest/current command
-        TUint8 iCommand;
-
-        // Flag indicating if service is busy processing a request
-        TBool iIsBusy;
-
-        TBool iIsStoreOpen;
-
-    };
-
-#endif // HTISIMDIRHANDLERVPBK_H
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/PIMHandler.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/inc/PIMHandler.h	Tue May 11 16:14:15 2010 +0300
@@ -22,20 +22,13 @@
 // INCLUDES
 #include <e32base.h>
 #include <s32mem.h>
-#include <HTIServicePluginInterface.h>
-#include <MVPbkBatchOperationObserver.h>
-#include <MVPbkContactCopyObserver.h>
-#include <MVPbkContactStoreObserver.h>
-#include <MVPbkContactViewObserver.h>
+#include <HtiServicePluginInterface.h>
 #include <calprogresscallback.h>
 
 // CONSTANTS
 
 // FORWARD DECLARATIONS
-class CVPbkContactManager;
-class CVPbkVCardEng;
 class CCalSession;
-class CCalEntryView;
 
 // CLASS DECLARATION
 
@@ -43,10 +36,6 @@
 *  Functional implentation of PIM service.
 */
 class CPIMHandler : public CBase,
-                    public MVPbkContactStoreObserver,
-                    public MVPbkContactCopyObserver,
-                    public MVPbkContactViewObserver,
-                    public MVPbkBatchOperationObserver,
                     public MCalProgressCallBack
     {
     public:
@@ -62,104 +51,7 @@
         virtual ~CPIMHandler();
 
         void SetDispatcher( MHtiDispatcher* aDispatcher );
-
-
-        // From MVPbkContactStoreObserver
-
-        /**
-         * Called when a contact store is ready to use.
-         */
-        void StoreReady( MVPbkContactStore& aContactStore );
-
-        /**
-         * Called when a contact store becomes unavailable.
-         * @param aContactStore The store that became unavailable.
-         * @param aReason The reason why the store is unavailable.
-         *                This is one of the system wide error codes.
-         */
-        void StoreUnavailable( MVPbkContactStore& aContactStore, TInt aReason );
-
-        /**
-         * Called when changes occur in the contact store.
-         * @param aContactStore The store the event occurred in.
-         * @param aStoreEvent   Event that has occured.
-         */
-        void HandleStoreEventL( MVPbkContactStore& aContactStore,
-                                TVPbkContactStoreEvent aStoreEvent);
-
-        // From MVPbkContactCopyObserver
-
-        /**
-         * Called when the contact has been successfully commited or
-         * copied. Caller takes the ownership of results.
-         * @param aOperation    The operation that this observer monitors.
-         * @param aResults  An array of links to copied contacts.
-         *                  Caller takes the ownership of the
-         *                  object immediately.
-         */
-        void ContactsSaved( MVPbkContactOperationBase& aOperation,
-            MVPbkContactLinkArray* aResults );
-
-        /**
-         * Called when there was en error while saving contact(s).
-         * @param aOperation    The operation that this observer monitors.
-         * @param aError an error that occured.
-         */
-        void ContactsSavingFailed(
-                MVPbkContactOperationBase& aOperation, TInt aError );
-
-        // From MVPbkContactViewObserver
-
-        /**
-         * Called when a view is ready for use.
-         */
-        void ContactViewReady( MVPbkContactViewBase& aView );
-
-        /**
-         * Called when a view is unavailable for a while.
-         */
-        void ContactViewUnavailable( MVPbkContactViewBase& aView );
-
-        /**
-         * Called when a contact has been added to the view.
-         */
-        void ContactAddedToView( MVPbkContactViewBase& aView,
-                                 TInt aIndex,
-                                 const MVPbkContactLink& aContactLink );
-
-        /**
-         * Called when a contact has been removed from a view.
-         */
-        void ContactRemovedFromView( MVPbkContactViewBase& aView,
-                                     TInt aIndex,
-                                     const MVPbkContactLink& aContactLink );
-
-        /**
-         * Called when an error occurs in the view.
-         */
-        void ContactViewError( MVPbkContactViewBase& aView,
-                               TInt aError,
-                               TBool aErrorNotified );
-
-        // From MVPbkBatchOperationObserver
-
-        /**
-         * Called when one step of the operation is complete
-         */
-        void StepComplete( MVPbkContactOperationBase& aOperation,
-                           TInt aStepSize );
-
-        /**
-         * Called when one step of the operation fails
-         */
-        TBool StepFailed( MVPbkContactOperationBase& aOperation,
-                          TInt aStepSize, TInt aError );
-
-        /**
-         * Called when operation is completed
-         */
-        void OperationComplete( MVPbkContactOperationBase& aOperation );
-
+      
 
         // From MCalProgressCallBack
 
@@ -178,31 +70,22 @@
         void HandleVCalendarImportFuncL( const TDesC8& aData );
         void HandleContactDeleteFuncL( const TDesC8& aData );
         void HandleCalendarDeleteFuncL( const TDesC8& aData );
+        void HandleOpenCalendarFileL( const TDesC8& aData );
+        void HandleListCalendarFilesL();
         void HandleNotepadAddMemoFuncL( const TDesC8& aData );
         void HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData );
         void HandleNotepadDeleteAllFuncL();
-        void CreateContactDeleteViewL();
-        void DeleteContactsInViewL();
-
+        
         void SendOkMsgL( const TDesC8& aData );
         void SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand );
         void SendErrorMessageL( TInt aError, const TDesC8& aDescription );
 
     private: // data
-        TUint8                iCommand;
         TBool                 iIsBusy;
-        CBufFlat*             iBuffer;
-        RBufReadStream        iReadStream;
-        CCalSession*          iCalSession;
-        CCalEntryView*        iEntryView;
-        CVPbkContactManager*  iContactManager;
-        CVPbkVCardEng*        iVCardEngine;
-        MVPbkContactStore*    iContactStore;
-        MVPbkContactOperationBase* iOp;
-        MVPbkContactViewBase* iContactView;
         MHtiDispatcher*       iDispatcher; // referenced
         CActiveSchedulerWait* iWaiter;
         TInt                  iEntryViewErr;
+        CCalSession*          iCalSession;
     };
 
 #endif // CPIMHANDLER_H
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiBookmarkHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -25,8 +25,8 @@
 #include <cmdestination.h>
 #include <cmmanager.h>
 
-#include <FavouritesItem.h>
-#include <FavouritesItemList.h>
+#include <favouritesitem.h>
+#include <favouritesitemlist.h>
 #include <FavouritesDb.h>
 #include <FavouritesFile.h>
 #include <FavouritesWapAp.h>
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiPIMServicePlugin.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiPIMServicePlugin.cpp	Tue May 11 16:14:15 2010 +0300
@@ -20,13 +20,12 @@
 #include "HtiPIMServicePlugin.h"
 #include "PIMHandler.h"
 #include "HtiBookmarkHandler.h"
-#include "HtiSimDirHandlerVPbk.h"
-
+#include "HtiSimDirHandler.h"
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 
 // CONSTANTS
-_LIT8( KErrorMissingCommand, "Command was not given - message was empty" );
+_LIT8( KErrorMissingCommand, "Missing command" );
 
 // ----------------------------------------------------------------------------
 // Create instance of concrete ECOM interface implementation
@@ -87,7 +86,7 @@
         {
         if ( iSimDirHandler == NULL )
             {
-            iSimDirHandler = CHtiSimDirHandlerVPbk::NewL();
+            iSimDirHandler = CHtiSimDirHandler::NewL();
             iSimDirHandler->SetDispatcher( iDispatcher );
             }
         iSimDirHandler->ProcessMessageL( aMessage, aPriority );
@@ -111,18 +110,17 @@
     {
     if ( iPimHandler )
         {
-        if ( iPimHandler->IsBusy() )
-            return ETrue;
+        return iPimHandler->IsBusy();
         }
-    if ( iSimDirHandler )
-        {
-        if ( iSimDirHandler->IsBusy() )
-            return ETrue;
-        }
+
     if ( iBookmarkHandler )
         {
-        if ( iBookmarkHandler->IsBusy() )
-            return ETrue;
+        return iBookmarkHandler->IsBusy();
+        }
+    
+    if( iSimDirHandler)
+        {
+        return iSimDirHandler->IsBusy();
         }
     return EFalse;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiSimDirHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,530 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description:  Implementation of SIM card contacts handling using the new
+ *                Virtual Phonebook API
+ *
+ */
+
+// INCLUDE FILES
+#include "HtiSimDirHandler.h"
+#include "HtiPIMServicePlugin.h"
+
+#include <HtiDispatcherInterface.h>
+#include <HtiLogging.h>
+
+#include <mmtsy_names.h>
+#include <mpbutil.h> 
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KSimInfoResponseLength = 12;
+const TInt KOneSimContactBufferSize = 512;
+// MACROS
+// LOCAL CONSTANTS AND MACROS
+_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
+_LIT8( KErrorImportFailed, "Contact import failed" );
+_LIT8( KErrorDeleteFailed, "Failed to delete contact" );
+_LIT8( KErrorSimCardInfoFailed, "Failed to get SIM card info" );
+_LIT8( KErrorFieldNotSupported, "Field is not supported");
+_LIT8( KErrorFieldTooBig, "Filed is too long");
+//_LIT8( KErrorSimStoreOpenFailed, "Failed to open SIM contact store" );
+//_LIT8( KErrorSimStoreUnavailable, "SIM contact store unavailable" );
+//_LIT8( KErrorContactOperationFailed, "SIM contact operation failed" );
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+CHtiSimDirHandler* CHtiSimDirHandler::NewL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::NewL" );
+    CHtiSimDirHandler* self = new (ELeave) CHtiSimDirHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::NewL" );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::CHtiSimDirHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+CHtiSimDirHandler::CHtiSimDirHandler() :
+    iIsBusy(EFalse), iStoreIsOpen(EFalse)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CHtiSimDirHandler" );
+
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::CHtiSimDirHandler" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::~CHtiSimDirHandler
+// Destructor.
+// -----------------------------------------------------------------------------
+CHtiSimDirHandler::~CHtiSimDirHandler()
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::~CHtiSimDirHandler" );
+    iEtelStore.Close();
+    iEtelPhone.Close();
+    iEtelServer.Close();
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::~CHtiSimDirHandler" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CHtiSimDirHandler::ConstructL()
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ConstructL" );
+
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ConstructL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::SetDispatcher
+// Sets the dispatcher pointer.
+// -----------------------------------------------------------------------------
+
+void CHtiSimDirHandler::SetDispatcher(MHtiDispatcher* aDispatcher)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SetDispatcher" );
+    iDispatcher = aDispatcher;
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SetDispatcher" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::ProcessMessageL
+// Parses the received message and calls handler functions.
+// -----------------------------------------------------------------------------
+void CHtiSimDirHandler::ProcessMessageL(const TDesC8& aMessage,
+        THtiMessagePriority /*aPriority*/)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::ProcessMessageL" );
+
+    if (iStoreIsOpen == EFalse)
+        {
+        User::LeaveIfError(iEtelServer.Connect());
+        User::LeaveIfError(iEtelServer.LoadPhoneModule(KMmTsyModuleName));
+        User::LeaveIfError(iEtelPhone.Open(iEtelServer, KMmTsyPhoneName));
+        User::LeaveIfError(iEtelStore.Open(iEtelPhone, KETelIccAdnPhoneBook));
+        HTI_LOG_TEXT( "SIM card open" );
+        iStoreIsOpen = ETrue;
+        }
+
+    if (iIsBusy)
+        {
+        HTI_LOG_TEXT( "HtiSimDirHandler is busy - leaving" );
+        User::Leave(KErrInUse);
+        }
+
+    // Will be set to EFalse in the SendOkMsgL or SendErrorMessageL methods.
+    iIsBusy = ETrue;
+
+    // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
+    // Other sanity checks must be done here.
+    TInt err = KErrNone;
+    TUint8 command = aMessage.Ptr()[0];
+    switch (command)
+        {
+        case CHtiPIMServicePlugin::ESimCardInfo:
+            {
+            TRAP(err ,HandleSimCardInfoL(aMessage.Right(aMessage.Length() - 1)));
+            break;
+            }
+        case CHtiPIMServicePlugin::EImportSimContact:
+            {
+            TRAP(err ,HandleSimContactImportL(aMessage.Right(aMessage.Length() - 1)));
+            break;
+            }
+        case CHtiPIMServicePlugin::EDeleteSimContact:
+            {
+            TRAP(err ,HandleSimContactDeleteL(aMessage.Right(aMessage.Length() - 1)));
+            break;
+            }
+        default:
+            {
+            SendErrorMessageL(KErrArgument, KErrorUnrecognizedCommand);
+            return;
+            }
+        }
+
+    if (err != KErrNone)
+        {
+        iIsBusy = EFalse;
+        User::Leave(err);
+        } 
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::ProcessMessageL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CHtiSimDirHandler::IsBusy
+// -----------------------------------------------------------------------------
+//
+TBool CHtiSimDirHandler::IsBusy()
+    {
+    return iIsBusy;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimCardInfoL
+// Gets information about the SIM card.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimCardInfoL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimCardInfoL" );
+    if (aData.Length() != 0)
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: wrong length of data" );
+        SendErrorMessageL(KErrArgument, KErrorInvalidParameters);
+        return;
+        }
+
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo;
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo);
+    
+    TRequestStatus requestStatus;
+    iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg);
+    User::WaitForRequest(requestStatus);
+    if (requestStatus.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" );
+        SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed);
+        return;
+        }
+
+    // Create and send response message
+    TBuf8<KSimInfoResponseLength> reply;
+    reply.Append(etelStoreInfo.iMaxSecondNames > 0 ? etelStoreInfo.iMaxSecondNames : 0);
+    reply.Append(etelStoreInfo.iMaxAdditionalNumbers > 0 ? etelStoreInfo.iMaxAdditionalNumbers : 0);
+    reply.Append(etelStoreInfo.iMaxEmailAddr > 0 ? etelStoreInfo.iMaxEmailAddr : 0);
+    reply.Append(etelStoreInfo.iMaxTextLength > 0 ? etelStoreInfo.iMaxTextLength : 0);
+    reply.Append(etelStoreInfo.iMaxNumLength > 0 ? etelStoreInfo.iMaxNumLength : 0);
+    reply.Append(etelStoreInfo.iMaxTextLengthSecondName > 0 ? 
+        etelStoreInfo.iMaxTextLengthSecondName : 0);
+    reply.Append(etelStoreInfo.iMaxNumLengthAdditionalNumber > 0?
+        etelStoreInfo.iMaxNumLengthAdditionalNumber : 0);
+    reply.Append(etelStoreInfo.iMaxTextLengthEmailAddr > 0 ? etelStoreInfo.iMaxTextLengthEmailAddr : 0);
+    reply.Append( ( TUint8* ) ( &etelStoreInfo.iTotalEntries ), 2 );
+    reply.Append( ( TUint8* ) ( &etelStoreInfo.iUsedEntries ), 2 );
+    SendOkMsgL(reply);
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimCardInfoL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimContactImportL
+// Imports the contact to SIM card.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimContactImportL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactImportL" );
+    
+    if(CheckImportMsg(aData) == EFalse)
+        {
+        return;
+        }
+    
+    RBuf8 buffer;
+    buffer.CreateL(KOneSimContactBufferSize);
+    CleanupClosePushL(buffer);
+    CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer();
+    CleanupStack::PushL(pbBuffer);
+    pbBuffer->Set(&buffer);
+
+    //add new enty tag
+    User::LeaveIfError(pbBuffer->AddNewEntryTag());
+
+    TInt offset = 0;
+    TInt fieldCount = aData[offset];
+    offset++;
+
+    for (TInt i = 0; i < fieldCount; i++)
+        {
+        HTI_LOG_FORMAT( "Processing field %d", i + 1 );
+
+        TContactFieldType type = (TContactFieldType) aData[offset];
+        offset++;
+        TInt fieldLength = aData[offset];
+        offset++;
+        HBufC* fieldData = HBufC::NewLC(fieldLength);
+        fieldData->Des().Copy(aData.Mid(offset, fieldLength));
+        switch (type)
+            {
+            case ENameField:
+                User::LeaveIfError(pbBuffer->PutTagAndValue(
+                        RMobilePhoneBookStore::ETagPBText, fieldData->Des()));
+                break;
+            case ESecondNameField:
+                User::LeaveIfError(pbBuffer->PutTagAndValue(
+                        RMobilePhoneBookStore::ETagPBSecondName,
+                        fieldData->Des()));
+                break;
+            case EPhoneNumberField:
+                User::LeaveIfError(
+                        pbBuffer->PutTagAndValue(
+                                RMobilePhoneBookStore::ETagPBNumber,
+                                fieldData->Des()));
+                break;
+            case EEMailField:
+                User::LeaveIfError(pbBuffer->PutTagAndValue(
+                        RMobilePhoneBookStore::ETagPBEmailAddress,
+                        fieldData->Des()));
+                break;
+            case EAdditNumberField:
+                User::LeaveIfError(pbBuffer->AddNewNumberTag());
+                User::LeaveIfError(
+                        pbBuffer->PutTagAndValue(
+                                RMobilePhoneBookStore::ETagPBNumber,
+                                fieldData->Des()));
+                break;
+            default:
+                HTI_LOG_FORMAT( "Unknown field type %d", type );
+                User::Leave(KErrArgument);
+                break;
+            }
+        CleanupStack::PopAndDestroy(); // fieldData
+        offset += fieldLength;
+        }
+    
+    // save contact into sim card
+    TInt index = -1;
+    TRequestStatus status;
+    //store the entry in the first free location and then return 
+    //this location within index when it completes the request
+    iEtelStore.Write(status, buffer, index);
+    User::WaitForRequest(status);
+    if(status.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT("Failed to add SIM contact");
+        SendErrorMessageL( status.Int(), KErrorImportFailed );
+        }
+    else
+        {
+        HTI_LOG_TEXT( "SIM contact added" );
+        TBuf8<4> idBuf;
+        idBuf.Append( ( TUint8* ) &index, 4 );
+        SendOkMsgL( idBuf );
+        }
+    CleanupStack::PopAndDestroy(2); // buffer, pbBuffer
+
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactImportL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::HandleSimContactDeleteL
+// Creates a contact view containing the contacts to be deleted.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::HandleSimContactDeleteL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::HandleSimContactDeleteL" );
+    TInt dataLength = aData.Length();
+    if ( dataLength != 0 && dataLength != 4 )
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: Wrong length of data" )
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return;
+        }
+    
+    TRequestStatus status;
+    if (dataLength == 0) //delete all
+        {
+        iEtelStore.DeleteAll(status);
+        HTI_LOG_TEXT("Delete all SIM contacts");
+        }
+    else //delete one contact with given id
+        {
+        TInt id = aData[0] + (aData[1] << 8) + (aData[2] << 16) + (aData[3]
+                << 24);
+        HTI_LOG_FORMAT( "Delete SIM contact with id %d", id );
+        iEtelStore.Delete(status, id);
+        }
+    
+    User::WaitForRequest(status);
+    if(status.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT("Failed to delete contact(s)");
+        SendErrorMessageL( status.Int(), KErrorDeleteFailed );
+        }
+    else
+        {
+        HTI_LOG_TEXT("SIM contact(s) deleted");
+        SendOkMsgL( KNullDesC8 );
+        }
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::HandleSimContactDeleteL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::CheckImportMsg
+// Validates the syntax of import contact message.
+// ----------------------------------------------------------------------------
+TBool CHtiSimDirHandler::CheckImportMsg(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::CheckImportMsg" );
+    // Import command syntax:
+    //   amount of fields     (1 byte)   __
+    //   type of field        (1 byte)     |
+    //   length of data field (1 byte)     | repeated <amount of fields> times
+    //   field data           (variable) __|
+
+    TInt length = aData.Length();
+    if (length < 4) // min length 4 bytes
+        {
+        HTI_LOG_FORMAT( "Message too short %d", length );
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5 etelStoreInfo;
+    RMobilePhoneBookStore::TMobilePhoneBookInfoV5Pckg etelStoreInfoPckg(etelStoreInfo);
+    
+    TRequestStatus requestStatus;
+    iEtelStore.GetInfo(requestStatus, (TDes8&) etelStoreInfoPckg);
+    User::WaitForRequest(requestStatus);
+    if (requestStatus.Int() != KErrNone)
+        {
+        HTI_LOG_TEXT( "CHtiSimDirHandler: Failed to get SIM card info" );
+        SendErrorMessageL(requestStatus.Int(), KErrorSimCardInfoFailed);
+        return EFalse;
+        }
+    TInt offset = 0;
+    TInt fieldCount = aData[offset];
+    HTI_LOG_FORMAT( "Fields %d", fieldCount );
+    if (fieldCount < 1) // must be at least one field
+        {
+        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+        return EFalse;
+        }
+
+    offset++;
+    TInt fieldsFound = 0;
+    while (offset < length)
+        {
+        fieldsFound++;
+        TContactFieldType fieldType = (TContactFieldType) aData[offset];
+        HTI_LOG_FORMAT( "Field type %d", fieldType );
+        TInt maxLength = 0;
+        if(fieldType == ENameField)
+            {
+            maxLength = etelStoreInfo.iMaxTextLength;
+            }
+        else if(fieldType == ESecondNameField)
+            {
+            maxLength = etelStoreInfo.iMaxTextLengthSecondName;
+            }
+        else if(fieldType == EPhoneNumberField)
+            {
+            maxLength = etelStoreInfo.iMaxNumLength;
+            }
+        else if(fieldType == EEMailField)
+            {
+            maxLength = etelStoreInfo.iMaxTextLengthEmailAddr;
+            }
+        else if(fieldType == EAdditNumberField)
+            {
+            maxLength = etelStoreInfo.iMaxNumLengthAdditionalNumber;
+            }
+        else
+            {
+            HTI_LOG_TEXT("Unknown field type");
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            return EFalse; // invalid field type
+            }
+        
+        if(maxLength <= 0)
+            {
+            HTI_LOG_TEXT("Field not supported");
+            SendErrorMessageL(KErrArgument, KErrorFieldNotSupported);
+            return EFalse;
+            }
+
+        offset++; // the type of field byte
+        if (offset >= length)
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            return EFalse;
+            }
+        TInt fieldLength = aData[offset];
+        HTI_LOG_FORMAT( "Field length %d", fieldLength );
+        if (fieldLength < 1)
+            {
+            SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+            return EFalse; // Field data can not be empty
+            }
+        else if(fieldLength > maxLength)
+            {
+            HTI_LOG_TEXT("The length of field is too long");
+            SendErrorMessageL( KErrArgument, KErrorFieldTooBig );
+            return EFalse;
+            }
+        offset++; // advance over the length of data byte
+        offset += fieldLength; // and the field data
+        }
+
+    if (offset == length && fieldsFound == fieldCount)
+        {
+        HTI_LOG_TEXT( "Message OK" );
+        return ETrue;
+        }
+    
+    SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
+    return EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::SendOkMsgL
+// Helper function for sending response messages.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::SendOkMsgL(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendOkMsgL" );
+    iIsBusy = EFalse; // Done with the current request
+    User::LeaveIfNull(iDispatcher);
+    HBufC8* temp = HBufC8::NewL(aData.Length() + 1);
+    TPtr8 response = temp->Des();
+    response.Append((TChar) CHtiPIMServicePlugin::EResultOk);
+    response.Append(aData);
+    User::LeaveIfError(iDispatcher->DispatchOutgoingMessage(temp,
+            KPIMServiceUid));
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendOkMsgL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CHtiSimDirHandler::SendErrorMessageL
+// Helper function for sending error response messages.
+// ----------------------------------------------------------------------------
+void CHtiSimDirHandler::SendErrorMessageL(TInt aError,
+        const TDesC8& aDescription)
+    {
+    HTI_LOG_FUNC_IN( "CHtiSimDirHandler::SendErrorMessageL" );
+    iIsBusy = EFalse; // Done with the current request
+    User::LeaveIfNull(iDispatcher);
+    User::LeaveIfError(iDispatcher->DispatchOutgoingErrorMessage(aError,
+            aDescription, KPIMServiceUid));
+    HTI_LOG_FUNC_OUT( "CHtiSimDirHandler::SendErrorMessageL" );
+    }
+
+// End of file
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/HtiSimDirHandlerVPbk.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1002 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of SIM card contacts handling using the new
-*                Virtual Phonebook API
-*
-*/
-
-
-// INCLUDE FILES
-#include "HtiSimDirHandlerVPbk.h"
-#include "HtiPIMServicePlugin.h"
-
-#include <CVPbkContactManager.h>
-#include <CVPbkContactLinkArray.h>
-#include <CVPbkContactStoreUriArray.h>
-#include <CVPbkContactViewDefinition.h>
-#include <CVPbkSortOrder.h>
-#include <MVPbkContactFieldTextData.h>
-#include <MVPbkContactLink.h>
-#include <MVPbkContactOperationBase.h>
-#include <MVPbkContactStore.h>
-#include <MVPbkContactStoreInfo.h>
-#include <MVPbkContactStoreList.h>
-#include <MVPbkContactStoreProperties.h>
-#include <MVPbkContactView.h>
-#include <MVPbkContactViewBase.h>
-#include <MVPbkFieldType.h>
-#include <MVPbkStoreContact.h>
-#include <MVPbkStoreContactField.h>
-#include <MVPbkContactStoreObserver.h>
-#include <TVPbkContactStoreUriPtr.h>
-#include <TVPbkFieldVersitProperty.h>
-#include <VPbkContactStoreUris.h>
-#include <VPbkContactView.hrh>
-#include <VPbkFieldType.hrh>
-#include <VPbkEng.rsg>
-
-#include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
-
-// EXTERNAL DATA STRUCTURES
-
-// EXTERNAL FUNCTION PROTOTYPES
-
-// CONSTANTS
-const TInt KSimInfoResponseLength = 12;
-
-// MACROS
-
-// LOCAL CONSTANTS AND MACROS
-_LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
-_LIT8( KErrorInvalidParameters, "Invalid command parameters" );
-_LIT8( KErrorImportFailed, "Contact import failed" );
-_LIT8( KErrorDeleteFailed, "Failed to delete contact" );
-_LIT8( KErrorSimCardInfoFailed, "Failed to get SIM card info" );
-_LIT8( KErrorSimStoreOpenFailed, "Failed to open SIM contact store" );
-_LIT8( KErrorSimStoreUnavailable, "SIM contact store unavailable" );
-
-// MODULE DATA STRUCTURES
-
-// LOCAL FUNCTION PROTOTYPES
-
-// FORWARD DECLARATIONS
-
-// ============================ MEMBER FUNCTIONS ===============================
-
-// -----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-CHtiSimDirHandlerVPbk* CHtiSimDirHandlerVPbk::NewL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::NewL" );
-    CHtiSimDirHandlerVPbk* self = new (ELeave) CHtiSimDirHandlerVPbk();
-    CleanupStack::PushL ( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::NewL" );
-    return self;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::CHtiSimDirHandlerVPbk
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// ----------------------------------------------------------------------------
-CHtiSimDirHandlerVPbk::CHtiSimDirHandlerVPbk():iIsBusy( EFalse ),
-                                               iIsStoreOpen( EFalse )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::CHtiSimDirHandlerVPbk" );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::CHtiSimDirHandlerVPbk" );
-    }
-
-
-// -----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::~CHtiSimDirHandlerVPbk
-// Destructor.
-// -----------------------------------------------------------------------------
-CHtiSimDirHandlerVPbk::~CHtiSimDirHandlerVPbk()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::~CHtiSimDirHandlerVPbk" );
-
-    if ( iContactView )
-        {
-        HTI_LOG_TEXT( "Deleting iContactView" );
-        iContactView->RemoveObserver( *this );
-        delete iContactView;
-        }
-    if ( iSimStore )
-        {
-        HTI_LOG_TEXT( "Closing iSimStore" );
-        iSimStore->Close( *this );
-        }
-    if ( iContactManager )
-        {
-        HTI_LOG_TEXT( "Deleting iContactManager" );
-        delete iContactManager;
-        }
-    if ( iMessage )
-        {
-        HTI_LOG_TEXT( "Deleting iMessage" );
-        delete iMessage;
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::~CHtiSimDirHandlerVPbk" );
-    }
-
-
-// -----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ConstructL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ConstructL" );
-
-    CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
-    uriArray->AppendL( TVPbkContactStoreUriPtr(
-        VPbkContactStoreUris::SimGlobalAdnUri() ) );
-
-    iContactManager = CVPbkContactManager::NewL( *uriArray );
-    CleanupStack::PopAndDestroy( uriArray );
-
-    MVPbkContactStoreList& storeList = iContactManager->ContactStoresL();
-    iSimStore = storeList.Find( TVPbkContactStoreUriPtr(
-        VPbkContactStoreUris::SimGlobalAdnUri() ) );
-
-    if ( !iSimStore )
-        {
-        HTI_LOG_TEXT( "SIM ADN store not found - leaving" );
-        User::Leave( KErrNotFound );
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ConstructL" );
-    }
-
-
-// -----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::SetDispatcher
-// Sets the dispatcher pointer.
-// -----------------------------------------------------------------------------
-
-void CHtiSimDirHandlerVPbk::SetDispatcher( MHtiDispatcher* aDispatcher )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::SetDispatcher" );
-    iDispatcher = aDispatcher;
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::SetDispatcher" );
-    }
-
-
-// -----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ProcessMessageL
-// Parses the received message and calls handler functions.
-// -----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ProcessMessageL( const TDesC8& aMessage,
-    THtiMessagePriority /*aPriority*/ )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ProcessMessageL" );
-
-    if ( iIsBusy )
-        {
-        HTI_LOG_TEXT( "HtiSimDirHandlerVPbk is busy - leaving" );
-        User::Leave( KErrInUse );
-        }
-
-    // Will be set to EFalse in the SendOkMsgL or SendErrorMessageL methods.
-    iIsBusy = ETrue;
-
-    delete iMessage;
-    iMessage = NULL;
-
-    // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
-    // Other sanity checks must be done here.
-
-    // Trap the AllocL to be able to set iIsBusy false before leaving.
-    TRAPD( err, iMessage = aMessage.Right( aMessage.Length() - 1 ).AllocL() );
-    if ( err != KErrNone )
-        {
-        iIsBusy = EFalse;
-        User::Leave( err );
-        }
-
-    iCommand = aMessage.Ptr()[0];
-
-    // Do basic validity checking for message
-    TBool isParamsOk = ETrue;
-    switch ( iCommand )
-        {
-        case CHtiPIMServicePlugin::ESimCardInfo:
-            {
-            if ( iMessage->Length() != 0 )
-                {
-                isParamsOk = EFalse;
-                }
-            break;
-            }
-        case CHtiPIMServicePlugin::EImportSimContact:
-            {
-            if ( !CheckImportMsg() )
-                {
-                isParamsOk = EFalse;
-                }
-            break;
-            }
-        case CHtiPIMServicePlugin::EDeleteSimContact:
-            {
-            if ( iMessage->Length() != 4 && iMessage->Length() != 0 )
-                {
-                isParamsOk = EFalse;
-                }
-            break;
-            }
-        default:
-            {
-            SendErrorMessageL( KErrArgument, KErrorUnrecognizedCommand );
-            return;
-            }
-        }
-
-    if ( !isParamsOk )
-        {
-        SendErrorMessageL( KErrArgument, KErrorInvalidParameters );
-        }
-
-    else
-        {
-        if ( iIsStoreOpen )
-            {
-            StoreReady( *iSimStore );
-            }
-        else
-            {
-            // Start async open operation.
-            // StoreReady callback will be called when opening is complete.
-            TRAPD( err, iSimStore->OpenL( *this ) );
-            if ( err != KErrNone )
-                {
-                HTI_LOG_FORMAT(
-                        "Leave from CHtiSimDirHandler::OpenL() %d", err );
-                SendErrorMessageL( err, KErrorSimStoreOpenFailed );
-                }
-            }
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ProcessMessageL" );
-    }
-
-
-// -----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::IsBusy
-// -----------------------------------------------------------------------------
-//
-TBool CHtiSimDirHandlerVPbk::IsBusy()
-    {
-    return iIsBusy;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::OpenComplete
-// Called when the opening process is complete.
-// From MVPbkContactStoreListObserver
-// ----------------------------------------------------------------------------
-/*
-void CHtiSimDirHandlerVPbk::OpenComplete()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::OpenComplete" );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::OpenComplete" );
-    }
-*/
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::StoreReady
-// Called when a contact store is ready to use.
-// From MVPbkContactStoreObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::StoreReady( MVPbkContactStore& aContactStore )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::StoreReady" );
-
-    if ( !iIsBusy || iSimStore != &aContactStore )
-        {
-        return;
-        }
-
-    iIsStoreOpen = ETrue;
-
-    if ( iCommand == CHtiPIMServicePlugin::ESimCardInfo )
-        {
-        TRAPD( err, HandleSimCardInfoL() );
-        if ( err != KErrNone )
-            {
-            TRAP_IGNORE( SendErrorMessageL( err, KErrorSimCardInfoFailed ) );
-            }
-        }
-
-    else if ( iCommand == CHtiPIMServicePlugin::EImportSimContact )
-        {
-        TRAPD( err, HandleSimContactImportL() );
-        if ( err != KErrNone )
-            {
-            TRAP_IGNORE( SendErrorMessageL( err, KErrorImportFailed ) );
-            }
-        }
-
-    else if ( iCommand == CHtiPIMServicePlugin::EDeleteSimContact )
-        {
-        TRAPD( err, HandleSimContactDeleteL() );
-        if ( err != KErrNone )
-            {
-            TRAP_IGNORE( SendErrorMessageL( err, KErrorDeleteFailed ) );
-            }
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::StoreReady" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::StoreUnavailable
-// Called when a contact store becomes unavailable.
-// From MVPbkContactStoreObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::StoreUnavailable( MVPbkContactStore& aContactStore,
-                                              TInt aReason )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::StoreUnavailable" );
-
-    if ( iIsBusy && iSimStore == &aContactStore )
-        {
-        TRAP_IGNORE( SendErrorMessageL( aReason, KErrorSimStoreUnavailable ) );
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::StoreUnavailable" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::HandleStoreEventL
-// Called when changes occur in the contact store.
-// From MVPbkContactStoreObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::HandleStoreEventL( MVPbkContactStore& aContactStore,
-                        TVPbkContactStoreEvent aStoreEvent )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::HandleStoreEventL" );
-
-    if ( iIsBusy && iSimStore == &aContactStore &&
-         aStoreEvent.iEventType == TVPbkContactStoreEvent::EContactAdded )
-        {
-        HTI_LOG_TEXT( "Contact added" );
-        TInt entryId = 0;
-        TBuf8<4> idBuf;
-        idBuf.Append( ( TUint8* ) &entryId, 4 );
-        TRAP_IGNORE( SendOkMsgL( idBuf ) );
-        }
-
-    else if ( iIsBusy && iSimStore == &aContactStore &&
-              aStoreEvent.iEventType == TVPbkContactStoreEvent::EContactDeleted )
-        {
-        HTI_LOG_TEXT( "Contact deleted" );
-        if ( iMessage->Length() > 0 )  // This is a single deletion
-            {
-            TRAP_IGNORE( SendOkMsgL( KNullDesC8 ) );
-            }
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::HandleStoreEventL" );
-    }
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactOperationCompleted
-// Called when a contact operation has succesfully completed.
-// From MVPbkContactObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ContactOperationCompleted( TContactOpResult /*aResult*/ )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ContactOperationCompleted" );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ContactOperationCompleted" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactOperationFailed
-// Called when a contact operation has failed.
-// From MVPbkContactObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ContactOperationFailed( TContactOp /*aOpCode*/,
-                                                    TInt /*aErrorCode*/,
-                                                    TBool /*aErrorNotified*/ )
-    {
-
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ContactOperationFailed" );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ContactOperationFailed" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactViewReady
-// Called when a view is ready for use.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ContactViewReady( MVPbkContactViewBase& aView )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ContactViewReady" );
-
-    if ( iContactView == &aView && iIsBusy &&
-            iCommand == CHtiPIMServicePlugin::EDeleteSimContact )
-        {
-        TRAPD( err, DeleteContactsInViewL() );
-        if ( err != KErrNone )
-            {
-            TRAP_IGNORE( SendErrorMessageL( err, KErrorDeleteFailed ) );
-            }
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ContactViewReady" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactViewUnavailable
-// Called when a view is unavailable for a while.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ContactViewUnavailable( MVPbkContactViewBase& /*aView*/ )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ContactViewUnavailable" );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ContactViewUnavailable" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactAddedToView
-// Called when a contact has been added to the view.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ContactAddedToView( MVPbkContactViewBase& /*aView*/,
-        TInt /*aIndex*/, const MVPbkContactLink& /*aContactLink*/ )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ContactAddedToView" );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ContactAddedToView" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactRemovedFromView
-// Called when a contact has been removed from a view.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ContactRemovedFromView( MVPbkContactViewBase& /*aView*/,
-        TInt /*aIndex*/, const MVPbkContactLink& /*aContactLink*/ )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ContactRemovedFromView" );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ContactRemovedFromView" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactViewError
-// Called when an error occurs in the view.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::ContactViewError( MVPbkContactViewBase& aView,
-                                              TInt aError,
-                                              TBool aErrorNotified )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::ContactViewError" );
-    HTI_LOG_FORMAT( "CHtiSimDirHandlerVPbk::ContactViewError: %d", aError );
-    HTI_LOG_FORMAT( "ErrorNotified = %d", aErrorNotified );
-    if ( iContactView == &aView )
-        {
-        iContactView->RemoveObserver( *this );
-        if ( iIsBusy && iCommand == CHtiPIMServicePlugin::EDeleteSimContact )
-            {
-            SendErrorMessageL( aError, KErrorDeleteFailed );
-            }
-        }
-    aErrorNotified = aErrorNotified;  // avoid compiler warning
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::ContactViewError" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::StepComplete
-// Called when one step of the batch operation is complete.
-// From MVPbkBatchOperationObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::StepComplete( MVPbkContactOperationBase& /*aOperation*/,
-                           TInt aStepSize )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::StepComplete" );
-    HTI_LOG_FORMAT( "Step size = %d", aStepSize );
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::StepComplete" );
-    aStepSize = aStepSize; // avoid compiler warning
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::StepFailed
-// Called when one step of the batch operation fails.
-// From MVPbkBatchOperationObserver
-// ----------------------------------------------------------------------------
-TBool CHtiSimDirHandlerVPbk::StepFailed( MVPbkContactOperationBase& aOperation,
-                                         TInt aStepSize, TInt aError )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::StepFailed" );
-    HTI_LOG_FORMAT( "Error %d", aError );
-    if ( iCurrentOperation == &aOperation )
-        {
-        // We are returning EFalse (= do not continue) we can delete
-        // the operation. OperationComplete() won't be called.
-        delete iCurrentOperation;
-        iCurrentOperation = NULL;
-        TRAP_IGNORE( SendErrorMessageL( aError, KErrorDeleteFailed ) );
-        }
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::StepFailed" );
-    aStepSize = aStepSize; // avoid compiler warning
-    return EFalse; // do not continue
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::OperationComplete
-// Called when operation is completed.
-// From MVPbkBatchOperationObserver
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::OperationComplete(
-            MVPbkContactOperationBase& aOperation )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::OperationComplete" );
-    // Operation is complete -> delete it
-    if ( iCurrentOperation == &aOperation )
-        {
-        delete iCurrentOperation;
-        iCurrentOperation = NULL;
-        if ( iIsBusy && iCommand == CHtiPIMServicePlugin::EDeleteSimContact )
-            {
-            // Delete operation has completed
-            TRAP_IGNORE( SendOkMsgL( KNullDesC8 ) );
-            }
-        }
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::OperationComplete" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::HandleSimCardInfoL
-// Gets information about the SIM card.
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::HandleSimCardInfoL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::HandleSimCardInfoL" );
-
-    // Get entry counts
-    const MVPbkContactStoreInfo& info = iSimStore->StoreInfo();
-    TInt maxEntries = info.MaxNumberOfContactsL();
-    TInt currentEntries = info.NumberOfContactsL();
-    HTI_LOG_FORMAT( "Current entries = %d", currentEntries );
-    HTI_LOG_FORMAT( "Max entries = %d", maxEntries );
-
-    // Create new entry object to get field informations
-    MVPbkStoreContact* entry = iSimStore->CreateNewContactLC();
-    TVPbkFieldVersitProperty prop;
-    TVPbkFieldTypeParameters param;
-
-    // Resolve field types
-    prop.SetName( EVPbkVersitNameN );
-    const MVPbkFieldType* nameFieldType =
-        iContactManager->FieldTypes().FindMatch( prop, 0 );
-
-    const MVPbkFieldType* secNameFieldType =
-        iContactManager->FieldTypes().Find( R_VPBK_FIELD_TYPE_SECONDNAME );
-
-    param.Reset();
-    param.Add( EVPbkVersitParamCELL );
-    prop.SetName( EVPbkVersitNameTEL );
-    prop.SetParameters( param );
-    const MVPbkFieldType* numberFieldType =
-        iContactManager->FieldTypes().FindMatch( prop, 0 );
-
-    param.Reset();
-    param.Add( EVPbkVersitParamINTERNET );
-    prop.SetName( EVPbkVersitNameEMAIL );
-    prop.SetParameters( param );
-    const MVPbkFieldType* mailFieldType =
-        iContactManager->FieldTypes().FindMatch( prop, 0 );
-
-    // Get max field counts
-    TInt maxNumbers = entry->MaxNumberOfFieldL( *numberFieldType );
-    TInt maxSecondNames = entry->MaxNumberOfFieldL( *secNameFieldType );
-    TInt maxEmails = entry->MaxNumberOfFieldL( *mailFieldType );
-
-    HTI_LOG_FORMAT( "Max numbers = %d", maxNumbers );
-    HTI_LOG_FORMAT( "Max second names = %d", maxSecondNames );
-    HTI_LOG_FORMAT( "Max emails = %d", maxEmails );
-
-    // Create field objects to get field data max lengths and verify that
-    // fields can be created. It is assumed that all SIM cards support name
-    // and number fields but e-mail and second name fields are TRAP:ed as
-    // creating them would cause a leave if not supported by the SIM card.
-    // It was noticed that with a SIM card not supporting the second name
-    // field the MaxNumberOfFieldL method for that field returns 1 but then
-    // the CreateFieldLC leaves with KErrNotSupported.
-    MVPbkStoreContactField* nameField = entry->CreateFieldLC( *nameFieldType );
-    MVPbkContactFieldTextData& nameFieldData =
-        MVPbkContactFieldTextData::Cast( nameField->FieldData() );
-    TInt maxNameLength = nameFieldData.MaxLength();
-    CleanupStack::PopAndDestroy(); // nameField
-
-    MVPbkStoreContactField* numberField = entry->CreateFieldLC( *numberFieldType );
-    MVPbkContactFieldTextData& numberFieldData =
-        MVPbkContactFieldTextData::Cast( numberField->FieldData() );
-    TInt maxNumberLength = numberFieldData.MaxLength();
-    CleanupStack::PopAndDestroy(); // numberField
-
-    MVPbkStoreContactField* mailField = NULL;
-    TInt maxMailLength = 0;
-    if ( maxEmails > 0 )
-        {
-        TRAPD( err, mailField = entry->CreateFieldLC( *mailFieldType );
-            CleanupStack::Pop(); ); // Popping inside the TRAP
-        if ( err != KErrNone )
-            {
-            maxEmails = 0;
-            }
-        else
-            {
-            MVPbkContactFieldTextData& mailFieldData =
-                MVPbkContactFieldTextData::Cast( mailField->FieldData() );
-            maxMailLength = mailFieldData.MaxLength();
-            delete mailField;
-            mailField = NULL;
-            }
-        }
-
-    MVPbkStoreContactField* secNameField = NULL;
-    TInt maxSecNameLength = 0;
-    if ( maxSecondNames > 0 )
-        {
-        TRAPD( err, secNameField = entry->CreateFieldLC( *secNameFieldType );
-            CleanupStack::Pop(); ); // Popping inside the TRAP
-        if ( err != KErrNone )
-            {
-            maxSecondNames = 0;
-            }
-        else
-            {
-            MVPbkContactFieldTextData& secNameFieldData =
-                MVPbkContactFieldTextData::Cast( secNameField->FieldData() );
-            maxSecNameLength = secNameFieldData.MaxLength();
-            delete secNameField;
-            secNameField = NULL;
-            }
-        }
-
-    HTI_LOG_FORMAT( "Max name length = %d", maxNameLength );
-    HTI_LOG_FORMAT( "Max 2nd name length = %d", maxSecNameLength );
-    HTI_LOG_FORMAT( "Max number length = %d", maxNumberLength );
-    HTI_LOG_FORMAT( "Max mail length = %d", maxMailLength );
-
-    CleanupStack::PopAndDestroy(); // entry
-
-    // Create and send response message
-    TBuf8<KSimInfoResponseLength> reply;
-    reply.Append( maxSecondNames );
-    reply.Append( maxNumbers - 1 ); // max num of additional numbers, so -1
-    reply.Append( maxEmails );
-    reply.Append( maxNameLength );
-    reply.Append( maxNumberLength );
-    reply.Append( maxSecNameLength );
-    reply.Append( maxNumberLength ); // additional number uses same field type
-    reply.Append( maxMailLength );
-    reply.Append( ( TUint8* ) ( &maxEntries ), 2 );
-    reply.Append( ( TUint8* ) ( &currentEntries ), 2 );
-
-    SendOkMsgL( reply );
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::HandleSimCardInfoL" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::HandleSimContactImportL
-// Imports the contact to SIM card.
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::HandleSimContactImportL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::HandleSimContactImportL" );
-
-    MVPbkStoreContact* newEntry = iSimStore->CreateNewContactLC();
-
-    TInt offset = 0;
-    TInt fieldCount = iMessage->Des()[offset];
-    offset++;
-
-    for ( TInt i = 0; i < fieldCount; i++ )
-        {
-        HTI_LOG_FORMAT( "Processing field %d", i + 1 );
-
-        MVPbkStoreContactField* field = NULL;
-        TVPbkFieldVersitProperty prop;
-        TVPbkFieldTypeParameters param;
-        const MVPbkFieldType* fieldType = NULL;
-        TContactFieldType type = ( TContactFieldType ) iMessage->Des()[offset];
-        offset++;
-        switch ( type )
-            {
-            case ENameField:
-                prop.SetName( EVPbkVersitNameN );
-                fieldType = iContactManager->FieldTypes().FindMatch( prop, 0 );
-                break;
-            case ESecondNameField:
-                fieldType = iContactManager->FieldTypes().Find(
-                    R_VPBK_FIELD_TYPE_SECONDNAME );
-                break;
-            case EPhoneNumberField:
-                param.Add( EVPbkVersitParamCELL );
-                prop.SetName( EVPbkVersitNameTEL );
-                prop.SetParameters( param );
-                fieldType = iContactManager->FieldTypes().FindMatch( prop, 0 );
-                break;
-            case EEMailField:
-                param.Add( EVPbkVersitParamINTERNET );
-                prop.SetName( EVPbkVersitNameEMAIL );
-                prop.SetParameters( param );
-                fieldType = iContactManager->FieldTypes().FindMatch( prop, 0 );
-                break;
-            case EAdditNumberField:
-                param.Add( EVPbkVersitParamCELL );
-                prop.SetName( EVPbkVersitNameTEL );
-                prop.SetParameters( param );
-                fieldType = iContactManager->FieldTypes().FindMatch( prop, 0 );
-                break;
-            default:
-                HTI_LOG_FORMAT( "Unknown field type %d", type );
-                User::Leave( KErrArgument );
-                break;
-            }
-
-        if ( fieldType == NULL )
-            {
-            User::Leave( KErrArgument );
-            }
-
-        HTI_LOG_FORMAT( "Field type res id %d", fieldType->FieldTypeResId() );
-
-        field = newEntry->CreateFieldLC( *fieldType );
-
-        TInt fieldLength = iMessage->Des()[offset];
-        offset++;
-        HBufC* fieldData = HBufC::NewLC( fieldLength );
-        fieldData->Des().Copy( iMessage->Mid( offset, fieldLength ) );
-        HTI_LOG_FORMAT( "Field created - adding data: %S", fieldData );
-
-        MVPbkContactFieldTextData& targetData =
-            MVPbkContactFieldTextData::Cast( field->FieldData() );
-        targetData.SetTextL( *fieldData );
-
-        CleanupStack::PopAndDestroy(); // fieldData
-
-        HTI_LOG_TEXT( "Data set - Adding the field" );
-        newEntry->AddFieldL( field );
-        CleanupStack::Pop(); // field
-
-        offset += fieldLength;
-        }
-
-    HTI_LOG_TEXT( "Entry created - Commiting" );
-    // Starts the async commit operation. Takes ownership of newEntry.
-    newEntry->CommitL( *this );
-    CleanupStack::Pop(); // newEntry
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::HandleSimContactImportL" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::HandleSimContactDeleteL
-// Creates a contact view containing the contacts to be deleted.
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::HandleSimContactDeleteL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::HandleSimContactDeleteL" );
-
-    if ( iContactView )
-        {
-        iContactView->RemoveObserver( *this );
-        delete iContactView;
-        iContactView = NULL;
-        }
-
-    // Delete one entry based on ID
-    if ( iMessage->Length() == 4 )
-        {
-        TPtr8 msgPtr = iMessage->Des();
-        TInt id = msgPtr[0] + ( msgPtr[1] << 8 )
-                            + ( msgPtr[2] << 16 )
-                            + ( msgPtr[3] << 24 );
-        HTI_LOG_FORMAT( "Delete with id %d", id );
-
-        User::Leave( KErrNotSupported );
-        }
-
-    // Delete all
-    else
-        {
-        CVPbkContactViewDefinition* viewDef = CVPbkContactViewDefinition::NewL();
-        CleanupStack::PushL( viewDef );
-        viewDef->SetType( EVPbkContactsView );
-        viewDef->SetSharing( EVPbkLocalView );
-        viewDef->SetSortPolicy( EVPbkUnsortedContactView ); // in SIM index order
-        CVPbkSortOrder* sortOrder = CVPbkSortOrder::NewL(
-                iSimStore->StoreProperties().SupportedFields() );
-        CleanupStack::PushL( sortOrder );
-        iContactView = iSimStore->CreateViewLC( *viewDef, *this, *sortOrder );
-        CleanupStack::Pop(); // view;
-        CleanupStack::PopAndDestroy( 2 ); // sortOrder, viewDef
-        }
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::HandleSimContactDeleteL" );
-    }
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::DeleteContactsInViewL
-// Deletes the contacts that are currently in iContactView.
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::DeleteContactsInViewL()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::DeleteContactsInViewL" );
-
-    TInt cntCount( iContactView->ContactCountL() );
-    HTI_LOG_FORMAT( "Contact count in view = %d", cntCount );
-    if ( cntCount > 0 )
-        {
-        CVPbkContactLinkArray* contactLinks = CVPbkContactLinkArray::NewLC();
-        for ( TInt i = 0; i < cntCount; ++i )
-            {
-            MVPbkContactLink* link =
-                iContactView->ContactAtL( i ).CreateLinkLC();
-            contactLinks->AppendL( link );
-            CleanupStack::Pop(); // link
-            }
-        // Following DeleteContactsL will result in calls to StepComplete
-        // and finally OperationComplete (StepFailed if error occurs)
-        iCurrentOperation = iContactManager->DeleteContactsL(
-                *contactLinks, *this );
-        CleanupStack::PopAndDestroy(); // contactLinks
-        }
-    else
-        {
-        // Nothing to delete
-        SendOkMsgL( KNullDesC8 );
-        }
-
-    // We don't need the view anymore
-    HTI_LOG_TEXT( "Deleting the contact view" );
-    iContactView->RemoveObserver( *this );
-    delete iContactView;
-    iContactView = NULL;
-
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::DeleteContactsInViewL" );
-    }
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::CheckImportMsg
-// Validates the syntax of import contact message.
-// ----------------------------------------------------------------------------
-TBool CHtiSimDirHandlerVPbk::CheckImportMsg()
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::CheckImportMsg" );
-    // Import command syntax:
-    //   amount of fields     (1 byte)   __
-    //   type of field        (1 byte)     |
-    //   length of data field (1 byte)     | repeated <amount of fields> times
-    //   field data           (variable) __|
-
-    TInt length = iMessage->Length();
-    if ( length < 4 ) // min length 4 bytes
-        {
-        HTI_LOG_FORMAT( "Message too short %d", length );
-        return EFalse;
-        }
-
-    TInt offset = 0;
-    TInt fieldCount = iMessage->Des()[offset];
-    HTI_LOG_FORMAT( "Fields %d", fieldCount );
-    if ( fieldCount < 1 ) // must be at least one field
-        {
-        return EFalse;
-        }
-
-    offset++;
-    TInt fieldsFound = 0;
-    while ( offset < length )
-        {
-        fieldsFound++;
-        TInt fieldType = iMessage->Des()[offset];
-        HTI_LOG_FORMAT( "Field type %d", fieldType );
-        if ( fieldType < ENameField || fieldType > EAdditNumberField )
-            {
-            return EFalse; // invalid field type
-            }
-        offset++; // the type of field byte
-        if ( offset >= length )
-            {
-            return EFalse;
-            }
-        TInt fieldLength = iMessage->Des()[offset];
-        HTI_LOG_FORMAT( "Field length %d", fieldLength );
-        if ( fieldLength < 1 )
-            {
-            return EFalse; // Field data can not be empty
-            }
-        offset++; // advance over the length of data byte
-        offset += fieldLength; // and the field data
-        }
-
-    if ( offset == length && fieldsFound == fieldCount )
-        {
-        HTI_LOG_TEXT( "Message OK" );
-        return ETrue;
-        }
-
-    return EFalse;
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::SendOkMsgL
-// Helper function for sending response messages.
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::SendOkMsgL( const TDesC8& aData )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::SendOkMsgL" );
-    iIsBusy = EFalse; // Done with the current request
-    User::LeaveIfNull( iDispatcher );
-    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
-    TPtr8 response = temp->Des();
-    response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk );
-    response.Append( aData );
-    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
-        temp, KPIMServiceUid ) );
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::SendOkMsgL" );
-    }
-
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::SendErrorMessageL
-// Helper function for sending error response messages.
-// ----------------------------------------------------------------------------
-void CHtiSimDirHandlerVPbk::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
-    {
-    HTI_LOG_FUNC_IN( "CHtiSimDirHandlerVPbk::SendErrorMessageL" );
-    iIsBusy = EFalse; // Done with the current request
-    User::LeaveIfNull( iDispatcher );
-    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
-        aError, aDescription, KPIMServiceUid ) );
-    HTI_LOG_FUNC_OUT( "CHtiSimDirHandlerVPbk::SendErrorMessageL" );
-    }
-
-
-// End of file
--- a/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/PIMHandler.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiPIMServicePlugin/src/PIMHandler.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,38 +17,30 @@
 
 
 // INCLUDE FILES
+#include "../../../symbian_version.hrh"
+
 #include "HtiPIMServicePlugin.h"
 #include "PIMHandler.h"
 
 #include <HtiDispatcherInterface.h>
-#include <HTILogging.h>
+#include <HtiLogging.h>
 
 #include <utf.h>
 #include <calcommon.h>
 #include <calsession.h>
-#include <calenimporter.h>
 #include <calentryview.h>
 
-#include <CVPbkContactLinkArray.h>
-#include <CVPbkContactManager.h>
-#include <CVPbkContactViewDefinition.h>
-#include <CVPbkContactStoreUriArray.h>
-#include <CVPbkSortOrder.h>
-#include <CVPbkVCardEng.h>
-#include <MVPbkContactLinkArray.h>
-#include <MVPbkContactOperationBase.h>
-#include <MVPbkContactStore.h>
-#include <MVPbkContactStoreList.h>
-#include <MVPbkContactStoreObserver.h>
-#include <MVPbkContactStoreProperties.h>
-#include <MVPbkContactView.h>
-#include <MVPbkContactViewBase.h>
-#include <MVPbkViewContact.h>
-#include <TVPbkContactStoreUriPtr.h>
-#include <VPbkContactStoreUris.h>
+#include <cntdb.h> 
+#include <cntitem.h> 
+#include <cntfldst.h> 
+#include <cntvcard.h> 
+#include <cntfilt.h> 
+#include <caldataexchange.h> 
+#include <caldataformat.h> 
 
 // CONSTANTS
 _LIT8( KErrorUnrecognizedCommand, "Unrecognized command" );
+_LIT8( KErrorCalendarFileFormat, "Invalid format of calendar file name");
 _LIT8( KErrorVCardImportFailed, "vCard import failed" );
 _LIT8( KErrorVCalendarImportFailed, "vCalendar import failed" );
 _LIT8( KErrorMissingVCalendar, "Missing vCalendar object" );
@@ -57,8 +49,14 @@
 _LIT8( KErrorItemNotFound, "Item not found" );
 _LIT8( KErrorFailedDelete, "Failed to delete item" );
 _LIT8( KErrorFailedDeleteAll, "Failed to delete all items" );
-_LIT8( KErrorIdDeleteNotSupported, "Deleting with ID not supported anymore" );
+_LIT8( KErrorFailedOpenCalendar, "Failed to open calendar file");
+//_LIT8( KErrorFailedOpenContact, "Failed to open contact database");
+
 
+
+_LIT( KDefaultAgendaFile, "" ); // A default file is opened if fileName is KNullDesC
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )  
 _LIT8( KErrorMissingText, "Text parameter missing" );
 _LIT8( KErrorMissingFilepath, "Filepath parameter missing" );
 _LIT8( KErrorNotepadAddMemoFailed, "Notepad add memo failed" );
@@ -70,9 +68,9 @@
 _LIT( KCmdAddMemoFromFile, "AddMemoFromFile" );
 _LIT( KCmdDeleteAll,       "DeleteAll" );
 _LIT( KCmdDelim,           " " );
-
-_LIT( KDefaultAgendaFile, "" ); // A default file is opened if fileName is KNullDesC
-
+#else
+_LIT8( KErrorNotepadNotSupported, "Notepad not supported" );
+#endif
 
 // ----------------------------------------------------------------------------
 CPIMHandler* CPIMHandler::NewL()
@@ -87,7 +85,8 @@
     }
 
 // ----------------------------------------------------------------------------
-CPIMHandler::CPIMHandler():iIsBusy( EFalse ), iEntryViewErr( KErrNone )
+CPIMHandler::CPIMHandler():iIsBusy( EFalse ), iEntryViewErr( KErrNone ),
+        iCalSession(NULL)
     {
     }
 
@@ -95,22 +94,8 @@
 CPIMHandler::~CPIMHandler()
     {
     HTI_LOG_TEXT( "CPIMHandler destroy" );
-    HTI_LOG_TEXT( "Deleting iEntryView" );
-    delete iEntryView;
-    HTI_LOG_TEXT( "Deleting iCalSession" );
+    HTI_LOG_TEXT( "Deleting iCalSession");
     delete iCalSession;
-    if ( iContactView )
-        {
-        HTI_LOG_TEXT( "Deleting iContactView" );
-        iContactView->RemoveObserver( *this );
-        delete iContactView;
-        }
-    HTI_LOG_TEXT( "Deleting iVCardEngine" );
-    delete iVCardEngine;
-    HTI_LOG_TEXT( "Deleting iContactManager" );
-    delete iContactManager;
-    HTI_LOG_TEXT( "Deleting iBuffer" );
-    delete iBuffer;
     HTI_LOG_TEXT( "Deleting iWaiter" );
     delete iWaiter;
     }
@@ -120,7 +105,6 @@
     {
     HTI_LOG_TEXT( "CPIMHandler::ConstructL" );
     iWaiter = new ( ELeave ) CActiveSchedulerWait;
-
     }
 
 // ----------------------------------------------------------------------------
@@ -141,8 +125,8 @@
     // Zero legth of aMessage tested already in CHtiPIMServicePlugin.
     // Other sanity checks must be done here.
 
-    iCommand = aMessage.Ptr()[0];
-    switch ( iCommand )
+    TUint8 command = aMessage.Ptr()[0];
+    switch ( command )
         {
         case CHtiPIMServicePlugin::EImportVCard:
             {
@@ -168,6 +152,17 @@
                     aMessage.Right( aMessage.Length() - 1 ) ) );
             break;
             }
+        case CHtiPIMServicePlugin::EOpenCalendarFile:
+            {
+            TRAP( err, HandleOpenCalendarFileL(
+                    aMessage.Right( aMessage.Length() - 1 )));
+            break;
+            }
+        case CHtiPIMServicePlugin::EListCalendarFiles:
+            {
+            TRAP( err, HandleListCalendarFilesL());
+            break;
+            }
         case CHtiPIMServicePlugin::ENotepadAddMemo:
             {
             TRAP( err, HandleNotepadAddMemoFuncL( aMessage.Mid( 1 ) ) );
@@ -207,46 +202,144 @@
     }
 
 // ----------------------------------------------------------------------------
+void CPIMHandler::HandleOpenCalendarFileL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleOpenCalendarFileL" );
+    
+    // check the format, the correct format is DriveLetter:FileName
+    if (aData.Length() != 0)
+        {
+        if(aData.Length() < 3 || aData[1] != ':'||
+                !(aData[0] >= 'a' && aData[0] <= 'z' || aData[0] >= 'A' && aData[0] <= 'Z'))
+            {
+            SendErrorMessageL( KErrArgument, KErrorCalendarFileFormat );
+            return;
+            }
+        }
+    
+    delete iCalSession;
+    iCalSession = NULL;
+    
+    // Open iCalSession
+    HTI_LOG_TEXT("Open calendar session");
+    iCalSession = CCalSession::NewL();
+    TBuf<KMaxFileName + 2> calFile;
+    calFile.Copy(aData);
+    TRAPD(err, iCalSession->OpenL(calFile));
+    if(err == KErrNone)
+        {
+        HTI_LOG_TEXT("Calendar session open");
+        SendOkMsgL( KNullDesC8 );
+        }
+    else
+        {
+        HTI_LOG_TEXT("Failed to open calendar file");
+        SendErrorMessageL( err, KErrorFailedOpenCalendar );
+        delete iCalSession;
+        iCalSession = NULL;
+        }
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleOpenCalendarFileL: Done" );
+    }
+
+// ----------------------------------------------------------------------------
+void CPIMHandler::HandleListCalendarFilesL()
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::HandleListCalendarFiles" );
+    
+    CCalSession* calSession = CCalSession::NewL();
+    CleanupStack::PushL(calSession);
+    HTI_LOG_TEXT("List all calendar files");
+    CDesCArray* calFiles = calSession->ListCalFilesL();
+    
+    if(calFiles == NULL) //No calendar files
+        {
+        TBuf8<2> reply;
+        reply.AppendFill(0, 2);
+        SendOkMsgL(reply);
+        CleanupStack::PopAndDestroy(); // calSession
+        return;
+        }
+    
+    CleanupStack::PushL(calFiles);
+    TInt count = calFiles->Count();
+    
+    // files count + file count * (file name length + max file name + driver letter + ':')
+    TInt bufSize = 2 + count * (2 + KMaxFileName + 1 + 1);
+    CBufFlat* calListBuf = CBufFlat::NewL( bufSize );
+    CleanupStack::PushL(calListBuf);
+    
+    HBufC8* calArray = HBufC8::NewLC( bufSize );
+    TPtr8 calArrayPtr = calArray->Des();
+    
+    calArrayPtr.Append((TUint8*)(&count), 2);
+    TInt pos = 0;
+    calListBuf->ExpandL(pos, 2);
+    calListBuf->Write(pos, *calArray, 2);
+    calArrayPtr.Zero();
+    pos += 2;
+    
+    for(int i = 0; i < count; ++i)
+        {
+        TInt len = calFiles->MdcaPoint(i).Length();
+        calArrayPtr.Append((TUint8*)(&len), 2);
+        calArrayPtr.Append(calFiles->MdcaPoint(i));
+        calListBuf->ExpandL(pos, calArray->Length());
+        calListBuf->Write(pos,*calArray, calArray->Length());
+        pos += calArray->Length();
+        calArrayPtr.Zero();
+        }
+    SendOkMsgL( calListBuf->Ptr( 0 ) );
+    CleanupStack::PopAndDestroy(4); //calArray, calListBuf, calFiles, calSession;    
+    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleListCalendarFiles: Done" );
+    }
+
+// ----------------------------------------------------------------------------
 void CPIMHandler::HandleVCardImportFuncL( const TDesC8& aData )
     {
     HTI_LOG_FUNC_IN( "CPIMHandler::HandleVCardImportFuncL" );
-
     if ( aData.Length() == 0 )
         {
         SendErrorMessageL( KErrArgument, KErrorMissingVCard );
         return;
         }
-
-    if ( iBuffer ) // delete if exists (just to be sure)
-        {
-        delete iBuffer;
-        iBuffer = NULL;
-        }
-    iBuffer = CBufFlat::NewL( aData.Length() );
-    iBuffer->ExpandL( 0, aData.Length() );
-
-    HTI_LOG_FORMAT( "Data length = %d", aData.Length() );
-    HTI_LOG_FORMAT( "Buffer length = %d", iBuffer->Ptr( 0 ).MaxLength() );
-    iBuffer->Ptr( 0 ).Copy( aData );
-
-    if ( iContactManager == NULL )
+    
+    CContactDatabase* contactDatabase = CContactDatabase::OpenL();
+    HTI_LOG_TEXT( "CPIMHandler: Contact database open" );
+    CleanupStack::PushL(contactDatabase);
+    
+    CBufFlat* buffer = CBufFlat::NewL(aData.Length());
+    CleanupStack::PushL(buffer);
+    buffer->ExpandL(0, aData.Length());
+    buffer->Ptr(0).Copy(aData.Right(aData.Length()));
+    RBufReadStream readStream;
+    readStream.Open(*buffer, 0);
+    CleanupClosePushL<RBufReadStream>( readStream );
+    
+    // Imports vCard
+    TBool success = EFalse;
+    TUid format = TUid::Uid(KUidVCardConvDefaultImpl);
+    CArrayPtr<CContactItem>* contacts = NULL;
+    TRAPD(err,contacts = contactDatabase->ImportContactsL(format, readStream, success, 
+            CContactDatabase::EImportSingleContact | CContactDatabase::ETTFormat));
+    CleanupStack::PushL(contacts);
+    if(err != KErrNone || success == EFalse || contacts == NULL || contacts->Count() == 0)
         {
-        CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
-        uriArray->AppendL( TVPbkContactStoreUriPtr(
-            VPbkContactStoreUris::DefaultCntDbUri() ) );
-        iContactManager = CVPbkContactManager::NewL( *uriArray );
-        CleanupStack::PopAndDestroy( uriArray );
+        HTI_LOG_TEXT("Failed to import vCard");
+        SendErrorMessageL( err, KErrorVCardImportFailed );
         }
-
-    if ( iVCardEngine == NULL )
+    else
         {
-        iVCardEngine = CVPbkVCardEng::NewL( *iContactManager );
+        // Returns the imported contact id 
+        TInt32 entryId = contacts->At(0)->Id();
+        TBuf8<4> idBuf;
+        idBuf.Append( ( TUint8* ) &entryId, 4 );
+        HTI_LOG_TEXT("vCard imported");
+        SendOkMsgL( idBuf );
         }
-
-    MVPbkContactStoreList& stores = iContactManager->ContactStoresL();
-    iContactStore = &stores.At( 0 );
-    iContactStore->OpenL( *this );
-
+    
+    contacts->ResetAndDestroy();
+    
+    CleanupStack::PopAndDestroy(4); // contacts, readStream, buffer, contactDatabase
     HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCardImportFuncL: Done" );
     }
 
@@ -262,27 +355,23 @@
         return;
         }
 
-    if ( iBuffer ) // delete if exists (just to be sure)
-        {
-        delete iBuffer;
-        iBuffer = NULL;
-        }
-    iBuffer = CBufFlat::NewL( aData.Length() );
-    iBuffer->ExpandL( 0, aData.Length() );
-    iBuffer->Ptr( 0 ).Copy( aData );
+    CBufFlat* buffer = CBufFlat::NewL( aData.Length() );
+    CleanupStack::PushL(buffer);
+    buffer->ExpandL( 0, aData.Length() );
+    buffer->Ptr( 0 ).Copy( aData );
     RBufReadStream readStream;
-    readStream.Open( *iBuffer, 0 );
+    readStream.Open( *buffer, 0 );
     CleanupClosePushL( readStream );
 
-    if ( iCalSession == NULL )
+    if(iCalSession == NULL)
         {
-        HTI_LOG_TEXT( "CPIMHandler: Creating Calendar session" );
+        HTI_LOG_TEXT( "CPIMHandler: Open default calendar file" );
         iCalSession = CCalSession::NewL();
         iCalSession->OpenL( KDefaultAgendaFile );
         HTI_LOG_TEXT( "CPIMHandler: Calendar session open" );
         }
 
-    CCalenImporter* importer = CCalenImporter::NewL( *iCalSession );
+    CCalDataExchange* importer = CCalDataExchange::NewL(*iCalSession);
     CleanupStack::PushL( importer );
     HTI_LOG_TEXT( "CPIMHandler: Calendar importer created" );
 
@@ -291,59 +380,48 @@
 
     TInt err = KErrNone;
     TInt size = 0;
-    importer->SetImportMode( ECalenImportModeExtended );
-    // First try to import as iCalendar
-    TRAP( err, importer->ImportICalendarL( readStream, entryArray ) );
-    HTI_LOG_FORMAT( "ImportICalendarL return value %d", err );
+    // Import as VCalendar
+    TRAP( err, importer->ImportL( KUidVCalendar, readStream, entryArray ) );
+    HTI_LOG_FORMAT( "ImportL return value %d", err );
     size = entryArray.Count();
-    HTI_LOG_FORMAT( "Import ICalendarL imported %d entries", size );
-    // If import didn't succeed, try as vCalendar
-    if ( err != KErrNone || size == 0 )
-        {
-        readStream.Close();
-        readStream.Open( *iBuffer, 0 ); // reset read stream
-        entryArray.ResetAndDestroy(); // avoid double imports
-        TRAP( err, importer->ImportVCalendarL( readStream, entryArray ) );
-        HTI_LOG_FORMAT( "ImportVCalendarL return value %d", err );
-        size = entryArray.Count();
-        HTI_LOG_FORMAT( "Import VCalendarL imported %d entries", size );
-        }
+    HTI_LOG_FORMAT( "Import VCalendarL imported %d entries", size );
     TCalLocalUid uniqueId = 0;
     TInt success = 0;
     if ( size > 0 )
         {
-        iEntryView = CCalEntryView::NewL( *iCalSession, *this );
+        CCalEntryView* entryView = CCalEntryView::NewL( *iCalSession, *this );
         iWaiter->Start();
+        CleanupStack::PushL(entryView);
         if ( iEntryViewErr == KErrNone )
             {
-            TRAP( err, iEntryView->StoreL( entryArray, success ) );
+            TRAP( err, entryView->StoreL( entryArray, success ) );
             HTI_LOG_FORMAT( "StoreL return value %d", err );
             HTI_LOG_FORMAT( "Successfully stored %d entries", success );
             uniqueId = entryArray[0]->LocalUidL();
             }
-        delete iEntryView;
-        iEntryView = NULL;
+        CleanupStack::PopAndDestroy();
         }
     entryArray.ResetAndDestroy();
     CleanupStack::PopAndDestroy(); // entryArray
 
     if ( err == KErrNone && success > 0 )
         {
+        HTI_LOG_TEXT("vCalendar imported");
         TBuf8<8> uniqueIdStr;
         uniqueIdStr.Copy( ( TUint8* ) ( &uniqueId ), sizeof( uniqueId ) );
         SendOkMsgL( uniqueIdStr );
         }
     else
         {
-        if ( err == KErrNone ) err = KErrGeneral;
+        HTI_LOG_TEXT("Failed to import vCalendar");
+        if ( err == KErrNone ) 
+            {
+            err = KErrGeneral;
+            }
         SendErrorMessageL( err, KErrorVCalendarImportFailed );
         }
 
-    CleanupStack::PopAndDestroy( 2 ); // readStream, importer
-    delete iCalSession;
-    iCalSession = NULL;
-    delete iBuffer;
-    iBuffer = NULL;
+    CleanupStack::PopAndDestroy( 3 ); // buffer, readStream, importer
     HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarImportFuncL: Done" );
     }
 
@@ -351,7 +429,6 @@
 void CPIMHandler::HandleContactDeleteFuncL( const TDesC8& aData )
     {
     HTI_LOG_FUNC_IN( "CPIMHandler::HandleContactDeleteFuncL" );
-
     TInt dataLength = aData.Length();
     if ( dataLength != 0 && dataLength != 4 )
         {
@@ -359,30 +436,50 @@
         SendErrorMessageL( KErrArgument, KErrorInvalidId );
         return;
         }
-
-    if ( dataLength == 4 )
-        {
-        SendErrorMessageL( KErrNotSupported, KErrorIdDeleteNotSupported );
-        return;
-        }
-
-    if ( iContactManager == NULL )
+    CContactDatabase* contactDatabase = CContactDatabase::OpenL();
+    HTI_LOG_TEXT( "CPIMHandler: Contact database open" );
+    CleanupStack::PushL(contactDatabase);
+    
+    if(dataLength == 0)   // delete all contacts
         {
-        CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
-        uriArray->AppendL( TVPbkContactStoreUriPtr(
-            VPbkContactStoreUris::DefaultCntDbUri() ) );
-        iContactManager = CVPbkContactManager::NewL( *uriArray );
-        CleanupStack::PopAndDestroy( uriArray );
+        //const CContactIdArray* array = iContactDatabase->SortedItemsL();
+        CCntFilter *filter = CCntFilter::NewLC();
+        filter->SetContactFilterTypeCard(ETrue);
+        filter->SetContactFilterTypeGroup(EFalse);
+        contactDatabase->FilterDatabaseL(*filter);
+        TRAPD(err, contactDatabase->DeleteContactsL(*filter->iIds));
+        CleanupStack::PopAndDestroy();
+        if(err == KErrNone)
+            {
+            HTI_LOG_TEXT("All contacts deleted");
+            SendOkMsgL( KNullDesC8 );
+            }
+        else
+            {
+            HTI_LOG_TEXT("Failed to delete all contacts");
+            SendErrorMessageL( err, KErrorFailedDeleteAll );
+            }
         }
-
-    if ( iContactStore == NULL )
+    else  // delete one contact by id
         {
-        MVPbkContactStoreList& stores = iContactManager->ContactStoresL();
-        iContactStore = &stores.At( 0 );
+        TUint id = aData[0] + ( aData[1] << 8 )
+                + ( aData[2] << 16 )
+                + ( aData[3] << 24 );
+        TRAPD(err, contactDatabase->DeleteContactL(id));
+        
+        if(err == KErrNone)
+            {
+            HTI_LOG_TEXT("Contact deleted");
+            SendOkMsgL( KNullDesC8 );
+            }
+        else
+            {
+            HTI_LOG_TEXT("Failed to delete contact");
+            SendErrorMessageL( err, KErrorFailedDelete );
+            }
         }
-
-    iContactStore->OpenL( *this );
-
+    
+    CleanupStack::PopAndDestroy();
     HTI_LOG_FUNC_OUT( "CPIMHandler::HandleContactDeleteFuncL" );
     }
 
@@ -399,42 +496,26 @@
         return;
         }
 
-    if ( iBuffer ) // delete if exists (just to be sure)
-        {
-        delete iBuffer;
-        iBuffer = NULL;
-        }
-    if ( aData.Length() > 0 )
+
+    if(iCalSession == NULL)
         {
-        iBuffer = CBufFlat::NewL( aData.Length() );
-        iBuffer->ExpandL( 0, aData.Length() );
-        iBuffer->Ptr( 0 ).Copy( aData );
-        }
-
-    if ( iCalSession == NULL )
-        {
-        HTI_LOG_TEXT( "CPIMHandler: Creating Calendar session" );
+        HTI_LOG_TEXT( "CPIMHandler: Open default calendar file" );
         iCalSession = CCalSession::NewL();
         iCalSession->OpenL( KDefaultAgendaFile );
         HTI_LOG_TEXT( "CPIMHandler: Calendar session open" );
         }
 
     HTI_LOG_TEXT( "CPIMHandler: Creating entry view" );
-    iEntryView = CCalEntryView::NewL( *iCalSession, *this );
+    CCalEntryView* entryView = CCalEntryView::NewL( *iCalSession, *this );
     iWaiter->Start();
+    CleanupStack::PushL(entryView);
     if ( iEntryViewErr != KErrNone )
         {
-        delete iEntryView;
-        iEntryView = NULL;
-        delete iCalSession;
-        iCalSession = NULL;
-        delete iBuffer;
-        iBuffer = NULL;
         User::Leave( iEntryViewErr );
         }
 
-    // If iBuffer is NULL, no ID given, delete all calendar entries
-    if ( iBuffer == NULL )
+    // If dataLength is 0, no ID given, delete all calendar entries
+    if ( dataLength == 0 )
         {
         HTI_LOG_TEXT( "CPIMHandler: Deleting all calendar entries" );
         TCalTime minTime;
@@ -442,15 +523,17 @@
         minTime.SetTimeUtcL( TCalTime::MinTime() );
         maxTime.SetTimeUtcL( TCalTime::MaxTime() );
         CalCommon::TCalTimeRange timeRange( minTime, maxTime );
-        TRAPD( err, iEntryView->DeleteL( timeRange,
+        TRAPD( err, entryView->DeleteL( timeRange,
                 CalCommon::EIncludeAll, *this ) );
         iWaiter->Start();
         if ( err == KErrNone && iEntryViewErr == KErrNone )
             {
+            HTI_LOG_TEXT("All calendar entries deleted");
             SendOkMsgL( KNullDesC8 );
             }
         else
             {
+            HTI_LOG_TEXT("Failed to delete all calendar entries");
             SendErrorMessageL( KErrGeneral, KErrorFailedDeleteAll );
             }
         }
@@ -458,13 +541,12 @@
     // If id given, delete only calendar entry having that id
     else
         {
-        TPtr8 data = iBuffer->Ptr( 0 );
-        TCalLocalUid id = data[0] + ( data[1] << 8 )
-                             + ( data[2] << 16 )
-                             + ( data[3] << 24 );
+        TCalLocalUid id = aData[0] + ( aData[1] << 8 )
+                             + ( aData[2] << 16 )
+                             + ( aData[3] << 24 );
         HTI_LOG_FORMAT( "CPIMHandler: Deleting one calendar entry %d", id );
         CCalEntry* entryToDelete = NULL;
-        TRAPD( err, entryToDelete = iEntryView->FetchL( id ) );
+        TRAPD( err, entryToDelete = entryView->FetchL( id ) );
 
         if ( err || entryToDelete == NULL )
             {
@@ -474,57 +556,25 @@
         else
             {
             CleanupStack::PushL( entryToDelete );
-            TRAP( err, iEntryView->DeleteL( *entryToDelete ) );
+            TRAP( err, entryView->DeleteL( *entryToDelete ) );
             if ( err == KErrNone )
                 {
+                HTI_LOG_TEXT("calendar entrie deleted");
                 SendOkMsgL( KNullDesC8 );
                 }
             else
                 {
-                HTI_LOG_TEXT( "CPIMHandler: Error deleting calendar entry" )
+                HTI_LOG_TEXT( "Failed to delete calendar entry" )
                 SendErrorMessageL( KErrGeneral, KErrorFailedDelete );
                 }
             CleanupStack::PopAndDestroy( entryToDelete );
             }
         }
-    delete iEntryView;
-    iEntryView = NULL;
-    delete iCalSession;
-    iCalSession = NULL;
-    delete iBuffer;
-    iBuffer = NULL;
+    CleanupStack::PopAndDestroy(); //entryView;
     HTI_LOG_FUNC_OUT( "CPIMHandler::HandleVCalendarDeleteFuncL" );
     }
 
-// ----------------------------------------------------------------------------
-void CPIMHandler::SendOkMsgL( const TDesC8& aData )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::SendOkMsgL: Starting" );
-
-    User::LeaveIfNull( iDispatcher );
-
-    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
-    TPtr8 response = temp->Des();
-    response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk );
-    response.Append( aData );
-    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
-        temp, KPIMServiceUid ) );
-    iIsBusy = EFalse;
-    HTI_LOG_FUNC_OUT( "CPIMHandler::SendOkMsgL: Done" );
-    }
-
-// ----------------------------------------------------------------------------
-void CPIMHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::SendErrorMessageL: Starting" );
-    User::LeaveIfNull( iDispatcher );
-    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
-        aError, aDescription, KPIMServiceUid ) );
-    iIsBusy = EFalse;
-    HTI_LOG_FUNC_OUT( "CPIMHandler::SendErrorMessageL: Done" );
-    }
-
-// ----------------------------------------------------------------------------
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )  
 TInt CallNpdHlp( const TDesC& aCmd )
     {
     HTI_LOG_FUNC_IN( "CallNpdHlp" );
@@ -555,24 +605,13 @@
     HTI_LOG_FUNC_OUT( "CallNpdHlp" );
     return KErrNone;
     }
-
-// ----------------------------------------------------------------------------
-void CPIMHandler::SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::SendNotepadOkMsgL" );
-    TBuf8<1> msg;
-    msg.Append( aCommand );
-    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
-                        msg.AllocL(), KPIMServiceUid ) );
-    iIsBusy = EFalse;
-    HTI_LOG_FUNC_OUT( "CPIMHandler::SendNotepadOkMsgL" );
-    }
+#endif
 
 // ----------------------------------------------------------------------------
 void CPIMHandler::HandleNotepadAddMemoFuncL( const TDesC8& aData )
     {
     HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFuncL" );
-
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
     if ( aData.Length() < 1 )
         {
         SendErrorMessageL( KErrArgument, KErrorMissingText );
@@ -601,7 +640,9 @@
         }
 
     CleanupStack::PopAndDestroy( 2 ); // text, cmd
-
+#else
+    SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif   
     HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFuncL" );
     }
 
@@ -609,7 +650,7 @@
 void CPIMHandler::HandleNotepadAddMemoFromFileFuncL( const TDesC8& aData )
     {
     HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" );
-
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
     if ( aData.Length() < 1 )
         {
         SendErrorMessageL( KErrArgument, KErrorMissingFilepath );
@@ -638,7 +679,9 @@
         }
 
     CleanupStack::PopAndDestroy( 2 ); // filename, cmd
-
+#else
+    SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif 
     HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadAddMemoFromFileFuncL" );
     }
 
@@ -646,7 +689,7 @@
 void CPIMHandler::HandleNotepadDeleteAllFuncL()
     {
     HTI_LOG_FUNC_IN( "CPIMHandler::HandleNotepadDeleteAllFuncL" );
-
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 ) 
     TInt err = CallNpdHlp( KCmdDeleteAll() );
     if ( err )
         {
@@ -656,352 +699,53 @@
         {
         SendNotepadOkMsgL( CHtiPIMServicePlugin::ENotepadDeleteAll );
         }
-
+#else
+    SendErrorMessageL(KErrNotSupported, KErrorNotepadNotSupported);
+#endif 
     HTI_LOG_FUNC_OUT( "CPIMHandler::HandleNotepadDeleteAllFuncL" );
     }
 
 // ----------------------------------------------------------------------------
-// CPIMHandler::CreateContactDeleteViewL
-// Creates a contact view containing the contacts to be deleted.
-// ----------------------------------------------------------------------------
-void CPIMHandler::CreateContactDeleteViewL()
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::CreateContactDeleteViewL" );
-
-    if ( iContactView )
-        {
-        iContactView->RemoveObserver( *this );
-        delete iContactView;
-        iContactView = NULL;
-        }
-
-    CVPbkContactViewDefinition* viewDef = CVPbkContactViewDefinition::NewL();
-    CleanupStack::PushL( viewDef );
-    viewDef->SetType( EVPbkContactsView );
-    viewDef->SetSharing( EVPbkLocalView );
-    viewDef->SetSortPolicy( EVPbkSortedContactView );
-    CVPbkSortOrder* sortOrder = CVPbkSortOrder::NewL(
-            iContactStore->StoreProperties().SupportedFields() );
-    CleanupStack::PushL( sortOrder );
-    iContactView = iContactStore->CreateViewLC( *viewDef, *this, *sortOrder );
-    CleanupStack::Pop(); // view;
-    CleanupStack::PopAndDestroy( 2 ); // sortOrder, viewDef
-
-    HTI_LOG_FUNC_OUT( "CPIMHandler::CreateContactDeleteViewL" );
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::DeleteContactsInViewL
-// Deletes the contacts that are currently in iContactView.
-// ----------------------------------------------------------------------------
-void CPIMHandler::DeleteContactsInViewL()
+void CPIMHandler::SendNotepadOkMsgL( CHtiPIMServicePlugin::TCommand aCommand )
     {
-    HTI_LOG_FUNC_IN( "CPIMHandler::DeleteContactsInViewL" );
-
-    TInt cntCount( iContactView->ContactCountL() );
-    HTI_LOG_FORMAT( "Contact count in view = %d", cntCount );
-    if ( cntCount > 0 )
-        {
-        CVPbkContactLinkArray* contactLinks = CVPbkContactLinkArray::NewLC();
-        for ( TInt i = 0; i < cntCount; ++i )
-            {
-            MVPbkContactLink* link =
-                iContactView->ContactAtL( i ).CreateLinkLC();
-            contactLinks->AppendL( link );
-            CleanupStack::Pop(); // link
-            }
-        // Following DeleteContactsL will result in calls to StepComplete
-        // and finally OperationComplete (StepFailed if error occurs)
-        iOp = iContactManager->DeleteContactsL( *contactLinks, *this );
-        CleanupStack::PopAndDestroy(); // contactLinks
-        }
-    else
-        {
-        // Nothing to delete
-        iContactStore->Close( *this );
-        SendOkMsgL( KNullDesC8 );
-        }
-
-    // We don't need the view anymore
-    HTI_LOG_TEXT( "Deleting the contact view" );
-    iContactView->RemoveObserver( *this );
-    delete iContactView;
-    iContactView = NULL;
-
-    HTI_LOG_FUNC_OUT( "CPIMHandler::DeleteContactsInViewL" );
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::StoreReady
-// Called when a contact store is ready to use.
-// From MVPbkContactStoreObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::StoreReady( MVPbkContactStore& aContactStore )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::StoreReady" );
-    if ( iIsBusy && iContactStore == &aContactStore )
-        {
-        if ( iCommand == CHtiPIMServicePlugin::EImportVCard )
-            {
-            iReadStream.Open( *iBuffer, 0 );
-            HTI_LOG_TEXT( "Starting vCard import" );
-            TRAPD( err, iOp = iVCardEngine->ImportVCardL(
-                    *iContactStore, iReadStream, *this ) );
-            HTI_LOG_FORMAT( "ImpoortVCardL returned %d", err );
-            if ( err != KErrNone )
-                {
-                delete iOp;
-                iOp = NULL;
-                iReadStream.Close();
-                delete iBuffer;
-                iBuffer = NULL;
-                iContactStore->Close( *this );
-                TRAP_IGNORE( SendErrorMessageL( err, KErrorVCardImportFailed ) );
-                }
-            }
-        else if ( iCommand == CHtiPIMServicePlugin::EDeleteContact )
-            {
-            TRAPD( err, CreateContactDeleteViewL() );
-            if ( err != KErrNone )
-                {
-                iContactStore->Close( *this );
-                TRAP_IGNORE( SendErrorMessageL( err, KErrorFailedDelete ) );
-                }
-            }
-        }
-    HTI_LOG_FUNC_OUT( "CPIMHandler::StoreReady" );
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::StoreUnavailable
-// Called when a contact store becomes unavailable.
-// From MVPbkContactStoreObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::StoreUnavailable( MVPbkContactStore& aContactStore,
-        TInt aReason )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::StoreUnavailable" );
-
-    if ( iIsBusy && iContactStore == &aContactStore )
-        {
-        delete iBuffer;
-        iBuffer = NULL;
-        TRAP_IGNORE( SendErrorMessageL( aReason, KErrorVCardImportFailed ) );
-        }
-
-    HTI_LOG_FUNC_OUT( "CPIMHandler::StoreUnavailable" );
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::HandleStoreEventL
-// Called when changes occur in the contact store.
-// From MVPbkContactStoreObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::HandleStoreEventL( MVPbkContactStore& /*aContactStore*/,
-                        TVPbkContactStoreEvent /*aStoreEvent*/ )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::HandleStoreEventL" );
-    HTI_LOG_FUNC_OUT( "CPIMHandler::HandleStoreEventL" );
+    HTI_LOG_FUNC_IN( "CPIMHandler::SendNotepadOkMsgL" );
+    TBuf8<1> msg;
+    msg.Append( aCommand );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+                        msg.AllocL(), KPIMServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CPIMHandler::SendNotepadOkMsgL" );
     }
 
 // ----------------------------------------------------------------------------
-// CPIMHandler::ContactsSaved
-// Called when the contact has been successfully commited or copied.
-// From MVPbkContactCopyObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::ContactsSaved( MVPbkContactOperationBase& aOperation,
-        MVPbkContactLinkArray* aResults )
-{
-    HTI_LOG_FUNC_IN( "CPIMHandler::ContactsSaved" );
+void CPIMHandler::SendOkMsgL( const TDesC8& aData )
+    {
+    HTI_LOG_FUNC_IN( "CPIMHandler::SendOkMsgL: Starting" );
 
-    if ( iIsBusy && iOp == &aOperation )
-        {
-        TInt count = aResults->Count();
-        HTI_LOG_FORMAT( "%d contact(s) added", count );
-        delete aResults;
-        delete iOp;
-        iOp = NULL;
-        iReadStream.Close();
-        delete iBuffer;
-        iBuffer = NULL;
-        iContactStore->Close( *this );
-        TInt entryId = 0; // We can't get the ID, just send zero
-        TBuf8<4> idBuf;
-        idBuf.Append( ( TUint8* ) &entryId, 4 );
-        TRAP_IGNORE( SendOkMsgL( idBuf ) );
-        }
-
-    HTI_LOG_FUNC_OUT( "CPIMHandler::ContactsSaved" );
-}
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::ContactsSavingFailed
-// Called when there was en error while saving contact(s).
-// From MVPbkContactCopyObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::ContactsSavingFailed(
-        MVPbkContactOperationBase& aOperation, TInt aError )
-{
-    HTI_LOG_FUNC_IN( "CPIMHandler::ContactsSavingFailed" );
+    User::LeaveIfNull( iDispatcher );
 
-    if ( iIsBusy && iOp == &aOperation )
-        {
-        delete iOp;
-        iOp = NULL;
-        iReadStream.Close();
-        delete iBuffer;
-        iBuffer = NULL;
-        iContactStore->Close( *this );
-        TRAP_IGNORE( SendErrorMessageL( aError, KErrorVCardImportFailed ) );
-        }
-
-    HTI_LOG_FUNC_OUT( "CPIMHandler::ContactsSavingFailed" );
-}
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::ContactViewReady
-// Called when a view is ready for use.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::ContactViewReady( MVPbkContactViewBase& aView )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::ContactViewReady" );
-
-    if ( iContactView == &aView && iIsBusy &&
-            iCommand == CHtiPIMServicePlugin::EDeleteContact )
-        {
-        TRAPD( err, DeleteContactsInViewL() );
-        if ( err != KErrNone )
-            {
-            TRAP_IGNORE( SendErrorMessageL( err, KErrorFailedDelete ) );
-            }
-        }
-
-    HTI_LOG_FUNC_OUT( "CPIMHandler::ContactViewReady" );
-    }
-
-// ----------------------------------------------------------------------------
-// CHtiSimDirHandlerVPbk::ContactViewUnavailable
-// Called when a view is unavailable for a while.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::ContactViewUnavailable( MVPbkContactViewBase& /*aView*/ )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::ContactViewUnavailable" );
-    HTI_LOG_FUNC_OUT( "CPIMHandler::ContactViewUnavailable" );
+    HBufC8* temp = HBufC8::NewL( aData.Length() + 1 );
+    TPtr8 response = temp->Des();
+    response.Append( ( TChar ) CHtiPIMServicePlugin::EResultOk );
+    response.Append( aData );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingMessage(
+        temp, KPIMServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CPIMHandler::SendOkMsgL: Done" );
     }
 
 // ----------------------------------------------------------------------------
-// CPIMHandler::ContactAddedToView
-// Called when a contact has been added to the view.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::ContactAddedToView( MVPbkContactViewBase& /*aView*/,
-        TInt /*aIndex*/, const MVPbkContactLink& /*aContactLink*/ )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::ContactAddedToView" );
-    HTI_LOG_FUNC_OUT( "CPIMHandler::ContactAddedToView" );
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::ContactRemovedFromView
-// Called when a contact has been removed from a view.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::ContactRemovedFromView( MVPbkContactViewBase& /*aView*/,
-        TInt /*aIndex*/, const MVPbkContactLink& /*aContactLink*/ )
+void CPIMHandler::SendErrorMessageL( TInt aError, const TDesC8& aDescription )
     {
-    HTI_LOG_FUNC_IN( "CPIMHandler::ContactRemovedFromView" );
-    HTI_LOG_FUNC_OUT( "CPIMHandler::ContactRemovedFromView" );
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::ContactViewError
-// Called when an error occurs in the view.
-// From MVPbkContactViewObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::ContactViewError( MVPbkContactViewBase& aView,
-        TInt aError, TBool aErrorNotified )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::ContactViewError" );
-    HTI_LOG_FORMAT( "CPIMHandler::ContactViewError: %d", aError );
-    HTI_LOG_FORMAT( "ErrorNotified = %d", aErrorNotified );
-    if ( iContactView == &aView )
-        {
-        iContactView->RemoveObserver( *this );
-        delete iContactView;
-        iContactView = NULL;
-        if ( iIsBusy && iCommand == CHtiPIMServicePlugin::EDeleteContact )
-            {
-            SendErrorMessageL( aError, KErrorFailedDelete );
-            }
-        iContactStore->Close( *this );
-        }
-    aErrorNotified = aErrorNotified;  // avoid compiler warning
-    HTI_LOG_FUNC_OUT( "CPIMHandler::ContactViewError" );
+    HTI_LOG_FUNC_IN( "CPIMHandler::SendErrorMessageL: Starting" );
+    User::LeaveIfNull( iDispatcher );
+    User::LeaveIfError( iDispatcher->DispatchOutgoingErrorMessage(
+        aError, aDescription, KPIMServiceUid ) );
+    iIsBusy = EFalse;
+    HTI_LOG_FUNC_OUT( "CPIMHandler::SendErrorMessageL: Done" );
     }
 
 // ----------------------------------------------------------------------------
-// CPIMHandler::StepComplete
-// Called when one step of the batch operation is complete.
-// From MVPbkBatchOperationObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::StepComplete( MVPbkContactOperationBase& /*aOperation*/,
-                           TInt /*aStepSize*/ )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::StepComplete" );
-    HTI_LOG_FUNC_OUT( "CPIMHandler::StepComplete" );
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::StepFailed
-// Called when one step of the batch operation fails.
-// From MVPbkBatchOperationObserver
-// ----------------------------------------------------------------------------
-TBool CPIMHandler::StepFailed( MVPbkContactOperationBase& aOperation,
-                                         TInt /*aStepSize*/, TInt aError )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::StepFailed" );
-    HTI_LOG_FORMAT( "Error %d", aError );
-    if ( iOp == &aOperation )
-        {
-        // We are returning EFalse (= do not continue) we can delete
-        // the operation. OperationComplete() won't be called.
-        delete iOp;
-        iOp = NULL;
-        iContactStore->Close( *this );
-        TRAP_IGNORE( SendErrorMessageL( aError, KErrorFailedDelete ) );
-        }
-    HTI_LOG_FUNC_OUT( "CPIMHandler::StepFailed" );
-    return EFalse; // do not continue
-    }
-
-// ----------------------------------------------------------------------------
-// CPIMHandler::OperationComplete
-// Called when operation is completed.
-// From MVPbkBatchOperationObserver
-// ----------------------------------------------------------------------------
-void CPIMHandler::OperationComplete(
-            MVPbkContactOperationBase& aOperation )
-    {
-    HTI_LOG_FUNC_IN( "CPIMHandler::OperationComplete" );
-    // Operation is complete -> delete it
-    if ( iOp == &aOperation )
-        {
-        delete iOp;
-        iOp = NULL;
-        iContactStore->Close( *this );
-        if ( iIsBusy && iCommand == CHtiPIMServicePlugin::EDeleteContact )
-            {
-            // Delete operation has completed
-            TRAP_IGNORE( SendOkMsgL( KNullDesC8 ) );
-            }
-        }
-    HTI_LOG_FUNC_OUT( "CPIMHandler::OperationComplete" );
-    }
-
-
-// ----------------------------------------------------------------------------
 // CPIMHandler::Progress
 // Called during calendar entry view creation and operations.
 // Called only if NotifyProgress returns ETrue.
--- a/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/HtiScreenshotServicePlugin.mmp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/group/HtiScreenshotServicePlugin.mmp	Tue May 11 16:14:15 2010 +0300
@@ -17,6 +17,7 @@
 
 
 #include <platform_paths.hrh>
+#include "../../../symbian_version.hrh"
 
 TARGET          HtiScreenshotServicePlugin.dll
 TARGETTYPE      PLUGIN
@@ -40,7 +41,10 @@
 TARGET          HtiScreenshotServicePlugin.rsc
 END
 
-LIBRARY         avkon.lib  // AknUtils for font handling
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+LIBRARY         alfclient.lib
+#endif
+LIBRARY         avkon.lib
 LIBRARY         bitgdi.lib
 LIBRARY         ecom.lib
 LIBRARY         efsrv.lib
@@ -53,6 +57,7 @@
 LIBRARY         imageconversion.lib
 LIBRARY         ws32.lib
 LIBRARY         flogger.lib
+LIBRARY         apgrfx.lib
 
 SMPSAFE
 
--- a/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiScreenshotServicePlugin.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/inc/HtiScreenshotServicePlugin.h	Tue May 11 16:14:15 2010 +0300
@@ -232,7 +232,10 @@
     //void InitFontCache();
 
     TBool IsMIMETypeSupported(TDesC8 &aMime);
-
+    
+    void SetScreenNumber(TInt aScreenNumber);
+    
+    void HandleRotateScreen(const TDesC8& aData);
 protected:
     CFbsBitmap* iScreen; //raw screen bitmap
     HBufC8* iEncodedBitmap; //ready to send
--- a/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiScreenshotServicePlugin.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiScreenshotServicePlugin.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,6 +17,9 @@
 
 
 // INCLUDE FILES
+#include "../../../symbian_version.hrh"
+
+
 #include "HtiScreenshotServicePlugin.h"
 #include <HtiDispatcherInterface.h>
 #include <HtiLogging.h>
@@ -25,6 +28,14 @@
 #include <ezcompressor.h>
 #include <hal.h>
 
+#include <AknLayoutConfig.h>
+#include <apgtask.h> 
+#include <AknCapServerDefs.h>
+
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+#include <alf/alfdrawer.h>
+#endif
+
 // CONSTANTS
 const static TUid KScreenshotServiceUid = {0x1020DEC3};
 
@@ -55,6 +66,9 @@
 
     // Gets the current screen size and orientation
     ECmdScreenMode            = 0x3A,
+    
+    // Rotates the screen to portrait or landscape
+    ECmdRotateScreen          = 0x3B,
 
     // Screencapture on updated part of screen only
     ECmdDeltaCaptureMask           = 0x80,
@@ -91,14 +105,16 @@
 const static TInt KMinScreenRegionCmdLength = 9;
 const static TInt KScreenDisplayOffset = 1;
 const static TInt KScreenMIMEOffset = KScreenDisplayOffset + 1;
+const static TInt KScreenScreenNumber = KScreenMIMEOffset + 8;
 const static TInt KRegionDisplayOffset = KMinScreenRegionCmdLength;
 const static TInt KRegionMIMEOffset = KRegionDisplayOffset + 1;
-
+const static TInt KRegionScreenNumber = KRegionMIMEOffset + 8;
 
 const static TInt KSeriesDurationOffset = 1;
 const static TInt KSeriesIntervalOffset = KSeriesDurationOffset + 4;
 const static TInt KSeriesDisplayOffset = KSeriesIntervalOffset + 4;
 const static TInt KSeriesMIMEOffset = KSeriesDisplayOffset + 1;
+const static TInt KSeriesScreenNumber = KSeriesMIMEOffset + 8;
 const static TInt KMinSeriesCmdLength = KSeriesMIMEOffset;
 
 const static TInt KRegionSeriesTlX = KSeriesDisplayOffset + 1;
@@ -106,6 +122,7 @@
 const static TInt KRegionSeriesBlX = KRegionSeriesTlY + 2;
 const static TInt KRegionSeriesBlY = KRegionSeriesBlX + 2;
 const static TInt KRegionSeriesMIMEOffset = KRegionSeriesBlY + 2;
+const static TInt KRegionSeriesScreenNumber = KRegionSeriesMIMEOffset + 8;
 const static TInt KMinRegionSeriesCmdLength = KRegionSeriesMIMEOffset;
 
 const static TInt KDeltaResetCmdLength = 1;
@@ -113,6 +130,7 @@
 
 const static TInt KScreenNrOffset = 1;
 const static TInt KSelectScreenCmdLength = 2;
+const static TInt KRotateScreenCmdLength = 2;
 
 _LIT( KSeriesShotPath, "c:\\Hti\\SeriesShot\\" );
 
@@ -1189,11 +1207,44 @@
                         }
                     }
 
+                bool screenNumberSet = false;
+                //check screen number
+                if ( (aMessage.Length() > KScreenScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)))
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    HTI_LOG_FORMAT( "set screen number: %d", screenNumber );
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
                 CreateBitmapL( empty, displayMode );
+
                 //check mime
                 if ( aMessage.Length() > KScreenMIMEOffset )
                     {
-                    mime.Set( aMessage.Mid( KScreenMIMEOffset ) );
+                    if(screenNumberSet)
+                        {
+                        mime.Set( aMessage.Mid( KScreenMIMEOffset, aMessage.Length()-1-KScreenMIMEOffset ) );
+                        }
+                    else
+                        {
+                        mime.Set( aMessage.Mid( KScreenMIMEOffset ) );
+                        }
                     if ( !IsMIMETypeSupported( mime ) )
                         {
                         iDispatcher->DispatchOutgoingErrorMessage(
@@ -1203,7 +1254,7 @@
                         return;
                         }
                     }
-                }
+                }              
                 break;
 
             case ECmdScreenRegion:
@@ -1211,6 +1262,30 @@
             case ECmdDeltaScreenRegion:
             case ECmdDeltaScreenRegionZip:
                 {
+                //check screen number
+                bool screenNumberSet = false;
+                if ( (aMessage.Length() > KRegionScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)))
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
                 if ( aMessage.Length() >= KMinScreenRegionCmdLength )
                     {
                     TRect region;
@@ -1271,11 +1346,18 @@
                                         KScreenshotServiceUid );
                         return;
                         }
-
+                    
                     //check mime
                     if ( aMessage.Length() > KRegionMIMEOffset )
                         {
-                        mime.Set( aMessage.Mid( KRegionMIMEOffset ) );
+                        if(!screenNumberSet)
+                            {
+                            mime.Set( aMessage.Mid( KRegionMIMEOffset ) );
+                            }
+                        else
+                            {
+                            mime.Set( aMessage.Mid( KRegionMIMEOffset, aMessage.Length()-1-KRegionMIMEOffset ) );
+                            }
                         if ( !IsMIMETypeSupported( mime ) )
                             {
                             iDispatcher->DispatchOutgoingErrorMessage(
@@ -1285,6 +1367,7 @@
                             return;
                             }
                         }
+
                     }
                 else
                     {
@@ -1308,6 +1391,30 @@
                                     KScreenshotServiceUid );
                     return;
                     }
+                
+                bool screenNumberSet = false;
+                if ( (aMessage.Length() > KSeriesScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)) )
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
                 TInt duration = ParseInt32( aMessage.Ptr() + KSeriesDurationOffset );
                 TInt interval = ParseInt32( aMessage.Ptr() + KSeriesIntervalOffset );
 
@@ -1320,10 +1427,17 @@
                                     KScreenshotServiceUid );
                     return;
                     }
-
+                
                 if ( aMessage.Length() > KSeriesMIMEOffset )
                     {
-                    mime.Set( aMessage.Mid( KSeriesMIMEOffset ) );
+                    if(screenNumberSet)
+                        {
+                        mime.Set( aMessage.Mid( KSeriesMIMEOffset, aMessage.Length()-1-KSeriesMIMEOffset ) );
+                        }
+                    else
+                        {
+                        mime.Set( aMessage.Mid( KSeriesMIMEOffset ) );
+                        }
                     if ( !IsMIMETypeSupported( mime ) )
                         {
                         iDispatcher->DispatchOutgoingErrorMessage(
@@ -1342,6 +1456,29 @@
             case ECmdScreenRegionSeries:
             case ECmdScreenRegionZipSeries:
                 {
+                bool screenNumberSet = false;
+                if ( (aMessage.Length() > KRegionSeriesScreenNumber) && 
+                        ((aMessage[aMessage.Length()-1] == 0) || (aMessage[aMessage.Length()-1] == 1)) )
+                    {
+                    TInt screenNumber = aMessage[aMessage.Length()-1];
+                    screenNumberSet = true;
+                    TInt screens;
+                    TInt ret = HAL::Get(HAL::EDisplayNumberOfScreens, screens);
+                    if(ret)
+                        {
+                        HTI_LOG_FORMAT( "HAL::Get failed %d", ret );
+                        User::Leave(ret);
+                        }
+                    HTI_LOG_FORMAT( "HAL::Get number of screens %d", screens );
+                    if( ( screenNumber>screens-1 ) || ( screenNumber<0 ) )
+                        {
+                        iDispatcher->DispatchOutgoingErrorMessage(
+                                KErrArgument, KErrDescrScreenNotSupported, KScreenshotServiceUid);
+                        return;
+                        }
+                    SetScreenNumber(screenNumber);
+                    }
+
                 if ( aMessage.Length() < KMinRegionSeriesCmdLength )
                     {
                     iDispatcher->DispatchOutgoingErrorMessage(
@@ -1403,10 +1540,17 @@
                                     KScreenshotServiceUid );
                     return;
                     }
-
+                
                 if ( aMessage.Length() > KRegionSeriesMIMEOffset )
                     {
-                    mime.Set( aMessage.Mid( KRegionSeriesMIMEOffset ) );
+                    if(screenNumberSet)
+                        {
+                        mime.Set( aMessage.Mid( KRegionSeriesMIMEOffset, aMessage.Length()-1-KRegionSeriesMIMEOffset ) );
+                        }
+                    else
+                        {
+                        mime.Set( aMessage.Mid( KRegionSeriesMIMEOffset ) );
+                        }
                     if ( !IsMIMETypeSupported( mime ) )
                         {
                         iDispatcher->DispatchOutgoingErrorMessage(
@@ -1526,7 +1670,17 @@
                     respMsg.AllocL(), KScreenshotServiceUid );
                 }
                 return;
-
+           case ECmdRotateScreen:
+               {
+               if (aMessage.Length() != KRotateScreenCmdLength)
+                   {
+                   iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+                           KErrDescrInvalid, KScreenshotServiceUid);
+                   return;
+                   }
+               HandleRotateScreen(aMessage.Right(aMessage.Length() -1));
+               return;
+               }
             default:
                 //Error: unknown command
                 iDispatcher->DispatchOutgoingErrorMessage(
@@ -1559,7 +1713,106 @@
     HTI_LOG_FUNC_OUT( "HtiScreenshotServicePlugin::ProcessMessage" );
     }
 
+// ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::HandleRotateScreen(const TDesC8& aData)
+    {
+    HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
+             
+    TInt orientation = aData[0];
+    if (orientation > 1 || orientation < 0)
+        {
+        iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
+                KErrDescrInvalid, KScreenshotServiceUid);
+        return;
+        }
 
+    TBool isLandScape = orientation;
+
+    RWsSession ws;
+    User::LeaveIfError(ws.Connect());
+    CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice(ws);
+    CleanupStack::PushL(screenDevice);
+    User::LeaveIfError(screenDevice->Construct());
+    TSize currentScreenSize = screenDevice->SizeInPixels();
+
+    TBool needsRotating = ETrue;
+    if (currentScreenSize.iWidth > currentScreenSize.iHeight && isLandScape)
+        {
+        // we are already in landscape 
+        HTI_LOG_TEXT("The screen are already in landscape.");
+        needsRotating = EFalse;
+        }
+    if (currentScreenSize.iWidth < currentScreenSize.iHeight
+            && (!isLandScape))
+        {
+        // we are already in portrait 
+        HTI_LOG_TEXT("The screen are already in portrait.");
+        needsRotating = EFalse;
+        }
+
+    CAknLayoutConfig* layoutConfigPtr = CAknLayoutConfig::NewL();
+    CleanupStack::PushL(layoutConfigPtr);
+
+    CAknLayoutConfig& layoutConfig = *layoutConfigPtr;
+
+    const CAknLayoutConfig::THardwareStateArray& hwStates =
+            layoutConfig.HardwareStates();
+    const CAknLayoutConfig::TScreenModeArray& screenModes =
+            layoutConfig.ScreenModes();
+
+    TInt newHwStateIndex = KErrNotFound;
+
+    // lets select alternate state from current
+    TSize newScreenSize;
+    if (needsRotating)
+        {
+        newScreenSize = TSize(currentScreenSize.iHeight,
+                currentScreenSize.iWidth);
+        HTI_LOG_FORMAT("Rotate the screen to the new width %d", newScreenSize.iWidth);
+        HTI_LOG_FORMAT("Rotate the screen to the new height %d", newScreenSize.iHeight);
+        }
+    else // basicly select current state again to ensure correct mode is informed to akncapserver
+        {
+        newScreenSize = TSize(currentScreenSize.iWidth,
+                currentScreenSize.iHeight);
+        }
+
+    for (TInt i = 0; i < hwStates.Count(); i++)
+        {
+        const CAknLayoutConfig::THardwareState hwState = hwStates.At(i);
+
+        const CAknLayoutConfig::TScreenMode normal = screenModes.Find(
+                hwState.ScreenMode());
+
+        if (normal.SizeInPixels() == newScreenSize)
+            {
+            newHwStateIndex = i;
+            break;
+            }
+        }
+
+    if (newHwStateIndex >= 0)
+        {
+        const CAknLayoutConfig::THardwareState newHwState = hwStates.At(
+                newHwStateIndex);
+        TApaTaskList taskList(ws);
+        TApaTask aknCapsrvTask = taskList.FindApp(KAknCapServerUid);
+        TInt keyCode = newHwState.KeyCode();
+        HTI_LOG_FORMAT( "Send key code %d to akncapserver", keyCode );
+        aknCapsrvTask.SendKey(keyCode, 0);
+        }
+
+    TBuf8<1> okMsg;
+    okMsg.Append(0);
+    iDispatcher->DispatchOutgoingMessage(okMsg.AllocL(),
+            KScreenshotServiceUid);
+
+    CleanupStack::PopAndDestroy(layoutConfigPtr);
+    CleanupStack::PopAndDestroy(screenDevice);
+    ws.Close();
+             
+    HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
+    }
 // ----------------------------------------------------------------------------
 void CHtiScreenshotServicePlugin::CreateBitmapL( TRect& aRegion,
                                                  TDisplayMode aMode )
@@ -1577,15 +1830,25 @@
     iScreen = new( ELeave ) CFbsBitmap;
     User::LeaveIfError( iScreen->Create( imageSize, displayMode ) );
 
+	TInt err = KErrNone;
+	TRect region;
     if ( aRegion.IsEmpty() )
         {
-        iScreenDevice->CopyScreenToBitmap( iScreen );
+        err = iScreenDevice->CopyScreenToBitmap( iScreen );
+		region = imageSize;
         }
     else
         {
-        iScreenDevice->CopyScreenToBitmap( iScreen, aRegion );
+        err = iScreenDevice->CopyScreenToBitmap( iScreen, aRegion );
+		region = aRegion;
         }
-
+    if (err == KErrNoMemory)
+	    {
+		HTI_LOG_TEXT( "screenshot in camera mode" );
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
+		err = CAlfDrawer::FallbackCopyScreenToBitmap(*iScreenDevice, iScreen, region);
+#endif
+		}
 
     if ( iDeltaCapture )
         {
@@ -1961,6 +2224,28 @@
     }
 
 // ----------------------------------------------------------------------------
+void CHtiScreenshotServicePlugin::SetScreenNumber(TInt aScreenNumber)
+    {
+    HTI_LOG_FUNC_IN("CHtiScreenshotServicePlugin::SetScreenNumber");
+    TInt currentScreen = iScreenDevice->GetScreenNumber();
+    HTI_LOG_FORMAT("current screen: %d", currentScreen);
+    HTI_LOG_FORMAT("new screen number: %d", aScreenNumber);
+    if(aScreenNumber == currentScreen)
+        {
+        return;
+        }
+
+    // Clear the previous delta bitmap to avoid error
+    iPreviousBitmap->Reset();
+    //delete old screendevice and create a new one
+    delete iScreenDevice;
+    iScreenDevice = NULL;
+    iScreenDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(iScreenDevice->Construct(aScreenNumber));
+    HTI_LOG_FUNC_OUT("CHtiScreenshotServicePlugin::SetScreenNumber");
+    }
+
+// ----------------------------------------------------------------------------
 CSeriesShot* CSeriesShot::NewL( MSeriesShotObserver* aServicePlugin )
     {
     HTI_LOG_FUNC_IN( "CSeriesShot::NewL" );
--- a/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiTextRcg.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiTextRcg.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,7 +17,6 @@
 
 
 #include "HtiTextRcg.h"
-#include <AknUtils.h>
 #include <HtiLogging.h>
 
 const static TInt KDefaultStrategy = EHintEdge;
--- a/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/HtiServicePlugins/HtiSysInfoServicePlugin/src/HtiSysInfoServicePlugin.cpp	Tue May 11 16:14:15 2010 +0300
@@ -2864,13 +2864,20 @@
     TFindFile finder( iFs );
     CDir* dir = NULL;
     TInt err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
-    while ( err == KErrNone )
+    TInt safeDeleteCount = 0;
+    while ( err == KErrNone && safeDeleteCount < 20)
         {
+        safeDeleteCount++;
         TFileName path;
         path.Copy(finder.File());
-        iFileMan->Delete(path);
+        HTI_LOG_FORMAT( "found file: %S", &path );
+        TInt ret = iFileMan->Delete(path);
         delete dir;
         dir = NULL;
+        if(ret != KErrNone)
+            {
+            break;
+            }
         err = finder.FindWildByDir(KMatchFileName, KTempFilePath, dir);
         }
     HTI_LOG_FUNC_OUT("CHtiSysInfoServicePlugin::CleanUpTempFiles");
--- a/htiui/group/bld.inf	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/group/bld.inf	Tue May 11 16:14:15 2010 +0300
@@ -21,20 +21,18 @@
 #include "../symbian_version.hrh"
 
 PRJ_EXPORTS
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 ../rom/htiui.iby        CORE_IBY_EXPORT_PATH(tools,htiui.iby)
-
-
-// Communication plugins
-#include "../HtiCommPlugins/HtiBtCommPlugin/group/bld.inf"
+#else
+../rom/htiui_10_1.iby   CORE_IBY_EXPORT_PATH(tools,htiui.iby)
+#endif
 
 // Service plugins
 #include "../HtiServicePlugins/HtiAppServicePlugin/group/bld.inf"
 #include "../HtiServicePlugins/HtiAudioServicePlugin/group/bld.inf"
 #include "../HtiServicePlugins/HtiKeyEventServicePlugin/group/bld.inf"
 #include "../HtiServicePlugins/HtiMessagesServicePlugin/group/bld.inf"
-#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
-    #include "../HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf"
-#endif
+#include "../HtiServicePlugins/HtiPIMServicePlugin/group/bld.inf"
 #include "../HtiServicePlugins/HtiScreenshotServicePlugin/group/bld.inf"
 #include "../HtiServicePlugins/HtiSysInfoServicePlugin/group/bld.inf"
 
@@ -48,7 +46,9 @@
 #include "../HtiStartupWait/group/bld.inf"
 
 // HTI Admin UI application
+#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
 #include "../HtiAdmin/group/bld.inf"
+#endif
 
 // Build stub SIS
 PRJ_EXTENSIONS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/htiui.pro	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+TEMPLATE = subdirs
+SUBDIRS += HtiAdminQt/HtiAdmin.pro 
+BLD_INF_RULES.prj_extensions += "$${LITERAL_HASH}include \"group/bld.inf\""  
+BLD_INF_RULES.prj_extensions += "prj_extensions"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/rom/htiui_10_1.iby	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: Specifies HTI UI layer components for ROM image
+*
+*/
+
+#ifndef __HTIUI_IBY__
+#define __HTIUI_IBY__
+
+
+// HtiAdmin application
+S60_APP_EXE(HtiAdmin)
+data=DATAZ_\Resource\apps\HtiAdmin.rsc                      Resource\Apps\HtiAdmin.rsc
+data=ZPRIVATE\10003a3f\import\apps\HtiAdmin_reg.rsc         private\10003a3f\import\apps\HtiAdmin_reg.rsc
+
+
+// Test service plug-ins
+ECOM_PLUGIN(HtiAudioServicePlugin.dll,HtiAudioServicePlugin.rsc)
+ECOM_PLUGIN(HtiKeyEventServicePlugin.dll,HtiKeyEventServicePlugin.rsc)
+ECOM_PLUGIN(HtiMessagesServicePlugin.dll,HtiMessagesServicePlugin.rsc)
+ECOM_PLUGIN(HtiPIMServicePlugin.dll,HtiPIMServicePlugin.rsc)
+ECOM_PLUGIN(HtiScreenshotServicePlugin.dll,HtiScreenshotServicePlugin.rsc)
+ECOM_PLUGIN(HtiSysInfoServicePlugin.dll,HtiSysInfoServicePlugin.rsc)
+
+// Test service plug-in extension
+file=ABI_DIR\BUILD_DIR\HtiAppControl.dll            SHARED_LIB_DIR\HtiAppControl.dll
+
+// Backup fake DLL used by HtiFtpServicePlugin
+file=ABI_DIR\BUILD_DIR\HtiFtpBackupFake.dll         SHARED_LIB_DIR\HtiFtpBackupFake.dll
+
+// Device rebooter
+file=ABI_DIR\BUILD_DIR\HtiDeviceRebootUI.exe       SHARED_LIB_DIR\HtiDeviceRebootUI.exe
+
+// Startup wait DLL
+file=ABI_DIR\BUILD_DIR\HtiStartupWait.dll           SHARED_LIB_DIR\HtiStartupWait.dll
+
+// Stub SIS
+data=ZSYSTEM\Install\HTI_stub.sis                   system\install\HTI_stub.sis
+
+#endif // __HTIUI_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60-10_1.pkg	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,111 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+; 
+; Description: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,21,0
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll"                          - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe"                        - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc"                      - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\import\apps\HtiAdmin_reg.rsc"          - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"    - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll"         - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll"            - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll"                 - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll"              - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll"             - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe"                 - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll"           - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll"             - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll"      - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll"            - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc"       - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll"        - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc"   - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll"      - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll"             - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc"        - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll"             - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc"        - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll"                   - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll"          - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc"     - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll"         - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc"    - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll"           - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc"      - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll"        - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc"   - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll"             - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc"        - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll"         - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc"    - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe"                      - "!:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll"                - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe"                    - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll"                    - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc"               - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll"                  - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- a/htiui/sis/HTI_S60-52.pkg	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/sis/HTI_S60-52.pkg	Tue May 11 16:14:15 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,17,0
+#{"HTI"},(0x1020DEB6),2,21,0
 
 ; Series60 product id for S60 5.2
 [0x20022E6D], 0, 0, 0, {"Series60ProductID"}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60_Upgrade-10_1.pkg	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,111 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+; 
+; Description: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll"                          - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe"                        - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc"                      - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\import\apps\HtiAdmin_reg.rsc"          - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"    - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll"         - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll"            - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll"                 - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll"              - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll"             - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe"                 - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll"           - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll"             - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll"      - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll"            - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc"       - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll"        - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc"   - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll"      - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll"             - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc"        - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll"             - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc"        - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll"                   - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll"          - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc"     - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll"         - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc"    - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll"           - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc"      - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll"        - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc"   - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll"             - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc"        - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll"         - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc"    - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe"                      - "!:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll"                - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe"                    - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll"                    - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc"               - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll"                  - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htiui/sis/HTI_S60_Upgrade-52.pkg	Tue May 11 16:14:15 2010 +0300
@@ -0,0 +1,114 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+; 
+; Description: Installation file for HTI
+
+
+; Languages
+&EN
+
+; Using UID of HtiFramework project
+#{"HTI"},(0x1020DEB6),2,21,0,TYPE=SA,RU
+
+; Series60 product id for S60 5.2
+[0x20022E6D], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Install files
+
+; HtiCfg library
+"\epoc32\release\armv5\urel\HtiCfg.dll"                          - "!:\sys\bin\HtiCfg.dll"
+
+; HtiAdmin
+"\epoc32\release\armv5\urel\HtiAdmin.exe"                        - "!:\sys\bin\HtiAdmin.exe"
+"\epoc32\data\Z\Resource\apps\HtiAdmin.rsc"                      - "!:\Resource\Apps\HtiAdmin.rsc"
+"\epoc32\data\Z\private\10003a3f\apps\HtiAdmin_reg.rsc"          - "!:\private\10003a3f\import\apps\HtiAdmin_reg.rsc"
+
+; Serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"    - "!:\Resource\Plugins\HtiSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSerialCommEcomPlugin.dll"         - "!:\sys\bin\HtiSerialCommEcomPlugin.dll"
+
+; BtSerial comm module
+"\epoc32\release\armv5\urel\HtiBtSerialComHelper.dll"            - "!:\sys\bin\HtiBtSerialComHelper.dll"
+"\epoc32\release\armv5\urel\HtiBtCommServer.dll"                 - "!:\sys\bin\HtiBtCommServer.dll"
+"\epoc32\release\armv5\urel\HtiBtCommInterface.dll"              - "!:\sys\bin\HtiBtCommInterface.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiBtCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiBtCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiBtCommEcomPlugin.dll"             - "!:\sys\bin\HtiBtCommEcomPlugin.dll"
+
+; IPComm module
+"\epoc32\release\armv5\urel\HtiIPCommServer.exe"                 - "!:\sys\bin\HtiIPCommServer.exe"
+"\epoc32\release\armv5\urel\HtiIPCommServerClient.dll"           - "!:\sys\bin\HtiIPCommServerClient.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIPCommEcomPlugin.rsc"        - "!:\Resource\Plugins\HtiIPCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIPCommEcomPlugin.dll"             - "!:\sys\bin\HtiIPCommEcomPlugin.dll"
+
+; USB serial comm module
+"\epoc32\data\Z\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc" - "!:\Resource\Plugins\HtiUsbSerialCommEcomPlugin.rsc"
+"\epoc32\release\armv5\urel\HtiUsbSerialCommEcomPlugin.dll"      - "!:\sys\bin\HtiUsbSerialCommEcomPlugin.dll"
+
+; Test service plug-ins
+"\epoc32\release\armv5\urel\HtiEchoServicePlugin.dll"            - "!:\sys\bin\HtiEchoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiEchoServicePlugin.rsc"       - "!:\Resource\Plugins\HtiEchoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiKeyEventServicePlugin.dll"        - "!:\sys\bin\HtiKeyEventServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiKeyEventServicePlugin.rsc"   - "!:\Resource\Plugins\HtiKeyEventServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiScreenshotServicePlugin.dll"      - "!:\sys\bin\HtiScreenshotServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiScreenshotServicePlugin.rsc" - "!:\Resource\Plugins\HtiScreenshotServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiFtpServicePlugin.dll"             - "!:\sys\bin\HtiFtpServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiFtpServicePlugin.rsc"        - "!:\Resource\Plugins\HtiFtpServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppServicePlugin.dll"             - "!:\sys\bin\HtiAppServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAppServicePlugin.rsc"        - "!:\Resource\Plugins\HtiAppServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAppControl.dll"                   - "!:\sys\bin\HtiAppControl.dll"
+"\epoc32\release\armv5\urel\HtiStifTfServicePlugin.dll"          - "!:\sys\bin\HtiStifTfServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiStifTfServicePlugin.rsc"     - "!:\Resource\Plugins\HtiStifTfServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiSysInfoServicePlugin.dll"         - "!:\sys\bin\HtiSysInfoServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiSysInfoServicePlugin.rsc"    - "!:\Resource\Plugins\HtiSysInfoServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiAudioServicePlugin.dll"           - "!:\sys\bin\HtiAudioServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAudioServicePlugin.rsc"      - "!:\Resource\Plugins\HtiAudioServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiMessagesServicePlugin.dll"        - "!:\sys\bin\HtiMessagesServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiMessagesServicePlugin.rsc"   - "!:\Resource\Plugins\HtiMessagesServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiPIMServicePlugin.dll"             - "!:\sys\bin\HtiPIMServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiPIMServicePlugin.rsc"        - "!:\Resource\Plugins\HtiPIMServicePlugin.rsc"
+"\epoc32\release\armv5\urel\HtiIpProxyServicePlugin.dll"         - "!:\sys\bin\HtiIpProxyServicePlugin.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiIpProxyServicePlugin.rsc"    - "!:\Resource\Plugins\HtiIpProxyServicePlugin.rsc"
+
+; Helper to add notepad memos
+"\epoc32\release\armv5\urel\HtiNpdHlp.exe"                       - "!:\sys\bin\HtiNpdHlp.exe"
+
+; File helper with capability ALL - for file operations to TCB folders
+"\epoc32\release\armv5\urel\HtiFileHlp.exe"                      - "!:\sys\bin\HtiFileHlp.exe"
+
+; Backup fake DLL used by HtiFtpServicePlugin
+"\epoc32\release\armv5\urel\HtiFtpBackupFake.dll"                - "!:\sys\bin\HtiFtpBackupFake.dll"
+
+; HTI watchdog
+"\epoc32\release\armv5\urel\HtiWatchDog.exe"                     - "!:\sys\bin\HtiWatchDog.exe"
+
+; HTI device reboot
+"\epoc32\release\armv5\urel\HtiDeviceRebootUI.exe"               - "!:\sys\bin\HtiDeviceRebootUI.exe"
+
+; HTI Framework
+"\epoc32\release\armv5\urel\HTIFramework.exe"                    - "!:\sys\bin\HTIFramework.exe"
+
+; AutoStart recogniser plug-in
+"\epoc32\release\armv5\urel\HtiAutoStart.dll"                    - "!:\sys\bin\HtiAutoStart.dll"
+"\epoc32\data\Z\Resource\Plugins\HtiAutoStart.rsc"               - "!:\Resource\Plugins\HtiAutoStart.rsc"
+
+; HTI startup wait
+"\epoc32\release\armv5\urel\HtiStartupWait.dll"                  - "!:\sys\bin\HtiStartupWait.dll"
+
+; Startup list resource file for starting HTIFramework.exe in device boot
+"\epoc32\data\Z\private\101f875a\import\1020deb6.rsc"            - "c:\private\101f875a\import\[1020deb6].rsc"
--- a/htiui/sis/HTI_stub.pkg	Tue Apr 27 16:38:40 2010 +0300
+++ b/htiui/sis/HTI_stub.pkg	Tue May 11 16:14:15 2010 +0300
@@ -18,7 +18,7 @@
 &EN
 
 ; Using UID of HtiFramework project
-#{"HTI"},(0x1020DEB6),2,17,0
+#{"HTI"},(0x1020DEB6),2,21,0
 
 ; Localised Vendor name
 %{"Nokia"}
--- a/launcher/inc/launcherappui.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/inc/launcherappui.h	Tue May 11 16:14:15 2010 +0300
@@ -24,14 +24,14 @@
 #include <eikdoc.h>
 #include <e32std.h>
 #include <coeccntx.h>
-#include <aknviewappui.h>
+#include <aknViewAppUi.h>
 #include <akntabgrp.h>
 #include <aknnavide.h>
 #include "../symbian_version.hrh"
 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
-#include <SendUi.h>
+#include <sendui.h>
 #endif 
-#include "LauncherEngine.h"
+#include "launcherengine.h"
 
 // FORWARD DECLARATIONS
 class CLauncherContainerApps;
--- a/launcher/inc/launcherdocument.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/inc/launcherdocument.h	Tue May 11 16:14:15 2010 +0300
@@ -21,7 +21,7 @@
 #define __LAUNCHER_DOCUMENT_H__
 
 
-#include <akndoc.h>
+#include <AknDoc.h>
 
 // Forward references
 class CLauncherAppUi;
--- a/launcher/inc/launcherengine.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/inc/launcherengine.h	Tue May 11 16:14:15 2010 +0300
@@ -18,7 +18,7 @@
 #ifndef __LAUNCHER_ENGINE_H__
 #define __LAUNCHER_ENGINE_H__
 
-#include "Launcher.hrh"
+#include "launcher.hrh"
 #include "launcherparserobserver.h"
 
 #include <aknappui.h>
@@ -26,10 +26,10 @@
 #include <apgcli.h>
 #include "../symbian_version.hrh"
 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
-#include <SendUi.h>
+#include <sendui.h>
 #endif 
-#include <aknprogressdialog.h>
-#include <maknfileselectionobserver.h>
+#include <AknProgressDialog.h>
+#include <MAknFileSelectionObserver.h>
 
 class CLauncherAppUi;
 class CLauncherContainerApps;
--- a/launcher/inc/launcherviewapps.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/inc/launcherviewapps.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 // INCLUDES
 #include <aknview.h>
 
-#include "LauncherEngine.h"
+#include "launcherengine.h"
 
 // CONSTANTS
 // UID of view
--- a/launcher/inc/launcherviewoutput.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/inc/launcherviewoutput.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 // INCLUDES
 #include <aknview.h>
 
-#include "LauncherEngine.h"
+#include "launcherengine.h"
 
 // CONSTANTS
 // UID of view
--- a/launcher/src/launcher.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launcher.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,7 +17,7 @@
 
 
 
-#include "LauncherApplication.h"
+#include "launcherapplication.h"
 #include <eikstart.h>
     
 
--- a/launcher/src/launcherapplication.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launcherapplication.cpp	Tue May 11 16:14:15 2010 +0300
@@ -16,8 +16,8 @@
 */
 
 
-#include "LauncherDocument.h"
-#include "LauncherApplication.h"
+#include "launcherdocument.h"
+#include "launcherapplication.h"
 
 // local constants
 static const TUid KUidLauncherApp = {0x101FB74F}; 
--- a/launcher/src/launcherappui.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launcherappui.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,10 +17,10 @@
 
 
 // INCLUDE FILES
-#include "LauncherAppUi.h"
-#include "LauncherViewApps.h"
-#include "LauncherViewOutput.h"
-#include <Launcher.rsg>
+#include "launcherappui.h"
+#include "launcherviewapps.h"
+#include "launcherviewoutput.h"
+#include <launcher.rsg>
 #include "launcher.hrh"
 
 #include <avkon.hrh>
--- a/launcher/src/launchercontainerapps.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launchercontainerapps.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,20 +17,20 @@
 
 
 // INCLUDE FILES
-#include "LauncherContainerApps.h"
-#include "LauncherEngine.h"
+#include "launchercontainerapps.h"
+#include "launcherengine.h"
 
 
 #include <eikclb.h>
 #include <eikclbd.h>
 #include <aknconsts.h>
-#include <aknutils.h>
+#include <AknUtils.h>
 #include <aknnotewrappers.h>
-#include <akniconarray.h> 
+#include <AknIconArray.h> 
 #include <f32file.h>
 #include <avkon.mbg>
 #include <AknIconUtils.h>
-#include <akndef.h>
+#include <AknDef.h>
 
 
 _LIT(KTab,"\t");
--- a/launcher/src/launchercontaineroutput.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launchercontaineroutput.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,15 +17,15 @@
 
 
 // INCLUDE FILES
-#include "LauncherContainerOutput.h"
-#include "LauncherEngine.h"
+#include "launchercontaineroutput.h"
+#include "launcherengine.h"
 
 
 #include <AknBidiTextUtils.h>
-#include <aknutils.h>
+#include <AknUtils.h>
 #include <aknnotewrappers.h>
 #include <eiksbfrm.h>
-#include <akndef.h>
+#include <AknDef.h>
 
 const TUint KLeftMargin = 2;
 const TUint KRightMargin = 2;
--- a/launcher/src/launcherdocument.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launcherdocument.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,8 +17,8 @@
 
 
 
-#include "LauncherAppUi.h"
-#include "LauncherDocument.h"
+#include "launcherappui.h"
+#include "launcherdocument.h"
 
 
 // Standard Symbian OS construction sequence
--- a/launcher/src/launcherengine.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launcherengine.cpp	Tue May 11 16:14:15 2010 +0300
@@ -19,21 +19,21 @@
 
 #include <aknnotewrappers.h>
 #include <avkon.hrh>
-#include <aknwaitdialog.h>
-#include <aknglobalnote.h>
+#include <AknWaitDialog.h>
+#include <AknGlobalNote.h>
 #include <coeutils.h> 
-#include <akncommondialogs.h>
+#include <AknCommonDialogs.h>
 #include <eikprogi.h>
 
-#include <LAUNCHER.rsg>
+#include <launcher.rsg>
 
-#include "LauncherAppUi.h"
-#include "LauncherEngine.h"
-#include "Launcher.hrh"
-#include "LauncherViewApps.h"
-#include "LauncherViewOutput.h"
-#include "LauncherContainerApps.h"
-#include "LauncherContainerOutput.h"
+#include "launcherappui.h"
+#include "launcherengine.h"
+#include "launcher.hrh"
+#include "launcherviewapps.h"
+#include "launcherviewoutput.h"
+#include "launchercontainerapps.h"
+#include "launchercontaineroutput.h"
 #include "launcherdllparser.h"
 #include "launcherxmlparser.h"
 
@@ -46,8 +46,8 @@
 #include <pathinfo.h> 
 #include <e32cmn.h>
 
-#include "LauncherTraces.h"
-#include "E32Image.h"
+#include "launchertraces.h"
+#include "e32image.h"
 
 _LIT(KLogFileName, "LauncherLog.txt");
 _LIT(KBCLogFileName, "LauncherBCLog.txt");
--- a/launcher/src/launcherviewapps.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launcherviewapps.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,14 +17,14 @@
 
 
 // INCLUDE FILES
-#include <aknviewappui.h>
+#include <aknViewAppUi.h>
 #include <avkon.hrh>
-#include <Launcher.rsg>
+#include <launcher.rsg>
 #include <AknUtils.h>
 #include <eikmenup.h>
 
-#include "LauncherViewApps.h"
-#include "LauncherContainerApps.h" 
+#include "launcherviewapps.h"
+#include "launchercontainerapps.h" 
 
 // ================= MEMBER FUNCTIONS =======================
 
--- a/launcher/src/launcherviewoutput.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/launcher/src/launcherviewoutput.cpp	Tue May 11 16:14:15 2010 +0300
@@ -17,11 +17,11 @@
 
 
 // INCLUDE FILES
-#include  <aknviewappui.h>
+#include  <aknViewAppUi.h>
 #include  <avkon.hrh>
 #include  <Launcher.rsg>
-#include  "LauncherViewOutput.h"
-#include  "LauncherContainerOutput.h" 
+#include  "launcherviewoutput.h"
+#include  "launchercontaineroutput.h" 
 
 // ================= MEMBER FUNCTIONS =======================
 
--- a/loadgen/inc/loadgen_appui.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/inc/loadgen_appui.h	Tue May 11 16:14:15 2010 +0300
@@ -24,7 +24,7 @@
 #include <eikdoc.h>
 #include <e32std.h>
 #include <coeccntx.h>
-#include <aknviewappui.h>
+#include <aknViewAppUi.h>
 #include <akntabgrp.h>
 #include <aknnavide.h>
 #include "loadgen_std.h"
--- a/loadgen/inc/loadgen_document.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/inc/loadgen_document.h	Tue May 11 16:14:15 2010 +0300
@@ -20,7 +20,7 @@
 #define LOADGEN_DOCUMENT_H
 
 // INCLUDES
-#include <akndoc.h>
+#include <AknDoc.h>
    
 // CONSTANTS
 
--- a/loadgen/inc/loadgen_editors.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/inc/loadgen_editors.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include <aknform.h> 
+#include <AknForm.h> 
 
 #include "loadgen_loadattributes.h"
 
--- a/loadgen/inc/loadgen_netconn.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/inc/loadgen_netconn.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include <downloadmgrclient.h> 
+#include <DownloadMgrClient.h> 
 
 #include "loadgen_loadbase.h"
 #include "loadgen_loadattributes.h"
--- a/loadgen/inc/loadgen_photocapture.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/inc/loadgen_photocapture.h	Tue May 11 16:14:15 2010 +0300
@@ -22,7 +22,7 @@
 // INCLUDES
 #include <e32std.h>
 #include <e32base.h>
-#include <ECam.h>  // CCamera, MCameraObserver
+#include <ecam.h>  // CCamera, MCameraObserver
 
 #include "loadgen_loadbase.h"
 #include "loadgen_loadattributes.h"
--- a/loadgen/inc/loadgen_settingsviewdlg.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/inc/loadgen_settingsviewdlg.h	Tue May 11 16:14:15 2010 +0300
@@ -20,9 +20,9 @@
 #define LOADGEN_SETTINGSVIEWDLG_H
 
 //  INCLUDES
-#include <akndialog.h>
+#include <AknDialog.h>
 #include <eiklbo.h>
-#include <akntabobserver.h> 
+#include <AknTabObserver.h> 
 #include <akntabgrp.h>
 
 //  FORWARD DECLARATIONS
--- a/loadgen/src/loadgen_applications.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_applications.cpp	Tue May 11 16:14:15 2010 +0300
@@ -298,7 +298,7 @@
 #include <apgtask.h>
 #include <bautils.h>
 #include <s32file.h>
-#include <APGWGNAM.H> 
+#include <apgwgnam.h> 
 
 // ---------------------------------------------------------------------------
 
--- a/loadgen/src/loadgen_appui.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_appui.cpp	Tue May 11 16:14:15 2010 +0300
@@ -25,7 +25,7 @@
 #include <loadgen.rsg>
 
 #include <avkon.hrh>
-#include <aknquerydialog.h>
+#include <AknQueryDialog.h>
 #include <aknmessagequerydialog.h> 
 
 
--- a/loadgen/src/loadgen_bluetooth.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_bluetooth.cpp	Tue May 11 16:14:15 2010 +0300
@@ -25,9 +25,9 @@
 #include <e32hal.h>
 #include <u32hal.h>
 #include <e32math.h>
-#include <EIKENV.H>
+#include <eikenv.h>
 #include <btserversdkcrkeys.h>
-#include <BtnotifierAPI.h>
+#include <btnotifierapi.h>
 #include <btpm.h>
 
 _LIT(KThreadName, "Bluetooth %d");
--- a/loadgen/src/loadgen_editors.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_editors.cpp	Tue May 11 16:14:15 2010 +0300
@@ -22,11 +22,11 @@
 #include "loadgen.hrh"
 #include <loadgen.rsg>
 
-#include <aknform.h> 
+#include <AknForm.h> 
 #include <eikedwin.h> 
 #include <eikmfne.h>
-#include <aknpopupfieldtext.h>
-#include <aknqueryvaluetext.h>
+#include <AknPopupFieldText.h>
+#include <AknQueryValueText.h>
 #include <eikspane.h> 
 #include <akntitle.h> 
 #include <eikcapc.h>
--- a/loadgen/src/loadgen_maincontainer.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_maincontainer.cpp	Tue May 11 16:14:15 2010 +0300
@@ -28,12 +28,12 @@
 #include <eikclb.h>
 #include <eikclbd.h>
 #include <aknconsts.h>
-#include <aknutils.h>
+#include <AknUtils.h>
 #include <aknnotewrappers.h>
-#include <akniconarray.h> 
+#include <AknIconArray.h> 
 #include <f32file.h>
 #include <AknIconUtils.h>
-#include <akndef.h>
+#include <AknDef.h>
 #include <akntitle.h>
 #include <eikspane.h> 
 
--- a/loadgen/src/loadgen_mainview.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_mainview.cpp	Tue May 11 16:14:15 2010 +0300
@@ -26,7 +26,7 @@
 #include <loadgen.rsg>
 
 #include <eikenv.h>
-#include <aknviewappui.h> 
+#include <aknViewAppUi.h> 
 #include <aknnotewrappers.h>
 
 
--- a/loadgen/src/loadgen_messages.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_messages.cpp	Tue May 11 16:14:15 2010 +0300
@@ -377,7 +377,7 @@
 #include <smscmds.h>
 #include <mtmuibas.h>
 #include <mtmdef.h>
-#include <stringloader.h>
+#include <StringLoader.h>
 #include "smutset.h"
 #include "smuthdr.h"
  
@@ -738,8 +738,8 @@
 #include <f32file.h>                
 #include <coeutils.h>                  // Check the file exist
 
-#include <CMsvMimeHeaders.h>        //Attachemt mimeheader
-#include <MMsvAttachmentManager.h>    //Attachment manager
+#include <cmsvmimeheaders.h>        //Attachemt mimeheader
+#include <mmsvattachmentmanager.h>    //Attachment manager
 
 // -----------------------------------------------------------------------------
 // CMmsHandler::CSmsHandler()
--- a/loadgen/src/loadgen_model.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_model.cpp	Tue May 11 16:14:15 2010 +0300
@@ -41,13 +41,13 @@
 #include <coeutils.h>
 #include <bautils.h>
 #include <eikenv.h>
-#include <aknquerydialog.h>
+#include <AknQueryDialog.h>
 #include <e32math.h> 
 #include <u32hal.h>
 #include <hal.h> 
 #include <hal_data.h>
 
-#include <ECam.h>
+#include <ecam.h>
 #include <aknnotewrappers.h>
 #include <featdiscovery.h>
 
--- a/loadgen/src/loadgen_photocapture.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_photocapture.cpp	Tue May 11 16:14:15 2010 +0300
@@ -25,7 +25,7 @@
 #include <e32hal.h>
 #include <u32hal.h>
 #include <e32math.h>
-#include <EIKENV.H>
+#include <eikenv.h>
 
 _LIT(KThreadName, "PhotoCapture %d");
 
--- a/loadgen/src/loadgen_settingsviewdlg.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/loadgen/src/loadgen_settingsviewdlg.cpp	Tue May 11 16:14:15 2010 +0300
@@ -24,12 +24,12 @@
 #include <loadgen.rsg>
 
 #include <aknsettingitemlist.h>
-#include <caknmemoryselectionsettingitem.h> 
+#include <CAknMemorySelectionSettingItem.h> 
 #include <aknlists.h>
 #include <akntitle.h>
 #include <aknnavi.h>
 #include <aknnavide.h>
-#include <stringloader.h>
+#include <StringLoader.h>
 #include <aknnotewrappers.h> 
 
 // ===================================== MEMBER FUNCTIONS =====================================
--- a/stifui/avkon/group/ReleaseNote.txt	Tue Apr 27 16:38:40 2010 +0300
+++ b/stifui/avkon/group/ReleaseNote.txt	Tue May 11 16:14:15 2010 +0300
@@ -1,5 +1,5 @@
 ========================================================================
-RELEASE NOTE FOR STIF UI - STIF_201014 (7.3.30)
+RELEASE NOTE FOR STIF UI - STIF_201016 (7.3.31)
 SUPPORTING SERIES 60 3.0 ->
 ========================================================================
 
Binary file stifui/avkon/sis/Stifui_31.sis has changed
--- a/stifui/avkon/stifui/inc/Container.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/stifui/avkon/stifui/inc/Container.h	Tue May 11 16:14:15 2010 +0300
@@ -94,8 +94,7 @@
         *         descriptor element located at position aIndex within 
         *         the array.
         */
-        virtual TPtrC MdcaPoint(TInt aIndex) const;
-
+        virtual TPtrC MdcaPoint( TInt aIndex ) const;
     protected:
         /**
         * Symbian OS two phased constructor.
@@ -156,6 +155,19 @@
         virtual void SelectedTestCases(RPointerArray<CTestInfo>& aSelectedTestCases);
 
         /**
+        * Returns pointers to currently (in list box) selected test cases info.
+        * @return Currently selected test case info.
+        */
+        virtual CTestInfo* SelectedTestCaseInfo();
+        
+        /**
+        * Returns pointers to selected test cases info.
+        * @param aIndex test case index
+        * @return Currently selected test case info.
+        */
+        virtual CTestInfo* TestCaseInfo( TInt aIndex );
+        
+        /**
         * Sets graphic icon using listbox as CEikColumnListBox.
         * @param aListBox Pointer to list box.
         */
--- a/stifui/avkon/stifui/inc/version.h	Tue Apr 27 16:38:40 2010 +0300
+++ b/stifui/avkon/stifui/inc/version.h	Tue May 11 16:14:15 2010 +0300
@@ -20,9 +20,9 @@
 
 #define STIFUI_MAJOR_VERSION 7
 #define STIFUI_MINOR_VERSION 3
-#define STIFUI_BUILD_VERSION 30
+#define STIFUI_BUILD_VERSION 31
 
-#define STIFUI_REL_DATE "06th Apr 2010"
+#define STIFUI_REL_DATE "20th Apr 2010"
 
 #define TO_UNICODE(text) _L(text) 
 
--- a/stifui/avkon/stifui/src/Container.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/stifui/avkon/stifui/src/Container.cpp	Tue May 11 16:14:15 2010 +0300
@@ -262,9 +262,43 @@
 void CContainer::SelectedTestCases
                             (RPointerArray<CTestInfo>& aSelectedTestCases)
     {
-    aSelectedTestCases.Append( iTestCasesInView[iListBox->CurrentItemIndex()] );
+    TInt selectedItemIdx = iListBox->CurrentItemIndex();
+    if ( ( selectedItemIdx >= 0 ) && ( iTestCasesInView.Count() > selectedItemIdx ) )
+        {
+        aSelectedTestCases.Append( iTestCasesInView[ selectedItemIdx ] );    
+        }
     }
 
+// ----------------------------------------------------------------------------
+// CContainer::SelectedTestCaseInfo
+// 
+// Returns pointers to currently selected (in list box) test cases info.
+// ----------------------------------------------------------------------------
+//
+CTestInfo* CContainer::SelectedTestCaseInfo()
+    {
+    TInt selectedItemIdx = iListBox->CurrentItemIndex();
+    if ( ( selectedItemIdx >= 0 ) && ( iTestCasesInView.Count() > selectedItemIdx ) )
+        {
+        return iTestCasesInView[ selectedItemIdx ];
+        }
+    return NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CContainer::TestCaseInfo
+// 
+// Returns pointers to selected test cases info.
+// ----------------------------------------------------------------------------
+//
+CTestInfo* CContainer::TestCaseInfo( TInt aIndex )
+    {
+    if ( ( aIndex >=0 ) && ( iTestCasesInView.Count() > aIndex ) )
+        {
+        return iTestCasesInView[ aIndex ];
+        }
+    return NULL;
+    }
     
 // ----------------------------------------------------------------------------
 // CContainer::HandleMarkCommandL
--- a/stifui/avkon/stifui/src/StartCasesView.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/stifui/avkon/stifui/src/StartCasesView.cpp	Tue May 11 16:14:15 2010 +0300
@@ -251,7 +251,7 @@
         for (i = 0; i < moduleCount; i++)
             {
             //item.iText = modules[i].iModuleName;
-            item.iText = modules[i];
+            item.iText.Copy( modules[i].Left( item.iText.MaxLength() ) ) ;
             aMenuPane->AddMenuItemL(item);
             item.iCommandId++; // command IDs 0x1000 - 0x1FFF are reserved for modules in hrh file
             }
@@ -284,7 +284,7 @@
 
         for (i = 0; i < testCaseFileCount; i++)
             {
-            item.iText = testCaseFiles[i];
+            item.iText.Copy( testCaseFiles[i].Left( item.iText.MaxLength() ) );
             // If thereīs no test case file, donīt add item to menu.
             if ( testCaseFiles[i].Length() > 0 )
                 {
@@ -372,26 +372,18 @@
     CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
     if ( startDialog->ExecuteLD(R_START_TESTCASE_LIST_QUERY) )
         {
-        RRefArray<CTestInfo> testInfo;
-        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCases( testInfo );
-        if( KErrNone != ret )
-            {
-            testInfo.Reset();
-            testInfo.Close();
-            User::Leave( ret );
-            }
-        TInt testCaseNumber = iCurrentTestCase;   
-       
+        CTestInfo* testCaseInfo = iContainer->SelectedTestCaseInfo();
+
+        User::LeaveIfNull( testCaseInfo );
+        
         TInt testCaseIndex( 0 );
 
-        ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestCase( testInfo[testCaseNumber], testCaseIndex );
+        TInt ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->StartTestCase( *testCaseInfo, testCaseIndex );
       
         if( KErrNone != ret )
             {
             User::Leave( ret );
             }
-        testInfo.Reset();
-        testInfo.Close();
 
         // Increment the counter value
         ((CAppUIAppUi*)AppUi())->iUIStoreHandler->iExecutedTestCaseCount++;
@@ -426,23 +418,16 @@
     CAknListQueryDialog* startDialog = new (ELeave) CAknListQueryDialog(&selectedItem);
     if ( startDialog->ExecuteLD(R_START_MULTIPLE_TESTCASES_LIST_QUERY) )
     	{
-    	RRefArray<CTestInfo> testInfo;
-    	CleanupClosePushL( testInfo );
-
     	ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->CreateTestSet( KTempSet );
     	
-        ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->TestCases( testInfo );
-        if( KErrNone != ret )
-            {
-            testInfo.Reset();
-            testInfo.Close();
-            User::Leave( ret );
-            }
+        User::LeaveIfError( ret );
         
         for( i = 0; i < aSelectedIndexes.Count(); i++ )
         	{
-    		ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->AddToTestSet( KTempSet,
-    		 testInfo[ aSelectedIndexes[i] ] );
+            CTestInfo* testCaseInfo = iContainer->TestCaseInfo( aSelectedIndexes[i] );
+            User::LeaveIfNull( testCaseInfo );
+        
+    		ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->AddToTestSet( KTempSet, *testCaseInfo );
     		if( KErrNone != ret )
     			{
     			User::Leave( ret );
@@ -466,8 +451,6 @@
 	    	}
 
         ret = ((CAppUIAppUi*)AppUi())->UIStoreHandler()->RemoveTestSet( KTempSet );
-
-  		CleanupStack::PopAndDestroy();
     	}
     }
 
--- a/stifui/avkon/uitestserverstarter/src/AknUiEnvProxy.cpp	Tue Apr 27 16:38:40 2010 +0300
+++ b/stifui/avkon/uitestserverstarter/src/AknUiEnvProxy.cpp	Tue May 11 16:14:15 2010 +0300
@@ -212,6 +212,8 @@
 	TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
 	User::LeaveIfError( ret );
 	
+	wsSession.Flush();
+	
 	// Request notification when key press is handled
 	*aStatus = KRequestPending;
 	iAppUi->NotifyAboutHandledKeyPress( aStatus );
@@ -257,6 +259,7 @@
 	TInt wgId = wsSession.GetFocusWindowGroup();	
 	TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );	
 	User::LeaveIfError( ret );
+	wsSession.Flush();
 	}
 
 
@@ -309,6 +312,7 @@
 		// Send single character from text to UI component
 		TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );
 		User::LeaveIfError( ret );
+		wsSession.Flush();
 		}
 		
 	// Request notification when send text is recived
@@ -359,6 +363,7 @@
 		// Send single character from text to UI component
 		TInt ret = wsSession.SendEventToWindowGroup( wgId, wsEvent );			
 		User::LeaveIfError( ret );
+		wsSession.Flush();
 		}
 	}
 
@@ -422,7 +427,9 @@
 				User::Leave( KErrArgument );
 			}
 		wsSession.SimulateRawEvent( pointerEventDown );
+		wsSession.Flush();
 		wsSession.SimulateRawEvent( pointerEventUp );
+		wsSession.Flush();
 		}
 	else
 		{
@@ -497,11 +504,13 @@
 			}
 		
 			CCoeEnv::Static()->RootWin().SimulatePointerEvent( pointerEventDown );
+			wsSession.Flush();
 			
 			// Send info to AppUi that we are going to send key event
 			iAppUi->PrepareToPointerEvent();
 	
 			CCoeEnv::Static()->RootWin().SimulatePointerEvent( pointerEventUp );
+			wsSession.Flush();
 	
 			// Request notification when key press is handled
 			*aStatus = KRequestPending;
--- a/stifui/qt/ReleaseNote.txt	Tue Apr 27 16:38:40 2010 +0300
+++ b/stifui/qt/ReleaseNote.txt	Tue May 11 16:14:15 2010 +0300
@@ -1,5 +1,5 @@
 ========================================================================
-RELEASE NOTE FOR STIFQTUI - STIF_201014 (7.3.30)
+RELEASE NOTE FOR STIFQTUI - STIF_201016 (7.3.31)
 ========================================================================
 
 Product Description: