# HG changeset patch # User hgs # Date 1278994901 -19800 # Node ID 2e64dc50f295162bbc7fc4dd250113289d9e364c # Parent a36219ae6585a3cab20fed5ee55ea3e5f116a034 201025_02 diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/data/dcmo.rss --- a/dcmofw/dcmoserver/data/dcmo.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +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 file for DCMO component. -* -*/ - - -// INCLUDES -#include -#include -#include -#include -#include - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf=""; } - - -// CONSTANTS - -// MACROS - -// RESOURCE DEFINITIONS - - -// r_dm_run_time_var_disable -// Text for showing Disabled -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_disable { buf = qtn_dm_run_time_var_disable; } - -// r_dm_run_time_var_enable -// Text for showing Enabled -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_enable { buf = qtn_dm_run_time_var_enable; } - -// r_dm_run_time_var_camera -// Text for showing Camera -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_camera { buf = qtn_dm_run_time_var_camera; } - -// r_dm_run_time_var_firmware_update -// Text for showing Firmware Update -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_firmware_update { buf = qtn_dm_run_time_var_firmware_update; } - -// r_dm_run_time_var_external_memory_card -// Text for showing External Memort Card -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_ext_memory { buf = qtn_dm_run_time_var_ext_memory; } - -// r_dm_run_time_var_bluetooth -// Text for showing Bluetooth -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_bluetooth { buf = qtn_dm_run_time_var_bluetooth; } - -// r_dm_run_time_var_wlan -// Text for showing WLAN -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_wlan { buf = qtn_dm_run_time_var_wlan; } - -// r_dm_run_time_var_desktop_sync -// Text for showing Desktop Sync -// Info note for showing the information received. -// -// ----------------------------------------------------------------------------- -// -RESOURCE TBUF r_dm_run_time_var_desktop_sync { buf = qtn_dm_run_time_var_desktop_sync; } - - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/group/bld.inf --- a/dcmofw/dcmoserver/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/dcmofw/dcmoserver/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -20,8 +20,6 @@ PRJ_EXPORTS -../loc/dcmo.loc MW_LAYER_LOC_EXPORT_PATH(dcmo.loc) - // Generic configuration interface for component cenrep settings ../conf/dcmo.confml MW_LAYER_CONFML(dcmo.confml) ../conf/dcmo_2001FE47.crml MW_LAYER_CRML(dcmo_2001FE47.crml) diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/group/dcmoserver.mmp --- a/dcmofw/dcmoserver/group/dcmoserver.mmp Tue Jul 13 09:37:43 2010 +0530 +++ b/dcmofw/dcmoserver/group/dcmoserver.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -29,22 +29,18 @@ SOURCEPATH ../src SOURCE dcmoserver.cpp SOURCE dcmosession.cpp -SOURCE dcmonotifieraob.cpp +SOURCE dcmomessagebox.cpp SOURCE dcmogenericcontrol.cpp MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore USERINCLUDE ../inc USERINCLUDE ../../inc -START RESOURCE ../data/dcmo.rss - HEADER - TARGETPATH resource - LANGUAGE_IDS -END - -LIBRARY euser.lib commonengine.lib efsrv.lib +LIBRARY euser.lib LIBRARY ecom.lib LIBRARY centralrepository.lib -LIBRARY aknnotify.lib eiksrv.lib LIBRARY flogger.lib +LIBRARY hbcore.lib hbwidgets.lib diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/inc/dcmomessagebox.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dcmofw/dcmoserver/inc/dcmomessagebox.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,75 @@ +/* +* 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: DCMO Message Box +* +*/ + +#ifndef __DCMO_MESSAGEBOX_H__ +#define __DCMO_MESSAGEBOX_H__ + +// INCLUDES + +#include + +/** +* Message Box class to show the global note. +* +*/ +class CDCMOMessageBox : public CBase, public MHbDeviceMessageBoxObserver + { +public: + static CDCMOMessageBox* NewL( ); + + /** + * Destructor + */ + ~CDCMOMessageBox(); + + /** + * Show the Notification + * @param aString , to be shown + * @return + */ + void ShowMessageL( TDesC& aString ); + +public: // from MHbDeviceMessageBoxObserver + void MessageBoxClosed(const CHbDeviceMessageBoxSymbian *aMessageBox, + CHbDeviceMessageBoxSymbian::TButtonId aButton); + + /** + * Gets the Message Box status + * @param None + * @return ETrue if the user pressed ok button, else EFalse. + */ + static TBool IsMsgBoxClosed(); + + /** + * Sets the Message Box status + * @param ETrue if the user pressed ok button, else EFalse. + * @return None + */ + static void SetMsgBoxStatus(TBool aStatus); + +private: + /** + * Createss CDCMOMessageBox + * Default Constructor + */ + CDCMOMessageBox( ); + +private: + CHbDeviceMessageBoxSymbian* iMessageBox; + static TBool iMsgBoxClosed; + }; +#endif //__DCMO_MESSAGEBOX_H__ diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/inc/dcmonotifieraob.h --- a/dcmofw/dcmoserver/inc/dcmonotifieraob.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +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: DCMO Notifier Aob -* -*/ - -#ifndef __DCMO_NOTIFIERAOB_H__ -#define __DCMO_NOTIFIERAOB_H__ - -// INCLUDES - -#include - -/** -* An active class to show the global note. -* -*/ -class CDCMONotifierAob : public CActive - { -public: - static CDCMONotifierAob* NewL( ); - - /** - * Destructor - */ - ~CDCMONotifierAob(); - - /** - * Show the Notification - * @param aString , to be shown - * @return - */ - void ShowNotifierL( TDesC& aString ); - - /** - * From CActive,DoCancel. - */ - void DoCancel(); - - /** - * From CActive,RunL. - */ - void RunL(); - - /** - * From CActive,RunError. - */ - TInt RunError(TInt aError); - -private: - /** - * Createss CDCMOGenericControl - * Default Constructor - */ - CDCMONotifierAob( ); - - /** - * second phase constructor - */ - void ConstructL(); - -private: - CAknGlobalMsgQuery* iGlobalMsgQuery; - - }; -#endif //__DCMO_NOTIFIERAOB_H__ diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/inc/dcmoserver.h --- a/dcmofw/dcmoserver/inc/dcmoserver.h Tue Jul 13 09:37:43 2010 +0530 +++ b/dcmofw/dcmoserver/inc/dcmoserver.h Tue Jul 13 09:51:41 2010 +0530 @@ -21,9 +21,11 @@ // INCLUDES #include +#include #include "dcmoclientserver.h" #include "dcmoconst.h" -#include "dcmonotifieraob.h" +#include "dcmomessagebox.h" + // CONSTANTS const TUid KCRUidDCMOServer={0x2001FE47}; @@ -40,7 +42,7 @@ class CDCMOServer : public CServer2 { friend class CDCMOSession; - friend class CDCMONotifierAob; + friend class CDCMOMessageBox; public: /** @@ -166,7 +168,14 @@ * @return */ void SetStarter(TBool aValue); - + + /** + * Deletes the idcmoArray value if any + * @param none + * @return none + */ + void CleanDcmoArray(); + private: /** @@ -187,7 +196,7 @@ RArray idcmoArray; static TInt iSessionCount; TBool iStarter; - CDCMONotifierAob* iNotifier; + CDCMOMessageBox* iMessageBox; }; #endif //__DCMO_SERVER_H__ diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/loc/dcmo.loc --- a/dcmofw/dcmoserver/loc/dcmo.loc Tue Jul 13 09:37:43 2010 +0530 +++ /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: Localisation file for DCMO framework. -* -*/ - - - -// LOCALISATION STRINGS - -//d:Text to be shown for Disabled -//l:heading_pane_t1 -//r:5.2 -// -#define qtn_dm_run_time_var_disable "Disabled by system administrator:" - -//d:Text to be shown for Enabled -//l:heading_pane_t1 -//r:5.2 -// -#define qtn_dm_run_time_var_enable "Enabled by system administrator:" - -//d:Text to be shown for Camera -//l:list_single_pane_t1_cp2 -//r:5.2 -// -#define qtn_dm_run_time_var_camera "Camera" - -//d:Text to be shown for Firmware Update -//l:list_single_pane_t1_cp2 -//r:5.2 -// -#define qtn_dm_run_time_var_firmware_update "Firmware Update" - -//d:Text to be shown for External Memory Card -//l:list_single_pane_t1_cp2 -//r:5.2 -// -#define qtn_dm_run_time_var_ext_memory "External Memory Card" - -//d:Text to be shown for Bluetooth -//l:list_single_pane_t1_cp2 -//r:5.2 -// -#define qtn_dm_run_time_var_bluetooth "Bluetooth" - -//d:Text to be shown for WLAN -//l:list_single_pane_t1_cp2 -//r:5.2 -// -#define qtn_dm_run_time_var_wlan "WLAN" - -//d:Text to be shown for Desktop Sync -//l:list_single_pane_t1_cp2 -//r:5.2 -// -#define qtn_dm_run_time_var_desktop_sync "Desktop Sync" - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/src/dcmomessagebox.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dcmofw/dcmoserver/src/dcmomessagebox.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,107 @@ +/* +* 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: DCMO Message Box +* +*/ + + +#include "dcmomessagebox.h" +#include "dcmoserver.h" +#include "dcmodebug.h" + +TBool CDCMOMessageBox::iMsgBoxClosed = EFalse; + +// -------------------------------------------------------------------------- +// CDCMOMessageBox* CDCMOMessageBox::NewL( ) +// -------------------------------------------------------------------------- +// +CDCMOMessageBox* CDCMOMessageBox::NewL( ) + { + RDEBUG("CDCMOMessageBox::NewL begin"); + CDCMOMessageBox* self = new (ELeave) CDCMOMessageBox( ); + RDEBUG("CDCMOMessageBox::NewL end"); + return self; + } + +// -------------------------------------------------------------------------- +// CDCMOMessageBox::CDCMOMessageBox( ) +// -------------------------------------------------------------------------- +// +CDCMOMessageBox::CDCMOMessageBox( ) + { + iMessageBox = NULL; + RDEBUG("CDCMOMessageBox::constructor"); + } + +// -------------------------------------------------------------------------- +// CDCMOMessageBox::~CDCMOMessageBox() +// -------------------------------------------------------------------------- +// +CDCMOMessageBox::~CDCMOMessageBox() + { + RDEBUG("CDCMOMessageBox::~CDCMOMessageBox begin"); + if( iMessageBox ) + { + delete iMessageBox ; + iMessageBox = NULL; + } + RDEBUG("CDCMOMessageBox::~CDCMOMessageBox end"); + } + +// -------------------------------------------------------------------------- +// TBool CDCMOMessageBox::IsMsgBoxClosed( ) +// -------------------------------------------------------------------------- +// +TBool CDCMOMessageBox::IsMsgBoxClosed() + { + return iMsgBoxClosed; + } + +// -------------------------------------------------------------------------- +// void CDCMOMessageBox::SetMsgBoxStatus( TBool aStatus ) +// -------------------------------------------------------------------------- +// +void CDCMOMessageBox::SetMsgBoxStatus(TBool aStatus) +{ + iMsgBoxClosed = aStatus; +} + +// -------------------------------------------------------------------------- +// void CDCMOMessageBox::ShowNotifierL( TDesC& aString ) +// -------------------------------------------------------------------------- +// +void CDCMOMessageBox::ShowMessageL( TDesC& aString ) +{ + RDEBUG("CDCMOMessageBox::ShowMessageL() : Begin"); + if( !iMessageBox ) + iMessageBox = CHbDeviceMessageBoxSymbian::NewL(); + iMessageBox->SetTimeout(0); //HbPopup::NoTimeout); + iMessageBox->SetDismissPolicy(0); //HbPopup::NoDismiss + iMessageBox->SetTextL(aString); + iMessageBox->SetObserver(this); + iMessageBox->ShowL(); + RDEBUG("CDCMOMessageBox::ShowMessageL() : End"); +} + +void CDCMOMessageBox::MessageBoxClosed(const CHbDeviceMessageBoxSymbian */*aMessageBox*/, + CHbDeviceMessageBoxSymbian::TButtonId /*aButton*/) + { + delete iMessageBox; + iMessageBox = NULL; + iMsgBoxClosed = ETrue; + if( CDCMOServer::iSessionCount == 0) + CActiveScheduler::Stop(); + } + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/src/dcmonotifieraob.cpp --- a/dcmofw/dcmoserver/src/dcmonotifieraob.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +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: DCMO Notifier Aob -* -*/ - - -#include "dcmonotifieraob.h" -#include "dcmoserver.h" -#include "dcmodebug.h" - - -// -------------------------------------------------------------------------- -// CDCMONotifierAob* CDCMONotifierAob::NewL( CAknGlobalMsgQuery& aGlobalMsgQuery ) -// -------------------------------------------------------------------------- -// -CDCMONotifierAob* CDCMONotifierAob::NewL( ) - { - RDEBUG("CDCMONotifierAob::NewL begin"); - CDCMONotifierAob* self = new (ELeave) CDCMONotifierAob( ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(); // self - RDEBUG("CDCMONotifierAob::NewL end"); - return self; - } - -// -------------------------------------------------------------------------- -// CDCMONotifierAob::CDCMONotifierAob( CAknGlobalMsgQuery& aGlobalMsgQuery ) -// -------------------------------------------------------------------------- -// -CDCMONotifierAob::CDCMONotifierAob( ) - :CActive( EPriorityStandard ) //EPriorityNormal ) - { - RDEBUG("CDCMONotifierAob::constructor"); - } - - -// -------------------------------------------------------------------------- -// void CDCMONotifierAob::ConstructL() -// -------------------------------------------------------------------------- -// -void CDCMONotifierAob::ConstructL() - { - RDEBUG("CDCMONotifierAob::ConstructL begin"); - iGlobalMsgQuery = NULL; - CActiveScheduler::Add(this); - RDEBUG("CDCMONotifierAob::ConstructL end"); - } - -// -------------------------------------------------------------------------- -// CDCMONotifierAob::~CDCMONotifierAob() -// -------------------------------------------------------------------------- -// -CDCMONotifierAob::~CDCMONotifierAob() - { - RDEBUG("CDCMONotifierAob::~CDCMONotifierAob begin"); - if( iGlobalMsgQuery ) - { - delete iGlobalMsgQuery ; - iGlobalMsgQuery = NULL; - } - RDEBUG("CDCMONotifierAob::~CDCMONotifierAob end"); - } - -// -------------------------------------------------------------------------- -// void CDCMONotifierAob::RunL() -// -------------------------------------------------------------------------- -// -void CDCMONotifierAob::RunL() - { - RDEBUG("CDCMONotifierAob::RunL() : Begin"); - - if(iStatus == EAknSoftkeyOk) - { - RDEBUG("CDCMONotifierAob::RunL() : EAknSoftkeyOk"); - delete iGlobalMsgQuery ; - iGlobalMsgQuery = NULL; - if( CDCMOServer::iSessionCount == 0) - CActiveScheduler::Stop(); - } - - RDEBUG("CDCMONotifierAob::RunL() : End"); - } - -// -------------------------------------------------------------------------- -// void CDCMONotifierAob::DoCancel() -// -------------------------------------------------------------------------- -// -void CDCMONotifierAob::DoCancel() - { - RDEBUG("CDCMONotifierAob::DoCancel() : Begin"); - iGlobalMsgQuery->CancelMsgQuery(); - delete iGlobalMsgQuery ; - iGlobalMsgQuery = NULL; - RDEBUG("CDCMONotifierAob::DoCancel() : End"); - } - -// -------------------------------------------------------------------------- -// void CDCMONotifierAob::ShowNotifierL( TDesC& aString ) -// -------------------------------------------------------------------------- -// -void CDCMONotifierAob::ShowNotifierL( TDesC& aString ) -{ - RDEBUG("CDCMONotifierAob::ShowNotifierL() : Begin"); - if( !iGlobalMsgQuery ) - iGlobalMsgQuery = CAknGlobalMsgQuery::NewL(); - if (!IsActive()) - { - iStatus = KRequestPending; - - iGlobalMsgQuery->ShowMsgQueryL( - iStatus, - aString, - R_AVKON_SOFTKEYS_OK_EMPTY, //R_AVKON_SOFTKEYS_OK_EMPTY, //R_AVKON_SOFTKEYS_OK_CANCEL, - KNullDesC, - KNullDesC); - SetActive(); - } - RDEBUG("CDCMONotifierAob::ShowNotifierL() : End"); -} - -// ----------------------------------------------------------------------------- -// CDCMONotifierAob::RunError -// Called when RunL leaves -// This method can't leave -// ----------------------------------------------------------------------------- - -TInt CDCMONotifierAob::RunError(TInt /* aError */) - { - RDEBUG("CDCMONotifierAob::RunError >>"); - - RDEBUG("CDCMONotifierAob::RunError <<"); - return KErrNone; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/src/dcmoserver.cpp --- a/dcmofw/dcmoserver/src/dcmoserver.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/dcmofw/dcmoserver/src/dcmoserver.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -21,10 +21,9 @@ #include #include #include -#include // Resource to be read header -#include #include #include +#include #include "dcmoclientserver.h" #include "dcmoconst.h" #include "dcmointerface.h" @@ -33,7 +32,9 @@ #include "dcmogenericcontrol.h" #include "dcmodebug.h" -_LIT( KdcmoResourceFileName, "z:dcmo.rsc" ); + +_LIT( KdcmoResourceFileName, "deviceupdates_" ); +_LIT( KdcmoResourceFilePath, "z:/resource/qt/translations/" ); const TInt KBufferSize = 256; TInt CDCMOServer::iSessionCount = 0; @@ -114,7 +115,7 @@ CDCMOServer::CDCMOServer() : CServer2(EPriorityStandard, EUnsharableSessions) /*CServer2(0)*/ { iStarter = EFalse; - iNotifier = NULL; + iMessageBox = NULL; } // ---------------------------------------------------------------------------------------- @@ -130,8 +131,8 @@ for(TInt i=0; i< count; i++) delete idcmoArray[i].iCategoryName; idcmoArray.Reset(); - delete iNotifier; - iNotifier = NULL; + delete iMessageBox; + iMessageBox = NULL; } else { @@ -157,7 +158,11 @@ RDEBUG("CDCMOServer::DropSession(): Starter"); SetStarter( EFalse ); return; - } + } + if(CDCMOMessageBox::IsMsgBoxClosed()) + { + CleanDcmoArray(); + } if( idcmoArray.Count() && ( iSessionCount == 0 )) { // A session is being destroyed @@ -369,25 +374,21 @@ RDEBUG("CDCMOServer::SetIntAttributeL(): LocalCategory"); CDCMOGenericControl* iGenericControl = new(ELeave) CDCMOGenericControl; err = iGenericControl->SetIntAttributeL(categotyNumber, id, value); - TFileName myFileName; - TParse parseObj; - parseObj.Set( KdcmoResourceFileName(), &KDC_RESOURCE_FILES_DIR,NULL ); - myFileName = parseObj.FullName(); - CStringResourceReader* test = CStringResourceReader::NewL( myFileName ); + + TBool result = HbTextResolverSymbian::Init(KdcmoResourceFileName, KdcmoResourceFilePath ); + TPtrC buf; dcmoList.iUid = categotyNumber; if(categotyNumber == 0) - { - buf.Set(test->ReadResourceString(R_DM_RUN_TIME_VAR_CAMERA)); - stringHolder = buf.AllocL() ; + { + _LIT(KTextCamera, "txt_device_update_info_camera"); + stringHolder = HbTextResolverSymbian::LoadL(KTextCamera); } else - { - buf.Set(test->ReadResourceString(R_DM_RUN_TIME_VAR_FIRMWARE_UPDATE)); - stringHolder = buf.AllocL() ; - } - delete test; - test = NULL; + { + _LIT(KTextFOTA, "txt_device_update_info_firmware_update"); + stringHolder = HbTextResolverSymbian::LoadL(KTextFOTA); + } delete iGenericControl; iGenericControl = NULL; } @@ -416,7 +417,7 @@ RDEBUG("CDCMOServer::SetIntAttributeL(): Starter"); SetStarter ( EFalse ); delete stringHolder; - stringHolder = NULL; + stringHolder = NULL; return err; } if((err == EDcmoSuccess) && (id == EEnable) ) @@ -477,7 +478,7 @@ RDEBUG("CDCMOServer::DoFinalizeL(): begin"); HBufC* content = HBufC::NewLC(KDCMOMaxStringSize); - TPtr contentptr = content->Des(); + TPtr contentptr = content->Des(); HBufC* enableContent = HBufC::NewLC(KDCMOMaxStringSize); TPtr enableContentptr = enableContent->Des(); HBufC* disableContent = HBufC::NewLC(KDCMOMaxStringSize); @@ -485,10 +486,6 @@ TBool enable ( EFalse ); TBool disable ( EFalse ); - TFileName myFileName; - TParse parseObj; - parseObj.Set( KdcmoResourceFileName(), &KDC_RESOURCE_FILES_DIR,NULL ); - myFileName = parseObj.FullName(); TInt arrayCount = idcmoArray.Count(); _LIT(KNewLine, "\n"); @@ -509,38 +506,34 @@ disableContentptr.Append( idcmoArray[i].iCategoryName->Des() ); disable = ETrue; } - } - - CStringResourceReader* test = CStringResourceReader::NewL( myFileName ); + } + + TBool result = HbTextResolverSymbian::Init(KdcmoResourceFileName, KdcmoResourceFilePath ); if ( enable ) { - TPtrC buf; - buf.Set(test->ReadResourceString(R_DM_RUN_TIME_VAR_ENABLE)); - contentptr.Append(buf); + _LIT(KTextEnabled, "txt_device_update_title_enabled_by_the_system_admi"); + HBufC* buf = HbTextResolverSymbian::LoadL(KTextEnabled); + contentptr.Append(buf->Des()); contentptr.Append(enableContentptr); + delete buf; } if ( disable ) { - TPtrC buf; - buf.Set(test->ReadResourceString(R_DM_RUN_TIME_VAR_DISABLE)); + _LIT(KTextDisabled, "txt_device_update_title_disabled_by_the_system_adm"); + HBufC* buf = HbTextResolverSymbian::LoadL(KTextDisabled); if( enable ) - contentptr.Append(KNewLine()); - contentptr.Append(buf); + contentptr.Append(KNewLine()); + contentptr.Append(buf->Des()); contentptr.Append(disableContentptr); + delete buf; } - delete test; - test = NULL; - - if( iNotifier ) - { - iNotifier->Cancel(); + + if( !iMessageBox ) + { + iMessageBox = CDCMOMessageBox::NewL(); } - else - { - iNotifier = CDCMONotifierAob::NewL( ); - } - - iNotifier->ShowNotifierL(contentptr); + iMessageBox->ShowMessageL(contentptr); + CleanupStack::PopAndDestroy(3); //disableContent, enableContent, content } RDEBUG("CDCMOServer::DoFinalizeL(): end"); @@ -618,3 +611,22 @@ iStarter = aValue; RDEBUG("CDCMOServer::SetStarter(): end"); } + +// ---------------------------------------------------------------------------------------- +// CDCMOServer::CleanDcmoArray +// Sets the iStarter value +// ---------------------------------------------------------------------------------------- +void CDCMOServer::CleanDcmoArray() +{ + RDEBUG("CDCMOServer::CleanDcmoArray(): begin"); + TInt count = idcmoArray.Count(); + RDEBUG_2("CDCMOServer::CleanDcmoArray; %d", count ); + if(count) + { + for(TInt i=0; i< count; i++) + delete idcmoArray[i].iCategoryName; + idcmoArray.Reset(); + } + CDCMOMessageBox::SetMsgBoxStatus(EFalse); + RDEBUG("CDCMOServer::CleanDcmoArray(): end"); +} diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/dcmoserver/src/dcmosession.cpp --- a/dcmofw/dcmoserver/src/dcmosession.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/dcmofw/dcmoserver/src/dcmosession.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -19,6 +19,7 @@ #include "dcmosession.h" #include "dcmoclientserver.h" +#include "dcmomessagebox.h" #include "dcmodebug.h" @@ -73,6 +74,10 @@ TPckg node(nodeValue); TPckg intvalue(value); + if(CDCMOMessageBox::IsMsgBoxClosed()) + { + Server().CleanDcmoArray(); + } HBufC* category = HBufC::NewLC(KDCMOMaxStringSize); TPtr categoryptr = category->Des(); aMessage.Read (0, categoryptr); diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/group/bld.inf --- a/dcmofw/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/dcmofw/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -18,7 +18,6 @@ PRJ_EXPORTS ../rom/dcmofw.iby CORE_MW_LAYER_IBY_EXPORT_PATH(dcmofw.iby) -../rom/dcmofwresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(dcmofwresources.iby) PRJ_MMPFILES #include "../dcmoclient/group/bld.inf" diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/rom/dcmofw.iby --- a/dcmofw/rom/dcmofw.iby Tue Jul 13 09:37:43 2010 +0530 +++ b/dcmofw/rom/dcmofw.iby Tue Jul 13 09:51:41 2010 +0530 @@ -22,7 +22,7 @@ file=ABI_DIR\BUILD_DIR\dcmoclient.dll SHARED_LIB_DIR\dcmoclient.dll #ifdef FF_RUNTIME_DEVICE_CAPABILITY_CONFIGURATION -data=DATAZ_\RESOURCE_FILES_DIR\dcmo.rsc RESOURCE_FILES_DIR\dcmo.rsc + file=ABI_DIR\BUILD_DIR\dcmoserver.exe PROGRAMS_DIR\dcmoserver.exe data=\epoc32\data\Z\private\10202BE9\2001FE47.txt private\10202BE9\2001FE47.txt diff -r a36219ae6585 -r 2e64dc50f295 dcmofw/rom/dcmofwresources.iby --- a/dcmofw/rom/dcmofwresources.iby Tue Jul 13 09:37:43 2010 +0530 +++ /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: Image description file for project dcmofw -* -*/ - - -#ifndef _DCMOFWRESOURCES_IBY_ -#define _DCMOFWRESOURCES_IBY_ - - -#ifdef FF_RUNTIME_DEVICE_CAPABILITY_CONFIGURATION -data=DATAZ_\RESOURCE_FILES_DIR\dcmo.rsc RESOURCE_FILES_DIR\dcmo.rsc -#endif -#endif - diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogclient/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogclient/bld/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,25 @@ +/* +* 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 syncml dm device dialogs +* +*/ + +// BLD.INF +// Component description file +// + +PRJ_MMPFILES + +dmdevdialogclient.mmp + diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogclient/bld/dmdevdialogclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogclient/bld/dmdevdialogclient.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,38 @@ +/* +* 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 dm device dialogs +* +*/ + +#include +#include + +CAPABILITY CAP_CLIENT_DLL + +TARGET dmdevdialogclient.dll +TARGETTYPE dll +UID 0x1000008D 0x2002FF67 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE dmdevdialogclient.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +DEBUGLIBRARY flogger.lib diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogclient/bwins/dmdevdialogclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogclient/bwins/dmdevdialogclientu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,11 @@ +EXPORTS + ?ShowConnectDialog@RDmDevDialog@@QAEHXZ @ 1 NONAME ; int RDmDevDialog::ShowConnectDialog(void) + ?IsPkgZeroConnectNoteShown@RDmDevDialog@@QAEHAAH@Z @ 2 NONAME ; int RDmDevDialog::IsPkgZeroConnectNoteShown(int &) + ?ShowConfirmationAlert@RDmDevDialog@@QAEXABHABVTDesC16@@1AAVTRequestStatus@@@Z @ 3 NONAME ; void RDmDevDialog::ShowConfirmationAlert(int const &, class TDesC16 const &, class TDesC16 const &, class TRequestStatus &) + ?Close@RDmDevDialog@@QAEXXZ @ 4 NONAME ; void RDmDevDialog::Close(void) + ?LaunchPkgZero@RDmDevDialog@@QAEXABH00AAVTDes8@@AAVTRequestStatus@@@Z @ 5 NONAME ; void RDmDevDialog::LaunchPkgZero(int const &, int const &, int const &, class TDes8 &, class TRequestStatus &) + ?OpenL@RDmDevDialog@@QAEHXZ @ 6 NONAME ; int RDmDevDialog::OpenL(void) + ?DismissConnectDialog@RDmDevDialog@@QAEHXZ @ 7 NONAME ; int RDmDevDialog::DismissConnectDialog(void) + ?ShowDisplayAlert@RDmDevDialog@@QAEXABVTDesC16@@AAVTRequestStatus@@@Z @ 8 NONAME ; void RDmDevDialog::ShowDisplayAlert(class TDesC16 const &, class TRequestStatus &) + ?CancelPkgZeroNote@RDmDevDialog@@QAEHXZ @ 9 NONAME ; int RDmDevDialog::CancelPkgZeroNote(void) + diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogclient/eabi/dmdevdialogclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogclient/eabi/dmdevdialogclientu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,11 @@ +EXPORTS + _ZN12RDmDevDialog13LaunchPkgZeroERKiS1_S1_R5TDes8R14TRequestStatus @ 1 NONAME + _ZN12RDmDevDialog16ShowDisplayAlertERK7TDesC16R14TRequestStatus @ 2 NONAME + _ZN12RDmDevDialog17CancelPkgZeroNoteEv @ 3 NONAME + _ZN12RDmDevDialog17ShowConnectDialogEv @ 4 NONAME + _ZN12RDmDevDialog20DismissConnectDialogEv @ 5 NONAME + _ZN12RDmDevDialog21ShowConfirmationAlertERKiRK7TDesC16S4_R14TRequestStatus @ 6 NONAME + _ZN12RDmDevDialog25IsPkgZeroConnectNoteShownERi @ 7 NONAME + _ZN12RDmDevDialog5CloseEv @ 8 NONAME + _ZN12RDmDevDialog5OpenLEv @ 9 NONAME + diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogclient/inc/dmdevdialogclientdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogclient/inc/dmdevdialogclientdebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -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 Dm device dialog client +* +*/ + +#ifndef DEVDIALOG_CLIENT_DEBUG_H_ +#define DEVDIALOG_CLIENT_DEBUG_H_ +#ifdef _DEBUG + #ifdef _DEVDIALOG_DEBUG +#endif + #include + #include + #include + #include + + _LIT( KLogFile, "devdiag.log" ); + _LIT( KLogDirFullName, "c:\\logs\\" ); + _LIT( KLogDir, "DMDD" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + + #ifdef __DEVDIALOG_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else //__DEVDIALOG_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // __DEVDIALOG_DEBUG_RDEBUG + + #else // _DEVDIALOG_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _DEVDIALOG_DEBUG + + +#endif /*FMSCLIENTDEBUG_H_*/ diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogclient/src/dmdevdialogclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogclient/src/dmdevdialogclient.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,167 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#include +#include "dmdevdialogclientserver.h" +#include "dmdevdialogclientdebug.h" + +// --------------------------------------------------------------------------- +// StartServerL() +// Starts DM device Dialog server +// --------------------------------------------------------------------------- +TInt StartServerL() + { + FLOG(_L("StartServerLt Started")); + TInt res = KErrNone; + RProcess server; + res=server.Create(KDMDEVDIALOGSERVER,KNullDesC); + FLOG(_L("StartServerL-- create server error as %d"),res); + if (res!=KErrNone) + { + return res; + } + TRequestStatus stat; + server.Rendezvous(stat); + if (stat!=KRequestPending) + server.Kill(0); // abort startup + else + server.Resume(); // logon OK - start the server + User::WaitForRequest(stat); // wait for start or death + res=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + FLOG(_L("StartServerL-- server.ExitType() returns %d"),res); + server.Close(); + return res; + } + +// --------------------------------------------------------------------------- +// RDmDevDialog::OpenL() +// --------------------------------------------------------------------------- +EXPORT_C TInt RDmDevDialog::OpenL() + { + FLOG(_L("RDmDevDialog::OpenL()- Begin")); + TInt res = KErrNone; + FLOG(_L("RDmDevDialog::OpenL()- Secured client")); + res = CreateSession( KDMDEVDIALOGSERVER,TVersion(KDmDevDialogServerVersionMajor, + KDmDevDialogServerVersionMinor,0),KDefaultMessageSlots ); + if ( res != KErrNone ) + { + FLOG(_L("RDmDevDialog::OpenL()- session not created")); + res = StartServerL(); + User::LeaveIfError( res ); + res = CreateSession( KDMDEVDIALOGSERVER,TVersion(KDmDevDialogServerVersionMajor, + KDmDevDialogServerVersionMinor,0),KDefaultMessageSlots ); + } + FLOG(_L("RDmDevDialog::OpenL()- End %d"),res); + return res; + } + +// --------------------------------------------------------------------------- +// RDmDevDialog::Close() +// --------------------------------------------------------------------------- +EXPORT_C void RDmDevDialog::Close() + { + FLOG(_L(" RDmDevDialog::Close")); + RSessionBase::Close(); + } + +// ---------------------------------------------------------------------------- +// RDmDevDialog::LaunchPkgZeroL() +// ---------------------------------------------------------------------------- +EXPORT_C void RDmDevDialog::LaunchPkgZero(const TInt& aProfileId, + const TInt& ajobId, const TInt& aUimode, + TDes8& aResponse, TRequestStatus& aStatus ) + { + FLOG(_L(" RDmDevDialog::LaunchPkgZero--Begin")); + SendReceive( EServerAlert, TIpcArgs(aProfileId,ajobId,aUimode,&aResponse), + aStatus); + FLOG(_L(" RDmDevDialog::LaunchPkgZero end ")); + } + +// --------------------------------------------------------------------------- +// RDmDevDialog::IsPkgZeroConnectNoteShown() +// --------------------------------------------------------------------------- +EXPORT_C TInt RDmDevDialog::IsPkgZeroConnectNoteShown(TInt& aConectNoteShown) + { + FLOG(_L(" RDmDevDialog::IsPkgZeroConnectNoteShown--Begin")); + TPckgBuf result(aConectNoteShown); + TInt err = SendReceive( EPkgConnectNoteIsActive,TIpcArgs(&result)); + aConectNoteShown = result(); + FLOG(_L(" RDmDevDialog::IsPkgZeroConnectNoteShown--End as %d,%d"),err, + aConectNoteShown); + return err; + } + +// --------------------------------------------------------------------------- +// RDmDevDialog::DismissConnectDialog() +// --------------------------------------------------------------------------- +EXPORT_C TInt RDmDevDialog::DismissConnectDialog() + { + FLOG(_L(" RDmDevDialog::DismissConnectDialog--Begin")); + TInt err = SendReceive( EPkgZeroConnectNoteDismiss,TIpcArgs()); + FLOG(_L(" RDmDevDialog::DismissConnectDialog--End as %d,%d"),err); + return err; + } + +// --------------------------------------------------------------------------- +// RDmDevDialog::ShowConnectDialog() +// --------------------------------------------------------------------------- +EXPORT_C TInt RDmDevDialog::ShowConnectDialog() + { + FLOG(_L(" RDmDevDialog::ShowConnectDialog--Begin")); + TInt err = SendReceive( EPkgZeroConnectNoteShowAgain,TIpcArgs()); + FLOG(_L(" RDmDevDialog::ShowConnectDialog--error is %d"),err); + return err; + } + +// --------------------------------------------------------------------------- +// RDmDevDialog::ShowDisplayAlert() +// --------------------------------------------------------------------------- +EXPORT_C void RDmDevDialog::ShowDisplayAlert(const TDesC& aNoteDisplayText, + TRequestStatus& aStatus) + { + FLOG(_L(" RDmDevDialog::ShowDisplayAlert--Begin")); + SendReceive( EShowDisplayAlert,TIpcArgs(&aNoteDisplayText),aStatus); + FLOG(_L(" RDmDevDialog::ShowDisplayAlert end" )); + } + + +// --------------------------------------------------------------------------- +// RDmDevDialog::ShowConfirmationAlert() +// --------------------------------------------------------------------------- +EXPORT_C void RDmDevDialog::ShowConfirmationAlert(const TInt& aTimeout, + const TDesC& aNoteHeader, const TDesC& aNoteDisplayText, + TRequestStatus& aStatus) + { + FLOG(_L(" RDmDevDialog::ShowConfirmationAlert--Begin")); + SendReceive( EShowConfirmationalert,TIpcArgs(aTimeout,&aNoteHeader, + &aNoteDisplayText),aStatus); + FLOG(_L(" RDmDevDialog::ShowConfirmationAlert--End ")); + } + +// --------------------------------------------------------------------------- +// RDmDevDialog::CancelPkgZeroNote() +// --------------------------------------------------------------------------- +EXPORT_C TInt RDmDevDialog::CancelPkgZeroNote() + { + FLOG(_L(" RDmDevDialog::CancelPkgZeroNote--Begin")); + TInt err = SendReceive(ECancelServerAlert, TIpcArgs()); + FLOG(_L(" RDmDevDialog::CancelPkgZeroNote--End ")); + return err; + } + +//End of file diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogserver/bld/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogserver/bld/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,27 @@ +/* +* 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 DM Device Dialogs +* This is part of syncmlfw. +* +*/ + +// BLD.INF +// Component description file +// + +PRJ_MMPFILES + +dmdevicedialog.mmp + + diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogserver/bld/dmdevicedialog.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogserver/bld/dmdevicedialog.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,48 @@ +/* +* 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 DM Device Dialogs +* +*/ + +#include +#include + + +CAPABILITY CAP_SERVER + +TARGET dmdevicedialog.exe +TARGETTYPE exe + +UID 0 0x2002FF68 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE dmdevicedialogserver.cpp +SOURCE dmdevicedialogsession.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../cenrep + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY hbcore.lib +LIBRARY syncmlclientapi.lib +LIBRARY centralrepository.lib +DEBUGLIBRARY flogger.lib + + diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogserver/inc/dmdevicedialogdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogserver/inc/dmdevicedialogdebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,67 @@ +/* +* 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 DM Device Dialogs +*/ + +#ifndef __DMDEVDEBUG_H_ +#define __DMDEVDEBUG_H_ +#include +#if 0 +#ifdef _DEBUG + #define _DMDEV_DEBUG +#endif + + #ifdef _DMDEV_DEBUG + + #include + #include + #include + #include + + _LIT( KLogFile, "dmdevdialog.log" ); + _LIT( KLogDirFullName, "c:\\logs\\" ); + _LIT( KLogDir, "Dmdd" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + + #ifdef _DMDEV_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else // _DMDEV_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // _DMDEV_DEBUG_RDEBUG + + #else // _DMDEV_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _DMDEV_DEBUG +#endif +#define FLOG(arg...) RDebug::Print(arg); +#endif /*DMDEVDEBUG_H_*/ diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogserver/inc/dmdevicedialogserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogserver/inc/dmdevicedialogserver.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,345 @@ +/* + * 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 DM Device Dialogs + */ + +#ifndef __DMDEVDIALOGSERVER_H__ +#define __DMDEVDIALOGSERVER_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "dmdevdialogclientserver.h" +#include "dmdevicedialogdebug.h" + +class CDmDeviceDialogSession; +class CDmDeviceDialogServer; +class CHbIndicatorSymbian; + + +_LIT(KDeviceDialogType,"com.nokia.hb.devicemanagementdialog/1.0"); +_LIT(KNotifierType, "syncmlfw"); +_LIT(KProfileId, "profileid"); +_LIT(KUImode, "uimode"); +_LIT(KServerdisplayname, "serverdisplayname"); +_LIT(KDMJobId, "jobid"); +_LIT(KServerpushalertInfo, "serverpushinformative"); +_LIT(KServerpushalertConfirm, "serverpushconfirmative"); +_LIT(KDMProgressIndicatorType, "com.nokia.devicemanagement.progressindicatorplugin/1.0"); +_LIT(KFotaDefaultProfile, "fotadefaultprofile"); +_LIT(KPkgZeroTimeout, "pkgzerotimeout"); + + +const TInt KRequestTriggerWaitTime(1000000); + +const TInt KDefaultNotifierId = 1000000; +const TInt KConnectNotifierId = 1000001; +// Device manager key UID +const TUid KCRUidNSmlDMSyncApp = {0x101f6de5}; +// CenRep keys for default dm profile used in the +// firmware update over the air. +const TUint32 KNSmlDMDefaultFotaProfileKey = 0x00000002; + +#define KSosServerUid 0x101f99fb +#define KFotaServerUid 0x102072C4 +#define KScomoServerUid 0x200267FB + + + +class CDmDeviceDialogServer : public CServer2, + public MHbDeviceDialogObserver, + public MSyncMLEventObserver, + public MHbIndicatorSymbianObserver + { + friend class CDmDeviceDialogSession; + +public: + enum TNoteType + { + EPkgZeroNote, + EConnectNote, + EInformativeAlertNote, + EConfirmationAlertNote + }; + + enum TSyncMLSANSupport + { + ESANNotSpecified, + ESANSilent, + ESANUserInformative, + ESANUserInteractive + }; + /** + * Destructor + */ + virtual ~CDmDeviceDialogServer(); + + /** + * Static method which creates the server instance + * @param None + * @return CServer2* + */ + static CServer2* NewLC(); + + /** + * Stops the session and closes the server + * @param None + * @return None + */ + void CloseServer(); + + /** + * For asynchronous network request to be + * logged on active object, using CPeriodic + * @param None + * @return None + */ + void PeriodicServerCloseL(); + + /** + * Launches package zero device dialog + * @param aProfileId, ProfileId of the DM server + * @param ajobId, Id of the DM job created due to package zero + * @param aUimode, Server alert ui mode type + * @param aReplySlot, Response to Sos server + * @param aMessage, reference to RMessage2 of current session. + * @return None. + */ + void LaunchPkgZeroNoteL(TInt &aProfileId, TInt &aJobId, + const TInt &aReplySlot, TInt &aUimode, + const RMessage2& aMessage); + + /** + * Launches display alert specific device dialog + * @param aAlertText, Text to be dsiplayed on display alert + * @param aMessage, reference to RMessage2 of current session. + * @return None. + */ + void ShowDisplayalertL(const TDesC &aAlertText, + const RMessage2& aMessage); + + /** + * Launches Confirmation(1101) alert dialog + * @param aTimeout, Timeout of the dialog. + * @param aNoteDisplayText, Text to be displayed on the note + * @param aNoteHeader, Text to be displayed as dialog header + * @param aMessage, reference to RMessage2 of current session. + * @return None. + */ + void ShowConfirmationalertL(const TInt& aTimeOut, const TDesC& aHeader, + const TDesC& aText, const RMessage2& aMessage); + + /** + * Keeps track of number of asynchronous requests + * @param None. + * @return None. + */ + void NewAsyncRequest(); + + /** + * Tells any request pending or not + * @param None. + * @return None. + */ + TBool RequestPending(); + + /** + * Cancels the earlier requested server shutdown + * annd serves for the incoming request. + * @param None. + * @return None. + */ + void CancelServerCloseRequest(); + + /** + * Callback method from Device dialog plugin for user action. + * @param aData, User response to the device dialog note + * @return None. + */ + virtual void DataReceived(CHbSymbianVariantMap& aData); + + /** + * Callback method from Device dialog plugin when dialog gets closed. + * @param aCompletionCode, Error code. + * @return None. + */ + virtual void DeviceDialogClosed(TInt aCompletionCode); + + /** + * From MSyncMLEventObserver + * Called when SyncML session events oocur. + * @param aEvent Sync event + * @param aIdentifier Identifier for the sync event + * @param aError Synce event error + * @param aAdditionalData. + * @return None. + */ + virtual void OnSyncMLSessionEvent(TEvent aEvent, TInt aIdentifier, + TInt aError, TInt aAdditionalData); + + /** + * Tells whether package zero query is currently shown or not. + * @param None. + * @return TBool, status of package zero note display. + */ + TBool IsPkgZeroNoteDisplaying(); + + /** + * Cancels outstanding package zero request. + * @param None. + * @return None. + */ + void CancelPendingServerAlert(); + + /** + * Callback method from Device dialog Indicator when user taps on Indicator. + * @param aType - Type of the indicator that user interacted with. + * @param aData - Data sent by the indicator. + * @return None. + */ + virtual void IndicatorUserActivated (const TDesC &aType, + CHbSymbianVariantMap &aData); + +private: + + /** + * second phase constructor + * @param None + */ + void ConstructL(); + + /** + * Default constructor + * @param None + */ + CDmDeviceDialogServer(); + + /** + * Called to close the server. + * @param None. + * @return None. + */ + void StopServer(); + + /** + * Dsimisses the Connect device dialog + * @param None. + * @return None. + */ + void DismissDialog(); + + /** + * Starts DM Job after user accepted the package zero message. + * @param None. + * @return None. + */ + void GetDMJobStatusL(); + + /** + * Tells whether connect dialog is currently shown or not. + * @param None. + * @return boolean, status of the connect dialog. + */ + TBool IsConenctDialogDisplaying(); + + /** + * Display connect dialog, if dismissed earlier. + * @param None. + * @return None. + */ + void ShowConnectDialogAgainL(); + + /** + * Called to process the response of user action on specified Device dialog + * @param aData, User response to the device dialog note + * @return None. + */ + void DevDialogResponseL(CHbSymbianVariantMap& aData); + +protected: + + /** + * Calls when a New session is getting created + * @param aVersion + * @param aMessage + * @return CSession2* + */ + CSession2* NewSessionL(const TVersion& aVersion, + const RMessage2& aMessage) const; + +private: + //Periodic timer used while shutting down the server + CPeriodic* iServerCloseRequest; + + //DM Server Profile Id + TInt iProfileId; + + //Current Dm Session Job Id + TInt iJobId; + + //Server alert type of package zero message + TUint iUimode; + + //Pointer to Device dialog server + CHbDeviceDialogSymbian* iDevDialog; + + //Reference to Indicator framework + CHbIndicatorSymbian* iDmIndicator; + + //Status variable to identify the status of Connecting note + TBool iPkgZeroConnectionNoteShown; + + //User response of device dialog note + TInt iResponse; + + //RMessage reference used to notify the caller + RMessage2 iMessage; + + //Status variable to know whether server can be stopped or not + TBool iStopServer; + + // SyncML Session + RSyncMLSession iSyncMLSession; + + // Job id after starting DM Job + TInt iSyncJobId; + + // DM job + RSyncMLDevManJob iSyncJob; + + //Status variable to know whether a DM Job is ongoing or not + TBool iJobongoing; + + //Status variable to know currently any device dialog is displayed or not + TBool iAnyDialogDisplaying; + + //Status variable to know whether an Indicator is launched or not + TBool iIndicatorLaunched; + + //Identifies the number of requests pending + TInt iSessionCount; + + //Identifies whether package zero note is displaying or not + TBool iPkgZeroQueryNoteDisplaying; + + //Response slot to write the result + TInt iReplySlot; + }; + +#endif diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogserver/inc/dmdevicedialogsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogserver/inc/dmdevicedialogsession.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,79 @@ +/* +* 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 DM Device Dialogs +* This is part of syncmlfw. +*/ + +#ifndef __DMDEVDIALOG_SESSION_H__ +#define __DMDEVDIALOG_SESSION_H__ + +#include "dmdevicedialogserver.h" + +class CDmDeviceDialogSession: public CSession2 +{ + friend class CDmDeviceDialogServer; + public: + /** + * Destructor + */ + virtual ~CDmDeviceDialogSession(); + + private: + /** + * Constructor + */ + CDmDeviceDialogSession(); + + /** + * Provides DM Device dialog Server reference + * @param None. + * @return CDmDeviceDialogServer reference + */ + CDmDeviceDialogServer& Server(); + + /** + * Called by the framework to handle the request + * @param aMessage + * @return None + */ + void ServiceL(const RMessage2& aMessage); + + /** + * Called from ServiceL to handle the request + * @param aMessage + * @return None + */ + void DispatchMessageL(const RMessage2& aMessage); + + /** + * Called when ServiceL leaves + * @param aMessage + * @param aError + * @return None + */ + void ServiceError(const RMessage2 &aMessage, TInt aError); + + /** + * Checks whether the session started client is secured or not + * @param aMessage + * @return TBool + */ + TBool CheckClientSecureId( const RMessage2 &aMessage ); + + private: + RMessage2 iMessage; +}; + + +#endif diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogserver/src/dmdevicedialogserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogserver/src/dmdevicedialogserver.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,755 @@ +/* + * 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 DM Device Dialogs + * + */ + +#include +#include +#include +#include "dmdevicedialogserver.h" +#include "dmdevdialogclientserver.h" +#include "dmdevicedialogsession.h" +//#include +// ---------------------------------------------------------------------------------------- +// Server startup code +// ---------------------------------------------------------------------------------------- +static void RunServerL() + { + // naming the server thread after the server helps to debug panics + User::LeaveIfError(User::RenameThread(KDMDEVDIALOGSERVER)); + + // create and install the active scheduler + CActiveScheduler* s = new (ELeave) CActiveScheduler; + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + // create the server (leave it on the cleanup stack) + CDmDeviceDialogServer::NewLC(); + + // Initialisation complete, now signal the client + RProcess::Rendezvous(KErrNone); + + // Ready to run + CActiveScheduler::Start(); + + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy(2); + } + +// ---------------------------------------------------------------------------------------- +// static method ShutDownL() called to submit async n/w request +// ---------------------------------------------------------------------------------------- +static TInt ShutDownL(TAny* aPtr) + { + CDmDeviceDialogServer* ptr = (CDmDeviceDialogServer*) aPtr; + FLOG(_L("static ShutDownL:-Begin")); + TRAPD(err, ptr->CloseServer()); + FLOG(_L("closing the server")); + ptr->CancelServerCloseRequest(); + FLOG(_L("closing the server:-end")); + return err; + } + +// ---------------------------------------------------------------------------------------- +// Server process entry-point +// ---------------------------------------------------------------------------------------- +TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt r = KErrNoMemory; + if (cleanup) + { + TRAP(r,RunServerL()); + delete cleanup; + } + __UHEAP_MARKEND; + return r; + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::NewLC +// ---------------------------------------------------------------------------------------- +CServer2* CDmDeviceDialogServer::NewLC() + { + CDmDeviceDialogServer* self = new (ELeave) CDmDeviceDialogServer; + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::ConstructL +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogServer::ConstructL() + { + FLOG(_L("CDmDeviceDialogServer::ConstructL- begin")); + StartL( KDMDEVDIALOGSERVER); + iSyncMLSession.OpenL(); + FLOG(_L("CDmDeviceDialogServer::ConstructL- end")); + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::CDmDeviceDialogServer() +// ---------------------------------------------------------------------------------------- +CDmDeviceDialogServer::CDmDeviceDialogServer() : + CServer2(EPriorityStandard, EUnsharableSessions) + { + iSessionCount = 0; + iServerCloseRequest = NULL; + iProfileId = EFalse; + iJobId = EFalse; + iStopServer = EFalse; + iResponse = -1; + iPkgZeroConnectionNoteShown = EFalse; + iDmIndicator = NULL; + iDevDialog = NULL; + iAnyDialogDisplaying = EFalse; + iIndicatorLaunched = EFalse; + iPkgZeroQueryNoteDisplaying = EFalse; + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::CloseServer() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::CloseServer() + { + iSessionCount = 0; + //Kill the server + CActiveScheduler::Stop(); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::DataReceived() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::DataReceived(CHbSymbianVariantMap& aData) + { + FLOG(_L("CDmDeviceDialogServer::DataReceived>>")); + TRAP_IGNORE(DevDialogResponseL(aData)); + FLOG(_L("CDmDeviceDialogServer::DataReceived<<")); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::DevDialogResponseL() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::DevDialogResponseL(CHbSymbianVariantMap& aData) + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL>>")); + _LIT(KNotifierReturnType, "notifiertype"); + _LIT(KKeyPress, "keypress"); + const CHbSymbianVariant* notifiertypevariant = aData.Get(KNotifierReturnType); + TInt *notifiertype = notifiertypevariant->Value (); + const CHbSymbianVariant* returnkeyvariant = aData.Get(KKeyPress); + TInt *returnvalue = returnkeyvariant->Value (); + iResponse = *returnvalue; + iDevDialog->Cancel(); + iAnyDialogDisplaying = EFalse; + if (EPkgZeroNote == *notifiertype )//Server alert note + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL EPkgZeroNote \ + response from user is %d"),iResponse); + if (iResponse == 0) + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL OK pressed")); + CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(varMap); + TInt id = KConnectNotifierId; + HBufC* notifierid = HBufC::NewL(10); + CleanupStack::PushL(notifierid); + *notifierid = KNotifierType; + CHbSymbianVariant* notifieridvar = CHbSymbianVariant::NewL(&id, + CHbSymbianVariant::EInt); + varMap->Add(*notifierid, notifieridvar); + TInt err = iDevDialog->Show(KDeviceDialogType, *varMap, this); + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseLconnect note \ + launch error is %d"), err); + iAnyDialogDisplaying = ETrue; + iPkgZeroConnectionNoteShown = ETrue; + GetDMJobStatusL(); + TPckgBuf response(KDmDevDialogUid); + iMessage.WriteL(iReplySlot,response); + iMessage.Complete(KErrNone); + iSessionCount--; + CleanupStack::PopAndDestroy(2); + //GetDMJobStatusL(); + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL DM Job \ + started")); + } + else + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL user pressed \ + cancel")); + iMessage.Complete(KErrCancel); + iSessionCount--; + StopServer(); + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL stop \ + server called")); + } + iPkgZeroQueryNoteDisplaying = EFalse; + } + else if (EInformativeAlertNote == *notifiertype )// Iformative alert + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL informative alert")); + iMessage.Complete(KErrNone); + iSessionCount--; + if (!iJobongoing) + StopServer(); + else + ShowConnectDialogAgainL(); + } + else if (EConfirmationAlertNote == *notifiertype)// conformative alert + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL conformative alert")); + iMessage.Complete(iResponse); + iSessionCount--; + if (!iJobongoing) + StopServer(); + else + ShowConnectDialogAgainL(); + } + else //connecting note + { + iPkgZeroConnectionNoteShown = EFalse; + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL connecting note")); + if (iResponse == KErrCancel) + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL user cancelled \ + connection")); + if (iJobongoing) + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL job stop \ + requested")); + iSyncJob.StopL(); + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL job stop\ + done")); + } + DismissDialog(); + StopServer(); + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL connecting note \ + stopserver called")); + } + else // Launch indicator + { + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL Launch \ + Indicator")); + //Send the text id + _LIT(KFileName, "deviceupdates_"); + _LIT(KPath, "z:/resource/qt/translations/"); + TBool result = HbTextResolverSymbian::Init(KFileName, KPath); + if(result) + { + if(iDmIndicator == NULL) + iDmIndicator = CHbIndicatorSymbian::NewL(); + _LIT(KIndicatorTest, + "txt_deviceupdate_dblist_device_updates_val_connect_fota"); + // returns the string "Text test" + HBufC* text = HbTextResolverSymbian::LoadL(KIndicatorTest); + CleanupStack::PushL(text); + TPtr textptr = text->Des(); + CHbSymbianVariant* IndicatorText = CHbSymbianVariant::NewL( + &textptr, CHbSymbianVariant::EDes); + CleanupStack::PushL(IndicatorText); + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL Indicator activated")); + iDmIndicator->SetObserver(this); + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL indicator Observer set")); + iDmIndicator->Activate(KDMProgressIndicatorType,IndicatorText); + + iIndicatorLaunched = ETrue; + CleanupStack::PopAndDestroy(2); + } + } + } + FLOG(_L("CDmDeviceDialogServer::DevDialogResponseL End")); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::DeviceDialogClosed() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::DeviceDialogClosed(TInt /*aError*/) + { + FLOG(_L("CDmDeviceDialogServer::DeviceDialogClosed ")); + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::~CDmDeviceDialogServer() +// ---------------------------------------------------------------------------------------- +CDmDeviceDialogServer::~CDmDeviceDialogServer() + { + FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer()")); + if (iServerCloseRequest) + { + FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer() \ + iServerCloseRequest cancel)")); + iServerCloseRequest->Cancel(); + delete iServerCloseRequest; + iServerCloseRequest = NULL; + } + if (iDevDialog) + { + FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer():if loop)")); + iDevDialog->Cancel(); + delete iDevDialog; + } + if (iDmIndicator) + { + iDmIndicator->Deactivate(KDMProgressIndicatorType); + delete iDmIndicator; + } + FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer()job to close")); + if(iJobongoing) + iSyncJob.Close(); + iSyncMLSession.Close(); + FLOG(_L("CDmDeviceDialogServer::~CDmDeviceDialogServer() end")); + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::NewSessionL() +// ---------------------------------------------------------------------------------------- +CSession2* CDmDeviceDialogServer::NewSessionL(const TVersion&, + const RMessage2&) const + { + return new (ELeave) CDmDeviceDialogSession(); + } + +// ---------------------------------------------------------------------------- +// CDmDeviceDialogServer::PeriodicServerCloseL() +// ---------------------------------------------------------------------------- +void CDmDeviceDialogServer::PeriodicServerCloseL() + { + if (iServerCloseRequest) + { + FLOG(_L("CDmDeviceDialogServer::PeriodicServerCloseL() \ + :-iServerCloseRequest cancel ")); + iServerCloseRequest->Cancel(); + delete iServerCloseRequest; + iServerCloseRequest = NULL; + } + iServerCloseRequest = CPeriodic::NewL(EPriorityNormal); + iServerCloseRequest->Start(TTimeIntervalMicroSeconds32( + KRequestTriggerWaitTime * 5), TTimeIntervalMicroSeconds32( + KRequestTriggerWaitTime * 5), TCallBack(ShutDownL, this)); + FLOG(_L("CDmDeviceDialogServer::PeriodicServerCloseL():-Request logged)")); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::LaunchPkgZeroNoteL() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::LaunchPkgZeroNoteL(TInt &aProfileId, + TInt &aJobId, const TInt &aReplySlot, TInt &aUimode, + const RMessage2& aMessage) + { + FLOG(_L("CDmDeviceDialogSession::LaunchPkgZeroNoteL \ + called:")); + iProfileId = aProfileId; + iReplySlot = aReplySlot; + iJobId = aJobId; + iUimode = aUimode; + iMessage = aMessage; + CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(varMap); + + HBufC* notifierid = HBufC::NewL(10); + CleanupStack::PushL(notifierid); + *notifierid = KNotifierType; + + HBufC* profileid = HBufC::NewL(10); + CleanupStack::PushL(profileid); + *profileid = KProfileId; + + HBufC* uimode = HBufC::NewL(10); + CleanupStack::PushL(uimode); + *uimode = KUImode; + + HBufC* serverdisplay = HBufC::NewL(20); + CleanupStack::PushL(serverdisplay); + *serverdisplay = KServerdisplayname; + + HBufC* defaultprofile = HBufC::NewL(20); + CleanupStack::PushL(defaultprofile); + *defaultprofile = KFotaDefaultProfile; + + HBufC* timeout = HBufC::NewL(20); + CleanupStack::PushL(timeout); + *timeout = KPkgZeroTimeout; + + TInt profileId( KErrNotFound ); + TBool Isdefault = EFalse; + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) ); + if (err == KErrNone) + { + centrep->Get(KNSmlDMDefaultFotaProfileKey, profileId); + delete centrep; + centrep = NULL; + if (aProfileId == profileId) + Isdefault = ETrue; + } + TRAP( err, centrep = CRepository::NewL( KCRUidDeviceManagementInternalKeys) ); + TInt Timeout(KErrNone); + if (err == KErrNone) + { + centrep->Get(KDevManServerAlertTimeout, Timeout); + //Timeout has minutes, convert to milli second + Timeout = Timeout * 60 * 1000; + delete centrep; + centrep = NULL; + } + + TInt id = KDefaultNotifierId; + CHbSymbianVariant* notifieridvar = CHbSymbianVariant::NewL(&id, + CHbSymbianVariant::EInt); + CleanupStack::PushL(notifieridvar); + CHbSymbianVariant* infoprofileid = CHbSymbianVariant::NewL(&iProfileId, + CHbSymbianVariant::EInt); + CleanupStack::PushL(infoprofileid); + CHbSymbianVariant* infouimode = CHbSymbianVariant::NewL(&iUimode, + CHbSymbianVariant::EInt); + CleanupStack::PushL(infouimode); + RSyncMLDevManProfile DmProfile; + DmProfile.OpenL( iSyncMLSession, iProfileId, ESmlOpenRead ); + TBuf<256> servername= DmProfile.DisplayName(); + DmProfile.Close(); + CHbSymbianVariant* serverdisplayname = CHbSymbianVariant::NewL( + &servername, CHbSymbianVariant::EDes); + CleanupStack::PushL(serverdisplayname); + CHbSymbianVariant* defaultprofilevalue = CHbSymbianVariant::NewL( + &Isdefault, CHbSymbianVariant::EBool); + CleanupStack::PushL(defaultprofilevalue); + + CHbSymbianVariant* pkgzerotimeout = CHbSymbianVariant::NewL( + &Timeout, CHbSymbianVariant::EInt); + CleanupStack::PushL(pkgzerotimeout); + + varMap->Add(*notifierid, notifieridvar); + varMap->Add(*profileid, infoprofileid); + varMap->Add(*uimode, infouimode); + varMap->Add(*serverdisplay, serverdisplayname); + varMap->Add(*defaultprofile, defaultprofilevalue); + varMap->Add(*timeout, pkgzerotimeout); + CleanupStack::Pop(6); + if (iDevDialog == NULL) + iDevDialog = CHbDeviceDialogSymbian::NewL(); + else if (iAnyDialogDisplaying) + { + iDevDialog->Cancel(); + iAnyDialogDisplaying = EFalse; + } + else + { + } + err = + iDevDialog->Show(KDeviceDialogType, *varMap, this); + iPkgZeroQueryNoteDisplaying = ETrue; + FLOG(_L("CDmDeviceDialogSession::LaunchPkgZeroNoteL \ + err in devdialog is %d"), err); + iAnyDialogDisplaying = ETrue; + CleanupStack::PopAndDestroy(7); + FLOG(_L("CDmDeviceDialogSession::LaunchPkgZeroNoteL \ + end:")); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::StopServer() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::StopServer() + { + FLOG(_L("CDmDeviceDialogServer::StopServer Begin")); + if(!iStopServer && !iJobongoing) + { + iPkgZeroConnectionNoteShown = EFalse; + iStopServer = ETrue; + FLOG(_L("CDmDeviceDialogServer::StopServer Requested to shut down")); + TRAP_IGNORE(PeriodicServerCloseL()); + } + FLOG(_L("CDmDeviceDialogServer::StopServer Done")); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::OnSyncMLSessionEvent() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::OnSyncMLSessionEvent(TEvent aEvent, + TInt aIdentifier, TInt aError, TInt /*aAdditionalData*/) + { + FLOG(_L("[OMADM]\tDmDeviceDialogServer::OnSyncMLSessionEvent(),\ + aEvent = %d, aIdentifier = %d, aError = %d"), + aEvent, aIdentifier, aError); + if (iSyncJobId == aIdentifier && (aEvent == EJobStop || aEvent + == EJobStartFailed || aEvent == EJobRejected)) + { + FLOG(_L("[OMADM]\tDmDeviceDialogServer::OnSyncMLSessionEvent(), \ + ajob stoping" )); + iSyncJob.Close(); + iJobongoing = false; + //Stop the dialog + DismissDialog(); + StopServer(); + } + FLOG(_L( "[OMADM]\tDmDeviceDialogServer::OnSyncMLSessionEvent()end" )); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::DismissDialog() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::DismissDialog() + { + FLOG(_L("CDmDeviceDialogServer::dismissDialog ")); + + if (iDevDialog && iPkgZeroConnectionNoteShown && !iIndicatorLaunched) + { + FLOG(_L("CDmDeviceDialogServer::dismissDialog 3")); + iDevDialog->Cancel(); + iAnyDialogDisplaying = EFalse; + iPkgZeroConnectionNoteShown = EFalse; + } + if (iIndicatorLaunched) + { + FLOG( + _L("CDmDeviceDialogServer::dismissDialog deactivating indicator")); + iDmIndicator->Deactivate(KDMProgressIndicatorType); + FLOG( + _L("CDmDeviceDialogServer::dismissDialog deactivating indicator done")); + iIndicatorLaunched = false; + } + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::GetDMJobStatusL() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::GetDMJobStatusL() + { + FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL ")); + iSyncJob.OpenL(iSyncMLSession, iJobId); + FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL Job started ")); + iJobongoing = true; + iSyncJobId = iSyncJob.Identifier(); + TInt err = KErrNone; + // for MSyncMLEventObserver events + TRAP( err, iSyncMLSession.RequestEventL(*this) ); + FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL error %d"), err); + if (err != KErrNone) + { + iSyncJob.StopL(); + iSyncJob.Close(); + FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL leaving")); + User::Leave(err); + } + FLOG(_L("CDmDeviceDialogServer::GetDMJobStatusL end ")); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::IsConenctDialogDisplaying() +// ----------------------------------------------------------------------------- +TBool CDmDeviceDialogServer::IsConenctDialogDisplaying() + { + return iPkgZeroConnectionNoteShown; + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::ShowConnectDialogAgainL() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::ShowConnectDialogAgainL() + { + if (iJobongoing && !iIndicatorLaunched && !iPkgZeroConnectionNoteShown) + { + FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 1")); + CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(varMap); + TInt id = KConnectNotifierId; + HBufC* notifierid = HBufC::NewL(10); + CleanupStack::PushL(notifierid); + FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 2")); + *notifierid = KNotifierType; + CHbSymbianVariant* notifieridvar = CHbSymbianVariant::NewL(&id, + CHbSymbianVariant::EInt); + FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 3")); + varMap->Add(*notifierid, notifieridvar); + FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 4")); + if (iDevDialog == NULL) + { + iDevDialog = CHbDeviceDialogSymbian::NewL(); + FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 5")); + } + else if (iAnyDialogDisplaying) + iDevDialog->Cancel(); + else + { + } + iDevDialog->Show(KDeviceDialogType, *varMap, this); + iAnyDialogDisplaying = ETrue; + FLOG(_L("CDmDeviceDialogServer::ShowConnectDialogAgain 6")); + iPkgZeroConnectionNoteShown = ETrue; + CleanupStack::PopAndDestroy(2); + } + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::ShowDisplayalertL() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::ShowDisplayalertL(const TDesC& aAlertText, + const RMessage2& aMessage) + { + FLOG(_L("CDmDeviceDialogServer::ShowDisplayalert ")); + iMessage = aMessage; + CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(varMap); + HBufC* keyBuf = HBufC::NewL(25); + CleanupStack::PushL(keyBuf); + *keyBuf = KNotifierType; + HBufC* servalertType = HBufC::NewL(25); + CleanupStack::PushL(servalertType); + *servalertType = KServerpushalertInfo; + TInt id = 0; + CHbSymbianVariant* notifierid = CHbSymbianVariant::NewL(&id, + CHbSymbianVariant::EInt); + varMap->Add(*keyBuf, notifierid); + CHbSymbianVariant* serveralertmsg = CHbSymbianVariant::NewL(&aAlertText, + CHbSymbianVariant::EDes); + varMap->Add(*servalertType, serveralertmsg); // takes ownership + FLOG(_L("CDmDeviceDialogServer::ShowDisplayalert before newl")); + if (iDevDialog == NULL) + iDevDialog = CHbDeviceDialogSymbian::NewL(); + else if (iAnyDialogDisplaying) + { + iDevDialog->Cancel(); + } + else + { + } + FLOG(_L("CDmDeviceDialogServer::ShowDisplayalert before show")); + iDevDialog->Show(KDeviceDialogType, *varMap, this); + iAnyDialogDisplaying = ETrue; + CleanupStack::PopAndDestroy(3); + } + +// ----------------------------------------------------------------------------- +// CDmDeviceDialogServer::ShowConfirmationalertL() +// ----------------------------------------------------------------------------- +void CDmDeviceDialogServer::ShowConfirmationalertL(const TInt& /*aTimeOut*/, + const TDesC& /*aHeader*/, const TDesC& aText, const RMessage2& aMessage) + { + iMessage = aMessage; + CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(varMap); + HBufC* keyBuf = HBufC::NewL(25); + CleanupStack::PushL(keyBuf); + *keyBuf = KNotifierType; + HBufC* servalertType = HBufC::NewL(25); + CleanupStack::PushL(servalertType); + *servalertType = KServerpushalertConfirm; + TInt id = 0; + CHbSymbianVariant* notifierid = CHbSymbianVariant::NewL(&id, + CHbSymbianVariant::EInt); + varMap->Add(*keyBuf, notifierid); + CHbSymbianVariant* serveralertmsg = CHbSymbianVariant::NewL(&aText, + CHbSymbianVariant::EDes); + varMap->Add(*servalertType, serveralertmsg); // takes ownership + if (iDevDialog == NULL) + iDevDialog = CHbDeviceDialogSymbian::NewL(); + else if (iAnyDialogDisplaying) + iDevDialog->Cancel(); + else + { + } + iDevDialog->Show(KDeviceDialogType, *varMap, this); + iAnyDialogDisplaying = ETrue; + CleanupStack::PopAndDestroy(3); + } + + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::NewAsyncRequest() +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogServer::NewAsyncRequest() + { + iSessionCount++; + } +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::RequestPending() +// Any request pending +// ---------------------------------------------------------------------------------------- +TBool CDmDeviceDialogServer::RequestPending() + { + if( iSessionCount > 0 ) + { + return ETrue; + } + return EFalse; + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::CancelServerCloseRequest() +// Cancels Server shutdown +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogServer::CancelServerCloseRequest() + { + FLOG(_L("CDmDeviceDialogServer::CancelServerCloseRequest():-begin)")); + if(iServerCloseRequest) + { + FLOG(_L("CDmDeviceDialogServer::CancelServerCloseRequest():-iServerCloseRequest cancel)")); + iServerCloseRequest->Cancel(); + delete iServerCloseRequest; + iServerCloseRequest = NULL; + } + FLOG(_L("CDmDeviceDialogServer::CancelServerCloseRequest():-end)")); + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::IsPkgZeroNoteDisplaying() +// ---------------------------------------------------------------------------------------- +TBool CDmDeviceDialogServer::IsPkgZeroNoteDisplaying() + { + FLOG(_L("CDmDeviceDialogServer::IsPkgZeroNoteDisplaying())")); + return iPkgZeroQueryNoteDisplaying; + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::CancelPendingServerAlert() +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogServer::CancelPendingServerAlert() + { + FLOG(_L("CDmDeviceDialogServer::CancelPendingServerAlert())")); + if(IsPkgZeroNoteDisplaying()) + { + iSessionCount--; + iDevDialog->Cancel(); + iPkgZeroQueryNoteDisplaying = EFalse; + iMessage.Complete(KErrCancel); + FLOG(_L("CDmDeviceDialogServer::CancelPendingServerAlert() cancelled")); + } + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogServer::IndicatorUserActivated() +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogServer::IndicatorUserActivated (const TDesC& /*aType*/, + CHbSymbianVariantMap& /*aData*/) + { + //Deactivate the indicator done by plugin + FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated()")); + if (iDmIndicator) + { + //Indicator deactivated on plugin side + FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() Indicator \ + deactivated")); + iIndicatorLaunched = EFalse; + FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() connect \ + dialog to be activated")); + TRAP_IGNORE(ShowConnectDialogAgainL()); + FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() connect \ + dialog activated")); + } + FLOG(_L("CDmDeviceDialogServer::IndicatorUserActivated() end")); + } +//End of file diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/dmdevdialogserver/src/dmdevicedialogsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/dmdevdialogserver/src/dmdevicedialogsession.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,235 @@ +/* + * 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 DM Device Dialogs + */ + +#include "dmdevicedialogsession.h" +#include "dmdevdialogclientserver.h" + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogSession::CDmDeviceDialogSession +// ---------------------------------------------------------------------------------------- +CDmDeviceDialogSession::CDmDeviceDialogSession() + { + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogSession::~CDmDeviceDialogSession +// ---------------------------------------------------------------------------------------- +CDmDeviceDialogSession::~CDmDeviceDialogSession() + { + FLOG(_L("CDmDeviceDialogSession::~CDmDeviceDialogSession-- begin")); + if ( !Server().RequestPending() ) + { + FLOG(_L("CDmDeviceDialogSession::~CDmDeviceDialogSession Stopserver")); + Server().StopServer(); + } + FLOG(_L("CDmDeviceDialogSession::~CDmDeviceDialogSession-- end")); + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogSession::Server +// ---------------------------------------------------------------------------------------- +CDmDeviceDialogServer& CDmDeviceDialogSession::Server() + { + return *static_cast (const_cast (CSession2::Server())); + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogSession::CheckClientSecureIdL +// ---------------------------------------------------------------------------------------- +TBool CDmDeviceDialogSession::CheckClientSecureId(const RMessage2& aMessage) + { + TUid fota = TUid::Uid(KFotaServerUid); + TUid sosserver = TUid::Uid(KSosServerUid); + TUid scomo = TUid::Uid(KScomoServerUid); + + // Fotaserver + if (aMessage.SecureId() == fota.iUid) + { + FLOG(_L("[CDmDeviceDialogSession] CheckClientSecureId client is \ + fotaserver!")); + return ETrue; + } + + // Sosserver + else if (aMessage.SecureId() == sosserver.iUid) + { + FLOG(_L("[CDmDeviceDialogSession] CheckClientSecureId client is \ + sosserver!")); + return ETrue; + } + // Scomoserver + else if (aMessage.SecureId() == scomo.iUid) + { + FLOG(_L("[CDmDeviceDialogSession] CheckClientSecureId client is \ + SCOMO server!")); + return ETrue; + } + // test app + else if (aMessage.SecureId() == 0x102073E4) + { + FLOG(_L("[CDmDeviceDialogSession] CheckClientSecureId client is \ + testapp!")); + return ETrue; + } + else + { + FLOG(_L("[CDmDeviceDialogSession] CheckClientSecureId client 0x%X is\ + unknown (msg %d), bailing out"), + aMessage.SecureId().iId, aMessage.Function()); + } + return EFalse; + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogSession::ServiceL +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogSession::ServiceL(const RMessage2& aMessage) + { + RThread clt; + aMessage.ClientL(clt); + TFullName cltnm = clt.FullName(); + FLOG(_L( "CDmDeviceDialogSession::ServiceL %d serving for %S?" ), + aMessage.Function(), &cltnm); + if (CheckClientSecureId(aMessage)) + { + FLOG(_L( "CDmDeviceDialogSession::ServiceL access ok")); + Server().CancelServerCloseRequest(); + if(!Server().IsPkgZeroNoteDisplaying() || aMessage.Function() == + ECancelServerAlert ) + { + TRAPD(err,DispatchMessageL(aMessage)); + FLOG(_L( "CDmDeviceDialogSession::ServiceL err is %d"), err); + User::LeaveIfError(err); + } + else //User not responded to earlier package zero, so no other services + { + FLOG(_L( "CDmDeviceDialogSession::ServiceL server is busy")); + aMessage.Complete(KErrServerBusy); + } + } + else + { + FLOG(_L( "CDmDeviceDialogSession::ServiceL access denied")); + aMessage.Complete(KErrAccessDenied); + } + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogSession::ServiceError +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogSession::ServiceError(const RMessage2& aMessage, + TInt aError) + { + CSession2::ServiceError(aMessage, aError); + } + +// ---------------------------------------------------------------------------------------- +// CDmDeviceDialogSession::DispatchMessageL +// ---------------------------------------------------------------------------------------- +void CDmDeviceDialogSession::DispatchMessageL(const RMessage2& aMessage) + { + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL-begin")); + iMessage = aMessage; + switch (aMessage.Function()) + { + case EServerAlert: + { + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL \ + Server alert case:")); + TInt Uimode = aMessage.Int2(); + if (Uimode == CDmDeviceDialogServer::ESANSilent) + aMessage.Complete(KErrNone); + else + { + Server().NewAsyncRequest(); + TInt ProfileId = aMessage.Int0(); + TInt JobId = aMessage.Int1(); + TInt ReplySlot = 3; + Server().LaunchPkgZeroNoteL(ProfileId, JobId, ReplySlot, Uimode, + iMessage); + } + } + break; + case EPkgConnectNoteIsActive: + { + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL EPkgZeroOngoing \ + case:")); + TBool ret = Server().IsConenctDialogDisplaying(); + TPckgBuf callactive(ret); + aMessage.WriteL(0, callactive); + aMessage.Complete(KErrNone); + } + break; + case EPkgZeroConnectNoteDismiss: + { + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL \ + EPkgZeroConnectNoteDismiss case:")); + if (Server().IsConenctDialogDisplaying()) + Server().DismissDialog(); + aMessage.Complete(KErrNone); + } + break; + case EPkgZeroConnectNoteShowAgain: + { + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL \ + EPkgZeroConnectNoteShow case:")); + if (!Server().IsConenctDialogDisplaying()) + Server().ShowConnectDialogAgainL(); + aMessage.Complete(KErrNone); + } + break; + case EShowDisplayAlert: + { + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL \ + EDisplayAlert case:")); + HBufC* alerttext = HBufC::NewLC(aMessage.GetDesLengthL(0)); + TPtr bufPtr = alerttext->Des(); + aMessage.ReadL(0, bufPtr, 0); + Server().NewAsyncRequest(); + Server().ShowDisplayalertL(bufPtr, iMessage); + CleanupStack::PopAndDestroy(); + } + break; + case EShowConfirmationalert: + { + HBufC* alerttext = HBufC::NewLC(aMessage.GetDesLengthL(2)); + TPtr alerttxtptr = alerttext->Des(); + aMessage.ReadL(2, alerttxtptr); + HBufC* alertheader = HBufC::NewLC(aMessage.GetDesLengthL(1)); + TPtr alertheaderptr = alertheader->Des(); + aMessage.ReadL(1, alertheaderptr); + Server().NewAsyncRequest(); + Server().ShowConfirmationalertL(aMessage.Int0(), alertheaderptr, + alerttxtptr, iMessage); + CleanupStack::PopAndDestroy(2); + } + break; + case ECancelServerAlert: + { + Server().CancelPendingServerAlert(); + aMessage.Complete(KErrNone); + } + break; + default: + { + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL default case: \ + and a leave happened")); + User::Leave(KErrArgument); + } + } + FLOG(_L("CDmDeviceDialogSession::DispatchMessageL:end")); + } +//End of file diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,29 @@ +/* +* 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: Build info file for Device management notification +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT +PRJ_EXPORTS + +../rom/devicemgmtnotifications.iby CORE_MW_LAYER_IBY_EXPORT_PATH(devicemgmtnotifications.iby) + +PRJ_MMPFILES + +#include "../dmdevdialogclient/bld/bld.inf" +#include "../dmdevdialogserver/bld/bld.inf" diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/inc/dmdevdialogclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/inc/dmdevdialogclientserver.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,43 @@ +/* +* 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 DM Device Dialogs +* This is part of syncmlfw. +*/ + +#ifndef __DMDEVDIALOG_CONSTS_H__ +#define __DMDEVDIALOG_CONSTS_H__ + +#include +#include + +// server name +_LIT(KDMDEVDIALOGSERVER,"dmdevicedialog"); + +const TInt KDmDevDialogServerVersionMinor = 0; +const TInt KDmDevDialogServerVersionMajor = 1; +const TUint KDefaultMessageSlots=4; +const TUint KDmDevDialogUid = 0x2002FF68; + +enum TNotifiertype +{ + EServerAlert, + EPkgConnectNoteIsActive, + EPkgZeroConnectNoteDismiss, + EPkgZeroConnectNoteShowAgain, + EShowDisplayAlert, + EShowConfirmationalert, + ECancelServerAlert + +}; +#endif diff -r a36219ae6585 -r 2e64dc50f295 devicemgmtnotifications/rom/devicemgmtnotifications.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devicemgmtnotifications/rom/devicemgmtnotifications.iby Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + + +#include + +#ifndef __DMNOTFIFICATIONS_IBY__ +#define __DMNOTFIFICATIONS_IBY__ + +#ifdef __SYNCML_DM // nothing should be installed from this .iby file if __SYNCML_DM feature is not selected + + + +REM DM Device Dialog Client +file=ABI_DIR\BUILD_DIR\dmdevdialogclient.dll SHARED_LIB_DIR\dmdevdialogclient.dll + +REM DM Device Dialog Server +file=ABI_DIR\BUILD_DIR\dmdevicedialog.exe PROGRAMS_DIR\dmdevicedialog.exe + +#endif //__SYNCML_DM + +#endif //__DMNOTFIFICATIONS_IBY__ diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaEngine/BWINS/fotaengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaEngine/BWINS/fotaengineu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,24 @@ +EXPORTS + ?GetUpdatePackageIds@RFotaEngineSession@@QAEHAAVTDes16@@@Z @ 1 NONAME ; int RFotaEngineSession::GetUpdatePackageIds(class TDes16 &) + ?TryResumeDownload@RFotaEngineSession@@QAEHH@Z @ 2 NONAME ; int RFotaEngineSession::TryResumeDownload(int) + ?CurrentVersion@RFotaEngineSession@@QAEHAAVTDes16@@@Z @ 3 NONAME ; int RFotaEngineSession::CurrentVersion(class TDes16 &) + ?Update@RFotaEngineSession@@QAEHHHABVTDesC8@@0@Z @ 4 NONAME ; int RFotaEngineSession::Update(int, int, class TDesC8 const &, class TDesC8 const &) + ?GetResult@RFotaEngineSession@@QAEHH@Z @ 5 NONAME ; int RFotaEngineSession::GetResult(int) + ?GetCurrentFirmwareDetailsL@RFotaEngineSession@@QAEXAAVTDes8@@0AAH@Z @ 6 NONAME ; void RFotaEngineSession::GetCurrentFirmwareDetailsL(class TDes8 &, class TDes8 &, int &) + ?Close@RFotaEngineSession@@QAEXXZ @ 7 NONAME ; void RFotaEngineSession::Close(void) + ?OpenL@RFotaEngineSession@@QAEXXZ @ 8 NONAME ; void RFotaEngineSession::OpenL(void) + ?GetState@RFotaEngineSession@@QAE?AW4TState@1@H@Z @ 9 NONAME ; enum RFotaEngineSession::TState RFotaEngineSession::GetState(int) + ?GenericAlertSentL@RFotaEngineSession@@QAEXH@Z @ 10 NONAME ; void RFotaEngineSession::GenericAlertSentL(int) + ?ScheduledUpdateL@RFotaEngineSession@@QAEHVTFotaScheduledUpdate@@@Z @ 11 NONAME ; int RFotaEngineSession::ScheduledUpdateL(class TFotaScheduledUpdate) + ?Version@RFotaEngineSession@@QBE?AVTVersion@@XZ @ 12 NONAME ; class TVersion RFotaEngineSession::Version(void) const + ?PauseDownload@RFotaEngineSession@@QAEHXZ @ 13 NONAME ; int RFotaEngineSession::PauseDownload(void) + ?DownloadAndUpdate@RFotaEngineSession@@QAEHHABVTDesC8@@H00H@Z @ 14 NONAME ; int RFotaEngineSession::DownloadAndUpdate(int, class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &, int) + ?LastUpdate@RFotaEngineSession@@QAEHAAVTTime@@@Z @ 15 NONAME ; int RFotaEngineSession::LastUpdate(class TTime &) + ?Download@RFotaEngineSession@@QAEHHABVTDesC8@@H00H@Z @ 16 NONAME ; int RFotaEngineSession::Download(int, class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &, int) + ?DeleteUpdatePackage@RFotaEngineSession@@QAEHH@Z @ 17 NONAME ; int RFotaEngineSession::DeleteUpdatePackage(int) + ??0RFotaEngineSession@@QAE@XZ @ 18 NONAME ; RFotaEngineSession::RFotaEngineSession(void) + ?UpdatePackageDownloadComplete@RFotaEngineSession@@QAEXH@Z @ 19 NONAME ; void RFotaEngineSession::UpdatePackageDownloadComplete(int) + ?OpenUpdatePackageStore@RFotaEngineSession@@QAEHHAAPAVRWriteStream@@@Z @ 20 NONAME ; int RFotaEngineSession::OpenUpdatePackageStore(int, class RWriteStream * &) + ?IsPackageStoreSizeAvailable@RFotaEngineSession@@QAEHH@Z @ 21 NONAME ; int RFotaEngineSession::IsPackageStoreSizeAvailable(int) + ?GetDownloadUpdatePackageSize@RFotaEngineSession@@QAEHHAAH0@Z @ 22 NONAME ; int RFotaEngineSession::GetDownloadUpdatePackageSize(int, int &, int &) + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaEngine/INC/fotaenginedebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaEngine/INC/fotaenginedebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2005-2006 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 defines logging macros +* +*/ + + + +#ifndef FOTADEBUG_H +#define FOTADEBUG_H + + // IMPORT_C static TInt Print(TRefByValue aFmt,...); + #ifdef _FOTA_DEBUG + + #include + #include + #include + #include + + _LIT( KLogFile, "fotaengine.log" ); + _LIT( KLogDirFullName, "c:\\logs\\" ); + _LIT( KLogDir, "fota" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + + #ifdef _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else // _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // _FOTA_DEBUG_RDEBUG + + #else // _FOTA_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _FOTA_DEBUG + +#endif // FOTADEBUG_H + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaEngine/SRC/fotaengine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaEngine/SRC/fotaengine.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,416 @@ +/* +* Copyright (c) 2005 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 for fotaserver +* +*/ + + +// INCLUDES +#include +#include +#include "FotaIPCTypes.h" +#include "fotaConst.h" +#include "fotaenginedebug.h" +#include + + + +// =================== LOCAL FUNCTIONS ======================================== + + +// --------------------------------------------------------------------------- +// StartServerL() +// Starts Fota Downlaod Interrupt Monitory server +// --------------------------------------------------------------------------- +TInt StartServerL() + { + FLOG(_L("StartServerLt Started")); + TInt res = KErrNone; + + RProcess server; + RSemaphore sem; + res = sem.CreateGlobal(KFotaServerScem, EOwnerProcess); + + res=server.Create(KFotaServerName,KNullDesC); + FLOG(_L("StartServerL-- create server error as %d"),res); + if (res!=KErrNone) + { + return res; + } + + server.Resume(); // logon OK - start the server + + sem.Wait(); + sem.Close(); + server.Close(); + + FLOG(_L("StartServerL-- server.ExitType() returns %d"),res); + + return res; + } + +/** + * Connects to the server using 4 message slots. + */ +TBool RFotaEngineSession::connectToHbServer() +{ + FLOG(_L("RFotaEngineSession::connectToHbServer >>")); + + TInt error = CreateSession(KFotaServerName,TVersion(1,0,0),2); + + if (KErrNone != error) { + FLOG(_L("RFotaEngineSession::Error: %d"), error); + } + FLOG(_L("RFotaEngineSession::connectToHbServer <<")); + return (KErrNone == error); +} + +// --------------------------------------------------------------------------- +// RFotaEngineSession::OpenL( ) +// Opens session to fotaserver. +// --------------------------------------------------------------------------- +EXPORT_C void RFotaEngineSession::OpenL( ) +{ + RProcess pr; TFullName fn = pr.FullName(); + + TInt res = KErrNone; + FLOG(_L("[RFotaEngineSession] OpenL\tcalled by '%S' >>"),&fn ); + + res = connectToHbServer(); + if(!res) + { + FLOG(_L("Creation of session failed with error: %d; starting the server now..."), res); + res = StartServerL(); + + FLOG(_L("Starting of the server, error = %d"), res); + User::LeaveIfError( res ); + + res = CreateSession( KFotaServerName,TVersion(1,0,0),2 ); + FLOG(_L("Creation of session, error: %d; "), res); + User::LeaveIfError (res); + + } + + FLOG(_L("[RFotaEngineSession]\tconnected <<") ); +} + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::Close( ) +// Closes session to fotaserver +// --------------------------------------------------------------------------- +EXPORT_C void RFotaEngineSession::Close( ) +{ + RProcess pr; TFullName fn = pr.FullName(); + FLOG(_L("[RFotaEngineSession] RFotaEngineSession::Close() >> called by '%S'"),&fn ); + + // Tell server that generic alert is sent for this pkg, so state is + // cleaned up + FLOG(_L("iGenericAlertSentPkgID = %d"), iGenericAlertSentPkgID); + if ( iGenericAlertSentPkgID != -1 ) + { + TInt err = SendReceive( EGenericAlertSentForPackage + , TIpcArgs(iGenericAlertSentPkgID) ); + } + + RSessionBase::Close(); + FLOG(_L("[RFotaEngineSession] RFotaEngineSession::Close() <<") ); +} + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::Download +// Starts download of upd package. +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::Download(const TInt aPkgId + , const TDesC8& aPkgURL, const TSmlProfileId aProfileId + , const TDesC8& aPkgName, const TDesC8& aPkgVersion, TBool aSilent) +{ + TInt err; + TDownloadIPCParams ipcparam; + ipcparam.iPkgId = aPkgId; + ipcparam.iProfileId = aProfileId; + ipcparam.iPkgName.Copy (aPkgName); + ipcparam.iPkgVersion.Copy (aPkgVersion); + TPckg pkg(ipcparam); + err = SendReceive ( EFotaDownload , TIpcArgs(&pkg, &aPkgURL, aSilent)); + return err; +} + +// --------------------------------------------------------------------------- +// RFotaEngineSession::DownloadAndUpdate +// Starts download and update of update pakcage +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::DownloadAndUpdate(const TInt aPkgId + ,const TDesC8& aPkgURL, const TSmlProfileId aProfileId + ,const TDesC8& aPkgName, const TDesC8& aPkgVersion, TBool aSilent) +{ + TInt err; + TDownloadIPCParams ipcparam; + ipcparam.iPkgId = aPkgId; + ipcparam.iProfileId = aProfileId; + ipcparam.iPkgName.Copy (aPkgName); + ipcparam.iPkgVersion.Copy (aPkgVersion); + TPckg pkg(ipcparam); + err = SendReceive( EFotaDownloadAndUpdate, TIpcArgs(&pkg, &aPkgURL, aSilent)); + return err; +} + +// --------------------------------------------------------------------------- +// RFotaEngineSession::Update +// Starts update of update package +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::Update(const TInt aPkgId + ,const TSmlProfileId aProfileId, const TDesC8& aPkgName + ,const TDesC8& aPkgVersion) +{ + TInt err; + TDownloadIPCParams ipcparam; + ipcparam.iPkgId = aPkgId; + ipcparam.iProfileId = aProfileId; + ipcparam.iPkgName.Copy (aPkgName); + ipcparam.iPkgVersion.Copy (aPkgVersion); + TPckg pkg(ipcparam); + err = SendReceive ( EFotaUpdate , TIpcArgs(&pkg)); + return err; +} + +// -------------------------------------------------------------------------- +// RFotaEngineSession::PauseDownload +// To pause the download +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::PauseDownload ( ) + { + TInt err(KErrNotSupported); + + err = SendReceive( EPauseDownload ); + + return err; + } + +// --------------------------------------------------------------------------- +// RFotaEngineSession::TryResumeDownload +// Requests to resume the suspended download of the update package. +// Implementation is not ready and will be provided later. +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::TryResumeDownload(TBool aSilent) + { + FLOG(_L("RFotaEngineSession::TryResumeDownload >>")); + + TInt err = KErrNone; + + err = SendReceive( EFotaTryResumeDownload, TIpcArgs( aSilent) ); + + FLOG(_L("RFotaEngineSession::TryResumeDownload << err = %d" ),err); + return err; + } + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::GetState +// --------------------------------------------------------------------------- +EXPORT_C RFotaEngineSession::TState RFotaEngineSession::GetState( + const TInt aPkgId) + { + FLOG(_L("RFotaEngineSession::GetState >>")); + + RFotaEngineSession::TState state; + TPckg pkgstate(state); + SendReceive ( EGetState , TIpcArgs(aPkgId, &pkgstate)); + FLOG(_L("RFotaEngineSession::GetState <<")); + + return state; + } + +// --------------------------------------------------------------------------- +// RFotaEngineSession::GetResult +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::GetResult(const TInt aPkgId) + { + FLOG(_L("RFotaEngineSession::GetResult")); + TInt result; + TPckg pkgresult(result); + SendReceive ( EGetResult , TIpcArgs(aPkgId, &pkgresult)); + return result; + } + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::DeleteUpdatePackage +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::DeleteUpdatePackage(const TInt aPkgId) +{ + TInt err = SendReceive(EDeletePackage, TIpcArgs(aPkgId) ); + return err; +} + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::LastUpdate +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::LastUpdate(TTime& aUpdates) + { + TInt err; + FLOG(_L("RFotaEngineSession::LastUpdate >>")); + TBuf<15> timestamp; + err = SendReceive ( EGetUpdateTimestamp, TIpcArgs(×tamp) ); + + if ( timestamp.Length() > 0 ) + { + TInt year = timestamp[0]; + TInt month = timestamp[1]; + TInt day = timestamp[2]; + TInt hour = timestamp[3]; + TInt minute = timestamp[4]; + aUpdates = TDateTime (year,(TMonth)month,day,hour,minute,0,0 ); + } + else + { + aUpdates.Set( _L( "19900327:101010.000000" ) ); + err = KErrUnknown; + } + FLOG(_L("RFotaEngineSession::LastUpdate <<")); + return err; + } + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::CurrentVersion +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::CurrentVersion(TDes& aSWVersion) + { + aSWVersion.Copy(_L("1.0")); + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::RFotaEngineSession +// --------------------------------------------------------------------------- +EXPORT_C RFotaEngineSession::RFotaEngineSession() : iGenericAlertSentPkgID(-1) + { + FLOG(_L("RFotaEngineSession::RFotaEngineSession() >>")); + FLOG(_L("RFotaEngineSession::RFotaEngineSession() <<")); + } + + +// --------------------------------------------------------------------------- +// RFotaEngineSession::GetUpdatePackageIds +// Gets ids of the update packages present in the system. +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::GetUpdatePackageIds(TDes16& aPackageIdList) + { + TInt err; + FLOG(_L("RFotaEngineSession::GetUpdatePackageIds >>")); + TBuf<10> b; b.Copy(_L("dkkd")); + TPkgIdList pkgids; + TPckg pkgids_pkg(pkgids); + TIpcArgs args ( &pkgids_pkg); + err = SendReceive ( EGetUpdatePackageIds, args); + aPackageIdList.Copy(pkgids); + FLOG(_L("RFotaEngineSession::GetUpdatePackageIds <<")); + return err; + } + + +EXPORT_C TVersion RFotaEngineSession::Version() const + { + TVersion version (1,0,0); + + return version; + } + +// --------------------------------------------------------------------------- +// RFotaEngineSession::GenericAlertSentL +// marks genereic alert being sent +// --------------------------------------------------------------------------- +EXPORT_C void RFotaEngineSession::GenericAlertSentL ( const TInt aPackageID ) + { + FLOG(_L("RFotaEngineSession::GenericAlertSentL, aPackageID = %d >>"),aPackageID); + iGenericAlertSentPkgID = aPackageID; + FLOG(_L("RFotaEngineSession::GenericAlertSentL, iGenericAlertSentPkgID = %d <<"), iGenericAlertSentPkgID); + } + +// --------------------------------------------------------------------------- +// RFotaEngineSession::ScheduledUpdateL +// Update fw +// --------------------------------------------------------------------------- +EXPORT_C TInt RFotaEngineSession::ScheduledUpdateL ( const TFotaScheduledUpdate aSchedule ) + { + TInt err(KErrNotSupported); + + TPckg p(aSchedule); + err = SendReceive( EScheduledUpdate, TIpcArgs(&p) ); + + return err; + } + +EXPORT_C void RFotaEngineSession::GetCurrentFirmwareDetailsL(TDes8& aName, TDes8& aVersion, TInt& aSize) + { + FLOG(_L("RFotaEngineSession::GetCurrentFirmwareDetailsL >>")); + + TPckg pkgsize(aSize); + + __ASSERT_ALWAYS(aName.MaxLength() >= KFotaMaxPkgNameLength, User::Leave(KErrArgument) ); + __ASSERT_ALWAYS(aName.MaxLength() >= KFotaMaxPkgVersionLength, User::Leave(KErrArgument) ); + + TInt err = SendReceive(EGetCurrFwDetails, TIpcArgs(&aName, &aVersion, &pkgsize)); + + FLOG(_L("RFotaEngineSession::GetCurrentFirmwareDetailsL, err = %d <<"), err); + User::LeaveIfError(err); + } + +// --------------------------------------------------------------------------- +// RFotaEngineSession::ServiceUid +// Apparc asks which session class to create in server side +// --------------------------------------------------------------------------- +TUid RFotaEngineSession::ServiceUid() const + { + RProcess pr; TFullName fn = pr.FullName(); + FLOG(_L( "RFotaEngineSession::ServiceUid() >> called by: %S" ), &fn ); + FLOG(_L( "RFotaEngineSession::ServiceUid() << ret: 0x%X" ), + KFotaServiceUid ); + return TUid::Uid( KFotaServiceUid ); + } + +/* + * The following exported functions are not supported in SF4 + * They would be removed once stakeholder remove dependency with them. + * Polonium CR: 530 + */ + +EXPORT_C TBool RFotaEngineSession::IsPackageStoreSizeAvailable( + const TInt aSize) + { + return EFalse; + } + +EXPORT_C TInt RFotaEngineSession::OpenUpdatePackageStore(const TInt aPkgId, + RWriteStream*& aPkgStore) + { + return KErrNotSupported; + } + +EXPORT_C TInt RFotaEngineSession::GetDownloadUpdatePackageSize( + const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize) + { + return KErrNotSupported; + } + +EXPORT_C void RFotaEngineSession::UpdatePackageDownloadComplete( + const TInt aPkgId) + { + + } + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaEngine/eabi/fotaengineu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaEngine/eabi/fotaengineu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,25 @@ +EXPORTS + _ZN18RFotaEngineSession10LastUpdateER5TTime @ 1 NONAME + _ZN18RFotaEngineSession13PauseDownloadEv @ 2 NONAME + _ZN18RFotaEngineSession14CurrentVersionER6TDes16 @ 3 NONAME + _ZN18RFotaEngineSession16ScheduledUpdateLE20TFotaScheduledUpdate @ 4 NONAME + _ZN18RFotaEngineSession17DownloadAndUpdateEiRK6TDesC8iS2_S2_i @ 5 NONAME + _ZN18RFotaEngineSession17GenericAlertSentLEi @ 6 NONAME + _ZN18RFotaEngineSession17TryResumeDownloadEi @ 7 NONAME + _ZN18RFotaEngineSession19DeleteUpdatePackageEi @ 8 NONAME + _ZN18RFotaEngineSession19GetUpdatePackageIdsER6TDes16 @ 9 NONAME + _ZN18RFotaEngineSession26GetCurrentFirmwareDetailsLER5TDes8S1_Ri @ 10 NONAME + _ZN18RFotaEngineSession5CloseEv @ 11 NONAME + _ZN18RFotaEngineSession5OpenLEv @ 12 NONAME + _ZN18RFotaEngineSession6UpdateEiiRK6TDesC8S2_ @ 13 NONAME + _ZN18RFotaEngineSession8DownloadEiRK6TDesC8iS2_S2_i @ 14 NONAME + _ZN18RFotaEngineSession8GetStateEi @ 15 NONAME + _ZN18RFotaEngineSession9GetResultEi @ 16 NONAME + _ZN18RFotaEngineSessionC1Ev @ 17 NONAME + _ZN18RFotaEngineSessionC2Ev @ 18 NONAME + _ZNK18RFotaEngineSession7VersionEv @ 19 NONAME + _ZN18RFotaEngineSession22OpenUpdatePackageStoreEiRP12RWriteStream @ 20 NONAME + _ZN18RFotaEngineSession27IsPackageStoreSizeAvailableEi @ 21 NONAME + _ZN18RFotaEngineSession28GetDownloadUpdatePackageSizeEiRiS0_ @ 22 NONAME + _ZN18RFotaEngineSession29UpdatePackageDownloadCompleteEi @ 23 NONAME + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaEngine/group/fotaengine.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaEngine/group/fotaengine.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2005-2006 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: Project specification file for fotaengine +* +*/ + + + +#include +#include + +//MACRO _FOTA_DEBUG +//MACRO _FOTA_DEBUG_RDEBUG + +TARGET fotaengine.dll +TARGETTYPE DLL +UID 0x1000008d 0x102072C5 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../SRC +SOURCE fotaengine.cpp +//SOURCE fotaengstream.cpp +SOURCEPATH ../../inc +SOURCE FotaIPCTypes.cpp + +USERINCLUDE ../INC ../../inc ../../cenrep + +MW_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/uiklaf/private + +LIBRARY avkon.lib +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY bafl.lib +LIBRARY apgrfx.lib +LIBRARY mtur.lib +LIBRARY eikcore.lib +LIBRARY efsrv.lib +LIBRARY ws32.lib // wssession +LIBRARY centralrepository.lib +LIBRARY flogger.lib + +SMPSAFE + +//End of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaScheduleHandler/group/fotaschedulehandler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaScheduleHandler/group/fotaschedulehandler.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2005-2006 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: Handles scheduled update, starts fotaserver and request upd +* +*/ + + + +#include +#include + +//MACRO _FOTA_DEBUG +//MACRO _FOTA_DEBUG_RDEBUG + + +TARGET fotaschedulehandler.exe +TARGETTYPE EXE + +EPOCSTACKSIZE 0x5400 + +UID 0x100039CE 0x101F99FA + +// set vendor id (from defaultcaps.hrh) +VENDORID VID_DEFAULT + +// set dll capability (from defaultcaps.hrh) +CAPABILITY CAP_APPLICATION + + +SOURCEPATH ../src + +SOURCE fotaschedulehandler.cpp + +USERINCLUDE . +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY schsvr.lib +LIBRARY fotaengine.lib +LIBRARY flogger.lib + +SMPSAFE \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaScheduleHandler/inc/FotaSchedDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaScheduleHandler/inc/FotaSchedDebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2005 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 defines logging macros +* +*/ + + + +#ifndef FOTADEBUG_H +#define FOTADEBUG_H + + #ifdef _FOTA_DEBUG + + + #include + #include + #include + #include + + _LIT( KLogFile, "fotaschedhandler.log" ); + _LIT( KLogDir, "fota" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + + #ifdef _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else // _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // _FOTA_DEBUG_RDEBUG + + #else // _FOTA_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _FOTA_DEBUG + +#endif // FOTADEBUG_H + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/FotaScheduleHandler/src/fotaschedulehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/FotaScheduleHandler/src/fotaschedulehandler.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,142 @@ +/* +* Copyright (c) 2005-2006 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: Handles scheduled update, starts fotaserver and request upd +* +*/ + + + +#include +#include +#include +#include +#include + +#include "FotaSchedDebug.h" +#include "fotaengine.h" +#include "../../inc/FotaIPCTypes.h" + +// Constants + +// ----------------------------------------------------------------------------- +// UpdateFirmwareL +// +// ----------------------------------------------------------------------------- +// +LOCAL_D void UpdateFirmwareL(RFile& aTaskFile) + { + FLOG(_L("fotaschedulehandler UpdateFirmwareL(RFile& aTaskFile)")); + TInt err; + CFileStore* store; + RStoreReadStream instream; + // Get tasks from scheduler's store + store = CDirectFileStore::FromLC(aTaskFile); + instream.OpenLC(*store,store->Root()); + TInt count = instream.ReadInt32L(); + FLOG(_L("fotaschedulehandler task count %d"),count ); + for (TInt i=0;i(&(task->Data())); + TPtr ptr = b->Des(); + HBufC8* b8 = HBufC8::NewLC( b->Length() ); + b8->Des().Copy(ptr); + TFotaScheduledUpdate fotareminder(-1,-1); + TPckg fotareminderpkg(fotareminder); + fotareminderpkg.Copy(b8->Des()); + CleanupStack::PopAndDestroy( b8 ); + FLOG(_L("fotaschedulehandler packageid:%d sched:%d"),fotareminder.iPkgId, fotareminder.iScheduleId); + RFotaEngineSession fota; + fota.OpenL(); + CleanupClosePushL( fota ); + err = fota.ScheduledUpdateL (fotareminder); + if(err){} // to remove compiler warning + FLOG(_L("fotaschedulehandler 2........ err %d"),err); + fota.Close(); + FLOG(_L("fotaschedulehandler 3 ")); + CleanupStack::PopAndDestroy( &fota); + CleanupStack::PopAndDestroy(task); + } + CleanupStack::PopAndDestroy( &instream ); + CleanupStack::PopAndDestroy( store ); + } + + +// ----------------------------------------------------------------------------- +// ExecuteL +// +// ----------------------------------------------------------------------------- +// +LOCAL_D TInt ExecuteL() + { + TInt err = KErrNoMemory; + + RFile file; + + // Adopt the task file from the Task Scheduler + err = file.AdoptFromCreator(TScheduledTaskFile::FsHandleIndex(), + TScheduledTaskFile::FileHandleIndex()); + FLOG(_L(" err %d"),err ); + User::LeaveIfError(err); + + TRAP(err, UpdateFirmwareL(file)); + + file.Close(); + + User::LeaveIfError(err); + + return err; + } + + +// ----------------------------------------------------------------------------- +// Execute +// +// ----------------------------------------------------------------------------- +// +LOCAL_D TInt Execute() + { + FLOG(_L("fotaschedulehandler Execute()")); + TInt err = KErrNoMemory; + + // construct and install active scheduler + CActiveScheduler* scheduler = new CActiveScheduler; + if (!scheduler) + { + return err; + } + CActiveScheduler::Install(scheduler); + CTrapCleanup* cleanupStack = CTrapCleanup::New(); + if (cleanupStack) + { + TRAP(err, ExecuteL()); + delete cleanupStack; + } + delete scheduler; + return err; + } + + +// ----------------------------------------------------------------------------- +// E32Main +// +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() + { + return Execute(); + } + + + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/cenrep/fotadiskstoragePrivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/cenrep/fotadiskstoragePrivateCRKeys.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2005 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: fotadiskstorage's cenrep keys +* +*/ + + + +#ifndef FOTADISKSTORAGE_PRIVATE_KEYS_H +#define FOTADISKSTORAGE_PRIVATE_KEYS_H + +// CONSTANTS + +// fotadiskstorage key UID +const TUid KCRUidFotaDiskStorage = { 0x102072C6 }; + +// How much space should be reserved for firmware update package +const TUint32 KFotaDiskSpaceReservationKey = 0x00000001; + +#endif // FOTADISKSTORAGE_PRIVATE_KEYS_H + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/cenrep/fotaserverPrivateCRKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/cenrep/fotaserverPrivateCRKeys.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2005 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: CR keys for fotaserver +* +*/ + + + +#ifndef FOTASERVER_PRIVATE_KEYS_H +#define FOTASERVER_PRIVATE_KEYS_H + +// CONSTANTS + +// FS key UID +const TUid KCRUidFotaServer = { 0x102072C4 }; + +// Device manager key UID +const TUid KPSUidNSmlDMSyncApp = {0x101f6de5}; +// Whether update agent should be simulated by FS +const TUint32 KSimulateUpdateAgent = 0x00000001; + +//Flag to enable/disable the feature ,.."Send Generic alert after device reboots" +//Allowed values 1 , 0 +const TUint32 KGenericAlertResendAfterBoot = 0x00000002; + +//Flag to configure number of retries for sending GA in failure cases. + +const TUint32 KGenericAlertRetries = 0x00000003; + +//Determines state of fota update. +//0 - Default , no action taken. +//1 - Firmware update/GA +//2. Download Interrupted + +const TUint32 KFotaUpdateState = 0x00000004; + +//Determines whether the Fota Monitory Service is enabled or not. +//0 (default ) - Feature OFF +//1 - Feature ON + +const TUint32 KFotaMonitoryServiceEnabled = 0x00000005; + +/* +* This key is used to determine the maximum number of postpones allowed for a FOTA Update. +* Default value : 3 +*/ + +const TUint32 KFOTAMaxPostponeCount = 0x00000006; + + +/* +* This key is used to determine the number of postpones done by the user for a particular FOTA Update. +* Default value : 0 +*/ + +const TUint32 KFOTAUserPostponeCount = 0x00000007; + +const TUint32 KUpdateRequesterUid = 0x0000008; + +const TUint32 KFOTADownloadRestartCount = 0x0000009; + +#endif // FOTASERVER_PRIVATE_KEYS_H + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/conf/CI_fotadiskstorage.confml Binary file fotaapplication/conf/CI_fotadiskstorage.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/conf/CI_fotaserver.confml Binary file fotaapplication/conf/CI_fotaserver.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/conf/fotadiskstorage.confml Binary file fotaapplication/conf/fotadiskstorage.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/conf/fotadiskstorage_102072C6.crml Binary file fotaapplication/conf/fotadiskstorage_102072C6.crml has changed diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/conf/fotaserver.confml Binary file fotaapplication/conf/fotaserver.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/conf/fotaserver_102072C4.crml Binary file fotaapplication/conf/fotaserver_102072C4.crml has changed diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmsclient/bwins/fmsclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmsclient/bwins/fmsclientu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,8 @@ +EXPORTS + ?Close@RFMSClient@@QAEXXZ @ 1 NONAME ; void RFMSClient::Close(void) + ?Cancel@RFMSClient@@QAEXXZ @ 2 NONAME ; void RFMSClient::Cancel(void) + ?OpenL@RFMSClient@@QAEHXZ @ 3 NONAME ; int RFMSClient::OpenL(void) + ?IsPhoneCallActive@RFMSClient@@QAEHAAH@Z @ 4 NONAME ; int RFMSClient::IsPhoneCallActive(int &) + ?NotifyForUpdateL@RFMSClient@@QAEXABW4TFmsIpcCommands@@I@Z @ 5 NONAME ; void RFMSClient::NotifyForUpdateL(enum TFmsIpcCommands const &, unsigned int) + ?NotifyForResumeL@RFMSClient@@QAEXABW4TFmsIpcCommands@@ABHABW4TDriveNumber@@1@Z @ 6 NONAME ; void RFMSClient::NotifyForResumeL(enum TFmsIpcCommands const &, int const &, enum TDriveNumber const &, int const &) + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmsclient/eabi/fmsclientu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmsclient/eabi/fmsclientu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,8 @@ +EXPORTS + _ZN10RFMSClient16NotifyForResumeLERK15TFmsIpcCommandsRKiRK12TDriveNumberS4_ @ 1 NONAME + _ZN10RFMSClient16NotifyForUpdateLERK15TFmsIpcCommandsj @ 2 NONAME + _ZN10RFMSClient17IsPhoneCallActiveERi @ 3 NONAME + _ZN10RFMSClient5CloseEv @ 4 NONAME + _ZN10RFMSClient5OpenLEv @ 5 NONAME + _ZN10RFMSClient6CancelEv @ 6 NONAME + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmsclient/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmsclient/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,26 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +// BLD.INF +// Component description file +// + +PRJ_MMPFILES + +FMSClient.mmp + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmsclient/group/fmsclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmsclient/group/fmsclient.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,47 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#include +#include "defaultcaps.hrh" + +//MACRO _FOTA_DEBUG +//MACRO _FOTA_DEBUG_RDEBUG + +CAPABILITY CAP_CLIENT_DLL + +TARGET fmsclient.dll +TARGETTYPE dll +UID 0x1000008D 0x200100C7 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE fmsclient.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../cenrep + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY centralrepository.lib +LIBRARY flogger.lib + +SMPSAFE \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmsclient/inc/fmsclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmsclient/inc/fmsclient.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,86 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#ifndef __FMS_CLIENT_H__ +#define __FMS_CLIENT_H__ + +#include +#include +#include +#include +#include "fmsclientserver.h" + + +class RFMSClient : public RSessionBase + { + public: + /** + * Launches FMSServer + * @param None + * @return KErrNone Symbian error code + */ + IMPORT_C TInt OpenL(); + + /** + * Close server connection + * @param None + * @return None + */ + IMPORT_C void Close(); + + /** + * Sending the parameters to FMSServer + * FotaServer or test app should use this + * @param aReason + * @param aBearer + * @param aDrive + * @param aSize + * @return None + */ + IMPORT_C void NotifyForResumeL(const TFmsIpcCommands& aReason, + const TInt& aBearer, const TDriveNumber& aDrive, const TInt& aSize); + + + /** + * phone call active check to FMSServer + * @param aCallActive, on return holds call status + * @return TInt, error code + */ + IMPORT_C TInt IsPhoneCallActive(TInt& aCallActive); + + + IMPORT_C void NotifyForUpdateL(const TFmsIpcCommands& aReason, TUint aLevel = 2); + + /** + * Cancels the request on FMSServer + * @param None + * @return None + */ + IMPORT_C void Cancel(); + + private: + /* + * FotaStartUp uses this at the time of reboot + * to trigger FMS server + * @param None + * @return None + */ + void SendInterruptParamsL(); +}; + +#endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmsclient/inc/fmsclientdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmsclient/inc/fmsclientdebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#ifndef FMS_CLIENT_DEBUG_H_ +#define FMS_CLIENT_DEBUG_H_ + #ifdef _FOTA_DEBUG + + #include + #include + #include + #include + + _LIT( KLogFile, "fmsclient.log" ); + _LIT( KLogDirFullName, "c:\\logs\\" ); + _LIT( KLogDir, "fota" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + + #ifdef _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else // _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // _FOTA_DEBUG_RDEBUG + + #else // _FOTA_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _FOTA_DEBUG + + +#endif /*FMSCLIENTDEBUG_H_*/ diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmsclient/src/fmsclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmsclient/src/fmsclient.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,195 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#include +#include +#include +#include "fmsclientserver.h" +#include "fmsclient.h" +#include "fmsclientdebug.h" + +#include "fotaserverPrivateCRKeys.h" +#include +// --------------------------------------------------------------------------- +// IsSecureClient() +// Checks who is trying to launch FMS +// --------------------------------------------------------------------------- +TBool IsSecureClient(TBool& aFotaStartUp) + { + FLOG(_L("IsSecureClient Started")); + RThread thread; + TUid fotaserver,fotastartup; + fotaserver.iUid = KFotaServerUid; + fotastartup.iUid = KStarterUid; + if ( thread.SecureId() == fotaserver.iUid ) + { + FLOG(_L("fmsclient fotaserver is using the service")); + return ETrue; + } + else if ( thread.SecureId() == fotastartup.iUid ) + { + FLOG(_L("fmsclient fotastartupplugin is using the service")); + aFotaStartUp = ETrue; + return ETrue; + } + else if (thread.SecureId() == 0x01D278B9 ) //test app + { + FLOG(_L("fmsclient test app is using the service")); + return ETrue; + } + FLOG(_L("fmsclient not launched")); + return EFalse; + } + +// --------------------------------------------------------------------------- +// StartServerL() +// Starts Fota Downlaod Interrupt Monitory server +// --------------------------------------------------------------------------- +TInt StartServerL() + { + FLOG(_L("StartServerLt Started")); + TInt res = KErrNone; + RProcess server; + res=server.Create(KFMSServerName,KNullDesC); + FLOG(_L("StartServerL-- create server error as %d"),res); + if (res!=KErrNone) + { + return res; + } + TRequestStatus stat; + server.Rendezvous(stat); + if (stat!=KRequestPending) + server.Kill(0); // abort startup + else + server.Resume(); // logon OK - start the server + User::WaitForRequest(stat); // wait for start or death + res=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int(); + FLOG(_L("StartServerL-- server.ExitType() returns %d"),res); + server.Close(); + return res; + } + +// --------------------------------------------------------------------------- +// RFMSClient::OpenL() +// --------------------------------------------------------------------------- +EXPORT_C TInt RFMSClient::OpenL() + { + FLOG(_L("RFMSClient::OpenL()- Begin")); + TInt res = KErrNone; + TBool FotaStartUp = EFalse; + if( IsSecureClient(FotaStartUp)) + { + FLOG(_L("RFMSClient::OpenL()- Secured client")); + res = CreateSession( KFMSServerName,TVersion(1,0,0),2 ); + if ( res != KErrNone ) + { + FLOG(_L("RFMSClient::OpenL()- session not created")); + res = StartServerL(); + User::LeaveIfError( res ); + res = CreateSession( KFMSServerName,TVersion(1,0,0),2 ); + } + User::LeaveIfError( res ); + FLOG(_L("RFMSClient::OpenL()- session created")); + CRepository* centrep2 = NULL; + TRAPD( err, centrep2 = CRepository::NewL( KCRUidFotaServer ) ) + TInt val = KErrNone; + if (err==KErrNone ) + { + centrep2->Get( KFotaUpdateState, val ); + delete centrep2; + } + + centrep2 = NULL; + + if( FotaStartUp && val == EFotaDownloadInterrupted ) + { + FLOG(_L("RFMSClient::OpenL()- fotastartup using FMS session")); + SendInterruptParamsL(); + } + } + else //not a secured client + { + FLOG(_L("fmsclient not launched--insecured client")); + res = KErrNotFound; + } + FLOG(_L("RFMSClient::OpenL()- End %d"),res); + return res; + } + +// --------------------------------------------------------------------------- +// RFMSClient::Close() +// --------------------------------------------------------------------------- +EXPORT_C void RFMSClient::Close() + { + FLOG(_L(" RFMSClient::Close")); + RSessionBase::Close(); //basecall + } + +// ---------------------------------------------------------------------------- +// RFMSClient::NotifyForResumeL() +// ---------------------------------------------------------------------------- +EXPORT_C void RFMSClient::NotifyForResumeL(const TFmsIpcCommands& aReason, + const TInt& aBearer, const TDriveNumber& aDrive, const TInt& aSize) + { + FLOG(_L(" RFMSClient::NotifyForResumeL--Begin")); + TInt Size(aSize),Drive((TInt)aDrive),Bearer(aBearer); + TInt err = SendReceive( (TInt)aReason, TIpcArgs(Bearer,Drive,Size)); + FLOG(_L(" RFMSClient::NotifyForResumeL--End error as %d"),err); + } + +// --------------------------------------------------------------------------- +// RFMSClient::SendInterruptParamsL() called only when fotastartup launched +// --------------------------------------------------------------------------- +void RFMSClient::SendInterruptParamsL() + { + FLOG(_L(" RFMSClient::SendInterruptParamsL--Begin")); + TInt err = Send( EFotaStartUpPlugin ); + FLOG(_L(" RFMSClient::SendInterruptParamsL--End as %d"),err); + } + +EXPORT_C void RFMSClient::NotifyForUpdateL(const TFmsIpcCommands& aReason, TUint aLevel) + { + FLOG(_L(" RFMSClient::NotifyForUpdateL--Begin, level = %d"), aLevel); + TInt err = SendReceive( (TInt) aReason, TIpcArgs (aLevel)); + FLOG(_L(" RFMSClient::NotifyForUpdateL--End as %d"),err); + User::LeaveIfError(err); + } +// --------------------------------------------------------------------------- +// RFMSClient::Cancel() +// --------------------------------------------------------------------------- +EXPORT_C void RFMSClient::Cancel() + { + FLOG(_L(" RFMSClient::Cancel--Begin")); + TInt err = SendReceive( ECancelOutstandingRequest ); + FLOG(_L(" RFMSClient::Cancel--End as %d"),err); + } + +// --------------------------------------------------------------------------- +// RFMSClient::ActivePhoneCallSync() +// --------------------------------------------------------------------------- +EXPORT_C TInt RFMSClient::IsPhoneCallActive(TInt& aCallActive) + { + FLOG(_L(" RFMSClient::IsPhoneCallActive--Begin")); + TPckgBuf result(aCallActive); + TInt err = SendReceive( EUpdPhoneCallActive,TIpcArgs(&result)); + aCallActive=result(); + FLOG(_L(" RFMSClient::IsPhoneCallActive--End as %d,%d"),err,aCallActive); + return err; + } + +//End of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,27 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +// BLD.INF +// Component description file +// + +PRJ_MMPFILES + +FMSServer.mmp + + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/group/fmsserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/group/fmsserver.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,56 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#include +#include "defaultcaps.hrh" + +//MACRO _FOTA_DEBUG +//MACRO _FOTA_DEBUG_RDEBUG + +CAPABILITY CAP_SERVER + +TARGET fmsserver.exe +TARGETTYPE exe + +UID 0 0x200100C8 +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE fmsserver.cpp +SOURCE fmsserversession.cpp +SOURCE fmsinterruptaob.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../cenrep + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY connmon.lib // for connection monitoring +LIBRARY sysutil.lib +LIBRARY efsrv.lib +LIBRARY flogger.lib +LIBRARY centralrepository.lib +LIBRARY fotaengine.lib +LIBRARY cmmanager.lib +LIBRARY etelmm.lib +LIBRARY etel.lib +LIBRARY schsvr.lib + +SMPSAFE diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/inc/fmsdebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/inc/fmsdebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,65 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#ifndef FMSDEBUG_H_ +#define FMSDEBUG_H_ + + + #ifdef _FOTA_DEBUG + + #include + #include + #include + #include + + _LIT( KLogFile, "fmsserver.log" ); + _LIT( KLogDirFullName, "c:\\logs\\" ); + _LIT( KLogDir, "fota" ); + + inline void FWrite (TRefByValue aFmt,...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir,KLogFile,EFileLoggingModeAppend ,TPtrC(aFmt) ,list ); + } + + + #ifdef _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG RDebug::Print + #else // __GNUC__ + #define FLOG(arg...) RDebug::Print(arg); + #endif // __GNUC__ + #else // _FOTA_DEBUG_RDEBUG + #ifndef __GNUC__ + #define FLOG FWrite + #else // __GNUC__ + #define FLOG(arg...) FWrite(arg); + #endif // __GNUC__ + #endif // _FOTA_DEBUG_RDEBUG + + #else // _FOTA_DEBUG + #ifndef __GNUC__ + #define FLOG + #else + #define FLOG(arg...) + #endif // __GNUC__ + #endif // _FOTA_DEBUG + + +#endif /*FMSDEBUG_H_*/ diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/inc/fmsinterruptaob.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/inc/fmsinterruptaob.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,296 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#ifndef __FMS_AOB_H__ +#define __FMS_AOB_H__ + +#include +#include +#include +#include +#include +#include +#include "fmsserver.h" +#include "fmsdebug.h" + +class CFMSServer; + +// CLASS DECLARATION +class CFMSInterruptAob : public CActive,private MConnectionMonitorObserver + { + friend class CFMSServer; + + public: + /** + * Default constructor + */ + CFMSInterruptAob(); + + /** + * second phase constructor + */ + void ConstructL(); + + /** + * Logs the new request/interrupt to be monitored + * @param aType, interrupt reason + * @return None + */ + void StartL(TFmsIpcCommands aType); + + /** + * Starts Active object to monitor for the update interrupt in case of USB charger support + * @param aType, Interrupt reason + * @return None + */ + void StartBatteryMonitoringL(TFmsIpcCommands aType, TUint aLevel); + + /** + * Sets the memory size member variable to be monitored + * for the current interrupt + * @param aSize, Memory space required + * @param aDrive, Drive used for download + * @return None + */ + void MemoryToMonitorL(TInt aSize, TDriveNumber aDrive); + + /** + * Sets the network type for the current interrupt + * @param aBearer + * @return None + */ + void NetworkTypeL(TInt aBearer); + /** + * Launches FOTA install notifier + * @param None + * @return None + */ + void LaunchFotaScheduleUpdate(); + + /* + * Destructor + */ + virtual ~CFMSInterruptAob(); + + /** + * Starts monitor for active call end + * @param aType, Reason to be monitored + * @return None + */ + void StartCallEndMonitoringL(TFmsIpcCommands aType); + + private: + + /** + * From CActive + * Called by Active scheduler when the asynchronous + * request completed + * @param None + * @return None + */ + void RunL(); + + /** + * From CActive + * Called when a pending request has to be cancelled + * @param None + * @return None + */ + void DoCancel(); + + /** + * From CActive + * Handle a leave occurred in the RunL(). + * Note: If RunError function pointer is not given in construction, + * the leave error is to be propagated back to the active scheduler! + * + * @since S60 v3.2 + * @param aError the error code of leave + */ + TInt RunError( TInt aError ); + + /** + * Checks the package size is more than warning level of memory + * @param aCritical to set EFalse/ETrue + * @return TInt + */ + TInt IsPkgSizeMoreThanWL(TBool& aCritical); + + /** + * Starts network notification registry + * @param None + * @return None + */ + TBool CheckNetworkL(); + + /** + * Starts network notification registry + * @param None + * @return None + */ + void LaunchFotaEngineL(); + + /** + * Starts network notification registry + * @param None + * @return None + */ + TBool CheckGlobalRFStateL(); + + /** + * Stops the FMS Server + * @param None + * @return None + */ + void StopServer(); + + /** + * Checks the memory size to be monitored + * after adding the warning level + * @param None + * @return None + */ + void CheckMemSizeL(); + + public: + + /** + * Starts network notification registry + * @param None + * @return None + */ + void NotifyL() ; + + /** + * Stops network notifications. + * @param None + * @return None + */ + void StopNotify() ; + + /** + * sets n/w to 3G. + * @param None + * @return None + */ + void SetWcdma() ; + + /** + * Starts n/w registry check in Hard reeboot case + * uses CPeriodic variable to call static method + * @param None + * @return None + */ + void StartNetworkRegistryCheckL(); + + /** + * checks n/w registry in Hard reeboot case + * and destroys the CPeriodic if connection is there + * and triggers fota engine + * @param None + * @return None + */ + void NetworkRegistryCheckL(); + + /** + * Launches Fota update note + * @param aPkgId, package Id of FOTA Update + * @param aProfilleId, Profile ID of FOTA + * @return None + */ + void LaunchFotaUpdate(); + + private : + + /** + * From MConnectionMonitorObserver + * Method involed by connection monitor with current event. + * This method handles the events + * @param aConnMonEvent says about the event + * @return None + */ + void EventL( const CConnMonEventBase& aConnMonEvent ) ; + + /** + *CheckNetworkstatus and takes action based on that + * @param none + * @return None + */ + void CheckNetworkStatusL(); + /** + * HandleAboveCriticallevel handle memory interrupt when it is above critical level + * @param None + * @return None + */ + void HandleAboveCriticallevelL(); + + /** + * HandleChargingInterruptL handle charging interrupt when it is above critical level + * @param None + * @return None + */ + + void HandleChargingInterruptL(); + + private: + + RConnectionMonitor iConnMon; + RFs iFs; + RProperty iProperty; + TInt iConnStatus; + TInt iSize; + TDriveNumber iDrive; + TInt iBearer; + TBool iWlanAvailable; + TBool iGPRSAvail; + TFmsIpcCommands iInterruptType; + TFmsIpcCommands iUpdInterruptType; + CFMSServer* iServer; + RFotaEngineSession iFotaEngine; + CPeriodic* iPeriodicNwCheck; + TBool iWcdma; + + /** + * RTelServer object used to keep an asynchronous request + * for phone call end monitoring + */ + RTelServer iTelServer; + + /** + * RPhone object used to keep an asynchronous request + * for phone call end monitoring + */ + RPhone iPhone; + + /** + * RLine object used to keep an asynchronous request + * for phone call end monitoring + */ + RLine iLine; + + /** + * To get hodl of current call status + */ + RCall::TStatus iCallStatus; + + TInt iChargeToMonitor; + + }; + + +#endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/inc/fmsserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/inc/fmsserver.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,297 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#ifndef __FMS_SERVER_H__ +#define __FMS_SERVER_H__ + +#include +#include +#include +#include +#include +#include +#include +#include "fmsclientserver.h" +#include "fmsinterruptaob.h" +#include "fmsdebug.h" + +_LIT( KFotaInterruptFileName, "fotainterrupt.txt" ); +const TInt64 KThresholdDiskSpace = 305152; +const TInt64 KDiskSpaceNotCL = 102400; +const TInt KRequestTriggerWaitTime(1000000); + +class CFMSSession; +class CFMSServer; +class CFMSInterruptAob; + + +class CFMSServer: public CServer2 + { + friend class CFMSSession; + friend class CFMSInterruptAob; + + public: + + /** + * Destructor + */ + virtual ~CFMSServer(); + + /** + * Static method which creates the server instance + * @param None + * @return CServer2* + */ + static CServer2* NewLC(); + + /** + * Stops the session and closes the server + * @param None + * @return None + */ + void DropSession(); + + /** + * Starts Active object to monitor for the interrupt + * @param aType, Interrupt reason + * @return None + */ + void StartMonitoringL(TFmsIpcCommands aType); + + /** + * Starts Active object to monitor for the update interrupt + * @param aType, Interrupt reason + * @param aLevel, Level of the battery charge to monitor + * @return None + */ + void StartBatteryMonitoringL(TFmsIpcCommands aType, TUint aLevel); + +/** + * Starts Active object to monitor for the update interrupt + * @param aType, Interrupt reason + * @return None + */ + void StartUpdateInterruptMonitoringL(TFmsIpcCommands aType); + /** + * Calls Active object's method to set the drive & size + * for memory interrupt + * @param aSize, Interrupt aDrive + * @return None + */ + void MemoryToMonitorL(TInt aSize, TDriveNumber aDrive); + + /** + * Calls Active object's method to set the network bearer + * @param aBearer + * @return None + */ + void NetworkTypeL(TInt aBearer); + + /** + * Writes the file with all the interrupt information + * @param aReason ,Interrupt reason + * @param aBearer ,Bearer id + * @param aDrive ,Drive to Download + * @param aSize , memory size to monitor + * @param aWcdmaBearer , 3G bearer or not + * @return None + */ + void WriteToFile(TInt aReason, TInt aBearer, TDriveNumber aDrive, + TInt aSize, TBool aWcdmaBearer ); + + /** + * Reads the file for the interrupt information + * @param aReason ,Interrupt reason + * @param aBearer ,Bearer id + * @param aDrive ,Drive to Download + * @param aSize , memory size to monitor + * @param aWcdmaBearer , 3G bearer or not + * @return TBool, says reading success or not + */ + TBool ReadFromFile(TInt& aReason, TInt& aBearer, TInt& aDrive, TInt& aSize + , TInt& aWcdmaBearer ); + + /** + * Checks for any interrupt pending + * @param None + * @return TBool + */ + TBool RequestPending(); + + /** + * Checks the network as part of other interrupts + * before triggering fota. + * In case of network down, it keeps network interrupt + * @param aBearer ,Bearer id + * @param aDrive ,Drive to Download + * @param aSize , memory size to monitor + * @param aWcdmaBearer , 3G bearer or not + * @return None + */ + void CheckNetworkL(TInt& aBearerId,TInt& aDrive, TInt& aSize,TBool& aWcdma); + + /** + * Locks the session, so that new session will not be started + * before the previous interrupt monitory completion + * @param None + * @return None + */ + void LockSession(); + + /** + * Computes the variation configured + * @param None + * @return None + */ + void FindVariation(); + + /** + * Checks Charger monitoring supported or not + * @param None + * @return TBool, which says Charger monitory support + */ + TBool ChargerTobeMonitered(); + + /** + * Checks Network monitoring supported or not + * @param None + * @return TBool, which says Network monitory support + */ + TBool NetworkTobeMonitered(); + + /** + * Checks Phone startup monitoring supported or not + * @param None + * @return TBool, which says Phone startup monitory support + */ + TBool MoniterAfterPhoneRestart(); + + /** + * Checks Memory monitoring supported or not + * @param None + * @return TBool, which says Memory monitory support + */ + TBool MemoryTobeMonitered(); + + /** + * Checks for WLAN + * @param None + * @return TBool, which says WLAN availability + */ + TBool CheckWlanL(); + + /** + * Sets the Bool value which decides file deletion + * @param aValue, says whether the file to be deletd or not + * @return None + */ + void DeleteFile(TBool aValue); + + /** + * Checks network and trigger fota engine in hard reboot case + * @param None + * @return None + */ + void TriggerFotaL(); + + /** + * For asynchronous network request to be + * logged on active object, using CPeriodic + * @param None + * @return None + */ + void AsyncSessionRequestL(); + + /** + * Destroys the CPeriodic object + * So that not to call the static method again + * @param None + * @return None + */ + void StopAsyncRequest(); + + /** + * Calls Active objects SetWcdma to set the bearer to 3G + * @param None + * @return None + */ + void SetWcdma() ; + + /** + * Checks whether a phone call is active or not + * @param aStatus, on return contains the call status + * @return None + */ + void CheckPhoneCallActiveL(TInt& aStatus); + + /** + * Starts montioring for active phone call end + * @param aPkgId, package Id of FOTA Update + * @param aProfileId, Profile ID of FOTA + * @return phone call active or not at that moment + */ + TBool MonitorPhoneCallEndL(); + + /** + * Logs Asynchronous montioring for active phone call end + * To avoid performance issues(like thread blocking call) + * @param None + * @return None + */ + void LogAsyncCallMonitorL(); + + void CreateScheduledReminderL(); + + void DeleteScheduledRemindersL(); + + private: + + /** + * second phase constructor + */ + void ConstructL(); + + /** + * Default constructor + */ + CFMSServer(); + + protected: + + /** + * Calls when a New session is getting created + * @param aVersion + * @param aMessage + * @return CSession2* + */ + CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; + + private: + RFs iFs; //for file creation, writing & Deleting + RFile iFile; + TInt iSessionCount; + CFMSInterruptAob iFMSInterruptAob; + TBool iNetworkMon; + TBool iChargerMon; + TBool iPhoneRestartMon; + TBool iMemoryMon; + TBool iDeleteFile; + CPeriodic* iLogAsyncRequest; + }; + +#endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/inc/fmsserversession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/inc/fmsserversession.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,112 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#ifndef __FMS_SESSION_H__ +#define __FMS_SESSION_H__ + +#include "fmsserver.h" + +class CFMSSession: public CSession2 +{ + friend class CFMSServer; + public: + /** + * Destructor + */ + virtual ~CFMSSession(); + + private: + /** + * Constructor + */ + CFMSSession(); + + /** + * Provides FMS Server reference + * @param None. + * @return CFMSServer reference + */ + CFMSServer& Server(); + + /** + * Called by the framework to handle the request + * @param aMessage + * @return None + */ + void ServiceL(const RMessage2& aMessage); + + /** + * Called from ServiceL to handle the request + * @param aMessage + * @return None + */ + void DispatchMessageL(const RMessage2& aMessage); + + + /** + * Called when ServiceL leaves + * @param aMessage + * @param aError + * @return None + */ + void ServiceError(const RMessage2 &aMessage, TInt aError); + + /** + * Checks whether the session started client is secured or not + * @param aMessage + * @return TBool + */ + TBool CheckClientSecureIdL( const RMessage2 &aMessage ); + + /** + * Finds the bearer id for the corresponding IAP Id + * @param aIapId + * @return TUint32, bearer id + */ + TUint32 FindBearerIdL(TInt aIapId); + + /** + * Writes Dummy file in case of unsupported monitoring + * @param None. + * @return CFMSServer reference + */ + void WriteDummyFile(); + + /** + * Checks whether the phone is in 2G or 3G mode + * sets the member variable iWcdmaBearer + * @param None. + * @return CFMSServer reference + */ + void PhoneModeL(); + + /** + * + * Handles the service based on bearer type + * @param aMessage. + * @return None + */ + void HandleBasedOnBearertypeL(const RMessage2& aMessage); + private: + TBool iStopServer; + TBool iWlanbearer; + TBool iWcdmaBearer; +}; + + +#endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/src/fmsinterruptaob.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/src/fmsinterruptaob.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,996 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#include +#include +#include +#include +#include +#include +#include "fotaserverPrivateCRKeys.h" +#include "fmsserver.h" +#include "fmsinterruptaob.h" +#include "fmsclientserver.h" +#include "FotaIPCTypes.h" + +#if defined (__WINS__) +#include +#endif +// ---------------------------------------------------------------------------------------- +// static method StaticCheckNwRequestL() called to check n/w availability +// ---------------------------------------------------------------------------------------- +static TInt StaticCheckNwRequestL(TAny* aPtr) + { + CFMSInterruptAob* ptr = (CFMSInterruptAob*) aPtr; + FLOG(_L("StaticCheckNwRequestL:-Begin")); + TRAPD(err, ptr->NetworkRegistryCheckL() ); + FLOG(_L("StaticCheckNwRequestL:-end")); + return err; + } + +// ----------------------------------------------------------------------------- +// CFMSInterruptAob::CFMSInterruptAob() +// ----------------------------------------------------------------------------- +CFMSInterruptAob::CFMSInterruptAob() +:CActive(EPriorityStandard) + { + //CActiveScheduler::Add(this); + iConnStatus = KErrNone; + iWlanAvailable = EFalse; + iGPRSAvail = EFalse; + iWcdma = EFalse; + iUpdInterruptType = ENoInterrupt; + iChargeToMonitor = 0; + } + +// ----------------------------------------------------------------------------- +// CFMSInterruptAob::ConstructL() +// ----------------------------------------------------------------------------- +void CFMSInterruptAob::ConstructL() + { + CActiveScheduler::Add(this); + User::LeaveIfError(iConnMon.ConnectL()); + } + +// ----------------------------------------------------------------------------- +// CFMSInterruptAob::Start() +// ----------------------------------------------------------------------------- +void CFMSInterruptAob::StartL(TFmsIpcCommands aType) + { + FLOG(_L("CFMSInterruptAob::Start- begin")); + iInterruptType = aType; + if(iInterruptType == EDLUserInterrupt && iServer->ChargerTobeMonitered()) + { + FLOG(_L("CFMSInterruptAob::Start--EUserInterrupt")); + if(!IsActive()) + { + //RProperty pw; + iProperty.Attach(KPSUidHWRMPowerState,KHWRMChargingStatus); + iStatus=KRequestPending; + iProperty.Subscribe(iStatus); + SetActive(); + } + } + else if(iInterruptType == EDLNetworkInterrupt && iServer->NetworkTobeMonitered()) + { + FLOG(_L("CFMSInterruptAob::Start--ENetworkInterrupt")); + if(!IsActive()) + { + iStatus=KRequestPending; + TBool phonenotoffline = CheckGlobalRFStateL(); + if ( ( iBearer == EBearerIdGPRS || iBearer == EBearerIdWCDMA ) + && phonenotoffline ) + { + FLOG(_L("CFMSInterruptAob::Start--ENetworkInterrupt iBearer is %d"),iBearer); + NotifyL(); + return; + } + else if ( iBearer == EBearerIdWLAN ) + { + //feature supported check + iWlanAvailable = EFalse; + iConnMon.GetBoolAttribute( EBearerIdWLAN, + 0, + KBearerAvailability, + iWlanAvailable, + iStatus ); + SetActive(); + } + else + { + FLOG(_L("CFMSInterruptAob::Start--ENetworkInterrupt--other then GPRS/ WLan bearer ")); + //Stop the server + //Dont delete the file if interrupt is network + offline( to differentiate from hard reboot + iServer->DeleteFile(EFalse); + StopServer(); + } + } + } + else if(iInterruptType == EDLMemoryInterrupt && iServer->MemoryTobeMonitered()) + { + FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt on drive %d"),(TInt)iDrive ); + if(!IsActive()) + { + User::LeaveIfError(iFs.Connect()); + TBool critical = EFalse; + TInt err = KErrNone; + err=IsPkgSizeMoreThanWL(critical); + if(critical) + { + FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt--critical pkg dont fit on drive %d"),(TInt)iDrive ); + iStatus=KRequestPending; + iFs.NotifyDiskSpace( iSize, iDrive, iStatus ); + FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt-setting as active") ); + SetActive(); + } + else + { + if(err == KErrNone) + { + FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt--critical pkg fits on drive %d"),(TInt)iDrive ); + LaunchFotaEngineL(); + } + else + { + FLOG(_L("CFMSInterruptAob::Start--EMemoryInterrupt--System error %d on memory drive %d"), err,(TInt)iDrive ); + } + //Stop the server + StopServer(); + } + } + } + else //case where variation fails or by chance if a bad interrupt reason + { + StopServer(); + } + } + +// ----------------------------------------------------------------------------- +// CFMSInterruptAob::RunL() +// ----------------------------------------------------------------------------- +void CFMSInterruptAob::RunL() + { + FLOG(_L("CFMSInterruptAob::RunL()- begin")); + TInt value = 0; + if( EUpdMonitorPhoneCallEnd == iUpdInterruptType) + { + FLOG(_L("RunL EPhoneCallActiveAsync--call status %d"),iCallStatus); + if(iStatus == KErrNone && RCall::EStatusIdle == iCallStatus ) + { + //call fota scheduler & Stop the server + LaunchFotaUpdate(); + StopServer(); + } + else //call in progress, subscribe again + { + FLOG(_L("call in progress, subscribing again")); + iLine.NotifyStatusChange(iStatus, iCallStatus); + SetActive(); + } + } + else if( iUpdInterruptType == EUpdMonitorbattery) + { + FLOG(_L("CFMSInterruptAob::RunL()- handling battery monitor")); + iProperty.Attach(KPSUidHWRMPowerState,KHWRMBatteryLevel); + TInt err=iProperty.Get(KPSUidHWRMPowerState,KHWRMBatteryLevel,value); + if(err != KErrNone) + { + FLOG(_L("CFMSInterruptAob::RunL()- error in getiing the battery level")); + StopServer(); + } + if(value >= iChargeToMonitor) + { iProperty.Cancel(); + iProperty.Close(); + TRAPD(err, LaunchFotaScheduleUpdate()); + if(err) + { + FLOG(_L("CFMSInterruptAob::RunL()- error in launch fota schedule")); + } + iUpdInterruptType = ENoInterrupt; + StopServer(); + + } + + else + { + FLOG(_L("CFMSInterruptAob::RunL()--status charger not connected")); + if(!IsActive()) + { + iStatus=KRequestPending; + iProperty.Subscribe(iStatus); + FLOG(_L("CFMSInterruptAob::RunL()--waiting for charger Connectivity")); + SetActive(); + } + } + } + else if( iInterruptType == EDLUserInterrupt) + { + TInt value; + //RProperty pw; + iProperty.Attach(KPSUidHWRMPowerState,KHWRMChargingStatus); + iProperty.Get(KPSUidHWRMPowerState,KHWRMChargingStatus,value); + // charger connected or already charging going on + if( value == EChargingStatusCharging /*|| value == EChargingStatusChargingComplete || + value == EChargingStatusAlmostComplete || value == EChargingStatusChargingContinued */) + { + FLOG(_L("CFMSInterruptAob::RunL()--status charging")); + HandleChargingInterruptL(); + + } + else + { + FLOG(_L("CFMSInterruptAob::RunL()--status charger not connected")); + if(!IsActive()) + { + iStatus=KRequestPending; + iProperty.Subscribe(iStatus); + FLOG(_L("CFMSInterruptAob::RunL()--waiting for charger Connectivity")); + SetActive(); + } + } + } + else if( iInterruptType == EDLNetworkInterrupt ) + { + FLOG(_L("CFMSInterruptAob::RunL()--ENetworkInterrupt" )); + /*if( iBearer == EBearerIdGPRS || iBearer == EBearerIdWCDMA ) + { + FLOG(_L("CFMSInterruptAob::RunL()--ENetworkInterrupt:GPRS/WCDMA" )); + }*/ + if ( iBearer == EBearerIdWLAN ) + { + TBuf<10> num; + FLOG(_L("CFMSInterruptAob::RunL()--ENetworkInterrupt due to bearer id WLAN, iStatus %d"),iStatus.Int()); + /*if(iWlanAvailable) + FLOG(_L("iWlanAvailable :TRUE")); + else + FLOG(_L("iWlanAvailable :FALSE")); */ + if( iWlanAvailable && iStatus == KErrNone ) + { + FLOG(_L("CFMSInterruptAob::RunL()--status WLAN networks found")); + LaunchFotaEngineL(); + StopServer(); + } + else if( iStatus == KErrNotSupported )//feture not supported + { + FLOG(_L("CFMSInterruptAob::RunL()--status WLAN feature not supported")); + StopServer(); + } + else + { + FLOG(_L("CFMSInterruptAob::RunL()--status WLAN networks not found")); + if(!IsActive()) + { + iWlanAvailable = EFalse; + iStatus=KRequestPending; + iConnMon.GetBoolAttribute( EBearerIdWLAN, + 0, + KBearerAvailability, + iWlanAvailable, + iStatus ); + FLOG(_L("CFMSInterruptAob::RunL()--search for wlan availability")); + SetActive(); + } + } + } + } + else if( iInterruptType == EDLMemoryInterrupt ) + { + FLOG(_L("CFMSInterruptAob::RunL()--EMemoryInterrupt,iStatus %d"),iStatus.Int()); + if( iStatus == KErrNone || iStatus == KErrCancel ) + { + TBool critical = EFalse; + IsPkgSizeMoreThanWL(critical); + //if download size doesn't lead to memory less than critical level + if( !critical ) + { + FLOG(_L("CFMSInterruptAob::RunL()--Ok download not greater than critical level")); + //Check network status at this moment + + HandleAboveCriticallevelL(); + + + } + else + { + FLOG(_L("CFMSInterruptAob::RunL()--Ok download greater than critical level")); + // space monitor for this + if(!IsActive()) + { + iStatus=KRequestPending; + iFs.NotifyDiskSpace( iSize, iDrive, iStatus ); + SetActive(); + } + } + } + else // for size request more than disk space + { + FLOG(_L("CFMSInterruptAob::RunL()--bad request size greater than the disk limit")); + StopServer(); + } + } + else //general + { + //Already ahandled in session class + } + FLOG(_L("CFMSInterruptAob::RunL()- End")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::DoCancel() +// ---------------------------------------------------------------------------------------- +void CFMSInterruptAob::DoCancel() + { + FLOG(_L("CFMSInterruptAob::::DoCancel()")); + if( iStatus == KRequestPending ) + { + FLOG(_L("CFMSInterruptAob::::DoCancel()--request pending")); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrCancel ); + } + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::MemoryToMonitorL() +// ---------------------------------------------------------------------------------------- +void CFMSInterruptAob::MemoryToMonitorL(TInt aSize, TDriveNumber aDrive) + { + FLOG(_L("CFMSInterruptAob::::MemoryToMonitorL()--Begin")); + if( aSize < 0 || (aDrive < EDriveA && aDrive > EDriveZ) ) + { + FLOG(_L("CFMSInterruptAob::::MemoryToMonitorL()--Leving with KErrArgumnet")); + User::Leave(KErrArgument); + } + iDrive = aDrive; + iSize = aSize; + CheckMemSizeL(); + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::NetworkTypeL() +// ---------------------------------------------------------------------------------------- +void CFMSInterruptAob::NetworkTypeL(TInt aBearer) + { + if( aBearer == EBearerIdGPRS || aBearer == EBearerIdWLAN + || aBearer == EBearerIdWCDMA +#if defined (__WINS__) + || aBearer == EBearerIdLAN) +#else + ) +#endif + { + iBearer = aBearer; + } + else + { + FLOG(_L("CFMSInterruptAob::::NetworkTypeL()--leaving with KErrArgument")); + User::Leave(KErrArgument); + } + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::IsPkgSizeMoreThanWL() +// ---------------------------------------------------------------------------------------- +TInt CFMSInterruptAob::IsPkgSizeMoreThanWL(TBool& aCritical) + { + FLOG(_L("CFMSInterruptAob::::IsPkgSizeMoreThanWL()--Begin")); + TInt err = KErrNone; + //Already checked the drive is proper or not + //here the check happened for warning level + TRAP(err,aCritical = SysUtil::DiskSpaceBelowCriticalLevelL ( &iFs, iSize, iDrive )); + FLOG(_L("CFMSInterruptAob::::IsPkgSizeMoreThanWL() end %d"),err); + return err; + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::CheckNetworkL() +// ---------------------------------------------------------------------------------------- +TBool CFMSInterruptAob::CheckNetworkL() + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--begin")); + TRequestStatus status=KRequestPending; + iConnStatus = KErrNone; + TBool phonenotoffline = CheckGlobalRFStateL(); + if ( phonenotoffline && iBearer == EBearerIdGPRS ) + { + TRequestStatus gsmstatus = KRequestPending; + iConnStatus = KErrNotFound; + FLOG(_L("CFMSInterruptAob::CheckNetworkL--check GSM registry")); + iConnMon.GetIntAttribute( EBearerIdGSM, 0,KNetworkRegistration, iConnStatus, gsmstatus ); + User::WaitForRequest(gsmstatus); + FLOG(_L("iConnStatus is %d gsmstatus is %d"),iConnStatus,gsmstatus.Int()); + if( iConnStatus == ENetworkRegistrationHomeNetwork || + iConnStatus == ENetworkRegistrationRoaming ) + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--GSM available")); + FLOG(_L("CFMSInterruptAob::CheckNetworkL--checking GPRS")); + iConnMon.GetBoolAttribute( EBearerIdGPRS, 0,KPacketDataAvailability, + iGPRSAvail, status ); + User::WaitForRequest(status); + if( iGPRSAvail && status.Int()==KErrNone ) + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--GPRS available")); + return ETrue; + } + } + } + else if ( phonenotoffline && iBearer == EBearerIdWCDMA ) + { + TRequestStatus gsmstatus = KRequestPending; + iConnStatus = KErrNotFound; + FLOG(_L("CFMSInterruptAob::CheckNetworkL--check WCDMA sim registry")); + iConnMon.GetIntAttribute( EBearerIdWCDMA, 0,KNetworkRegistration, iConnStatus, gsmstatus ); + User::WaitForRequest(gsmstatus); + FLOG(_L("iConnStatus is %d WCDMA gsmstatus is %d"),iConnStatus,gsmstatus.Int()); + if( iConnStatus == ENetworkRegistrationHomeNetwork || + iConnStatus == ENetworkRegistrationRoaming ) + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--WCDMA GSM available")); + FLOG(_L("CFMSInterruptAob::CheckNetworkL--checking WCDMA GPRS")); + iConnMon.GetBoolAttribute( EBearerIdWCDMA, 0,KPacketDataAvailability, + iGPRSAvail, status ); + User::WaitForRequest(status); + if( iGPRSAvail && status.Int()==KErrNone ) + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--WCDMA GPRS available")); + return ETrue; + } + } + } + else if ( iBearer == EBearerIdWLAN ) + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--checking WLAN")); + iWlanAvailable = EFalse; + iConnMon.GetBoolAttribute( EBearerIdWLAN, + 0, + KBearerAvailability, + iWlanAvailable, + status ); + User::WaitForRequest(status);//Synchronous call + if( iWlanAvailable && status == KErrNone ) + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--wlan available")); + return ETrue; + } + } + else //phone is offline + { + FLOG(_L("CFMSInterruptAob::CheckNetworkL--phone is offline or invalid bearer")); + } + FLOG(_L("CFMSInterruptAob::CheckNetworkL--end")); + return EFalse; + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::CheckGlobalRFStateL() +// ---------------------------------------------------------------------------------------- +TBool CFMSInterruptAob::CheckGlobalRFStateL() + { + TInt val = KErrNone; + TInt err = KErrNone; + TInt status = EFalse; + err = RProperty::Get(KPSUidStartup, KPSGlobalSystemState, val); + if ( err == KErrNone && val == ESwStateNormalRfOn ) + { + //Phone is not offline. Check for Network Registration status + FLOG(_L("Phone is online. Check for Network Registration status")); + status = ETrue; + } + else + { + //Phone is offline. No Network activities allowed. + FLOG(_L("Phone is offline. No Network activities allowed.")); + status = EFalse; + } + FLOG(_L("CFotaNetworkRegStatus::CheckGlobalRFState, status = %d <<"),status); + return status; + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::StopServer() +// ---------------------------------------------------------------------------------------- +void CFMSInterruptAob::StopServer() + { + FLOG(_L("CFMSInterruptAob::StopServer begin")); + iServer->iSessionCount = 0; + CActiveScheduler::Stop();//---for stopping the server + FLOG(_L("CFMSInterruptAob::StopServer:server stopped")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::LaunchFotaEngineL() +// ---------------------------------------------------------------------------------------- +void CFMSInterruptAob::LaunchFotaEngineL() + { + FLOG(_L("CFMSInterruptAob::LaunchFotaEngineL call to iFotaEngine.OpenL() ")); + TInt err = KErrNone; + iServer->DeleteScheduledRemindersL(); + TRAP(err,iFotaEngine.OpenL()); + FLOG(_L("iFotaEngine.OpenL() launched withe error as %d"),err); + if(err == KErrNone) + { + RFotaEngineSession::TState state = iFotaEngine.GetState(-1); + if (state == RFotaEngineSession::EDownloadProgressing) + { + FLOG(_L("Trying resume download...")); + err = iFotaEngine.TryResumeDownload(); + } + else if (state == RFotaEngineSession::EStartingUpdate) + { + FLOG(_L("Trying resume update...")); + err = iFotaEngine.Update(-1,(TSmlProfileId)1, _L8(""), _L8("")); + } + + FLOG(_L("Fota engine returned : %d"), err); + iFotaEngine.Close(); + FLOG(_L("CFMSInterruptAob::LaunchFotaEngineL END - fotaengine closed ")); + } + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::CheckMemSizeL() +// ---------------------------------------------------------------------------------------- +void CFMSInterruptAob::CheckMemSizeL(/*TInt& aMemoryNeeded*/) + { + FLOG(_L("CFMSInterruptAob::CheckMemSizeL-begin")); + iSize = iSize + KDRIVECWARNINGTHRESHOLD; //irrespective of Drive + FLOG(_L(" neededspace = sizeNeededFromFS + KDRIVECWARNINGTHRESHOLD: %d"), iSize); + FLOG(_L("CFMSInterruptAob::CheckMemSizeL-end")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSInterruptAob::~CFMSInterruptAob() +// ---------------------------------------------------------------------------------------- +CFMSInterruptAob::~CFMSInterruptAob() + { + FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()")); + if(iPeriodicNwCheck) + { + FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()--deleting iPeriodicNwCheck")); + delete iPeriodicNwCheck; + iPeriodicNwCheck = NULL; + } + StopNotify(); + Cancel(); + iConnMon.Close(); + if(iProperty.Handle()) + { + iProperty.Close(); + FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()--iProperty closed")); + } + + if(iInterruptType == EDLMemoryInterrupt) + { + iFs.NotifyDiskSpaceCancel(); + } + iFs.Close(); + if(iLine.SubSessionHandle()) + { + iLine.Close(); + } + if(iPhone.SubSessionHandle()) + { + iPhone.Close(); + } + if(iTelServer.Handle()) + { + iTelServer.Close(); + } + FLOG(_L("CFMSInterruptAob::~CFMSInterruptAob()--End")); + } + + +// --------------------------------------------------------------------------- +// CFMSInterruptAob::RunError +// --------------------------------------------------------------------------- +// +TInt CFMSInterruptAob::RunError( TInt aError ) + { + FLOG( _L("CAOConnectionImpl::RunError: aError: %d"), aError ); + return aError; + } + + +// +// ----------------------------------------------------------------------------- +// CFMSInterruptAob::NotifyL() +// Registers with connection monitor for notification +// ----------------------------------------------------------------------------- +// +void CFMSInterruptAob::NotifyL() + { + FLOG(_L("CFMSInterruptAob::NotifyL Begin ")); + iConnMon.NotifyEventL( *this ); + FLOG(_L("CFMSInterruptAob::NotifyL, after registering ")); + // Threholds + TInt err = iConnMon.SetUintAttribute( iBearer, + 0, + KBearerAvailabilityThreshold, + 1 ); + FLOG(_L("CFMSInterruptAob::NotifyL : END ")); + + } + + +// ----------------------------------------------------------------------------- +// CFMSInterruptAob::StopNotify() +// Cancels notification with connection monitor +// ----------------------------------------------------------------------------- +// +void CFMSInterruptAob::StopNotify() + { + FLOG(_L("CFMSInterruptAob::StopNotify Begin ")); + iConnMon.CancelNotifications(); + FLOG(_L("CFMSInterruptAob::StopNotify end ")); + } + +// ----------------------------------------------------------------------------- +// CNsmlNetworkStatusEngine::EventL() +// Method involed by connection monitor with current event. +// This method handles the events +// ----------------------------------------------------------------------------- +// +void CFMSInterruptAob::EventL( const CConnMonEventBase& aConnMonEvent ) + { + FLOG(_L("CFMSInterruptAob::EventL, BEGIN")); + FLOG(_L("CFMSInterruptAob::EventL event is == %d"), aConnMonEvent.EventType() ); + switch ( aConnMonEvent.EventType() ) + { + case EConnMonNetworkStatusChange: + { + CConnMonBearerAvailabilityChange* eventBearerAvailabilityChange; + eventBearerAvailabilityChange = ( CConnMonBearerAvailabilityChange* ) &aConnMonEvent; + + if ( eventBearerAvailabilityChange->ConnectionId() == iBearer ) + { + if ( eventBearerAvailabilityChange->Availability() ) + { + // Available + if(CheckNetworkL()) + { + FLOG(_L("CFMSInterruptAob::EventL()--status GPRS up")); + LaunchFotaEngineL(); + StopServer(); + } + else + { + FLOG(_L("CFMSInterruptAob::EventL()--status GPRS not up-- but connmon triggererd")); + NotifyL(); + } + } + else + { + //check the phone status + // Not available + FLOG(_L("CFMSInterruptAob::EventL()--search for GPRS connection not up")); + NotifyL(); + } + } + break; + } + case EConnMonPacketDataAvailable: + { + CConnMonPacketDataAvailable* eventAvailable; + eventAvailable = ( CConnMonPacketDataAvailable* ) &aConnMonEvent; + + if ( eventAvailable->ConnectionId() == iBearer ) + { + // Available + if(CheckNetworkL()) + { + FLOG(_L("CFMSInterruptAob::EventL()--status GPRS up")); + LaunchFotaEngineL(); + StopServer(); + } + else + { + FLOG(_L("CFMSInterruptAob::EventL()--status GPRS not up-- but connmon triggererd")); + NotifyL(); + } + } + else + { + //check the phone status + // Not available + FLOG(_L("CFMSInterruptAob::EventL()--search for GPRS connection not up")); + NotifyL(); + } + break; + } + default: + break; + } + } + +//------------------------------------------------------------ +// CFMSInterruptAob::SetWcdma +//------------------------------------------------------------ +void CFMSInterruptAob::SetWcdma() + { + iWcdma = ETrue; + } + +//------------------------------------------------------------ +// CFMSInterruptAob::CheckNetworkRegistryL +//------------------------------------------------------------ +void CFMSInterruptAob::StartNetworkRegistryCheckL() + { + FLOG(_L("CFMSInterruptAob::CheckNetworkRegistryL- begin")); + iPeriodicNwCheck = CPeriodic::NewL (EPriorityNormal) ; + FLOG(_L("CFMSInterruptAob::CheckNetworkRegistryL:-iPeriodicNwCheck created)")); + iPeriodicNwCheck->Start( + TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*20) + , TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*25) + , TCallBack(StaticCheckNwRequestL,this) ) ; + FLOG(_L("CFMSInterruptAob::CheckNetworkRegistryL- End")); + } + +//------------------------------------------------------------ +// CFMSInterruptAob::StopNetworkRegistryCheckL +//------------------------------------------------------------ +void CFMSInterruptAob::NetworkRegistryCheckL() + { + FLOG(_L("CFMSInterruptAob::StopNetworkRegistryCheckL- begin")); + if(CheckNetworkL()) + { + FLOG(_L("CFMSInterruptAob::StopNetworkRegistryCheckL-n/w found")); + if(iPeriodicNwCheck) + { + delete iPeriodicNwCheck; + iPeriodicNwCheck = NULL; + FLOG(_L("CFMSInterruptAob::iPeriodicNwCheck-deleted")); + } + LaunchFotaEngineL(); + StopServer(); + } + FLOG(_L("CFMSInterruptAob::StopNetworkRegistryCheckL- End")); + } + +//---------------------------------------------------------------------------- +// CFMSInterruptAob::StartBatteryMonitoringL +// Starts the monitoring of Battery +//---------------------------------------------------------------------------- +void CFMSInterruptAob::StartBatteryMonitoringL(TFmsIpcCommands aType, TUint aLevel) + { + FLOG(_L("CFMSInterruptAob::StartBatteryMonitoringL- begin")); + + __ASSERT_ALWAYS(aLevel > EBatteryLevelLevel0 && aLevel <=EBatteryLevelLevel7, User::Leave(KErrArgument)); + + iUpdInterruptType = aType; +if(iUpdInterruptType == EUpdMonitorbattery) + { + FLOG(_L("CFMSInterruptAob::Start- EMonitorbattery")); + TInt value =0; + iChargeToMonitor = aLevel; + iProperty.Attach(KPSUidHWRMPowerState,KHWRMBatteryLevel); + TInt err=iProperty.Get(KPSUidHWRMPowerState,KHWRMBatteryLevel,value); + if(err != KErrNone) + { + FLOG(_L("CFMSInterruptAob::StartBatteryMonitoringL- error in getiing the battery level")); + StopServer(); + } + if(value >= iChargeToMonitor) + { + iProperty.Cancel(); + iProperty.Close(); + TRAPD(err1, LaunchFotaScheduleUpdate()); + if (err1) + { + FLOG(_L("CFMSInterruptAob::error in LaunchFotaScheduleUpdateL()")); + } + + StopServer(); + } + else + { + if(!IsActive()) + { + //RProperty pw; + FLOG(_L("CFMSInterruptAob::Start- attaching for battery")); + + iProperty.Attach(KPSUidHWRMPowerState,KHWRMBatteryLevel); + iStatus=KRequestPending; + iProperty.Subscribe(iStatus); + SetActive(); + } + } + } + FLOG(_L("CFMSInterruptAob::StartBatteryMonitoringL- end")); +} +//---------------------------------------------------------------------------- +// CFMSInterruptAob::LaunchFotaScheduleUpdate +// Launches the FOTA schedule dialog +//---------------------------------------------------------------------------- + +void CFMSInterruptAob::LaunchFotaScheduleUpdate() +{ + TRAP_IGNORE(iServer->DeleteScheduledRemindersL()); + + RFotaEngineSession fotaengine; + TRAPD(error,fotaengine.OpenL()); + if(error == KErrNone) + { + + + FLOG(_L("CFMSInterruptAob::LaunchFotaScheduleUpdate()- going for update again")); + TFotaScheduledUpdate sched(-1,-1); //trigger the Fota remainder dialog here.. + TPckg p(sched); + TRAPD(err, fotaengine.ScheduledUpdateL(sched)); + if(err) + { + FLOG( _L( "[LaunchFotaScheduleUpdate()] FirmwareUpdate scheduling failed " ) ); + } + FLOG(_L("CFMSInterruptAob::LaunchFotaScheduleUpdate()- closing fota engine")); + iUpdInterruptType = ENoInterrupt; + fotaengine.Close(); + } + else + { + FLOG(_L("CFMSInterruptAob::LaunchFotaScheduleUpdate()- error in opening the fota engine")); + + } +} + +//---------------------------------------------------------------------------- +// CFMSInterruptAob::CheckNetworkStatusL +// Checks the network status +//---------------------------------------------------------------------------- +void CFMSInterruptAob::CheckNetworkStatusL() +{ + if(CheckNetworkL()) + { + FLOG(_L("CFMSInterruptAob::RunL()--charging & network found")); + LaunchFotaEngineL(); + StopServer(); + } + else + { + FLOG(_L("CFMSInterruptAob::RunL()--charging but no network found & started monitoring")); + //StartNetWorkMonitoring + iServer->WriteToFile(EDLNetworkInterrupt, iBearer, EDriveC, 0, iWcdma); + StartL(EDLNetworkInterrupt); + } +} + + +//---------------------------------------------------------------------------- +// CFMSInterruptAob::HandleChargingInterruptL +// Handle the cherging interrupt +//---------------------------------------------------------------------------- +void CFMSInterruptAob::HandleChargingInterruptL() +{ + iProperty.Cancel(); + iProperty.Close(); + //check variation + if(iServer->NetworkTobeMonitered()) + { + //Check network status at this moment + CheckNetworkStatusL(); + + } + else + { + FLOG(_L("CFMSInterruptAob::RunL()--charging & network found")); + LaunchFotaEngineL(); + StopServer(); + } +} + +//---------------------------------------------------------------------------- +// CFMSInterruptAob::HandleAboveCriticallevelL +// Handle the meory above critical level +//---------------------------------------------------------------------------- +void CFMSInterruptAob::HandleAboveCriticallevelL() +{ + if(iServer->NetworkTobeMonitered()) + { + if(CheckNetworkL()) + { + FLOG(_L("CFMSInterruptAob::RunL()--memory avail & network found")); + //Notify fota server + LaunchFotaEngineL(); + StopServer(); + } + else + { + FLOG(_L("CFMSInterruptAob::RunL()--memory avail but no network found")); + //StartNetWorkMonitoring + iServer->WriteToFile(EDLNetworkInterrupt, iBearer, iDrive, 0, iWcdma); + StartL(EDLNetworkInterrupt); + } + } + else + { + FLOG(_L("CFMSInterruptAob::RunL()--memory avail & no network monitor ")); + //Notify fota server + LaunchFotaEngineL(); + StopServer(); + } +} +//---------------------------------------------------------------------------- +// CFMSInterruptAob::LaunchFotaUpdate +// Launches the FOTA update dialog +//---------------------------------------------------------------------------- + +void CFMSInterruptAob::LaunchFotaUpdate() + { + RFotaEngineSession fotaengine; + TRAPD(error,fotaengine.OpenL()); + if(error == KErrNone) + { + FLOG(_L("CFMSInterruptAob::LaunchFotaUpdate()- going for update")); + TInt err=fotaengine.Update( -1, -1, KNullDesC8, KNullDesC8 ); + if(err) + { + FLOG( _L( "LaunchFotaUpdate() failed " ) ); + } + FLOG(_L("CFMSInterruptAob::LaunchFotaUpdate()- closing fota engine")); + iUpdInterruptType = ENoInterrupt; + fotaengine.Close(); + } + else + { + FLOG(_L("CFMSInterruptAob::LaunchFotaUpdate()- error in opening the fota engine")); + } + } + + + +//---------------------------------------------------------------------------- +// CFMSInterruptAob::StartCallEndMonitoringL +// starts monitoring for call end +//---------------------------------------------------------------------------- +void CFMSInterruptAob::StartCallEndMonitoringL(TFmsIpcCommands aType) + { + if(!IsActive()) + { + FLOG(_L("Starting Call End Monitoring:Begin")); + iUpdInterruptType = aType; + User::LeaveIfError(iTelServer.Connect()); + _LIT(KTsyName, "phonetsy.tsy");//TSY module names wouldn't change + RTelServer::TPhoneInfo info; + RPhone::TLineInfo lineInfo; + User::LeaveIfError(iTelServer.LoadPhoneModule(KTsyName)); + // Get the details for the first (and only) phone. + User::LeaveIfError(iTelServer.GetPhoneInfo(0, info)); + // Open the phone. + User::LeaveIfError(iPhone.Open(iTelServer, info.iName)); + iPhone.Initialise(); + TInt numberLines = 0; + User::LeaveIfError(iPhone.EnumerateLines(numberLines)); + TBool foundLine = EFalse; + for (TInt a = 0; a < numberLines; a++) + { + User::LeaveIfError(iPhone.GetLineInfo(a, lineInfo)); + if (lineInfo.iLineCapsFlags & RLine::KCapsVoice) + { + foundLine = ETrue; + break; + } + } + if (!foundLine) + { + User::Leave(KErrNotFound); + } + User::LeaveIfError(iLine.Open(iPhone, lineInfo.iName)); + iCallStatus = RCall::EStatusIdle; + iLine.NotifyStatusChange(iStatus, iCallStatus); + SetActive(); + } + FLOG(_L("Starting Call End Monitoring: end")); + } +//End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/src/fmsserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/src/fmsserver.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,839 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "fotaserverPrivateCRKeys.h" +#include "fmsserver.h" +#include "fmsinterruptaob.h" +#include "fmsclientserver.h" +#include "fmsserversession.h" +#include +#include +#include "FotaIPCTypes.h" +// ---------------------------------------------------------------------------------------- +// Server startup code +// ---------------------------------------------------------------------------------------- +static void RunServerL() + { + // naming the server thread after the server helps to debug panics + User::LeaveIfError(User::RenameThread(KFMSServerName)); + + // create and install the active scheduler + CActiveScheduler* s=new(ELeave) CActiveScheduler; + CleanupStack::PushL(s); + CActiveScheduler::Install(s); + + // create the server (leave it on the cleanup stack) + CFMSServer::NewLC(); + + // Initialisation complete, now signal the client + RProcess::Rendezvous(KErrNone); + + // Ready to run + CActiveScheduler::Start(); + + // Cleanup the server and scheduler + CleanupStack::PopAndDestroy(2); + } + + +// ---------------------------------------------------------------------------------------- +// static method LogNwRequestL() called to submit async n/w request +// ---------------------------------------------------------------------------------------- +static TInt LogNwRequestL(TAny* aPtr) + { + CFMSServer* ptr = (CFMSServer*) aPtr; + FLOG(_L("static LogNwRequestL:-Begin")); + TRAPD(err, ptr->StartMonitoringL(EDLNetworkInterrupt)); + FLOG(_L("LogNwRequestL started monitoring")); + ptr->StopAsyncRequest(); + FLOG(_L("static LogNwRequestL:-end")); + return err; + } + + +// ---------------------------------------------------------------------------------------- +// static method LogCallEndMonitorRequestL() called to submit async call end monitor request +// ---------------------------------------------------------------------------------------- +static TInt LogCallEndMonitorRequestL(TAny* aPtr) + { + CFMSServer* ptr = (CFMSServer*) aPtr; + FLOG(_L("static LogCallEndMonitorRequestL:-Begin")); + TRAPD(err, ptr->StartUpdateInterruptMonitoringL(EUpdMonitorPhoneCallEnd)); + FLOG(_L("LogCallEndMonitorRequestL started monitoring")); + ptr->StopAsyncRequest(); + FLOG(_L("static LogCallEndMonitorRequestL:-end")); + return err; + } + +// ---------------------------------------------------------------------------------------- +// Server process entry-point +// ---------------------------------------------------------------------------------------- +TInt E32Main() + { + __UHEAP_MARK; + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt r=KErrNoMemory; + if (cleanup) + { + TRAP(r,RunServerL()); + delete cleanup; + } + __UHEAP_MARKEND; + return r; + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::NewLC +// ---------------------------------------------------------------------------------------- +CServer2* CFMSServer::NewLC() +{ +CFMSServer* self=new(ELeave) CFMSServer; +CleanupStack::PushL(self); +self->ConstructL(); +return self; +} + +// ---------------------------------------------------------------------------------------- +// CFMSServer::ConstructL +// ---------------------------------------------------------------------------------------- +void CFMSServer::ConstructL() + { + FLOG(_L("CFMSServer::ConstructL- begin")); + StartL(KFMSServerName); + User::LeaveIfError( iFs.Connect() ); + TInt err; + err = iFs.CreatePrivatePath(EDriveC); + if ( err != KErrNone && err != KErrAlreadyExists ) + { User::Leave (err); } + User::LeaveIfError( iFs.SetSessionToPrivate( EDriveC ) ); + err = iFile.Create(iFs,KFotaInterruptFileName,EFileWrite); + if(err == KErrNone)//means file created now and opened + { + FLOG(_L("CFMSServer::ConstructL- file closed")); + iFile.Close(); + } + else if( err != KErrAlreadyExists ) + { + FLOG(_L("CFMSServer::ConstructL- leaving with err as %d"),err); + User::Leave(err); + } + FindVariation(); + iFMSInterruptAob.ConstructL(); + iFMSInterruptAob.iServer = this; + FLOG(_L("CFMSServer::ConstructL- end")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::CFMSServer() +// ---------------------------------------------------------------------------------------- +CFMSServer::CFMSServer() :CServer2(EPriorityStandard, EUnsharableSessions) /*CServer2(0)*/ + { + iSessionCount = 0; + //iNetworkMon = ETrue; //Incase of cenrep key has problem + iNetworkMon = EFalse; + iChargerMon = EFalse; + iPhoneRestartMon = EFalse; + iMemoryMon = EFalse; + iDeleteFile = ETrue; + iLogAsyncRequest = NULL; + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::MemoryToMonitorL() +// ---------------------------------------------------------------------------------------- +void CFMSServer::MemoryToMonitorL(TInt aSize, TDriveNumber aDrive) + { + if( iSessionCount == 0 )// no pending request + { + iFMSInterruptAob.MemoryToMonitorL(aSize,aDrive); + } + } +// ---------------------------------------------------------------------------------------- +// CFMSServer::NetworkTypeL() +// ---------------------------------------------------------------------------------------- +void CFMSServer::NetworkTypeL(TInt aBearer) + { + if( iSessionCount == 0 )// no pending request + { + iFMSInterruptAob.NetworkTypeL(aBearer); + } + } + +//------------------------------------------------------------ +// Call from session class in fotastartup case +// CFMSServer::CheckNetworkL +//------------------------------------------------------------ +void CFMSServer::CheckNetworkL(TInt& aBearerId, TInt& aDrive, TInt& aSize, + TBool& aWcdma) + { + if(iNetworkMon)//n/w monitoring supports + { + FLOG(_L("CFMSServer::CheckNetworkL- n/w monitor supported")); + if(iFMSInterruptAob.CheckNetworkL()) //not n/w interrupt + WLAN or GPRS + { + FLOG(_L("CFMSServer::CheckNetworkL- n/w mon supported & launch fota")); + iFMSInterruptAob.LaunchFotaEngineL(); + DropSession(); // to close the session & server + return; + } + else //if network not up, monitor for that + { + //from session itself we set the bearer type + FLOG(_L("CFMSServer::CheckNetworkL- n/w not up beaerer 3G %d"),aWcdma); + WriteToFile(EDLNetworkInterrupt,aBearerId, + (TDriveNumber)aDrive, aSize, aWcdma ); + StartMonitoringL(EDLNetworkInterrupt); + } + } + else //user interrupt or general interrupt dont check n/w call fota + { + FLOG(_L("CFMSServer::CheckNetworkL- n/w monitor not supported & launch fota")); + iFMSInterruptAob.LaunchFotaEngineL(); + FLOG(_L("CFMSServer::CheckNetworkL- stop server")); + DropSession(); + } + } + +//------------------------------------------------------------ +// Call from session class in hard reboot only +// CFMSServer::TriggerFotaL +//------------------------------------------------------------ +void CFMSServer::TriggerFotaL() + { + FLOG(_L("CFMSServer::TriggerFotaL- begin")); + if(iNetworkMon)//n/w monitoring supports + { + FLOG(_L("CFMSServer::TriggerFotaL- n/w monitor supported")); +#if defined (__WINS__) + if(ETrue) +#else + if(iFMSInterruptAob.CheckNetworkL()) +#endif + { + FLOG(_L("CFMSServer::TriggerFotaL- n/w mon supported & launch fota")); + iFMSInterruptAob.LaunchFotaEngineL(); + } + else if(iFMSInterruptAob.CheckGlobalRFStateL()) + { + FLOG(_L("CFMSServer::TriggerFotaL- n/w check started")); + iFMSInterruptAob.StartNetworkRegistryCheckL(); + return; //dont call drop session as it closes server + } + else + { + FLOG(_L("CFMSServer::TriggerFotaL- phone is offline")); + } + } + else //user interrupt or general interrupt dont check n/w call fota + { + FLOG(_L("CFMSServer::TriggerFotaL- n/w monitor not supported & launch fota")); + iFMSInterruptAob.LaunchFotaEngineL(); + FLOG(_L("CFMSServer::TriggerFotaL- stop server")); + } + DropSession(); // to close the session & server in any case + FLOG(_L("CFMSServer::TriggerFotaL- End")); + } + +//------------------------------------------------------------ +// Called only in n/w interrupt+ WLAN case from session class +// CFMSServer::CheckWlanL +//------------------------------------------------------------ +TBool CFMSServer::CheckWlanL() + { + return iFMSInterruptAob.CheckNetworkL(); + } + +//------------------------------------------------------------ +// CFMSServer::SetWcdma +//------------------------------------------------------------ +void CFMSServer::SetWcdma() + { + iFMSInterruptAob.SetWcdma(); + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::LockSession() +// ---------------------------------------------------------------------------------------- +void CFMSServer::LockSession() + { + iSessionCount++; + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::WriteToFile() +// ---------------------------------------------------------------------------------------- +void CFMSServer::WriteToFile(TInt aReason, TInt aBearer,TDriveNumber aDrive, + TInt aSize, TBool aWcdmaBearer ) + { + if(iSessionCount == 0) + { + FLOG(_L("CFMSServer::WriteToFile- begin")); + TInt err=iFile.Open(iFs,KFotaInterruptFileName,EFileWrite); + if(err == KErrNone) + { + FLOG(_L("CFMSServer::WriteToFile--passed")); + TBuf8<30> data;//size 30 or 32--as args is 16 bytes + TBuf8<30> temp; + temp.Num(aReason); + data.Append(temp); + data.Append(','); + temp.Num(aBearer);// or use iFMSinterruptAob's iBearer + data.Append(temp); + data.Append(','); + temp.Num((TInt)aDrive); + data.Append(temp); + data.Append(','); + temp.Num(aSize); + data.Append(temp); + data.Append(','); + temp.Num(aWcdmaBearer); + data.Append(temp); + iFile.Write(data); + iFile.Close(); + } + else + FLOG(_L("CFMSServer::WriteToFile- Failed")); + } + else + FLOG(_L("CFMSServer::WriteToFile- not done as another request is there")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::ReadFromFile() +// ---------------------------------------------------------------------------------------- +TBool CFMSServer::ReadFromFile(TInt& aReason, TInt& aBearer, TInt& aDrive, TInt& aSize + , TInt& aWcdmaBearer ) + { + TInt err = iFile.Open(iFs,KFotaInterruptFileName,EFileRead); + FLOG(_L("CFMSServer::ReadFromFile() error as %d"),err); + if(err == KErrNone) + { + TInt size = KErrNone; + err = iFile.Size(size); + if(size == 0) //file empty + { + FLOG(_L("CFMSServer::ReadFromFile() file size is empty")); + iFile.Close(); + return EFalse; + } + TBuf8<30> data; + iFile.Read(data); + iFile.Close(); + TBuf8<30> data1; + if(data.Length()>0) + { + TInt len =0 ; + if((len=data.LocateF(',')) > 0) + { + TLex8 value( data.Left(len)); + value.Val(aReason); + FLOG(_L("CFMSServer::ReadFromFile() retrieving reason as %d"),aReason); + data1.Insert(0,data.Right(data.Length()-(len+1))); + data.Zero(); + // len=data1.LocateF(','); + if( data1.Length() > 0 && (len=data1.LocateF(',')) > 0) + { + value=data1.Left(len); + value.Val(aBearer); + FLOG(_L("CFMSServer::ReadFromFile() retrieving aBearer as %d"),aBearer); + data.Insert(0,data1.Right(data1.Length()-(len+1))); + data1.Zero(); + // len=data.LocateF(','); + if(data.Length() > 0 && ( len=data.LocateF(','))> 0) + { + value=data.Left(len); + value.Val(aDrive); + FLOG(_L("CFMSServer::ReadFromFile() retrieving aDrive as %d"),aDrive); + data1.Insert(0,data.Right(data.Length()-(len+1))); + data.Zero(); + if(data1.Length() > 0 && ( len=data1.LocateF(','))> 0 ) + { + value=data1.Left(len); + value.Val(aSize); + FLOG(_L("CFMSServer::ReadFromFile() retrieving aSize as %d"),aSize); + data.Insert(0,data1.Right(data1.Length()-len-1)); + data1.Zero(); + if(data.Length() > 0 ) + { + value=data; + value.Val(aWcdmaBearer); + FLOG(_L("CFMSServer::ReadFromFile() retrieving aWcdmaBearer as %d"),aWcdmaBearer); + } + } + } + } + } + } + } + else + { + return EFalse; + } + return ETrue; + } + +// ----------------------------------------------------------------------------- +// CFMSServer::DropSession() +// ----------------------------------------------------------------------------- + +void CFMSServer::DropSession() + { + // A session is being destroyed + iSessionCount = 0; + //Kill the server + CActiveScheduler::Stop(); + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::FindVariation() +// ---------------------------------------------------------------------------------------- +void CFMSServer::FindVariation() + { + FLOG(_L("CFMSServer::FindVariation()")); + CRepository* centrep = NULL; + TInt variation = 1; + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if ( centrep ) + { + FLOG(_L("CFMSServer::FindVariation()::Inside cenrep if")); + TInt err = centrep->Get( KFotaMonitoryServiceEnabled, variation ); + if( err == KErrNone) + { + FLOG(_L("CFMSServer::FindVariation()::cenrep key found with %d"),variation); + } + delete centrep; + } + if ( err == KErrNone ) + { + TBuf<10> var; //32-bit has max of 10 chars in Decimal + var.Num(variation,EBinary); + TInt size = var.Length(), maxlen = 4; + if( size < maxlen) + { + TBuf<4> temp; + temp.AppendFill('0',maxlen-size); + temp.Append(var); + var.Zero(); + var.Append(temp); + } + var.AppendFill('0',6); + if( var[0] == '1' )//memory + { + FLOG(_L("CFMSServer::FindVariation():: memory monitor supported")); + iMemoryMon = ETrue; + } + if( var[1] == '1' ) //startup + { + FLOG(_L("CFMSServer::FindVariation()::Phone restart monitor supported")); + iPhoneRestartMon = ETrue; + } + if( var[2] == '1' )//user or charger + { + FLOG(_L("CFMSServer::FindVariation()::charger monitor supported")); + iChargerMon = ETrue; + } + if( var[3] == '1' )//newtwork + { + FLOG(_L("CFMSServer::FindVariation()::network monitor supported")); + iNetworkMon = ETrue; + } + } + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::ChargerTobeMonitered() +// ---------------------------------------------------------------------------------------- +TBool CFMSServer::ChargerTobeMonitered() + { + FLOG(_L("CFMSServer::ChargerTobeMonitered()::charger monitor check")); + return iChargerMon; + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::NetworkTobeMonitered() +// ---------------------------------------------------------------------------------------- +TBool CFMSServer::NetworkTobeMonitered() + { + FLOG(_L("CFMSServer::NetworkTobeMonitered()::network monitor check")); + return iNetworkMon; + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::MoniterAfterPhoneRestart() +// ---------------------------------------------------------------------------------------- +TBool CFMSServer::MoniterAfterPhoneRestart() + { + FLOG(_L("CFMSServer::MoniterAfterPhoneRestart()::phonerestart monitor check")); + return iPhoneRestartMon; + } + +// ---------------------------------------------------------------------------------------- +// CFMSServer::MemoryTobeMonitered() +// ---------------------------------------------------------------------------------------- +TBool CFMSServer::MemoryTobeMonitered() + { + FLOG(_L("CFMSServer::MemoryTobeMonitered()::memory monitor check")); + return iMemoryMon; + } + +// ----------------------------------------------------------------------------- +// CFMSServer::StartMonitoring() +// ----------------------------------------------------------------------------- +void CFMSServer::StartMonitoringL(TFmsIpcCommands aType) + { + // A new session is being created + FLOG(_L("CFMSServer::StartMonitoringL>>")); + if( iSessionCount == 0 ) + { + ++iSessionCount; + iFMSInterruptAob.StartL(aType); + } + FLOG(_L("CFMSServer::StartMonitoringL<<")); + } + +// ----------------------------------------------------------------------------- +// CFMSServer::DeleteFile() +// ----------------------------------------------------------------------------- +void CFMSServer::DeleteFile(TBool aValue) + { + iDeleteFile = aValue; + } +// ---------------------------------------------------------------------------------------- +// CFMSServer::~CFMSServer() +// ---------------------------------------------------------------------------------------- +CFMSServer::~CFMSServer() +{ +FLOG(_L("CFMSServer::~CFMSServer())")); +//iFMSInterruptAob.Cancel(); +if(iDeleteFile) + { + TInt err = iFs.Delete(KFotaInterruptFileName); + FLOG(_L("CFMSServer::~CFMSServer() File Deleted with error as %d"),err); + } +if(iLogAsyncRequest) + { + FLOG(_L("CFMSServer::~CFMSServer():-iLogAsyncRequest cancel)")); + iLogAsyncRequest->Cancel(); + delete iLogAsyncRequest; + iLogAsyncRequest = NULL; + } +iFs.Close(); +} + +// ---------------------------------------------------------------------------------------- +// CFMSServer::NewSessionL() +// ---------------------------------------------------------------------------------------- +CSession2* CFMSServer::NewSessionL(const TVersion&,const RMessage2&) const +{ +return new (ELeave) CFMSSession(); +} + +// ---------------------------------------------------------------------------------------- +// CFMSServer::RequestPending() +// Any request pending +// ---------------------------------------------------------------------------------------- +TBool CFMSServer::RequestPending() + { + if( iSessionCount > 0 ) + { + return ETrue; + } + return EFalse; + } + +// ---------------------------------------------------------------------------- +// CFMSServer::AsyncSessionRequestL() +// Asynchronous request logging +// ---------------------------------------------------------------------------- +void CFMSServer::AsyncSessionRequestL() + { + if(iLogAsyncRequest) + { + FLOG(_L("CFMSServer::AsyncSessionRequestL():-iLogAsyncRequest cancel)")); + iLogAsyncRequest->Cancel(); + delete iLogAsyncRequest; + iLogAsyncRequest = NULL; + } + iLogAsyncRequest = CPeriodic::NewL (EPriorityNormal) ; + FLOG(_L("CFMSServer::AsyncSessionRequestL():-iLogAsyncRequest created)")); + iLogAsyncRequest->Start( + TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*4) + , TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*4) + , TCallBack(LogNwRequestL,this) ) ; + FLOG(_L("CFMSServer::AsyncSessionRequestL():-Request logged)")); + } + +// ----------------------------------------------------------------------------- +// CFMSServer::AsyncSessionRequestL() +// Asynchronous request logging +// ----------------------------------------------------------------------------- +void CFMSServer::StopAsyncRequest() + { + FLOG(_L("CFMSServer::StopAsyncRequest():-Begin)")); + if(iLogAsyncRequest) + { + FLOG(_L("CFMSServer::StopAsyncRequest():-cancelling the request)")); + iLogAsyncRequest->Cancel(); + delete iLogAsyncRequest; + iLogAsyncRequest = NULL; + } + FLOG(_L("CFMSServer::StopAsyncRequest():-End)")); + } + +// ----------------------------------------------------------------------------- +// CFMSServer::StartBatteryMonitoringL() +// Monitors for the battery +// ----------------------------------------------------------------------------- +void CFMSServer::StartBatteryMonitoringL(TFmsIpcCommands aType, TUint aLevel) + { + // A new session is being created + FLOG(_L("CFMSServer::StartMonitoringL, level = %d>>"), aLevel); + if( iSessionCount == 0 ) + { + ++iSessionCount; + iFMSInterruptAob.StartBatteryMonitoringL(aType, aLevel); + } + FLOG(_L("CFMSServer::StartMonitoringL<<")); + } +// ----------------------------------------------------------------------------- +// CFMSServer::StartUpdateInterruptMonitoringL() +// Monitors for the update interrupt type +// ----------------------------------------------------------------------------- +void CFMSServer::StartUpdateInterruptMonitoringL(TFmsIpcCommands aType) + { + // A new session is being created + FLOG(_L("CFMSServer::StartUpdateInterruptMonitoringL>>")); + if(EUpdMonitorPhoneCallEnd == aType) + { + iFMSInterruptAob.StartCallEndMonitoringL(aType); + } + else + { + FLOG(_L("reason unknown")); + } + FLOG(_L("CFMSServer::StartUpdateInterruptMonitoringL<<")); + } + +// ----------------------------------------------------------------------------- +// CFMSServer::CheckPhoneCallActiveL() +// checks any phone call is there or not at this moment +// ----------------------------------------------------------------------------- +void CFMSServer::CheckPhoneCallActiveL(TInt& aStatus) + { + FLOG(_L("CFMSServer::CheckPhoneCallActiveL>>")); + TInt callstatus(KErrNotFound); + RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callstatus); + //check ctsydomainpskeys.h for different combinations, below OR condition holds good + if(EPSCTsyCallStateUninitialized == callstatus || + EPSCTsyCallStateNone == callstatus ) // call not active + { + aStatus = EFalse; + } + else // call active + { + aStatus = ETrue; + } + FLOG(_L("CFMSServer::CheckPhoneCallActiveL status is %d<<"),aStatus); + } + +// ----------------------------------------------------------------------------- +// CFMSServer::MonitorPhoneCallEndL() +// Monitors for active phone call end +// ----------------------------------------------------------------------------- +TBool CFMSServer::MonitorPhoneCallEndL() + { + TInt CallState = KErrNotFound; + + CheckPhoneCallActiveL(CallState); + if(CallState) + { + //go for call end montioring + LogAsyncCallMonitorL(); + return EFalse; + } + else //trigger fota to show install query + { + return ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CFMSServer::LogAsyncCallMonitorL() +// Async request to monitor active phone call end +// ----------------------------------------------------------------------------- +void CFMSServer::LogAsyncCallMonitorL() + { + if(iLogAsyncRequest) + { + FLOG(_L("CFMSServer::LogAsyncCallMonitorL():- cancel)")); + iLogAsyncRequest->Cancel(); + delete iLogAsyncRequest; + iLogAsyncRequest = NULL; + } + iLogAsyncRequest = CPeriodic::NewL (EPriorityNormal) ; + FLOG(_L("CFMSServer::LogAsyncCallMonitorL(): created)")); + iLogAsyncRequest->Start( + TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*1) + , TTimeIntervalMicroSeconds32(KRequestTriggerWaitTime*4) + , TCallBack(LogCallEndMonitorRequestL,this) ) ; + FLOG(_L("CFMSServer::LogAsyncCallMonitorL():-Request logged)")); + } + + +void CFMSServer::CreateScheduledReminderL() + { + FLOG(_L("CFMSServer::CreateScheduledReminderL ()")); + _LIT(KFotaScheduleExe, "Z:\\sys\\bin\\fotaschedulehandler.exe"); + + RScheduler scheduler; + TTsTime startTime; + TTime time; + time.HomeTime(); + time = time + (TTimeIntervalHours(1)); + startTime.SetLocalTime(time); + + User::LeaveIfError(scheduler.Connect()); + CleanupClosePushL(scheduler); + //Creating a persistent daily schedule + + TSchedulerItemRef persistentScheduleItem; + CArrayFixFlat* entries = new CArrayFixFlat (1); + CleanupStack::PushL(entries); + persistentScheduleItem.iName = TUid::Uid(KFMSServerUid).Name(); + + //TScheduleEntryInfo2 scentry1(startTime, EDaily, 1, 1); + TScheduleEntryInfo2 scentry1; + scentry1.SetStartTime(startTime); + scentry1.SetInterval(1); + scentry1.SetIntervalType(TIntervalType(EHourly)); + scentry1.SetValidityPeriod((TTimeIntervalMinutes) 1440); //1440 min = 24 hrs or 1 day + + entries->AppendL(scentry1); + + scheduler.Register(TFileName( KFotaScheduleExe ), 0 ); + TInt ret = scheduler.CreatePersistentSchedule(persistentScheduleItem, *entries); + + FLOG(_L("created schedule %d %d:%d"), persistentScheduleItem.iHandle, + time.DateTime().Hour(), time.DateTime().Minute()); + + if (ret == KErrNone) + { + TTaskInfo taskInfo; + taskInfo.iName = TUid::Uid(KFMSServerUid).Name(); + taskInfo.iRepeat = 1; //Repeat once + taskInfo.iPriority = 1; + + TFotaScheduledUpdate fotareminder(-1, -1); + TPckg fotareminderpkg(fotareminder); + + HBufC* data = HBufC::NewLC(fotareminderpkg.Length()); + data->Des().Copy(fotareminderpkg); + + TInt err = scheduler.ScheduleTask(taskInfo, *data, persistentScheduleItem.iHandle); + + FLOG(_L("Schedule creation error %d"), err); + + CleanupStack::PopAndDestroy(data); + } + CleanupStack::PopAndDestroy(entries); + CleanupStack::PopAndDestroy(&scheduler); // xx + } + + +void CFMSServer::DeleteScheduledRemindersL() + { + FLOG(_L("CFMSServer::DeleteScheduledRemindersL >>")); + + TScheduleEntryInfo2 ret; + TInt err; + RScheduler sc; + TTime t; + TTsTime time; + TSchedulerItemRef scitem; + CArrayFixFlat* aSchRefArray = new CArrayFixFlat (5); + TScheduleFilter aFilter(EAllSchedules); + User::LeaveIfError( sc.Connect() ); + CleanupClosePushL( sc ); + CleanupStack::PushL(aSchRefArray); + + User::LeaveIfError( sc.GetScheduleRefsL( *aSchRefArray,aFilter) ); + FLOG(_L("Schedule items: ")); + for ( TInt i=0; iCount(); ++i ) + { + TSchedulerItemRef it = (*aSchRefArray)[i]; + if ( it.iName == TUid::Uid(KFMSServerUid).Name() ) + { + TScheduleState2 sc_state; + CArrayFixFlat* sc_entries = new CArrayFixFlat (5); + CArrayFixFlat* sc_tasks = new CArrayFixFlat (5); + TTsTime sc_duetime; + CleanupStack::PushL( sc_entries ); + CleanupStack::PushL( sc_tasks ); + FLOG (_L("%d. schedule handle: %d name:'%S'"),i,it.iHandle, &(it.iName) ); + + err = sc.GetScheduleL ( it.iHandle , sc_state, *sc_entries,*sc_tasks,sc_duetime ); // xx + + TDateTime dtm = sc_duetime.GetLocalTime().DateTime(); + FLOG(_L(" schedule duetime:%d:%d"), dtm.Hour(), dtm.Minute()); + + if ( err ) FLOG(_L(" schedule sc get err %d"),err); + else + { + for ( TInt k=0; kCount();++k) + { + TScheduleEntryInfo2 sc_entry = (*sc_entries)[k]; + ret = sc_entry; + TTime sctime = sc_entry.StartTime().GetLocalTime(); + FLOG(_L(" schedule entry %d int-type:%d int:%d start: %d:%d"),k,sc_entry.IntervalType(),sc_entry.Interval(),sctime.DateTime().Hour(),sctime.DateTime().Minute()); + } + + for ( TInt j=0; jCount();++j) + { + TTaskInfo sc_task = (*sc_tasks)[j]; + FLOG(_L(" schedule task %d '%S'"),sc_task.iTaskId,&(sc_task.iName) ); + if ( sc_task.iName==TUid::Uid(KFMSServerUid).Name() ) + { + FLOG(_L(" schedule DeleteTask %d"),sc_task.iTaskId); + User::LeaveIfError( sc.DeleteTask(sc_task.iTaskId) ); + } + } + } + + FLOG(_L(" DeleteSchedule %d"),it.iHandle); + err = sc.DeleteSchedule(it.iHandle ); + FLOG(_L("Delete status of tasks = %d"), err); + + CleanupStack::PopAndDestroy( sc_tasks ); + CleanupStack::PopAndDestroy( sc_entries ); + } + } + CleanupStack::PopAndDestroy( aSchRefArray ); + CleanupStack::PopAndDestroy(&sc); + + FLOG(_L("CFMSServer::DeleteScheduledRemindersL <<")); + } +//End of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fmserver/src/fmsserversession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fmserver/src/fmsserversession.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,513 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +#include +#include +#include +#include +#include +#include //for telephone mode +#include //for telephone mode +#include +#include "fmsserversession.h" +#include "fmsclientserver.h" + +#if defined (__WINS__) +#include +#endif +// ---------------------------------------------------------------------------------------- +// CFMSSession::CFMSSession +// ---------------------------------------------------------------------------------------- +CFMSSession::CFMSSession() + { + iStopServer = EFalse; + iWlanbearer = EFalse; + iWcdmaBearer = EFalse; + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::~CFMSSession +// ---------------------------------------------------------------------------------------- +CFMSSession::~CFMSSession() + { + FLOG(_L("CFMSSession::~CFMSSession-- begin")); + if( iStopServer ) + { + FLOG(_L("Stop fmserver CFMSSession::~CFMSSession")); + Server().DropSession(); + } + FLOG(_L("CFMSSession::~CFMSSession-- end")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::Server +// ---------------------------------------------------------------------------------------- +CFMSServer& CFMSSession::Server() + { + return *static_cast(const_cast(CSession2::Server())); + } + + +// ---------------------------------------------------------------------------------------- +// CFMSSession::CheckClientSecureIdL +// ---------------------------------------------------------------------------------------- +TBool CFMSSession::CheckClientSecureIdL ( + const RMessage2& aMessage) + { + TUid fota = TUid::Uid( KFotaServerUid ); + TUid starter = TUid::Uid( KStarterUid ); + + // Fotaserver + if ( aMessage.SecureId() == fota.iUid ) + { + FLOG(_L("[CFMSSession] CheckClientSecureIdL client is \ + fotaserver!")); + return ETrue; + } + + // Starter + if ( aMessage.SecureId() == starter.iUid ) + { + return ETrue; + } + + // test app + if ( aMessage.SecureId() == 0x01D278B9 ) + { + return ETrue; + } + + FLOG(_L("[CFMSSession] CheckClientSecureIdL client 0x%X is unknown \ + (msg %d), bailing out"),aMessage.SecureId().iId, aMessage.Function()); + iStopServer = ETrue; + User::Leave( KErrAccessDenied ); + return EFalse; // compiler warning otherwise + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::ServiceL +// ---------------------------------------------------------------------------------------- +void CFMSSession::ServiceL(const RMessage2& aMessage) + { + RThread clt; aMessage.ClientL(clt); TFullName cltnm = clt.FullName(); + FLOG(_L( "CFMSSession::ServiceL %d serving for %S?" ) + ,aMessage.Function(), &cltnm ); + if( CheckClientSecureIdL( aMessage ) ) + { + //already one request pending + if( Server().RequestPending() && + aMessage.Function() != ECancelOutstandingRequest ) + { + aMessage.Complete(KErrCancel); + } + else //For no pending request case + { + TRAPD(err,DispatchMessageL(aMessage)); + if(err != KErrNone ) + { + iStopServer = ETrue; + } + aMessage.Complete(err); + } + } + else + { + aMessage.Complete(KErrAccessDenied); + } + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::ServiceError +// ---------------------------------------------------------------------------------------- +void CFMSSession::ServiceError(const RMessage2& aMessage,TInt aError) + { + CSession2::ServiceError(aMessage,aError); + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::DispatchMessageL +// ---------------------------------------------------------------------------------------- +void CFMSSession::DispatchMessageL(const RMessage2& aMessage) + { + FLOG(_L("CFMSSession::DispatchMessageL-begin")); + + if( aMessage.Function() != EFotaStartUpPlugin && + aMessage.Function() != ECancelOutstandingRequest && + aMessage.Function() != EUpdMonitorbattery && + aMessage.Function() != EUpdPhoneCallActive && + aMessage.Function() != EUpdMonitorPhoneCallEnd ) + { + + HandleBasedOnBearertypeL(aMessage); + + + + } + switch(aMessage.Function()) + { + case EDLUserInterrupt: + { + Server().CreateScheduledReminderL(); + + if(Server().ChargerTobeMonitered()) + { + FLOG(_L("FMSSErver::EUserInterrupt")); + Server().WriteToFile(EDLUserInterrupt,aMessage.Int0(), + (TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer); + Server().StartMonitoringL(EDLUserInterrupt); + } + else + { + WriteDummyFile(); + iStopServer = ETrue; + } + } + break; + case EDLNetworkInterrupt: + { + if(Server().NetworkTobeMonitered()) + { + FLOG(_L("FMSSErver::ENetworkInterrupt")); + //If wlan = on & network interrupt, then stop the server and dont monitor + //mean other wlan n/w's present but this wlan gone off + if(iWlanbearer && Server().CheckWlanL()) + { + WriteDummyFile(); + Server().DeleteFile(EFalse); + iStopServer = ETrue; + break; + } + Server().WriteToFile(EDLNetworkInterrupt,aMessage.Int0(), + (TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer); + Server().AsyncSessionRequestL(); + } + else + { + WriteDummyFile(); + iStopServer = ETrue; + } + } + break; + case EDLMemoryInterrupt: + { + if(Server().MemoryTobeMonitered()) + { + FLOG(_L("FMSSErver::EMemoryInterrupt")); + Server().MemoryToMonitorL(aMessage.Int2(),(TDriveNumber)aMessage.Int1()); + Server().WriteToFile(EDLMemoryInterrupt,aMessage.Int0(), + (TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer); + Server().StartMonitoringL(EDLMemoryInterrupt); + } + else + { + WriteDummyFile(); + iStopServer = ETrue; + } + } + break; + case EDLGeneralInterrupt: + { + if(Server().ChargerTobeMonitered()) + { + FLOG(_L("FMSSErver::GeneralInterrupt")); + Server().WriteToFile(EDLUserInterrupt,aMessage.Int0(), + (TDriveNumber)aMessage.Int1(),aMessage.Int2(),iWcdmaBearer); + Server().StartMonitoringL(EDLUserInterrupt); + } + else + { + WriteDummyFile(); + iStopServer = ETrue; + } + } + break; + case EFotaStartUpPlugin: + { + if(Server().MoniterAfterPhoneRestart()) + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin")); + TInt intrreason(-1),bearer(-1),size(0); + TInt drive(-1), wcdmabearer(-1); + //if loop for Hard reboot--no file or size is empty +#if defined(__WINS__) + if(ETrue) +#else + if(Server().ReadFromFile(intrreason,bearer,drive,size,wcdmabearer) == EFalse ) +#endif + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin no file or size is empty")); + if(!Server().RequestPending()) + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin-no request pending")); + TRAPD(err,PhoneModeL()); + if(err); // remove compiler warning + FLOG(_L("PhoneModeL() fotastartup returns err as %d"),err); + if(iWcdmaBearer) + Server().NetworkTypeL( (TInt)EBearerIdWCDMA ); + + else + Server().NetworkTypeL( (TInt)EBearerIdGPRS ); + Server().LockSession(); + Server().TriggerFotaL(); //checks n/w & trigger FOTA DL + } + break; + } + TUint32 BearerId = FindBearerIdL(bearer); + FLOG(_L("CFMSSession::EFotaStartUpPlugin wcdma bearer is %d"),wcdmabearer); + if( BearerId == KUidWlanBearerType ) + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin-wlan bearer")); + Server().NetworkTypeL(EBearerIdWLAN); + if(intrreason == EDLNetworkInterrupt) + { + //stop the server , but dont delete file to support in second reboot + FLOG(_L("wlan bearer & n/w interrupt--stopping the server")); + Server().DeleteFile(EFalse); + iStopServer = ETrue; + break; + } + } + else if( BearerId == KUidPacketDataBearerType ) + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin-bearer is packet data")); + if( wcdmabearer == 1 ) + { + Server().NetworkTypeL(EBearerIdWCDMA); + FLOG(_L("CFMSSession::EFotaStartUpPlugin-packet data and 3G")); + } + else + { + Server().NetworkTypeL(EBearerIdGPRS); + FLOG(_L("CFMSSession::EFotaStartUpPlugin-packet data and 2G")); + } + } + else + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin-unknown bearer")); + Server().DeleteFile(EFalse); + iStopServer = ETrue; + break; + } + //when there is dummy file in the store + if( intrreason < EDLUserInterrupt || intrreason > EDLGeneralInterrupt ) + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin-Interrupt unknown")); + Server().DeleteFile(EFalse); //used when variation support & reboot again + iStopServer = ETrue; + break; + } + if( intrreason == EDLUserInterrupt || intrreason == EDLGeneralInterrupt ) + { + FLOG(_L("CFMSSession::EFotaStartUpPlugin-Check n/w & trigger fotaengine")); + Server().CheckNetworkL(bearer,drive,size,wcdmabearer);//3 params used in monitoring if no n/w + break; + } + //for other interrupts it will monitor + Server().StartMonitoringL((TFmsIpcCommands)intrreason); + } + else + { + iStopServer = ETrue; + } + } + break; + case ECancelOutstandingRequest: + { + FLOG(_L("CFMSSession::DispatchMessageL ECancelOutstandingRequest case:")); + Server().DeleteScheduledRemindersL(); + iStopServer = ETrue; + } + break; + + case EUpdMonitorbattery: + { + FLOG(_L("CFMSSession::DispatchMessageL EUpdMonitorbattery case:")); + Server().StartBatteryMonitoringL(EUpdMonitorbattery, aMessage.Int0()); + } + break; + + case EUpdPhoneCallActive: + { + FLOG(_L("CFMSSession::DispatchMessageL EUpdPhoneCallActive case:")); + Server().LockSession(); + TInt reason =EFalse; + Server().CheckPhoneCallActiveL(reason); + TPckgBuf callactive(reason); + aMessage.WriteL(0,callactive); + Server().iSessionCount = 0; + FLOG(_L("CFMSSession::DispatchMessageL EUpdPhoneCallActive case:%d"),reason); + iStopServer = ETrue; + } + break; + + case EUpdMonitorPhoneCallEnd: + { + FLOG(_L("CFMSSession::DispatchMessageL EUpdMonitorPhoneCallEnd case:%d,%d"),aMessage.Int0(),aMessage.Int1()); + Server().LockSession(); + if(Server().MonitorPhoneCallEndL()) + { + iStopServer = ETrue; + Server().iSessionCount = 0; + } + else //let server monitor for active call end + { + iStopServer = EFalse; + } + } + break; + default: + { + FLOG(_L("CFMSSession::DispatchMessageL default case:and a leave happened")); + iStopServer = ETrue; + User::Leave(KErrArgument); + } + } + FLOG(_L("CFMSSession::DispatchMessageL:end")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::FindBearerId +// ---------------------------------------------------------------------------------------- +TUint32 CFMSSession::FindBearerIdL(TInt aIapId) + { + FLOG(_L("CFMSSession::FindBearerId: % d"),aIapId); + TUint32 bearer = 0; + TInt err( KErrNone ); + // Query CM Id + TInt cmId ( aIapId ); + RCmManagerExt CmManagerExt; + TRAP( err, CmManagerExt.OpenL() ); + if( err == KErrNone ) + { + RCmConnectionMethodExt cm; + TRAP( err, cm = CmManagerExt.ConnectionMethodL( cmId ) ); + if ( err == KErrNone ) + { + CleanupClosePushL( cm ); + bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); + CleanupStack::PopAndDestroy(); // cm + } + CmManagerExt.Close(); + } + return bearer; + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::WriteDummyFile +// This method used when the variation wouldn't support and startup called +// and also differentiates hard reeboot(with empty or no file) +// ---------------------------------------------------------------------------------------- +void CFMSSession::WriteDummyFile() + { + FLOG(_L("CFMSSession::WriteDummyFile--begin")); + Server().WriteToFile(KErrNotFound,KErrNotFound, + (TDriveNumber)KErrNotFound,KErrNotFound,EFalse); + Server().DeleteFile(EFalse); + FLOG(_L("CFMSSession::WriteDummyFile--End")); + } + +// ---------------------------------------------------------------------------------------- +// CFMSSession::PhoneMode +// This method used to know the current phone mode +// If the phone is in dual mode it will check GPRS bearer only +// ---------------------------------------------------------------------------------------- +void CFMSSession::PhoneModeL() + { + FLOG(_L("CFMSSession::PhoneModeL--begin")); + // find out if we are in 2G or in 3G - it is needed for calculating bearer availability + __UHEAP_MARK; + RTelServer telServer; + User::LeaveIfError( telServer.Connect()); + FLOG(_L("CFMSSession::PhoneModeL--telServer Connected")); + RTelServer::TPhoneInfo teleinfo; + User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) ); + FLOG(_L("CFMSSession::PhoneModeL--telServer getting tel info")); + RMobilePhone phone; + User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) ); + FLOG(_L("CFMSSession::PhoneModeL--RMobilePhone opened")); + User::LeaveIfError(phone.Initialise()); + FLOG(_L("CFMSSession::PhoneModeL--phone.Initialise() success")); + RMobilePhone::TMobilePhoneNetworkMode mode; + TInt err = phone.GetCurrentMode( mode ); + phone.Close(); + telServer.Close(); + __UHEAP_MARKEND; + + if( KErrNone == err ) + { + switch(mode) + { + case RMobilePhone::ENetworkModeGsm: + //case RMobilePhone::ENetworkModeUnknown: // emulator default + { + FLOG(_L("CFMSSession::PhoneModeL-begin-GSM Mode")); + iWcdmaBearer = EFalse; + Server().NetworkTypeL(EBearerIdGPRS); + break; + } + case RMobilePhone::ENetworkModeWcdma: + { + FLOG(_L("CFMSSession::PhoneModeL-begin-3G Mode")); + iWcdmaBearer = ETrue; + Server().SetWcdma(); + Server().NetworkTypeL(EBearerIdWCDMA); + break; + } + default: + FLOG(_L("unknown")); + } + } + FLOG(_L("CFMSSession::PhoneModeL--end")); + } + +//---------------------------------------------------------------------------------------- +// CFMSSession::HandleBasedOnBearertypeL +// Handles based on bearer type +//---------------------------------------------------------------------------------------- + +void CFMSSession::HandleBasedOnBearertypeL(const RMessage2& aMessage) +{ + TUint32 bearer = FindBearerIdL(aMessage.Int0()); + if( bearer == KUidPacketDataBearerType ) + { + FLOG(_L("CFMSSession::DispatchMessageL bearer is packet data")); + TRAPD(err,PhoneModeL()); + if(err); // remove compiler warning + FLOG(_L("PhoneModeL() returns err as %d"),err); + } + else if ( bearer == KUidWlanBearerType ) + { + FLOG(_L("CFMSSession::DispatchMessageL bearer is WLAN")); + iWlanbearer = ETrue; + Server().NetworkTypeL(EBearerIdWLAN); + } +#if defined(__WINS__) + else if ( bearer == KUidLanBearerType ) + { + FLOG(_L("CFMSSession::DispatchMessageL bearer is LAN")); + Server().NetworkTypeL(EBearerIdLAN); + } +#endif + else + { + FLOG(_L("CFMSSession::DispatchMessageL bearer is not known and a leave happened ")); + iStopServer = ETrue; + User::Leave(KErrArgument); + } +} +//End of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaapplication.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaapplication.pro Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,21 @@ +# +# 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 is the project specification file for the Organizer project. +# + +TEMPLATE = subdirs +CONFIG += ordered +SUBDIRS += fotaserver \ + +# End of file --Don't remove this. diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/bwins/fotacustcmdsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/bwins/fotacustcmdsu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,5 @@ +EXPORTS + ?FotaCustCmdAllReasonsNewL@FotaCustCmdsFactory@@SAPAVMSsmCustomCommand@@XZ @ 1 NONAME ; class MSsmCustomCommand * FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL(void) + ?FotaCustCmdFirmwareUpdateNewL@FotaCustCmdsFactory@@SAPAVMSsmCustomCommand@@XZ @ 2 NONAME ; class MSsmCustomCommand * FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL(void) + ?FotaCustCmdFirstBootNewL@FotaCustCmdsFactory@@SAPAVMSsmCustomCommand@@XZ @ 3 NONAME ; class MSsmCustomCommand * FotaCustCmdsFactory::FotaCustCmdFirstBootNewL(void) + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/eabi/fotacustcmdsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/eabi/fotacustcmdsu.def Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,5 @@ +EXPORTS + _ZN19FotaCustCmdsFactory25FotaCustCmdAllReasonsNewLEv @ 1 NONAME + _ZN19FotaCustCmdsFactory29FotaCustCmdFirmwareUpdateNewLEv @ 2 NONAME + _ZN19FotaCustCmdsFactory24FotaCustCmdFirstBootNewLEv @ 3 NONAME + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,27 @@ +/* +* 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: +* Build information file for the FotaCustCmds project. +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES +fotacustcmds.mmp diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/group/fotacustcmds.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/group/fotacustcmds.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -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: +* Project definition file for the FotaCustCmds project. +* +*/ + +#include +#include + +TARGET fotacustcmds.dll +TARGETTYPE dll +UID 0x1000008D 0x10205071 + +CAPABILITY CAP_GENERAL_DLL +VENDORID VID_DEFAULT + +SOURCEPATH ../src +SOURCE fotacustcmdsfactory.cpp +SOURCE fotacustcmdallreasons.cpp +SOURCE fotacustcmdfirmwareupdate.cpp +SOURCE fotacustcmdfirstboot.cpp + +USERINCLUDE ../inc ../../cenrep ../../inc ../../fmsclient/inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +#ifdef __SYNCML_DM_FOTA +LIBRARY fotaengine.lib +LIBRARY fmsclient.lib +#endif +DEBUGLIBRARY flogger.lib +LIBRARY centralrepository.lib +LIBRARY schsvr.lib +LIBRARY apgrfx.lib +LIBRARY apparc.lib + +SMPSAFE \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/inc/fotacustcmdallreasons.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/inc/fotacustcmdallreasons.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,113 @@ +/* +* 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: +* Declaration of CFotaCustCmdAllReasons class. +* +*/ + +#ifndef FOTACUSTCMDALLREASONS_H +#define FOTACUSTCMDALLREASONS_H + +#include +#include + +/** + * Each command is implemented in a class derived from MSsmCustomCommand. + * It is also possible to implement multiple similar command in the same + * class and differentiate between them based on constructor parameters + * from the factory method. + */ +NONSHARABLE_CLASS( CFotaCustCmdAllReasons ) : public CBase, public MSsmCustomCommand + { + +public: + + /** + * Two-phased constructor + */ + static CFotaCustCmdAllReasons* NewL(); + + /** + * Destructor + */ + virtual ~CFotaCustCmdAllReasons(); + +private: // From MSsmCustomCommand + + /** + * @see MSsmCustomCommand + */ + TInt Initialize( CSsmCustomCommandEnv* aCmdEnv ); + + /** + * @see MSsmCustomCommand + */ + void Execute( const TDesC8& aParams, TRequestStatus& aRequest ); + + /** + * Takes action depending on the fota update state cenrep + * @Params None + * @return None + * + */ + + void ExecuteL( ); + + /** + * @see MSsmCustomCommand + */ + void ExecuteCancel(); + + /** + * @see MSsmCustomCommand + */ + void Close(); + + /** + * @see MSsmCustomCommand + */ + void Release(); + + /** + * Finds whether fota is schedduled or not + * @Params None + * @return + * ETrue if fota is scheduled else EFalse + */ + TBool FindScheduleL(); + +private: // data + + /** + * If the command needs command env in Execute function, it should store it + * to member variable: + * + * Custom command environment. Not owned. Set in Initialize. + * CSsmCustomCommandEnv* iEnv; + */ + + /* + * Function description: + * This function checks for dmEventNotifier. + * This checks for the specific scenario "when MMC is removed/inserted when phone is + * in switch off mode. Then it starts the DmEventNotifier. + * + * @params: None + * @Return: void + */ + void checkDMEventNotifierL(); + + }; + +#endif // FOTACUSTCMDALLREASONS_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/inc/fotacustcmdfirmwareupdate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/inc/fotacustcmdfirmwareupdate.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,93 @@ +/* +* 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: +* Declaration of CFotaCustCmdFirmwareUpdate class. +* +*/ + +#ifndef FOTACUSTCMDFIRMWAREUPDATE_H +#define FOTACUSTCMDFIRMWAREUPDATE_H + +#include +#include + +/** + * Each command is implemented in a class derived from MSsmCustomCommand. + * It is also possible to implement multiple similar command in the same + * class and differentiate between them based on constructor parameters + * from the factory method. + */ +NONSHARABLE_CLASS( CFotaCustCmdFirmwareUpdate ) : public CBase, public MSsmCustomCommand + { + +public: + + /** + * Two-phased constructor + */ + static CFotaCustCmdFirmwareUpdate* NewL(); + + /** + * Destructor + */ + virtual ~CFotaCustCmdFirmwareUpdate(); + +private: // From MSsmCustomCommand + + /** + * @see MSsmCustomCommand + */ + TInt Initialize( CSsmCustomCommandEnv* aCmdEnv ); + + /** + * @see MSsmCustomCommand + */ + void Execute( const TDesC8& aParams, TRequestStatus& aRequest ); + + /** + * invokes fotaengine after fota update + * @Params None + * @return None + * + */ + void ExecuteL(); + + /** + * @see MSsmCustomCommand + */ + void ExecuteCancel(); + + /** + * @see MSsmCustomCommand + */ + void Close(); + + /** + * @see MSsmCustomCommand + */ + void Release(); + +private: // data + + /** + * If the command needs command env in Execute function, it should store it + * to member variable: + * + * Custom command environment. Not owned. Set in Initialize. + * CSsmCustomCommandEnv* iEnv; + */ + + }; + +#endif // FOTACUSTCMDFIRMWAREUPDATE_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/inc/fotacustcmdfirstboot.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/inc/fotacustcmdfirstboot.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,85 @@ +/* +* 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: +* Declaration of CFotaCustCmdFirstBoot class. +* +*/ + +#ifndef FOTACUSTCMDFIRSTBOOT_H +#define FOTACUSTCMDFIRSTBOOT_H + +#include +#include + +/** + * Each command is implemented in a class derived from MSsmCustomCommand. + * It is also possible to implement multiple similar command in the same + * class and differentiate between them based on constructor parameters + * from the factory method. + */ +NONSHARABLE_CLASS( CFotaCustCmdFirstBoot ) : public CBase, public MSsmCustomCommand + { + +public: + + /** + * Two-phased constructor + */ + static CFotaCustCmdFirstBoot* NewL(); + + /** + * Destructor + */ + virtual ~CFotaCustCmdFirstBoot(); + +private: // From MSsmCustomCommand + + /** + * @see MSsmCustomCommand + */ + TInt Initialize( CSsmCustomCommandEnv* aCmdEnv ); + + /** + * @see MSsmCustomCommand + */ + void Execute( const TDesC8& aParams, TRequestStatus& aRequest ); + + /** + * @see MSsmCustomCommand + */ + void ExecuteCancel(); + + /** + * @see MSsmCustomCommand + */ + void Close(); + + /** + * @see MSsmCustomCommand + */ + void Release(); + +private: // data + + /** + * If the command needs command env in Execute function, it should store it + * to member variable: + * + * Custom command environment. Not owned. Set in Initialize. + * CSsmCustomCommandEnv* iEnv; + */ + + }; + +#endif // FOTACUSTCMDFIRSTBOOT_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/inc/fotacustcmdsfactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/inc/fotacustcmdsfactory.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,80 @@ +/* +* 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: +* Declaration of FotaCustCmdsFactory class. +* +*/ + +#ifndef FOTACUSTCMDSFACTORY_H +#define FOTACUSTCMDSFACTORY_H + +#include + +class MSsmCustomCommand; + +/** + * Creates custom command objects. + * + * Custom commands are loaded by system state manager based on DLL name and + * function ordinal. + * Each DLL containing custom commands must offer factory methods for each + * custom command. + * The function ordinals must be exactly the same in emulator and HW builds + * or loading the custom command may have unpredictable results. + * + * FotaCustCmdsFactory is a static class containing factory method of one + * custom command. It can be easily extended to contain factory methods of + * multiple custom commands by adding more member functions. + * + * It is better to implement own factory method for each separate command + * than to try to use parameters of Execute function to distinguish between + * them. + * Note that similar commands can be implemented in the same command class - + * just the factory methods need to be different. + */ + +class FotaCustCmdsFactory + { + +public: + + /** + * Creates and returns a custom command of type CFotaCustCmdAllReasons. + * This method has function ordinal 1 in fotacustcmds.dll. + * + * @return A custom command object. + */ + IMPORT_C static MSsmCustomCommand* FotaCustCmdAllReasonsNewL(); + + /** + * Creates and returns a custom command of type CFotaCustCmdFirmwareUpdate. + * This method has function ordinal 2 in fotacustcmds.dll. + * + * @return A custom command object. + */ + IMPORT_C static MSsmCustomCommand* FotaCustCmdFirmwareUpdateNewL(); + + /** + * Creates and returns a custom command of type CFotaCustCmdFirstBoot. + * This method has function ordinal 3 in fotacustcmds.dll. + * + * @return A custom command object. + */ + IMPORT_C static MSsmCustomCommand* FotaCustCmdFirstBootNewL(); + + // To add new custom commands to this DLL, add their factory methods here. + + }; + +#endif // FOTACUSTCMDSFACTORY diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/inc/fotastartupDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/inc/fotastartupDebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2007 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 defines logging macros for Fotastartupextension log +* +*/ + + + + +#ifndef FOTASTARTUPDEBUG_H +#define FOTASTARTUPDEBUG_H + +#include +#include + +//Examples +//FLOG( _L( "[fotastartupextensionplugin] CFotaStartupExtensionPlugIn::NewL:" ) ); +//FTRACE(RDebug::Print(_L("[fotastartupextensionplugin] fotastartupextensionplugin::NewL: err (%d)"), err)); +#ifdef _DEBUG + +const TInt KBTHexDumpWidth=16; +const TInt KBTLogBufferSize=100; +const TText KFullStopChar='.'; + +_LIT(KBTFirstFormatString,"%04x: "); +_LIT(KBTSecondFormatString,"%02x "); +_LIT(KBTThirdFormatString,"%c"); +_LIT(KBTThreeSpaces," "); +_LIT(KBTSeparator," "); + +inline void HexDump(const TUint8* aPtr, TInt aLen) + { + if( aPtr != NULL ) + { + TBuf line; + TInt i = 0; + + while (aLen>0) + { + TInt n = (aLen>KBTHexDumpWidth ? KBTHexDumpWidth : aLen); + line.AppendFormat(KBTFirstFormatString,i); + TInt j; + for (j=0; j126 || aPtr[i+j]==37) ? KFullStopChar : aPtr[i+j]); + + RDebug::Print(line); + + line.Zero(); + aLen-=n; + i+=n; + } + } + } + + +// =========================================================================== +#ifdef __WINS__ // File logging for WINS +// =========================================================================== +#include +#include +#include + +_LIT( KLogFile, "fotacustcmds.log" ); +_LIT( KLogDirFullName, "c:\\logs\\" ); +_LIT( KLogDir, "fota" ); + +#define FLOG( a ) { FPrint(a); } +#define FTRACE( a ) { a; } + +// Declare the FPrint function +// +inline void FPrint( const TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir, + KLogFile, + EFileLoggingModeAppend, + aFmt, + list ); + } + +// =========================================================================== +#else // RDebug logging for target HW +// =========================================================================== +/*#include + +#define FLOG( a ) { RDebug::Print( a ); } +#define FTRACE( a ) { a; } + +*/ + +/////////////////////////////// +#include +#include +#include + +_LIT( KLogFile, "fotacustcmds.log" ); +_LIT( KLogDirFullName, "c:\\logs\\" ); +_LIT( KLogDir, "fota" ); + +#define FLOG( a ) { FPrint(a); } +#define FTRACE( a ) { a; } + +// Declare the FPrint function +// +inline void FPrint( const TRefByValue aFmt, ... ) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat( KLogDir, + KLogFile, + EFileLoggingModeAppend, + aFmt, + list ); + } + +//////////////////////////////// + + +#endif //__WINS__ + +// =========================================================================== +#else // // No loggings --> Reduced binary size +// =========================================================================== +#define FLOG( a ) +#define FTRACE( a ) + +#endif // _DEBUG + +///////// /////////////////////// +inline void LOGX(TInt aSource) + { + HBufC *iMyBufNumber = HBufC::NewLC(255); + TPtr bufNumberPtr(iMyBufNumber->Des()); + bufNumberPtr.FillZ(); + bufNumberPtr.AppendFormat(_L("%d"),aSource); + FLOG(iMyBufNumber->Des()); + CleanupStack::PopAndDestroy(); + } +///////// /////////////////////// + +#endif // FOTASTARTUP_H + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/src/fotacustcmdallreasons.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/src/fotacustcmdallreasons.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,342 @@ +/* +* 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 CFotaCustCmdAllReasons class. +* +*/ + +#include "fotacustcmdallreasons.h" +#include "fotastartupDebug.h" +#ifdef __SYNCML_DM_FOTA +#include +#include "fmsclient.h" +#include "fotaserverPrivateCRKeys.h" +#include "FotaIPCTypes.h" +#include "fmsclientserver.h" +#endif +#include +#include +#include +// RProperty +#include +#include +// Memory status PS key headers +#include +// Loading application headers +#include +#include +//Middleware includes +#include +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::NewL +// --------------------------------------------------------------------------- +// +CFotaCustCmdAllReasons* CFotaCustCmdAllReasons::NewL() + { + FLOG( _L( "[CFotaCustCmdAllReasons::NewL() BEGIN " ) ); + return new ( ELeave ) CFotaCustCmdAllReasons; + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::~CFotaCustCmdAllReasons +// --------------------------------------------------------------------------- +// +CFotaCustCmdAllReasons::~CFotaCustCmdAllReasons() + { + FLOG( _L( "[CFotaCustCmdAllReasons::~CFotaCustCmdAllReasons() " ) ); + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::Initialize +// --------------------------------------------------------------------------- +// +TInt CFotaCustCmdAllReasons::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ ) + { + FLOG( _L( "[CFotaCustCmdAllReasons::~Initialize() " ) ); + + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::Execute +// --------------------------------------------------------------------------- +// +void CFotaCustCmdAllReasons::Execute( + const TDesC8& /*aParams*/, + TRequestStatus& aRequest ) + { + FLOG( _L( "[CFotaCustCmdAllReasons::~Execute() BEGIN " ) ); + aRequest = KRequestPending; + #ifdef __SYNCML_DM_FOTA + TRAP_IGNORE(ExecuteL()); + #endif + TRequestStatus* request = &aRequest; + User::RequestComplete( request, KErrNone ); + FLOG( _L( "[CFotaCustCmdAllReasons::~Execute() END " ) ); + } + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::ExecuteL +// --------------------------------------------------------------------------- +// +void CFotaCustCmdAllReasons::ExecuteL( ) + { + FLOG( _L( "[CFotaCustCmdAllReasons]::ExecuteL() Boot reason AllReason BEGIN " ) ); + + RFotaEngineSession fotaEngine; + //CheckCenrep if GA feature in ON then start else nothing. + CRepository* centrep(NULL); + TInt err = KErrNone; + TRAP( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + TInt sendGAAfterrebootfeature = 0; + TInt val(EFotaDefault); + + if (err == KErrNone) + { + err = centrep->Get(KFotaUpdateState, val); + + if (err == KErrNone) + { + // check if there is GA pending + + FTRACE(RDebug::Print(_L("[CFotaCustCmdAllReasons] startup reason is %d"), val)); + switch (val) + { + case EFotaDownloadInterrupted: + { + FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Start FMS server " ) ); + RFMSClient fmsClient; + TRAPD(err, fmsClient.OpenL()); + if (err == KErrNone) + { + fmsClient.Close(); + FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Closing FMS server " ) ); + } + } + break; + case EFotaPendingGenAlert: + { + FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Start fota server " ) ); + err = centrep->Get(KGenericAlertResendAfterBoot, + sendGAAfterrebootfeature); + FTRACE(RDebug::Print(_L("[CFotaCustCmdAllReasons] feature sendGenericAlert is %d"), sendGAAfterrebootfeature)); + + if (sendGAAfterrebootfeature == 1) + { + TRAPD(oError,fotaEngine.OpenL()); + if (oError == KErrNone) + { + fotaEngine.Close(); + FLOG( _L( "[CFotaCustCmdAllReasons] AllReason: Closing fota server " ) ); + } + } + } + break; + case EFotaUpdateInterrupted: + { + FLOG(_L(" update interrupted >>")); + RFMSClient fmsclient; + TRAPD(err,fmsclient.OpenL()); + if (err) + { + FLOG(_L( " opening fms failed " ) ); + + } + else + { + + FLOG(_L("CFotaUpdate::going into FMS client side MonitorBatteryL() >>")); + TRAPD(err1, fmsclient.NotifyForUpdateL(EUpdMonitorbattery, 3))// equal to EBatteryLevelLevel3 + if (err1) + { + FLOG(_L( " MonitorBatteryL failed " )); + } + fmsclient.Close(); + FLOG(_L(" update interrupted <<")); + } + } + break; + default: + { + FLOG( _L( "[CFotaCustCmdAllReasons] pendingGAToSend is not SET " ) ); + } + break; + } + + } + } + delete centrep; + { // Write the code for starting the dmEventNotifier + TRAPD(err, checkDMEventNotifierL()); + if (err) + { + FLOG(_L("start DmEventNotifier.exe successfull")); + } + else + { + FLOG(_L("start DmEventNotifier.exe un-successfull")); + } + } + FLOG( _L( "[CFotaCustCmdAllReasons]::ExecuteL() Boot reason AllReason END " ) ); + } + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::ExecuteCancel +// --------------------------------------------------------------------------- +// +void CFotaCustCmdAllReasons::ExecuteCancel() + { + + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::Close +// --------------------------------------------------------------------------- +// +void CFotaCustCmdAllReasons::Close() + { + FLOG( _L( "[CFotaCustCmdAllReasons]::Close() " ) ); + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdAllReasons::Release +// --------------------------------------------------------------------------- +// +void CFotaCustCmdAllReasons::Release() + { + + FLOG( _L( "[CFotaCustCmdAllReasons]::Close() " ) ); + delete this; + } + + +TBool CFotaCustCmdAllReasons::FindScheduleL() +{ + FLOG( _L( "[CFotaCustCmdAllReasons]::FindScheduleL()BEGIN " ) ); + TScheduleEntryInfo2 ret; + RScheduler sc; + TTime t; + TTsTime time; + TSchedulerItemRef scitem; + CArrayFixFlat* aSchRefArray = new CArrayFixFlat (5); + TScheduleFilter aFilter(EAllSchedules); + User::LeaveIfError( sc.Connect() ); // xx + CleanupClosePushL( sc ); + CleanupStack::PushL(aSchRefArray); + + User::LeaveIfError( sc.GetScheduleRefsL( *aSchRefArray,aFilter) ); // xx + FLOG(_L("Schedule items: ")); + for ( TInt i=0; iCount(); ++i ) + { + TSchedulerItemRef it = (*aSchRefArray)[i]; + if ( it.iName == TUid::Uid(KFotaServerUid).Name() ) + { + + CleanupStack::PopAndDestroy(aSchRefArray); + CleanupStack::PopAndDestroy(&sc); + return ETrue; + + } + } + CleanupStack::PopAndDestroy(aSchRefArray); + CleanupStack::PopAndDestroy(&sc); + FLOG( _L( "[CFotaCustCmdAllReasons]::FindScheduleL()END " ) ); + return EFalse; +} + + +void CFotaCustCmdAllReasons::checkDMEventNotifierL() +{ + FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - started")); + + const TUid KAppDmEventNotifierUid = TUid::Uid(KAppUidDmEventNotifier); //UID3 from .mmp file + CRepository* cenrep (NULL); + cenrep = CRepository::NewLC( KAppDmEventNotifierUid ); + TInt value (KErrNone); + TBool tocontinue (EFalse); + + FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for cenrep KDmEventNotifierEnabled")); + if ( ((cenrep->Get(KDmEventNotifierEnabled,value)) == KErrNone ) + && (EHandlerRegistered == value || EHandlerNeedRegister == value )) // v alue != EHandlerNotRegistered + { +// FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - cenrep KDmEventNotifierEnabled exist, value = (%d) "), value); + FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - cenrep KDmEventNotifierEnabled exist")); + tocontinue = ETrue; + } + else + { + //Log errors +// FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for cenrep KDmEventNotifierEnabled does not exist: error: (%d) "), err); + FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - cenrep KDmEventNotifierEnabled does not exist or already registered")); + //delete cenrep; cenrep = NULL; + CleanupStack::PopAndDestroy(); // cenrep + return; + } + + TInt pMmcstatus = KErrNotFound; + TInt ret = RProperty::Get(KPSUidUikon, KUikMMCInserted, pMmcstatus); +// FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for present Memory status: ret = (%d) , MMCStatus = (%d) "), ret, pMmcStatus); + FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for memory status")); + if(!ret) + { + + TInt sMMCStatus (KErrNotFound); + TInt error = cenrep->Get(KMMCStatus, sMMCStatus); + CleanupStack::PopAndDestroy(); // cenrep + + //FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - checking for previous Memory status, before phone off: error = (%d) , sMMCStatus = (%d) "), error, sMMCStatus); + if(error) + { + FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - Error in memory status get")); + //CleanupStack::PopAndDestroy(); // cenrep + return; + } + if (pMmcstatus == sMMCStatus && tocontinue) // if sMMCStatus is 0 && pMMCStatus is 0. Or sMMCStatus is 1 && pMMCStatus is 1 + { + //start the dm event notifier + + RApaLsSession apaLsSession; + User :: LeaveIfError(apaLsSession.Connect()); + TApaAppInfo appInfo; + FLOG(_L("RApaLsSession connection successful")); + FLOG(_L("Running dmeventnotifier.exe")); + + _LIT(KExampleTaskHandlerExe, "dmeventnotifier.exe"); + + appInfo.iFullName = KExampleTaskHandlerExe; + CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); + cmdLine->SetExecutableNameL( appInfo.iFullName ); + TBuf temp; + temp.Copy (appInfo.iFullName); + TInt err = apaLsSession.StartApp(*cmdLine); + + User :: LeaveIfError(err); + CleanupStack :: PopAndDestroy(cmdLine); + apaLsSession.Close(); + FLOG(_L("started dmeventnotifier.exe successfully")); + } + } + //CleanupStack::PopAndDestroy(); // cenrep + FLOG(_L("CFotaCustCmdAllReasons::checkDMEventNotifier() - ended")); +} diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/src/fotacustcmdfirmwareupdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/src/fotacustcmdfirmwareupdate.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,156 @@ +/* +* 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 CFotaCustCmdFirmwareUpdate class. +* +*/ + +#include "fotacustcmdfirmwareupdate.h" +#ifdef __SYNCML_DM_FOTA +#include +#include "fmsclient.h" +#include "fotaserverPrivateCRKeys.h" +#include "FotaIPCTypes.h" +#include "fmsclientserver.h" +#endif +#include "fotastartupDebug.h" +#include +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::NewL +// --------------------------------------------------------------------------- +// +CFotaCustCmdFirmwareUpdate* CFotaCustCmdFirmwareUpdate::NewL() + { + FLOG( _L( "CFotaCustCmdFirmwareUpdate::NewL() " ) ); + return new ( ELeave ) CFotaCustCmdFirmwareUpdate; + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::~CFotaCustCmdFirmwareUpdate +// --------------------------------------------------------------------------- +// +CFotaCustCmdFirmwareUpdate::~CFotaCustCmdFirmwareUpdate() + { + FLOG( _L( "CFotaCustCmdFirmwareUpdate::~CFotaCustCmdFirmwareUpdate() " ) ); + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::Initialize +// --------------------------------------------------------------------------- +// +TInt CFotaCustCmdFirmwareUpdate::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ ) + { + + FLOG( _L( "CFotaCustCmdFirmwareUpdate::Initialize() " ) ); + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::Execute +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirmwareUpdate::Execute( + const TDesC8& /*aParams*/, + TRequestStatus& aRequest ) + { + aRequest = KRequestPending; + FLOG( _L( "CFotaCustCmdFirmwareUpdate::Execute() BEGIN " ) ); + #ifdef __SYNCML_DM_FOTA + TRAP_IGNORE(ExecuteL()); + #endif + TRequestStatus* request = &aRequest; + User::RequestComplete( request, KErrNone ); + FLOG( _L( "CFotaCustCmdFirmwareUpdate::Execute() END " ) ); + + + } +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::ExecuteL +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirmwareUpdate::ExecuteL( ) + + { + FLOG( _L( "CFotaCustCmdFirmwareUpdate::ExecuteL( ) Boot reason KFirmwareUpdateReason BEGIN " ) ); + + CRepository* centrep( NULL); + RFotaEngineSession fotaEngine; + TInt err= KErrNone; + TRAP( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + TInt sendGAAfterrebootfeature = 0; + if( err == KErrNone && centrep ) + { + err = centrep->Get( KGenericAlertResendAfterBoot, sendGAAfterrebootfeature ); + } + FTRACE(RDebug::Print(_L("[CFotaCustCmdFirmwareUpdate] feature sendGenericAlert is %d"), sendGAAfterrebootfeature)); + if( sendGAAfterrebootfeature != 1 ) + { + FLOG( _L( "[CFotaCustCmdFirmwareUpdate] FirmwareUpdateReason: Starting fota server " ) ); + TRAPD(oError,fotaEngine.OpenL()); + if(oError == KErrNone) + { + fotaEngine.Close(); + FLOG( _L( "[CFotaCustCmdFirmwareUpdate] FirmwareUpdateReason: Closing fota server " ) ); + } + + } + + if(centrep) + { + delete centrep; + } + + FLOG( _L( "CFotaCustCmdFirmwareUpdate::ExecuteL( ) Boot reason KFirmwareUpdateReason END " ) ); + + } +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::ExecuteCancel +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirmwareUpdate::ExecuteCancel() + { + + FLOG( _L( "CFotaCustCmdFirmwareUpdate::ExecuteCancel() " ) ); + + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::Close +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirmwareUpdate::Close() + { + + FLOG( _L( "CFotaCustCmdFirmwareUpdate::Close() " ) ); + + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirmwareUpdate::Release +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirmwareUpdate::Release() + { + FLOG( _L( "CFotaCustCmdFirmwareUpdate::Release() " ) ); + + delete this; + } diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/src/fotacustcmdfirstboot.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/src/fotacustcmdfirstboot.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,110 @@ +/* +* 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 CFotaCustCmdFirstBoot class. +* +*/ + +#include "fotacustcmdfirstboot.h" +#include "fotastartupDebug.h" +//#include "trace.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirstBoot::NewL +// --------------------------------------------------------------------------- +// +CFotaCustCmdFirstBoot* CFotaCustCmdFirstBoot::NewL() + { + FLOG( _L( "[CFotaCustCmdFirstBoot::NewL() " ) ); + return new ( ELeave ) CFotaCustCmdFirstBoot; + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirstBoot::~CFotaCustCmdFirstBoot +// --------------------------------------------------------------------------- +// +CFotaCustCmdFirstBoot::~CFotaCustCmdFirstBoot() + { + FLOG( _L( "[CFotaCustCmdFirstBoot::~CFotaCustCmdFirstBoot() " ) ); + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirstBoot::Initialize +// --------------------------------------------------------------------------- +// +TInt CFotaCustCmdFirstBoot::Initialize( CSsmCustomCommandEnv* /*aCmdEnv*/ ) + { + + FLOG( _L( "[CFotaCustCmdFirstBoot::Initialize() " ) ); + + return KErrNone; + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirstBoot::Execute +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirstBoot::Execute( + const TDesC8& /*aParams*/, + TRequestStatus& aRequest ) + { + aRequest = KRequestPending; + FLOG( _L( "[CFotaCustCmdFirstBoot::Execute() " ) ); + #ifdef __PLUG_AND_PLAY_MOBILE_SERVICES + FLOG( _L( "NOTHING TO DO " ) ); + #endif + TRequestStatus* request = &aRequest; + User::RequestComplete( request, KErrNone ); + + + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirstBoot::ExecuteCancel +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirstBoot::ExecuteCancel() + { + FLOG( _L( "[CFotaCustCmdFirstBoot::ExecuteCancel() " ) ); + + + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirstBoot::Close +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirstBoot::Close() + { + FLOG( _L( "[CFotaCustCmdFirstBoot::Close() " ) ); + } + + +// --------------------------------------------------------------------------- +// CFotaCustCmdFirstBoot::Release +// --------------------------------------------------------------------------- +// +void CFotaCustCmdFirstBoot::Release() + { + FLOG( _L( "[CFotaCustCmdFirstBoot::Release() " ) ); + + delete this; + } diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotacustcmds/src/fotacustcmdsfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotacustcmds/src/fotacustcmdsfactory.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,60 @@ +/* +* 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 FotaCustCmdsFactory class. +* +*/ + +#include "fotacustcmdsfactory.h" +#include "fotacustcmdallreasons.h" +#include "fotacustcmdfirmwareupdate.h" +#include "fotacustcmdfirstboot.h" +#include "fotastartupDebug.h" +//#include "trace.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL +// --------------------------------------------------------------------------- +// +EXPORT_C MSsmCustomCommand* FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL() + { + FLOG( _L( "[FotaCustCmdsFactory::FotaCustCmdAllReasonsNewL() " ) ); + + return CFotaCustCmdAllReasons::NewL(); + } + + +// --------------------------------------------------------------------------- +// FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL +// --------------------------------------------------------------------------- +// +EXPORT_C MSsmCustomCommand* FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL() + { + FLOG( _L( "[FotaCustCmdsFactory::FotaCustCmdFirmwareUpdateNewL() " ) ); + return CFotaCustCmdFirmwareUpdate::NewL(); + } + + +// --------------------------------------------------------------------------- +// FotaCustCmdsFactory::FotaCustCmdFirstBootNewL +// --------------------------------------------------------------------------- +// +EXPORT_C MSsmCustomCommand* FotaCustCmdsFactory::FotaCustCmdFirstBootNewL() + { + + FLOG( _L( "[FotaCustCmdsFactory::FotaCustCmdFirstBootNewL() " ) ); + return CFotaCustCmdFirstBoot::NewL(); + } diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/data/fullscreendialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/data/fullscreendialog.docml Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/fotaserver.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/fotaserver.pro Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,177 @@ +# Copyright (c) 2010 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 is the project file defnition for fotaserver. + +TEMPLATE = app +TARGET = fotaserver + +DEPENDPATH += . \ + ./inc \ + ./src \ + ../inc \ + +INCLUDEPATH += . \ + ./inc \ + ../inc \ + ../cenrep \ + ../fmsclient/inc \ + +HEADERS += FotaServer.h \ + FotaDlMgrClient.h \ + FotaDlClient.h \ + FotaDB.h \ + FotaNetworkRegStatus.h \ + fotaserverPrivatePSKeys.h \ + FotaSrvDebug.h \ + FotasrvSession.h \ + fotaupdate.h \ + fotaUpdateAgentComms.h \ + fotanotifiers.h \ + fotafullscreendialog.h \ + fsview.h + + +RESOURCES = fotaservernotifier.qrc + +TRANSLATIONS += deviceupdates.ts + +SOURCES += FotaDlMgrClient.cpp \ + FotaDlClient.cpp \ + FotaServer.cpp \ + fotaupdate.cpp \ + fotaSrvSession.cpp \ + FotaDB.cpp \ + FotaNetworkRegStatus.cpp \ + FotaIPCTypes.cpp \ + fotanotifiers.cpp \ + fotafullscreendialog.cpp \ + main.cpp \ + fsview.cpp + +CONFIG(release, debug|release):LIBS += -L. \ + -L./../../../../WrtBuild/Release/bin \ + -lWrtDownloadMgr \ + -lwrtserviceipcclient +CONFIG(debug, debug|release):LIBS += -L. \ + -L./../../../../WrtBuild/Debug/bin \ + -lWrtDownloadMgr \ + -lwrtserviceipcclient +symbian { + SYMBIAN_PLATFORMS = WINSCW + SYMBIAN_PLATFORMS += ARMV5 + TARGET.VID = VID_DEFAULT + TARGET.UID3 = 0x102072C4 + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_SERVER \ + NetworkControl \ + PowerMgmt \ + DiskAdmin \ + All \ + -Tcb + INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \ + /epoc32/include/platform/mw/cwrt \ + /epoc32/include/cshelp \ + /epoc32/include/ecom \ + /epoc32/include/libc \ + /epoc32/include/mw/Qt \ + /epoc32/include/mw/QtCore \ + /epoc32/include/mw/QtGui \ + /epoc32/include/mw \ + ../../sf/mw/qt/mkspecs/common/symbian \ + ../../sf/mw/qt/mkspecs/common/symbian/tmp \ + /epoc32/include \ + /epoc32/include/stdapis \ + /epoc32/include/stdapis/sys \ + /epoc32/include/platform/mw \ + /epoc32/include/platform \ + /epoc32/include/platform/loc \ + /epoc32/include/platform/mw/loc \ + /epoc32/include/platform/loc/sc \ + /epoc32/include/platform/mw/loc/sc \ + /epoc32/include/mw/cwrt \ + /epoc32/include/app \ + /epoc32/include/platform/app \ + /epoc32/include/platform/app/loc \ + /epoc32/include/platform/app/loc/sc \ + /epoc32/include/stdapis/stlportv5 \ + /epoc32/include/mw/hb/hbcore \ + /epoc32/include/mw/hb/hbwidgets \ + /epoc32/include/mw/hb/hbutils \ + tmp + + LIBS += -laknskins \ + -lapgrfx \ + -lapengine \ + -lapparc \ + -lapsettingshandlerui \ + -lavkon \ + -lbafl \ + -lcone \ + -lcommdb \ + -lcommonengine \ + -ledbms \ + -lefsrv \ + -leikctl \ + -leikcore \ + -leikcoctl \ + -leikdlg \ + -lestor \ + -leuser \ + -lfeatmgr \ + -lhlplch \ + -lws32 \ + -lcommonui \ + -lapmime \ + -lsyncmlclientapi \ + -lecom \ + -lbitgdi \ + -lfbscli \ + -lgdi \ + -letelmm \ + -letel \ + -lcentralrepository \ + -lesock \ + -lschsvr \ + -lsysversioninfo \ + -lnsmldmtreedbclient \ + -lakncapserverclient \ + -lstarterclient \ + -lconnmon \ + -lfeatmgr \ + -lfmsclient \ + -lcmmanager \ + -lsysutil \ + -lQtGui \ + -lQtCore \ + -lapgrfx \ + -lgdi \ + -leiksrv \ + -lhal \ + -llibc \ + -llibm \ + -llibdl \ + -lmediaclientaudio \ + -lcharconv \ + -lws32 \ + -laknnotify \ + -lHbCore \ + -lHbWidgets \ + -lHbUtils \ + -lQtSvg \ + -lQtNetwork \ + -lxqutils \ + -linetprotutil \ + -lusbman \ + -lxqserviceutil \ + -lflogger + +CONFIG += hb +MOC_DIR = moc +} diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/fotaservernotifier.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/fotaservernotifier.qrc Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,5 @@ + + + data/fullscreendialog.docml + + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/FotaDB.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/FotaDB.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,258 @@ +/* +* Copyright (c) 2005 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: Header file for fotadb +* +*/ + + + + +#ifndef __CFOTADB_H___ +#define __CFOTADB_H___ + +// INCLUDES +#include +#include +#include "FotaIPCTypes.h" + + +// CONSTANTS +// see fotaipctypes.h for field descriptions +_LIT(KDatabaseName,"FotaState"); + +_LIT(KSelectAll,"SELECT * FROM State" ); +_LIT(KSelect_where_packageid,"SELECT * FROM State WHERE PkgID=%d" ); +_LIT(KCreateTable, "CREATE TABLE State ( Id COUNTER, PkgID INTEGER NOT \ + NULL, Result INTEGER, State INTEGER NOT NULL, ProfileID INTEGER,\ + PkgURL LONG VARCHAR, PkgName CHAR(255),Version CHAR(255), SmlTryCount INTEGER, \ + SessionType INTEGER, IapId INTEGER, PkgSize UNSIGNED INTEGER, UpdateLtr BIT)"); +_LIT(KAlterTable, "ALTER TABLE State ADD (SessionType INTEGER, IapId INTEGER, PkgSize UNSIGNED INTEGER, UpdateLtr BIT)"); +_LIT(KTblState, "State"); + +_LIT(KColPkgId, "PkgID"); +_LIT(KColResult, "Result"); +_LIT(KColState, "State"); +_LIT(KColProfileId, "ProfileID"); +_LIT(KColPkgUrl, "PkgURL"); +_LIT(KColPkgName, "PkgName"); +_LIT(KColVersion, "Version"); +_LIT(KColSmlTryCount, "SmlTryCount"); +_LIT(KColSessionType, "SessionType"); +_LIT(KColIapId, "IapId"); +_LIT(KColPkgSize, "PkgSize"); +_LIT(KColUpdateLtr, "UpdateLtr"); + +// DATATYPES +enum TFDBFields +{ + EFDBResult = 0x01, + EFDBState = 0x02, + EFDBProfileId = 0x04, + EFDBPkgUrl = 0x08, + EFDBPkgName = 0x10, + EFDBVersion = 0x20, + EFDBSmlTryCount = 0x40, + EFDBSessionType = 0x80, + EFDBIapId = 0x100, + EFDBPkgSize = 0x200, + EFDBUpdateLtr = 0x400 +}; +//Number of attributes in fotastate table +const TUint KNoOfDBFields = 13; + +// FORWARD DECLARATION +class CPackageState; + + +/** + * Database class + * + * @lib fotaserver + * @since S60 v3.1 + */ +NONSHARABLE_CLASS(CFotaDB): public CBase + { + friend class CPackageState; +public: + CFotaDB(); + + virtual ~CFotaDB(); + + static CFotaDB* NewL(); + + /** + * Create database + * + * @since S60 v3.1 + * @param None + * @return none + */ + void CreateDatabaseL(); + + + /** + * Open database + * + * @since S60 v3.1 + * @param None + * @return Error code + */ + void OpenDBL(); + + /** + * Close database and commit changes + * + * @since S60 v3.1 + * @param None + * @return none + */ + void CloseAndCommitDB(); + + + /** + * Checks if DB is open + * + * @since S60 v3.1 + * @param None + * @return TBool - is database open + */ + TBool IsOpen(); + + + /** + * Add new package state to database + * + * @since S60 v3.1 + * @param aState State + * @param aPkgURL URL + * @return None + */ + void AddPackageStateL( const TPackageState& aState + ,const TDesC8& aPkgURL ); + + + /** + * Get state from db + * + * @since S60 v3.1 + * @param aPkgId Package ID + * @return State object + */ + TPackageState GetStateL( const TInt aPkgId, TDes8& aPkgURL ); + + + /** Sets state of package specified by packageid. If state doesnt exist, + * it is added to db. + * @since S60 v3.1 + * @param aState source data to be set + * @param aPkgURL URL + * @param aChangedFields Changed fields. Tells what columns from aState + * are to be set. + * @return None + */ + void SetStateL( TPackageState& aState + ,const TDesC8& aPkgURL, TUint aChangedFields ); + + /** + * Gets all states from database + * + * @since S60 v3.1 + * @param aStates On return, all states + * @return Error code + */ + void GetAllL(RArray& aStates); + +private: + + void ConstructL(); + + + /** + * Converts database row to TPackageState + * + * @since S60 v3.1 + * @param aPkgUrl URL + * @param aView Database view. Must be ready&prepared for data + * extraction + * @return State + */ + TPackageState RowToStateL(HBufC8*& aPkgUrl,const RDbView& aView); + + + /** + * Inserts TPackageState to database view + * + * @since S60 v3.1 + * @param aPkg Source package + * @param aPkgURL Url + * @param aView Database view. Must be ready&prepared for data writing + * @return None + */ + void StateToRowL (const TPackageState& aPkg, const TDesC8& aPkgURL + ,RDbView& aView); + + /** + * Sets the retry count from the cenrep + * + * @since S60 v5.0 + * @param package state + * @return None + */ + + void SetRetryCount(TPackageState& aState); + + /** + * Determines the char need for db queries + * + * @since S60 v5.0 + * @param aChangedFields change fields + * @param aState package states + * @param aPkgURL + * @return None + */ + TInt DetermineCharNeeded(TInt aChangedFields,TPackageState& aState,const TDesC8& aPkgURL); + +private: + + /** + * File server session + */ + RFs iFSSession; + + + /** + * Reference to database + */ + RDbNamedDatabase iStateDB; + + + /** + * Columns + */ + CDbColSet* iColSet; + + + /** + * Table + */ + RDbTable iTable; + + /** + * Is the db open? + */ + TBool iIsOpen; + + }; + +#endif // FOTADB_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/FotaDlClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/FotaDlClient.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2005 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: Fota download client + * + */ +#ifndef FOTADLCLIENT_H +#define FOTADLCLIENT_H + +//All UI related headers +#include +#include +#include + +//All download manager related headers +#include +#include +#include + +//All user includes +#include "FotaSrvDebug.h" + +using namespace WRT; + +//Forward declarations +class DownloadManagerClient; + +//Enums for mapping download manager operation status +enum DLReturns + { + EOk = 0, ENotOk + }; + +//Enums for type of download mechanism +enum TDownloadType + { + THttpDownload = 0, //HTTP download mechanism + TOmaDL10Download, //OMA DL1.0 download mechanism + TUnknownType + //Unknown download mechanism + }; + +//Enums for client (fota) side errors. This is used to know why client decided to pause/cancel the download. +enum TClientErrorType + { + ErrorNone = 0, //No error + + //Device side errors + UserCancelled = 100,//User cancelled download + NeedMoreMemory, //Memory insufficient to start download + + //Server side errors + InvalidContentType = 200 + //Content type invalid. ie. either HTTP nor OMA DL1.0 + }; + +/** + * This is the download client class. + * + * @lib fotaserver + * @since SF^4 + */ +class DownloadClient : public QObject + { +Q_OBJECT + +public: + /** + * Constructor. + */ + DownloadClient(DownloadManagerClient* aObserver); + + /** + * Destructor. + */ + ~DownloadClient(); + + /** + * Creates a single download with the download manager + * + * @since SF^4 + * @param url - the source which is to be downloaded + * @param type - determines the type of download. Either parallel or sequential. + * @return One of DLReturns + */ + TInt CreateDownload(const QString& url, DownloadType type); + + /** + * Sets the required attributes for the single download. + * + * @since SF^4 + * @return One of DLReturns + */ + TInt SetDownloadAttributes(); + + /** + * Gets the attribute of the single download + * + * @since SF^4 + * @param attr - the attribute of the download for which value is needed. + * @return The value of the attribute. Caller should read the value in right format. + */ + QVariant GetDownloadAttribute(DownloadAttribute attr); + + /** + * Starts the single download. Download should be created and attributes set before this. + * + * @since SF^4 + * @param None + * @return One of DLReturns + */ + TInt Start(); + + /** + * Pauses the single download. + * + * @since SF^4 + * @param Client reason for pausing the download. + * @return One of DLReturns + */ + TInt Pause(TClientErrorType aReason); + + /** + * Resumes the single download. + * + * @since SF^4 + * @param None + * @return One of DLReturns + */ + TInt Resume(); + + /** + * Cancels the single download. + * + * @since SF^4 + * @param Client reason for cancelling the download. + * @return One of DLReturns + */ + TInt Cancel(TClientErrorType aReason); + + /** + * Restarts the single download. This is equivalent to cancel and start on Download. + * + * @since SF^4 + * @param None + * @return None + */ + TInt Restart(); + +private slots: + + /** + * The slot which receives all the single download events. + * + * @since SF^4 + * @param event - the download event + * @return true, if handled here. Otherwise false. + */ + bool DownloadEventRecieved(DownloadEvent *event); + +private: + /** + * Called to update the progress of download to fota server. This fetches the percentage + * of download from download manager. + * + * @since SF^4 + * @param None + * @return None + */ + void UpdateDownloadProgress(); + + /** + * Called when download is complete, either successfully or unsuccessfully. + * The arguments to this function is read to know the actual status. + * + * @since SF^4 + * @param dlevent - the event of the single download + * @param err0 - the last error occured + * @return None + */ + void HandleDownloadComplete(Download::State dlstate, int err0 = 0); + + /** + * Called to handle the post download interrupt operation when client cancels/pauses download. + * + * @since SF^4 + * @param dlstate - the state of the single download + * @param err0 - the last error occured + * @return None + */ + void HandleClientInterrupt(Download::State dlstate, int err0); + + /** + * Called to read the OMA DL1.0 download descriptor. This will update the fota server with size and version. + * + * @since SF^4 + * @param None + * @return None + */ + void ReadDescriptorData(); + + /** + * Called to validate the content type of the download as received in header. + * + * @since SF^4 + * @param aContent - the content type as received in the header + * @return One of TDownloadType + */ + TDownloadType CheckContentType(const QString aContent); + + void SetSubDownloadAttributes(); + +private: + + /** + * The Fota download manger client. This is not owned + */ + DownloadManagerClient* iFotaDlMgrClient; + + /** + * The Download object of the single download + */ + Download *iDownload; + + /** + * Progress of the download. true when download progressing, otherwise false. + */ + TBool iProgress; + + /** + * The total size of the download (ie. update package). + */ + int iTotalSize; + + /** + * To tell if space check has happened or not, before the start of the download. + */ + bool iSpaceChecked; + + /** + * To tell if client has interrupted download or not. The reason will be in iClientError. + */ + bool iClientinterrupted; + + /** + * Holds the client error that caused the download to cancel or pause. + */ + TClientErrorType iClientError; + + /** + * The state of the single download. This corresponds to the state received in the download event slot. + */ + Download::State iDlState; + + TDownloadType iContentType; + + }; + +#endif // FOTADLCLIENT_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/FotaDlMgrClient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/FotaDlMgrClient.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2005 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: Fota download manager client + * + */ +#ifndef FOTADLMGRCLIENT_H +#define FOTADLMGRCLIENT_H + +#include +#include +#include +#include +//All download manager related headers +#include +#include +#include +#include +#include +#include +#include + +//All orbit related headers +#include +#include +#include +#include + +//All user includes +#include "FotaDlMgrClient.h" +#include "FotaSrvDebug.h" +#include +#include "FotaIPCTypes.h" +#include "fotadiskstoragePrivateCRKeys.h" +#include "fotafullscreendialog.h" +#include "fotadevicedialogobserver.h" + +//Forward declarations +class DownloadClient; +class CFotaServer; +class CFotaDownloadNotifHandler; + +using namespace WRT; + +enum TFreeSpace + { + EFitsToReservation, // fits to space reservation + EFitsToFileSystem, // doesn't fit to reservation,fits to FS + EDoesntFitToFileSystem + // doesn't fit to fs + }; + +// System Critical Level (128KB) plus 5KB for fota operations. +const TInt KSystemCriticalWorkingspace = 136192; +_LIT( KReservedFileName, "reserved"); +_LIT( KDefaultPath, "C:\\private\\102072C4\\"); +_LIT( KPackageExtension, ".swupd"); +_LIT( KPackageExtensionAll, "*.swupd"); +_LIT( KDownloadTempDir, "FotaServer\\downloads\\"); + +const QString DefaultPath = "C:\\private\\102072C4\\"; +const QString PackageName = "fwupdate.swupd"; + +//Supported content types for firmware download +const QString ContentTypeHttp = "application/vnd.nokia.swupd.dp2"; +const QString ContentTypeOmaDl = "application/vnd.oma.dd+xml"; + +/** + * This is the download manager client class. + * + * @lib fotaserver + * @since SF^4 + */ +class DownloadManagerClient : public QObject, MfotadevicedialogObserver + { +Q_OBJECT + +public: + /** + * Two phase construction. + */ + static DownloadManagerClient* NewL(CFotaServer* aServer); + + /** + * The destructor + */ + ~DownloadManagerClient(); + + /** + * This method returns the created DownloadManager pointer + * + * @since SF^4 + * @param + * @return the download manager pointer + */ + DownloadManager* Manager(); + + /** + * Creates a single download from the given url. + * + * @since SF^4 + * @param the source url of the download + * @return None. Can leave with system wide errors + */ + void DownloadL(const TDesC8& url); + + /** + * This method is called by the download client when the download begins. + * @since SF^4 + * @param size - the size of the actual download + * @param version - the version as specified in the OMA DL1.0 descriptor + * @return None + */ + void StartDownloadProgress(QString name, QString version, int size); + + /** + * This method is called by the download client when the download is in progress. + * @since SF^4 + * @param progress - progress of the download in percentage. + * @return None + */ + void UpdateDownloadProgress(int progress); + + /** + * This method is called by the download client when the download is complete, either + * successfully or unsuccessfully. + * + * @since SF^4 + * @param dlstate - the state of the single download + * @param err0 - the last download error + * @return None + */ + void HandleDownloadEvent(Download::State dlstate, int err0); + + /** + * This method is called by the download client when the download is interrupted due to client specific reasons. + * @since SF^4 + * @param dlstate - the state of the single download + * @param err0 - the last download error + * @return None + */ + void HandleClientInterrupt(Download::State dlstate, int err0); + + /** + * This method tells if the download is active or not. + * @since SF^4 + * @param None + * @return true, if active, otherwise false. + */ + TBool IsDownloadActive(); + + /** + * The method finds the suitable path for a given download. It checks the availability of memory using the size provided. + * @since SF^4 + * @param aSize - the size of the download + * @param aPath - the suitable path for the download to happen + * @return one of TFreeSpace - space available, space fits to reservation, space unavailable + */ + TFreeSpace GetSuitablePath(TInt aSize, QString& aPath); + + /** + * This method creates the required space reservation on the disk. + * @since SF^4 + * @param None + * @return None + */ + void CreateDiskReservation(); + + /** + * This method deletes the reservation on the path provided. + * @since SF^4 + * @param path - the path where reservation to be deleted. + * @return None + */ + void DeleteDiskReservation(QString& path); + + /** + * This method deletes the update package on the disk. + * @since SF^4 + * @param None + * @return None, can leave with system wide errors. + */ + void DeleteUpdatePackageL(); + + /** + * This method will try to resume any suspended single download + * @since SF^4 + * @param None + * @return None, can leave with system wide errors. + */ + void TryResumeDownloadL(); + + /** + * This method will try to pause any ongoing download + * @since SF^4 + * @param None + * @return + */ + void PauseDownloadL(); + + /** + * This method will get the location of the update package + * @since SF^4 + * @param aPathj - location of the update package + * @return None, can leave with system wide errors. + */ + void GetUpdatePackageLocation(TDes& aPath); + + /** + * This method will get size of the downloaded content + * @since SF^4 + * @param None + * @return size of the package in bytes + */ + TInt GetDownloadPackageSize(); + + /** + * This function shows the device dialog which is requested + * @since SF^4 + * @param dialogid - the dialog id to be shown + * @param aValue - the value to be passed, if any. + * @return + */ + void ShowDialogL(TFwUpdNoteTypes dialogid, TInt aValue = 0); + +public: + // from MfotadevicedialogObserver + + void HandleDialogResponse(int response, TInt aDialogid); + +public slots: + + /** + * This is the slot which receives the download manager events. + * @since SF^4 + * @param event - the download manager event + * @return true if handled, otherwise false. + */ + bool DownloadMgrEventRecieved(DownloadManagerEvent *event); + +private: + + /** + * Constructor. + */ + + DownloadManagerClient(CFotaServer *aServer); + + /** + * Two phase construction + */ + void ConstructL(); + + /** + * This functions initializes the download manager + * @since SF^4 + * @param None + * @return one of DLReturns + */ + int InitDownloadMgr(); + + /** + * This function uninitializes the download manager. + * @since SF^4 + * @param None + * @return None + */ + void UninitDownloadMgr(); + + /** + * This function returns the access point name for a given access point id. + * @since SF^4 + * @param aIapId - access point id + * @return access point name, can leave with system wide errors. + */ + QString GetIapNameWithIdL(TInt aIapId); + + /** + * This function calculates the disk space allocated for firmware update and reserved file. + * @since SF^4 + * @param aSwupdSize, the size of the swupd files in bytes + * @param aReservedSize, the size of the reserved file in bytes. + * @return None + */ + void SpaceAllocatedBySWUPDFiles(TInt& aSwupdSize, TInt& aReservedSize); + + /** + * This function maps the download errors to fota failure reasons + * @since SF^4 + * @param err0 - the error in the single download + * @return None + */ + void MapDownloadErrors(int err0); + +private: + /** + * The download manager instance + */ + DownloadManager* iDownloadManager; + + /** + * The fota download client instance + */ + DownloadClient* iDownloadClient; + + /** + * The fota server instance + */ + CFotaServer* iFotaServer; // not owned + + /** + * Is download manager initialized? + */ + TBool iInitialized; + + /** + * Is download submitted to download manager? + */ + TBool iDownloadSubmitted; + + /** + * Is download in progress? + */ + TBool iProgress; + + /** + * The file server instance + */ + RFs iFs; + + /** + * the reserved memory size in bytes + */ + TInt iReservedSize; + + /** + * The dialog variant maps which is exchanged with device dialog server + */ + + CHbSymbianVariantMap * iNotifParams; + CFotaDownloadNotifHandler* iNotifier; + }; + +#endif // FOTADLMGRCLIENT_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/FotaNetworkRegStatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/FotaNetworkRegStatus.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2005 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: GPRS and Wlan status getter for sending Generic Alerts + * + */ + +#ifndef __FOTANETWORKREGSTATUS_H__ +#define __FOTANETWORKREGSTATUS_H__ + +// SYSTEM INCLUDES +#include +#include + +//Forward declarations +class CFotaServer; + +//Constants used in this class + +const TTimeIntervalMicroSeconds32 KTimeInterval = 1000000; //1 second, duration between each retry. +const TInt KRetries = 10; //Maximum number of retries. + +/** + * Actice object class that runs a timer for probing network status (GPRS & WLAN) + * @lib fotaserver + * @since S60 v3.2 + */ +NONSHARABLE_CLASS (CFotaNetworkRegStatus) : public CActive + { +public: + //Symbian 2-Phase construction + + static CFotaNetworkRegStatus* NewL(CFotaServer* aObserver); + static CFotaNetworkRegStatus* NewLC(CFotaServer* aObserver); + + /** + * Destructor. + */ + virtual ~CFotaNetworkRegStatus(); + +public: + /** + * Starts monitoring for Network status before sending Generic Alert + * + * @since S60 v3.2 + * @param None + * @return None + */ + + void StartMonitoringL(); + + /** + * Checks whether the network connection possible with the IAP Id provided + * + * @since S60 v3.2 + * @param None + * @return ETrue if yes, EFalse when not possible + */ + //TBool IsConnectionPossibleL(TInt aIapid); + +public: + // Functions from base classes + /** + * From CActive,DoCancel. + */ + void DoCancel(); + + /** + * From CActive,RunL. + */ + void RunL(); + + /** + * From CActive,RunError. + */ + TInt RunError(TInt aError); + +private: + //functions + + //Constructors + + CFotaNetworkRegStatus(); + CFotaNetworkRegStatus(CFotaServer* aObserver); + + //Symbian 2-Phase construction + void ConstructL(); + + /** + * Checks GlobalRFs status + * + * @since S60 v3.2 + * @param None + * @return ETrue if success, EFalse if failure + */ + TBool CheckGlobalRFState(); + + /** + * Checks Network status, basically Network Registration + * + * @since S60 v3.2 + * @param None + * @return ETrue if success, EFalse if failure + */ + TBool CheckNetworkRegStateL(); + + /** + * Checks Wlan status + * + * @since S60 v3.2 + * @param None + * @return ETrue if success, EFalse if failure + */ + TBool IsWlanSupportedL(); + + /** + * To find the bearer of the IapId + * + * @since S60 v3.2 + * @param aIapId + * @return ETrue/EFalse + */ + //TUint32 FindBearerL(TInt aIapId); + +private: + // data + + /** + * timer used for monitoring + */ + RTimer iTimer; + + /** + * S60 monitory class used for monitoring network status + */ + RConnectionMonitor iMonitor; + + /** + * FotaServer + */ + CFotaServer* iObserver; + + /** + * Number of retries + */ + TInt iRetriesLeft; + + /** + * GlobalRFs state + */ + TBool iGlobalRFState; + }; + +#endif // __FOTANETWORKREGSTATUS_H__ +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/FotaServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/FotaServer.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,740 @@ +/* + * Copyright (c) 2005 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: Header file for CFotaServer + * + */ + +#ifndef __FOTASERVER_H__ +#define __FOTASERVER_H__ + +// INCLUDES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "fotaserverPrivateCRKeys.h" +#include "FotaIPCTypes.h" +#include "FotaDB.h" +#include "fotaConst.h" +#include "fotaupdate.h" +#include "fmsclient.h" //The FMS Client header file +#include "FotaSrvDebug.h" +#include "fotadevicedialogobserver.h" + +/** If download is active this P&S key is set to ETrue, otherwise EFalse. + * The key is owned by omadmappui**/ +const TUint32 KFotaServerActive = 0x0000008; +#define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); } + +//Forward declarations +class FotaFullscreenDialog; +/** File that stores the firmware version at the start of download. This is in fota's private directory*/ +_LIT (KSWversionFile, "swv.txt"); + +/** Time and the interval download finalizing retries*/ +const TInt KDownloadFinalizerWaitTime(1000000); + +/** Time interval between syncml session retry attempts*/ +const TInt KSyncmlSessionRetryInterval(60000000); + +/** Time and the interval between the fota shutdownload retries*/ +const TTimeIntervalMicroSeconds32 KFotaTimeShutDown(10000000); + +/** How many times generic alert sending should be tried in row. */ +const TInt KSyncmlAttemptCount = 3; + +/** How many times a download can be restarted when a non-resumable interrupt occurs. */ +const TInt KMaxDownloadRestartCount = 3; + +_LIT_SECURITY_POLICY_C1( KReadPolicy, ECapabilityReadDeviceData ); +_LIT_SECURITY_POLICY_C1( KWritePolicy, ECapabilityWriteDeviceData ); +_LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); + +// FORWARD CLASS DECLARATION + +class CFotaUpdate; +class CFotaSrvApp; +class CFotaNetworkRegStatus; +class DownloadManagerClient; +class CFotaDownloadNotifHandler; +/** + * Fota server. Handles client requests. Starts download and/or update. + * + * This class is + * + * @lib fotaserver + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( CFotaServer ) : public CServer2, + MSyncMLEventObserver, + MfotadevicedialogObserver + { + friend class CFotaSrvSession; + friend class CFotaUpdate; + +public: + + // Member functions + + static CFotaServer* NewInstance(HbMainWindow& mainwindow); + + /** + * Destructor. + */ + virtual ~CFotaServer(); + +public: + + // All functions called from the session + /** + * Start download + * + * @since S60 v3.1 + * @param aParams Package state params to be save in db + * @param aPkgURL URL + * @return none + */ + void DownloadL(TDownloadIPCParams aParams, const TDesC8& aPkgURL, + TFotaClient aRequester, TBool aSilent, TBool aUpdateLtr); + + /** + * Pauses ongoing download + * + * @since S60 v3.1 + * @param none + * @return none, can leave with system wide errors + */ + void PauseDownloadL(); + + /** + * Start update + * + * @since S60 v3.1 + * @param aClient - the client which invoked the update + * @return none, can leave with system wide errors + */ + void TryUpdateL(TFotaClient aClient); + + /** + * Update, triggered by scheduler + * + * @since S60 v3.1 + * @param aUpdate - Update details + * @param aClient - the client which invoked the update + * @return none, can leave with system wide errors + */ + void ScheduledUpdateL(TFotaScheduledUpdate aUpdate, TFotaClient aClient); + + /** + * Delete swupd package + * + * @since S60 v3.1 + * @param aPkgId - Package id + * @return none, can leave with system wide errors + */ + void DeletePackageL(const TInt aPkgId); + + /** + * Get state of a swupd package + * + * @since S60 v3.1 + * @param aPkgId - Package id + * @return Package state, can leave with system wide errors + */ + TPackageState GetStateL(const TInt aPkgId); + + /** + * Tries to resume the download. + * + * @since S60 v5.2 + * @param aClient the client which triggers resume + * @param aSilentDl Whether to query user for resume? + * @return None, can leave with system wide errors + */ + void TryResumeDownloadL(TFotaClient aClient, TBool aSilentDl); + + /** + * Get ids of present swupd packages + * + * @since S60 v3.1 + * @param aPackageIdList On return, ids will be here + * @return None, can leave with system wide errors + */ + void GetUpdatePackageIdsL(TDes16& aPackageIdList); + + /** + * Get time of last update + * + * @since S60 v3.1 + * @param aTime On return, time of last update + * @return None, can leave with system wide errors + */ + void GetUpdateTimeStampL(TDes16& aTime); + + void GetCurrentFwDetailsL(TDes8& aName, TDes8& aVersion, TInt& aSize); + + /** + * Do cleanup for package + * + * @since S60 v3.1 + * @param aPackageID Packageid + * @return None + */ + void ResetFotaStateL(const TInt aPackageID); + + /** + * Set download to be finalized. + * + * @since S60 v3.1 + * @param aDLState Final state of the download + * @return None, can leave with system wide errors + */ + void FinalizeDownloadL(); + + /** + * Callback function to notify the network status + * + * @since S60 v3.2 + * @param Status of network connection + * @return None + */ + void ReportNetworkStatus(TBool status); + + //All user interface functions + + /** + * Function to start the full screen dialog + * + * @since SF4 + * @param aSize - the full size of the download + * @param aVersion - the version of the firmware upate + * @param aName - the name of the firmware update + * @return None + */ + void StartDownloadDialog(const QString &aName, const QString &aVersion, + const TInt &Size); + + /** + * Function to update the full screen dialog with download progress + * + * @since SF4 + * @param aProgress - the download progress in percentage + * @return None + */ + void UpdateDownloadDialog(TInt aProgress); + + /** + * Function to show any dialog within fota server + * + * @since SF4 + * @param dialogid -the dialog identifier + * @return None + */ + void ShowDialogL(TFwUpdNoteTypes aDialogid); + + /** + * Function that handles all the user responses on full screen dialog + * + * @since SF4 + * @param aResponse - key response + * @return None + */ + void HandleFullScreenDialogResponse(TInt aResponse); + + /** + * Function called from the fota update when battery condition changes + * + * @since SF4 + * @param aStatus - status of the battery, true if low, false if acceptable + * @return None + */ + void UpdateBatteryLowInfo(TBool aStatus); + + /** + * Returns the full screen dialog pointer + * + * @since SF4 + * @param none + * @return pointer to full screen dialog instance + */ + FotaFullscreenDialog* FullScreenDialog(); + + /** + * Sets the phone's startup reason which will used by Fota Startup Pluggin to any decision. + * + * @since S60 v3.2 + * @param aReason Startup reason, either download interrupted + * @return None + */ + void SetStartupReason(TInt aReason); + + void ConstructApplicationUI(TBool aVal); + void SetServerActive(TBool aValue); + + void FinalizeUpdate(); + +public: + // member variables + + /** + * The package state of the firmware update + */ + + TPackageState iPackageState; + + /** + * Used for package state saving. + */ + CFotaDB* iDatabase; + + + TBuf8 iLastFwUrl; + +public: + // from base classes + + /** + * Handle syncml event + * @param aEvent + * @param aIdentifier + * @param aError + * @param aAdditionalData + * @return none + */ + void OnSyncMLSessionEvent(TEvent aEvent, TInt aIdentifier, TInt aError, + TInt aAdditionalData); + + /** + * Function that is called when any user action happens on the dialogs or full screen dialog + * + * @since SF4 + * @param response - key press + * @return None + */ + void HandleDialogResponse(int response, TInt aDialogid); + + //All finalizing functions + /** + * Finalize download + * + * @since S60 v3.1 + * @param None + * @return None, can leave with system wide errors + */ + void DoFinalizeDownloadL(); + + /** + * Read update result file and report result back to DM server + * + * @since S60 v3.1 + * @param None + * @return None, can leave with system wide errors + */ + void DoExecuteResultFileL(); + + /** + * Close syncml session + * + * @since S60 v3.1 + * @param none + * @return None, can leave with system wide errors + */ + void DoCloseSMLSessionL(); + + /** + * When called, will try to shut the server when possible. + * This will use the timer to shut down. + * + * @since SF4 + * @param none + * @return None + */ + void StopServerWhenPossible(); + + void ServerCanShut(TBool aParam); + + TBool DecrementDownloadRestartCount(); + + void SetVisible(TBool aVisible); + +protected: + // from base classes + + /** + * Calls when a New session is getting created + * @param aVersion + * @param aMessage + * @return CSession2* + */ + CSession2* NewSessionL(const TVersion& aVersion, + const RMessage2& aMessage) const; + + /** + * DoConnect. + * + * @since S60 v3.1 + * @param aMessage IPC message + * @return none + */ + void DoConnect(const RMessage2& aMessage); + + void DropSession(); + +private: + + /** + * C++ default constructor. + */ + CFotaServer(HbMainWindow& mainwindow); + + /** + * ConstructL + * + * @since S60 v3.1 + * @param none + * @return none + */ + virtual void ConstructL(); + + /** + * Latter part of constructing. It's ensured that parent fotaserver is + * constructed only once, and child fotaserver is not constructed at all. + * Client fotaserver has a task of saving swupd as its only task. It should + * not update swupd states. + * + * @since S60 v3.1 + * @param aMessage Client process details + * @return none + */ + void ClientAwareConstructL(const RMessage2 &aMessage); + + /** + * Resets the fota state + * @since S60 v3.2 + * @param IPC params + * @return None + */ + + void ResetFotaStateToFailL(); + + /** + * Starts network monitoring operaiton for defined interval and retries + * + * @since S60 v3.2 + * @param None + * @return None + */ + void StartNetworkMonitorL(); + + /** + * Creates the disk reservation as set in the configuration + * + * @since SF4 + * @param + * @return None + */ + void CreateDiskReservation(); + + /** + * Deletes the disk reservation in the given absolute path + * + * @since SF4 + * @param + * @return None + */ + void DeleteDiskReservation(TDesC& path); + + /** + * Sets the appropriate access point id for the download + * + * @since SF4 + * @param none + * @return None, can leave with system wide errors. + */ + void SetIapToUseL(); + + /** + * Invoke Fota Monitory Service when the download gets suspended + * + * @since S60 v3.2 + * @return None + */ + void InvokeFmsL(); + + /** + * Cancels any outstanding request for resume notification + * + * @since S60 v3.2 + * @return None + */ + void CancelFmsL(); + + /** + * Check s/w version with the current version + * + * @since S60 v3.2 + * @param none + * @return Bool value(matches or not) + */ + TBool CheckSWVersionL(); + + /** + * Create DM session to DM server (identified by profileid) + * + * @since S60 v3.1 + * @param aProfileId DM profile id + * @param aIapid IAP id. If not kerrnone, will be used instead + * of profiles' IAP id. + * @return none + */ + void CreateDeviceManagementSessionL(TPackageState& aState); + + /** + * Get the software version of the device + * @since S60 v3.2 + * @param s/w version + * @return error + */ + TInt GetSoftwareVersion(TDes& aVersion); + + /** + * Checks for IAP Id exists or not in commsdb + * IAPId used for resuming the paused download + * @since S60 v5.0 + * @param IapId + * @return ETrue/EFalse + */ + TBool CheckIapExistsL(TUint32 aIapId); + + /** + * Checks if the drive is busy due to encryption + * + * @since SF4 + * @param None + * @return true, if busy, else false + */ + TBool IsDeviceDriveBusyL(); + + /** + * The downloader manager object + * + * @since SF4 + * @param + * @return None + */ + DownloadManagerClient* DownloaderL(); + + /** + * Sets the update requester + * + * @since SF4 + * @param aRequester - the requester of firmware update + * @return None + */ + void SetUpdateRequester(TFotaClient aRequester); + + /** + * Gets the update requester + * + * @since SF4 + * @param + * @return None + */ + TFotaClient GetUpdateRequester(); + + /** + * Reports firmware update status to the requester + * + * @since SF4 + * @param astate - the package state that has the status + * @return None + */ + void ReportFwUpdateStatusL(TPackageState& aState); + + /** + * Loops for the battery status whilst full screen dialog is open + * + * @since SF4 + * @param aBatteryLevel - the battery level + * @return None + */ + void LoopBatteryCheckL(TBool aBatteryLevel); + + /** + * Shows the full screen dialog + * + * @since SF4 + * @param aType - type of the dialog + * @return None + */ + void ShowFullScreenDialog(TInt aType); + + /** + * Swaps the fota process from background to foreground + * + * @since SF4 + * @param aState - true will bring to foreground, false to background + * @return None + */ + //void swapProcess(TBool aState); + + void ResetCounters(); + + TBool IsUserPostponeAllowed(); + + void DecrementUserPostponeCount(); + + void WakeupServer(); + +private: + // Data + +private: + // member variables + /** + * Is server initialized? + */ + TBool iInitialized; + + /** + * The download manager client + */ + DownloadManagerClient* iDownloader; + + /** + * Used for starting update of fw. + */ + CFotaUpdate* iUpdater; + + /** + * Used for deleting download. + */ + CPeriodic* iDownloadFinalizer; + + /** + * Used for deleting update. + */ + CPeriodic* iUpdateFinalizer; + + /** + * Used for reading result file. + */ + CPeriodic* iTimedExecuteResultFile; + + /** + * Used for closing syncml session + */ + CPeriodic* iTimedSMLSessionClose; + + /** + * File server session + */ + RFs iFs; + + /** + * Tries to periodically shut down fotaserver + */ + CPeriodic* iAppShutter; + + /** + * Syncmlsession for creating dmsession + */ + RSyncMLSession iSyncMLSession; + + /** + * Class that checks for network availability + * + */ + CFotaNetworkRegStatus* iMonitor; + + /** + * How many times to try dm session + */ + TInt iSyncMLAttempts; + + /** + * sync job id + */ + TSmlJobId iSyncJobId; + + /** + * profile + */ + TSmlProfileId iSyncProfile; + + /** + * To tell whether Generic Alert sending is being retried or not. This is checked before shutting down fota server + * + */ + TBool iRetryingGASend; + + /** + * To tell whether network is available to send Generic Alert. + * + */ + TBool iNetworkAvailable; + + /** + * The Fota Monitory Client object + */ + RFMSClient iFMSClient; + + /** + * Holds the storage drive of the package. + */ + TDriveNumber iStorageDrive; + + /** + * The session count to fota server. + */ + static TInt iSessionCount; + + /** + * The full screen dialog + */ + FotaFullscreenDialog *iFullScreenDialog; + + /** + * The notifier params to the dialogs + */ + CHbSymbianVariantMap * iNotifParams; + + CFotaDownloadNotifHandler * iNotifier; + /** + * Can the server shut? + */ + TBool iServerCanShut; + + /** + * Is async operation requested? + */ + TBool iAsyncOperation; + + TInt iDialogId; + + TBool iConstructed; + + HbMainWindow& iMainwindow; + }; + +#endif + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/FotaSrvDebug.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/FotaSrvDebug.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2005 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 defines logging macros + * + */ +#ifndef FOTADEBUG_H +#define FOTADEBUG_H +// IMPORT_C static TInt Print(TRefByValue aFmt,...); +#if defined (__WINS__) +#define _FOTA_DEBUG +#define _FOTA_DEBUG_RDEBUG +#else + +#endif +//#endif +#ifdef _FOTA_DEBUG +#include +#include +#include +#include +_LIT( KLogFile, "fotaserver.log" ); +_LIT( KLogDir, "fota" ); + +inline void FWrite(TRefByValue aFmt, ...) + { + VA_LIST list; + VA_START( list, aFmt ); + RFileLogger::WriteFormat(KLogDir, KLogFile, EFileLoggingModeAppend, + TPtrC(aFmt), list); + } + +#ifdef _FOTA_DEBUG_RDEBUG +#ifndef __GNUC__ +#define FLOG RDebug::Print +#else // __GNUC__ +#define FLOG(arg...) RDebug::Print(arg); +#endif // __GNUC__ +#else // _FOTA_DEBUG_RDEBUG +#ifndef __GNUC__ +#define FLOG FWrite +#else // __GNUC__ +#define FLOG(arg...) FWrite(arg); +#endif // __GNUC__ +#endif // _FOTA_DEBUG_RDEBUG +#else // _FOTA_DEBUG +#ifndef __GNUC__ +#define FLOG +#else +#define FLOG(arg...) +#endif // __GNUC__ +#endif // _FOTA_DEBUG +#endif // FOTADEBUG_H +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/FotasrvSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/FotasrvSession.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2005 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: Represent client's session at serverside + * + */ + +#ifndef CFOTASRVSESSION_H +#define CFOTASRVSESSION_H + +// INCLUDES + +#include +#include "FotaServer.h" + +// CLASS DECLARATION +/** + * Fotaserver's session class + * + * @lib fotaserver.exe + * @since S60 v3.1 + */ +class CFotaSrvSession : public CSession2 + { +public: + + CFotaSrvSession(); + + /** + * C++ Destructor + */ + virtual ~CFotaSrvSession(); + + /** + * Getter for fotaserver + * + * @since S60 v3.1 + * @param None + * @return Fotaserver + */ + CFotaServer* FotaServer() const; + +public: + // new functions + + /** + * Checks client secure id (dmhostserver,fotaserver,fotatester) + * + * @since S60 v3.1 + * @param Message containing client details + * @return is it fotaserver + */ + static TFotaClient CheckClientSecureIdL(const RMessage2& aMessage); + +protected: + + /** + * service client request + * + * @since S60 v3.1 + * @param aMessage message containing client request details + * @return None + */ + void ServiceL(const RMessage2& aMessage); + + /** + * Called from ServiceL to handle the request + * @param aMessage + * @return None + */ + void DispatchMessageL(const RMessage2& aMessage); + + + /** + * Handle service error + * + * @since S60 v3.1 + * @param aMessage Msg that resulted in error + * @param aError Error code + * @return None + */ + void ServiceError(const RMessage2& aMessage, TInt aError); + +private: + /** + * Error caught while writing data into FS + */ + TInt iError; + + }; + +#endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/fotaUpdateAgentComms.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/fotaUpdateAgentComms.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2005 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: Update agent result codes + * + */ + +#ifndef __COMMUNICATION_BETWEEN_NORMAL_AND_UPDATE_MODE_H__ +#define __COMMUNICATION_BETWEEN_NORMAL_AND_UPDATE_MODE_H__ + +typedef enum + { + + /* + Everything is ok - update package were installed successfully and + newer version of OS is running. + */ + UPD_OK = 0, + /* + Problem: The request sent to update installer were invalid - probable issue in + Download agent. + + Solutions: + - Probable: Download agent created an invalid file. + Fix download agent. + - Inprobable: Corrupted request file, or FAT + */ + UPD_INSTALL_REQUEST_IS_INVALID = 1, + /* + Problem: Update package is absent from specified location. + + Solution: Incorrect user application actions. + Read update application document / manual on how to switch to + update mode. + */ + UPD_UPDATE_PACKAGE_IS_ABSENT = 2, + /* + Problem: Update package is corrupted. (Integrity or authenticity + check failed) + Solution: End-user should try to download again update package. + */ + UPD_UPDATE_PACKAGE_IS_CORRUPTED = 3, + /* + Problem: Update package contents is invalid for some reason. + This problem normally refers to the fact that update package + were created incorrectly. + + Solution: Contact update package build team in order to find out the + error cause. + */ + UPD_UPDATE_PACKAGE_CONTENTS_IS_INVALID = 4, + /* + Problem: Update package is not compatible with current mobile device. + Solution: End-user should try to download again update package. + */ + + UPD_UPDATE_PACKAGE_IS_NOT_COMPATIBLE_WITH_CURRENT_MOBILE_DEVICE = 5, + /* + Problem: This error code will be used to indicate fatal error + code after which phone becomes dead. + + Solution: Phone should be taken to maintenance. + This error code cannot be seen by normal mode applications + because OS cannot be started when phone became dead. + */ + UPD_FATAL_ERROR = 0xFFFFFFFF + } InstallationResult; + +typedef enum + { + UPD_InvalidBlockHeaderIdentifier = 1, + UPD_InvalidUpdatePackageVersion = 2, + UPD_GenericInvalidFileFormat = 3 + } DetailedInstallationResult; + +#endif //__COMMUNICATION_BETWEEN_NORMAL_AND_UPDATE_MODE_H__ diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/fotadevicedialogobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/fotadevicedialogobserver.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2005 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: Fota server update and download functionality + * + */ + +#ifndef FOTADEVICEDIALOGOBSERVER_H +#define FOTADEVICEDIALOGOBSERVER_H + +class MfotadevicedialogObserver + { +public: + /** + * Notify the input of the device dialog to the respective caller. + */ + virtual void HandleDialogResponse( int response, TInt aDialogid ) = 0; + }; + +#endif // FOTADEVICEDIALOGOBSERVER_H + +// End of File + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/fotafullscreendialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/fotafullscreendialog.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2010 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: + * + */ + +#ifndef FOTAFULLSCREENDIALOG_H +#define FOTAFULLSCREENDIALOG_H + +// INCLUDES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "FotaDlClient.h" +#include "FotaServer.h" + +enum TFotaWarningType + { + EHbFotaDownload = 1, EHbFotaUpdate, EHbFotaLowBattery + }; + +// CLASS DECLARATION + +/** + * FotaFullscreenDialog + * + */ +class FotaFullscreenDialog : public QObject + { +Q_OBJECT + +public: + + FotaFullscreenDialog(CFotaServer* aObserver); + + ~FotaFullscreenDialog(); + + /** + * This function updates the details of the update to the fullscreen dialog. + * @param size - The total size of the update package. + * @param version - The version of the soeftware that is being updated. + * @param aName - the package name of the current update. + * @return void + */ + void SetSoftwareDetails(int size, const QString version, + const QString aName); + + /** + * This function updates the download progress bar to the progress value passed. + * @param aType - the state in which the firmware update is in(downloading or donwload complete) + * @return void + */ + void SetWarningDetails(TFotaWarningType aType); + + /** + * This function updates the download progress bar to the progress value passed. + * @param aProgress - the progress value to be update to the progress bar. + * @return void + */ + void UpdateProgressBar(TInt aProgress); + + /** + * Used to change the warnings and softkeys required for the update dialog + * @param void + * @return void + */ + void ShowUpdateDialog(); + + /** + * Used to refresh the dialog when the content of the dialog content changes. + * @param void + * @return void + */ + void Close(); + + /** + * Used to disable the RSK of the dialog when resume dialogs + * @param aVal - to enable or disable the key + * @return void + */ + void DisableRSK(TBool aVal); + + bool IsLSKEnabled(); + + void SetVisible(TBool aVisible); + +private: + + /** + * Used to refresh the dialog when the content of the dialog changes. + * @param void + * @return void + */ + void RefreshDialog(); + +public slots: + + /** + * Slot to be called when user selects the Left soft key. + * @param void + * @return void + */ + void LSKSelected(); + + /** + * Slot to be called when user selects the Right soft key. + * @param void + * @return void + */ + void RSKSelected(); + + /** + * Slot to be called when the dialog is about to get closed. + * @param void + * @return void + */ + void aboutToClose(); + +private: + + // dialog instance + HbDialog * idialog; + + //document loader to load the widgets + HbDocumentLoader iloader; + + //progress bar for updating download progress + HbProgressBar * iprogressBar; + + // Fota server instance to send the keypress event + CFotaServer* iServer; + + // LSK of the dialog + HbPushButton * iPrimaryAction; + + // RSK of the dialog + HbPushButton * iSecondaryAction; + + // Flag to differentiate from keypress and dialog timeout case. + TBool iClicked; + + // Warning note displayed in the full screen dialog + HbLabel *iInstallNote; + + // Warning note displayed in the full screen dialog + HbLabel *iRestartNote; + + // Warning note displayed in the full screen dialog + HbLabel *iRestartIcon; + + // Warning note displayed in the full screen dialog + HbLabel *iEmergencyNote; + + // Warning note displayed in the full screen dialog + HbLabel *iEmergencyIcon; + + // Warning note displayed in the full screen dialog + HbLabel *iChargerNote; + + HbLabel *iChargerIcon; + + // To display the state of the download above progress bar + HbLabel *iDownloadState; + + // Fullscreen dialog title. + HbLabel *iTitle; + // Firmware details that is to be shwon in full screen dialog. + HbLabel *iSwDetails; + }; + +#endif // CLASSNAME_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/fotanotifiers.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/fotanotifiers.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2010 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: + * + */ +#ifndef FOTANOTIFIER_H +#define FOTANOTIFIER_H + +// INCLUDES +#include +#include +#include +#include +#include + +#include "FotaDlMgrClient.h" +#include "fotaserverPrivateCRKeys.h" + +// CLASS DECLARATION + +/** + * CClassName + * + */ + +//#include // MHbDeviceDialogObserver + +NONSHARABLE_CLASS ( CFotaDownloadNotifHandler ) : public MHbDeviceDialogObserver + { +public: + // new functions + /** + * Construction and setting of observer happens here + * + * @since S60 SF4 + * @param aObserver is the parent class which owns the notifier and information is + * passed to the parent class from the device dialog. + */ + + static CFotaDownloadNotifHandler* NewL( + MfotadevicedialogObserver* aObserver); + + /** + * constructor for CFotaDownloadNotifHandler + * + * @since S60 SF4 + * @param None + */ + + CFotaDownloadNotifHandler(); + + /** + * Destructor for CFotaDownloadNotifHandler + * + * @since S60 SF4 + * @param None + */ + + ~CFotaDownloadNotifHandler(); + + /** + * Shows notifier and/or ends download + * + * @since S60 SF4 + * @param aNotifParams Contains necessary information to lauch a notifier + */ + + void CFotaDownloadNotifHandler::LaunchNotifierL( + CHbSymbianVariantMap *aNotifParams, TInt aDialogId); + + void Cancel(); + +public: + // from MHbDeviceDialogObserver + + /** + * Slot to be called from the device dialog + * + * @aData - It contains the information from the device dialog + */ + void DataReceived(CHbSymbianVariantMap& aData); + + /** + * Slot to be called from the device dialog is closed + * + * @aCompletionCode - It contains the error code due to which dialog is closed. + */ + void DeviceDialogClosed(TInt aCompletionCode); + +private: + + //DownloadClient* iDownload; + MfotadevicedialogObserver * iObserver; + + // Device dialog instance + CHbDeviceDialogSymbian* iDevDialog; + + TInt iDialogID; + + }; + +#endif // FOTANOTIFIER_H diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/fotaserverPrivatePSKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/fotaserverPrivatePSKeys.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2005 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: PS keys for fotaserver + * + */ + +#ifndef FOTASERVER_PRIVATE_PSKEYS_H +#define FOTASERVER_PRIVATE_PSKEYS_H + +// CONSTANTS + +// Reading the current or ongoing NSML Job Id from DM UI +const TUint32 KNsmlCurrentJobId = 0x00000001; + +// Reading the Server Alert UI Mode Key +const TUint32 KNsmlSanUIMode = 0x00000004; + +// Reading the OMA DM large object download status +const TUint32 KFotaLrgObjDl = 0x00000005; + +// Reading the Server profile id used for OMA DM large object download +const TUint32 KFotaLrgObjProfileId = 0x00000006; + +//PubSub key used to mark which application is handling the process of download +//Sets by DM UI, NSC or NSCBackground +const TUint32 KNSmlCurrentFotaUpdateAppName = 0x0000000A; + +//PubSub key used to define should "Install Now?" query be shown or not +//Sets by DM UI or NSC +const TUint32 KDevManShowInstallNowQuery = 0x0000000B; + +//Reading the DM Job status/error used for OMA DM large object download +const TUint32 KDmJobCancel = 0x00000012; + +#endif // FOTASERVER_PRIVATE_PSKEYS_H +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/fotaupdate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/fotaupdate.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2005 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: Header for updater active object + * + */ +#ifndef __UPDATER_H___ +#define __UPDATER_H___ +//System includes +#include +#include +#include +#include "FotaServer.h" +#include "fotaUpdateAgentComms.h" +#include "fotaengine.h" +#include +#include +#include "fotadevicedialogobserver.h" +// CONSTANTS +_LIT (KUpdateResultFile, "update.resp"); +_LIT (KUpdateRequestFile, "update.req"); +_LIT (KUpdateBitmap ,"installing.bmp"); +_LIT (KRestartingBitmap ,"restarting.bmp"); +_LIT (KUpdateTimeStampFileName, "updatetimestamp"); +_LIT8 (KSwupdPath8, "c:\\private\\102072C4\\"); +_LIT8 (KSwupdFileExt8, ".swupd"); + +const TInt BatteryLevelAccepted = EBatteryLevelLevel3; + +enum MonitorType + { + None, BatteryLevel, ChargingStatus + }; + +// FORWARD DECLARATIONS +class CFotaServer; +class CFotaUpdate; +class CFotaDownloadNotifHandler; + +// CLASS DECLARATION + +/** + * Update related activities + * + * @lib fotaserver + * @since S60 v3.1 + */ +NONSHARABLE_CLASS( CFotaUpdate ) : public CActive, MfotadevicedialogObserver + { +public: + + static CFotaUpdate* NewL(CFotaServer* aServer); + + virtual ~CFotaUpdate(); + + /*****Functions called before update*****/ + + TBool CheckBatteryL(); + + void MonitorBatteryChargeLevel(); + + void MonitorBatteryChargingStatus(); + + void CancelMonitor(); + + /** + * Start update + * + * @since S60 v3.1 + * @param aParams details + * @return none + */ + void StartUpdateL(const TDownloadIPCParams &aParams); + + /** + * Update. boot. + * + * @since S60 v3.1 + * @param none + * @return none + */ + void UpdateL(); + + /*****Functions called after update *****/ + + /** + * Check update result written update agent. Is it there? + * + * @since S60 v3.1 + * @param aRfs + * @return is it there + */ + static TBool CheckUpdateResults(RFs& aRfs); + + /** + * Delete update result file + * + * @since S60 v3.1 + * @param none + * @return none + */ + static void DeleteUpdateResultFileL(); + + /** + * Execute update result file. That is, read result code. Send it to srv. + * + * @since S60 v3.1 + * @param aRfs + * @return none + */ + void ExecuteUpdateResultFileL(); + +protected: + // from base classes + + + /** + * Hanlde notifier clicking + * + * @since S60 v3.1 + * @param none + * @return none + */ + virtual void RunL(); + + /** + * Cancel outstanding reqeust + * + * @since S60 v3.1 + * @param none + * @return none + */ + void DoCancel(); + + /** + * Handle leaving runl + * + * @since S60 v3.1 + * @param aError error + * @return none + */ + virtual TInt RunError(TInt aError); + +private: + + CFotaUpdate(); + + void ShowDialogL(TFwUpdNoteTypes dialogid); + + TBool IsUSBConnected(); + + TInt WriteUpdateBitmapL( const TDesC& aText, const TDesC& aFile); + +public: + // from MfotadevicedialogObserver + + void HandleDialogResponse(int response, TInt aDialogid); + +private: + + /** + * reference to fotaserver. + * Not own + */ + CFotaServer* iFotaServer; + + RProperty iProperty; + + MonitorType iMonitorType; + + CHbSymbianVariantMap * iNotifParams; + + CFotaDownloadNotifHandler * iNotifier; + }; + +#endif // __UPDATER_H___ diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/inc/fsview.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/inc/fsview.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#ifndef FSVIEW_H_ +#define FSVIEW_H_ + +#include +#include + +class CFotaServer; + +class FSView : public HbView + { + Q_OBJECT + +public: + FSView(); + ~FSView(); + + void SetServer(CFotaServer * aServer); + + //Handles the incoming events + bool eventFilter(QObject *object, QEvent *event); + +private: + CFotaServer *iServer; + }; +#endif /* FSVIEW_H_ */ diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/FotaDB.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/FotaDB.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,549 @@ +/* + * Copyright (c) 2005 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: Fota package state preservation + * + */ + +#include +#include "FotaDB.h" +#include "FotaSrvDebug.h" +#include "fotaserverPrivateCRKeys.h" + +#define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); } + +// ====================== MEMBER FUNCTIONS =================================== + +// --------------------------------------------------------------------------- +// CFotaDB::CFotaDB() +// --------------------------------------------------------------------------- +CFotaDB::CFotaDB() : + iIsOpen(EFalse) + { + } + +// --------------------------------------------------------------------------- +// CFotaDB::~CFotaDB() +// --------------------------------------------------------------------------- +CFotaDB::~CFotaDB() + { + //Delete columns set + if (iColSet) + { + delete iColSet; + iColSet = NULL; + } + //Close table + iTable.Close(); + + //Close database + iStateDB.Close(); + + //Close file server session + if (iFSSession.Handle()) + iFSSession.Close(); + } + +// --------------------------------------------------------------------------- +// CFotaDB::NewL() +// --------------------------------------------------------------------------- +CFotaDB* CFotaDB::NewL() + { + CFotaDB* self = new (ELeave) CFotaDB(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// --------------------------------------------------------------------------- +// CFotaDB::ConstructL() +// --------------------------------------------------------------------------- +void CFotaDB::ConstructL() + { + TInt err; + TBuf tmp; + User::LeaveIfError(iFSSession.Connect()); + err = iFSSession.CreatePrivatePath(EDriveC); + if (err != KErrNone && err != KErrAlreadyExists) + User::Leave(err); + User::LeaveIfError(iFSSession.SetSessionToPrivate(EDriveC)); + User::LeaveIfError(iFSSession.SessionPath(tmp)); + } + +// --------------------------------------------------------------------------- +// CFotaDB::CreateDatabaseL() +// Creates db in private dir of fotaserver +// --------------------------------------------------------------------------- +void CFotaDB::CreateDatabaseL() + { + FLOG(_L("CFotaDB::CreateDatabaseL() >>")); + TInt err; + User::LeaveIfError(iStateDB.Create(iFSSession, KDatabaseName)); + User::LeaveIfError(iStateDB.Begin()); + User::LeaveIfError(iStateDB.Execute(KCreateTable)); + err = iStateDB.Commit(); + if (err) + { + FLOG(_L(" cdb err %d"), err); + iStateDB.Rollback(); + User::Leave(err); + } + User::LeaveIfError(iStateDB.Compact()); + FLOG(_L("CFotaDB::CreateDatabaseL() <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDB::AddPackageStateL +// Adds state to db +// --------------------------------------------------------------------------- +void CFotaDB::AddPackageStateL(const TPackageState& aState, + const TDesC8& aPkgURL) + { + FLOG(_L(" CFotaDB::AddPackageStateL >>")); + TInt err; + RDbView view; + CleanupClosePushL(view); + TPackageState pkgstate(aState); + pkgstate.iResult = -1; // result should be -1 if no Execs have been done + err = view.Prepare(iStateDB, TDbQuery(KSelectAll), RDbView::EInsertOnly); + __LEAVE_IF_ERROR(err); + FLOG(_L(" CFotaDB::AddPackageStateL inserting. pkgid:%d result:%d state:%d"), + pkgstate.iPkgId, pkgstate.iResult, pkgstate.iState); + view.InsertL(); + StateToRowL(pkgstate, aPkgURL, view); + view.PutL(); + CleanupStack::PopAndDestroy(); //view + FLOG(_L(" CFotaDB::AddPackageStateL <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDB::GetAllL +// Get all states +// --------------------------------------------------------------------------- +void CFotaDB::GetAllL(RArray& aStates) + { + RDbView view; + CleanupClosePushL(view); + + TInt err = view.Prepare(iStateDB, TDbQuery(KSelectAll)); + __LEAVE_IF_ERROR(err); + view.EvaluateAll(); + + view.FirstL(); + FLOG(_L("[fota DB] --- rows ------------------------------------------------------------------- v")); + while (view.AtRow()) + { + view.GetL(); + HBufC8* url; + TPackageState s = RowToStateL(url, view); + aStates.Append(s.iPkgId); + CleanupStack::PushL(url); + FLOG(_L("[fotaDB] pkgid: %d profid:%d state:%d result:%d \ + url: %d chars sessiontype:%d IapId:%d Pkgsize:%d UpdateLtr:%d"), + s.iPkgId, s.iProfileId, s.iState, s.iResult, + url->Des().Length(), s.iSessionType, s.iIapId, s.iPkgSize, + s.iUpdateLtr); + CleanupStack::PopAndDestroy(); // url + view.NextL(); + } + FLOG(_L("[fota DB] --- rows ------------------------------------------------------------------- ^")); + view.Close(); + CleanupStack::PopAndDestroy(); //view + } + +// --------------------------------------------------------------------------- +// CFotaDB::OpenDBL() +// Opens database +// --------------------------------------------------------------------------- +void CFotaDB::OpenDBL() + { + FLOG(_L("CFotaDB::OpenDBL()")); + if (!iIsOpen) //Prevents accidental opening of database twice + { + TInt err; + err = iStateDB.Open(iFSSession, KDatabaseName); + + if (err == KErrNotFound) + { + CreateDatabaseL(); + } + else if (err != KErrNone) + { + FLOG(_L("[fota DB openDB]\t db open error: %d"), err); + FLOG(_L("deleting fota DB and creating it again...")); + err = iFSSession.Delete(KDatabaseName); + CreateDatabaseL(); + User::LeaveIfError(err); + } + User::LeaveIfError(iTable.Open(iStateDB, KTblState)); + iColSet = iTable.ColSetL(); + + iIsOpen = ETrue; + } + } + +// --------------------------------------------------------------------------- +// CFotaDB::CloseAndCommitDB +// Closes and commits DB +// --------------------------------------------------------------------------- +void CFotaDB::CloseAndCommitDB() + { + if (iColSet) + { + delete iColSet; + iColSet = NULL; + } + iTable.Close(); + iStateDB.Close(); + iIsOpen = EFalse; + } + +// --------------------------------------------------------------------------- +// CFotaDB::IsOpen() +// Chekcs if db is open +// --------------------------------------------------------------------------- +TBool CFotaDB::IsOpen() + { + return iIsOpen; + } + +// --------------------------------------------------------------------------- +// CFotaDB::GetStateL +// Gets pkg state from db +// --------------------------------------------------------------------------- +TPackageState CFotaDB::GetStateL(const TInt aPkgId, TDes8& aPkgURL) + { + RDbView view; + TPackageState s; + CleanupClosePushL(view); + + s.iState = RFotaEngineSession::EIdle; // default state is idle + + HBufC* select = HBufC::NewLC(KSelect_where_packageid().Length() + 10); + select->Des().Format(KSelect_where_packageid, aPkgId); + + TInt err = view.Prepare(iStateDB, TDbQuery(*select)); + __LEAVE_IF_ERROR(err); + view.EvaluateAll(); + view.FirstL(); + + while (view.AtRow()) + { + view.GetL(); + HBufC8* url; + s = RowToStateL(url, view); + CleanupStack::PushL(url); + aPkgURL.Copy(url->Des()); + CleanupStack::PopAndDestroy(); // url + view.NextL(); + } + CleanupStack::PopAndDestroy(); //select + CleanupStack::PopAndDestroy(); //view + return s; + } + +// --------------------------------------------------------------------------- +// CFotaDB::SetStateL +// Writes package state to DB. +// --------------------------------------------------------------------------- +void CFotaDB::SetStateL(TPackageState& aState, const TDesC8& aPkgURL, + TUint aChangedFields) + { + FLOG(_L(" CFotaDB::SetStateL >> id %d result %d state %d sessiontype %d iapid %d pkgsize %d updateltr %d"), aState.iPkgId, aState.iResult, aState.iState); + __ASSERT_ALWAYS( aChangedFields!=0, User::Leave(KErrArgument) ); + TBuf8 temp; + TPackageState found = GetStateL(aState.iPkgId, temp); + if (found.iPkgId == KErrNotFound) + { + AddPackageStateL(aState, aPkgURL); + } + else + { + // sml try count must be reset, if state is set + if (aChangedFields & EFDBState) + { + aChangedFields = aChangedFields | EFDBSmlTryCount; + SetRetryCount(aState); + } + + // Construct a SQL string for update. + // Example: UPDATE State SET Result=40,State=4 WHERE pkgID=5 + // + TInt sqlsize = 0; + _LIT8( KSqlbegin, "UPDATE State SET " ); + TBuf<21> sqlEnd; + HBufC8* sql(NULL); + // determine characters needed + sqlsize = DetermineCharNeeded(aChangedFields, aState, aPkgURL); + sqlEnd.AppendFormat(_L(" WHERE pkgID=%d"), aState.iPkgId); + + sql = HBufC8::NewLC(((TDesC8) KSqlbegin).Length() + sqlsize + + sqlEnd.Length()); + + sql->Des().Append(KSqlbegin); + + if (aChangedFields & EFDBResult) + { + // check FUMO compability + __ASSERT_ALWAYS( aState.iResult>=KErrNotFound + && aState.iResult<=602, User::Leave(KErrArgument) ); + sql->Des().AppendFormat(_L8("Result=%d,"), aState.iResult); + } + if (aChangedFields & EFDBState) + { + // check FUMO compability + __ASSERT_ALWAYS( aState.iState>=0 && aState.iState<=100 + , User::Leave(KErrArgument) ); + sql->Des().AppendFormat(_L8("State=%d,"), aState.iState); + } + if (aChangedFields & EFDBProfileId) + { + sql->Des().AppendFormat(_L8("profileid=%d,"), aState.iProfileId); + } + if (aChangedFields & EFDBPkgUrl) + { + sql->Des().AppendFormat(_L8("pkgurl='%S',"), &aPkgURL); + } + if (aChangedFields & EFDBPkgName) + { + sql->Des().AppendFormat(_L8("pkgname='%S',"), &(aState.iPkgName)); + } + if (aChangedFields & EFDBVersion) + { + sql->Des().AppendFormat(_L8("Version='%S',"), + &(aState.iPkgVersion)); + } + if (aChangedFields & EFDBSmlTryCount) + { + __ASSERT_ALWAYS( aState.iSmlTryCount>=0 + , User::Leave(KErrArgument) ); + sql->Des().AppendFormat(_L8("SmlTryCount=%d,"), + aState.iSmlTryCount); + + } + if (aChangedFields & EFDBSessionType) + { + sql->Des().AppendFormat(_L8("SessionType=%d,"), + aState.iSessionType); + } + if (aChangedFields & EFDBIapId) + { + // validate IAP ID + __ASSERT_ALWAYS( aState.iIapId>=-1 ,User::Leave(KErrArgument) ); + sql->Des().AppendFormat(_L8("IapId=%d,"), aState.iIapId); + } + if (aChangedFields & EFDBPkgSize) + { + sql->Des().AppendFormat(_L8("PkgSize=%d,"), aState.iPkgSize); + } + if (aChangedFields & EFDBUpdateLtr) + { + // validate bit + sql->Des().AppendFormat(_L8("UpdateLtr=%d,"), aState.iUpdateLtr); + } + // remove trailing , + if (aChangedFields) + { + sql->Des().SetLength(sql->Des().Length() - 1); + } + sql->Des().Append(sqlEnd); + HBufC* sql2 = HBufC::NewLC(sql->Length()); // to cleanupstack + sql2->Des().Copy(sql->Des()); + FLOG(_L(" sql:%S"), sql2); + + User::LeaveIfError(iStateDB.Begin()); + User::LeaveIfError(iStateDB.Execute(*sql2)); + User::LeaveIfError(iStateDB.Commit()); + User::LeaveIfError(iStateDB.Compact()); + + CleanupStack::PopAndDestroy(sql2); //sql2 + CleanupStack::PopAndDestroy(sql); //sql + } + FLOG(_L(" CFotaDB::SetStateL <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDB::DetermineCharNeeded +// Returns the char needed fro the query +// --------------------------------------------------------------------------- + +TInt CFotaDB::DetermineCharNeeded(TInt aChangedFields, TPackageState& aState, + const TDesC8& aPkgURL) + + { + + TInt sqlsize = 0; + if (aChangedFields & EFDBResult) + sqlsize += 4 + 7 + 4; + if (aChangedFields & EFDBState) + sqlsize += 4 + 5 + 4; + if (aChangedFields & EFDBProfileId) + sqlsize += 4 + 9 + 4; + if (aChangedFields & EFDBPkgUrl) + sqlsize += aPkgURL.Length() + 6 + 4; + if (aChangedFields & EFDBPkgName) + sqlsize += aState.iPkgName.Length() + 7 + 4; + if (aChangedFields & EFDBVersion) + sqlsize += aState.iPkgVersion.Length() + 7 + 4; + if (aChangedFields & EFDBSmlTryCount) + sqlsize += 4 + 11 + 4; + + if (aChangedFields & EFDBSessionType) + sqlsize += 4 + 11 + 4; + if (aChangedFields & EFDBIapId) + sqlsize += 4 + 5 + 4; + if (aChangedFields & EFDBPkgSize) + sqlsize += 4 + 7 + 10; + if (aChangedFields & EFDBUpdateLtr) + sqlsize += 4 + 11 + 4; + + return sqlsize; + + } + +// --------------------------------------------------------------------------- +// CFotaDB::SetRetryCount +// Sets the retry count +// --------------------------------------------------------------------------- +void CFotaDB::SetRetryCount(TPackageState& aState) + { + CRepository* centrep(NULL); + TInt err = KErrNone; + TInt retry = 0; + + TRAP(err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if (centrep) + { + err = centrep->Get(KGenericAlertRetries, retry); + delete centrep; + centrep = NULL; + } + if (err == KErrNone) + { + if (retry < 0) + { + aState.iSmlTryCount = KDefaultSmlTryCount; + } + else if (retry == 0) + { + aState.iSmlTryCount = 2; + } + else if (retry > KMaximumSmlTryCount) + { + aState.iSmlTryCount = KMaximumSmlTryCount + 1; + } + else + { + aState.iSmlTryCount = retry + 1; + } + } + else + { + aState.iSmlTryCount = KDefaultSmlTryCount; + } + } + +// --------------------------------------------------------------------------- +// CFotaDB::RowToStateL +// Extracts db row contents to package state object and aPkgUrl +// Returns url in aPkgURL parameter +// --------------------------------------------------------------------------- +TPackageState CFotaDB::RowToStateL(HBufC8*& aPkgUrl, const RDbView& aView) + { + TPackageState s; + TInt pkgid = aView.ColInt(iColSet->ColNo(KColPkgId)); + TInt state = aView.ColInt(iColSet->ColNo(KColState)); + TInt result = aView.ColInt(iColSet->ColNo(KColResult)); + TSmlProfileId profileid(aView.ColInt(iColSet->ColNo(KColProfileId))); + TPtrC pkgname = aView.ColDes(iColSet->ColNo(KColPkgName)); + TPtrC version = aView.ColDes(iColSet->ColNo(KColVersion)); + TInt smltrycount = aView.ColInt(iColSet->ColNo(KColSmlTryCount)); + TInt sessiontype = aView.ColInt(iColSet->ColNo(KColSessionType)); + TInt iapid = aView.ColInt(iColSet->ColNo(KColIapId)); + TUint pkgsize = aView.ColUint(iColSet->ColNo(KColPkgSize)); + TBool updateltr = aView.ColUint8(iColSet->ColNo(KColUpdateLtr)); + + s.iPkgId = pkgid; + s.iPkgName.Copy(pkgname); + s.iPkgVersion.Copy(version); + s.iProfileId = profileid; + s.iResult = result; + s.iState = RFotaEngineSession::TState(state); + s.iSmlTryCount = smltrycount; + s.iSessionType = sessiontype; + s.iIapId = iapid; + s.iPkgSize = pkgsize; + s.iUpdateLtr = updateltr; + + RDbColReadStream rstream; + TInt len = aView.ColLength(iColSet->ColNo(KColPkgUrl)); + rstream.OpenLC(aView, iColSet->ColNo(KColPkgUrl)); + HBufC* pkgurl = HBufC::NewLC(len); + TPtr ptr = pkgurl->Des(); + rstream.ReadL(ptr, len); + + HBufC8* tmp = HBufC8::NewL(pkgurl->Des().Length()); + tmp->Des().Copy(pkgurl->Des()); + aPkgUrl = tmp; + + CleanupStack::PopAndDestroy(pkgurl); + CleanupStack::PopAndDestroy(&rstream); + return s; + } + +// --------------------------------------------------------------------------- +// CFotaDB::StateToRowL +// Converts state object to database row (into view object) +// --------------------------------------------------------------------------- +void CFotaDB::StateToRowL(const TPackageState& aPkg, const TDesC8& aPkgURL, + RDbView& aView) + { + HBufC* pkgname = HBufC::NewLC(aPkg.iPkgName.Length()); + HBufC* version = HBufC::NewLC(aPkg.iPkgVersion.Length()); + + pkgname->Des().Copy(aPkg.iPkgName); + version->Des().Copy(aPkg.iPkgVersion); + + aView.SetColL(iColSet->ColNo(KColPkgId), aPkg.iPkgId); + aView.SetColL(iColSet->ColNo(KColResult), aPkg.iResult); + aView.SetColL(iColSet->ColNo(KColState), aPkg.iState); + aView.SetColL(iColSet->ColNo(KColProfileId), aPkg.iProfileId); + aView.SetColL(iColSet->ColNo(KColPkgName), *pkgname); + aView.SetColL(iColSet->ColNo(KColVersion), *version); + aView.SetColL(iColSet->ColNo(KColSmlTryCount), aPkg.iSmlTryCount); + aView.SetColL(iColSet->ColNo(KColSessionType), aPkg.iSessionType); + aView.SetColL(iColSet->ColNo(KColIapId), aPkg.iIapId); + aView.SetColL(iColSet->ColNo(KColPkgSize), aPkg.iPkgSize); + aView.SetColL(iColSet->ColNo(KColUpdateLtr), aPkg.iUpdateLtr); + + RDbColWriteStream wstream; + CleanupClosePushL(wstream); + wstream.OpenL(aView, iColSet->ColNo(KColPkgUrl)); + // Cannot write 8 bit descriptors to databae + HBufC* buf = HBufC::NewLC(aPkgURL.Length()); + buf->Des().Copy(aPkgURL); + wstream.WriteL(buf->Des()); + + FLOG(_L("CFotaDB::StateToRowL id:%d result:%d state:%d profileid:%d \ + name:%d chars version: %d chars url: %d chars sessiontype:%d iapid:%d pkgsize:%d updateltr = %d"), + aPkg.iPkgId, aPkg.iResult, aPkg.iState, aPkg.iProfileId, + pkgname->Des().Length(), version->Des().Length(), + buf->Des().Length(), aPkg.iSessionType, aPkg.iIapId, + aPkg.iPkgSize, aPkg.iUpdateLtr); + + CleanupStack::PopAndDestroy(buf); + CleanupStack::PopAndDestroy(&wstream); + CleanupStack::PopAndDestroy(version); + CleanupStack::PopAndDestroy(pkgname); + } diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/FotaDlClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/FotaDlClient.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,615 @@ +/* + * Copyright (c) 2005 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: Fota download client + * + */ +#include +#include "FotaDlClient.h" +#include "FotaDlMgrClient.h" + +// ----------------------------------------------------------------------------- +// The constructor of this class +// ----------------------------------------------------------------------------- +DownloadClient::DownloadClient(DownloadManagerClient* Observer) + { + FLOG(_L("DownloadClient::DownloadClient >>")); + + iFotaDlMgrClient = Observer; + iTotalSize = -1; + iSpaceChecked = 0; + iDownload = NULL; + iClientinterrupted = false; + iClientError = ErrorNone; + iContentType = TUnknownType; + + FLOG(_L("DownloadClient::DownloadClient <<")); + } + +// ----------------------------------------------------------------------------- +// The destructor of this class +// ----------------------------------------------------------------------------- +DownloadClient::~DownloadClient() + { + FLOG(_L("DownloadClient::~DownloadClient >>")); + + if (iDownload) + { + disconnect(iDownload, SIGNAL(downloadEvent(DownloadEvent *)), this, + SLOT(DownloadEventRecieved(DownloadEvent *))); + + //Do not delete iDownload as it is owned by download manager. + //delete iDownload; + iDownload = NULL; + } + //Don't delete as it is not owned + iFotaDlMgrClient = NULL; + + FLOG(_L("DownloadClient::~DownloadClient <<")); + } + +// ----------------------------------------------------------------------------- +// Creates a single download with the download manager +// ----------------------------------------------------------------------------- +TInt DownloadClient::CreateDownload(const QString &url, DownloadType type) + { + FLOG(_L("DownloadClient::CreateDownload >>")); + + TInt ret = ENotOk; + + iDownload = iFotaDlMgrClient->Manager()->createDownload(url, type); //Step 6 + + if (iDownload) + { + connect(iDownload, SIGNAL(downloadEvent(DownloadEvent *)), this, + SLOT(DownloadEventRecieved(DownloadEvent *))); + ret = EOk; + } + else + { + FLOG(_L("Download creation is unsuccessful!")); + } + + FLOG(_L("DownloadClient::CreateDownload, ret = %d <<"), ret); + return ret; + } + +// ----------------------------------------------------------------------------- +// Sets the required attributes for the single download. +// ----------------------------------------------------------------------------- +TInt DownloadClient::SetDownloadAttributes() + { + FLOG(_L("DownloadClient::SetDownloadAttributes >>")); + + int ret(EOk); + + iDownload->setAttribute(ProgressInterval, 100); //Step 7 + iDownload->setAttribute(Priority, High); //Step 8 + + //Setting the default path + iDownload->setAttribute(DestinationPath, DefaultPath); + + iDownload->setAttribute(FileName, PackageName); + + FLOG(_L("DownloadClient::SetDownloadAttributes, ret = %d <<"), ret); + + return ret; + } + +// ----------------------------------------------------------------------------- +// Starts the single download. Download should be created and attributes set before this. +// ----------------------------------------------------------------------------- +TInt DownloadClient::Start() + { + FLOG(_L("DownloadClient::Start >>")); + + iClientinterrupted = false; + iDownload->start(); //Step 9 + + FLOG(_L("DownloadClient::Start <<")); + return EOk; + + } + +// ----------------------------------------------------------------------------- +// Gets the attribute of the single download +// ----------------------------------------------------------------------------- +inline QVariant DownloadClient::GetDownloadAttribute(DownloadAttribute attr) + { + FLOG(_L("DownloadClient::GetDownloadAttribute >>")); + + QVariant val; + + val = iDownload->attribute(attr); + + FLOG(_L("DownloadClient::GetDownloadAttribute<<")); + return val; + } + +// ----------------------------------------------------------------------------- +// Pauses the single download. +// ----------------------------------------------------------------------------- +TInt DownloadClient::Pause(TClientErrorType aReason) + { + FLOG(_L("DownloadClient::Pause >>")); + + iClientinterrupted = true; + iClientError = aReason; + + iDownload->pause(); + + FLOG(_L("DownloadClient::Pause <<")); + return EOk; + } + +// ----------------------------------------------------------------------------- +// Resumes the single download. +// ----------------------------------------------------------------------------- +TInt DownloadClient::Resume() + { + FLOG(_L("DownloadClient::Resume >>")); + + int ret(ENotOk); + iSpaceChecked = true; + + if (!iDownload) + { + QList dls = + iFotaDlMgrClient->Manager()->currentDownloads(); + int count = dls.count(); + FLOG(_L("Number of current downloads = %d"), count); + + if (count) + { + iDownload = dls[0]; + FLOG(_L("Connecting to download event")); + connect(iDownload, SIGNAL(downloadEvent(DownloadEvent *)), this, + SLOT(DownloadEventRecieved(DownloadEvent *))); + FLOG(_L("Connecting to download events done")); + } + + } + iClientinterrupted = false; + iClientError = ErrorNone; + + if (iDownload) + { + FLOG(_L("B4 Download Start")); + iDownload->start(); + ret = EOk; + FLOG(_L("After Download Start")); + } + + FLOG(_L("DownloadClient::Resume, ret = %d <<"), ret); + return ret; + } + +// ----------------------------------------------------------------------------- +// Cancels the single download. +// ----------------------------------------------------------------------------- +TInt DownloadClient::Cancel(TClientErrorType aReason) + { + FLOG(_L("DownloadClient::Cancel >>")); + + iClientinterrupted = true; + iClientError = aReason; + + iDownload->cancel(); + + FLOG(_L("DownloadClient::Cancel <<")); + return EOk; + } + +// ----------------------------------------------------------------------------- +// Restarts the single download. This is equivalent to cancel and start on Download. +// ----------------------------------------------------------------------------- +TInt DownloadClient::Restart() + { + FLOG(_L("DownloadClient::Restart >>")); + + QString path(NULL); + int size = iTotalSize; + TFreeSpace avail = iFotaDlMgrClient->GetSuitablePath(size, path); + + if (avail == EFitsToReservation || avail == EFitsToFileSystem) + { + //FLOG(_L("Space is available for download at %S"), TPtrC (reinterpret_cast (path.constData()),path.length())); + + if (iContentType == TOmaDL10Download) + { + ReadDescriptorData(); + } + Resume(); + } + else + { + FLOG(_L("Space not available. Download is stopped!")); + TRAP_IGNORE(iFotaDlMgrClient->ShowDialogL(EFwDLNeedMoreMemory, size)); + } + + FLOG(_L("DownloadClient::Restart >>")); + + return EOk; + } + +// ----------------------------------------------------------------------------- +// The slot which receives all the single download events. +// ----------------------------------------------------------------------------- +bool DownloadClient::DownloadEventRecieved(DownloadEvent *event) + { + FLOG(_L("DownloadClient::event >>")); + + DownloadEvent::Event type = (DownloadEvent::Event) event->type(); + bool eventHandled = false; + int err0(NoError); + + FLOG(_L("Download Event Type: %d"), type); + + switch (type) + { + case DownloadEvent::Started: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::Started")); + iProgress = true; + iDlState = Download::Created; + + eventHandled = true; + break; + } + + case DownloadEvent::HeadersReceived: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::HeadersReceived")); + iProgress = true; + iDlState = Download::Created; + + QString contenttype = + GetDownloadAttribute(ContentType).toString(); + HBufC* s_contenttype = XQConversions::qStringToS60Desc(contenttype); + FLOG(_L("Content type received is %S"), s_contenttype); + delete s_contenttype; + + iContentType = CheckContentType(contenttype); + + if (iContentType == THttpDownload) + { + FLOG(_L("Content type: Http; checking the size of download")); + if (!iSpaceChecked) + { + + iTotalSize = GetDownloadAttribute(TotalSize).toInt(); + + FLOG(_L("Size of the firmware update as received is %d"), + iTotalSize); + + if (iTotalSize > 0) + { + QString path(NULL); + + TFreeSpace avail = iFotaDlMgrClient->GetSuitablePath( + iTotalSize, path); + + if (avail == EFitsToReservation || avail + == EFitsToFileSystem) + { + //FLOG(_L("Space is available for download at %S"),TPtrC (reinterpret_cast (path.constData()),path.length())); + iFotaDlMgrClient->DeleteDiskReservation(path); + iDownload->setAttribute(DestinationPath, path); + } + else + { + FLOG( + _L("Space not available. Download is stopped!")); + Pause(NeedMoreMemory); + TRAP_IGNORE(iFotaDlMgrClient->ShowDialogL(EFwDLNeedMoreMemory)); + break; + } + + iSpaceChecked = true; + iFotaDlMgrClient->StartDownloadProgress( + QString::null, QString::null, iTotalSize); + } + } + } + else if (iContentType == TUnknownType) + { + FLOG(_L("Content type unknown; hence cancelling download !")); + Cancel(InvalidContentType); + } + + eventHandled = true; + break; + } + + case DownloadEvent::InProgress: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::InProgress")); + + iProgress = true; + iDlState = Download::InProgress; + UpdateDownloadProgress(); + + eventHandled = true; + break; + } + + case DownloadEvent::Completed: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::Completed")); + iProgress = false; + iDlState = Download::Completed; + iTotalSize = 0; + UpdateDownloadProgress(); + + eventHandled = true; + break; + } + + case DownloadEvent::Paused: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::Paused")); + iProgress = false; + iDlState = Download::Paused; + + eventHandled = true; + break; + } + case DownloadEvent::Failed: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::Failed")); + iProgress = false; + iDlState = Download::Failed; + + eventHandled = true; + break; + } + case DownloadEvent::Cancelled: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::Cancelled")); + iProgress = false; + iDlState = Download::Cancelled; + + eventHandled = true; + break; + } + + case DownloadEvent::NetworkLoss: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::NetworkLoss")); + iProgress = false; + iDlState = Download::Paused; + + eventHandled = true; + break; + } + + case DownloadEvent::Error: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::Error")); + iProgress = false; + // iDlState = (Download::State) GetDownloadAttribute(State).toInt(); + iDlState = Download::Failed; + eventHandled = true; + break; + } + + case DownloadEvent::DescriptorReady: + { + FLOG(_L("DownloadEventRecieved - DownloadEvent::DescriptorReady")); + iProgress = true; + iDlState = Download::InProgress; + iContentType = TOmaDL10Download; + + iTotalSize = GetDownloadAttribute(DescriptorSize).toInt(); + QString path(NULL); + if (iTotalSize > 0) + { + + TFreeSpace avail = iFotaDlMgrClient->GetSuitablePath( + iTotalSize, path); + + if (avail == EFitsToReservation || avail == EFitsToFileSystem) + { + //FLOG(_L("Space is available for download at %S"), TPtrC (reinterpret_cast (path.constData()),path.length())); + iFotaDlMgrClient->DeleteDiskReservation(path); + } + else + { + FLOG(_L("Space not available. Download is stopped!")); + TRAP_IGNORE(iFotaDlMgrClient->ShowDialogL(EFwDLNeedMoreMemory)); + break; + } + } + ReadDescriptorData(); + Resume(); + SetSubDownloadAttributes(); + + eventHandled = true; + break; + } + case DownloadEvent::CreatingConnection: + { + FLOG( + _L("DownloadEventRecieved - DownloadEvent::CreatingConnection")); + iProgress = true; + iDlState = Download::InProgress; + + eventHandled = true; + break; + } + case DownloadEvent::ConnectionNeeded: + case DownloadEvent::ConnectionDisconnected: + { + FLOG( + _L("DownloadEventRecieved - DownloadEvent::ConnectionNeeded/ConnectionDisconnected")); + iProgress = false; + iDlState = Download::Paused; + err0 = ConnectionFailed; + eventHandled = true; + break; + } + + default: + { + FLOG(_L("DownloadEventRecieved - Skipped this event: %d"), type); + break; + } + } + + if (iProgress == false) + { + + if (iClientinterrupted) + { + //Client has requested for cancellation. Hence provide the same error code + err0 = iClientError; + HandleClientInterrupt(iDlState, err0); + } + else + { + //Download Manager has cancelled download. Hence provide the last error code. + if (err0 == NoError) + err0 = GetDownloadAttribute(LastError).toInt(); + + HandleDownloadComplete(iDlState, err0); + } + + } + + FLOG(_L("DownloadClient::event <<")); + + return eventHandled; + } + +// ----------------------------------------------------------------------------- +// Called to update the progress of download to fota server. This fetches the percentage +// of download from download manager. +// ----------------------------------------------------------------------------- +inline void DownloadClient::UpdateDownloadProgress() + { + FLOG(_L("DownloadClient::UpdateDownloadProgress >>")); + + // Remaining size calculation + int prog = GetDownloadAttribute(Percentage).toInt(); + iFotaDlMgrClient->UpdateDownloadProgress(prog); + + FLOG(_L("DownloadClient::UpdateDownloadProgress, progress = %d <<"), prog); + } + +// ----------------------------------------------------------------------------- +// Called to read the OMA DL1.0 download descriptor. This will update the fota server with size and version. +// ----------------------------------------------------------------------------- +void DownloadClient::ReadDescriptorData() + { + FLOG(_L("DownloadClient::ReadDescriptorData >>")); + + QString name = GetDownloadAttribute(DescriptorName).toString(); // "name" in OMA dd + QString version = GetDownloadAttribute(DescriptorVersion).toString(); // "version" in OMA dd + QString type = GetDownloadAttribute(DescriptorType).toString(); // "type" in OMA dd + int size = GetDownloadAttribute(DescriptorSize).toInt(); // "size" in OMA dd + QString vendor = GetDownloadAttribute(DescriptorVendor).toString(); // "vendor" in OMA dd + QString description = + GetDownloadAttribute(DescriptorDescription).toString(); // "description" in OMA dd + QString nxturl = GetDownloadAttribute(DescriptorNextURL).toString(); // "nextURL" in OMA dd + + TDownloadType gottype = CheckContentType(type); + + if (gottype == THttpDownload) + { + iFotaDlMgrClient->StartDownloadProgress(name, version, size); + } + else + { + FLOG( + _L("The content type in descriptor is not appropriate! Hence cancelling download")); + Cancel(InvalidContentType); + } + + FLOG(_L("DownloadClient::ReadDescriptorData <<")); + } + +// ----------------------------------------------------------------------------- +// Called when download is complete, either successfully or unsuccessfully. +// The arguments to this function is read to know the actual status. +// ----------------------------------------------------------------------------- +void DownloadClient::HandleDownloadComplete(Download::State dlstate, int err0) + { + FLOG(_L("DownloadClient::HandleDownloadComplete, idlstate = %d, err0 = %d>>"), dlstate, err0); + + iFotaDlMgrClient->HandleDownloadEvent(dlstate, err0); + + FLOG(_L("DownloadClient::HandleDownloadComplete <<")); + } + +// ----------------------------------------------------------------------------- +// Called to handle the post download interrupt operation when client cancels/pauses download. +// ----------------------------------------------------------------------------- +void DownloadClient::HandleClientInterrupt(Download::State dlstate, int err0) + { + FLOG(_L("DownloadClient::HandleClientInterrupt, idlstate = %d, err0 = %d >>"), dlstate, err0); + + iFotaDlMgrClient->HandleClientInterrupt(dlstate, err0); + + FLOG(_L("DownloadClient::HandleClientInterrupt <<")); + } + +// ----------------------------------------------------------------------------- +// Called to validate the content type of the download as received in header. +// ----------------------------------------------------------------------------- +TDownloadType DownloadClient::CheckContentType(const QString aContent) + { + FLOG(_L("DownloadClient::CheckContentType >>")); + + TDownloadType type(TUnknownType); + + QString semicollon(";"); + QString contenttype = aContent; + + int index = aContent.indexOf(semicollon, 0); + + if (index > 0) + { + contenttype.chop(aContent.length() - index); + } + + if (contenttype.compare(ContentTypeHttp) == 0) + type = THttpDownload; + else if (contenttype.compare(ContentTypeOmaDl) == 0) + type = TOmaDL10Download; + + FLOG(_L("DownloadClient::CheckContentType, type = %d<<"), type); + + return type; + } + +void DownloadClient::SetSubDownloadAttributes() + { + FLOG(_L("DownloadClient::SetSubDownloadAttributes >>")); + + QList dls = iDownload->subDownloads(); + + if (dls.count() > 0) + { + Download* subdl = dls[0]; + + subdl->setAttribute(FileName, PackageName); + } + else + { + FLOG(_L("Error: There are no sub downloads!")); + } + + FLOG(_L("DownloadClient::SetSubDownloadAttributes <<")); + } + +//End of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/FotaDlMgrClient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/FotaDlMgrClient.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,1128 @@ +/* + * Copyright (c) 2005 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: Fota download manager client + * + */ + +//System includes +#include +#include +#include +#include +#include +#include +#include +#include //For parsing uri +//User includes +#include "FotaDlMgrClient.h" +#include "FotaDlClient.h" +#include "FotaServer.h" +#include "fotanotifiers.h" + +// -------------------------------------------------------------------------- +// Two phase construction +// -------------------------------------------------------------------------- +DownloadManagerClient* DownloadManagerClient::NewL(CFotaServer* aServer) + { + DownloadManagerClient* self = new (ELeave) DownloadManagerClient(aServer); + self->ConstructL(); + return self; + } + +// -------------------------------------------------------------------------- +// The constructor +// -------------------------------------------------------------------------- +DownloadManagerClient::DownloadManagerClient(CFotaServer* aServer) : + iDownloadManager(NULL), iDownloadClient(NULL), iFotaServer(aServer), + iInitialized(EFalse), iDownloadSubmitted(EFalse), iReservedSize( + 5242880), iNotifParams(NULL), iNotifier (NULL) + { + + } + +// -------------------------------------------------------------------------- +// The destructor +// -------------------------------------------------------------------------- +DownloadManagerClient::~DownloadManagerClient() + { + FLOG(_L("DownloadManagerClient::~DownloadManagerClient >>")); + + if (iDownloadClient) + { + delete iDownloadClient; + iDownloadClient = NULL; + } + + UninitDownloadMgr(); //Closes the RFs session and iDownloadManager. + + iFs.Close(); + + /* + if (iNotifParams) + { + FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifParams >>")); + delete iNotifParams; + iNotifParams = NULL; + FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifParams <<")); + } + if (iNotifier) + { + FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifier >>")); + delete iNotifier; + iNotifier = NULL; + FLOG(_L("DownloadManagerClient::~DownloadManagerClient, iNotifier <<")); + }*/ + FLOG(_L("DownloadManagerClient::~DownloadManagerClient <<")); + } + +// -------------------------------------------------------------------------- +// Two phase construction +// -------------------------------------------------------------------------- +void DownloadManagerClient::ConstructL() + { + FLOG(_L("DownloadManagerClient::ConstructL >>")); + + TInt err; + CRepository* centrep(NULL); + + TRAP(err, centrep = CRepository::NewL( KCRUidFotaDiskStorage ) ); + if (centrep) + { + err = centrep->Get(KFotaDiskSpaceReservationKey, iReservedSize); + } + + delete centrep; + centrep = NULL; + + __LEAVE_IF_ERROR(iFs.Connect()); + + iProgress = EFalse; + + FLOG(_L("DownloadManagerClient::ConstructL, reservation needed is %d <<"),iReservedSize); + } + +// -------------------------------------------------------------------------- +// Initializes the download manager for fota requirements +// -------------------------------------------------------------------------- +int DownloadManagerClient::InitDownloadMgr() + { + FLOG(_L("DownloadManagerClient::InitDownloadMgr >>")); + + int ret = EOk; + + if (!iInitialized) + { + iDownloadManager = new DownloadManager("FotaServer"); //Step 0 + connect(iDownloadManager, + SIGNAL(downloadManagerEvent(DownloadManagerEvent *)), this, + SLOT(DownloadMgrEventRecieved(DownloadManagerEvent *))); //step 1 + //Scope as false signifies that the download should happen on fota process + bool scope = false; + ret = iDownloadManager->initialize(scope); //Step 2 + +#if defined(__WINS__) + iDownloadManager->setProxy("bswebproxy01.americas.nokia.com", 8080); //Step 3/ +#endif + //Set the progress mode of download to be non quite + ret = iDownloadManager->setAttribute(ProgressMode, NonQuiet); + //Set the persistent mode of download to be active. + ret = iDownloadManager->setAttribute(PersistantMode, Active); + //Set the default destination path for all the downloads + ret = iDownloadManager->setAttribute(DefaultDestinationPath, DefaultPath); + + if (iFotaServer->iPackageState.iIapId > 0) + { + QString name; + TRAPD(err, name = GetIapNameWithIdL(iFotaServer->iPackageState.iIapId)); + HBufC* temp = XQConversions::qStringToS60Desc(name); + FLOG(_L("IAP name for ID %d is %S, err = %d"), iFotaServer->iPackageState.iIapId, temp, err); + delete temp; +#if defined(__WINS__) + +#else + if (err == KErrNone) + { + FLOG(_L("Setting IAP =int for the single download"), iFotaServer->iPackageState.iIapId); + ret = iDownloadManager->setAttribute(AccessPoint, name); + } +#endif + } + + iInitialized = ETrue; + } + + FLOG(_L("DownloadManagerClient::InitDownloadMgr, ret = %d <<"), ret); + return ret; + } + +// -------------------------------------------------------------------------- +// Uninitializes the download manager +// -------------------------------------------------------------------------- +void DownloadManagerClient::UninitDownloadMgr() + { + FLOG(_L("DownloadManagerClient::UninitDownloadMgr >>")); + + if (iDownloadManager) + { + disconnect(iDownloadManager, + SIGNAL(downloadManagerEvent(DownloadManagerEvent *)), this, + SLOT(DownloadMgrEventRecieved(DownloadManagerEvent *))); + + iDownloadManager->deleteLater(); + iDownloadManager = NULL; + } + iInitialized = EFalse; + + FLOG(_L("DownloadManagerClient::UninitDownloadMgr <<")); + } + +// -------------------------------------------------------------------------- +// Gets the access point name for a given access point id. +// -------------------------------------------------------------------------- +QString DownloadManagerClient::GetIapNameWithIdL(TInt aIapId) + { + FLOG(_L("DownloadManagerClient::GetIapNameWithIdL, iapid = %d"), aIapId); + + QString name(NULL); + + RCmManager cmManager; + cmManager.OpenL(); + + RCmConnectionMethod conn; + conn = cmManager.ConnectionMethodL(aIapId); + + HBufC* temp = conn.GetStringAttributeL(CMManager::ECmName); + name = QString::fromUtf16(temp->Ptr(), temp->Length()); + delete temp; + temp = NULL; + + conn.Close(); + + cmManager.Close(); + FLOG(_L("DownloadManagerClient::GetIapNameWithIdL <<")); + return name; + } + +// -------------------------------------------------------------------------- +// Starts the download using a given url +// -------------------------------------------------------------------------- +void DownloadManagerClient::DownloadL(const TDesC8& url) + { + FLOG(_L("DownloadManagerClient::Download >>")); + + iDownloadSubmitted = EFalse; + iProgress = EFalse; + //Validate url... + + TUriParser8 parser; + + if (parser.Parse(url) && !parser.IsSchemeValid()) + { + FLOG(_L("URL is malformed.. finalizing download")); + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadFailed; + iFotaServer->iPackageState.iResult= RFotaEngineSession::EResMalformedOrBadURL; + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iDatabase->SetStateL(iFotaServer->iPackageState, KNullDesC8, EFDBState | EFDBResult); + iFotaServer->iDatabase->CloseAndCommitDB(); + + iFotaServer->FinalizeDownloadL(); + TRAP_IGNORE(ShowDialogL(EFwDLNonResumableFailure)); + return; + } + + FLOG(_L("DownloadManagerClient::DownloadL, State 2 - init download manager")); + InitDownloadMgr(); + + //Remove any existing download for this client + iDownloadManager->removeAll(); + + DeleteUpdatePackageL(); + + DownloadType type = Parallel; + + if (!iDownloadClient) + { + iDownloadClient = new DownloadClient(this); + } + + FLOG(_L("DownloadManagerClient::DownloadL, State 3 - creating download")); + + QString temp = QString::fromUtf8( + reinterpret_cast (url.Ptr()), url.Length()); + int err (0); + if ((err = iDownloadClient->CreateDownload(temp, type)) != 0) + { + FLOG(_L("Error in creating download"), err); + } + else if ((err = iDownloadClient->SetDownloadAttributes()) != 0) + { + FLOG(_L("Error in setting attributes for download: %d"), err); + } + else + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EStartingDownload; + iFotaServer->iPackageState.iResult = KErrNotFound; + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iDatabase->SetStateL(iFotaServer->iPackageState, KNullDesC8, EFDBState | EFDBResult); + iFotaServer->iDatabase->CloseAndCommitDB(); + iDownloadSubmitted = ETrue; + iFotaServer->SetStartupReason(EFotaDownloadInterrupted); + + iDownloadClient->Start(); + FLOG(_L("Download is submitted successfully")); + } + + if (err == ENotOk) + { + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadFailed; + iFotaServer->iPackageState.iResult = RFotaEngineSession::EResUndefinedError; + + iFotaServer->iDatabase->SetStateL(iFotaServer->iPackageState, KNullDesC8, EFDBState | EFDBResult); + iFotaServer->iDatabase->CloseAndCommitDB(); + + iFotaServer->FinalizeDownloadL(); + TRAP_IGNORE(ShowDialogL(EFwDLNonResumableFailure)); + } + + FLOG(_L("DownloadManagerClient::Download <<")); + } + +// -------------------------------------------------------------------------- +// Pauses an ongoing download. +// -------------------------------------------------------------------------- +void DownloadManagerClient::PauseDownloadL() + { + FLOG(_L("DownloadManagerClient::PauseDownloadL >>")); + + TInt ret(ENotOk); + + if (iDownloadClient) + { + ret = iDownloadClient->Pause(UserCancelled); + + __LEAVE_IF_ERROR(ret); + } + + FLOG(_L("DownloadManagerClient::PauseDownloadL <<")); + } + +// -------------------------------------------------------------------------- +// Tries to resume a suspended download +// -------------------------------------------------------------------------- +void DownloadManagerClient::TryResumeDownloadL() + { + FLOG(_L("DownloadManagerClient::TryResumeDownloadL >>")); + + TInt ret(ENotOk); + + FLOG(_L("DownloadManagerClient::TryResumeDownloadL, State 1 - init download manager")); + + __LEAVE_IF_ERROR(InitDownloadMgr()); + + iDownloadSubmitted = ETrue; + iProgress = EFalse; + + if (!iDownloadClient) + { + iDownloadClient = new DownloadClient(this); + } + + iFotaServer->SetStartupReason(EFotaDownloadInterrupted); + ret = iDownloadClient->Resume(); + + if (ret == ENotOk ) + { + if (iFotaServer->DecrementDownloadRestartCount()) + { + FLOG(_L("There is no paused download! Hence restarting download...")); + DownloadL(iFotaServer->iLastFwUrl); + } + else + { + FLOG(_L("There is no paused download! Restart exhausted and hence finalizing download...")); + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadFailed; + + if (iFotaServer->iPackageState.iResult == -1 ) + iFotaServer->iPackageState.iResult = RFotaEngineSession::EResUndefinedError; + + iDownloadSubmitted = EFalse; + iFotaServer->FinalizeDownloadL(); + TRAP_IGNORE(ShowDialogL(EFwDLNonResumableFailure)); + } + } + FLOG(_L("DownloadManagerClient::TryResumeDownloadL, ret = %d <<"), ret); + } + +// -------------------------------------------------------------------------- +// The slot which gets all the download manager events. +// -------------------------------------------------------------------------- +bool DownloadManagerClient::DownloadMgrEventRecieved( + DownloadManagerEvent *event) + { + FLOG(_L("DownloadManagerClient::event >>")); + + DownloadManagerEvent::Event type = (DownloadManagerEvent::Event) event->type(); + TBool ret(EFalse); + + FLOG(_L("Download Manager Event Type: %d"), type); + switch (type) + { + case DownloadManagerEvent::Created: + { + FLOG(_L("Download is created...")); + ret = ETrue; + break; + } + case DownloadManagerEvent::Removed: + { + FLOG(_L("Download is cleared...")); + ret = ETrue; + break; + } + } + + FLOG(_L("DownloadManagerClient::event, ret = %d <<"), ret); + return ret; + } + +// -------------------------------------------------------------------------- +// Called by the download client when the single download begins. +// -------------------------------------------------------------------------- +void DownloadManagerClient::StartDownloadProgress(QString name, + QString version, int size) + { + + HBufC8* temp1 = XQConversions::qStringToS60Desc8(name); + HBufC8* temp2 = XQConversions::qStringToS60Desc8(version); + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadProgressing; + iFotaServer->iPackageState.iPkgSize = size; + + if (temp1->Length() <= iFotaServer->iPackageState.iPkgName.MaxLength()) + iFotaServer->iPackageState.iPkgName.Copy(temp1->Des()); + + if (temp2->Length() <= iFotaServer->iPackageState.iPkgVersion.MaxLength()) + iFotaServer->iPackageState.iPkgVersion.Copy(temp2->Des()); + delete temp1; + delete temp2; + TRAP_IGNORE( + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iDatabase->SetStateL( iFotaServer->iPackageState, KNullDesC8, EFDBPkgName|EFDBVersion|EFDBPkgSize|EFDBState); + iFotaServer->iDatabase->CloseAndCommitDB(); + ); + + if (!iFotaServer->iPackageState.iSessionType) + { + iFotaServer->StartDownloadDialog(name, version, size); + iFotaServer->ConstructApplicationUI(ETrue); + } + } + +// -------------------------------------------------------------------------- +// Called by the download client to update the progress of download. +// -------------------------------------------------------------------------- +void DownloadManagerClient::UpdateDownloadProgress(int progress) + { + FLOG(_L("DownloadManagerClient::UpdateDownloadProgress, progress = %d >>"), + progress ); + + iProgress = ETrue; + + if (!iFotaServer->iPackageState.iSessionType) + { + iFotaServer->UpdateDownloadDialog(progress); + } + + FLOG(_L("DownloadManagerClient::UpdateDownloadProgress <<")); + + } + +// -------------------------------------------------------------------------- +// Called by the download client when the download is complete, either successfully or unsuccessfully. +// -------------------------------------------------------------------------- +void DownloadManagerClient::HandleDownloadEvent(Download::State dlstate, + int err0) + { + FLOG(_L("DownloadManagerClient::HandleDownloadEvent, status = %d >>"), dlstate); + + iDownloadSubmitted = EFalse; + iProgress = EFalse; + TInt notetype(-1); + + if (iDownloadClient) + { + delete iDownloadClient; + iDownloadClient = NULL; + } + + if (dlstate == Download::Completed) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadComplete; + iFotaServer->iPackageState.iResult = -1; + } + else if (dlstate == Download::Paused) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadProgressing; + + MapDownloadErrors(err0); + } + else if (dlstate == Download::Failed) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadFailed; + + MapDownloadErrors(err0); + + if(iFotaServer->iPackageState.iResult == RFotaEngineSession::EResDLFailDueToDeviceOOM + || iFotaServer->iPackageState.iResult == RFotaEngineSession::EResDLFailDueToNWIssues) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadProgressing; + } + } + else if (dlstate == Download::Cancelled) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadProgressing; + + MapDownloadErrors(err0); + } + else if (dlstate == Download::Paused) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadProgressing; + + MapDownloadErrors(err0); + } + else + { + FLOG(_L(" I DO NOT KNOW THIS DLSTATE!!")); + } + TRAPD(err, + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iDatabase->SetStateL( iFotaServer->iPackageState, KNullDesC8, EFDBState|EFDBResult); + iFotaServer->iDatabase->CloseAndCommitDB(); + ); + FLOG(_L("Updating fota database, error = %d"), err); + + UninitDownloadMgr(); + + if (iFotaServer->iPackageState.iState == RFotaEngineSession::EDownloadComplete + && iFotaServer->iPackageState.iUpdateLtr) + { + iFotaServer->SetStartupReason(EFotaUpdateInterrupted); + } + + if (iFotaServer->iPackageState.iResult + == RFotaEngineSession::EResDLFailDueToNWIssues) + { + notetype = EFwDLConnectionFailure; + } + else if (iFotaServer->iPackageState.iState == RFotaEngineSession::EDownloadProgressing && + iFotaServer->iPackageState.iResult == RFotaEngineSession::EResUndefinedError) + { + notetype = EFwDLGeneralFailure; + } + else if (iFotaServer->iPackageState.iResult == RFotaEngineSession::EResFailedSignatureAuthentication + || iFotaServer->iPackageState.iResult == RFotaEngineSession::EResMalformedOrBadURL + || iFotaServer->iPackageState.iResult == RFotaEngineSession::EResAlternateDLServerUnavailable + || iFotaServer->iPackageState.iResult == RFotaEngineSession::EResInvalidDownloadDescriptor + || iFotaServer->iPackageState.iResult == RFotaEngineSession::EResUndefinedError) + { + notetype = EFwDLNonResumableFailure; + } + + TRAP(err, iFotaServer->FinalizeDownloadL()); + + FLOG(_L("Finalized download, error = %d"), err); + + if (notetype != -1) + { + TRAP_IGNORE(ShowDialogL((TFwUpdNoteTypes) notetype)); + } + + FLOG(_L("DownloadManagerClient::HandleDownloadEvent <<")); + } + +// -------------------------------------------------------------------------- +// Called by the download client when download is interrupted by fota. +// -------------------------------------------------------------------------- +void DownloadManagerClient::HandleClientInterrupt(Download::State dlstate, + int err0) + { + FLOG(_L("DownloadManagerClient::HandleClientInterrupt, status = %d >>"), + dlstate); + + iDownloadSubmitted = EFalse; + iProgress = EFalse; + TInt notetype(-1); + + if (iDownloadClient) + { + delete iDownloadClient; + iDownloadClient = NULL; + } + + if (dlstate == Download::Cancelled || dlstate == Download::Failed) + { + if (err0 == UserCancelled) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadFailed; + iFotaServer->iPackageState.iResult = RFotaEngineSession::EResUserCancelled; + notetype = EFwDLNonResumableFailure; + } + else if (err0 == NeedMoreMemory) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadProgressing; + iFotaServer->iPackageState.iResult= RFotaEngineSession::EResUserCancelled; + } + else if (err0 == InvalidContentType) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadFailed; + iFotaServer->iPackageState.iResult= RFotaEngineSession::EResContentMisMatch; + notetype = EFwDLNonResumableFailure; + } + } + else if (dlstate == Download::Paused) + { + if (err0 == UserCancelled) + { + iFotaServer->iPackageState.iState = RFotaEngineSession::EDownloadProgressing; + iFotaServer->iPackageState.iResult= RFotaEngineSession::EResUserCancelled; + + iFotaServer->ServerCanShut(ETrue); + } + } + else + { + FLOG(_L(" I DO NOT KNOW THIS!!")); + } + TRAPD(err, + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iDatabase->SetStateL( iFotaServer->iPackageState, KNullDesC8, EFDBState|EFDBResult); + iFotaServer->iDatabase->CloseAndCommitDB(); + ); + FLOG(_L("Updating fota database, error = %d"), err); + + UninitDownloadMgr(); + + TRAP(err, iFotaServer->FinalizeDownloadL()); + + FLOG(_L("Finalizing download, error = %d"), err); + + if (notetype != -1) + { + TRAP_IGNORE(ShowDialogL((TFwUpdNoteTypes) notetype)); + } + + FLOG(_L("DownloadManagerClient::HandleClientInterrupt <<")); + } + +// -------------------------------------------------------------------------- +// Called to map the download error codes to fota result codes (FUMO result codes) +// -------------------------------------------------------------------------- +void DownloadManagerClient::MapDownloadErrors(int err0) + { + FLOG(_L("DownloadManagerClient::MapDownloadErrors, err = %d >>"), err0); + + if (err0 >= ConnectionRefusedError && err0 <= UnknownNetworkError) + { + //Connection related error + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResAlternateDLServerUnavailable; + } + else if (err0 == ContentNotFoundError) + { + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResAlternateDLServerUnavailable; + } + else if (err0 >= ContentAccessDenied && err0 <= UnknownContentError) + { + //Content related error + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResUndefinedError; + } + else if (err0 >= ProtocolUnknownError && err0 <= ProtocolFailure) + { + //Protocol related error + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResUndefinedError; + } + else if (err0 >= ConnectionFailed && err0 <= TransactionFailed) + { + //No network coverage + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResDLFailDueToNWIssues; + } + else if (err0 >= HttpRestartFailed && err0 <= ContentExpired) + { + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResUndefinedError; + } + else if (err0 == ObjectNotFound) + { + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResAlternateDLServerUnavailable; + } + else if (err0 == BadUrl) + { + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResMalformedOrBadURL; + } + else if (err0 == MediaRemoved) + { + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResDLFailDueToDeviceOOM; + } + else if (err0 == DiskFull) + { + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResDLFailDueToDeviceOOM; + } + else if (err0 == InvalidDownloadDescriptor) + { + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResInvalidDownloadDescriptor; + } + else + { + //Unknown failure reason + iFotaServer->iPackageState.iResult + = RFotaEngineSession::EResUndefinedError; + } + FLOG(_L("DownloadManagerClient::MapDownloadErrors, mapped fota failure reason = %d"), iFotaServer->iPackageState.iResult); + } + +// -------------------------------------------------------------------------- +// Tells whether any download is active or not. +// -------------------------------------------------------------------------- +TBool DownloadManagerClient::IsDownloadActive() + { + return (iDownloadSubmitted || iProgress); + } + +// -------------------------------------------------------------------------- +// Returns the download manager instance pointer +// -------------------------------------------------------------------------- +DownloadManager* DownloadManagerClient::Manager() + { + return iDownloadManager; + } + +// -------------------------------------------------------------------------- +// Finds the suitable drive and folder for a download, given its size. +// -------------------------------------------------------------------------- +TFreeSpace DownloadManagerClient::GetSuitablePath(TInt aSize, QString& aPath) + { + TFreeSpace isavailable; + TInt swupdSize(0); + TInt dummySize(0); + + SpaceAllocatedBySWUPDFiles(swupdSize, dummySize); + + if (aSize <= dummySize) + { + // fits to reservation + isavailable = EFitsToReservation; + } + else + { + // doesnt fit to reservation, does it fit to filesystem? + TInt sizeNeededFromFS = aSize - dummySize; + + if (sizeNeededFromFS < 0) + sizeNeededFromFS = 0; + TBool critical(ETrue); + TRAP_IGNORE(critical = SysUtil::FFSSpaceBelowCriticalLevelL( &iFs, sizeNeededFromFS )); + + if (critical) + { + // how much space would be needed + TVolumeInfo vi; + iFs.Volume(vi, EDriveC); + + TInt neededspace = sizeNeededFromFS - vi.iFree + + KSystemCriticalWorkingspace; + FLOG(_L("neededspace = %d vi.iFree = %d "), neededspace, vi.iFree); + FLOG(_L(" neededspace = sizeNeededFromFS - vi.iFree + KSystemCriticalWorkingspace;")); + + aSize = neededspace; + isavailable = EDoesntFitToFileSystem; + } + else + { + isavailable = EFitsToFileSystem; + } + + } + aPath = DefaultPath; + + FLOG(_L("DownloadManagerClient::IsPackageStoreSizeAvailableL, isavailable = %d <<"), isavailable); + + return isavailable; + } + +// --------------------------------------------------------------------------- +// DownloadManagerClient::GetUpdatePackageLocation +// Gets update package location, that is , path. +// --------------------------------------------------------------------------- +void DownloadManagerClient::GetUpdatePackageLocation(TDes& aPath) + { + FLOG(_L("DownloadManagerClient::GetUpdatePackageLocation >>")); + + TBuf temp; + temp.Zero(); + temp.Copy(KDefaultPath); + + aPath.Zero(); + + if (iFotaServer->iPackageState.iState == RFotaEngineSession::EDownloadProgressing + || iFotaServer->iPackageState.iState == RFotaEngineSession::EDownloadFailed) + temp.Append(KDownloadTempDir); + + TPtrC name(reinterpret_cast (PackageName.constData())); + + temp.Append(name); + + if (BaflUtils::FileExists(iFs, temp)) + aPath.Copy(temp); + + FLOG(_L("DownloadManagerClient::GetUpdatePackageLocation <<")); + } + +// -------------------------------------------------------------------------- +// Gets the download package size +// -------------------------------------------------------------------------- +TInt DownloadManagerClient::GetDownloadPackageSize() + { + FLOG(_L("DownloadManagerClient::GetDownloadPackageSize >>")); + + TInt size(0); + TBuf temp; + temp.Zero(); + temp.Copy(KDefaultPath); + + if (iFotaServer->iPackageState.iState + == RFotaEngineSession::EDownloadProgressing) + temp.Append(KDownloadTempDir); + + TPtrC name(reinterpret_cast (PackageName.constData())); + + temp.Append(name); + + TEntry entry; + if (iFs.Entry(temp, entry) == KErrNone) + size = entry.iSize; + + FLOG(_L("DownloadManagerClient::GetDownloadPackageSize, size = %d >>"), + size); + return size; + } + +// -------------------------------------------------------------------------- +// Gets the space allocated for the package and reserved memory +// -------------------------------------------------------------------------- +void DownloadManagerClient::SpaceAllocatedBySWUPDFiles(TInt& aSwupdSize, + TInt& aReservedSize) + { + // get sizes of swupd files + aSwupdSize = GetDownloadPackageSize(); + + // get size of reserved file + aReservedSize = 0; + TBuf temp; + temp.Zero(); + temp.Copy(KDefaultPath); + temp.Append(KReservedFileName); + + TEntry entry; + if (iFs.Entry(temp, entry) == KErrNone) + aReservedSize = entry.iSize; + + FLOG(_L("CFotaDiskStorage::SpaceAllocatedBySWUPDFilesL reserved:%d swupd:%d"), aReservedSize, aSwupdSize); + } + +// -------------------------------------------------------------------------- +// Creates the disk reservation +// -------------------------------------------------------------------------- +void DownloadManagerClient::CreateDiskReservation() + { + FLOG(_L("DownloadManagerClient::CreateDiskReservationL >>")); + + // Count size reserved by .swupd files + // CDir* list; + TInt err; + TInt swupdSize(0); + TInt dummySize(0); + RFile dummy; + + SpaceAllocatedBySWUPDFiles(swupdSize, dummySize); + + // Calculate space for dummy file + TInt targetsize = iReservedSize - swupdSize; + if (targetsize < 0) + { + targetsize = 0; + } + + // Reduce dummy file size + if (dummySize != targetsize || dummySize == 0) + { + FLOG(_L(" dummy new size %d (old %d)"), targetsize, dummySize); + + err = dummy.Open(iFs, KReservedFileName, EFileWrite + | EFileShareExclusive); + + if (err == KErrNotFound) + { + dummy.Replace(iFs, KReservedFileName, EFileWrite + | EFileShareExclusive); + } + + TInt err = KErrNone; + //Reservation logic - if 'x' bytes is not available, try x/2 to reserve. + //Trial would end if unable to save atleast 1MB. + + do { + FLOG(_L("Trying to reserve size: %d bytes..."), targetsize); + err = dummy.SetSize(targetsize); + if (err != KErrNoMemory) + break; + targetsize = targetsize / 2; + + if (targetsize < 1024 * 1024) //Don't reserver anything lesser than 1MB + break; + } + while (err == KErrNoMemory); + dummy.Close(); + + if (err == KErrNone) + { + FLOG(_L("Successfully created reservation of size: %d bytes"), + targetsize); + } + else + { + FLOG(_L("Error %d while creating reserved of size: %d bytes"), + err, targetsize); + } + } + + FLOG(_L("DownloadManagerClient::CreateDiskReservationL <<")); + } + +// -------------------------------------------------------------------------- +// Deletes the disk reservation in the specified path +// -------------------------------------------------------------------------- +void DownloadManagerClient::DeleteDiskReservation(QString& path) + { + FLOG(_L("DownloadManagerClient::DeleteDiskReservation >>")); + + RFile file; + TBuf temp; + temp.Zero(); + + TPtrC spath(reinterpret_cast (path.constData())); + temp.Copy(spath); + temp.Append(KReservedFileName); + + TInt err = file.Open(iFs, temp, EFileWrite | EFileShareExclusive); + + if (!err) + { + FLOG(_L("Removing the reserved memory as download has started"), + iReservedSize); + file.SetSize(KErrNone); + } + + file.Close(); + + FLOG(_L("DownloadManagerClient::DeleteDiskReservation <<")); + } + +// --------------------------------------------------------------------------- +// DownloadManagerClient::DeleteUpdatePackageL +// --------------------------------------------------------------------------- +void DownloadManagerClient::DeleteUpdatePackageL() + { + FLOG(_L("DownloadManagerClient::DeleteUpdatePackageL >>")); + + CDir* list; + + // get sizes of swupd files + TInt err = iFs.GetDir (KPackageExtensionAll, KEntryAttNormal ,ESortByName, list ); + if (err == KErrNone) + { + CleanupStack::PushL ( list ); + + for(int i=0; iCount() ;++i ) + { + TEntry t = (*list)[i]; + iFs.Delete(t.iName); + FLOG(_L("Deleted: %S"), &t.iName); + } + + CleanupStack::PopAndDestroy( list ); + } + + TBuf temp; + temp.Copy(KDefaultPath); + temp.Append(KDownloadTempDir); + temp.Append(KPackageExtensionAll); + + err = iFs.GetDir (temp, KEntryAttNormal ,ESortByName, list ); + + if (err == KErrNone) + { + CleanupStack::PushL ( list ); + TBuf temp; + + for(int i=0; iCount() ;++i ) + { + TEntry t = (*list)[i]; + temp.Copy(KDefaultPath); + temp.Append(KDownloadTempDir); + temp.Append(t.iName); + iFs.Delete(temp); + FLOG(_L("Deleted: %S"), &temp); + } + + CleanupStack::PopAndDestroy( list ); + } + + CreateDiskReservation(); + + FLOG(_L("DownloadManagerClient::DeleteUpdatePackageL<<")); + } + +// -------------------------------------------------------------------------- +// Called to show any update specific dialogs +// -------------------------------------------------------------------------- +void DownloadManagerClient::ShowDialogL(TFwUpdNoteTypes adialogid, + TInt aValue) + { + FLOG(_L("DownloadManagerClient::ShowDialog, dialogid = %d >>"), adialogid); + iFotaServer->ServerCanShut(EFalse); + if (iFotaServer->FullScreenDialog()) + iFotaServer->FullScreenDialog()->Close(); + + if (iFotaServer->iPackageState.iSessionType && adialogid + != EFwDLNeedMoreMemory) + { + FLOG(_L("Differing showing dialog as session is silent.")); + return; + } + + iNotifParams = CHbSymbianVariantMap::NewL(); + + HBufC* keyDialog = HBufC::NewL(10); + CleanupStack::PushL(keyDialog); + *keyDialog = KKeyDialog; + + HBufC* keyParam1 = HBufC::NewL(10); + CleanupStack::PushL(keyParam1); + *keyParam1 = KKeyParam1; + + HBufC* keyParam2 = HBufC::NewL(10); + CleanupStack::PushL(keyParam2); + *keyParam2 = KKeyParam2; + + HBufC* keyParam3 = HBufC::NewL(10); + CleanupStack::PushL(keyParam3); + *keyParam3 = KKeyParam3; + + //adialogid = EFwUpdResumeUpdate; + CHbSymbianVariant* dialogId = CHbSymbianVariant::NewL(&adialogid, + CHbSymbianVariant::EInt); + CleanupStack::PushL(dialogId); + iNotifParams->Add(*keyDialog, dialogId); + iNotifier = CFotaDownloadNotifHandler::NewL(this); + + switch (adialogid) + { + case EFwDLNeedMoreMemory: //For Flexible memory + { + //TFwUpdNoteTypes aType = EFwDLNeedMoreMemory; + CHbSymbianVariant* param1Val = CHbSymbianVariant::NewL(&aValue, + CHbSymbianVariant::EInt); + + iNotifParams->Add(*keyParam1, param1Val); + iNotifier->LaunchNotifierL(iNotifParams, adialogid); + } + break; + case EFwDLConnectionFailure: + { + iNotifier->LaunchNotifierL(iNotifParams, adialogid); + } + break; + case EFwDLGeneralFailure: + { + iNotifier->LaunchNotifierL(iNotifParams, adialogid); + } + break; + case EFwDLNonResumableFailure: + { + iNotifier->LaunchNotifierL(iNotifParams, adialogid); + } + break; + default: + { + + } + break; + } + CleanupStack::PopAndDestroy(5); + + FLOG(_L("DownloadManagerClient::ShowDialog <<")); + } + +// -------------------------------------------------------------------------- +// The call back when update specific dialog receives an user response +// -------------------------------------------------------------------------- +void DownloadManagerClient::HandleDialogResponse(int response, TInt aDialogId) + { + + FLOG(_L("DownloadManagerClient::HandleDialogResponse, response = %d, aDialogid = %d >>"), response, aDialogId); + //TInt dialogID; + //const CHbSymbianVariant* dialogId = iNotifParams->Get(KKeyDialog); + //dialogID = *(TFwUpdNoteTypes *)dialogId->Value(); + + switch (aDialogId) + { + case EFwDLNeedMoreMemory: //For Flexible memory + { + if (response == EHbLSK) //LSK + { + iDownloadClient->Restart(); + } + else //End key + { + iDownloadClient->Cancel(NeedMoreMemory); + } + } + break; + case EFwDLConnectionFailure: + case EFwDLGeneralFailure: + case EFwDLNonResumableFailure: + { + iFotaServer->ServerCanShut(ETrue); + } + break; + default: + { + iFotaServer->ServerCanShut(ETrue); + } + break; + } + + FLOG(_L("DownloadManagerClient::HandleDialogResponse <<\n")); + } + +//End of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/FotaNetworkRegStatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/FotaNetworkRegStatus.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,392 @@ +/* + * Copyright (c) 2005 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: GPRS and Wlan status getter for sending Generic Alerts + * + */ + +// INCLUDE FILES + +//System Includes +#include //GlobalRFsStates +#include //RConnectionMonitor +#include //Feature Manager +#include //Feature Manager +#include +#include +#include +#include + +//User Includes +#include "FotaServer.h" +#include "FotaNetworkRegStatus.h" + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::NewL +// Symbian 2-Phase construction, NewL used for creating object of this class +// This method can leave +// ----------------------------------------------------------------------------- + +CFotaNetworkRegStatus* CFotaNetworkRegStatus::NewL(CFotaServer* aObserver) + { + CFotaNetworkRegStatus* self = CFotaNetworkRegStatus::NewLC(aObserver); + CleanupStack::Pop(self); + return self; + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::NewLC +// Symbian 2-Phase construction, NewLC used for creating object of this class +// This method can leave +// ----------------------------------------------------------------------------- + +CFotaNetworkRegStatus* CFotaNetworkRegStatus::NewLC(CFotaServer* aObserver) + { + CFotaNetworkRegStatus* self = new (ELeave) CFotaNetworkRegStatus( + aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + + return self; + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::ConstructL +// Symbian 2-Phase construction, ConstructL used for constructing the members of this class +// This method can leave +// ----------------------------------------------------------------------------- + +void CFotaNetworkRegStatus::ConstructL() + { + iTimer.CreateLocal(); + iMonitor.ConnectL(); + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::CFotaNetworkRegStatus +// C++ Constructor +// This method shouldn't leave +// ----------------------------------------------------------------------------- + +CFotaNetworkRegStatus::CFotaNetworkRegStatus(CFotaServer* aObserver) : + CActive(CActive::EPriorityStandard), iObserver(aObserver), iRetriesLeft( + KRetries), iGlobalRFState(EFalse) + { + CActiveScheduler::Add(this); // Add AO to current active scheduler + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::~CFotaNetworkRegStatus +// C++ Desctructor +// This method shouldn't leave +// ----------------------------------------------------------------------------- + +CFotaNetworkRegStatus::~CFotaNetworkRegStatus() + { + Cancel(); + + iTimer.Close(); + iMonitor.Close(); + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::DoCancel() +// Cancels currently active notifier, if such exists +// ----------------------------------------------------------------------------- +// +void CFotaNetworkRegStatus::DoCancel() + { + FLOG(_L("CFotaNetworkRegStatus::DoCancel >>")); + + if (IsActive()) + { + iTimer.Cancel(); + // Cancel(); + } + + FLOG(_L("CFotaNetworkRegStatus::DoCancel <<")); + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::StartMonitoringL +// Monitors for connection status +// This method don't leave +// ----------------------------------------------------------------------------- + +void CFotaNetworkRegStatus::StartMonitoringL() + { + FLOG(_L("CFotaNetworkRegStatus::StartMonitoringL >>")); + + //Check offline state + FLOG(_L("Check GlobalRF state...")); + if (!iGlobalRFState) + { + iGlobalRFState = CheckGlobalRFState(); + } + + if (iGlobalRFState) + { + //Check registration state only if iGlobalRFState is true + FLOG(_L("Check registration state...")); + if (CheckNetworkRegStateL()) + { + //If both are successful report complete + FLOG( + _L("Network Registration is successful, sending Status as success to FotaServer")); + iObserver->ReportNetworkStatus(ETrue); + return; + } + } + //If one of them is not successful, start timer and retry KRetries times... + + if (--iRetriesLeft >= 0) + { + FLOG(_L("Retry count... [%d]"), KRetries - iRetriesLeft); + iTimer.After(iStatus, KTimeInterval); + if (!IsActive()) + SetActive(); + } + else + { + FLOG( + _L("Maximum retries (%d) reached, sending Status as failure to FotaServer"), + KRetries); + iObserver->ReportNetworkStatus(IsWlanSupportedL()); + } + + FLOG(_L("CFotaNetworkRegStatus::StartMonitoringL <<")); + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::RunL() +// Called when event accomplished +// ----------------------------------------------------------------------------- +// +void CFotaNetworkRegStatus::RunL() + { + FLOG(_L("CFotaNetworkRegStatus::RunL >>")); + + if (iStatus == KErrNone) + { + StartMonitoringL(); + } + else + { + iObserver->ReportNetworkStatus(EFalse); + } + + FLOG(_L("CFotaNetworkRegStatus::RunL <<")); + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::RunError +// Called when RunL leaves +// This method can't leave +// ----------------------------------------------------------------------------- + +TInt CFotaNetworkRegStatus::RunError(TInt aError) + { + FLOG(_L("CFotaNetworkRegStatus::RunL >>")); + iObserver->ReportNetworkStatus(EFalse); + FLOG(_L("CFotaNetworkRegStatus::RunL <<")); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::CheckGlobalRFState +// Checks for GlobalRFState, set by Starter +// This method can't leave +// ----------------------------------------------------------------------------- + +TBool CFotaNetworkRegStatus::CheckGlobalRFState() + { + FLOG(_L("CFotaNetworkRegStatus::CheckGlobalRFState >>")); + + RProperty prop; + TInt val = KErrNone; + TInt err = KErrNone; + TInt status = EFalse; + + err = prop.Get(KPSUidStartup, KPSGlobalSystemState, val); + if (err == KErrNone && val == ESwStateNormalRfOn) + { + //Phone is not offline. Check for Network Registration status + FLOG(_L("Phone is online. Check for Network Registration status")); + status = ETrue; + } + else + { + //Phone is offline. No Network activities allowed. + FLOG(_L("Phone is offline. No Network activities allowed.")); + status = EFalse; + } + FLOG(_L("CFotaNetworkRegStatus::CheckGlobalRFState, status = %d <<"), + status); + return status; + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::CheckNetworkRegStatusL +// Checks for Network registration status +// This method can leave +// ----------------------------------------------------------------------------- + +TBool CFotaNetworkRegStatus::CheckNetworkRegStateL() + { + FLOG(_L("CFotaNetworkRegStatus::CheckNetworkRegStateL >>")); + + TBool status = EFalse; + + TInt registrationStatus(KErrNone); + TRequestStatus status1; + iMonitor.GetIntAttribute(EBearerIdGSM, // See bearer ids from TConnMonBearerId + 0, KNetworkRegistration, registrationStatus, status1); + User::WaitForRequest(status1); + + if (status1.Int() == KErrNone) + { + switch (registrationStatus) + { + case ENetworkRegistrationHomeNetwork: + case ENetworkRegistrationRoaming: + { + status = ETrue; + break; + } + default: + { + /* Includes - ENetworkRegistrationNotAvailable: + ENetworkRegistrationUnknown: + ENetworkRegistrationNoService: + ENetworkRegistrationEmergencyOnly: + ENetworkRegistrationSearching: + ENetworkRegistrationBusy: + ENetworkRegistrationDenied:*/ + status = EFalse; + break; + } + } + } + + FLOG(_L("CFotaNetworkRegStatus::CheckNetworkRegStateL, status = %d <<"), + status); + return status; + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::IsWlanSupportedL +// Checks whether Wlan supported on device and active +// This method can leave +// ----------------------------------------------------------------------------- + +TBool CFotaNetworkRegStatus::IsWlanSupportedL() + { + FLOG(_L("CFotaNetworkRegStatus::IsWlanSupportedL >>")); + + TBool status = EFalse; + + FeatureManager::InitializeLibL(); + if (FeatureManager::FeatureSupported(KFeatureIdProtocolWlan)) // check for feature enabled + { + status = ETrue; + } + + FeatureManager::UnInitializeLib(); + +#if defined(__WINS__) + status = ETrue; +#endif + + FLOG(_L("CFotaNetworkRegStatus::IsWlanSupportedL, status = %d <<"), + status); + return status; + } + +// ----------------------------------------------------------------------------- +// CFotaNetworkRegStatus::IsConnectionPossibleL +// Checks whether the network connection is possible in the given IAP Id +// This method can leave +// ----------------------------------------------------------------------------- +/*TBool CFotaNetworkRegStatus::IsConnectionPossibleL(TInt aIapid) + { + FLOG(_L("CFotaNetworkRegStatus::IsConnectionPossibleL >>")); + TBool status(EFalse); + + TUint32 bearer = FindBearerL(aIapid); + if (bearer == KUidPacketDataBearerType) + { + FLOG(_L("Bearer is Packet data")); + if (CheckGlobalRFState() && CheckNetworkRegStateL()) + { + FLOG(_L("Network is up and connection is possible ")); + status = ETrue; + } + else + { + FLOG(_L("Network is not up and connection is not possible ")); + status = EFalse; + } + } + else if (bearer == KUidWlanBearerType)//for wlan or other bearers + { + FLOG(_L("Bearer is wlan and proceeding for download ")); + //proceed & this else loop to be removed + status = ETrue; + } + else + { + FLOG(_L("Bearer is not packet data or WLAN")); + } + + FLOG(_L("CFotaNetworkRegStatus::IsConnectionPossibleL, status = %d <<"), + status); + return status; + }*/ + +// ---------------------------------------------------------------------------------------- +// CFotaDownload::FindBearerId +// Finds the Bearer Id for a given IAP Id +// ---------------------------------------------------------------------------------------- +/*TUint32 CFotaNetworkRegStatus::FindBearerL(TInt aIapId) + { + FLOG(_L("CFotaNetworkRegStatus::FindBearerL: %d"), aIapId); + TUint32 bearer = 0; + TInt err(KErrNone); + // Query CM Id + TInt cmId(aIapId); + RCmManagerExt CmManagerExt; + TRAP( err, CmManagerExt.OpenL() ); + FLOG(_L("CmManagerExt.OpenL() with error as %d"), err); + if (err == KErrNone) + { + RCmConnectionMethodExt cm; + TRAP( err, cm = CmManagerExt.ConnectionMethodL( cmId ) ); + FLOG(_L("CmManagerExt.ConnectionMethodL with error as %d"), err); + if (err == KErrNone) + { + CleanupClosePushL(cm); + FLOG(_L("cm pushed to cleanupstack ")); + bearer = cm.GetIntAttributeL(CMManager::ECmBearerType); + FLOG(_L("bearer is %d "), bearer); + CleanupStack::PopAndDestroy(); // cm + FLOG(_L("cm poped & destroyed from cleanupstack ")); + } + + CmManagerExt.Close(); + FLOG(_L("CmManagerExt closed ")); + } + FLOG(_L("CFotaNetworkRegStatus::FindBearerL end with bearer: %d"), bearer); + return bearer; + }*/ + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/FotaServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/FotaServer.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,2705 @@ +/* + * Copyright (c) 2005 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: Fota server update and download functionality + * + */ +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "FotaServer.h" +#include "FotaSrvDebug.h" +#include "FotasrvSession.h" +#include "fotaConst.h" +#include "nsmldmtreedbclient.h" +#include "fotaserverPrivatePSKeys.h" +#include "FotaNetworkRegStatus.h" +#include "FotaDlMgrClient.h" +#include "fotadevicedialogobserver.h" +#include "fotanotifiers.h" +#include "fotaserverPrivatePSKeys.h" + +#define __LEAVE_IF_ERROR(x) if(KErrNone!=x) {FLOG(_L("LEAVE in %s: %d"), __FILE__, __LINE__); User::Leave(x); } + +TInt CFotaServer::iSessionCount = 0; + + +// ============================= LOCAL FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// GetPredefinedNodeL +// function to get preconfigured node for FUMO +// --------------------------------------------------------------------------- +void GetPredefinedNodeL(TDes8& aNode) + { + FLOG(_L("GetPredefinedNodeL() Begin")); + CRepository* centrep(NULL); + aNode.Zero(); + centrep = CRepository::NewLC(TUid::Uid(0x101F9A0A)); + + if (centrep) + { + FLOG(_L("centralrepository found End")); + TFullName temp; + + if (centrep->Get(KDevManFUMOPredefinedNodes, temp) == KErrNone + && temp.Length()) + { + temp.Trim(); + aNode.Copy(temp); + } + CleanupStack::PopAndDestroy(centrep); + } + FLOG(_L("GetPredefinedNodeL() End")); + } +// --------------------------------------------------------------------------- +// DeleteFUMOTreeL +// function to get preconfigured node for FUMO +// --------------------------------------------------------------------------- +void DeleteFUMOTreeL() + { + FLOG(_L("DeleteFUMOTreeL() Begin")); + const TUint32 KNSmlFotaAdapterUid = 0x101F9A09; + _LIT8( KNSmlFumoPath, "FUMO" ); + _LIT8( KNSmlFumoSeparator, "/" ); + const TInt KGranularity = 10; + TBuf8 temp; + GetPredefinedNodeL(temp); + RNSmlDMCallbackSession session; + __LEAVE_IF_ERROR(session.Connect()); + CleanupClosePushL(session); + + CBufBase *emptyList = CBufFlat::NewL(0); + CleanupStack::PushL(emptyList); + CArrayFixFlat* UriSegList; + UriSegList = new (ELeave) CArrayFixFlat (KGranularity); + + CleanupStack::PushL(UriSegList); + + session.GetUriSegListL(KNSmlFotaAdapterUid, KNSmlFumoPath, *UriSegList); + + for (TUint16 i = 0; i < UriSegList->Count(); i++) + { + if (temp.Length() && UriSegList->At(i).iURISeg.Find(temp) + != KErrNotFound) + { + FLOG(_L("DeleteFUMOTreeL predefined match =%S"), &temp); + continue; + } + + TBuf8 tempFumo; + tempFumo.Append(KNSmlFumoPath); + tempFumo.Append(KNSmlFumoSeparator); + tempFumo.Append(UriSegList->At(i).iURISeg); + FLOG(_L("DeleteFUMOTreeL() call update mapping info for node %S"), &tempFumo); + session.UpdateMappingInfoL(KNSmlFotaAdapterUid, tempFumo, *emptyList); + + } + // session.UpdateMappingInfoL(KNSmlFotaAdapterUid,KNSmlFumoPath,*emptyList); + CleanupStack::PopAndDestroy(UriSegList); + CleanupStack::PopAndDestroy(emptyList); + CleanupStack::PopAndDestroy(&session); //session + FLOG(_L("DeleteFUMOTreeL() End")); + } + +// ---------------------------------------------------------------------------------------- +// CFotaServer::NewInstance +// ---------------------------------------------------------------------------------------- +CFotaServer* CFotaServer::NewInstance(HbMainWindow& mainwindow) + { + FLOG(_L("CFotaServer::NewInstance >>")); + + CFotaServer* self = new CFotaServer(mainwindow); + + if (self) + { + TRAPD( err, self->ConstructL()); + + if (err != KErrNone) + { + delete self; self = NULL; + } + } + FLOG(_L("CFotaServer::NewInstance >>")); + return self; + } + +// ---------------------------------------------------------------------------------------- +// CFotaSrvSession::NewSessionL() +// ---------------------------------------------------------------------------------------- +CSession2* CFotaServer::NewSessionL(const TVersion&, const RMessage2&) const + { + iSessionCount++; + FLOG(_L("Number of active sessions = %d"), iSessionCount); + return new (ELeave) CFotaSrvSession(); + } + +void CFotaServer::ReportFwUpdateStatusL(TPackageState& aState) + { + FLOG(_L("CFotaServer::ReportFwUpdateStatusL >>")); + + TFotaClient requester = GetUpdateRequester(); + + if (requester == EDMHostServer) + { + FLOG(_L("Reporting status back to hostserver...")); + ServerCanShut(EFalse); + CreateDeviceManagementSessionL(aState); + } + else + { + //iServerCanShut = EFalse; Don't do here. Should be set in downloadmgrcli based on error type. + //ResetFotaStateL(aState.iPkgId); + SetStartupReason(EFotaDefault); + StopServerWhenPossible(); + FLOG(_L("Not reporting status as requester is unknown!")); + } + + FLOG(_L("CFotaServer::ReportFwUpdateStatusL >>")); + } + +void CFotaServer::StartDownloadDialog(const QString &aName, + const QString &aVersion, const TInt &aSize) + { + FLOG(_L("CFotaServer::StartDownloadDialog >>")); + //The dialog should not timeout here. + if (!iFullScreenDialog) + { + //ConstructApplicationUI(ETrue); + iFullScreenDialog = new FotaFullscreenDialog(this); + } + + iFullScreenDialog->SetSoftwareDetails(aSize, aVersion, aName); + + iFullScreenDialog->SetWarningDetails(EHbFotaDownload); + + TBool postpone = IsUserPostponeAllowed(); + if (!postpone) + { + FLOG(_L("Disabling option to resume later!")); + iFullScreenDialog->DisableRSK(ETrue); + } + + FLOG(_L("CFotaServer::StartDownloadDialog <<")); + } + +void CFotaServer::UpdateDownloadDialog(TInt aProgress) + { + FLOG(_L("CFotaServer::UpdateDownloadDialog >>")); + if (!iFullScreenDialog) + { + QString name = XQConversions::s60Desc8ToQString( + iPackageState.iPkgName); + QString version = XQConversions::s60Desc8ToQString( + iPackageState.iPkgVersion); + StartDownloadDialog(name, version, iPackageState.iPkgSize); + ConstructApplicationUI(ETrue); + } + + iFullScreenDialog->UpdateProgressBar(aProgress); + FLOG(_L("CFotaServer::UpdateDownloadDialog <<")); + } + +void CFotaServer::ShowDialogL(TFwUpdNoteTypes adialogid) + { + FLOG(_L("CFotaServer::ShowDialogL adialogid = %d<<"), adialogid); + + if (iNotifier) + { + FLOG(_L("Deleting the open device dialog!!")); + iNotifier->Cancel(); + } + + ServerCanShut(EFalse); + iDialogId = (TInt) adialogid; + + iNotifParams = CHbSymbianVariantMap::NewL(); + + HBufC* keyDialog = HBufC::NewL(10); + CleanupStack::PushL(keyDialog); + *keyDialog = KKeyDialog; + + HBufC* keyParam1 = HBufC::NewL(10); + CleanupStack::PushL(keyParam1); + *keyParam1 = KKeyParam1; + + HBufC* keyParam2 = HBufC::NewL(10); + CleanupStack::PushL(keyParam2); + *keyParam2 = KKeyParam2; + + HBufC* keyParam3 = HBufC::NewL(10); + CleanupStack::PushL(keyParam3); + *keyParam3 = KKeyParam3; + + HBufC* keyParam4 = HBufC::NewL(10); + CleanupStack::PushL(keyParam4); + *keyParam4 = KKeyParam4; + + CHbSymbianVariant* dialogId = CHbSymbianVariant::NewL(&adialogid, + CHbSymbianVariant::EInt); + CleanupStack::PushL(dialogId); + iNotifParams->Add(*keyDialog, dialogId); + + if (!iNotifier) + iNotifier = CFotaDownloadNotifHandler::NewL(this); + + switch (adialogid) + { + case EFwUpdNotEnoughBattery: + case EFwUpdDeviceBusy: + { + FLOG(_L("CFotaServer::EFwUpdNotEnoughBattery/EFwUpdDeviceBusy")); + iNotifier->LaunchNotifierL(iNotifParams, adialogid); + } + break; + case EFwUpdResumeUpdate: + case EFwUpdResumeDownload: + { + FLOG(_L("CFotaServer::EFwUpdResumeUpdate / EFwUpdResumeDownload")); + CHbSymbianVariant* param1Val = CHbSymbianVariant::NewL( + &iPackageState.iPkgSize, CHbSymbianVariant::EInt); + CleanupStack::PushL(param1Val); + iNotifParams->Add(*keyParam1, param1Val); + TBuf16 temp1; + temp1.Copy(iPackageState.iPkgVersion); + CHbSymbianVariant* param2Val = CHbSymbianVariant::NewL( + //&iPackageState.iPkgVersion, CHbSymbianVariant::EDes); + &temp1, CHbSymbianVariant::EDes); + CleanupStack::PushL(param2Val); + iNotifParams->Add(*keyParam2, param2Val); + TBuf16 temp2; + temp2.Copy(iPackageState.iPkgName); + CHbSymbianVariant* param3Val = CHbSymbianVariant::NewL( + &temp2, CHbSymbianVariant::EDes); + CleanupStack::PushL(param3Val); + iNotifParams->Add(*keyParam3, param3Val); + TBool postpone = IsUserPostponeAllowed(); + CHbSymbianVariant* param4Val = CHbSymbianVariant::NewL(&postpone, + CHbSymbianVariant::EInt); + CleanupStack::PushL(param4Val); + iNotifParams->Add(*keyParam4, param4Val); + iNotifier->LaunchNotifierL(iNotifParams, adialogid); + CleanupStack::PopAndDestroy(4); + + } + break; + + default: + { + FLOG(_L("CFotaServer::default")); + //Do nothing + } + break; + } + CleanupStack::PopAndDestroy(6); + FLOG(_L("CFotaServer::ShowDialogL >>")); + + } + +void CFotaServer::HandleDialogResponse(int response, TInt aDialogId) + { + FLOG( _L("CFotaServer::HandleDialogResponse, response = %d dialog = %d >>"), response, aDialogId); + + switch (aDialogId) + { + case EFwUpdNotEnoughBattery: + case EFwUpdDeviceBusy: + { + SetServerActive(EFalse); + + StopServerWhenPossible(); + } + break; + case EFwUpdResumeDownload: + { + if (response == EHbLSK) //Continue + { + FLOG(_L("User accepted to resume the download")); + + TRAP_IGNORE(CancelFmsL()); + TRAP_IGNORE(DownloaderL()->TryResumeDownloadL()); + } + else //Resume Later + { + FLOG(_L("User denied resuming the download")); + DecrementUserPostponeCount(); + SetServerActive(EFalse); + SetStartupReason(EFotaDownloadInterrupted); + + TRAP_IGNORE(InvokeFmsL()); + + StopServerWhenPossible(); + } + } + break; + case EFwUpdResumeUpdate: + { + if (response == EHbLSK) //Continue + { + FLOG(_L("User accepted to resume the update")); + iPackageState.iResult = KErrNotFound; + TRAPD(err, + iDatabase->OpenDBL(); + iDatabase->SetStateL( iPackageState ,KNullDesC8,EFDBResult ); + ); + FLOG(_L("Updating the fota database... err = %d"), err); + iDatabase->CloseAndCommitDB(); + + TRAP(err, iUpdater->StartUpdateL( iPackageState )); + FLOG(_L("Starting update, err = %d"), err); + } + else //Update Later + { + FLOG(_L("User denied resuming the update")); + iPackageState.iState = RFotaEngineSession::EStartingUpdate; + iPackageState.iResult = RFotaEngineSession::EResUserCancelled; + TRAPD(err, + iDatabase->OpenDBL(); + iDatabase->SetStateL( iPackageState ,KNullDesC8,EFDBState|EFDBResult ); + iDatabase->CloseAndCommitDB(); + ); + FLOG(_L("Updating the fota database... err = %d"), err); + + DecrementUserPostponeCount(); + SetServerActive(EFalse); + SetStartupReason(EFotaUpdateInterrupted); + + TRAP(err, InvokeFmsL()); + FLOG(_L("Invoking fms, err = %d"), err); + + StopServerWhenPossible(); + } + } + break; + default: + { + //Do nothing + } + break; + } + /* + if(iNotifParams) + { + delete iNotifParams; iNotifParams = NULL; + } + + if(iNotifier) + { + delete iNotifier; iNotifier = NULL; + }*/ + iDialogId = 0; + FLOG(_L("CFotaServer::HandleDialogResponse<<")); + } + +void CFotaServer::SetServerActive(TBool aValue) + { + FLOG(_L("CFotaServer::SetServerActive, aValue = %d"), aValue); + + TInt err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KFotaServerActive, + aValue); + FLOG(_L("RProperty SetServerActive Set %d, err = %d"), aValue, err); + + if (err == KErrNotFound) + { + err = RProperty::Define(TUid::Uid(KOmaDMAppUid), KFotaServerActive, + RProperty::EInt, KReadPolicy, KWritePolicy); + err = RProperty::Set(TUid::Uid(KOmaDMAppUid), KFotaServerActive, + aValue); + FLOG(_L("RProperty SetServerActive Set %d, err = %d"), aValue, + err); + } + + FLOG(_L("CFotaServer::SetServerActive <<")); + } + +void CFotaServer::ShowFullScreenDialog(TInt aType) + { + FLOG(_L("CFotaServer::ShowFullScreenDialog, type = %d >>"), aType); + + if (!iFullScreenDialog) + { + const QString ver = QString::fromUtf8( reinterpret_cast (iPackageState.iPkgVersion.Ptr()), iPackageState.iPkgVersion.Length()); + const QString name = QString::fromUtf8( reinterpret_cast (iPackageState.iPkgName.Ptr()), iPackageState.iPkgName.Length()); + iFullScreenDialog = new FotaFullscreenDialog(this); + + iFullScreenDialog->SetSoftwareDetails(iPackageState.iPkgSize, ver, name); + iFullScreenDialog->SetWarningDetails(EHbFotaDownload); + ConstructApplicationUI(ETrue); + } + + if (aType == EHbFotaUpdate) + { + iFullScreenDialog->UpdateProgressBar(100); + TBool postpone = IsUserPostponeAllowed(); + if (!postpone) + { + FLOG(_L("Disabling option to resume later!")); + iFullScreenDialog->DisableRSK(ETrue); + } + + iFullScreenDialog->ShowUpdateDialog(); + } + else if (aType == EHbFotaLowBattery) + { + iFullScreenDialog->UpdateProgressBar(100); + iFullScreenDialog->DisableRSK(EFalse); + iFullScreenDialog->SetWarningDetails(EHbFotaLowBattery); + } + + FLOG(_L("CFotaServer::ShowFullScreenDialog <<")); + } + +// -------------------------------------------------------------------------- +// CreateDeviceManagementSessionL +// Creates DM session +// -------------------------------------------------------------------------- +void CFotaServer::CreateDeviceManagementSessionL(TPackageState& aState) + { + FLOG( + _L("[cfotasever] CreateDeviceManagementSessionL dms >> profid %d\ + %d counts left ,sml handle %d, iNetworkAvailable=%d"), + aState.iProfileId, aState.iSmlTryCount, iSyncMLSession.Handle(), + iNetworkAvailable); + + SetStartupReason(EFotaPendingGenAlert); + + if (!iNetworkAvailable) + { + iRetryingGASend = ETrue; + iPackageState = aState; + StartNetworkMonitorL(); + } + else + { + + TBool dbAlreadyOpen = iDatabase->IsOpen(); + TBool triesLeft(EFalse); + + iNetworkAvailable = EFalse; // to check network again when GA is sent next time + + if (iSyncMLSession.Handle()) + { + __LEAVE_IF_ERROR( KErrAlreadyExists ); + } + + if (!dbAlreadyOpen) + iDatabase->OpenDBL(); + // There is still tries left + if (aState.iSmlTryCount > 0) + { + triesLeft = ETrue; + FLOG(_L(" decrementing the retry count")); + aState.iSmlTryCount = aState.iSmlTryCount - 1; + iDatabase->SetStateL(aState, KNullDesC8, EFDBSmlTryCount); + } + // out of tries, set state to idle + else + { + triesLeft = EFalse; + FLOG(_L(" out of tries, resetting pkg state")); + + SetStartupReason(EFotaDefault); + aState.iState = RFotaEngineSession::EIdle; + aState.iResult = KErrNotFound; + iDatabase->SetStateL(aState, KNullDesC8, EFDBState | EFDBResult); + } + if (!dbAlreadyOpen) + iDatabase->CloseAndCommitDB(); + + if (triesLeft) + { + + CRepository *cenrep = CRepository::NewL( + KCRUidDeviceManagementInternalKeys); + TInt x = cenrep->Set(KDevManClientInitiatedFwUpdateId, + iPackageState.iProfileId); + delete cenrep; + FLOG(_L("Status writing the cenrep for GA: %d"), x); + + iSyncMLSession.OpenL(); + + if (aState.iIapId <0) + aState.iIapId = 0; + + FLOG(_L("IAP set in the Fota profile %d is :%d"), + aState.iProfileId, aState.iIapId); + + FLOG(_L("From Db Using IAP: %d to send GA"), aState.iIapId); + + RSyncMLDevManJob dmJob; + TBuf<10> genalertap, temp; + genalertap.Zero(); + temp.Zero(); + genalertap.Append(KNSmlDMJobIapPrefix); + temp.Num(aState.iIapId);//Decimal Iap + if (temp.Length() <= KNSmlHalfTransportIdLength && aState.iIapId + > KErrNotFound && CheckIapExistsL(aState.iIapId)) + { + genalertap.AppendFill('0', KNSmlHalfTransportIdLength + - temp.Length()); + genalertap.Append(temp); + TLex gavalue(genalertap); + TInt temp2(0); + gavalue.Val(temp2); + dmJob.CreateL(iSyncMLSession, aState.iProfileId, temp2); + iSyncMLAttempts = KSyncmlAttemptCount; + } + else + { + iSyncMLAttempts = 0; + dmJob.CreateL(iSyncMLSession, aState.iProfileId); + } + + // If there's no iapid defined, sml will pop up connection dialog. + // In that case, only one connection attempt is allowed. + iSyncJobId = dmJob.Identifier(); + iSyncProfile = aState.iProfileId; + dmJob.Close(); + iSyncMLSession.RequestEventL(*this); + } + } + + FLOG(_L("[cfotasever] CreateDeviceManagementSessionL dms << profid %d"), aState.iProfileId); + } + +// ============================= MEMBER FUNCTIONS ============================ + +// -------------------------------------------------------------------------- +// CFotaServer::CFotaServer() +// -------------------------------------------------------------------------- +// +CFotaServer::CFotaServer(HbMainWindow& mainwindow) : + CServer2(EPriorityStandard, EUnsharableSessions) /*CServer2(0)*/, + iDatabase(0), iInitialized(EFalse), iDownloader(0), iUpdater(0), + iDownloadFinalizer(0), iUpdateFinalizer(0), iTimedExecuteResultFile(0), iTimedSMLSessionClose(0), + iAppShutter(0), iMonitor(NULL), iSyncMLAttempts(0), iSyncJobId(-1),iRetryingGASend(EFalse), + iNetworkAvailable(EFalse),iFullScreenDialog(NULL), iNotifParams(NULL), iNotifier(NULL), + iServerCanShut(EFalse), iAsyncOperation(EFalse),iDialogId (0), iConstructed(EFalse), iMainwindow(mainwindow) + { + RProcess pr; + TFullName fn = pr.FullName(); + TUint prid = pr.Id(); + FLOG(_L( "CFotaServer::CFotaServer process(id %d)%S. this 0x%x"), prid, + &fn, this); + + } + +// -------------------------------------------------------------------------- +// CFotaServer::DoExecuteResultFileL +// Interprets result of update (file update.resp) +// -------------------------------------------------------------------------- +// +void CFotaServer::DoExecuteResultFileL() + { + FLOG(_L("CFotaServer::DoExecuteResultFileL() >>")); + + if (iTimedExecuteResultFile) + { + iTimedExecuteResultFile->Cancel(); + delete iTimedExecuteResultFile; + iTimedExecuteResultFile = NULL; + } + iUpdater = CFotaUpdate::NewL(this); + iUpdater->ExecuteUpdateResultFileL(); + FLOG(_L("CFotaServer::DoExecuteResultFileL() <<")); + } + +// -------------------------------------------------------------------------- +// StaticDoExecuteResultFile +// -------------------------------------------------------------------------- +// +static TInt StaticDoExecuteResultFile(TAny *aPtr) + { + FLOG(_L("[cfotaserver] StaticDoExecuteResultFile() >>")); + __ASSERT_ALWAYS( aPtr, User::Panic(KFotaPanic, KErrBadHandle) ); + CFotaServer* srv = (CFotaServer*) aPtr; + TRAPD( err, srv->DoExecuteResultFileL() ); + if (err) + { + FLOG(_L("[cfotaserver] StaticDoExecuteResultFile ERROR %d"), err); + } + + FLOG(_L("[cfotaserver] StaticDoExecuteResultFile() <<")); + return err; + } + +// -------------------------------------------------------------------------- +// CFotaServer::CFotaServer() +// Constructor. Can't do all constructing since fotaserver might call itself +// recursively (via downloadmgr). +// -------------------------------------------------------------------------- +// +void CFotaServer::ConstructL() + { + FLOG(_L("CFotaServer::ConstructL() >>")); + TBool updated(EFalse); + TInt err; + iLastFwUrl.Zero(); + StartL(KFotaServerName); + + __LEAVE_IF_ERROR(iFs.Connect()); + + err = iFs.CreatePrivatePath(EDriveC); + if (err != KErrNone && err != KErrAlreadyExists) + { + __LEAVE_IF_ERROR(err); + } + __LEAVE_IF_ERROR(iFs.SetSessionToPrivate(EDriveC)); + + if (!iDatabase) + { + TRAPD( err,iDatabase = CFotaDB::NewL() ); + if (err) + { + FLOG(_L("CFotaServer:: DB creationg error %d"), err); + __LEAVE_IF_ERROR(err); + } + } + + updated = CFotaUpdate::CheckUpdateResults(iFs); + + // Update has happened, and result file is in place + if (updated) + { + FLOG(_L("scheduling update result file execution")); + ServerCanShut(EFalse); + + if (iTimedExecuteResultFile) + { + iTimedExecuteResultFile->Cancel(); + delete iTimedExecuteResultFile; + iTimedExecuteResultFile = NULL; + } + iTimedExecuteResultFile = CPeriodic::NewL(EPriorityNormal); + iTimedExecuteResultFile->Start(TTimeIntervalMicroSeconds32( + KDownloadFinalizerWaitTime), TTimeIntervalMicroSeconds32( + KDownloadFinalizerWaitTime), TCallBack( + StaticDoExecuteResultFile, this)); + } + + FLOG(_L("CFotaServer::ConstructL() <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::ClientAwareConstructL +// Does rest of constructing, if not done. If parent of this fotaserver +// instance is another fotaserver, skip maintenance operations (since parent +// takes care of them). DmHOstserver triggers cleanup for states: 20,70,80 +// ,90,100 , must handle state 60 here +// -------------------------------------------------------------------------- +void CFotaServer::ClientAwareConstructL(const RMessage2 &aMessage) + { + FLOG(_L("CFotaServer::ClientAwareConstructL >>")); + if (iInitialized) + return; + + ConstructApplicationUI(EFalse); + CreateDiskReservation(); + + TFotaClient client = CFotaSrvSession::CheckClientSecureIdL(aMessage); + + RArray states; + TPackageState state; + CleanupClosePushL(states); + iDatabase->OpenDBL(); + iDatabase->GetAllL(states); + TBool dlactive(EFalse); + + dlactive = DownloaderL()->IsDownloadActive(); + + FLOG(_L("Download active value is:%d "), (TInt) dlactive); + // Loop states. + for (TInt i = 0; i < states.Count(); ++i) + { + TPackageState tmp; + + tmp = iDatabase->GetStateL(states[i],iLastFwUrl); + FLOG(_L(" 1 got state id:%d state:%d result:%d"), tmp.iPkgId, + tmp.iState, tmp.iResult); + + //Download was started earlier and was interrupted. + if (tmp.iState == RFotaEngineSession::EStartingUpdate || tmp.iState + == RFotaEngineSession::EDownloadProgressing || tmp.iState + == RFotaEngineSession::EDownloadProgressing) + + { + TBool ispkgvalid = ETrue; + //Software version check from the time download started. + TRAPD(err1,ispkgvalid= CheckSWVersionL() ) + if (err1 == KErrNone && !ispkgvalid) + { + FLOG(_L("Mismatch in software version since the download started! Hence resetting!")); + + DownloaderL()->DeleteUpdatePackageL(); + + tmp.iState = RFotaEngineSession::EUpdateFailed; + tmp.iResult = RFotaEngineSession::EResPackageMismatch; + iDatabase->SetStateL(tmp, KNullDesC8, EFDBState | EFDBResult); + + } + + } + // Update has been started (60) + // If there is no result file, means that update agent failed + // to run. Must get back to 50 to allow user to try again. + if (tmp.iState == RFotaEngineSession::EUpdateProgressing + && iTimedExecuteResultFile == NULL) + { + FLOG(_L(" State EUpdateProgressing found, UA didnt run! id %d "), tmp.iPkgId); + + tmp.iState = RFotaEngineSession::EStartingUpdate; + iDatabase->SetStateL(tmp, KNullDesC8, EFDBState); + } + + // These states need must trigger generic alert! (70+ ) + if (tmp.iState >= RFotaEngineSession::EUpdateFailed && client != EDMHostServer) + { + if (iSyncMLSession.Handle() == NULL) + { + iDatabase->CloseAndCommitDB(); + ReportFwUpdateStatusL(tmp); + iDatabase->OpenDBL(); + } + } + + if (tmp.iState == RFotaEngineSession::EDownloadComplete + && tmp.iResult == RFotaEngineSession::EResSuccessful && client != EDMHostServer) + { + ReportFwUpdateStatusL(tmp); + } + + if (dlactive == EFalse) //if download is not active, EStartingDownload should be reset to EDownloadFailed + { + if (tmp.iState == RFotaEngineSession::EStartingDownload) + { + FLOG(_L("Resetting state %d to 20..."), tmp.iState); + tmp.iState = RFotaEngineSession::EDownloadFailed; + iDatabase->SetStateL(tmp, KNullDesC8, EFDBState); + iDatabase->CloseAndCommitDB(); + iDatabase->OpenDBL(); + } + else if (tmp.iState == RFotaEngineSession::EStartingDownload) + { + FLOG(_L("Resetting state %d to 30..."), tmp.iState); + tmp.iState = RFotaEngineSession::EDownloadProgressing; + iDatabase->SetStateL(tmp, KNullDesC8, EFDBState); + iDatabase->CloseAndCommitDB(); + iDatabase->OpenDBL(); + } + } + if (tmp.iState == RFotaEngineSession::EDownloadProgressing) + { + FLOG(_L("Firmware update state is EDownloadProgressing")); + //FMS will start fota server when it is appropriate to resume download. + } + else if (tmp.iState == RFotaEngineSession::EStartingUpdate) + { + FLOG(_L("Firmware update state is EStartingUpdate")); + //FMS will start fota server when it is appropriate to start install. + } + if (tmp.iState == RFotaEngineSession::EDownloadFailed && client != EDMHostServer) + { + FLOG(_L("Resetting state %d to 20..."), tmp.iState); + DownloaderL()->DeleteUpdatePackageL(); + tmp.iResult = RFotaEngineSession::EResDLFailDueToNWIssues; + iDatabase->SetStateL(tmp, KNullDesC8, EFDBResult); + iDatabase->CloseAndCommitDB(); + ReportFwUpdateStatusL(tmp); + iDatabase->OpenDBL(); + } + + } + iDatabase->CloseAndCommitDB(); + CleanupStack::PopAndDestroy(&states); + + iInitialized = ETrue; + FLOG(_L("CFotaServer::ClientAwareConstructL <<")); + } + +// -------------------------------------------------------------------------- +// StaticDoFinalizeDownload +// Intermediate function +// -------------------------------------------------------------------------- +static TInt StaticDoFinalizeDownload(TAny *aPtr) + { + FLOG(_L("[cfotaserver] StaticDoFinalizeDownload() >>")); + CFotaServer* srv = (CFotaServer*) aPtr; + TRAPD( err, srv->DoFinalizeDownloadL() ); + if (err) + { + FLOG(_L("[cfotaserver] StaticDoFinalizeDownload ERROR %d"), err); + } + + FLOG(_L("[cfotaserver] StaticDoFinalizeDownload() <<")); + return err; + } + +// -------------------------------------------------------------------------- +// CFotaServer::FinalizeDownload +// Initialize finalization of download +// -------------------------------------------------------------------------- +// +void CFotaServer::FinalizeDownloadL() + { + FLOG(_L("CFotaServer::FinalizeDownload() >> state:%d result:%d"), + iPackageState.iState, iPackageState.iResult); + __ASSERT_ALWAYS( iDownloader, User::Panic(KFotaPanic, KErrBadHandle )); + + if (iDownloadFinalizer) + { + iDownloadFinalizer->Cancel(); + delete iDownloadFinalizer; + iDownloadFinalizer = NULL; + } + iDownloadFinalizer = CPeriodic::NewL(EPriorityMuchMore); + + // Not restarting,quick finalize + iDownloadFinalizer->Start(TTimeIntervalMicroSeconds32( + KDownloadFinalizerWaitTime), TTimeIntervalMicroSeconds32( + KDownloadFinalizerWaitTime), TCallBack(StaticDoFinalizeDownload, + this)); + FLOG(_L("CFotaServer::FinalizeDownload() <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::DoFinalizeDownloadL +// Finalize download. Free resources +// -------------------------------------------------------------------------- +// +void CFotaServer::DoFinalizeDownloadL() + { + + FLOG(_L("CFotaServer::DoFinalizeDownloadL() >> state:%d result:%d"), + iPackageState.iState, iPackageState.iResult); + __ASSERT_ALWAYS( iDownloader, User::Panic(KFotaPanic, KErrBadHandle )); + + + if (iDownloadFinalizer) + { + iDownloadFinalizer->Cancel(); + delete iDownloadFinalizer; + iDownloadFinalizer = NULL; + } + + // Set downloader's ending state to DB + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, KNullDesC8, EFDBState | EFDBResult); + iDatabase->CloseAndCommitDB(); + + if (iPackageState.iResult != RFotaEngineSession::EResDLFailDueToDeviceOOM) + { + FLOG(_L("Adjusting the reserved memory...")); + DownloaderL()->CreateDiskReservation(); + } + + // Initiate update + if (iPackageState.iState == RFotaEngineSession::EDownloadComplete + && iPackageState.iUpdateLtr) + { + TRAP_IGNORE(TryUpdateL(EOMADMAppUi)); + + } + else if (iPackageState.iState == RFotaEngineSession::EDownloadProgressing) + { + FLOG(_L("Download has paused due to an error. Invoking FMS...")); + if (iFullScreenDialog) + { + iFullScreenDialog->Close(); + iFullScreenDialog->deleteLater(); + iFullScreenDialog = NULL; + } + SetStartupReason(EFotaDownloadInterrupted); + InvokeFmsL(); + StopServerWhenPossible(); + SetServerActive(EFalse); + iAsyncOperation = EFalse; + } + else + { + if (iFullScreenDialog) + { + iFullScreenDialog->Close(); + iFullScreenDialog->deleteLater(); + iFullScreenDialog = NULL; + } + ConstructApplicationUI(EFalse); + ReportFwUpdateStatusL(iPackageState); + SetServerActive(EFalse); + iAsyncOperation = EFalse; + } + + FLOG(_L("CFotaServer::DoFinalizeDownloadL() <<")); + } + +// -------------------------------------------------------------------------- +// StaticDoCloseSMLSession +// Intermediate function +// -------------------------------------------------------------------------- +static TInt StaticDoCloseSMLSession(TAny *aPtr) + { + FLOG(_L("[cfotaserver] StaticDoCloseSMLSession() >>")); + CFotaServer* srv = (CFotaServer*) aPtr; + TRAPD( err, srv->DoCloseSMLSessionL() ); + if (err) + { + FLOG(_L("[cfotaserver] StaticDoCloseSMLSession ERROR %d"), err); + } + + FLOG(_L("[cfotaserver] StaticDoCloseSMLSession() <<")); + return err; + } + +// -------------------------------------------------------------------------- +// CFotaServer::DoCloseSMLSessionL +// Close syncml session, or resync +// -------------------------------------------------------------------------- +// +void CFotaServer::DoCloseSMLSessionL() + { + FLOG(_L("CFotaServer::DoCloseSMLSessionL() >>")); + + // Must still try to sync + if (iSyncMLAttempts > 0) + { + FLOG(_L(" trycount %d => creating new job"), iSyncMLAttempts); + RSyncMLDevManJob dmJob; + if (iPackageState.iIapId > KErrNotFound) + { + FLOG(_L("DoCloseSMLSessionL new job uses iap from fotadb %d"), + iPackageState.iIapId); + dmJob.CreateL(iSyncMLSession, iSyncProfile, iPackageState.iIapId); + } + else + { + FLOG(_L("DoCloseSMLSessionL new job uses iap from profile")); + dmJob.CreateL(iSyncMLSession, iSyncProfile); + } + iSyncMLAttempts--; + iSyncJobId = dmJob.Identifier(); + dmJob.Close(); + } + else + // We ran out of attempts, close sml + { + if (iSyncMLSession.Handle()) + { + FLOG(_L(" Closing syncml session")); + iSyncMLSession.CancelEvent(); + iSyncMLSession.Close(); + } + } + + if (iTimedSMLSessionClose) + { + FLOG(_L(" closing smlsession timer")); + iTimedSMLSessionClose->Cancel(); + delete iTimedSMLSessionClose; + iTimedSMLSessionClose = NULL; + } + + FLOG(_L("CFotaServer::DoCloseSMLSessionL() <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::TryResumeDownloadL +// Tries to resume the download operation +// -------------------------------------------------------------------------- +// +void CFotaServer::TryResumeDownloadL(TFotaClient aClient, TBool aSilentDl) + { + FLOG(_L("CFotaServer::TryResumeDownloadL, client = %d aSilent = %d >>"), + (TInt) aClient, aSilentDl); + //Check whether there is a paused resume actually. + iAsyncOperation = ETrue; + SetServerActive(ETrue); + WakeupServer(); + + if (DownloaderL()->IsDownloadActive()) + { + FLOG(_L("Another download is already active, hence returning...")); + __LEAVE_IF_ERROR (KErrAlreadyExists); + } + + if (iPackageState.iPkgId == KErrNotFound) + iPackageState = GetStateL(-1); //Gets the state of the current/last fota download + + FLOG(_L("Session type is =%d "), iPackageState.iSessionType); + + if (iPackageState.iState != RFotaEngineSession::EDownloadProgressing) + { + FLOG(_L("There are no paused downloads currently; hence leaving with KErrNotFound...")); + SetServerActive(EFalse); + __LEAVE_IF_ERROR (KErrNotFound); + } + + //Resume download now + + iPackageState.iSessionType = aSilentDl; + + if (aSilentDl && iPackageState.iResult + == RFotaEngineSession::EResUserCancelled) + { + //If user has paused download earlier, then resume should be non-silent. + FLOG(_L("Converting to non-silent download as user had paused it earlier!")); + iPackageState.iSessionType = EFalse; + } + + TRAP_IGNORE(SetIapToUseL()); + FLOG(_L("Using IAP = %d for the download"), iPackageState.iIapId); + + FLOG(_L("Session type = %d"), iPackageState.iSessionType); + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, KNullDesC8, EFDBIapId||EFDBSessionType); + iDatabase->CloseAndCommitDB(); + + if (iPackageState.iSessionType || aClient == EOMADMAppUi) + { + ConstructApplicationUI(EFalse); + DownloaderL()->TryResumeDownloadL(); + } + else + { + ShowDialogL(EFwUpdResumeDownload); + } + + FLOG(_L("CFotaServer::TryResumeDownloadL <<")); + } + +void CFotaServer::PauseDownloadL() + { + + if (DownloaderL()->IsDownloadActive()) + { + DownloaderL()->PauseDownloadL(); + } + else + { + FLOG(_L("No download is active. Hence leaving with KErrNotFound")); + __LEAVE_IF_ERROR(KErrNotFound); + } + } +// -------------------------------------------------------------------------- +// CFotaServer::InvokeFmsL +// Starts Fota Monitory Service with relevant parameters for monitoring. +// -------------------------------------------------------------------------- +// +void CFotaServer::InvokeFmsL() + { + FLOG(_L("CFotaServer::InvokeFmsL >>")); + //Collect all information needed to invoke FMS. + CancelFmsL(); + + FLOG(_L("State as recorded in fota db:")); + FLOG(_L("iPkgId = %d"), iPackageState.iPkgId); + FLOG(_L("iProfileId = %d"), iPackageState.iProfileId); + FLOG(_L("iPkgName = %S"), &iPackageState.iPkgName); + FLOG(_L("iPkgVersion = %S"), &iPackageState.iPkgVersion); + FLOG(_L("iSendAlert = %d"), iPackageState.iSendAlert); + FLOG(_L("iIapId = %d"), iPackageState.iIapId); + FLOG(_L("iPkgSize = %d"), iPackageState.iPkgSize); + FLOG(_L("iSessionType = %d"), iPackageState.iSessionType); + FLOG(_L("iState = %d"), iPackageState.iState); + FLOG(_L("iResult = %d"), iPackageState.iResult); + + if (iPackageState.iState == RFotaEngineSession::EDownloadProgressing) + { + //Finding the reason for download interrupt + TFmsIpcCommands reason(EDLGeneralInterrupt); // 13 + + switch (iPackageState.iResult) + { + case RFotaEngineSession::EResUserCancelled: + { + reason = EDLUserInterrupt; //10 + break; + } + case RFotaEngineSession::EResDLFailDueToNWIssues: + { + reason = EDLNetworkInterrupt; //11 + break; + } + case RFotaEngineSession::EResDLFailDueToDeviceOOM: + { + reason = EDLMemoryInterrupt; //12 + break; + } + default: + { + //reason is already EGeneralInterrupt + break; + } + } + + //Finding the drive number + TBuf path; + path.Zero(); + DownloaderL()->GetUpdatePackageLocation(path); + + TInt drive(EDriveC); //Default drive is Phone Memory + TParse p; + if (path.Length() && !p.Set(path, NULL, NULL)) + { + TDriveName drivename(p.Drive()); + TDriveUnit driveunit(drivename); + if (iFs.IsValidDrive((TInt) driveunit)) //some crash here + drive = driveunit; + } + else + { + FLOG(_L("Error while parsing for drive number! defaulting to Phone Memory (C)")); + } + + TInt dlsize = DownloaderL()->GetDownloadPackageSize(); + + TInt neededsize = iPackageState.iPkgSize - dlsize; + + if (neededsize < 0) + neededsize = 0; + + FLOG(_L("Launching FMS with params... reason = %d, iapid = %d, drive = %d, neededsize = %d"), + reason, iPackageState.iIapId, drive, neededsize); + iFMSClient.OpenL(); + iFMSClient.NotifyForResumeL(reason, iPackageState.iIapId, + (TDriveNumber) drive, neededsize); + iFMSClient.Close(); + } + else if (iPackageState.iState == RFotaEngineSession::EStartingUpdate) + { + //Finding the reason for update interrupt + TFmsIpcCommands reason(ENoInterrupt); + + switch (iPackageState.iResult) + { + case RFotaEngineSession::EResUserCancelled: + { + reason = EDLUserInterrupt; + } + break; + case RFotaEngineSession::EResLowBattery: + { + reason = EUpdMonitorbattery; + } + default: + { + break; + } + } + FLOG(_L("Launching FMS with params... reason = %d, iapid = %d"), reason, iPackageState.iIapId); + iFMSClient.OpenL(); + iFMSClient.NotifyForUpdateL(reason); + iFMSClient.Close(); + + } + FLOG(_L("CFotaServer::InvokeFmsL <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::CancelFmsL +// Cancels any outstanding monitoring requests in Fota Monitory Service +// -------------------------------------------------------------------------- +// +void CFotaServer::CancelFmsL() + { + FLOG(_L("CFotaServer::CancelFmsL >>")); + + iFMSClient.OpenL(); + iFMSClient.Cancel(); + iFMSClient.Close(); + + FLOG(_L("CFotaServer::CancelFmsL <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::SetStartupReason +// Sets the startup reason for Fota. This is used in Fota Startup pluggin. +// -------------------------------------------------------------------------- +// +void CFotaServer::SetStartupReason(TInt aReason) + { + FLOG(_L("CFotaServer::SetStartupReason, aReason = %d >>"), aReason); + + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if (err == KErrNone) + { + err = centrep->Set(KFotaUpdateState, aReason); + } + delete centrep; + centrep = NULL; + + FLOG(_L("CFotaServer::SetStartupReason, err = %d <<"), err); + } + +void CFotaServer::SetUpdateRequester(TFotaClient aRequester) + { + FLOG(_L("CFotaServer::SetUpdateRequester, requester = %d >>"), + aRequester); + + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ) + if (err == KErrNone) + { + err = centrep->Set(KUpdateRequesterUid, (TInt) aRequester); + } + delete centrep; + centrep = NULL; + + FLOG(_L("CFotaServer::SetUpdateRequester, err = %d <<"), err); + } + +TFotaClient CFotaServer::GetUpdateRequester() + { + FLOG(_L("CFotaServer::GetUpdateRequester >>")); + + TInt ret(EUnknown); + + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if (err == KErrNone) + { + err = centrep->Get(KUpdateRequesterUid, ret); + } + delete centrep; + centrep = NULL; + + FLOG(_L("CFotaServer::GetUpdateRequester, requester = %d, err = %d <<"), + ret, err); + + return (TFotaClient) ret; + } + +// -------------------------------------------------------------------------- +// CFotaServer::~CFotaServer() +// Frees database, download, chunk, filewriter, etc resources +// -------------------------------------------------------------------------- +// +CFotaServer::~CFotaServer() + { + FLOG(_L("CFotaServer::~CFotaServer >>")); + + if (iDatabase) + { + iDatabase->CloseAndCommitDB(); + delete iDatabase; + iDatabase = NULL; + } + + if (iUpdater) + { + delete iUpdater; + iUpdater = NULL; + } + + if (iDownloadFinalizer) + { + iDownloadFinalizer->Cancel(); + delete iDownloadFinalizer; + iDownloadFinalizer = NULL; + } + + if (iUpdateFinalizer) + { + iUpdateFinalizer->Cancel(); + delete iUpdateFinalizer; + iUpdateFinalizer = NULL; + } + + if (iTimedExecuteResultFile) + { + iTimedExecuteResultFile->Cancel(); + delete iTimedExecuteResultFile; + iTimedExecuteResultFile = NULL; + } + + if (iTimedSMLSessionClose) + { + iTimedSMLSessionClose->Cancel(); + delete iTimedSMLSessionClose; + iTimedSMLSessionClose = NULL; + } + + if (iFs.Handle()) + iFs.Close(); + + if (iSyncMLSession.Handle()) + iSyncMLSession.Close(); + + if (iMonitor) + { + delete iMonitor; + iMonitor = NULL; + } + + if (iFMSClient.Handle()) + iFMSClient.Close(); + + if (iDownloader) + { + delete iDownloader; + iDownloader = NULL; + } + + if (iFullScreenDialog) + { + iFullScreenDialog->deleteLater(); + } + + /* + if (iNotifParams) + { + delete iNotifParams; + iNotifParams = NULL; + } + + if (iNotifier) + { + delete iNotifier; + iNotifier = NULL; + }*/ + + FLOG(_L("CFotaServer::~CFotaServer <<")); + } + +// --------------------------------------------------------------------------- +// CFotaServer::DeletePackageL +// Deletes update package from db +// --------------------------------------------------------------------------- +void CFotaServer::DeletePackageL(const TInt aPkgId) + { + FLOG(_L("CFotaServer::DeletePackageL >> id %d"), aPkgId); + + DownloaderL()->DeleteUpdatePackageL(); + + FLOG(_L("CFotaServer::DeletePackageL <<")); + } + +// --------------------------------------------------------------------------- +// CFotaServer::DownloadL +// Create package downloader and download update package. +// --------------------------------------------------------------------------- +void CFotaServer::DownloadL(TDownloadIPCParams aParams, + const TDesC8& aPkgURL, TFotaClient aRequester, TBool aSilent, + TBool aUpdateLtr) + { + FLOG(_L("[FotaServer] Download >>")); + iAsyncOperation = ETrue; + SetServerActive(ETrue); + WakeupServer(); + + + if (DownloaderL()->IsDownloadActive()) + { + FLOG(_L("One download is already active, hence leaving!")); + __LEAVE_IF_ERROR(KErrAlreadyExists); + } + + TBuf temp; + if (GetSoftwareVersion(temp) == KErrNone) + { + + RFileWriteStream wstr; + CleanupClosePushL(wstr); + TInt err1 = wstr.Replace(iFs, KSWversionFile, EFileWrite); + if (err1 == KErrNone) + { + HBufC16* swv; + swv = HBufC16::NewLC(temp.Length()); + swv->Des().Copy(temp); + wstr.WriteInt16L(swv->Des().Length()); // length + wstr.WriteL(swv->Des()); + wstr.WriteInt16L(0); + CleanupStack::PopAndDestroy(swv); + + } + + CleanupStack::PopAndDestroy(&wstr); // wstr + } + + iPackageState = aParams; + iPackageState.iUpdateLtr = aUpdateLtr; + iPackageState.iSessionType = aSilent; + iPackageState.iIapId = -2; //Signifies default connection to use. + TRAP_IGNORE(SetIapToUseL()); + FLOG(_L("Using IAP = %d for the download"), iPackageState.iIapId); + + //First entry to fota database + FLOG(_L("DownloadManagerClient::DownloadL, State 1 - writing to database")); + + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, aPkgURL, EFDBState | EFDBResult + | EFDBProfileId | EFDBPkgUrl | EFDBPkgName | EFDBVersion + | EFDBUpdateLtr | EFDBSessionType | EFDBIapId); + iDatabase->CloseAndCommitDB(); + + //Cancel any outstanding requests to monitor. + CancelFmsL(); + SetUpdateRequester(aRequester); + ResetCounters(); + + DownloaderL()->DownloadL(aPkgURL); + + + FLOG(_L("[FotaServer] Download <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::UpdateL +// Start update +// -------------------------------------------------------------------------- +// +void CFotaServer::TryUpdateL(TFotaClient aClient) + { + FLOG(_L("CFotaServer::TryUpdateL, client = %d >>"), (TInt) aClient); + iAsyncOperation = ETrue; + SetServerActive(ETrue); + WakeupServer(); + + TBool isPkgvalid(ETrue); + isPkgvalid = CheckSWVersionL(); + + if (!isPkgvalid) + { + FLOG( _L("Fota Update:: Firmware version mismatch! Resetting fota state")); + + ResetFotaStateToFailL(); + SetServerActive(EFalse); + __LEAVE_IF_ERROR(KErrNotFound); + } + + if (iPackageState.iPkgId == KErrNotFound) + iPackageState = GetStateL(-1); + + iPackageState.iState = RFotaEngineSession::EStartingUpdate; + iPackageState.iResult = KErrNotFound; + iPackageState.iSendAlert = EFalse; + + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, KNullDesC8, EFDBState | EFDBResult); + iDatabase->CloseAndCommitDB(); + + SetStartupReason(EFotaUpdateInterrupted); + + if (IsDeviceDriveBusyL()) + { + FLOG( + _L("Fota Update:: Device encryption is onging, hence aborting update!")); + ShowDialogL(EFwUpdDeviceBusy); + + __LEAVE_IF_ERROR(KErrNotReady); + } + + FLOG(_L("Fota Update:: Firmware version check okie")); + + if (!iUpdater) + { + iUpdater = CFotaUpdate::NewL(this); + } + + if (aClient != EFMSServer) + { + //Check any active phone call + TInt callactive(EFalse); + iFMSClient.OpenL(); + TInt err1 = iFMSClient.IsPhoneCallActive(callactive); + + if (callactive) + { + FLOG(_L("Fota Update:: Active call found; differing showing the install dialog!")); + + iPackageState.iResult = RFotaEngineSession::EResUpdateFailed; + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, KNullDesC8, EFDBResult); + iDatabase->CloseAndCommitDB(); + + iFMSClient.NotifyForUpdateL(EUpdMonitorPhoneCallEnd); + iFMSClient.Close(); + SetServerActive(EFalse); + __LEAVE_IF_ERROR(KErrNotReady); + } + iFMSClient.Close(); + + FLOG(_L("Fota Update:: Active phone call check okie ")); + + TBool batt = iUpdater->CheckBatteryL(); + +#if defined (__WINS__) + batt = ETrue; +#endif + + if (aClient == EOMADMAppUi || aClient == EDMHostServer) + { + FLOG(_L("Device Updates/Adapter. Show Full screen dialog.")); + LoopBatteryCheckL(batt); + } + else + { + if (batt) + { + FLOG(_L("Not Device Updates. Show device dialog.")); + + ShowDialogL(EFwUpdResumeUpdate); + } + else + { + FLOG(_L("Not Device Updates. Leave and monitor for battery.")); + + iPackageState.iState = RFotaEngineSession::EStartingUpdate; + iPackageState.iResult = RFotaEngineSession::EResLowBattery; + + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, KNullDesC8, EFDBState + | EFDBResult); + iDatabase->CloseAndCommitDB(); + + InvokeFmsL(); + + __LEAVE_IF_ERROR(KErrBadPower); + } + } + } + else + { + ShowDialogL(EFwUpdResumeUpdate); + } + FLOG(_L("CFotaServer::TryUpdateL <<")); + } + +void CFotaServer::LoopBatteryCheckL(TBool aBatteryLevel) + { + FLOG(_L("CFotaServer::LoopBatteryCheckL, level = %d"), aBatteryLevel); + if (aBatteryLevel) + { + FLOG(_L("Fota Update:: Battery check success; monitoring battery until update")); + ShowFullScreenDialog(EHbFotaUpdate); + ConstructApplicationUI(ETrue); + iUpdater->MonitorBatteryChargeLevel(); + } + else + { + FLOG(_L("Fota Update:: Battery check failed; monitoring for charger connection")); + + iPackageState.iState = RFotaEngineSession::EStartingUpdate; + iPackageState.iResult = RFotaEngineSession::EResLowBattery; + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, KNullDesC8, EFDBResult); + iDatabase->CloseAndCommitDB(); + + ShowFullScreenDialog(EHbFotaLowBattery); + ConstructApplicationUI(ETrue); + iUpdater->MonitorBatteryChargingStatus(); + } + FLOG(_L("CFotaServer::LoopBatteryCheckL <<")); + } + + +void CFotaServer::FinalizeUpdate() + { + FLOG(_L("CFotaServer::FinalizeUpdate >>")); + + if (iPackageState.iResult == RFotaEngineSession::EResLowBattery) + { + TRAP_IGNORE(InvokeFmsL()); + } + SetServerActive(EFalse); + ServerCanShut(ETrue); + StopServerWhenPossible(); + FLOG(_L("CFotaServer::FinalizeUpdate <<")); + } + + +FotaFullscreenDialog* CFotaServer::FullScreenDialog() + { + return iFullScreenDialog; + } + +void CFotaServer::HandleFullScreenDialogResponse(TInt aResponse) + { + FLOG(_L("CFotaServer::HandleFullScreenDialogResponse, response = %d >>"), + aResponse); + + TBool active (EFalse); + TRAP_IGNORE(active = DownloaderL()->IsDownloadActive()); + CEikonEnv* env = CEikonEnv::Static(); + + if (iPackageState.iState == RFotaEngineSession::EDownloadProgressing) + { + + //swapProcess(EFalse); + ConstructApplicationUI(EFalse); + if (aResponse == EHbLSK) + { + //HIDE is pressed + FLOG(_L("HIDE is pressed")); + if (env) + { + CApaWindowGroupName* wgName (NULL); + TRAP_IGNORE( wgName = CApaWindowGroupName::NewL(env->WsSession())); + if (wgName) + { + wgName->SetHidden(EFalse); // hides us from FSW and protects us from OOM FW etc. + delete wgName; + } + } + } + else + { + DecrementUserPostponeCount(); + if (active) + { + FLOG(_L("CONTINUE LATER is pressed on update dialog")); + /* + if (env) + { + CApaWindowGroupName* wgName; + TRAP_IGNORE(wgName = CApaWindowGroupName::NewL(env->WsSession())); + if (wgName) + { + wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc. + delete wgName; + } + }*/ + TRAP_IGNORE(PauseDownloadL()); + } + } + } + else if (iPackageState.iState == RFotaEngineSession::EDownloadComplete + || iPackageState.iState == RFotaEngineSession::EStartingUpdate) + { + if (aResponse == EHbLSK) + { + FLOG(_L("CONTINUE is pressed/Timeout on update dialog")); + iPackageState.iResult = KErrNotFound; + TRAPD(err, + iDatabase->OpenDBL(); + iDatabase->SetStateL( iPackageState ,KNullDesC8,EFDBResult ); + iDatabase->CloseAndCommitDB(); + ); + FLOG(_L("Updating the fota database... err = %d"), err); + + TInt callactive(EFalse); + + TRAP(err, + iFMSClient.OpenL(); + TInt err1 = iFMSClient.IsPhoneCallActive(callactive); + iFMSClient.Close(); + ); + + if (callactive) + { + FLOG(_L("Fota Update:: Active call found; differing showing the install dialog!")); + + iPackageState.iResult = RFotaEngineSession::EResUpdateFailed; + TRAP(err, + iDatabase->OpenDBL(); + iDatabase->SetStateL(iPackageState, KNullDesC8, EFDBResult); + iDatabase->CloseAndCommitDB(); + ); + + TRAP(err, + iFMSClient.OpenL(); + iFMSClient.NotifyForUpdateL(EUpdMonitorPhoneCallEnd); + iFMSClient.Close(); + ); + + FLOG(_L("Deleting the fullscreen dialog...")); + iFullScreenDialog->deleteLater(); + iFullScreenDialog = NULL; + SetServerActive(EFalse); + return; + } + + TRAP(err, iUpdater->StartUpdateL( iPackageState )); + FLOG(_L("Starting update, err = %d"), err); + } + else + { + FLOG(_L("CONTINUE LATER is pressed on update dialog")); + ConstructApplicationUI(EFalse); + + iUpdater->CancelMonitor(); + + if (iFullScreenDialog->IsLSKEnabled()) + { + DecrementUserPostponeCount(); + } + + iPackageState.iState = RFotaEngineSession::EStartingUpdate; + iPackageState.iResult = RFotaEngineSession::EResUserCancelled; + TRAPD(err, + iDatabase->OpenDBL(); + iDatabase->SetStateL( iPackageState ,KNullDesC8,EFDBState|EFDBResult ); + iDatabase->CloseAndCommitDB(); + ); + FLOG(_L("Updating the fota database... err = %d"), err); + + SetStartupReason(EFotaUpdateInterrupted); + SetServerActive(EFalse); + TRAP(err, InvokeFmsL()); + StopServerWhenPossible(); + + iAsyncOperation = EFalse; + FLOG(_L("Invoking fms, err = %d"), err); + } + } + FLOG(_L("CFotaServer::HandleFullScreenDialogResponse <<")); + } + +void CFotaServer::UpdateBatteryLowInfo(TBool aValue) + { + FLOG(_L("CFotaServer::UpdateBatteryLowInfo >>")); + + if (aValue) + { + FLOG( + _L("Fota Update:: Battery has become low; disabling installation")); + iPackageState.iResult = RFotaEngineSession::EResUpdateFailed; + TRAP_IGNORE( + iDatabase->OpenDBL(); + iDatabase->SetStateL( iPackageState ,KNullDesC8,EFDBResult ); + iDatabase->CloseAndCommitDB(); + ); + + ShowFullScreenDialog(EHbFotaLowBattery); + } + else + { + ShowFullScreenDialog(EHbFotaUpdate); + FLOG( + _L("Fota Update:: Battery is still sufficient; enabling installation")); + } + FLOG(_L("CFotaServer::UpdateBatteryLowInfo <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::CheckSWVersionL +// Check the s/w version +// -------------------------------------------------------------------------- +// + +TBool CFotaServer::CheckSWVersionL() + + { + FLOG(_L("CFotaServer::CheckSWVersionL >>")); + TBuf temp; + HBufC16* message16 = NULL; + TBool isPkgvalid(ETrue); + if (GetSoftwareVersion(temp) == KErrNone) + { + + //TBufswvfromfile; + //Fetch the software version ... + RFileReadStream rstr; + TInt err1 = rstr.Open(iFs, KSWversionFile, EFileRead); + if (err1 == KErrNone) + { + CleanupClosePushL(rstr); + TInt msglen = rstr.ReadInt16L(); + if (msglen > 0) + { + message16 = HBufC16::NewLC(msglen + 1); + TPtr16 tempswv = message16->Des(); + TRAPD(err, rstr.ReadL(tempswv,msglen )); + + if (err != KErrNone && err != KErrEof) + { + FLOG(_L(" file read err %d"), err); //User::Leave( err ); + msglen = 0; + } + else + { + FLOG(_L(" msglen %d"), msglen); + TPtr swvfromfile = message16->Des(); + + FLOG(_L(" swvfromfile=%S"), message16); + + //Compare the software versions to decide whether the download is still valid or not. + if (msglen != temp.Length() || temp.Compare(tempswv) + != KErrNone) + { + isPkgvalid = EFalse; + FLOG(_L("CFotaServer::software not matching >>")); + + } + } + + CleanupStack::PopAndDestroy(message16); + } + CleanupStack::PopAndDestroy(&rstr); + + } + + } + + FLOG(_L("CFotaServer::CheckSWVersionL <<")); + return isPkgvalid; + + } + +// -------------------------------------------------------------------------- +// CFotaServer::ScheduledUpdateL +// Update, triggered by scheduler +// -------------------------------------------------------------------------- +void CFotaServer::ScheduledUpdateL(TFotaScheduledUpdate aUpdate, + TFotaClient aClient) + { + FLOG(_L("CFotaServer::ScheduledUpdateL >>")); + + iAsyncOperation = ETrue; + WakeupServer(); + + TPackageState s = GetStateL(aUpdate.iPkgId); + + if (s.iState == RFotaEngineSession::EDownloadProgressing) + { + FLOG(_L("Trying to resume the download in non-silent mode")); + iPackageState = s; + TryResumeDownloadL(aClient, EFalse); + } + else if (s.iState == RFotaEngineSession::EStartingUpdate) + { + // If update is in progress, do not start new one (multiple popups) + if (iUpdater) + { + FLOG(_L("\t\tupdate in progress")); + return; + } + else + { + FLOG(_L("Trying to resume the installation in non-silent mode")); + iPackageState = s; + TryUpdateL(aClient); + } + } + FLOG(_L("CFotaServer::ScheduledUpdateL <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::DoConnect +// From CServer2. Initializes class members. +// -------------------------------------------------------------------------- +void CFotaServer::DoConnect(const RMessage2 &aMessage) + { + FLOG(_L("CFotaServer::DoConnect(const RMessage2 &aMessage) >>")); + + // In case shutdown is in progress, cancel it. + if (iInitialized == EFalse) + { + TRAPD( err, ClientAwareConstructL( aMessage ) ); + if (err) + FLOG(_L(" ClientAwareConstructL err %d"), err); + } + CServer2::DoConnect(aMessage); + FLOG(_L("CFotaServer::DoConnect(const RMessage2 &aMessage) <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::GetStateL +// Get state of a download package +// -------------------------------------------------------------------------- +TPackageState CFotaServer::GetStateL(const TInt aPkgId) + { + FLOG(_L("CFotaServer::GetStateL >>")); + TPackageState s = RFotaEngineSession::EIdle; + + if (aPkgId >= 0) // Used by all clients + { + iDatabase->OpenDBL(); + s = iDatabase->GetStateL(aPkgId,iLastFwUrl); + iDatabase->CloseAndCommitDB(); + } + else if (aPkgId == -1) //Used by DM UI to get the state of last fota operation + { + //Read status from fotastate last entry + + iDatabase->OpenDBL(); + + RArray states; + CleanupClosePushL(states); + iDatabase->GetAllL(states); + // Loop states. + for (TInt i = 0; i < states.Count(); ++i) + { + TPackageState tmp; + TBuf8 tmpurl; + tmp = iDatabase->GetStateL(states[i], tmpurl); + FLOG(_L("***Package: %d, State = %d"), states[i], + (TInt) tmp.iState); + if (tmp.iState != RFotaEngineSession::EIdle) + { + s = tmp; + iLastFwUrl.Copy(tmpurl); + } + } + FLOG(_L("Status of current operation is %d"), (TInt) s.iState); + + CleanupStack::PopAndDestroy(&states); + iDatabase->CloseAndCommitDB(); + } + FLOG(_L("CFotaServer::GetStateL <<")); + return s; + } + +// -------------------------------------------------------------------------- +// CFotaServer::OnSyncMLSessionEvent +// -------------------------------------------------------------------------- +// +void CFotaServer::OnSyncMLSessionEvent(TEvent aEvent, TInt aIdentifier, + TInt aError, TInt /*aAdditionalData*/) + { + FLOG(_L("CFotaServer::OnSyncMLSessionEvent >>")); + + if (iSyncJobId != aIdentifier) + return; + FLOG(_L("CFotaServer::OnSyncMLSessionEvent %d err:%d (id %d==%d?)"), + aEvent, aError, aIdentifier, iSyncJobId); + TBool end(EFalse); + + if (iSyncJobId == aIdentifier) + { + + switch (aEvent) + { + //EJobStart = 0 + case EJobStartFailed: // 1 E + { + end = ETrue; + } + break; + case EJobStop: // 2 E + { + end = ETrue; + // Sync ok => do not try anymore + if (aError == KErrNone) + { + iSyncMLAttempts = 0; + } + } + break; + case EJobRejected: // 3 E + { + end = ETrue; + } + break; + // ETransportTimeout , // 7 + default: + { + } + break; + } + } + + if (end && iSyncMLAttempts == 0) + { + if (iTimedSMLSessionClose) + { + FLOG(_L(" closing smlsession timer")); + iTimedSMLSessionClose->Cancel(); + delete iTimedSMLSessionClose; + iTimedSMLSessionClose = NULL; + } + StopServerWhenPossible(); + + } + else if (end) + { + + if (iTimedSMLSessionClose) + { + FLOG(_L(" closing smlsession timer")); + iTimedSMLSessionClose->Cancel(); + delete iTimedSMLSessionClose; + iTimedSMLSessionClose = NULL; + } + + FLOG(_L(" starting smlsession timer")); + TRAPD( err2, iTimedSMLSessionClose = CPeriodic::NewL (EPriorityNormal) ); + if (!err2) + { + iTimedSMLSessionClose->Start(TTimeIntervalMicroSeconds32( + KSyncmlSessionRetryInterval), + TTimeIntervalMicroSeconds32( + KSyncmlSessionRetryInterval), TCallBack( + StaticDoCloseSMLSession, this)); + } + else + FLOG(_L(" iTimedSMLSessionClose err %d"), err2); + } + FLOG(_L("CFotaServer::OnSyncMLSessionEvent <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::GetUpdateTimeStampL +// Gets time of last update. It is stored in a file. +// -------------------------------------------------------------------------- +void CFotaServer::GetUpdateTimeStampL(TDes16& aTime) + { + FLOG(_L("CFotaServer::GetUpdateTimeStampL >>")); + TInt err; + + RFileReadStream rstr; + err = rstr.Open(iFs, _L("updatetimestamp"), EFileRead); + + if (err == KErrNone) + { + FLOG(_L(" update time stamp file found,reading")); + CleanupClosePushL(rstr); + TInt year = rstr.ReadInt32L(); + TInt month = rstr.ReadInt32L(); + TInt day = rstr.ReadInt32L(); + TInt hour = rstr.ReadInt32L(); + TInt minute = rstr.ReadInt32L(); + TInt year16 = year; + TInt month16 = month; + TInt day16 = day; + TInt hour16 = hour; + TInt minute16 = minute; + CleanupStack::PopAndDestroy(&rstr); + aTime.Append(year16); + aTime.Append(month16); + aTime.Append(day16); + aTime.Append(hour16); + aTime.Append(minute16); + } + else if (err != KErrNotFound) + { + __LEAVE_IF_ERROR ( err ); + } + + if (err == KErrNotFound) + { + FLOG(_L(" update time stamp not found ")); + } + + FLOG(_L("CFotaServer::GetUpdateTimeStampL <<")); + } + +void CFotaServer::GetCurrentFwDetailsL(TDes8& aName, TDes8& aVersion, + TInt& aSize) + { + FLOG(_L("CFotaServer::GetCurrentFwDetailsL >>")); + + TPackageState package = GetStateL(-1); + + aName.Copy(package.iPkgName); + aVersion.Copy(package.iPkgVersion); + aSize = package.iPkgSize; + + FLOG(_L("CFotaServer::GetCurrentFwDetailsL <<")); + } +// -------------------------------------------------------------------------- +// CFotaServer::GetUpdatePackageIdsL +// -------------------------------------------------------------------------- +// +void CFotaServer::GetUpdatePackageIdsL(TDes16& aPackageIdList) + { + FLOG(_L("CFotaServer::GetUpdatePackageIdsL()")); + __LEAVE_IF_ERROR(KErrNotSupported); + } + +// -------------------------------------------------------------------------- +// CFotaServer::GenericAlertSentL +// Generic alert sent, do cleanup. FUMO spec specifies cleanup need to have +// for states 20,70,80,90,100. Called by syncml framework when it has sent +// generic alert +// -------------------------------------------------------------------------- +// +void CFotaServer::ResetFotaStateL(const TInt aPackageID) + { + FLOG(_L("CFotaServer::ResetFotaStateL %d"), aPackageID); + TPackageState state; + TBool toidle(EFalse); + TBool deletepkg(EFalse); + + iDatabase->OpenDBL(); + state = iDatabase->GetStateL(aPackageID, iLastFwUrl); + + switch (state.iState) + { + case RFotaEngineSession::EDownloadFailed: + { + toidle = ETrue; + deletepkg = ETrue; + } + break; + case RFotaEngineSession::EUpdateFailed: + { + toidle = ETrue; + deletepkg = ETrue; + } + break; + case RFotaEngineSession::EUpdateFailedNoData: + { + toidle = ETrue; + } + break; + case RFotaEngineSession::EUpdateSuccessful: + { + toidle = ETrue; + } + break; + case RFotaEngineSession::EUpdateSuccessfulNoData: + { + toidle = ETrue; + } + break; + case RFotaEngineSession::EDownloadComplete: + { + state.iState = RFotaEngineSession::EStartingUpdate; + state.iResult = KErrNotFound; + iDatabase->SetStateL(state, KNullDesC8, EFDBState); + toidle = EFalse; + } + break; + default: + { + FLOG(_L(" pkg %d (state:%d) doesnt need cleanup"), aPackageID, + state.iState); + } + break; + + } + + if (toidle) + { + state.iState = RFotaEngineSession::EIdle; + state.iResult = KErrNotFound; + iDatabase->SetStateL(state, KNullDesC8, EFDBState | EFDBResult); + DeleteFUMOTreeL(); + } + + iDatabase->CloseAndCommitDB(); + + SetStartupReason(EFotaDefault); + + if (deletepkg) + { + DownloaderL()->DeleteUpdatePackageL(); + } + } + +void CFotaServer::ResetCounters() + { + FLOG(_L("CFotaServer::ResetCounters >>")); + + CRepository* centrep = NULL; + TInt maxcount(0); + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if (err == KErrNone) + { + err = centrep->Get(KFOTAMaxPostponeCount, maxcount); + err = centrep->Set(KFOTAUserPostponeCount, maxcount); + err = centrep->Set(KFOTADownloadRestartCount, KMaxDownloadRestartCount); + } + delete centrep; + centrep = NULL; + + FLOG(_L("CFotaServer::ResetCounters, postpone count set to %d, err = %d <<"), maxcount, err); + } + +TBool CFotaServer::IsUserPostponeAllowed() + { + FLOG(_L("CFotaServer::IsUserPostponeAllowed >>")); + + TBool ret(ETrue); + CRepository* centrep = NULL; + TInt count(1); + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if (err == KErrNone) + { + err = centrep->Get(KFOTAUserPostponeCount, count); + } + delete centrep; + centrep = NULL; + + if (count == 0) + ret = EFalse; + else if (count == -1) //-1 signifies infinite postpone + ret = ETrue; + + FLOG(_L("CFotaServer::IsUserPostponeAllowed, count = %d, ret = %d, err = %d >>"), count, ret, err); + + return ret; + } + +void CFotaServer::DecrementUserPostponeCount() + { + FLOG(_L("CFotaServer::DecrementUserPostponeCount >>")); + + CRepository* centrep = NULL; + TInt count; + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if (err == KErrNone) + { + err = centrep->Get(KFOTAUserPostponeCount, count); + if (--count < 0) + count = 0; + err = centrep->Set(KFOTAUserPostponeCount, count); + } + delete centrep; + centrep = NULL; + + FLOG( + _L("CFotaServer::DecrementUserPostponeCount, tries left: %d, err = %d >>"), + count, err); + } + +TBool CFotaServer::DecrementDownloadRestartCount() + { + FLOG(_L("CFotaServer::DecrementDownloadRestartCount >>")); + + TBool ret (ETrue); + CRepository* centrep = NULL; + TInt count; + + TRAPD( err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if (err == KErrNone) + { + err = centrep->Get(KFOTADownloadRestartCount, count); + if (--count < 0) + count = 0; + err = centrep->Set(KFOTADownloadRestartCount, count); + } + delete centrep; + centrep = NULL; + + if (count == 0) + ret = EFalse; + + FLOG(_L("CFotaServer::DecrementDownloadRestartCount, ret = %d, err = %d <<"), ret, err); + return ret; + } + + +// -------------------------------------------------------------------------- +// CFotaServer::StartNetworkMonitorL +// Starts Network Monitoring operation for defined interval and retries (FotaNetworkRegMonitor.h) +// -------------------------------------------------------------------------- +void CFotaServer::StartNetworkMonitorL() + { + FLOG(_L("CFotaServer::StartNetworkMonitorL >>")); + if (!iMonitor) + iMonitor = CFotaNetworkRegStatus::NewL(this); + iMonitor->StartMonitoringL(); + + FLOG(_L("CFotaServer::StartNetworkMonitorL <<")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::ReportNetworkStatus +// called by CFotaNetworkRegStatus for reporting status +// -------------------------------------------------------------------------- +void CFotaServer::ReportNetworkStatus(TBool status) + { + FLOG(_L("CFotaServer::ReportNetworkStatus, status = %d >>"), status); + iRetryingGASend = EFalse; + iNetworkAvailable = status; + + if (iNetworkAvailable) + { + TRAPD (err, CreateDeviceManagementSessionL (iPackageState)); + if (err != KErrNone) + { + FLOG(_L("Error %d occured while sending GA after retries"), err); + } + } + //No need of iMonitor anymore + if (iMonitor) + { + delete iMonitor; + iMonitor = NULL; + } + + FLOG(_L("CFotaServer::ReportNetworkStatus >>")); + } + +// -------------------------------------------------------------------------- +// CFotaServer::CheckIapExistsL +// Checks for IAP Id exists or not in commsdb +// IAP Id used for resuming the download or for sending Generic alert +// -------------------------------------------------------------------------- +// +TBool CFotaServer::CheckIapExistsL(TUint32 aIapId) + { + FLOG(_L("CFotaServer::CheckIapExistsL >>")); + CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP); + CleanupStack::PushL(commDb); + CApUtils* aputils = CApUtils::NewLC(*commDb); + TBool exists = aputils->IAPExistsL(aIapId); + CleanupStack::PopAndDestroy(aputils); + CleanupStack::PopAndDestroy(commDb); + FLOG(_L("CFotaServer::CheckIapExistsL <<")); + return exists; + } + +// -------------------------------------------------------------------------- +// CFotaServer::IsDeviceDriveBusyL +// Finds if device encryption or decryption is in progress. +// It is harmful to restart device whilst encryption/decryption is in progress +// -------------------------------------------------------------------------- +// +TBool CFotaServer::IsDeviceDriveBusyL() + { + FLOG(_L("CFotaServer::IsDeviceDriveBusyL >>")); + + TBool ret(EFalse); + FeatureManager::InitializeLibL(); + TBool defeature = FeatureManager::FeatureSupported( + KFeatureIdFfDeviceEncryptionFeature); + FeatureManager::UnInitializeLib(); + + if (defeature) + { + TInt value(EOpIdle); // Encryption idle + RProperty::Get(KDevEncProtectedUid, KDevEncOperationKey, value); + + if (value != EOpIdle) + ret = ETrue; + } + + FLOG(_L("CFotaServer::IsDeviceDriveBusyL, ret = %d <<"), ret); + return ret; + } +// -------------------------------------------------------------------------- +// CFotaDownload::SetIapToUseL +// Sets the IAP ID to use. This menthod is used in fresh and resume download. +// -------------------------------------------------------------------------- +// +void CFotaServer::SetIapToUseL() + { + FLOG(_L("CFotaServer::SetIapToUseL >>")); + + TInt aIapId(KErrNotFound); + + // GET IAP FROM PROFILE ---------------------------------------------- + + FLOG(_L("[FotaServer] 1")); + RSyncMLSession syncsession; + syncsession.OpenL(); + FLOG(_L("[FotaServer] 2")); + RSyncMLDevManProfile smlprof; + RArray connections; + TSmlTransportId transport; + RSyncMLConnection connection; + + CleanupClosePushL(syncsession); + CleanupClosePushL(smlprof); + CleanupClosePushL(connections); + CleanupClosePushL(connection); + + FLOG(_L("[FotaServer] 1.1 opening syncml profileid %d "), + iPackageState.iProfileId); + smlprof.OpenL(syncsession, iPackageState.iProfileId, ESmlOpenRead); + FLOG(_L("[FotaServer] 1.1")); + smlprof.ListConnectionsL(connections); + FLOG(_L("[FotaServer] 1.3")); + transport = connections[0]; + connection.OpenL(smlprof, transport); + TBuf8<20> iapid2 = connection.GetPropertyL(KNSmlIAPId); + TLex8 iapid3(iapid2); + iapid3.Val(aIapId); + + CleanupStack::PopAndDestroy(&connection); + CleanupStack::PopAndDestroy(&connections); + CleanupStack::PopAndDestroy(&smlprof); + CleanupStack::PopAndDestroy(&syncsession); + + if (aIapId > KErrNotFound) + { + iPackageState.iIapId = aIapId; + } + else if (iPackageState.iState != RFotaEngineSession::EDownloadProgressing) + { + // GET IAP FROM CURRENT CONNECTION ---------------------------------------------- + + FLOG(_L("IAP in DM profile is default. Hence reading from the connection manager...")); + TInt sockIapid(-1); + RSocketServ serv; + CleanupClosePushL(serv); + User::LeaveIfError(serv.Connect()); + + RConnection conn; + CleanupClosePushL(conn); + User::LeaveIfError(conn.Open(serv)); + + TUint count(0); + User::LeaveIfError(conn.EnumerateConnections(count)); + // enumerate connections + for (TUint idx = 1; idx <= count; ++idx) + { + TConnectionInfo connectionInfo; + TConnectionInfoBuf connInfo(connectionInfo); + + TInt err = conn.GetConnectionInfo(idx, connInfo); // iapid + if (err != KErrNone) + { + CleanupStack::PopAndDestroy(2); // conn, serv + User::Leave(err); + } + // enumerate connectionclients + TConnectionEnumArg conArg; + conArg.iIndex = idx; + TConnEnumArgBuf conArgBuf(conArg); + err = conn.Control(KCOLConnection, KCoEnumerateConnectionClients, + conArgBuf); + if (err != KErrNone) + { + CleanupStack::PopAndDestroy(2); // conn, serv + User::Leave(err); + } + TInt cliCount = conArgBuf().iCount; + for (TUint j = 1; j <= cliCount; ++j) + { + TConnectionGetClientInfoArg conCliInfo; + conCliInfo.iIndex = j; + TConnGetClientInfoArgBuf conCliInfoBuf(conCliInfo); + err = conn.Control(KCOLConnection, + KCoGetConnectionClientInfo, conCliInfoBuf); + + if (err != KErrNone) + { + CleanupStack::PopAndDestroy(2); // conn, serv + User::Leave(err); + } + TConnectionClientInfo conCliInf = conCliInfoBuf().iClientInfo; + TUid uid = conCliInf.iUid; + if (uid == TUid::Uid(KSosServerUid)) + { + sockIapid = connInfo().iIapId; + FLOG(_L("[FotaServer] IAP found from ESOCK %d"), sockIapid); + iPackageState.iIapId = sockIapid; + } + + FLOG(_L("[FotaServer] CFotaDownload::DownloadL uid %x"), + uid.iUid); + } + } + CleanupStack::PopAndDestroy(2); // conn, serv + } + + FLOG(_L("CFotaDownload::SetIapToUseL, iap = %d <<"), iPackageState.iIapId); + } +// -------------------------------------------------------------------------- +// CFotaServer::GetSoftwareVersion +// Gets the software version +// +// -------------------------------------------------------------------------- +// +TInt CFotaServer::GetSoftwareVersion(TDes& aVersion) + { + FLOG(_L("CFotaServer::GetSoftwareVersion >>")); + aVersion.Zero(); + + SysVersionInfo::TVersionInfoType what = SysVersionInfo::EFWVersion; + TInt error(KErrNone); + error = SysVersionInfo::GetVersionInfo(what, aVersion); + FLOG(_L("CFotaServer::GetSoftwareVersion,SwV=%S <<"), &aVersion); + return error; + } + +// -------------------------------------------------------------------------- +// CFotaServer::ResetFotaStateL +// Resets the Fotastate +// +// -------------------------------------------------------------------------- +// +void CFotaServer::ResetFotaStateToFailL() + { + FLOG(_L("CFotaServer::ResetFotaStateToFailL >>")); + + TPackageState state; + if (!iDatabase->IsOpen()) + iDatabase->OpenDBL(); + //Fetch the software version that was before download from db. + state = iDatabase->GetStateL(iPackageState.iPkgId, iLastFwUrl); + state.iState = RFotaEngineSession::EUpdateFailed; + state.iResult = RFotaEngineSession::EResPackageMismatch; + iDatabase->SetStateL(state, KNullDesC8, EFDBState | EFDBResult); + iDatabase->CloseAndCommitDB(); + + DownloaderL()->DeleteUpdatePackageL(); + + ReportFwUpdateStatusL(state); + + FLOG(_L("CFotaServer::ResetFotaStateToFailL <<")); + } + +void CFotaServer::CreateDiskReservation() + { + FLOG(_L("CFotaServer::CreateDiskReservation >>")); + + TRAP_IGNORE(DownloaderL()->CreateDiskReservation()); + + FLOG(_L("CFotaServer::CreateDiskReservation <<")); + } + +void CFotaServer::DeleteDiskReservation(TDesC& path) + { + FLOG(_L("CFotaServer::DeleteDiskReservation >>")); + + QString temp = QString::fromUtf8(reinterpret_cast (path.Ptr()), path.Length()); + + TRAP_IGNORE(DownloaderL()->DeleteDiskReservation(temp)); + + FLOG(_L("CFotaServer::DeleteDiskReservation <<")); + } + +inline DownloadManagerClient* CFotaServer::DownloaderL() + { + if (!iDownloader) + { + FLOG(_L("Creating new download client...")); + iDownloader = DownloadManagerClient::NewL(this); + } + + return iDownloader; + } + +void CFotaServer::DropSession() + { + FLOG(_L("CFotaServer::DropSession >>")); + + iSessionCount--; + + FLOG(_L("Number of active sessions = %d"), iSessionCount); + + if (iSessionCount == 0 && !iAsyncOperation) + { + StopServerWhenPossible(); + ServerCanShut(ETrue); + } + + FLOG(_L("CFotaServer::DropSession <<")); + } + +static TInt StaticApplicationShutter(TAny *aPtr) + { + __ASSERT_ALWAYS( aPtr, User::Panic(KFotaPanic, KErrArgument) ); + CFotaServer* srv = (CFotaServer*) aPtr; + srv->StopServerWhenPossible(); + return KErrNone; + } + +void CFotaServer::WakeupServer() + { + FLOG(_L("CFotaServer::WakeupServer >>")); + ServerCanShut(EFalse); + if (iAppShutter) + { + iAppShutter->Cancel(); + delete iAppShutter; + iAppShutter = NULL; + } + + FLOG(_L("CFotaServer::WakeupServer >>")); + } + +void CFotaServer::StopServerWhenPossible() + { + FLOG(_L("CFotaServer::StopServerWhenPossible, sessioncount = %d, servercanshut = %d >>"), iSessionCount, iServerCanShut); + //Check if it's the right time to do so.. + + if (iSessionCount == 0 && iServerCanShut) + { + FLOG(_L("Shutting down the Fota server...")); + //Do some cleanup + + if (iAppShutter) + { + iAppShutter->Cancel(); + delete iAppShutter; + iAppShutter = NULL; + } + + //Exit. This will stop the active scheduler too. + QApplication::exit(); + } + else if (iSessionCount == 0) + { + FLOG(_L("Diferring shutdown now. Started shutdown timer...")); + + if (!iAppShutter) + { + TRAP_IGNORE( + iAppShutter = CPeriodic::NewL (EPriorityNormal); + iAppShutter->Start(KFotaTimeShutDown, KFotaTimeShutDown, + TCallBack(StaticApplicationShutter, this)); + ); + } + + } + else + { + //one or more client is still open + FLOG(_L("Diferring shutdown now.")); + WakeupServer(); + } + FLOG(_L("CFotaServer::StopServerWhenPossible <<")); + } + +void CFotaServer::ServerCanShut(TBool aParam) + { + FLOG(_L("CFotaServer::ServerCanShut, param = %d >>"), aParam); + + iServerCanShut = aParam; + + FLOG(_L("CFotaServer::ServerCanShut <<")); + + } + +void CFotaServer::ConstructApplicationUI(TBool aVal) + { + FLOG(_L("CFotaServer::ConstructApplicationUI, value = %d >>"), aVal); + + if (!aVal) + iMainwindow.lower(); + else + iMainwindow.raise(); + + FLOG(_L("CFotaServer::ConstructApplicationUI <<")); + } + + +void CFotaServer::SetVisible(TBool aVisible) +{ + FLOG(_L("CFotaServer::SetVisible >>")); + + if(iFullScreenDialog) + iFullScreenDialog->SetVisible(aVisible); + + FLOG(_L("CFotaServer::SetVisible <<")); +} + +//End of file diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/fotaSrvSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/fotaSrvSession.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,396 @@ +/* + * Copyright (c) 2005 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: fotaengines server side session + * + */ + +// INCLUDE FILES +#include "FotasrvSession.h" +#include "FotaSrvDebug.h" +#include +#include +#include +#include +#include +#include "FotaServer.h" + +// ============================= MEMBER FUNCTIONS ============================ + +class CFotaServer; + +// --------------------------------------------------------------------------- +// CFotaSrvSession::CheckClientSecureIdL +// Returns True if caller is syncml framework. False for fotasrv. +// Leaves if client is unknown +// --------------------------------------------------------------------------- +// +TFotaClient CFotaSrvSession::CheckClientSecureIdL(const RMessage2& aMessage) + { + TFotaClient client(EUnknown); + TUid dmhostserver1 = TUid::Uid(KDMHostServer1Uid); + TUid fota = TUid::Uid(KFotaServerUid); + TUid omadmappui = TUid::Uid(KOmaDMAppUid); + TUid starter = TUid::Uid(KStarterUid); + TUid fscheduler = TUid::Uid(KFotaScheduler); + TUid fms = TUid::Uid(KFMSServerUid); + TUid softwarechecker = TUid::Uid(0x2000BB96); + TUid softwarecheckerbackground = TUid::Uid(0x2000BB97); + TUid testapp = TUid::Uid(0x102073E4); + TUid testapp2 = TUid::Uid(0x10009CF4); + + TUid iadclient = TUid::Uid(0x2000F85A); + + // Syncml + if (aMessage.SecureId() == dmhostserver1.iUid) + { + FLOG( + _L("[CFotaSrvSession] CheckClientSecureIdL client is DmHostserver!")); + client = EDMHostServer; + } + else if (aMessage.SecureId() == omadmappui.iUid) + { + FLOG( + _L("[CFotaSrvSession] CheckClientSecureIdL client is omadmappui!")); + client = EOMADMAppUi; + } + else if (aMessage.SecureId() == starter.iUid) + { + FLOG(_L("[CFotaSrvSession] CheckClientSecureIdL client is starter!")); + client = EStarter; + } + else if (aMessage.SecureId() == softwarechecker.iUid + || aMessage.SecureId() == iadclient.iUid) + { + FLOG(_L("[CFotaSrvSession] CheckClientSecureIdL client is IAD!")); + client = ESoftwareChecker; + } + else if (aMessage.SecureId() == softwarecheckerbackground.iUid) + { + FLOG( + _L("[CFotaSrvSession] CheckClientSecureIdL client is IAD - background!")); + client = ESoftwareCheckerBackground; + } + else if (aMessage.SecureId() == fms.iUid) + { + FLOG(_L("[CFotaSrvSession] CheckClientSecureIdL client is FMS!")); + client = EFMSServer; + } + else if (aMessage.SecureId() == fscheduler.iUid) + { + FLOG( + _L("[CFotaSrvSession] CheckClientSecureIdL client is fota scheduler!")); + client = EFotaScheduler; + } + else if (aMessage.SecureId() == 0x0323231 || aMessage.SecureId() + == testapp.iUid || aMessage.SecureId() == testapp2.iUid) + { + client = EFotaTestApp; + } + + return client; + } + +// --------------------------------------------------------------------------- +// CFotaSrvSession::CFotaSrvSession +// --------------------------------------------------------------------------- +// +CFotaSrvSession::CFotaSrvSession() + { + FLOG(_L( "CFotaSrvSession::CFotaSrvSession( )" )); + iError = KErrNone; + //iDoc = CEikonEnv::Static()->EikAppUi()->Document(); + } + +// --------------------------------------------------------------------------- +// CFotaSrvSession::~CFotaSrvSession +// --------------------------------------------------------------------------- +// +CFotaSrvSession::~CFotaSrvSession() + { + FotaServer()->DropSession(); + } + +// --------------------------------------------------------------------------- +// CFotaSrvSession::ServiceL +// Handle client request +// --------------------------------------------------------------------------- +// +void CFotaSrvSession::ServiceL(const RMessage2& aMessage) + { + TInt err(KErrNone); + TInt pkgid = 0; + TPackageState state; + RThread clt; + aMessage.ClientL(clt); + TFullName cltnm = clt.FullName(); + FLOG(_L( "CFotaSrvSession::ServiceL %d serving for %S?" ), + aMessage.Function(), &cltnm); + + TFotaClient client = CheckClientSecureIdL(aMessage); + + if (client == EUnknown) + { + FLOG(_L("Permission denied to use fota services!")); + User::Leave(KErrPermissionDenied); + } + + TInt cmd = aMessage.Function(); + if ((cmd != EGetState) && (cmd != EGetResult) && (cmd != EGetCurrFwDetails) && (cmd != EGetUpdateTimestamp)) + { + + TInt fotaValue(1); + CRepository* centrep(NULL); + TUid uidValue = + { + 0x101F9A08 + }; // KCRFotaAdapterEnabled + + centrep = CRepository::NewL(uidValue); + if (centrep) + { + FLOG(_L("centralrepository found ")); + centrep->Get(1, fotaValue); // KCRFotaAdapterEnabled + delete centrep; + } + + if (!fotaValue) + { + FLOG(_L("Fota is disabled or not supported!")); + User::Leave(KErrNotSupported); + } + + } + + switch (aMessage.Function()) + { + + case EFotaDownload: + { + FLOG(_L( "CFotaSrvSession::ServiceL DOWNLOAD")); + TDownloadIPCParams ipc; + TPckg pkg(ipc); + aMessage.Read(0, pkg); + TInt deslen = aMessage.GetDesLengthL(1); + HBufC8* urlbuf = HBufC8::NewLC(deslen); + TPtr8 urlptr = urlbuf->Des(); + aMessage.Read(1, urlptr); + TInt silent = aMessage.Int2(); + FotaServer()->DownloadL(ipc, urlptr, client, silent, EFalse); + CleanupStack::PopAndDestroy(urlbuf); // urlbuf + aMessage.Complete(KErrNone); + + break; + } + case EFotaUpdate: + { + FLOG(_L( "CFotaSrvSession::ServiceL UPDATE" )); + TDownloadIPCParams ipc; + TPckg pkg(ipc); + aMessage.Read(0, pkg); + + // If update started from omadmappui, no alert should be sent if + // update is cancelled + if (client == EOMADMAppUi) + { + ipc.iSendAlert = EFalse; + } + FotaServer()->TryUpdateL(client); + aMessage.Complete(KErrNone); + break; + } + case EFotaDownloadAndUpdate: + { + FLOG(_L( "CFotaSrvSession::ServiceL DOWNLOADANDUPDATE" )); + TDownloadIPCParams ipc; + TPckg pkg(ipc); + aMessage.Read(0, pkg); + TInt deslen = aMessage.GetDesLengthL(1); + HBufC8* urlbuf = HBufC8::NewLC(deslen); + TPtr8 urlptr = urlbuf->Des(); + aMessage.Read(1, urlptr); + TFotaClient requester = CheckClientSecureIdL(aMessage); + + TInt silent = aMessage.Int2(); + FotaServer()->DownloadL(ipc, urlptr, requester, silent, ETrue); + CleanupStack::PopAndDestroy(urlbuf); + aMessage.Complete(KErrNone); + } + break; + + case EFotaTryResumeDownload: + { + FLOG(_L( "CFotaSrvSession::ServiceL TRYRESUMEDOWNLOAD" )); + if (client == EOMADMAppUi || client == EFMSServer || client + == EFotaTestApp) + { + TInt silent = aMessage.Int0(); + + FotaServer()->TryResumeDownloadL(client, silent); // silent + aMessage.Complete(KErrNone); + } + else + { + aMessage.Complete(KErrAccessDenied); + } + + } + break; + + case EDeletePackage: + { + FLOG(_L( "CFotaSrvSession::ServiceL DELETEPACKAGE")); + pkgid = aMessage.Int0(); + FotaServer()->DeletePackageL(pkgid); + aMessage.Complete(KErrNone); + } + break; + case EGetState: + { + FLOG(_L( "CFotaSrvSession::ServiceL GETSTATE" )); + pkgid = aMessage.Int0(); + + state = FotaServer()->GetStateL(pkgid); + + FLOG(_L( "CFotaSrvSession::ServiceL GETSTATE << %d" ), state.iState); + TPckg pkg2(state.iState); + aMessage.Write(1, pkg2); + aMessage.Complete(KErrNone); + } + break; + case EGetResult: + { + FLOG(_L( "CFotaSrvSession::ServiceL GETRESULT >>" )); + pkgid = aMessage.Int0(); + state = FotaServer()->GetStateL(pkgid); + TPckg pkg2(state.iResult); + FLOG(_L( "CFotaSrvSession::ServiceL GETRESULT << %d" ), + state.iResult); + aMessage.Write(1, pkg2); + aMessage.Complete(err); + break; + } + case EGetUpdatePackageIds: + { + FLOG(_L( "CFotaSrvSession::ServiceL EGETUPDATEPACKAGEIDS" )); + TPkgIdList pkgids; + FotaServer()->GetUpdatePackageIdsL(pkgids); + TPckg pkgids_pkg(pkgids); + aMessage.Write(0, pkgids_pkg); + aMessage.Complete(KErrNone); + } + break; + + case EGetUpdateTimestamp: + { + FLOG(_L( "CFotaSrvSession::ServiceL EGETUPDATETIMESTAMP" )); + TBuf16<15> timestamp; + FotaServer()->GetUpdateTimeStampL(timestamp); + aMessage.Write(0, timestamp); + aMessage.Complete(KErrNone); + } + break; + + case EGenericAlertSentForPackage: + { + FLOG(_L( "CFotaSrvSession::ServiceL EGENERICALERTSENT FOR PKGID" )); + TInt pkgid = aMessage.Int0(); + FotaServer()->ResetFotaStateL(pkgid); + aMessage.Complete(err); + } + break; + + case EScheduledUpdate: + { + FLOG(_L( "CFotaSrvSession::ServiceL ESCHEDULEDUPDATE" )); + TFotaScheduledUpdate sched(-1, -1); + TPckg p(sched); + aMessage.Read(0, p); + + FLOG(_L(" pkgid: %d scheduleid:%d"), sched.iPkgId, + sched.iScheduleId); + FotaServer()->ScheduledUpdateL(sched, client); + aMessage.Complete(KErrNone); + + } + break; + + case EPauseDownload: + { + FLOG(_L( "CFotaSrvSession::ServiceL EPAUSEDOWNLOAD" )); + FotaServer()->PauseDownloadL(); + aMessage.Complete(KErrNone); + } + break; + case EGetCurrFwDetails: + { + FLOG(_L( "CFotaSrvSession::ServiceL EGETCURRFWDETAILS" )); + + TBuf8 name; + TBuf8 version; + TInt size(0); + + FotaServer()->GetCurrentFwDetailsL(name, version, size); + + /* + aMessage.Write(1, name); + aMessage.Write(2, version); + TPckg psize(size); + aMessage.Write(3, psize); + + aMessage.Complete(KErrNone);*/ + + aMessage.Write(0, name); + aMessage.Write(1, version); + TPckg psize(size); + aMessage.Write(2, psize); + + aMessage.Complete(KErrNone); + + + } + break; + default: + { + FLOG(_L( "CFotaSrvSession::ServiceL In default case" )); + } + break; + } + } + +// ---------------------------------------------------------------------------------------- +// CFotaSrvSession::ServiceError +// ---------------------------------------------------------------------------------------- +void CFotaSrvSession::ServiceError(const RMessage2& aMessage, TInt aError) + { + FLOG(_L("CFotaSrvSession::ServiceError, err = %d >>"), aError); + CSession2::ServiceError(aMessage, aError); + FLOG(_L("CFotaSrvSession::ServiceError <<")); + } + +// --------------------------------------------------------------------------- +// CFotaSrvSession::FotaServer +// Helper function +// --------------------------------------------------------------------------- +// + +CFotaServer* CFotaSrvSession::FotaServer() const + { + return (CFotaServer*) Server(); + } + +void DispatchMessageL(const RMessage2& aMessage) + { + return; + } + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/fotafullscreendialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/fotafullscreendialog.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,455 @@ +/* + * Copyright (c) 2010 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: + * + */ + +#include "fotafullscreendialog.h" + +#include +#include +#include +#include +#include +#include +#include + + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::FotaFullscreenDialog +// Constructor of the full screen dialogs, it takes all the widgets from the docml +// initializes it and sets the progress bar to zero. +// --------------------------------------------------------------------------- +// + + +FotaFullscreenDialog::FotaFullscreenDialog(CFotaServer* aObserver) + { + FLOG(_L("FotaFullscreenDialog::FotaFullscreenDialog >>")); + bool ok = false; + iServer = aObserver; + iloader.load(":/xml/data/fullscreendialog.docml", &ok); + if (!ok) + { + return; + } + iClicked = EFalse; + idialog = qobject_cast (iloader.findWidget("dialog")); + + idialog->setTimeout(HbPopup::NoTimeout); + + iPrimaryAction = qobject_cast (iloader.findWidget( + "btnHide")); + + iSecondaryAction = qobject_cast (iloader.findWidget( + "btnResumeLater")); + + + + iprogressBar = qobject_cast (iloader.findWidget( + "horizontalProgressBar")); + iprogressBar->setProgressValue(0); + + /*iInstallNote = qobject_cast (iloader.findWidget( + "lblinstallnote"));*/ + iDownloadState = qobject_cast (iloader.findWidget( + "lblDownloadState")); + //iEmergencyIcon = qobject_cast (iloader.findWidget( + // "icnEmergency")); + iChargerIcon = qobject_cast (iloader.findWidget("icnCharger")); + HbIcon iconCharger; + //iconCharger.setIconName(:/icons/qgn_prop_sml_http.svg); + //iChargerIcon->setIcon(iconCharger); + HbIcon iconEmergency; + //iconEmergency.setIconName(:/icons/qgn_prop_sml_http.svg); + //iEmergencyIcon->setIcon(iconEmergency); + //iEmergencyNote = qobject_cast (iloader.findWidget( + // "lblEmergency")); + //iRestartIcon = qobject_cast (iloader.findWidget("icnInstall")); + //HbIcon iconRestart; + //iconRestart.setIconName(:/icons/qgn_prop_sml_http.svg); + //iRestartIcon->setIcon(iconRestart); + //iRestartNote = qobject_cast (iloader.findWidget( + // "lblRestartNote")); + //installEventFilter(this); + iPrimaryAction->setText(hbTrId("txt_common_button_hide")); + iSecondaryAction->setText(hbTrId("txt_device_update_button_resume_later")); + iTitle = qobject_cast (iloader.findWidget("lblTitle")); + iTitle->setPlainText(hbTrId("txt_device_update_title_updating_phone")); + iDownloadState->setPlainText(hbTrId("txt_device_update_info_downloading")); + //iInstallNote->setPlainText(hbTrId( + // "txt_device_update_info_installation_will_proceed_n")); + iChargerNote = qobject_cast (iloader.findWidget("lblcharger")); + iChargerNote->setPlainText(hbTrId( + "txt_device_update_info_FS_its_recommended_to_connec")); + //iRestartNote->setPlainText(hbTrId( + // "txt_device_update_info_FS_after_the_installation_the")); + //iEmergencyNote->setPlainText(hbTrId( + // "txt_device_update_info_FS_during_the_installation_the")); + + QObject::connect(iPrimaryAction, SIGNAL(clicked()), this, + SLOT(LSKSelected())); + QObject::connect(iSecondaryAction, SIGNAL(clicked()), this, + SLOT(RSKSelected())); + QObject::connect(idialog, SIGNAL(aboutToClose()), this, + SLOT(aboutToClose())); + + RefreshDialog(); + FLOG(_L("FotaFullscreenDialog::FotaFullscreenDialog <<")); + } + + + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::refreshDialog +// This function is used to refresh the contents of the full screen dialog +// once it is changed. +// --------------------------------------------------------------------------- +// + + +void FotaFullscreenDialog::RefreshDialog() + { + FLOG(_L("FotaFullscreenDialog::RefreshDialog >>")); + if (idialog) + { + FLOG(_L("FotaFullscreenDialog::idialog >>")); + iClicked = EFalse; + idialog->show(); + } + FLOG(_L("FotaFullscreenDialog::RefreshDialog <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::setsoftwaredetails +// This function is called to set the details of the software,which is downloaded. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::SetSoftwareDetails(int size, + const QString version, const QString aName) + { + //set Sw Details + FLOG(_L("FotaFullscreenDialog::RefreshDialog >>")); + iSwDetails = qobject_cast (iloader.findWidget("lblSwVersion")); + QString content; + + TReal sizeKB = size / 1024; + TReal sizeRounded = 0; + QString pkgsize; + + if (sizeKB > 1024) + { + TReal sizeMB = sizeKB / 1024; + Math::Round(sizeRounded,sizeMB,2); + content = hbTrId("txt_device_update_info_new_device_software_availab_Mb") .arg(aName) .arg(version).arg(sizeRounded); + } + else + { + Math::Round(sizeRounded,sizeKB,2); + content = hbTrId("txt_device_update_info_new_device_software_availab_Kb") .arg(aName) .arg(version).arg(sizeRounded); + } + + iSwDetails->setPlainText(content); + FLOG(_L("FotaFullscreenDialog::RefreshDialog <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::close +// This slot is called to manually close the dialog. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::Close() + { + FLOG(_L("FotaFullscreenDialog::Close <<")); + iClicked = ETrue; + if (idialog) + idialog->close(); + FLOG(_L("FotaFullscreenDialog::Close >>")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::setwarningdetails +// This function is to set the warnings details of the full screen dialog +// according to the state of the firmware update. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::SetWarningDetails(TFotaWarningType aType) + { + FLOG(_L("FotaFullscreenDialog::SetWarningDetails <<")); + //set heading content + if (aType == EHbFotaDownload) + { + FLOG(_L("FotaFullscreenDialog::EHbFotaDownload")); + idialog->setTimeout(HbPopup::NoTimeout); + iInstallNote = qobject_cast (iloader.findWidget( + "lblinstallnote")); + iInstallNote->setPlainText(hbTrId( + "txt_device_update_info_installation_will_proceed_n")); + //User::After(1000); + iInstallNote->setVisible(false); + + iRestartNote = qobject_cast (iloader.findWidget( + "lblRestartNote")); + iRestartNote->setPlainText(hbTrId( + "txt_device_update_info_FS_after_the_installation_the")); + //User::After(1000); + iRestartNote->setVisible(false); + + iRestartIcon = qobject_cast (iloader.findWidget("icnInstall")); + HbIcon iconRestart; + //iconRestart.setIconName(:/icons/qgn_prop_sml_http.svg); + //iRestartIcon->setIcon(iconRestart); + //User::After(1000); + iRestartIcon->setVisible(false); + + iEmergencyNote = qobject_cast (iloader.findWidget( + "lblEmergency")); + iEmergencyNote->setPlainText(hbTrId( + "txt_device_update_info_FS_during_the_installation_the")); + //User::After(1000); + iEmergencyNote->setVisible(false); + + iEmergencyIcon = qobject_cast (iloader.findWidget( + "icnEmergency")); + HbIcon iconEmergency; + //iconEmergency.setIconName(:/icons/qgn_prop_sml_http.svg); + //iEmergencyIcon->setIcon(iconEmergency); + //User::After(1000); + iEmergencyIcon->setVisible(false); + + } + else if (aType == EHbFotaUpdate) + { + FLOG(_L("FotaFullscreenDialog::EHbFotaUpdate")); + idialog->setTimeout(HbPopup::ContextMenuTimeout); + HbIcon iconCharger; + //iconCharger.setIconName(:/icons/qgn_prop_sml_http.svg); + //iChargerIcon->setIcon(iconCharger); + HbIcon iconRestart; + //iconRestart.setIconName(:/icons/qgn_prop_sml_http.svg); + //iRestartIcon->setIcon(iconRestart); + iInstallNote->setPlainText(hbTrId( + "txt_device_update_info_installation_will_proceed_n")); + iChargerNote->setPlainText(hbTrId( + "txt_device_update_info_FS_its_recommended_to_connec")); + iRestartNote->setPlainText(hbTrId( + "txt_device_update_info_FS_after_the_installation_the")); + iInstallNote->setVisible(true); + iRestartNote->setVisible(true); + iRestartIcon->setVisible(true); + iEmergencyNote->setVisible(true); + iEmergencyIcon->setVisible(true); + iDownloadState->setPlainText(hbTrId( + "txt_device_update_info_download_complete")); + iDownloadState->setVisible(true); + iPrimaryAction->setEnabled(ETrue); + } + else if (aType == EHbFotaLowBattery) + { + FLOG(_L("FotaFullscreenDialog::EHbFotaLowBattery")); + idialog->setTimeout(HbPopup::NoTimeout); + HbIcon iconCharger; + //iconCharger.setIconName(:/icons/qgn_prop_sml_http.svg); + //iChargerIcon->setIcon(iconCharger); + HbIcon iconRestart; + //iconRestart.setIconName(:/icons/qgn_prop_sml_http.svg); + //iRestartIcon->setIcon(iconRestart); + iInstallNote->setPlainText(hbTrId( + "txt_device_update_info_to_proceed_with_installatio")); + iChargerNote->setPlainText(hbTrId( + "txt_device_update_info_FS_after_the_installation_the")); + iRestartNote->setPlainText(hbTrId( + "txt_device_update_info_FS_during_the_installation_the")); + //iEmergencyNote->setPlainText(hbTrId("txt_device_update_info_FS_during_the_installation_the")); + iInstallNote->setVisible(true); + iRestartNote->setVisible(true); + iRestartIcon->setVisible(true); + iEmergencyNote->setVisible(false); + iEmergencyIcon->setVisible(false); + iDownloadState->setPlainText(hbTrId( + "txt_device_update_info_download_complete")); + iDownloadState->setVisible(true); + iPrimaryAction->setText(hbTrId("txt_device_update_button_continue")); + iSecondaryAction->setText(hbTrId( + "txt_device_update_button_install_later")); + iPrimaryAction->setEnabled(EFalse); + } + RefreshDialog(); + FLOG(_L("FotaFullscreenDialog::SetWarningDetails >>")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::updateprogressbar +// This function is called to update the progress bar with the download progress details/. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::UpdateProgressBar(TInt aProgress) + { + FLOG(_L("FotaFullscreenDialog::UpdateProgressBar <<")); + iprogressBar->setProgressValue(aProgress); + FLOG(_L("FotaFullscreenDialog::UpdateProgressBar >>")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::DisableRSK +// This function is called disable the RSK of the dialog when the postpone limeit expires +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::DisableRSK(TBool aVal) + { + FLOG(_L("FotaFullscreenDialog::DisableRSK <<")); + iSecondaryAction->setEnabled(!aVal); + FLOG(_L("FotaFullscreenDialog::DisableRSK >>")); + } + +bool FotaFullscreenDialog::IsLSKEnabled() + { + FLOG(_L("FotaFullscreenDialog::IsLSKEnabled <<")); + return (iPrimaryAction->isEnabled()); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::cancelSelected +// This slot is called when user presses the left softkey of fullscreen dialog. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::LSKSelected() + { + FLOG(_L("FotaFullscreenDialog::LSKSelected <<")); + iClicked = ETrue; + idialog->hide(); + iServer->HandleFullScreenDialogResponse(EHbLSK); + FLOG(_L("FotaFullscreenDialog::LSKSelected >>")); + } + + + // --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::cancelSelected +// This slot is called when user presses the right softkey of fullscreen dialog. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::RSKSelected() + { + FLOG(_L("FotaFullscreenDialog::RSKSelected >>")); + iClicked = ETrue; + idialog->hide(); + iServer->HandleFullScreenDialogResponse(EHbRSK); + FLOG(_L("FotaFullscreenDialog::RSKSelected <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::~FotaFullscreenDialog +// Destructor which destroys all the widgets +// --------------------------------------------------------------------------- +// + +FotaFullscreenDialog::~FotaFullscreenDialog() + { + FLOG(_L("~ FotaFullscreenDialog <<")); + + QObject::disconnect(iPrimaryAction, SIGNAL(clicked()), this, + SLOT(LSKSelected())); + QObject::disconnect(iSecondaryAction, SIGNAL(clicked()), this, + SLOT(RSKSelected())); + QObject::disconnect(idialog, SIGNAL(aboutToClose()), this, + SLOT(aboutToClose())); + + if (iprogressBar) + iprogressBar->deleteLater(); + + if (iPrimaryAction) + delete iPrimaryAction; + + if (iSecondaryAction) + delete iSecondaryAction; + + if (iTitle) + delete iTitle; + + if (iSwDetails) + delete iSwDetails; + + if (iInstallNote) + delete iInstallNote; + + if (iRestartNote) + delete iRestartNote; + + if (iRestartIcon) + delete iRestartIcon; + + if (iEmergencyNote) + delete iEmergencyNote; + + if (iEmergencyIcon) + delete iEmergencyIcon; + + if (iDownloadState) + delete iDownloadState; + + if (idialog) + delete idialog; + + FLOG(_L("~ FotaFullscreenDialog >>")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::showUpdateDialog +// This function is called when download is complete and update dialog has to be shown. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::ShowUpdateDialog() + { + FLOG(_L("FotaFullscreenDialog::ShowUpdateDialog <<")); + iPrimaryAction->setText(hbTrId("txt_common_button_continue_dialog")); + iSecondaryAction->setText( + hbTrId("txt_device_update_button_install_later")); + SetWarningDetails(EHbFotaUpdate); + FLOG(_L("FotaFullscreenDialog::ShowUpdateDialog >>")); + } + + +void FotaFullscreenDialog::SetVisible(TBool aVisible) +{ + FLOG(_L("RefreshDialog::SetVisible >>")); + RefreshDialog(); + FLOG(_L("RefreshDialog::SetVisible <<")); +} +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::aboutToClose +// This slot is called when full screen dialogs is cloased during a timeout. +// --------------------------------------------------------------------------- +// + +void FotaFullscreenDialog::aboutToClose() + { + FLOG(_L("FotaFullscreenDialog::aboutToClose <<")); + if (!iClicked) + { + FLOG(_L("Calling fotaserver as timedout...")); + iServer->HandleFullScreenDialogResponse(EHbLSK); + } + iClicked = EFalse; + FLOG(_L("FotaFullscreenDialog::aboutToClose >>")); + } + + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/fotanotifiers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/fotanotifiers.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2010 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: + * + */ +#include "fotanotifiers.h" +#include "FotaDlMgrClient.h" +_LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0"); + +// -------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::NewL +// -------------------------------------------------------------------------- +// +CFotaDownloadNotifHandler* CFotaDownloadNotifHandler::NewL( + MfotadevicedialogObserver* aObserver) + { + FLOG(_L("CFotaDownloadNotifHandler::NewL >>")); + __ASSERT_ALWAYS( aObserver, User::Panic(KFotaPanic, KErrArgument) ); + CFotaDownloadNotifHandler* h = new (ELeave) CFotaDownloadNotifHandler; + h->iObserver = aObserver; + + FLOG(_L("CFotaDownloadNotifHandler::NewL <<")); + + return h; + } + +// -------------------------------------------------------------------------- +CFotaDownloadNotifHandler::CFotaDownloadNotifHandler() : + iDevDialog(NULL), iDialogID(0) + { + FLOG(_L("CFotaDownloadNotifHandler::CFotaDownloadNotifHandler()")); + } + +// -------------------------------------------------------------------------- +CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler() + { + FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler >>")); + if (iDevDialog) + delete iDevDialog; + FLOG(_L("CFotaDownloadNotifHandler::~CFotaDownloadNotifHandler <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::LaunchNotifierL +// This function is used the observer which uses this notifer to lauch the notifier +// It puts the necessary parameters to lauch the notifier in CHbSymbianVariantMap +// --------------------------------------------------------------------------- +// +void CFotaDownloadNotifHandler::LaunchNotifierL( + CHbSymbianVariantMap *aNotifParams, TInt aDialogId) + { + FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() >>")); + if (!iDevDialog) + iDevDialog = CHbDeviceDialogSymbian::NewL(); + FLOG(_L("CFotaDownloadNotifHandler::CHbDeviceDialogSymbian::NewL()")); + if (iDevDialog == NULL) + FLOG(_L("Error in CHbDeviceDialogSymbian::NewL()")); + + iDialogID = aDialogId; + //connect(mDeviceDialog, SIGNAL(dataReceived(QVariantMap)), this, SLOT(dataReceived(QVariantMap))); + + TInt Err = iDevDialog->Show(KHbNotifier, *aNotifParams, this); + FLOG( + _L("CFotaDownloadNotifHandler::CHbDeviceDialogSymbian::Show() - %d"), + Err); + + FLOG(_L("CFotaDownloadNotifHandler::LaunchNotifierL() <<")); + } + +void CFotaDownloadNotifHandler::Cancel() + { + FLOG(_L("CFotaDownloadNotifHandler::Cancel >>")); + if (iDialogID) + iDevDialog->Cancel(); + FLOG(_L("CFotaDownloadNotifHandler::Cancel <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::DataReceived +// This slot is called when user gives a keypress event to the device dialog(through deviceDialogData signal). +// CHbSymbianVariantMap is passed from the device dialog which contains the information +// of the user input. +// --------------------------------------------------------------------------- +// +void CFotaDownloadNotifHandler::DataReceived(CHbSymbianVariantMap& aData) + { + FLOG(_L("CFotaDownloadNotifHandler::DataReceived() >>")); + iDevDialog->Cancel(); + TFwUpdNoteTypes ret; + const CHbSymbianVariant* dialogId = aData.Get(KResult); + ret = *(TFwUpdNoteTypes *) dialogId->Value (); + TInt temp = iDialogID; + iDialogID = 0; + iObserver->HandleDialogResponse(ret, temp); + + FLOG(_L("CFotaDownloadNotifHandler::DataReceived() <<")); + } + +// --------------------------------------------------------------------------- +// CFotaDownloadNotifHandler::DeviceDialogClosed +// This slot is called when the device dialog is closed due to some error. +// aCompletionCode gives the error information on which the dialog is closed. +// --------------------------------------------------------------------------- +// +void CFotaDownloadNotifHandler::DeviceDialogClosed(TInt aCompletionCode) + { + FLOG(_L("CFotaDownloadNotifHandler::DeviceDialogClosed() >>")); + + FLOG(_L("CFotaDownloadNotifHandler::DeviceDialogClosed() <<")); + } + diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/fotaupdate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/fotaupdate.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,718 @@ +/* + * Copyright (c) 2005-2006 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: starts update sequence + * + */ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "fotaupdate.h" +#include "fmsclient.h" +#include "FotasrvSession.h" +#include "fotaserverPrivateCRKeys.h" +#include "fotaserverPrivatePSKeys.h" +#include "fotanotifiers.h" + +#include +#include +// ============================= MEMBER FUNCTIONS ============================ + + +// --------------------------------------------------------------------------- +// CFotaUpdate::CFotaUpdate() +// --------------------------------------------------------------------------- +// +CFotaUpdate::CFotaUpdate() : + CActive(EPriorityNormal) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::~CFotaUpdate() +// --------------------------------------------------------------------------- +// +CFotaUpdate::~CFotaUpdate() + { + FLOG(_L("CFotaUpdate::~CFotaUpdate >>")); + iFotaServer = NULL; + + CancelMonitor(); + + if (iProperty.Handle()) + iProperty.Close(); + + FLOG(_L("CFotaUpdate::~CFotaUpdate <<")); + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::NewL +// --------------------------------------------------------------------------- +// +CFotaUpdate* CFotaUpdate::NewL(CFotaServer* aServer) + { + CFotaUpdate* ao = new (ELeave) CFotaUpdate(); + ao->iFotaServer = aServer; + return ao; + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::CheckUpdateResults +// Checks if there is update result file available (meaning that update just +// took place) +// --------------------------------------------------------------------------- +// +TBool CFotaUpdate::CheckUpdateResults(RFs& aRfs) + { + RFile f; + TInt err; + err = f.Open(aRfs, KUpdateResultFile, EFileShareAny); + f.Close(); + if (err != KErrNone) + { + return EFalse; + } + FLOG(_L(" CFotaUpdate::CheckUpdateResults update result file Found! ")); + return ETrue; + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::ExecuteUpdateResultFileL +// Read result code from update result file and update state accordingly. +// Show notifier "Update succesful". Do some cleanup. +// --------------------------------------------------------------------------- +// +void CFotaUpdate::ExecuteUpdateResultFileL() + { + FLOG(_L("CFotaUpdate::ExecuteUpdateResultFileL >>")); + + TInt err; + RFileReadStream rstr; + TInt result; + TInt msglen; + HBufC8* message = NULL; + HBufC16* message16 = NULL; + TBool deleteData(EFalse); + + // Open update result file + FLOG(_L("opening rstr 1/2 ")); + err = rstr.Open(iFotaServer->iFs, KUpdateResultFile, EFileRead + | EFileStream); + FLOG(_L("opened rstr 2/2 ")); + if (err) + FLOG(_L(" update result file open err %d"), err); + User::LeaveIfError(err); + FLOG(_L(" 0.1")); + CleanupClosePushL(rstr); + FLOG(_L(" 0.2")); + + // Read resultcode + result = rstr.ReadUint32L(); + msglen = rstr.ReadUint32L(); + if (msglen != 0) + { + message = HBufC8::NewLC(msglen + 1); + TPtr8 ptrdesc = message->Des(); + TRAPD ( err2, rstr.ReadL(ptrdesc) ); + if (err2 != KErrNone && err2 != KErrEof) + { + FLOG(_L(" file read err %d"), err2); + User::Leave(err2); + } + + message16 = HBufC16::NewLC(message->Des().Length()); + message16->Des().Copy(*message); + FLOG(_L(" 1 update result: %d"), result); + FLOG(_L(" 2 dbg msg: %S"), message16); + CleanupStack::PopAndDestroy(message16); + CleanupStack::PopAndDestroy(message); + } + + FLOG(_L(" 0.6 ")); + CleanupStack::PopAndDestroy(&rstr); + + // Map resultcode to FUMO result code + RFotaEngineSession::TState fstate = RFotaEngineSession::EUpdateFailed; + RFotaEngineSession::TResult fresult = + RFotaEngineSession::EResUpdateFailed; + + FLOG(_L(" 3")); + switch (result) + { + case UPD_OK: + { + fstate = RFotaEngineSession::EUpdateSuccessfulNoData; + fresult = RFotaEngineSession::EResSuccessful; + deleteData = ETrue; + ShowDialogL(EFwUpdSuccess); + } + break; + case UPD_INSTALL_REQUEST_IS_INVALID: + { + fstate = RFotaEngineSession::EUpdateFailedNoData; + fresult = RFotaEngineSession::EResUpdateFailed; + deleteData = ETrue; + ShowDialogL(EFwUpdNotCompatible); + } + break; + case UPD_UPDATE_PACKAGE_IS_ABSENT: + { + fstate = RFotaEngineSession::EUpdateFailedNoData; + fresult = RFotaEngineSession::EResUpdateFailed; + ShowDialogL(EFwUpdNotCompatible); + } + break; + case UPD_UPDATE_PACKAGE_IS_CORRUPTED: + { + fstate = RFotaEngineSession::EUpdateFailedNoData; + fresult = RFotaEngineSession::EResCorruptedFWUPD; + deleteData = ETrue; + ShowDialogL(EFwUpdNotCompatible); + } + break; + case UPD_UPDATE_PACKAGE_CONTENTS_IS_INVALID: + { + fstate = RFotaEngineSession::EUpdateFailedNoData; + fresult = RFotaEngineSession::EResCorruptedFWUPD; + deleteData = ETrue; + ShowDialogL(EFwUpdNotCompatible); + } + break; + case UPD_UPDATE_PACKAGE_IS_NOT_COMPATIBLE_WITH_CURRENT_MOBILE_DEVICE: + { + fstate = RFotaEngineSession::EUpdateFailedNoData; + fresult = RFotaEngineSession::EResPackageMismatch; + deleteData = ETrue; + ShowDialogL(EFwUpdNotCompatible); + } + break; + case UPD_FATAL_ERROR: + { + fstate = RFotaEngineSession::EUpdateFailedNoData; + fresult = RFotaEngineSession::EResUpdateFailed; + deleteData = ETrue; + ShowDialogL(EFwUpdNotCompatible); + } + break; + + default: + { + FLOG(_L(" 3.1 invalid result: %d"), result); + fstate = RFotaEngineSession::EUpdateFailedNoData; + fresult = RFotaEngineSession::EResUpdateFailed; + deleteData = ETrue; + ShowDialogL(EFwUpdNotCompatible); + } + break; + } + + // Find the state 60 (update progressing) -> 100 (etc) + RArray states; + TPackageState state; + CleanupClosePushL(states); + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iDatabase->GetAllL(states); + + FLOG(_L(" 4.1 found %d states "), states.Count()); + for (TInt i = 0; i < states.Count(); ++i) + { + TPackageState tmp; + TBuf8 tmpurl; + tmp = iFotaServer->iDatabase->GetStateL(states[i], tmpurl); + FLOG(_L(" 5 got state ")); + if (tmp.iState == RFotaEngineSession::EUpdateProgressing) + { + state = tmp; + state.iState = fstate; + state.iResult = fresult; + FLOG(_L(" 6 Updating state id %d to %d ,result %d "), + state.iPkgId, state.iState, state.iResult); + iFotaServer->iDatabase->SetStateL(state, KNullDesC8, EFDBState + | EFDBResult); + } + } + iFotaServer->iDatabase->CloseAndCommitDB(); + CleanupStack::PopAndDestroy(&states); + + // Delete request file + err = BaflUtils::DeleteFile(iFotaServer->iFs, KUpdateRequestFile); + if (err != KErrNone && err != KErrNotFound) + { + FLOG(_L(" 6.1 req file deleted, err %d"), err); + User::Leave(err); + } + + // Write timestamp (shown to user in device management ui) + if (fresult == RFotaEngineSession::EResSuccessful) + { + RFileWriteStream wstr; + TTime time; + User::LeaveIfError(wstr.Replace(iFotaServer->iFs, + KUpdateTimeStampFileName, EFileWrite)); + CleanupClosePushL(wstr); + time.HomeTime(); + TInt year = time.DateTime().Year(); + TInt month = time.DateTime().Month(); + TInt day = time.DateTime().Day(); + TInt hour = time.DateTime().Hour(); + TInt minute = time.DateTime().Minute(); + wstr.WriteInt32L(year); + wstr.WriteInt32L(month); + wstr.WriteInt32L(day); + wstr.WriteInt32L(hour); + wstr.WriteInt32L(minute); + CleanupStack::PopAndDestroy(1); // wstr + } + // Delete package content + if (deleteData && state.iPkgId > KErrNotFound) + { + iFotaServer->DeletePackageL(state.iPkgId); + DeleteUpdateResultFileL(); + } + + // Report state back to syncml server + if (state.iPkgId >= 0) + { + FLOG(_L(" 6.1 creating device mgmt session for profile %d"), + state.iProfileId); + iFotaServer->ReportFwUpdateStatusL(state); + } + else + { + FLOG(_L(" No state found in 'update progress' mode! cannot report status to DM server ")); + } + + FLOG(_L("CFotaUpdate::ExecuteUpdateResultFileL <<")); + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::DeleteUpdateResultsL +// --------------------------------------------------------------------------- +// +void CFotaUpdate::DeleteUpdateResultFileL() + { + FLOG(_L("CFotaUpdate::DeleteUpdateResultsL >>")); + // Delete result file + RFs fs; + __LEAVE_IF_ERROR(fs.Connect()); + BaflUtils::DeleteFile(fs, KUpdateResultFile); + BaflUtils::DeleteFile(fs, KUpdateRequestFile); + BaflUtils::DeleteFile(fs, KUpdateBitmap); + BaflUtils::DeleteFile(fs, KRestartingBitmap); + fs.Close(); + FLOG(_L("CFotaUpdate::DeleteUpdateResultsL <<")); + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::UpdateL +// Updates the fw: Creates input files for update agent and boots device to +// update mode. +// --------------------------------------------------------------------------- +void CFotaUpdate::UpdateL() + { + FLOG(_L("CFotaUpdate::UpdateL() >>")); + // Set state ........................................ + iFotaServer->iPackageState.iState + = RFotaEngineSession::EUpdateProgressing; + iFotaServer->iDatabase->OpenDBL(); + iFotaServer->iDatabase->SetStateL(iFotaServer->iPackageState, KNullDesC8, + EFDBState); + iFotaServer->iDatabase->CloseAndCommitDB(); + + // Write update request for update agent.............. + FLOG(_L("CFotaUpdate::UpdateL 1 writing update.req ")); + TBuf16 dp2filepath; + HBufC16* dp2; + RFileWriteStream wstr; + CleanupClosePushL(wstr); + FLOG(_L("CFotaUpdate::UpdateL 2 getting pkg location")); + iFotaServer->DownloaderL()->GetUpdatePackageLocation(dp2filepath); + + FLOG(_L("CFotaUpdate::UpdateL 3 craeting update.req")); + User::LeaveIfError(wstr.Replace(iFotaServer->iFs, KUpdateRequestFile, + EFileWrite)); + wstr.WriteInt16L(1); // version number is 1 + wstr.WriteInt32L(1); // count of cmds is 1 + wstr.WriteInt16L(0); // requestid is 0 + + dp2 = HBufC16::NewLC(dp2filepath.Length()); + dp2->Des().Copy(dp2filepath); + wstr.WriteInt32L(dp2->Des().Length() + 1); // length of filename + null + wstr.WriteL(dp2->Des()); + wstr.WriteInt16L(0); // null character + CleanupStack::PopAndDestroy(dp2); + CleanupStack::PopAndDestroy(&wstr); // wstr + + FLOG(_L("CFotaUpdate::UpdateL 4 craeting update.bmp")); + + + // Write update graphic for update agent ............... + HBufC* updatetxt; + HBufC* restarttxt; + QString installstr = hbTrId("txt_device_update_info_installing"); + QString rebootstr = hbTrId("txt_device_update_info_rebooting"); + updatetxt = XQConversions::qStringToS60Desc(installstr); + restarttxt = XQConversions::qStringToS60Desc(rebootstr); + + WriteUpdateBitmapL( updatetxt->Des(), KUpdateBitmap ); + WriteUpdateBitmapL( restarttxt->Des(), KRestartingBitmap ); + delete updatetxt; + delete restarttxt; + + // Simulate update agent by writing result file. + CRepository* centrep(NULL); + TInt err = KErrNone; + TRAP(err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + TInt simulate(KErrNotFound); + if (centrep) + { + err = centrep->Get(KSimulateUpdateAgent, simulate); + } + delete centrep; + if (simulate > 0) + { + FLOG(_L("CFotaUpdate::UpdateL 5 - writing update.resp")); + RFileWriteStream respstr; + CleanupClosePushL(respstr); + User::LeaveIfError(respstr.Replace(iFotaServer->iFs, + KUpdateResultFile, EFileWrite)); + + respstr.WriteUint32L(UPD_OK); + respstr.WriteUint32L(15); + respstr.WriteL(_L("UPDATE DONE!")); + CleanupStack::PopAndDestroy(&respstr); + } + + iFotaServer->SetStartupReason(EFotaDefault); + + RStarterSession starter; + FLOG(_L(" starter->Connect")); + User::LeaveIfError(starter.Connect()); + starter.Reset(RStarterSession::EFirmwareUpdate); + starter.Close(); + FLOG(_L("CFotaUpdate::UpdateL() <<")); + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::CheckBatteryL() +// Cheks if there's enough battery power to update +// --------------------------------------------------------------------------- +// +TBool CFotaUpdate::CheckBatteryL() + { + FLOG(_L("CFotaUpdate::CheckBatteryL >>")); + + TInt chargingstatus(EChargingStatusError); + TInt batterylevel(EBatteryLevelUnknown); + TBool enoughPower(EFalse); + + // Read battery level + + RProperty pw; + User::LeaveIfError(pw.Attach(KPSUidHWRMPowerState, KHWRMBatteryLevel)); + User::LeaveIfError(pw.Get(batterylevel)); + + if (batterylevel >= BatteryLevelAccepted) + { + FLOG(_L("Battery charge is above acceptable level!")); + enoughPower = ETrue; + } + else + { + + //Read charger status + User::LeaveIfError(pw.Attach(KPSUidHWRMPowerState, + KHWRMChargingStatus)); + User::LeaveIfError(pw.Get(chargingstatus)); + pw.Close(); + + // But charger is connected, power sufficient + if (chargingstatus == EChargingStatusCharging || chargingstatus + == EChargingStatusAlmostComplete || chargingstatus + == EChargingStatusChargingComplete || chargingstatus + == EChargingStatusChargingContinued) + { + FLOG( + _L("Battery charge is below acceptable level, but charger is connected!")); + enoughPower = ETrue; + } + } + + FLOG(_L("CFotaUpdate::CheckBattery, current charge = %d, ret = %d <<"), + batterylevel, enoughPower); + return enoughPower; + } + +void CFotaUpdate::MonitorBatteryChargeLevel() + { + FLOG(_L("CFotaUpdate::MonitorBatteryChargeLevel >>")); + + CancelMonitor(); + + iProperty.Attach(KPSUidHWRMPowerState, KHWRMBatteryLevel); + TInt value = 0; + + iProperty.Get(KPSUidHWRMPowerState, KHWRMBatteryLevel, value); + + FLOG(_L("Battery level at this time is %d, err = %d"), value); + iStatus = KRequestPending; + iProperty.Subscribe(iStatus); + + iMonitorType = BatteryLevel; + SetActive(); + + FLOG(_L("CFotaUpdate::MonitorBatteryChargeLevel <<")); + } + +void CFotaUpdate::MonitorBatteryChargingStatus() + { + FLOG(_L("CFotaUpdate::MonitorBatteryChargingStatus >>")); + + CancelMonitor(); + + iProperty.Attach(KPSUidHWRMPowerState, KHWRMChargingStatus); + TInt value = 0; + + iProperty.Get(KPSUidHWRMPowerState, KHWRMChargingStatus, value); + + FLOG(_L("Charging status at this time is %d, err = %d"), value); + iStatus = KRequestPending; + iProperty.Subscribe(iStatus); + + iMonitorType = ChargingStatus; + SetActive(); + + FLOG(_L("CFotaUpdate::MonitorBatteryChargingStatus <<")); + } + +void CFotaUpdate::CancelMonitor() + { + FLOG(_L("CFotaUpdate::CancelMonitor >>")); + if (IsActive()) + { + FLOG(_L("Cancelling....")); + Cancel(); + } + FLOG(_L("CFotaUpdate::CancelMonitor <<")); + } + +TBool CFotaUpdate::IsUSBConnected() + { + FLOG(_L("CFotaUpdate::IsUSBConnected >>")); + + TBool ret (EFalse); + TUsbDeviceState state(EUsbDeviceStateUndefined); + RUsb usbman; + TInt err = usbman.Connect(); + if (err == KErrNone) + { + usbman.GetDeviceState(state); + usbman.Close(); + } + if (state != EUsbDeviceStateUndefined) + ret = ETrue; + + FLOG(_L("CFotaUpdate::IsUSBConnected, value = %d, ret = %d <<"), state, ret); + return ret; + } + +void CFotaUpdate::RunL() + { + FLOG(_L("CFotaUpdate::RunL >>")); + + if (iStatus.Int() == KErrNone) + { + TInt value = 0; + + if (iMonitorType == BatteryLevel) + { + iProperty.Get(KPSUidHWRMPowerState, KHWRMBatteryLevel, + value); + + FLOG(_L("Battery level has changed to %d"), value); + + iFotaServer->UpdateBatteryLowInfo( + (value >= BatteryLevelAccepted) ? EFalse : ETrue); + + MonitorBatteryChargeLevel(); + } + else if (iMonitorType == ChargingStatus) + { + iProperty.Get(KPSUidHWRMPowerState, KHWRMChargingStatus, + value); + + FLOG(_L("Charging status has changed to %d"), value); + + if (value == EChargingStatusCharging || value + == EChargingStatusAlmostComplete || value + == EChargingStatusChargingComplete || value + == EChargingStatusChargingContinued) + { + if (IsUSBConnected()) + { + ShowDialogL(EFwUpdNotEnoughBattery); + } + else + { + iFotaServer->UpdateBatteryLowInfo(EFalse); + } + } + else + { + iFotaServer->UpdateBatteryLowInfo(ETrue); + } + } + + } + FLOG(_L("CFotaUpdate::RunL, iStatus = %d <<"), iStatus.Int()); + } + +// --------------------------------------------------------------------------- +// CFotaUpdate::StartUpdateL +// Starts fw updating (shows a notifier to user). +// --------------------------------------------------------------------------- +// +void CFotaUpdate::StartUpdateL(const TDownloadIPCParams &aParams) + { + FLOG(_L("CFotaUpdate::StartUpdateL, pkig:%d >>"), aParams.iPkgId); + + //First cancel any ongoing battery monitoring. + CancelMonitor(); + + UpdateL(); + + FLOG(_L("CFotaUpdate::StartUpdateL <<")); + } + +TInt CFotaUpdate::RunError(TInt aError) + { + FLOG(_L("CFotaUpdate::RunError, error = %d >>"), aError); + return aError; + } + +void CFotaUpdate::DoCancel() + { + FLOG(_L("CFotaUpdate::DoCancel >>")); + + iProperty.Cancel(); + + FLOG(_L("CFotaUpdate::DoCancel <<")); + } + +void CFotaUpdate::ShowDialogL(TFwUpdNoteTypes aDialogid) + { + FLOG(_L("CFotaUpdate::ShowDialogL, dialogid = %d >>"), aDialogid); + iFotaServer->ServerCanShut(EFalse); + + if (iFotaServer->FullScreenDialog()) + iFotaServer->FullScreenDialog()->Close(); + + iNotifParams = CHbSymbianVariantMap::NewL(); + + HBufC* keyDialog = HBufC::NewL(10); + CleanupStack::PushL(keyDialog); + *keyDialog = KKeyDialog; + + CHbSymbianVariant* dialogId = CHbSymbianVariant::NewL(&aDialogid, + CHbSymbianVariant::EInt); + iNotifParams->Add(*keyDialog, dialogId); + iNotifier = CFotaDownloadNotifHandler::NewL(this); + + iNotifier->LaunchNotifierL(iNotifParams, aDialogid); + + CleanupStack::PopAndDestroy(); + FLOG(_L("CFotaUpdate::ShowDialogL <<")); + } + +void CFotaUpdate::HandleDialogResponse(int response, TInt aDialogId) + { + FLOG(_L("CFotaUpdate::HandleDialogResponse, dialogid = %d response = %d >>"), aDialogId, response); + + if (aDialogId == EFwUpdNotEnoughBattery) + { + iFotaServer->FinalizeUpdate(); + } + + FLOG(_L("CFotaUpdate::HandleDialogResponse <<")); + } + +TInt CFotaUpdate::WriteUpdateBitmapL( const TDesC& aText, const TDesC& aFile) + { + FLOG(_L("WriteUpdateBitmapL writing %S to %S w/ txtdir"),&aText,&aFile); + + TSize screensize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels(); + TInt width = screensize.iWidth - KBmpMargin*2; + TInt height = screensize.iHeight; + + CArrayFixSeg* lines = new CArrayFixSeg(5); + CleanupStack::PushL(lines); + CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap; + CleanupStack::PushL( bitmap ); + bitmap->Create( TSize(width,height), EColor64K ); + CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( bitmap ); + CleanupStack::PushL( device ); + const CFont* font = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont); + CFbsBitGc* context; + User::LeaveIfError( device->CreateContext( context ) ); + CleanupStack::PushL( context ); + TInt ascent = font->AscentInPixels(); + TInt descent = font->DescentInPixels(); + context->UseFont ( font ); + context->Clear(); // bg color + + // Visually ordered text + HBufC* wrappedstring = AknBidiTextUtils::ConvertToVisualAndWrapToArrayL( + aText, width,*font, *lines); + CleanupStack::PushL ( wrappedstring ); + TBool dirfound (ETrue); + // direction of text, affects alignemnt + TBidiText::TDirectionality direction = TBidiText::TextDirectionality( + *wrappedstring, &dirfound ); + + // Print visual text to bitmap + for ( TInt i=0; iCount(); ++i ) + { + TPtrC l = (*lines)[i]; + TInt top = (ascent+descent)*(i); + TInt bot = (ascent+descent)*(i+1); + TRect rect (0, top ,width, bot ); + CGraphicsContext::TTextAlign alignment = + direction==TBidiText::ELeftToRight ? CGraphicsContext::ELeft + : CGraphicsContext::ERight; + context->DrawText(l, rect, ascent, alignment); + } + height = (ascent+descent)*lines->Count() + descent; + bitmap->Resize( TSize(width,height)); + bitmap->Save( aFile ); + context->DiscardFont(); + CleanupStack::PopAndDestroy( wrappedstring ); + CleanupStack::PopAndDestroy( context ); + CleanupStack::PopAndDestroy( device ); + CleanupStack::PopAndDestroy( bitmap ); + CleanupStack::PopAndDestroy( lines ); + return 1; + } diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/fsview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/fsview.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + +#include "fsview.h" +#include "fotaserver.h" + +// ------------------------------------------------------------------------------------------------ +// FSView::FSView() +// ------------------------------------------------------------------------------------------------ +FSView::FSView() + { + + } +// ------------------------------------------------------------------------------------------------ +// FSView::~FSView() +// ------------------------------------------------------------------------------------------------ +FSView::~FSView() + { + + } +// ------------------------------------------------------------------------------------------------ +// FSView::eventFilter() +// ------------------------------------------------------------------------------------------------ +bool FSView::eventFilter(QObject *object, QEvent *event) +{ + switch (event->type()) + { + case QEvent::ApplicationActivate: + { +// RDEBUG( "eventFilter: QEvent::ApplicationActivate start" ); + iServer->SetVisible(ETrue); +// RDEBUG( "eventFilter: end" ); + break; + } + default: + break; + } +return HbView::eventFilter(object, event); +} + + + +void FSView::SetServer(CFotaServer * aServer) +{ + iServer = aServer; +} diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/fotaserver/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/fotaserver/src/main.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2000 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 applicationmanagement components + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include "FotaServer.h" +#include "FotaSrvDebug.h" +#include "fsview.h" + +int main(int argc, char *argv[]) + { + FLOG(_L("CFotaServer::Main >>")); + + FLOG(_L("CFotaServer::HbApplication >>")); + HbApplication a(argc, argv); + + FSView* view = new FSView(); + FLOG(_L("CFotaServer::HbView >>")); + view->hideItems(Hb::AllItems); + FLOG(_L("CFotaServer::hideItems >>")); + view->setContentFullScreen(); + FLOG(_L("CFotaServer::setContentFullScreen >>")); + + HbMainWindow mainWindow(0, Hb::WindowFlagTransparent); + FLOG(_L("CFotaServer::mainWindow >>")); + + HbTransparentWindow *transparentWindow = new HbTransparentWindow; + FLOG(_L("CFotaServer::transparentWindow >>")); + HbStackedLayout *stackedLayout = new HbStackedLayout; + FLOG(_L("CFotaServer::stackedLayout >>")); + stackedLayout->addItem(transparentWindow); + FLOG(_L("CFotaServer::addItem >>")); + view->setLayout(stackedLayout); + FLOG(_L("CFotaServer::setLayout >>")); + + mainWindow.addView(view); + FLOG(_L("CFotaServer::addView >>")); + mainWindow.setCurrentView(view); + mainWindow.lower(); + FLOG(_L("CFotaServer::setCurrentView >>")); + + // create the server (leave it on the cleanup stack) + CFotaServer* server = CFotaServer::NewInstance(mainWindow); + + if (server == NULL) + { + return 0; + } + + mainWindow.show(); + + FLOG(_L("CFotaServer::show <<")); + //app.installEventFilter(view); + RSemaphore sem; + TInt ret = sem.OpenGlobal(KFotaServerScem); + FLOG(_L("CFotaServer::OpenGlobal >>")); + + FLOG(_L("CFotaServer::showMaximized <<")); + + QTranslator *translator = new QTranslator(); + QString lang = QLocale::system().name(); + QString path = "Z:/resource/qt/translations/"; + bool fine = translator->load("deviceupdates_" + lang, path); + if (fine) + qApp->installTranslator(translator); + + QTranslator *commontranslator = new QTranslator(); + fine = commontranslator->load("common_" + lang, path);/*finally required once localisation available*/ + if(fine) + qApp->installTranslator(commontranslator); + else + qDebug("fotaserver common translator loading failed"); + + a.setApplicationName("FotaServer"); + + + view->SetServer(server); + a.installEventFilter(view); + + + // Initialisation complete, now signal the client + if (ret == KErrNone) + { + sem.Signal(); + FLOG(_L("CFotaServer::Signal <<")); + sem.Close(); + FLOG(_L("CFotaServer::Close <<")); + } + FLOG(_L("CFotaServer::KErrNone <<")); + //This will install and start a active scheduler for this thread. + ret = a.exec(); + + RProperty::Set(TUid::Uid(KOmaDMAppUid), KFotaServerActive, 0); + delete server; + FLOG(_L("CFotaServer::Main <<")); + return ret; + } diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/group/bld.inf --- a/fotaapplication/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/fotaapplication/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -16,12 +16,50 @@ * */ +PRJ_PLATFORMS +DEFAULT + +#ifdef __SYNCML_DM_FOTA + +PRJ_EXPORTS +../rom/fotaserver.iby CORE_MW_LAYER_IBY_EXPORT_PATH(fotaserver.iby) +../rom/fotaserverresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(fotaserverresources.iby) -#ifdef __SYNCML_DM_FOTA -#include "../fotaserver/group/bld.inf" +// Generic configuration interface for component cenrep settings +../conf/fotadiskstorage.confml MW_LAYER_CONFML(fotadiskstorage.confml) +../conf/CI_fotadiskstorage.confml MW_LAYER_CONFML(CI_fotadiskstorage.confml) +../conf/fotadiskstorage_102072C6.crml MW_LAYER_CRML(fotadiskstorage_102072C6.crml) +../conf/fotaserver.confml MW_LAYER_CONFML(fotaserver.confml) +../conf/CI_fotaserver.confml MW_LAYER_CONFML(CI_fotaserver.confml) +../conf/fotaserver_102072C4.crml MW_LAYER_CRML(fotaserver_102072C4.crml) + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv + OPTION TARGETFILE fotaserver.mif + OPTION HEADERFILE fotaserver.mbg + OPTION SOURCES \ + -c8,8 qgn_prop_sml_http -c8,8 qgn_prop_sml_http_off -c8,8 qgn_prop_sml_bt \ + -c8,8 qgn_prop_sml_bt_off -c8,8 qgn_prop_sml_usb -c8,8 qgn_prop_sml_usb_off \ + -c8,8 qgn_menu_dm_cxt -c8,8 qgn_menu_dm_disabled_cxt -c8,8 qgn_note_sml \ + -c8,8 qgn_note_sml_server +END + +START EXTENSION s60/mifconv + OPTION TARGETFILE fotaserver_aif.mif + OPTION SOURCES -c8,8 qgn_menu_dm +END + + +PRJ_MMPFILES + +../FotaEngine/group/fotaengine.mmp +../fmsclient/group/fmsclient.mmp +../fmserver/group/fmsserver.mmp +../FotaScheduleHandler/group/fotaschedulehandler.mmp + #endif #if ( defined (__SYNCML_DM ) || defined (__PLUG_AND_PLAY_MOBILE_SERVICES) ) -#include "../fotaserver/fotacustcmds/group/bld.inf" +#include "../fotacustcmds/group/bld.inf" #endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/inc/FotaIPCTypes.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/inc/FotaIPCTypes.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2005-2006 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: interprocess messages +* +*/ + + + +// INCLUDES +#include "FotaIPCTypes.h" +#include +#include "fotaserverPrivateCRKeys.h" + +// ======================= MEMBER FUNCTIONS ================================== + +// --------------------------------------------------------------------------- +// TDownloadIPCParams::TDownloadIPCParams +// --------------------------------------------------------------------------- +TDownloadIPCParams::TDownloadIPCParams () : iPkgId(-1),iProfileId(0) + , iSendAlert(ETrue) + , iIapId(-1), iPkgSize(0), iSessionType(0), iUpdateLtr (0) +{ + iPkgName = KNullDesC8; + iPkgVersion = KNullDesC8; +} + +// --------------------------------------------------------------------------- +// TDownloadIPCParams::TDownloadIPCParams +// --------------------------------------------------------------------------- +TDownloadIPCParams::TDownloadIPCParams (const TDownloadIPCParams& p ) + : iPkgId ( p.iPkgId ), iProfileId (p.iProfileId ) + , iSendAlert( p.iSendAlert ) + , iIapId(p.iIapId), iPkgSize(p.iPkgSize), iSessionType(p.iSessionType), iUpdateLtr (p.iUpdateLtr) + { + iPkgName = p.iPkgName; + iPkgVersion = p.iPkgVersion; + } + + + +// --------------------------------------------------------------------------- +// TPackageState::TPackageState +// --------------------------------------------------------------------------- +TPackageState::TPackageState( RFotaEngineSession::TState aState, TInt aResult) + : TDownloadIPCParams (), iState(aState), iResult(aResult) + ,iSmlTryCount( KDefaultSmlTryCount ) + { + } + + +// --------------------------------------------------------------------------- +// TPackageState::TPackageState +// --------------------------------------------------------------------------- +TPackageState::TPackageState( RFotaEngineSession::TState aState) + : TDownloadIPCParams (), iState(aState), iResult(-1) + ,iSmlTryCount( KDefaultSmlTryCount ) + { + SetSmlTryCount(); + } + + +// --------------------------------------------------------------------------- +// TPackageState::TPackageState +// --------------------------------------------------------------------------- +TPackageState::TPackageState( TDownloadIPCParams p) : + TDownloadIPCParams(p),iState(RFotaEngineSession::EIdle), iResult(-1) + ,iSmlTryCount( KDefaultSmlTryCount ) + { + SetSmlTryCount(); + + } + + +// --------------------------------------------------------------------------- +// TPackageState::TPackageState +// --------------------------------------------------------------------------- +TPackageState::TPackageState() : TDownloadIPCParams () + ,iState(RFotaEngineSession::EIdle), iResult(-1) + ,iSmlTryCount( KDefaultSmlTryCount ) + { + SetSmlTryCount(); + } + + +// --------------------------------------------------------------------------- +// TPackageState::SetSmlTryCount() +// --------------------------------------------------------------------------- +void TPackageState::SetSmlTryCount() +{ + TInt err = KErrNone; + TInt retry = 0; + CRepository *centrep = NULL; + TRAP(err, centrep = CRepository::NewL( KCRUidFotaServer ) ); + if ( centrep ) + { + err = centrep->Get( KGenericAlertRetries, retry ); + delete centrep; centrep = NULL; + } + if(err == KErrNone) + { + + if(retry < 0 ) + { + iSmlTryCount = KDefaultSmlTryCount; + } + else if( retry == 0 ) + { + iSmlTryCount = 2 ; + } + else if (retry > KMaximumSmlTryCount ) + { + iSmlTryCount = KMaximumSmlTryCount + 1; + } + else + { + iSmlTryCount = retry + 1; + } + } + else + { + iSmlTryCount = KDefaultSmlTryCount; + } +} + + +// --------------------------------------------------------------------------- +// TPackageState::operator= +// --------------------------------------------------------------------------- +TPackageState& TPackageState::operator= ( const TDownloadIPCParams& a ) + { + iPkgId = a.iPkgId; + iProfileId = a.iProfileId; + iPkgName = a.iPkgName; + iPkgVersion = a.iPkgVersion; + iIapId = a.iIapId; + iPkgSize = a.iPkgSize; + iSessionType= a.iSessionType; + iUpdateLtr = a.iUpdateLtr; + + return *this; + } + + +// --------------------------------------------------------------------------- +// TPackageState::operator= +// --------------------------------------------------------------------------- +TPackageState& TPackageState::operator=(const TPackageState& a) + { + iPkgId = a.iPkgId; + iProfileId = a.iProfileId; + iPkgName = a.iPkgName; + iPkgVersion = a.iPkgVersion; + iIapId = a.iIapId; + iPkgSize = a.iPkgSize; + iSessionType= a.iSessionType; + iUpdateLtr = a.iUpdateLtr; + iState = a.iState; + iResult = a.iResult; + iSmlTryCount= a.iSmlTryCount; + return *this; + } + + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/inc/FotaIPCTypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/inc/FotaIPCTypes.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,223 @@ +/* +* Copyright (c) 2005-2006 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 fotaserver component +* This is part of fotaapplication. +* +*/ + + + +#ifndef __FOTAIPCTYPES_H_ +#define __FOTAIPCTYPES_H_ + +// INCLUDES +#include +#include +#include "fotaengine.h" + +// DATA TYPES +typedef TBuf16<200> TPkgIdList; + +/** + * Inter process parameters for fotaserver + * + * @lib fotaengine.lib + * @since S60 v3.1 + */ +class TDownloadIPCParams + { + +public: + TDownloadIPCParams (); + + + /** + * Copy constructor. + * + * @since S60 v3.1 + * @param p Copy of another ipc + * @return None + */ + TDownloadIPCParams (const TDownloadIPCParams& p ); + + + /** + * Package id + */ + TInt iPkgId; + + /** + * Profile id + */ + TSmlProfileId iProfileId; + + + /** + * Package name + */ + TBuf8 iPkgName; + + + /** + * Package version + */ + TBuf8 iPkgVersion; + + + /** + * Should DM server be notified via generic alert. + * This is not saved to database! + */ + TBool iSendAlert; + + + /** + * IAP Id used + */ + TInt iIapId; + + /** + * Total size of the package + */ + TUint iPkgSize; + + + /** + * DM Session type + */ + TInt iSessionType; + + + /** + * Should update happen later? + */ + TBool iUpdateLtr; + }; + + +/** + * Extended inter process parameters for fotaserver + * + * @lib fotaengine.lib + * @since S60 v3.1 + */ +class TPackageState : public TDownloadIPCParams + { + +public: + + + /** + * Constructor + * + * @since S60 v3.1 + * @param aState State + * @param aResult Result + * @return None + */ + TPackageState( RFotaEngineSession::TState aState, TInt aResult); + + + /** + * Constructor + * + * @since S60 v3.1 + * @param aState State + * @return None + */ + TPackageState( RFotaEngineSession::TState aState); + + + /** + * Constructor + * + * @since S60 v3.1 + * @param p Ipc params + * @return None + */ + TPackageState( TDownloadIPCParams p); + + TPackageState(); + + /** + * Assignment operator + * + * @since S60 v3.1 + * @param a Source + * @return None + */ + TPackageState& operator=(const TDownloadIPCParams& a); + + + /** + * Assignment operator + * + * @since S60 v3.1 + * @param a Source + * @return None + */ + TPackageState& operator=(const TPackageState& a); + + +public: + + /** + * State (see FUMO specification) + */ + RFotaEngineSession::TState iState; + + + /** + * Result code (FUMO) + */ + TInt iResult; + + /** + * Counter for generic alert raporting. If raporting fails, try again in + * successive boots until counter runs to 0 + */ + TInt iSmlTryCount; + +private : + /* + * Method to set the iSmlTryCount depending on Cenrep settings + */ + void SetSmlTryCount(); +}; + + + +/** + * Update reminder task + * + * @lib fotaengine.lib + * @since S60 v3.1 + */ +class TFotaScheduledUpdate +{ + public: + TFotaScheduledUpdate(const TInt aPkgId, const TInt aScheduleId) + { + iPkgId = aPkgId; + iScheduleId = aScheduleId; + } + + TInt iPkgId; + + TInt iScheduleId; +}; + +#endif // __FOTAIPCTYPES_H_ + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/inc/fmsclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/inc/fmsclientserver.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,53 @@ +/* +* 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 fotaserver component +* This is part of fotaapplication. +* +*/ + +// FMSClientServer.h +// +// +#ifndef __FMS_CLIENTSERVER_H__ +#define __FMS_CLIENTSERVER_H__ + +#include +#include +#include +// server name + +_LIT(KFMSServerName,"FMSServer"); + +//const TUid KFMSServerUid={0x200100C8}; //To be moved to fotaconst.h + +enum TFmsIpcCommands +{ + ENoInterrupt = 0, // Not to be used for IPC. + //For starting of the FMS monitoring during phone startup + EFotaStartUpPlugin = 1, //as continuation to upper enums + //For all download related interrupts + EDLUserInterrupt = 10, + EDLNetworkInterrupt, + EDLMemoryInterrupt, + EDLGeneralInterrupt, + + //For all update related interrupts + EUpdMonitorbattery = 20, + EUpdPhoneCallActive, + EUpdMonitorPhoneCallEnd, + + //For canceling any outstanding request + ECancelOutstandingRequest = 30, +}; +#endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/rom/fotaserver.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/rom/fotaserver.iby Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2005-2006 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: Image description file for project fotaserver +* +*/ + + + +#ifndef ___FOTASERVER_IBY__ +#define ___FOTASERVER_IBY__ + + +#ifdef __SYNCML_DM_FOTA + +#include + +file=ABI_DIR\BUILD_DIR\fotaengine.dll SHARED_LIB_DIR\fotaengine.dll +file=ABI_DIR\BUILD_DIR\FMSClient.dll SHARED_LIB_DIR\FMSClient.dll + + +S60_APP_EXE(fotaserver) +SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,fotaserver) +S60_APP_AIF_ICONS(fotaserver) + + +file=ABI_DIR\BUILD_DIR\fotaschedulehandler.exe PROGRAMS_DIR\fotaschedulehandler.exe +file=ABI_DIR\BUILD_DIR\FMSServer.exe PROGRAMS_DIR\FMSServer.exe + +data=DATAZ_/private/10003a3f/import/apps/fotaserver_reg.rsc /private/10003a3f/import/apps/fotaserver_reg.rsc + + +#if ( defined (__SYNCML_DM ) || defined (__PLUG_AND_PLAY_MOBILE_SERVICES) ) + +file=ABI_DIR\BUILD_DIR\fotacustcmds.dll SHARED_LIB_DIR\fotacustcmds.dll + +#endif // __SYNCML_DM || __PLUG_AND_PLAY_MOBILE_SERVICES + +#endif // __SYNCML_DM_FOTA + +#endif diff -r a36219ae6585 -r 2e64dc50f295 fotaapplication/rom/fotaserverresources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fotaapplication/rom/fotaserverresources.iby Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2005-2006 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: Image description file for project fotaserver +* +*/ + + + +#ifndef ___FOTASERVERRESOURCES_IBY__ +#define ___FOTASERVERRESOURCES_IBY__ + +#ifdef __SYNCML_DM_FOTA +// Backup registration +#include + +data=DATAZ_/resource/apps/fotaserver.rsc /resource/apps/fotaserver.rsc +#endif // __SYNCML_DM_FOTA + +#endif diff -r a36219ae6585 -r 2e64dc50f295 group/bld.inf --- a/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -45,3 +45,6 @@ //remotemgmt_pub #include "../remotemgmt_pub/group/bld.inf" + +//devicemgmtnotifications +#include "../devicemgmtnotifications/group/bld.inf" \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 layers.sysdef.xml --- a/layers.sysdef.xml Tue Jul 13 09:37:43 2010 +0530 +++ b/layers.sysdef.xml Tue Jul 13 09:51:41 2010 +0530 @@ -1,13 +1,14 @@ - ]> - + + diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/Group/bld.inf --- a/omaprovisioning/provisioning/Group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/omaprovisioning/provisioning/Group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -38,93 +38,21 @@ // Generic configuration interface for component cenrep settings ../conf/s60provisioning.confml MW_LAYER_CONFML(provisioning.confml) +../conf/CI_s60provisioning.confml MW_LAYER_CONFML(CI_provisioning.confml) ../conf/s60provisioning_101F87AA.crml MW_LAYER_CRML(provisioning_101F87AA.crml) ../Rom/Provisioning.iby CORE_MW_LAYER_IBY_EXPORT_PATH(provisioning.iby) -//../rom/Provisioning_variant.iby CUSTOMER_MW_LAYER_IBY_EXPORT_PATH(provisioning_variant.iby) ../Rom/ProvisioningResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(provisioningresources.iby) ../loc/Provisioning.loc MW_LAYER_LOC_EXPORT_PATH(provisioning.loc) -../IMAdapter/loc/WPWVAdapter.loc MW_LAYER_LOC_EXPORT_PATH(wpwvadapter.loc) -../MbxNbrAdapter/loc/MailboxAdapter.loc MW_LAYER_LOC_EXPORT_PATH(mailboxadapter.loc) -../accesspointadapter/loc/WPAPAdapter.loc MW_LAYER_LOC_EXPORT_PATH(WPAPAdapter.loc) -../ProvisioningBC/loc/ProvisioningBC.loc MW_LAYER_LOC_EXPORT_PATH(provisioningbc.loc) -//../ProvisioningCx/loc/ProvisioningCx.loc MW_LAYER_LOC_EXPORT_PATH(provisioningcx.loc) -../StreamingAdapter/loc/StreamingAdapter.loc MW_LAYER_LOC_EXPORT_PATH(streamingadapter.loc) -../AuthTypePlugin/loc/Authtypeplugin.loc MW_LAYER_LOC_EXPORT_PATH(authtypeplugin.loc) - PRJ_EXTENSIONS -#ifdef SBSV2 - - -START EXTENSION s60/mifconv -OPTION TARGETFILE provisioningcx.mif -OPTION HEADERFILE provisioningcx.mbg -OPTION SOURCES -c8,8 qgn_menu_set_cxt.bmp -END - -#ifdef __SCALABLE_ICONS - START EXTENSION s60/mifconv - OPTION TARGETFILE provisioningcx_aif.mif - OPTION SOURCES -c8,8 qgn_menu_set.svg - END -#else - START EXTENSION s60/mifconv - OPTION TARGETFILE provisioningcx_aif.mbm - OPTION SOURCES -c8,8 qgn_menu_set_lst.bmp -c8,8 qgn_menu_set_cxt.bmp - END -#endif - -START EXTENSION s60/mifconv -OPTION TARGETFILE Authtypeplugin.mif -OPTION HEADERFILE Authtypeplugin.mbg -OPTION SOURCES -c8,8 qgn_prop_set_conn_config -END -#endif - PRJ_MMPFILES - ../ProvisioningEngine/Group/ProvisioningEngine.mmp ../ProvisioningParser/Group/ProvisioningParser.mmp ../ProvisioningHandler/Group/ProvisioningHandler.mmp - -../accesspointadapter/group/WPAPAdapter.mmp -//../WAPAdapter/group/WPWAPAdapter.mmp -//../IMAdapter/group/IMAdapter.mmp -../StreamingAdapter/group/StreamingAdapter.mmp -../MbxNbrAdapter/group/MbxNbrAdapter.mmp - - - -//../AuthtypePlugin/group/Authtypeplugin.mmp -//../AlwaysOnAdapter/group/AlwaysOnAdapter.mmp -//../cpdestinationnwadapter/group/wpdestinationnwadapter.mmp - -#ifdef __SMART_CARD_PROV -// ../ProvisioningSC/group/ProvisioningSC.mmp - commented -#endif - - -#ifndef SBSV2 - -gnumakefile ../ProvisioningCx/group/iconscxdc.mk - -#ifdef __SCALABLE_ICONS - // gnumakefile ../provisioningcx/group/Iconscxaifscalabledc.mk - commented -#else - // gnumakefile ../provisioningcx/group/Iconscxaifbitmaps.mk - commented -#endif - -//gnumakefile ../AuthtypePlugin/group/AuthtypepluginIcons.mk - commented - -#endif - - - - PRJ_TESTMMPFILES // End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/MbxNbrAdapter/Data/10207281.rss --- a/omaprovisioning/provisioning/MbxNbrAdapter/Data/10207281.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 1020 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 DLL interface & implementation description resource for -* this DLL. -* -*/ - - -// INCLUDES -#include - -#include "ProvisioningUIDs.h" - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// theInfo -// ECOM DLL interface & implementation description resource. -// -// ----------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x10207281; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KProvisioningAdapterInterface; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10207282; - version_no = 1; - display_name = "WAP Mbx Nbr PA"; // Use short name to save RAM and ROM space - default_data = ""; - opaque_data = "10"; // Adapter priority - } - }; - } - }; - } - -// End of File - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/MbxNbrAdapter/Data/WPMbxNbrAdapterResource.rss --- a/omaprovisioning/provisioning/MbxNbrAdapter/Data/WPMbxNbrAdapterResource.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2002 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 file. -* -*/ - - -// INCLUDES -#include -#include - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// Mailbox number adapter title resource. -// -// ----------------------------------------------------------------------------- -// -RESOURCE LBUF r_mailbox_number_adapter_title - { - txt = qtn_op_head_mailbox; - } - -// End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/MbxNbrAdapter/Group/MbxNbrAdapter.mmp --- a/omaprovisioning/provisioning/MbxNbrAdapter/Group/MbxNbrAdapter.mmp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Project definition file for mailbox number settings adapter. -* -*/ - - -#include - -#include - -TARGET wpmbxnbradapter.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10207281 -VENDORID VID_DEFAULT - -CAPABILITY CAP_ECOM_PLUGIN - -SOURCEPATH ../Src -SOURCE MbxNbrAdapter.cpp -SOURCE MbxNbrAdapterGroupProxy.cpp - -SOURCEPATH ../Data - -START RESOURCE 10207281.rss -TARGET wpmbxnbradapter.rsc -END - -START RESOURCE WPMbxNbrAdapterResource.rss -HEADER -TARGET wpmbxnbradapterresource.rsc -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -USERINCLUDE . -USERINCLUDE ../Inc -USERINCLUDE ../../Group - - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - -LIBRARY euser.lib -LIBRARY provisioningengine.lib -LIBRARY commonengine.lib -//LIBRARY vmbx.lib -LIBRARY centralrepository.lib - -DEBUGLIBRARY flogger.lib - - -SMPSAFE -//end of file - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/MbxNbrAdapter/Inc/MbxNbrAdapter.h --- a/omaprovisioning/provisioning/MbxNbrAdapter/Inc/MbxNbrAdapter.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2002 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: Handles mailbox number settings in OMA provisioning. -* -*/ - - -#ifndef MbxNbrAdapter_H -#define MbxNbrAdapter_H - -// INCLUDES - -#include - -// FORWARD DECLARATIONS -//struct TMbxNbrAdapterData; - - -// MODULE DATA STRUCTURES - -// ENUMERATIONS - - -// CLASS DECLARATION - -/** - * CMbxNbrAdapter handles accesspoint settings. - */ -class CMbxNbrAdapter : public CWPAdapter - { - private: // ENUMERATIONS - - enum TMailboxType - { - ECSVoiceMailbox = 1, // Default if type is not received in XML - ECSVideoMailbox - }; - - private: // MODULE DATA STRUCTURES - - struct TMbxNbrAdapterData - { - TPtrC iName; - TPtrC iMailboxNumber; - TBool iVidiosupport; - TBool iIsVideosupport; - TMailboxType iMailboxType; - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @return a instance of class. - */ - static CMbxNbrAdapter* NewL(); - - /** - * Destructor - */ - virtual ~CMbxNbrAdapter(); - - public: // Functions from base classes - - /** - * From CWPAdapter - */ - TInt ItemCount() const; - - /** - * From CWPAdapter - */ - const TDesC16& SummaryTitle( TInt aIndex ) const; - - /** - * From CWPAdapter - */ - const TDesC16& SummaryText( TInt aIndex ) const; - - /** - * From CWPAdapter - */ - TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); - - /** - * From CWPAdapter - */ - void SaveL( TInt aItem ); - - /** - * From CWPAdapter - */ - TBool CanSetAsDefault( TInt aItem ) const; - - /** - * From CWPAdapter - */ - void SetAsDefaultL( TInt aItem ); - - /** - * From CWPAdapter - */ - void VisitL( CWPCharacteristic& aElement ); - - /** - * From CWPAdapter - */ - void VisitL( CWPParameter& aElement ); - - /** - * From CWPAdapter - */ - void VisitLinkL( CWPCharacteristic& aCharacteristic ); - - private: // Default constructors - - /** - * C++ default constructor. - */ - CMbxNbrAdapter(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // New functions - - /** - * Validates the data in iTempData. - */ - TBool IsValid(); - - /** - * Validates the phone number string. - */ - TBool IsValidPhoneNumber( const TDesC& aPtr ); - - /** - * Parses an mailbox type from a descriptor. - */ - void ParseMbxTypeL( const TDesC& aPtr, TMailboxType& aInt ); - - /** - * Parses an video ON/OFF type from a descriptor. - */ - - void ParseVideoTypeL( const TDesC& aPtr, TBool& aInt, TBool& aInt1 ); - - private: // Data - - HBufC* iTitle; - - TPtrC iAppId; - RArray iSettings; - TMbxNbrAdapterData iTempData; - - private: - friend class T_CWPMbxNbrAdapter; - - - }; - -#endif // MbxNbrAdapter_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/MbxNbrAdapter/Src/MbxNbrAdapter.cpp --- a/omaprovisioning/provisioning/MbxNbrAdapter/Src/MbxNbrAdapter.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,384 +0,0 @@ -/* -* Copyright (c) 2002 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: Handles mailbox number settings in OMA provisioning. -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -//#include -#include -#include -#include - -#include "WPAdapterUtil.h" -#include "MbxNbrAdapter.h" -#include "ProvisioningDebug.h" - -// CONSTANTS -#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw - _LIT( KAdapterName, "WPMbxNbrAdapterResource" ); -#else - _LIT( KAdapterName, "WPMbxNbrAdapter" ); -#endif -_LIT( KMailboxNumberStr, "MBNMBR" ); -_LIT( KMailboxTypeStr, "MBTYPE" ); -_LIT( KCSVideoMailboxType, "VIDEO" ); -_LIT( KVideoSupportType, "VIDEO_MBOX_SUPPORT" ); -_LIT( KVideoSupportTypeTrue, "TRUE" ); -_LIT( KVideoSupportTypeFalse, "FALSE" ); -_LIT( KMailboxAppId, "w9027" ); // From OMA provisioning registration document -const TInt KSettingsGranularity = 2; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::CMbxNbrAdapter -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CMbxNbrAdapter::CMbxNbrAdapter() : - iSettings( KSettingsGranularity ) - { - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::ConstructL() - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ConstructL:" ) ); - - TFileName fileName; - Dll::FileName( fileName ); - iTitle = WPAdapterUtil::ReadHBufCL( fileName, - KAdapterName, - R_MAILBOX_NUMBER_ADAPTER_TITLE ); - - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ConstructL: Done" ) ); - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CMbxNbrAdapter* CMbxNbrAdapter::NewL() - { - CMbxNbrAdapter* self = new( ELeave ) CMbxNbrAdapter; - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - - return self; - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::~CMbxNbrAdapter -// Destructor -// ----------------------------------------------------------------------------- -// -CMbxNbrAdapter::~CMbxNbrAdapter() - { - delete iTitle; - iSettings.Close(); - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::ItemCount -// ----------------------------------------------------------------------------- -// -TInt CMbxNbrAdapter::ItemCount() const - { - // SummaryTitle(), SummaryText(), SaveL(), SetAsDefaultL() and - // CanSetAsDefault() are called ItemCount() times - return iSettings.Count(); - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::SummaryTitle -// ----------------------------------------------------------------------------- -// -const TDesC16& CMbxNbrAdapter::SummaryTitle( TInt /*aIndex*/ ) const - { - return *iTitle; - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::SummaryText -// ----------------------------------------------------------------------------- -// -const TDesC16& CMbxNbrAdapter::SummaryText( TInt aIndex ) const - { - // SummaryText should be called ItemCount() times - __ASSERT_DEBUG( iSettings.Count() > aIndex, - User::Panic( _L("CMbxNbrAdapter::SummaryText"), KErrCorrupt ) ); - __ASSERT_DEBUG( aIndex >= 0, - User::Panic( _L("CMbxNbrAdapter::SummaryText"), KErrCorrupt ) ); - return iSettings[ aIndex ].iName; - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::DetailsL -// ----------------------------------------------------------------------------- -// -TInt CMbxNbrAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ ) - { - // Detail view is a feature for later release. - return KErrNotSupported; - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::SaveL -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::SaveL( TInt aItem ) - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::SaveL:" ) ); - __ASSERT_DEBUG( iSettings.Count() > aItem, User::Leave( KErrCorrupt ) ); - __ASSERT_DEBUG( aItem >= 0, User::Leave( KErrCorrupt ) ); - - //RVmbxNumber model; - //User::LeaveIfError( model.Open() ); - //CleanupClosePushL( model ); - - TInt err( KErrNone ); - switch( iSettings[aItem].iMailboxType ) - { - case ECSVoiceMailbox: - //err = model.SaveVmbxNumber( iSettings[aItem].iMailboxNumber, - // EAlsActiveLineEntry ); - break; - case ECSVideoMailbox: - FLOG( _L( "[Provisioning] CMbxNbrAdapter::SaveL:case ECSVideoMailbox" ) ); - //err = model.SaveVideoMbxNumber( iSettings[aItem].iMailboxNumber, - // EAlsActiveLineEntry ); - if ( iSettings[aItem].iIsVideosupport ) - { - CRepository* cenrep = CRepository::NewL( KCRUidVideoMailbox ); - FLOG( _L( "[Provisioning] CMbxNbrAdapter::SaveL:case Saving it to Cenrep" ) ); - TBuf<100> buf1; - buf1.AppendNum( iSettings[aItem].iVidiosupport ); - - FLOG( buf1 ); - CleanupStack::PushL(cenrep); - User::LeaveIfError( - cenrep->Set( KVideoMbxSupport, iSettings[aItem].iVidiosupport )); - FLOG( _L( "[Provisioning] CMbxNbrAdapter::SaveL:case Saved" ) ); - CleanupStack::PopAndDestroy(cenrep); - } - break; - default: - User::Leave( KErrCorrupt ); - break; - } - - User::LeaveIfError( err ); - CleanupStack::PopAndDestroy(); // Close model - - FLOG( _L( "[Provisioning] CStreamingAdapter::SaveL: Done" ) ); - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CMbxNbrAdapter::CanSetAsDefault( TInt /*aItem*/ ) const - { - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::SetAsDefault -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::SetAsDefaultL( TInt /*aItem*/ ) - { - // This shouldn't be called because CanSetAsDefault - // always returns EFalse. - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::VisitL -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::VisitL( CWPCharacteristic& aCharacteristic ) - { - switch( aCharacteristic.Type() ) - { - case KWPApplication: - // Initialize iTempData's members - iTempData.iName.Set( KNullDesC ); - iTempData.iMailboxNumber.Set( KNullDesC ); - iTempData.iVidiosupport = EFalse; - iTempData.iIsVideosupport = EFalse; - iTempData.iMailboxType = ECSVoiceMailbox; - - // Accept characteristic - aCharacteristic.AcceptL( *this ); - - // Check iAppId and validate data - if( iAppId == KMailboxAppId && IsValid() ) - { - // iAppId is correct and data is valid - // -> Lets append it to array - iSettings.Append( iTempData ); - } - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::VisitL -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::VisitL( CWPParameter& aParameter ) - { - switch( aParameter.ID() ) - { - case EWPParameterAppID: - iAppId.Set( aParameter.Value() ); - break; - case EWPParameterName: - iTempData.iName.Set( aParameter.Value() ); - break; - case EWPNamedParameter: - { - if( aParameter.Name().Compare( KMailboxNumberStr ) == 0 ) - { - iTempData.iMailboxNumber.Set( aParameter.Value() ); - } - else if( aParameter.Name().Compare( KMailboxTypeStr ) == 0 ) - { - ParseMbxTypeL( aParameter.Value(), iTempData.iMailboxType ); - } - else if( aParameter.Name().Compare( KVideoSupportType ) == 0) - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::VisitL:Visiting to ParseVideoTypeL" ) ); - ParseVideoTypeL( aParameter.Value(), iTempData.iVidiosupport, iTempData.iIsVideosupport ); - } - break; - } - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::VisitLinkL -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::VisitLinkL( CWPCharacteristic& /*aCharacteristic*/ ) - { - } - - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::IsValid -// ----------------------------------------------------------------------------- -// -TBool CMbxNbrAdapter::IsValid() - { - TBool validity( EFalse ); - - // Validity check: - // iMailboxType is either ECSVideoMailbox or ECSVoiceMailbox and - // iMailboxNumber is valid number in e.164 format - if( ( iTempData.iMailboxType == ECSVideoMailbox || - iTempData.iMailboxType == ECSVoiceMailbox ) && - IsValidPhoneNumber( iTempData.iMailboxNumber ) ) - { - validity = ETrue; - } - - return validity; - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::IsValidPhoneNumber -// ----------------------------------------------------------------------------- -// -TBool CMbxNbrAdapter::IsValidPhoneNumber( const TDesC& aPtr ) - { - return CommonPhoneParser::IsValidPhoneNumber( aPtr, - CommonPhoneParser::EPhoneClientNumber ); - } - -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::ParseMbxTypeL -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::ParseMbxTypeL( const TDesC& aPtr, TMailboxType& aType ) - { - if( aPtr.Length() ) - { - if( aPtr.Compare( KCSVideoMailboxType ) == 0 ) - { - aType = ECSVideoMailbox; - } - else - { - User::Leave( KErrNotSupported ); - } - } - else - { - aType = ECSVoiceMailbox; - } - } -// ----------------------------------------------------------------------------- -// CMbxNbrAdapter::ParseVideoTypeL -// ----------------------------------------------------------------------------- -// -void CMbxNbrAdapter::ParseVideoTypeL( const TDesC& aPtr, TBool& aType, TBool& aType1 ) - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:in" ) ); - if( aPtr.Length() ) - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:If there is ON/OFF Value" ) ); - if( aPtr.Compare( KVideoSupportTypeTrue ) == 0 ) - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:if ON set TRUE" ) ); - aType = ETrue; - aType1 = ETrue; - } - else if( aPtr.Compare( KVideoSupportTypeFalse ) == 0 ) - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:if OFF set False" ) ); - aType = EFalse; - aType1 = ETrue; - } - else - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:if some thing else set False" ) ); - aType1 = EFalse; - } - } - else - { - FLOG( _L( "[Provisioning] CMbxNbrAdapter::ParseVideoTypeL:no ON/OFF" ) ); - aType1 = EFalse; - } - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/MbxNbrAdapter/Src/MbxNbrAdapterGroupProxy.cpp --- a/omaprovisioning/provisioning/MbxNbrAdapter/Src/MbxNbrAdapterGroupProxy.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2002 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: Table of plugins for ECom -* -*/ - - - -// INCLUDE FILES -#include -#include -#include "MbxNbrAdapter.h" - - -// CONSTANTS -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( 0x10207282, CMbxNbrAdapter::NewL ) - }; - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// ImplementationProxy -// ECOM implementation table entry. -// ----------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/MbxNbrAdapter/loc/MailboxAdapter.loc --- a/omaprovisioning/provisioning/MbxNbrAdapter/loc/MailboxAdapter.loc Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 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 is a localisation file for MediaSettings -* A .loc file is the one and only place where the logical strings -* to be localised are defined. -* -*/ - - - -// LOCALISATION STRINGS - -//d: Summary text for mailbox settings -//l: popup_info_list_pane_t2/opt1 -// -#define qtn_op_head_mailbox "Mailbox settings" - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/BWINS/ProvisioningBCu.def --- a/omaprovisioning/provisioning/ProvisioningBC/BWINS/ProvisioningBCu.def Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?NewL@CWPBioControl@@SAPAV1@AAVMMsgBioControlObserver@@PAVCMsvSession@@JW4TMsgBioMode@@PBVRFile@@@Z @ 1 NONAME ; class CWPBioControl * CWPBioControl::NewL(class MMsgBioControlObserver &, class CMsvSession *, long, enum TMsgBioMode, class RFile const *) - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Bif/ProvisioningBif.mk --- a/omaprovisioning/provisioning/ProvisioningBC/Bif/ProvisioningBif.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -# -# Copyright (c) 2002 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: -# Makefile for building bif resource -# -# - -PROJECT=provisioningbc -SOURCEDIR=..\bif -LANGUAGE=sc - - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -TARGETDIR=\Epoc32\Release\$(PLATFORM)\$(CFG)\z\system\bif -else -TARGETDIR=\Epoc32\release\$(PLATFORM)\$(CFG) -endif - -$(TARGETDIR) : - @perl \epoc32\tools\emkdir.pl $(TARGETDIR) - - -SOURCERESOURCE=$(SOURCEDIR)\provisioningbif.rss -TEMPRESOURCE=$(TARGETDIR)\provisioningbif.rss -TARGETRESOURCE=$(TARGETDIR)\prov.r$(LANGUAGE) - -$(TARGETRESOURCE) : $(TARGETDIR) $(SOURCERESOURCE) - @copy $(SOURCERESOURCE) $(TEMPRESOURCE) - @epocrc.bat -u -I. -I\epoc32\include -I$(SOURCEDIR)\..\..\Group $(TEMPRESOURCE) -o$(TARGETRESOURCE) - @del $(TEMPRESOURCE) - -do_nothing: - rem do nothing - - -MAKMAKE : do_nothing - -RESOURCE : $(TARGETRESOURCE) - -SAVESPACE : BLD - -BLD : do_nothing - -FREEZE : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -FINAL : do_nothing - -CLEAN : - @erase $(TARGETRESOURCE) - -RELEASABLES : - @echo $(TARGETRESOURCE) - -# End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Bif/ProvisioningBif.rss --- a/omaprovisioning/provisioning/ProvisioningBC/Bif/ProvisioningBif.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2002 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 resources for the bif file created by biftool. -* -* -*/ - - -// INCLUDES -#ifdef __MESSAGING_API_V2__ -#include -#else -#include -#endif // __MESSAGING_API_V2__ - -#include -#include "../Group/ProvisioningUIDs.h" - - -RESOURCE BIO_INFO_FILE - { - message_type_uid = KProvisioningMessageTypeUid; - message_app_uid = KUidUseDefaultApp; - message_appctrl_name = "ProvisioningBC.dll"; - description = qtn_mce_inbox_type_smart_conf; - icons_filename = "none"; - icon_zoom_levels = {1}; - ids= - { - ID - { - type=EIana; - confidence=ECertain; - text="application/vnd.wap.connectivity-wbxml"; - } - }; - } - -// End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Bif/ProvisioningBif_dc.mk --- a/omaprovisioning/provisioning/ProvisioningBC/Bif/ProvisioningBif_dc.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -# -# Copyright (c) 2002 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: -# Makefile for building bif resource -# -# - -PROJECT=provisioningbc -SOURCEDIR=..\bif -LANGUAGE=sc - - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -TARGETDIR=\Epoc32\Release\$(PLATFORM)\$(CFG)\z\resource\messaging\bif -else -TARGETDIR=\Epoc32\release\$(PLATFORM)\$(CFG) -endif - -$(TARGETDIR) : - @perl \epoc32\tools\emkdir.pl $(TARGETDIR) - - -SOURCERESOURCE=$(SOURCEDIR)\provisioningbif.rss -TEMPRESOURCE=$(TARGETDIR)\provisioningbif.rss -TARGETRESOURCE=$(TARGETDIR)\prov.r$(LANGUAGE) - -$(TARGETRESOURCE) : $(TARGETDIR) $(SOURCERESOURCE) - @copy $(SOURCERESOURCE) $(TEMPRESOURCE) - @epocrc.bat -u -I. -I\epoc32\include -I$(SOURCEDIR)\..\..\Group $(TEMPRESOURCE) -o$(TARGETRESOURCE) - @del $(TEMPRESOURCE) - -do_nothing: - rem do nothing - - -MAKMAKE : do_nothing - -RESOURCE : $(TARGETRESOURCE) - -SAVESPACE : BLD - -BLD : do_nothing - -FREEZE : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -FINAL : do_nothing - -CLEAN : - @erase $(TARGETRESOURCE) - -RELEASABLES : - @echo $(TARGETRESOURCE) - -# End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Group/ProvisioningBC.lnt --- a/omaprovisioning/provisioning/ProvisioningBC/Group/ProvisioningBC.lnt Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ --w2 - --i..\Inc --d_UNICODE -APP_LAYER_SYSTEMINCLUDE -..\Src\*.cpp diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Group/ProvisioningBC.mmp --- a/omaprovisioning/provisioning/ProvisioningBC/Group/ProvisioningBC.mmp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Project definition file for project the ProvisioningBC. -* -*/ - - -#include - -#include -#include "../../Group/ProvisioningUIDs.h" - -TARGET provisioningbc.dll -TARGETPATH system/libs -TARGETTYPE dll -UID KProvisioningBCUid2 KProvisioningBCUid3 - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - - - -SOURCEPATH ../Src -SOURCE CWPBioControl.cpp -SOURCE CWPSaver.cpp -SOURCE CWPCodeQueryDialog.cpp -SOURCE CWPNameValue.cpp - -START RESOURCE ../Group/ProvisioningBC.rss -HEADER -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -START RESOURCE ../Bif/ProvisioningBif.rss -TARGETPATH BIOFILE_DIR -TARGET prov.rsc -LANGUAGE_IDS -END // RESOURCE - -USERINCLUDE ../Inc ../Group ../../Group ../../ProvisioningEngine/Inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom -//SYSTEMINCLUDE /epoc32/include/cshelp - -LIBRARY euser.lib -LIBRARY eikdlg.lib // dialog base -LIBRARY bafl.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib // bordered control -LIBRARY msgeditorutils.lib -LIBRARY cone.lib -LIBRARY msgs.lib // Messaging Centre interface -LIBRARY commonengine.lib // StringLoader -LIBRARY richbio.lib -LIBRARY provisioningengine.lib -LIBRARY avkon.lib -LIBRARY eikctl.lib -LIBRARY featmgr.lib -LIBRARY apengine.lib -LIBRARY favouritesengine.lib -LIBRARY sysutil.lib -LIBRARY centralrepository.lib - -DEBUGLIBRARY flogger.lib - -SMPSAFE -// End of file - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Group/ProvisioningBC.rss --- a/omaprovisioning/provisioning/ProvisioningBC/Group/ProvisioningBC.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,394 +0,0 @@ -/* -* Copyright (c) 2002 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 all the resources for the module. -* -* -*/ - - -// RESOURCE IDENTIFIER - -NAME PROV - -// INCLUDES - -#include -#include -#include -#include -#include "provisioningbc.loc" -#include "../../loc/Provisioning.loc" // Localisable text - - -// RESOURCE DEFINITIONS -// --------------------------------------------------------- -// -// ProvisioningBC.rss -// -// --------------------------------------------------------- -// - -RESOURCE RSS_SIGNATURE { } - -RESOURCE EIK_APP_INFO - { - } - -// --------------------------------------------------------- -// -// r_title_provisioning -// Provisioning message title -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_title_provisioning - { - buf=qtn_op_title_confsett; - } - -// --------------------------------------------------------- -// -// r_menu_savesetting -// Save text -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_menu_savesetting - { - buf=qtn_op_options_save; - } - -// --------------------------------------------------------- -// -// r_text_authenticated -// Save text -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_authenticated - { - buf=qtn_mce_inbox_sender_servprov; - } - -// --------------------------------------------------------- -// -// r_text_helptext -// Save text -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_helptext - { - buf=qtn_op_view_help; - } - -// --------------------------------------------------------- -// -// r_text_numitems -// Number of items if >=5 -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_numitems - { - buf=qtn_op_sett_items; - } - -// --------------------------------------------------------- -// -// r_text_notsaved_singular_zero -// Number of items not saved -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_notsaved_singular_zero - { - buf=qtn_op_info_notsaved_singular_zero; - } - -// --------------------------------------------------------- -// -// r_text_notsaved_singular_one -// Number of items not saved -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_notsaved_singular_one - { - buf=qtn_op_info_notsaved_singular_one; - } - - -// --------------------------------------------------------- -// -// r_text_notsaved -// Number of items not saved -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_notsaved - { - buf=qtn_op_info_notsaved; - } - -// --------------------------------------------------------- -// -// r_text_saved -// All settings were saved -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_saved - { - buf=qtn_sm_all_serv_settings_copied; - } - -// --------------------------------------------------------- -// -// r_text_ap_protected -// Access points are protected -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_ap_protected - { - buf=qtn_sms_note_protected_ap; - } - - -// --------------------------------------------------------- -// -// r_text_wrong_pin -// Error text when entered PIN is wrong. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_wrong_pin - { - buf = qtn_op_verific_failed; - } - -// --------------------------------------------------------- -// -// r_text_already_saved -// Confirmation when settings have already been saved. -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_query_already_saved - { - flags = EGeneralQueryFlags; - #ifdef __SERIES60_32__ // KS - buttons = R_AVKON_SOFTKEYS_YES_NO__YES; - #else - buttons = R_AVKON_SOFTKEYS_YES_NO; - #endif - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = qtn_op_already_saved; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_query_notauthenticated -// Query when message is not authenticated. -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_query_notauthenticated - { - flags = EGeneralQueryFlags; - #ifdef __SERIES60_32__ // KS - buttons = R_AVKON_SOFTKEYS_YES_NO__YES; - #else - buttons = R_AVKON_SOFTKEYS_YES_NO; - #endif - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = qtn_op_nottsp_conf_note; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_query_pin -// Query when a PIN should be entered -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_query_pin - { - flags=EGeneralQueryFlags; - #ifdef __SERIES60_32__ // KS - buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK; - #else - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - #endif - items= - { - DLG_LINE - { - type=EAknCtQuery; - id=EGeneralQuery; - control= AVKON_DATA_QUERY - { - layout = EPinLayout; - label = qtn_op_enter_settpin; - control = NUMSECRETED - { - num_code_chars = 20; - }; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_query_setdefault -// Query for setting the settings as default. -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_query_verific_failed_totally - { - flags = EAknErrorNoteFlags | EEikDialogFlagWait; - #ifdef __SERIES60_32__ // KS - buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; - #else - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - #endif - items = - { - DLG_LINE - { - type = EAknCtNote; - id = EGeneralNote; - control = AVKON_NOTE - { - layout = EGeneralLayout; - singular_label = qtn_op_verific_failed_totally; - animation = R_QGN_NOTE_ERROR_ANIM; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_query_setdefault -// Query for setting the settings as default. -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_query_setdefault - { - flags = EGeneralQueryFlags; - #ifdef __SERIES60_32__ // KS - buttons = R_AVKON_SOFTKEYS_YES_NO__YES; - #else - buttons = R_AVKON_SOFTKEYS_YES_NO; - #endif - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - label = qtn_op_conf_setdef; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_waitnote_save -// Save wait note -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_waitnote_save - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = 1; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_sm_wait_saving_servsett; - }; - } - }; - } - -RESOURCE DIALOG r_msg_authentication_failed - { - flags = EGeneralQueryFlags | EEikDialogFlagNoBorder | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY__OK; - items = - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - label = qtn_op_info_sms_autfai_heading; - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - message = qtn_op_info_sms_autfai; - }; - } - }; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Inc/CWPBioControl.h --- a/omaprovisioning/provisioning/ProvisioningBC/Inc/CWPBioControl.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,276 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Bio control for Provisioning documents. -* -*/ - - -#ifndef CWPBIOCONTROL_H -#define CWPBIOCONTROL_H - -// INCLUDES -#include // for CMsgBioControl - -// FORWARD DECLARATIONS -class CWPEngine; -class CWPNameValue; -class CWPPushMessage; -class CRichBio; - -// CLASS DECLARATION - -/** - * Bio control for OMA Provisioning messages. - * @since 2.0 - */ -class CWPBioControl: public CMsgBioControl - { - public: // Constructor and destructor - - /** - * Two-phased constructor. - * @param aObserver Reference to the Bio control observer. - * @param aSession Reference to Message Server session. - * @param aId Id of the message. - * @param aEditorOrViewerMode Enum for the mode, is it as editor or viewer. - * @param aFileName The newly created object. - * @param aFile file handle to provisioning content. - */ - IMPORT_C static CWPBioControl* NewL( MMsgBioControlObserver& aObserver, - CMsvSession* aSession, - TMsvId aId, - TMsgBioMode aEditorOrViewerMode, - const RFile* aFile ); - - /** - * Destructor. - */ - virtual ~CWPBioControl(); - - public: // From MMsgBioControl - - /** - * Calculates and sets size for a Bio control according to aSize. - * This function might become deprecated. The SetSizeL() function will - * be the replacement. - * The height of the Bio control may be less or more than requested by - * aSize, but the width must be exactly the same. If width of the Bio - * control is not the same as given by aSize, the width must be reset - * back to requested one. The aSize is set to the new size. - * @param aSize Size. - */ - void SetAndGetSizeL( TSize& aSize ); - - /** - * This is called by the container to allow the Bio control to add - * a menu item command. The command ID's should start from the value - * returned by the MMsgBioControlObserver::FirstFreeCommand(). - * @param aMenuPane Reference to the applications menu which will be - * modified. - */ - void SetMenuCommandSetL( CEikMenuPane& aMenuPane ); - - /** - * The command handler. The Bio Control should only handle its own - * commands that it has set using the function SetMenuCommandSetL(). - * @param aCommand ID of command to be handled. - * @return If the command is handled, it returns ETrue, and vice versa - */ - TBool HandleBioCommandL( TInt aCommand ); - - /** - * Returns a rectangle slice of the bio controls viewing area. - * It is used by the CMsgEditorView class for scrolling the screen. - * The position is given relative to the bio controls top left - * corner. - * @return TRect - */ - TRect CurrentLineRect() const; - - /** - * Used by the body container for managing focus and scrolling. - * @param aDirection The direction to be checked. - * @return ETrue if focus change is possible, and vice versa. - */ - TBool IsFocusChangePossible( TMsgFocusDirection aDirection ) const; - - /** - * Returns the header text. - * @return The header text. - */ - HBufC* HeaderTextL() const; - - /** - * The application can get the option menu permissions using this - * function. - * @return The option menu permission flags. If the flag is off it - * means that the option menu command is not recommended with this - * Bio Control. - */ - TUint32 OptionMenuPermissionsL() const; - - /** - * Gives the height of the text in pixels. - * It is used by the scrolling framework. - * @return Height of the text in pixels. - */ - TInt VirtualHeight(); - - /** - * Gives the cursor position in pixels. - * It is used by the scrolling framework. - * @return Cursor position in pixels. - */ - TInt VirtualVisibleTop(); - - /** - * Tells whether the cursor is in the topmost or bottom position. - * It is used by the scrolling framework. - * @param aLocation Specifies either top or bottom. - * @return ETrue if the cursor is in the part specified by aLocation. - */ - TBool IsCursorLocation( TMsgCursorLocation aLocation ) const; - - - public: // From CCoeControl - - TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ); - void GetHelpContext( TCoeHelpContext& aContext ) const; - - protected: // From CCoeControl - - TInt CountComponentControls() const; - CCoeControl* ComponentControl( TInt aIndex ) const; - void SizeChanged(); - void FocusChanged( TDrawNow aDrawNow ); - void SetContainerWindowL( const CCoeControl& aContainer ); - /** - * SetCenrepKeyL - * Set the Cenrep key. - * @param aValue Cenrep Value. - * @return void - **/ - void SetCenrepKeyL(const TDesC8& aValue); - - private: // Constructors - - /** - * Constructor is prohibited. - * @param aObserver Reference to the Bio control observer. - * @param aSession Reference to Message Server session. - * @param aId Id of the message in Message Server. - * @param aEditorOrViewerMode Enum for the mode, is it as editor or viewer. - * @param aFileName The newly created object. - * @param aFile file handle to provisioning content. - */ - CWPBioControl( MMsgBioControlObserver& aObserver, - CMsvSession* aSession, - TMsvId aId, - TMsgBioMode aEditorOrViewerMode, - const RFile* aFile ); - - /** - * By default Symbian OS constructor is private. - */ - void ConstructL(); - - private: // New functions - - /** - * Restores the message from messaging store. - */ - void RestoreMsgL(); - - /** - * Adds the message summaries to the richbio. - */ - void AddItemsL(); - - /** - * Collects the summary items from engine and - * sorts them. - * @return Array with summary items - */ - RPointerArray* CollectItemsLC() const; - - /** - * Collates items with same title and adds - * them to the rich bio. - * @param aItems The items to be collated - */ - void CollateAndAddItemsL( RPointerArray& aItems ); - - /** - * Save the settings. - */ - void SaveSettingsL(); - - /** - * Save the message again. - */ - void SaveMessageL(); - - /** - * Do the actual saving. - */ - void DoSaveL(); - - /** - * Try to authenticate a message. - * @param aMessage The message to authenticate - */ - void AuthenticateL( CWPPushMessage& aMessage ); - - /** - * ResetAndDestroy() cleanup for an RPointerArray. - * @param aAny Array - */ - static void Cleanup( TAny* aAny ); - - /** - * Comparator for two string pairs. Compares the names of the pairs. - * @param aImpl1 First string pair to compare - * @param aImpl2 Second string pair to compare - */ - static TInt Compare( const CWPNameValue& aImpl1, - const CWPNameValue& aImpl2 ); - private: - void ErrorNoteL(const TDesC& aText); - void ErrorNoteL(TInt aStringResource); - void ConfirmationNoteL(const TDesC& aText); - void ConfirmationNoteL(TInt aStringResource); - void InformationNoteL(const TDesC& aText); - void InformationNoteL(TInt aStringResource); - - private: //Data - enum TMenuCommands - { - ECmdSaveSettings - }; - - /// Pointer to richbio control. Owns. - CRichBio* iRichBio; - - /// Provisioning engine. Owns. - CWPEngine* iEngine; - - /// The message being handled. Owns. - CWPPushMessage* iMessage; - }; - -#endif // CWPBIOCONTROL_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Inc/CWPCodeQueryDialog.h --- a/omaprovisioning/provisioning/ProvisioningBC/Inc/CWPCodeQueryDialog.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2002 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: -* -* -*/ - - -#ifndef CWPCODEQUERYDIALOG_H -#define CWPCODEQUERYDIALOG_H - -// INCLUDES -#include -#include - -// CLASS DECLARATION - -/** - * Sortable - */ -class CWPCodeQueryDialog : public CAknTextQueryDialog - { - public: - /** - * C++ default constructor. - */ - CWPCodeQueryDialog(TDes& aDataText); - - /** - * Destructor. - */ - ~CWPCodeQueryDialog(); - - public: - /** - * Allows dismissing of code queries. Only mandatory requirement is that PIN - * queries are dismissed by the # - * - * @param aKeyEvent TKeyEvent& - * @return ETrue query is dismissed - * EFalse not dismissed - */ - TBool NeedToDismissQueryL(const TKeyEvent& aKeyEvent); - - protected://from CAknTextQueryDialog - /** - * From CAknTextQueryDialog This function is called by the UIKON dialog framework - * just before the dialog is activated, after it has called - * PreLayoutDynInitL() and the dialog has been sized. - */ -// void PreLayoutDynInitL(); - /** - * From CAknTextQueryDialog This function is called by the UIKON framework - * if the user activates a button in the button panel. - * It is not called if the Cancel button is activated, - * unless the EEikDialogFlagNotifyEsc flag is set. - * @param aButtonId The ID of the button that was activated - * @return Should return ETrue if the dialog should exit, and EFalse if it should not. - */ - TBool OkToExitL(TInt aButtonId); - /** - * From CAknTextQueryDialog This function is called by the UIKON dialog framework - * just after a key is pressed - * @param aKeyEvent TKeyEvent& - * @param aType TEventCode - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); - - - }; - -#endif // CWPCodeQueryDialog_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Inc/CWPNameValue.h --- a/omaprovisioning/provisioning/ProvisioningBC/Inc/CWPNameValue.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2002 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 class encapsulates a name and value pair. -* -*/ - - - -#ifndef _CWPNameValue_H_ -#define _CWPNameValue_H_ - -// INCLUDES - -#include // CBase - -// CLASS DECLARATION - -/** - * Class holds name and value text pairs. - */ -class CWPNameValue : public CBase - { - public: // construction - - /** - * Two phased constructor. - * @param aName The field name. - * @param aValue The field value. - * @return The newly constructed object. - */ - static CWPNameValue* NewL( HBufC* aName, HBufC* aValue ); - static CWPNameValue* NewL(const TDesC& aName, const TDesC& aValue); - static CWPNameValue* NewLC(const TDesC& aName, const TDesC& aValue); - - /// Destructor - ~CWPNameValue(); - - public: // new functions - - /// @return Name or KNullDesC - const TDesC& Name() const; - /// @return Value or KNullDesC - const TDesC& Value() const; - - private: // construction - - /** - * Second phase constructor. - * @param aName The field name. - * @param aValue The field value. - */ - void ConstructL( const TDesC& aName, const TDesC& aValue ); - - /** - * Second phase constructor. - * @param aName The field name. - * @param aValue The field value. - */ - void ConstructL( HBufC* aName, HBufC* aValue ); - - private: // hidden - - /// Default constructor. - CWPNameValue(); - - /// Another constructor - CWPNameValue( HBufC* aName, HBufC* aValue ); - - /// Copy contructor prohibited. - CWPNameValue(const CWPNameValue& aSource); - - /// Assignment operator prohibited. - const CWPNameValue& operator=(const CWPNameValue& aSource); - - private: - - /// Own. Pointer to the name. - HBufC* iName; - - /// Own. Pointer to the value. - HBufC* iValue; - }; - -#endif // _CWPNameValue_H_ - -// End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Inc/CWPSaver.h --- a/omaprovisioning/provisioning/ProvisioningBC/Inc/CWPSaver.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Settings saver with progress note. -* -*/ - - -#ifndef CWPSAVER_H -#define CWPSAVER_H - -// INCLUDES -#include -#include -#include -#include - - -// FORWARD DECLARATIONS -class CWPEngine; -class CActiveFavouritesDbNotifier; - -// CLASS DECLARATION - -/** - * Helper class for saving Provisioning settings. Provides a progress note. - * @since 2.0 - */ -class CWPSaver : public CActive, - private MProgressDialogCallback, - private MActiveApDbObserver, - private MFavouritesDbObserver - { - public: - /** - * C++ default constructor. - * @param aEngine Engine to be used for saving - * @param aSetAsDefault EFalse => call CWPEngine::SaveL, ETrue - * => call CWPEngine::SetAsDefaultL - */ - CWPSaver( CWPEngine& aEngine, TBool aSetAsDefault ); - - /** - * Destructor. - */ - virtual ~CWPSaver(); - - public: - /** - * Prepares the object for saving. - */ - void PrepareLC(); - - /** - * Executes save with a progress note. Ownership of the - * CWPSaver object is transferred. - * @param aNumSaved When returns, contains number of settings saved. - * @return Status code. >= 0 if saving was completed - */ - TInt ExecuteLD( TInt& aNumSaved ); - - TInt GetNumAccessDenied(); - void SetNumAccessDenied(TInt aNumAccessDenied ); - protected: // From CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - - private: // From MProgressDialogCallback - - void DialogDismissedL( TInt aButtonId ); - - private: // from MActiveApDbObserver - - void HandleApDbEventL( TEvent anEvent ); - - private: // from MFavouritesDbObserver - - void HandleFavouritesDbEventL( RDbNotifier::TEvent aEvent ); - - private: - /** - * Complete the request so that RunL() gets called. - */ - void CompleteRequest(); - - /** - * Complete the request so that Timeout() gets called after - * a delay. Leaves with KErrTimeout if retry count is - * exceeded. - */ - void DelayedCompleteRequestL(); - - /** - * Retry save now. - */ - void Retry(); - - /** - * Timer timed-out. - */ - static TInt Timeout(TAny* aSelf); - - private: - /// The engine used for performing the save. Refs. - CWPEngine& iEngine; - - /// ETrue if setting as default - TBool iSetAsDefault; - - /// The progress dialog. Owns. - CAknProgressDialog* iDialog; - - /// The item to be saved next - TInt iCurrentItem; - - /// Contains result to be passed to the called of ExecuteLD - TInt iResult; - - /// Active AP database. Owns. - CActiveApDb* iApDbNotifier; - - /// Active Favourites Database. Owns. - CActiveFavouritesDbNotifier* iFavouritesNotifier; - - /// Contains ETrue if commsdb is being waited on - TBool iWaitCommsDb; - - /// Contains ETrue if favourites db is being waited on - TBool iWaitFavourites; - - /// Active scheduler. - CActiveSchedulerWait iWait; - - /// Timer for retry. Owns. - CPeriodic* iRetryTimer; - - /// Retry counter - TInt iRetryCount; - - RFavouritesDb iBookmarkDb; - RFavouritesSession iSession; - TInt iNumAccessDenied; - }; - - -#endif // CWPSAVER_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Inc/CWPStringPair.h --- a/omaprovisioning/provisioning/ProvisioningBC/Inc/CWPStringPair.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Sortable string pair. -* -*/ - - -#ifndef CWPSTRINGPAIR_H -#define CWPSTRINGPAIR_H - -// INCLUDES -#include - -// CLASS DECLARATION - -/** - * Sortable string pair - */ -class CWPStringPair : public CBase - { - public: - /** - * C++ default constructor. - */ - CWPStringPair(); - - /** - * Destructor. - */ - ~CWPStringPair(); - - public: - /** - * Sets the values for string pair. - * @param aName The name of the string - * @param aValue The value of the string - */ - void SetL( const TDesC& aName, const TDesC& aValue ); - - public: - // Points to iName. Use for constructing TKeyArrayFixPtr. - TPtrC iNamePtr; - - // Points to iValue. Use for constructing TKeyArrayFixPtr. - TPtrC iValuePtr; - - private: - // The name of the pair. Owns. - HBufC* iName; - - // The value of the pair. Owns. - HBufC* iValue; - }; - -#endif // CWPSTRINGPAIR_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Src/CWPBioControl.cpp --- a/omaprovisioning/provisioning/ProvisioningBC/Src/CWPBioControl.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,875 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Bio control for Provisioning documents. -* -*/ - - -// INCLUDE FILES -#include "CWPBioControl.h" - -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include -#include -#include "CWPEngine.h" -#include "CWPAdapter.h" -#include "MWPPhone.h" -#include "WPPhoneFactory.h" -#include "CWPPushMessage.h" -#include "CWPBootstrap.h" -#include "CWPSaver.h" -#include "ProvisioningUIDs.h" -#include "CWPCodeQueryDialog.h" -#include "MWPContextManager.h" -#include "ProvisioningDebug.h" -#include "CWPNameValue.h" -#include -#include "ProvisioningInternalCRKeys.h" -// CONSTANTS -/// Strings are loaded from this resource -_LIT(KResourceFileName, "provisioningbc.rsc"); -/// Maximum number of items with same title before they get merged. -const TInt KMaxDuplicates = 5; -/// Maximum length of PIN code -const TInt KMaxPinSize = 20; -/// Number of retries for PIN -// const TInt KPinRetries = 3; // Removed, because iMtmData1 data member of TMsvEntry in CWPMessage.cpp contains Max tries, default=3. -///NONE -_LIT(KNone,""); - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Constructor. -// ----------------------------------------------------------------------------- -// -CWPBioControl::CWPBioControl( MMsgBioControlObserver& aObserver, - CMsvSession* aSession, - TMsvId aId, - TMsgBioMode aEditorOrViewerMode, - const RFile* aFile ) - : CMsgBioControl( aObserver, - aSession, - aId, - aEditorOrViewerMode, - aFile ) - { - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSyncAppEngine::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPBioControl::ConstructL() - { - FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL:" ) ); - - FeatureManager::InitializeLibL(); - - if( IsEditor() ) //This control does not support editing mode. - { - User::Leave( KErrNotSupported ); - } - - LoadResourceL(KResourceFileName); - LoadStandardBioResourceL(); - - iEngine = CWPEngine::NewL(); - iRichBio = new(ELeave) CRichBio( ERichBioModeEditorBase ); - - // this function leaves if not enough data exists - RestoreMsgL(); - - // Add items to CRichBio - AddItemsL(); - FLOG( _L( "[ProvisioningBC] CWPBioControl::ConstructL: done" ) ); - } - -// ----------------------------------------------------------------------------- -// CNSmlDMSyncAppEngine::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -EXPORT_C CWPBioControl* CWPBioControl::NewL( MMsgBioControlObserver& aObserver, - CMsvSession* aSession, - TMsvId aId, - TMsgBioMode aEditorOrViewerMode, - const RFile* aFile ) - { - - CWPBioControl* self = new( ELeave ) CWPBioControl( aObserver, - aSession, - aId, - aEditorOrViewerMode, - aFile ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPBioControl::~CWPBioControl() - { - delete iRichBio; - delete iEngine; - delete iMessage; - FeatureManager::UnInitializeLib(); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::SetAndGetSizeL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SetAndGetSizeL( TSize& aSize ) - { - iRichBio->SetAndGetSizeL( aSize ); - SetSizeWithoutNotification( aSize ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::SetMenuCommandSetL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SetMenuCommandSetL( CEikMenuPane& aMenuPane ) - { - AddMenuItemL( aMenuPane, R_MENU_SAVESETTING, ECmdSaveSettings ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::CurrentLineRect -// ---------------------------------------------------------------------------- -// -TRect CWPBioControl::CurrentLineRect() const - { - return iRichBio->CurrentLineRect(); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::IsFocusChangePossible -// ---------------------------------------------------------------------------- -// -TBool CWPBioControl::IsFocusChangePossible( - TMsgFocusDirection aDirection ) const - { - if (aDirection == EMsgFocusUp ) - { - return iRichBio->IsCursorLocation( EMsgTop ); - } - else - { - return EFalse; - } - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::IsCursorLocation -// ---------------------------------------------------------------------------- -// -TBool CWPBioControl::IsCursorLocation( TMsgCursorLocation aLocation ) const - { - return iRichBio->IsCursorLocation( aLocation ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::HeaderTextL -// ---------------------------------------------------------------------------- -// -HBufC* CWPBioControl::HeaderTextL() const - { - return StringLoader::LoadL( R_TITLE_PROVISIONING ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::HandleBioCommandL() -// ---------------------------------------------------------------------------- -// -TBool CWPBioControl::HandleBioCommandL(TInt aCommand) - { - TBool result( EFalse ); - - if ( aCommand == iBioControlObserver.FirstFreeCommand() + ECmdSaveSettings ) - { - SaveSettingsL(); - result = ETrue; - } - return result; - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::OptionMenuPermissionsL -// ---------------------------------------------------------------------------- -// -TUint32 CWPBioControl::OptionMenuPermissionsL() const - { - TUint32 perm( EMsgBioDelete | EMsgBioMessInfo | EMsgBioMove | EMsgBioExit ); - - if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - perm |= EMsgBioHelp; - } - return perm; - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::OfferKeyEventL -// ---------------------------------------------------------------------------- -// -TKeyResponse CWPBioControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - return iRichBio->OfferKeyEventL( aKeyEvent, aType ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::GetBioHelpContext -// ---------------------------------------------------------------------------- -// -void CWPBioControl::GetHelpContext( TCoeHelpContext& aContext ) const - { - if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) - { - aContext.iContext = KPROV_HLP_PROVISIONVIEW() ; - aContext.iMajor = TUid::Uid( KProvisioningBCUid3 ); - } - else - { - CCoeControl::GetHelpContext(aContext); - } - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::CountComponentControls -// ---------------------------------------------------------------------------- -// -TInt CWPBioControl::CountComponentControls() const - { - return 1; - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::ComponentControl -// ---------------------------------------------------------------------------- -// -CCoeControl* CWPBioControl::ComponentControl( TInt /*aIndex*/ ) const - { - return iRichBio; - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::SizeChanged() -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SizeChanged() - { - iRichBio->SetExtent( Position(), iRichBio->Size() ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::FocusChanged -// ---------------------------------------------------------------------------- -// -void CWPBioControl::FocusChanged( TDrawNow aDrawNow ) - { - iRichBio->SetFocus( IsFocused(), aDrawNow ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl::SetContainerWindowL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SetContainerWindowL( const CCoeControl& aContainer ) - { - CCoeControl::SetContainerWindowL( aContainer ); - iRichBio->ConstructL(this); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::VirtualHeight -// ---------------------------------------------------------------------------- -// -TInt CWPBioControl::VirtualHeight() - { - return iRichBio->VirtualHeight(); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::VirtualVisibleTop -// ---------------------------------------------------------------------------- -// -TInt CWPBioControl::VirtualVisibleTop() - { - return iRichBio->VirtualVisibleTop(); - } - - -// ---------------------------------------------------------------------------- -// CWPBioControl ::RestoreMsgL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::RestoreMsgL() - { - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL" ) ); - - // Load the message from Messaging Server - CMsvEntry* entry = MsvSession().GetEntryL(iId); - CleanupStack::PushL( entry ); - TMsvEntry tentry( entry->Entry() ); - iMessage = CWPPushMessage::NewL(); - CMsvStore* readStore = entry->ReadStoreL(); - CleanupStack::PushL( readStore ); - iMessage->RestoreL( *readStore ); - CleanupStack::PopAndDestroy(); // readStore - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 1" ) ); - // Fill the engine - TRAPD( result, iEngine->ImportDocumentL( iMessage->Body() ) ); - if( result == KErrCorrupt ) - { - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL KErrMsgBioMessageNotValid " ) ); - result = KErrMsgBioMessageNotValid; - } - FTRACE(RDebug::Print(_L("[ProvisioningBC] CWPBioControl::RestoreMsgL result (%d)"), result)); - User::LeaveIfError( result ); - - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 2 " ) ); - TBool preAuthenticated( iMessage->Authenticated() ); - // If the message was not authenticated, give a warning - AuthenticateL( *iMessage ); - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 3 " ) ); - if( !tentry.ReadOnly() && preAuthenticated != iMessage->Authenticated() ) - { - // If the entry can be written to, get its edit store and save - // authentication flag. Failing is not dangerous, as the only - // effect is that the user has to re-enter the PIN. - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 4 " ) ); - TRAPD( ignoreError, SaveMessageL() ); - if ( ignoreError ) ignoreError = 0; // prevent compiler warning - } - - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 5 " ) ); - iEngine->PopulateL(); - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 6 " ) ); - // Empty messages are not supported - if( iEngine->ItemCount() == 0 ) - { - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 7 " ) ); - User::Leave( KErrMsgBioMessageNotValid ); - } - - TPtrC8 orig8( iMessage->Originator() ); - HBufC* orig16 = HBufC::NewLC( orig8.Length() ); - orig16->Des().Copy( orig8 ); - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL 8 " ) ); - if( iMessage->Authenticated() - && iEngine->ContextExistsL( *orig16 ) ) - { - TUint32 context( iEngine->ContextL( *orig16 ) ); - iEngine->SetCurrentContextL( context ); - } - else - { - iEngine->SetCurrentContextL( KWPMgrUidNoContext ); - } - - CleanupStack::PopAndDestroy(2); // orig16, entry - FLOG( _L( "[ProvisioningBC] CWPBioControl::RestoreMsgL done" ) ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::AuthenticateL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::AuthenticateL( CWPPushMessage& aMessage ) - { - if( !aMessage.Authenticated() ) - { - // Try authentication and bootstrap without PIN. - - - MWPPhone* phone = NULL; - TBuf imsi; - TRAPD(err, phone = WPPhoneFactory::CreateL()); - - if(err!=KErrNone) - { - imsi = KNone; - - } - else - { - imsi = phone->SubscriberId(); - } - - - CWPBootstrap* bootstrap = CWPBootstrap::NewL( imsi ); - - if(phone) - delete phone; - - CleanupStack::PushL( bootstrap ); - - CWPBootstrap::TBootstrapResult result( bootstrap->BootstrapL( - aMessage, - *iEngine, - KNullDesC ) ); - if( result == CWPBootstrap::EPinRequired ) - { - CMsvEntry* entry = MsvSession().GetEntryL(iId); - TInt count = (entry->Entry()).MtmData1(); - // We need to ask the PIN. Retry max. MtmData1 (=3, default) times if - // the user supplies from PIN. - TBuf pin; - for( TInt i(0); i < count && !aMessage.Authenticated(); i++ ) - { - pin.Zero(); - CWPCodeQueryDialog* dlg = - new (ELeave) CWPCodeQueryDialog( pin ); - if (dlg->ExecuteLD( R_QUERY_PIN ) == 0) //R_DATA_QUERY - { - delete entry; - entry = NULL; - //enable user cancelling at any phase - User::Leave( KLeaveWithoutAlert ); - } - result = bootstrap->BootstrapL( aMessage, *iEngine, pin ); - - // Wrong PIN. Give a note except on the last time. - // Then the user will get note - // R_QUERY_VERIFIC_FAILED_TOTALLY with OK key. - if( result == CWPBootstrap::EAuthenticationFailed - && i < (const_cast (entry->Entry())).iMtmData1--) - { - entry->ChangeL(entry->Entry()); - i--; - count = (entry->Entry()).MtmData1(); //(const_cast (entry->Entry())).iMtmData1; - ErrorNoteL( R_TEXT_WRONG_PIN ); - } - } - - // Still wrong PIN -> tell the user and delete the message. - if( !aMessage.Authenticated() ) - { - delete entry; - entry = NULL; - CAknNoteDialog* dlg = new(ELeave) CAknNoteDialog; - dlg->ExecuteLD(R_QUERY_VERIFIC_FAILED_TOTALLY); - MsvSession().RemoveEntry( iId ); - User::Leave( KLeaveWithoutAlert ); - } - if(entry) - { - delete entry; - } - } - if(result == CWPBootstrap::EAuthenticationFailed) - { - - CAknMessageQueryDialog* msg = new(ELeave) CAknMessageQueryDialog; - msg->ExecuteLD(R_MSG_AUTHENTICATION_FAILED); - - MsvSession().RemoveEntry( iId ); - - User::Leave( KLeaveWithoutAlert ); - - - } - CleanupStack::PopAndDestroy( bootstrap ); - - // If the message is still not authenticated, show a note to user. - if( !aMessage.Authenticated() ) - { - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - - if ( !dlg->ExecuteLD(R_QUERY_NOTAUTHENTICATED) ) - { - User::Leave( KLeaveWithoutAlert ); - } - } - } - if (aMessage.Authenticated() ) - { - //update Cenrep key - TBuf8<100> orig; - orig.Copy(aMessage.Originator()); - TRAPD(err, SetCenrepKeyL(orig)); - User::LeaveIfError(err); - - } - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::AddItemsL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::AddItemsL() - { - // Add help text before the actual items - HBufC* help = StringLoader::LoadLC( R_TEXT_HELPTEXT ); - iRichBio->AddItemL( *help, KNullDesC ); - CleanupStack::PopAndDestroy(); // help - - RPointerArray* array = CollectItemsLC(); - CollateAndAddItemsL( *array ); - CleanupStack::PopAndDestroy(); // array - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::CollectItemsL -// ---------------------------------------------------------------------------- -// -RPointerArray* CWPBioControl::CollectItemsLC() const - { - RPointerArray* array = - new(ELeave) RPointerArray; - CleanupStack::PushL( TCleanupItem( Cleanup, array ) ); - - TInt count( iEngine->ItemCount() ); - for( TInt index = 0; index < count; index++ ) - { - const TDesC& text = iEngine->SummaryText( index ); - const TDesC& title = iEngine->SummaryTitle( index ); - - CWPNameValue* pair = CWPNameValue::NewLC( title, text ); - User::LeaveIfError( array->Append( pair ) ); - CleanupStack::Pop( pair ); - } - - array->Sort( TLinearOrder( CWPBioControl::Compare ) ); - - return array; - } - -// ----------------------------------------------------------------------------- -// CWPBioControl::Cleanup -// ----------------------------------------------------------------------------- -// -void CWPBioControl::Cleanup( TAny* aAny ) - { - RPointerArray* array = - reinterpret_cast*>( aAny ); - array->ResetAndDestroy(); - array->Close(); - delete array; - } - -// ----------------------------------------------------------------------------- -// CWPBioControl::Compare -// ----------------------------------------------------------------------------- -// -TInt CWPBioControl::Compare( const CWPNameValue& aItem1, - const CWPNameValue& aItem2 ) - { - return aItem1.Name().Compare( aItem2.Name() ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::CollateAndAddItemsL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::CollateAndAddItemsL( RPointerArray& aItems ) - { - // Add a pivot item - CWPNameValue* pivot = CWPNameValue::NewLC( KNullDesC, KNullDesC ); - User::LeaveIfError( aItems.Append( pivot ) ); - CleanupStack::Pop( pivot ); - - // Title of the items being currently collected - TPtrC currentTitle( KNullDesC ); - // Items under the same title - RArray pointers; - CleanupClosePushL( pointers ); - for( TInt item = 0; item < aItems.Count(); item++ ) - { - CWPNameValue* pair = aItems[ item ]; - - if( pair->Name().Compare( currentTitle ) != 0 ) - { - // Title has changed. Inserted collected items into rich bio - if( pointers.Count() > KMaxDuplicates ) - { - // More than KMaxDuplicates items. Put only one line with - // number of items. - HBufC* string = StringLoader::LoadLC( R_TEXT_NUMITEMS, - pointers.Count() ); - iRichBio->AddItemL( currentTitle, *string ); - CleanupStack::PopAndDestroy( string ); - } - else - { - // Insert all collected items into rich bio - for( TInt index = 0; index < pointers.Count(); index++ ) - { - iRichBio->AddItemL( currentTitle, pointers[index] ); - // Make sure title is repeated only once - currentTitle.Set( KNullDesC ); - } - } - // Change the current title and start collecting for it - currentTitle.Set( pair->Name() ); - pointers.Reset(); - } - if( pair->Value().Compare( KNullDesC ) != 0 ) - { - User::LeaveIfError( pointers.Append( pair->Value() ) ); - } - } - // Delete pivot - aItems.Remove( aItems.Count() - 1 ); - delete pivot; - CleanupStack::PopAndDestroy( &pointers ); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::SaveSettingsL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SaveSettingsL() - { - if( SysUtil::FFSSpaceBelowCriticalLevelL( &iEikonEnv->FsSession() ) ) - { - User::Leave( KErrDiskFull ); - } - - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - - if( !iMessage->Saved()) - { - DoSaveL(); - delete dlg; - } - - else - if( dlg->ExecuteLD(R_QUERY_ALREADY_SAVED) ) - { - DoSaveL(); - } - iMessage->SetSaved( ETrue ); - SaveMessageL(); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::DoSaveL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::DoSaveL() - { - TInt numSaved( 0 ); - CWPSaver* saver = new(ELeave) CWPSaver( *iEngine, EFalse ); - HBufC* text=NULL; - TInt err( saver->ExecuteLD( numSaved ) ); - TInt numAccessDenied = saver->GetNumAccessDenied(); - TInt itemCount( iEngine->ItemCount() ); - - if( (numSaved != itemCount) && (iEngine->GetAccessDenied()) ) - { - numSaved = numSaved + 1 - numAccessDenied; - iEngine->SetAccessDenied(EFalse); - err= KErrAccessDenied; - } - - if( err >= 0 ) - { - // Check if any setting can be made default - TBool setDefault( EFalse ); - - for( TInt i( 0 ); i < itemCount && !setDefault; i++ ) - { - if( iEngine->CanSetAsDefault( i ) ) - { - setDefault = ETrue; - } - } - - // Ask the user if the saved settings should be - // made default. - TInt result = KErrNone; - if( setDefault ) - { - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - - if ( dlg->ExecuteLD(R_QUERY_SETDEFAULT) ) - { - CWPSaver* setter = new(ELeave) CWPSaver( *iEngine, ETrue ); - TInt numSet( 0 ); - result = setter->ExecuteLD( numSet ); - } - } - - // All settings saved - if (result) - { - if(numSaved == 0) - text = StringLoader::LoadLC( R_TEXT_NOTSAVED_SINGULAR_ZERO); - else if(numSaved == 1) - text = StringLoader::LoadLC( R_TEXT_NOTSAVED_SINGULAR_ONE, numSaved ); - else - text = StringLoader::LoadLC( R_TEXT_NOTSAVED, numSaved ); - ErrorNoteL( *text ); - CleanupStack::PopAndDestroy(); // text - } - else - { - ConfirmationNoteL( R_TEXT_SAVED ); - } - } - else - { - if( err == EWPAccessPointsProtected ) - { - // Some problem in saving or user cancelled. - InformationNoteL( R_TEXT_AP_PROTECTED ); - } - else - { - // Some problem in saving or user cancelled. - if(numSaved == 0) - text = StringLoader::LoadLC( R_TEXT_NOTSAVED_SINGULAR_ZERO); - else if(numSaved == 1) - text = StringLoader::LoadLC( R_TEXT_NOTSAVED_SINGULAR_ONE, numSaved ); - else - text = StringLoader::LoadLC( R_TEXT_NOTSAVED, numSaved ); - ErrorNoteL( *text ); - CleanupStack::PopAndDestroy( text ); - } - } - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::SaveMessageL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SaveMessageL() - { - CMsvEntry* entry = MsvSession().GetEntryL(iId); - CleanupStack::PushL( entry ); - - CMsvStore* editStore = entry->EditStoreL(); - CleanupStack::PushL( editStore ); - iMessage->StoreL( *editStore ); - editStore->CommitL(); - CleanupStack::PopAndDestroy(2); // editStore, entry - } - -void CWPBioControl::ErrorNoteL(const TDesC& aText) - { - CAknErrorNote* note = new(ELeave)CAknErrorNote( ETrue ); - note->ExecuteLD(aText); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::ErrorNoteL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::ErrorNoteL(TInt aStringResource) - { - HBufC* buf = StringLoader::LoadLC(aStringResource); - ErrorNoteL(*buf); - CleanupStack::PopAndDestroy(buf); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::ConfirmationNoteL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::ConfirmationNoteL(TInt aStringResource) - { - HBufC* buf = StringLoader::LoadLC(aStringResource); - ConfirmationNoteL(*buf); - CleanupStack::PopAndDestroy(buf); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::InformationNoteL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::InformationNoteL(TInt aStringResource) - { - HBufC* buf = StringLoader::LoadLC(aStringResource); - InformationNoteL(*buf); - CleanupStack::PopAndDestroy(buf); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::ConfirmationNoteL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::ConfirmationNoteL(const TDesC& aText) - { - CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote; - note->ExecuteLD(aText); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::InformationNoteL -// ---------------------------------------------------------------------------- -// -void CWPBioControl::InformationNoteL(const TDesC& aText) - { - CAknInformationNote* note = new (ELeave) CAknInformationNote; - note->ExecuteLD(aText); - } - -// ---------------------------------------------------------------------------- -// CWPBioControl ::SetCenrepKey -// ---------------------------------------------------------------------------- -// -void CWPBioControl::SetCenrepKeyL(const TDesC8& aValue) - { - - FLOG( _L( "[ProvisioningBC] CWPBioControl::SetCenrepKeyL" ) ); - - CRepository* rep= NULL; - TInt errorStatus = KErrNone; - - TRAPD( errVal, rep = CRepository::NewL( KCRUidOMAProvisioningLV )) - ; - - if (errVal == KErrNone) - { - errorStatus = rep->Set(KOMAProvOriginatorContent, aValue); - } - else - { - errorStatus = errVal; - } - - if (rep) - { - delete rep; - } - - if (errorStatus != KErrNone) - { - User::Leave(errorStatus); - } - - FLOG( _L( "[ProvisioningBC] CWPBioControl::SetCenrepKeyL done" ) ); - - } -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Src/CWPCodeQueryDialog.cpp --- a/omaprovisioning/provisioning/ProvisioningBC/Src/CWPCodeQueryDialog.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Sortable pair of strings. -* -*/ - - -// INCLUDE FILES -#include "CWPCodeQueryDialog.h" - -// ============================ MEMBER FUNCTIONS =============================== - - -// ---------------------------------------------------------------------------- -// CCodeQueryDialog::CCodeQueryDialog() -// C++ constructor -// ---------------------------------------------------------------------------- -// -CWPCodeQueryDialog::CWPCodeQueryDialog( TDes& aDataText ) - : CAknTextQueryDialog( aDataText, ENoTone ) - { - } - - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -// -CWPCodeQueryDialog::~CWPCodeQueryDialog() - { - } - -// ---------------------------------------------------------------------------- -// CWPCodeQueryDialog::OfferKeyEventL -// called by framework when any key is pressed -// ---------------------------------------------------------------------------- -// -TKeyResponse CWPCodeQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - // '#' key - if( aKeyEvent.iScanCode == EStdKeyHash && aType == EEventKeyUp) - { - TryExitL( EEikBidOk ); - return EKeyWasConsumed; - } - - // '*' key - if ( aKeyEvent.iCode == '*' ) - { - return EKeyWasConsumed; - } - - return CAknTextQueryDialog::OfferKeyEventL( aKeyEvent, aType ); - } - -// ---------------------------------------------------------------------------- -// CWPCodeQueryDialog::NeedToDismissQueryL() -// Handles '#' key called by CAknTextQueryDialog::OfferKeyEventL() -// ---------------------------------------------------------------------------- -// -TBool CWPCodeQueryDialog::NeedToDismissQueryL( const TKeyEvent& /*aKeyEvent*/ ) - { - return EFalse; - } - -// ---------------------------------------------------------------------------- -// CWPCodeQueryDialog::OkToExitL() -// called by framework when the Softkey is pressed -// ---------------------------------------------------------------------------- -// -TBool CWPCodeQueryDialog::OkToExitL( TInt aButtonId ) - { - return CAknTextQueryDialog::OkToExitL( aButtonId ); - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Src/CWPNameValue.cpp --- a/omaprovisioning/provisioning/ProvisioningBC/Src/CWPNameValue.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2002 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 class encapsulates a name and value pair -* -*/ - - -// INCLUDE FILES - -#include "CWPNameValue.h" - -// MEMBER FUNCTIONS - -CWPNameValue* CWPNameValue::NewL( HBufC* aName, HBufC* aValue) - { - CWPNameValue* self = new (ELeave) CWPNameValue(aName, aValue); - return self; - } - -CWPNameValue* CWPNameValue::NewL(const TDesC& aName, const TDesC& aValue) - { - CWPNameValue* self = CWPNameValue::NewLC( aName, aValue ); - CleanupStack::Pop( self ); - return self; - } - -CWPNameValue* CWPNameValue::NewLC(const TDesC& aName, const TDesC& aValue) - { - CWPNameValue* self = new (ELeave) CWPNameValue; - CleanupStack::PushL(self); - self->ConstructL(aName, aValue); - return self; - } - -CWPNameValue::~CWPNameValue() - { - delete iName; - delete iValue; - } - -const TDesC& CWPNameValue::Name() const - { - if (iName) - { - return *iName; - } - return KNullDesC; - } - -const TDesC& CWPNameValue::Value() const - { - if (iValue) - { - return *iValue; - } - return KNullDesC; - } - -void CWPNameValue::ConstructL(const TDesC& aName, const TDesC& aValue) - { - aName.Length()==0 ? iName=KNullDesC().AllocL() : iName = aName.AllocL(); - aValue.Length()==0 ? iValue=KNullDesC().AllocL() : iValue = aValue.AllocL(); - } - -CWPNameValue::CWPNameValue() - { - } - -CWPNameValue::CWPNameValue( HBufC* aName, HBufC* aValue ) : - iName(aName), - iValue(aValue) - { - } - -// end of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Src/CWPSaver.cpp --- a/omaprovisioning/provisioning/ProvisioningBC/Src/CWPSaver.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,327 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Helper class for saving Provisioning settings. Provides a progress note. -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "CWPSaver.h" - -// CONSTANTS -const TInt KMaxWaitTime = 2000000; -const TInt KRetryCount = 5; - -// CLASS DECLARATION - -// ========================== MEMBER FUNCTIONS =============================== - -// ---------------------------------------------------------------------------- -// C++ default constructor. -// ---------------------------------------------------------------------------- -CWPSaver::CWPSaver( CWPEngine& aEngine, TBool aSetAsDefault ) - : CActive( EPriorityStandard ), - iEngine( aEngine ), - iSetAsDefault( aSetAsDefault ), - iCurrentItem( 0 ), - iResult( KErrNone ), - iNumAccessDenied(0) - { - } - -// ---------------------------------------------------------------------------- -// CWPSaver::PrepareLC -// ---------------------------------------------------------------------------- -// -void CWPSaver::PrepareLC() - { - // Assume ownership of this. - CleanupStack::PushL( this ); - - iApDbNotifier = CActiveApDb::NewL( EDatabaseTypeIAP ); - iApDbNotifier->AddObserverL( this ); - - User::LeaveIfError( iSession.Connect() ); - User::LeaveIfError( iBookmarkDb.Open( iSession, KBrowserBookmarks ) ); - iFavouritesNotifier = - new(ELeave) CActiveFavouritesDbNotifier( iBookmarkDb, *this ); - - iFavouritesNotifier->Start(); - - iRetryTimer = CPeriodic::NewL( EPriorityStandard ); - - // Set up the dialog and callback mechanism. - iDialog = new(ELeave)CAknProgressDialog( - reinterpret_cast(&iDialog), EFalse ); - iDialog->SetCallback( this ); - iDialog->ExecuteLD(R_WAITNOTE_SAVE); - CEikProgressInfo* progressInfo = iDialog->GetProgressInfoL(); - progressInfo->SetAndDraw(iCurrentItem); - progressInfo->SetFinalValue(iEngine.ItemCount()); - } - -// ---------------------------------------------------------------------------- -// CWPSaver::ExecuteLD -// ---------------------------------------------------------------------------- -// -TInt CWPSaver::ExecuteLD( TInt& aNumSaved ) - { - PrepareLC(); - - // Add us to active scheduler and make sure RunL() gets called. - CActiveScheduler::Add( this ); - CompleteRequest(); - iWait.Start(); - - // Progress note has been finished/cancelled. Cache the result - // and delete this. - TInt result( iResult ); - aNumSaved = iCurrentItem; - CleanupStack::PopAndDestroy(); // this - - return result; - } - -// ---------------------------------------------------------------------------- -// Destructor -// ---------------------------------------------------------------------------- -CWPSaver::~CWPSaver() - { - Cancel(); - - delete iApDbNotifier; - - if( iFavouritesNotifier ) - { - iFavouritesNotifier->Cancel(); - delete iFavouritesNotifier; - } - - iBookmarkDb.Close(); - iSession.Close(); - delete iRetryTimer; - } - -// ---------------------------------------------------------------------------- -// CWPSaver::DoCancel -// ---------------------------------------------------------------------------- -// -void CWPSaver::DoCancel() - { - } - -// ---------------------------------------------------------------------------- -// CWPSaver::RunL -// ---------------------------------------------------------------------------- -// -void CWPSaver::RunL() - { - // Choose whether to save or set as default - TInt err( KErrNone ); - if( iSetAsDefault ) - { - TRAP( err, - if( iEngine.CanSetAsDefault( iCurrentItem ) ) - { - iEngine.SetAsDefaultL( iCurrentItem ); - } ); - } - else - { - TRAP( err, iEngine.SaveL( iCurrentItem ) ); - } - - // If CommsDB or BookmarkDB are locked, schedule a retry - if( err == EWPCommsDBLocked || err == KErrLocked) - { - iWaitCommsDb = ETrue; - DelayedCompleteRequestL(); - return; - } - else if( err == EWPBookmarksLocked ) - { - iWaitFavourites = ETrue; - DelayedCompleteRequestL(); - return; - } - else if( err == KErrNone || err == KErrAccessDenied) - { - if( err == KErrAccessDenied) - { - TInt aNumAccessDenied = GetNumAccessDenied(); - aNumAccessDenied++; - SetNumAccessDenied(aNumAccessDenied); - iEngine.SetAccessDenied(ETrue); - } - - // Succesful save, so reset retry count - iRetryCount = 0; - - // Normal progress - if( iCurrentItem == iEngine.ItemCount()-1 ) - { - iDialog->ProcessFinishedL(); - } - else - { - CEikProgressInfo* progressInfo = iDialog->GetProgressInfoL(); - iCurrentItem++; - progressInfo->SetAndDraw(iCurrentItem); - CompleteRequest(); - } - } - else - { - // For all other errors, pass them through. - User::LeaveIfError( err ); - } - } - -// ---------------------------------------------------------------------------- -// CWPSaver::RunError -// ---------------------------------------------------------------------------- -// -TInt CWPSaver::RunError( TInt aError ) - { - // There was a leave in RunL(). Store the error and - // stop the dialog. - iResult = aError; - iWait.AsyncStop(); - delete iDialog; - iDialog = NULL; - - return KErrNone; - } - -// ---------------------------------------------------------------------------- -// CWPSaver::DialogDismissedL -// ---------------------------------------------------------------------------- -// -void CWPSaver::DialogDismissedL( TInt aButtonId ) - { - if( aButtonId < 0 ) - { - iResult = KErrCancel; - } - - iWait.AsyncStop(); - } - -// ---------------------------------------------------------------------------- -// CWPSaver::CompleteRequest -// ---------------------------------------------------------------------------- -// -void CWPSaver::CompleteRequest() - { - // Schedule an immediate complete. Make sure that there - // is no timer alive first - Cancel(); - iRetryTimer->Cancel(); - - SetActive(); - TRequestStatus* sp = &iStatus; - User::RequestComplete( sp, KErrNone ); - } - -// ---------------------------------------------------------------------------- -// CWPSaver::DelayedCompleteRequestL -// ---------------------------------------------------------------------------- -// -void CWPSaver::DelayedCompleteRequestL() - { - if( iRetryCount < KRetryCount ) - { - // Schedule a delayed complete. Cancel first in case - // an immediate request was scheduled. - iRetryTimer->Cancel(); - iRetryTimer->Start( KMaxWaitTime, KMaxTInt32, TCallBack( Timeout, this ) ); - iRetryCount++; - } - else - { - User::Leave( KErrTimedOut ); - } - } - -// ---------------------------------------------------------------------------- -// CWPSaver::Retry -// ---------------------------------------------------------------------------- -// -void CWPSaver::Retry() - { - // Immediate retry. Mark that we're not waiting - // for an event and complete request. - iWaitCommsDb = EFalse; - iWaitFavourites = EFalse; - CompleteRequest(); - } - -// ---------------------------------------------------------------------------- -// CWPSaver::Timeout -// ---------------------------------------------------------------------------- -// -TInt CWPSaver::Timeout(TAny* aSelf) - { - // There was a time-out. Retry saving even though we - // didn't get a notify from database. - CWPSaver* self = static_cast( aSelf ); - self->Retry(); - - return KErrNone; - } - -// ---------------------------------------------------------------------------- -// CWPSaver::HandleApDbEventL -// ---------------------------------------------------------------------------- -// -void CWPSaver::HandleApDbEventL( TEvent aEvent ) - { - // We received an event from CommsDB. Retry if we're - // waiting for it. - if( iWaitCommsDb && aEvent == EDbAvailable ) - { - Retry(); - } - } - -// ---------------------------------------------------------------------------- -// CWPSaver::HandleFavouritesDbEventL -// ---------------------------------------------------------------------------- -// -void CWPSaver::HandleFavouritesDbEventL( RDbNotifier::TEvent /*aEvent*/ ) - { - // We received an event from BookmarkDB. Retry if we're - // waiting for it. - if( iWaitFavourites ) - { - Retry(); - } - } - -TInt CWPSaver::GetNumAccessDenied() - { - return iNumAccessDenied; - } -void CWPSaver::SetNumAccessDenied(TInt aNumAccessDenied ) - { - iNumAccessDenied = aNumAccessDenied; - } -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/Src/CWPStringPair.cpp --- a/omaprovisioning/provisioning/ProvisioningBC/Src/CWPStringPair.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Sortable pair of strings. -* -*/ - - -// INCLUDE FILES -#include "CWPStringPair.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// C++ default constructor. -CWPStringPair::CWPStringPair() - { - } - -// Destructor -CWPStringPair::~CWPStringPair() - { - delete iName; - delete iValue; - } - -// --------------------------------------------------------- -// CWPStringPair::SetL -// --------------------------------------------------------- -// -void CWPStringPair::SetL( const TDesC& aName, const TDesC& aValue ) - { - HBufC* name = aName.AllocLC(); - HBufC* value = aValue.AllocL(); - CleanupStack::Pop(); // name - - delete iName; - iName = name; - iNamePtr.Set( *iName ); - - delete iValue; - iValue = value; - iValuePtr.Set( *iValue ); - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/eabi/ProvisioningBCu.def --- a/omaprovisioning/provisioning/ProvisioningBC/eabi/ProvisioningBCu.def Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -EXPORTS - _ZN13CWPBioControl4NewLER22MMsgBioControlObserverP11CMsvSessionl11TMsgBioModePK5RFile @ 1 NONAME - _ZTI13CWPBioControl @ 2 NONAME ; ## - _ZTI18CWPCodeQueryDialog @ 3 NONAME ; ## - _ZTI8CWPSaver @ 4 NONAME ; ## - _ZTV13CWPBioControl @ 5 NONAME ; ## - _ZTV18CWPCodeQueryDialog @ 6 NONAME ; ## - _ZTV8CWPSaver @ 7 NONAME ; ## - _ZTI12CWPNameValue @ 8 NONAME ; ## - _ZTV12CWPNameValue @ 9 NONAME ; ## - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningBC/loc/ProvisioningBC.loc --- a/omaprovisioning/provisioning/ProvisioningBC/loc/ProvisioningBC.loc Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2002 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 is a localisation file for Provisioning -* -* ------------------------------------------------------------------- -* -*/ - - - -// LOCALISATION STRINGS - -//**************************************************************************** - -//d:Message info in Message Details -//l:list_single_heading_pane_t1 -#define qtn_sm_title_configuration "Config. msg." - -//d:Provisioning message title pane item. -//l:title_pane_t2/opt12 -// -#define qtn_op_title_confsett "Configuration settings" - -//d:Help text for the user -//l:popup_info_list_pane_t1 -#define qtn_op_view_help "Select 'Save' from 'Options' to configure all settings" - -//d:Number of settings text if >5 -//l:popup_info_list_pane_t1 -#define qtn_op_sett_items "%N items" - -//d:Heading text for wait note in save all-operation -//l:popup_note_wait_window -// -#define qtn_sm_wait_saving_servsett "Saving service settings " - -//d:Not all settings saved -//l:popup_note_window -// -#define qtn_op_info_notsaved "%N settings saved. Uncompleted settings were not saved" - -//d:All settings saved -//l:popup_note_window -// -#define qtn_sm_all_serv_settings_copied "Saved" - -//d:Set as default query -//l:popup_note_window -// -#define qtn_op_conf_setdef "Set the received settings as default?" - -//d:Query presented when message is not authenticated. -//l:popup_note_window -// -#define qtn_op_nottsp_conf_note "Sender of the message is unknown. Continue?" - -//d:Command in options list. -//d:Saves the settings to the device. -//l:list_single_pane_t1_cp2 -// -#define qtn_op_options_save "Save" - -//d:Message cannot be opened -//l:popup_note_window -#define qtn_mce_info_message_not_opened "Unable to open. Message format not supported." - -//d:Message cannot be saved -//l:popup_note_window -#define qtn_op_error_save "No access points found in the message. Settings cannot be saved." - -//d:Message cannot be saved due to protected AP settings -//l:popup_note_window -#define qtn_sms_note_protected_ap "Unable to add access point to protected access point settings" - -//d:User entered a wrong PIN -//l:popup_note_window -#define qtn_op_verific_failed "Code error" - -//d:Text for PIN query -//l:popup_query_code_window/opt1 -#define qtn_op_enter_settpin "Enter settings’ PIN:" - -//d:User entered wrong PIN three times -//l:popup_note_window -#define qtn_op_verific_failed_totally "Verification failed and message was deleted. Contact your service provider." - -//d:Settings already saved query -//l:popup_note_window -#define qtn_op_already_saved "Settings are already saved. Save again?" - -//**************************************************************** -//from the mce ui specification - -//d:Name of the message [type]. -//l:list_double_graphic_pane_t2 -#define qtn_mce_inbox_type_smart_conf "Configuration message" - -//d:Text to be displayed on the pop up note -//l:popup_note_window -//r:3.2 -// -#define qtn_op_info_notsaved_singular_zero "No settings saved" - -//d:Text to be displayed on the pop up note -//l:popup_note_window -//r:3.2 -// -#define qtn_op_info_notsaved_singular_one "%N setting saved. Uncompleted settings were not saved " - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxApp.h --- a/omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxApp.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Provisioning dumpper application -* -*/ - - -#ifndef CWPCXAPP_H -#define CWPCXAPP_H - -// INCLUDES -#include - -// CLASS DECLARATION - -/** -* CProvisioningCxApp application class. -* Provides factory to create concrete document object. -* -*/ -class CWPCxApp : public CAknApplication - { - - private: - - /** - * From CApaApplication, creates CProvisioningCxDocument document object. - * @return A pointer to the created document object. - */ - CApaDocument* CreateDocumentL(); - - /** - * From CApaApplication, returns application's UID (KUidProvisioningCx). - * @return The value of KUidProvisioningDump. - */ - TUid AppDllUid() const; - }; - -#endif - -// End of File - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxAppUi.h --- a/omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxAppUi.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Provisioning context list application -* -*/ - - -#ifndef CWPCXAPPUI_H -#define CWPCXAPPUI_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class CWPCxContainer; - -// CLASS DECLARATION - -/** -* Application UI class. -* Provides support for the following features: -* - EIKON control architecture -* - view architecture -* - status pane -* -*/ -class CWPCxAppUi : public CAknViewAppUi - { - public: // // Constructors and destructor - - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CWPCxAppUi(); - - private: // from CEikAppUi - - void HandleCommandL(TInt aCommand); - - }; - -#endif - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxContainer.h --- a/omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxContainer.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Provisioning context list container -* -*/ - - -#ifndef CWPCXCONTAINER_H -#define CWPCXCONTAINER_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CAknSingleStyleListBox; -class CWPEngine; - -// CLASS DECLARATION - -/** -* CWPCxDocument container control class. -* -*/ -class CWPCxContainer : public CCoeControl, - private MCoeControlObserver - { - public: // Constructors and destructor - - /** - * C++ constructor - */ - CWPCxContainer( CWPEngine& aEngine, CAknView& aAppView ); - - /** - * Symbian default constructor. - * @param aRect Frame rectangle for container. - */ - void ConstructL(const TRect& aRect); - - /** - * Destructor. - */ - ~CWPCxContainer(); - - public: // from CCoeControl - - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); - void HandleResourceChange( TInt aType ); - - public: // new methods - - /** - * Returns the UID of the currently selected context. - * @return Context UID - */ - TUint32 CurrentContext() const; - - /** - * Returns the UID of the currently selected context. - * @return Context UID - */ - TPtrC CurrentContextName() const; - - /** - * Returns number of contexts in list. - * @return Number of contexts - */ - TInt ContextCount() const; - - /** - * Updates the list of contexts. - */ - void UpdateContextsL(); - - private: // from CCoeControl - - void SizeChanged(); - TInt CountComponentControls() const; - CCoeControl* ComponentControl(TInt aIndex) const; - void GetHelpContext( TCoeHelpContext& aContext ) const; - - private: // from MCoeControlObserver - - void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); - - private: //data - - /// The list box. Owns. - CAknSingleStyleListBox* iListBox; - - /// Provisioning engine. Refs. - CWPEngine& iEngine; - - /// List of context uids. Owns. - CArrayFix* iCxUids; - - /// List of visible lines. Owns. - CDesCArray* iLines; - - /// The application view - CAknView& iAppView; - }; - -#endif - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxDeleter.h --- a/omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxDeleter.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,152 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Settings deleter with progress note. -* -*/ - - -#ifndef CWPCXDELETER_H -#define CWPCXDELETER_H - -// INCLUDES -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CWPEngine; -class CActiveFavouritesDbNotifier; - -// CLASS DECLARATION - -/** - * Helper class for deleting Provisioning settings. - */ -class CWPCxDeleter : public CActive, - private MProgressDialogCallback, - private MActiveApDbObserver, - private MFavouritesDbObserver - { - public: - /** - * C++ default constructor. - * @param aEngine Engine to be used for saving - */ - CWPCxDeleter( CWPEngine& aEngine, TUint32 aContext ); - - /** - * Destructor. - */ - ~CWPCxDeleter(); - - public: - /** - * Prepares the object for saving. - */ - void PrepareLC(); - - /** - * Executes save with a progress note. Ownership of the - * CWPSaver object is transferred. - * @param aNumDeleted When returns, contains number of settings saved. - * @return Status code. >= 0 if saving was completed - */ - TInt ExecuteLD( TInt& aNumDeleted ); - - protected: // From CActive - - void DoCancel(); - void RunL(); - TInt RunError( TInt aError ); - - private: // From MProgressDialogCallback - - void DialogDismissedL( TInt aButtonId ); - - private: // from MActiveApDbObserver - - void HandleApDbEventL( TEvent anEvent ); - - private: // from MFavouritesDbObserver - - void HandleFavouritesDbEventL( RDbNotifier::TEvent aEvent ); - - private: - /** - * Complete the request so that RunL() gets called. - */ - void CompleteRequest(); - - /** - * Complete the request so that Timeout() gets called after - * a delay. - */ - void DelayedCompleteRequestL(); - - /** - * Retry save now. - */ - void Retry(); - - /** - * Timer timed-out. - */ - static TInt Timeout(TAny* aSelf); - - private: - // The engine used for performing the save. Refs. - CWPEngine& iEngine; - - // The context being deleted - TUint32 iContext; - - // The progress dialog. Owns. - CAknProgressDialog* iDialog; - - // The item to be saved next - TInt iCurrentItem; - - // Contains result to be passed to the called of ExecuteLD - TInt iResult; - - // Active AP database - CActiveApDb* iApDbNotifier; - - // Active Favourites Database - CActiveFavouritesDbNotifier* iFavouritesNotifier; - - // Contains ETrue if commsdb is being waited on - TBool iWaitCommsDb; - - // Contains ETrue if favourites db is being waited on - TBool iWaitFavourites; - - // Active scheduler. - CActiveSchedulerWait iWait; - - // Timer for retry - CPeriodic* iRetryTimer; - - // Retry count - TInt iRetryCount; - - RFavouritesDb iBookmarkDb; - RFavouritesSession iSession; - }; - - -#endif // CWPCXDELETER_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxDocument.h --- a/omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxDocument.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Provisioning context list document -* -*/ - - -#ifndef CWPCXDOCUMENT_H -#define CWPCXDOCUMENT_H - -// INCLUDES -#include - -// CONSTANTS - -// FORWARD DECLARATIONS -class CEikAppUi; - -// CLASS DECLARATION - -/** -* CWPCxDocument document class. -*/ -class CWPCxDocument : public CAknDocument - { - public: // Constructors and destructor - /** - * Two-phased constructor. - */ - static CWPCxDocument* NewL(CEikApplication& aApp); - - /** - * Destructor. - */ - ~CWPCxDocument(); - - private: - - /** - * C++ default constructor. - */ - CWPCxDocument(CEikApplication& aApp); - - /** - * Symbian second phase constructor. - */ - void ConstructL(); - - private: // from CEikDocument - - CEikAppUi* CreateAppUiL(); - }; - -#endif - -// End of File - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxView.h --- a/omaprovisioning/provisioning/ProvisioningCx/Inc/CWPCxView.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Provisioning context list view -* -*/ - - -#ifndef CWPCXVIEW_H -#define CWPCXVIEW_H - -// INCLUDES -#include -#include "MWPContextObserver.h" - -// CONSTANTS -// UID of view -const TUid KProvisioningCxViewId = {1}; - -// FORWARD DECLARATIONS -class CWPCxContainer; -class CWPEngine; - -// CLASS DECLARATION - -/** -* CProvisioningDumpView view class. -* -*/ -class CWPCxView : public CAknView, private MWPContextObserver - { - public: // Constructors and destructor - - /** - * EPOC default constructor. - */ - void ConstructL(); - - /** - * Destructor. - */ - ~CWPCxView(); - - public: // from CAknView - - TUid Id() const; - void HandleCommandL(TInt aCommand); - void HandleClientRectChange(); - - private: // from CAknView - - void DoActivateL(const TVwsViewId& aPrevViewId,TUid aCustomMessageId, - const TDesC8& aCustomMessage); - void DoDeactivate(); - - public: // From MWPContextObserver - void ContextChangeL( RDbNotifier::TEvent aEvent ); - - private: - // From MEikMenuObserver - void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); - - private: // new methods - void DeleteContextL(); - void LaunchPopupL(); - - private: // Data - /// The context list container. Owns. - CWPCxContainer* iContainer; - - /// The ProvisioningEngine instance. Owns. - CWPEngine* iEngine; - - }; - -#endif - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Inc/ProvisioningCx.hrh --- a/omaprovisioning/provisioning/ProvisioningCx/Inc/ProvisioningCx.hrh Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Provisioning context list view commands -* -*/ - - -#ifndef PROVISIONINGCX_HRH -#define PROVISIONINGCX_HRH - -enum TProvisioningCxMenuCommands - { - EProvisioningCxCmdDeleteContext = 1, - EProvisioningCxCmdSelect - }; - - -#endif // PROVISIONINGCX_HRH diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Rss/ProvisioningCx.rss --- a/omaprovisioning/provisioning/ProvisioningCx/Rss/ProvisioningCx.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -/* -* Copyright (c) 2002 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 all the resources for the module ProvisioningHandler. -* -* -*/ - - -// RESOURCE IDENTIFIER - -NAME PROV - -// INCLUDES - -#include -#include -#include -#include -#include -#include -#include "ProvisioningCx.hrh" -#include - -#include - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf=qtn_op_conf_cont_title; } - -//not_used -RESOURCE EIK_APP_INFO not_used - { - menubar = 0; - cba = 0; - } - -RESOURCE LOCALISABLE_APP_INFO r_provisioningcx_localisable_app_info - { - short_caption = qtn_op_conf_cont_title; - caption_and_icon = - CAPTION_AND_ICON_INFO - { - caption = qtn_op_conf_cont_title; - #ifdef __SCALABLE_ICONS - number_of_icons = 1; - icon_file = "Z:\\resource\\apps\\ProvisioningCx_aif.mif"; - #else - number_of_icons = 2; - icon_file = "Z:\\resource\\apps\\ProvisioningCx_aif.mbm"; - #endif - }; - } - -#ifdef __SERIES60_32__ -//---------------------------------------------------- -// -// r_provisioningcx_softkeys_options_back__contextoptions -// Provisioning context list view -// -//---------------------------------------------------- -// -RESOURCE CBA r_provisioningcx_softkeys_options_back__contextoptions - { - buttons = - { - - CBA_BUTTON - { - id = EAknSoftkeyOptions; txt = text_softkey_option; - }, - - - CBA_BUTTON - { - id = EAknSoftkeyBack; txt = text_softkey_back; - }, - - CBA_BUTTON - { - id = EAknSoftkeyContextOptions; txt = text_softkey_option; - } - - }; - - } -#endif -//---------------------------------------------------- -// -// r_provisioningcx_view1 -// Provisioning context list view -// -//---------------------------------------------------- -// -RESOURCE AVKON_VIEW r_provisioningcx_view1 - { - menubar=r_provisioningcx_menubar_view1; - #ifdef __SERIES60_32__ // KS - cba = r_provisioningcx_softkeys_options_back__contextoptions; - #else - cba=R_AVKON_SOFTKEYS_SELECTION_LIST; - #endif - } - -//---------------------------------------------------- -// -// r_provisioningcx_menubar_view1 -// Menu bar for view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_provisioningcx_menubar_view1 -{ - titles= - { - MENU_TITLE { menu_pane = r_provisioningcx_app_menu; } - }; -} - -//---------------------------------------------------- -// -// r_provisioningcx_app_menu -// Menu bar for view -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_provisioningcx_app_menu -{ - items= - { - MENU_ITEM { command=EProvisioningCxCmdDeleteContext; txt = qtn_op_opt_delete; }, - MENU_ITEM { command=EAknCmdHelp; txt=qtn_options_help; }, - MENU_ITEM { command=EAknCmdExit; txt=qtn_options_exit; } - }; -} - -//---------------------------------------------------- -// -// r_provisioningcx_context_menubar -// Menu bar for view -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_provisioningcx_context_menubar - { - titles = - { - MENU_TITLE { menu_pane = r_provisioningcx_context_menu; } - }; - } - -//---------------------------------------------------- -// -// r_provisioningcx_context_menu -// Menu bar for view -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_provisioningcx_context_menu -{ - items= - { - MENU_ITEM { command=EProvisioningCxCmdDeleteContext; txt = qtn_op_opt_delete; } - }; -} - -//---------------------------------------------------- -// -// r_provisioningcx_listbox -// Context list box -// -//---------------------------------------------------- -// -RESOURCE LISTBOX r_provisioningcx_listbox - { - flags = EAknListBoxSelectionList; - } - -// --------------------------------------------------------- -// -// r_provisioncx_query_delete -// Confirmation query for deletion -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_provisioncx_query_delete - { - flags = EGeneralQueryFlags; - #ifdef __SERIES60_32__ // KS - buttons = R_AVKON_SOFTKEYS_YES_NO__YES; - #else - buttons = R_AVKON_SOFTKEYS_YES_NO; - #endif - - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - }; - } - }; - } - -//---------------------------------------------------- -// -// r_provisioningcx_empty -// Text when there are no configuration contexts -// -//---------------------------------------------------- -// -RESOURCE TBUF r_qtn_op_conf_cont_empty - { - buf = qtn_op_conf_cont_empty; - } - -//---------------------------------------------------- -// -// r_provisioningcx_delete -// Text for deletion query -// -//---------------------------------------------------- -// -RESOURCE TBUF r_qtn_op_delete_context - { - buf = qtn_op_delete_context; - } - -//---------------------------------------------------- -// -// r_provisioningcx_default_name -// Text for deletion query -// -//---------------------------------------------------- -// -RESOURCE TBUF r_qtn_op_context_name - { - buf = qtn_op_context_name; - } - -//---------------------------------------------------- -// -// r_provisioningcx_default_name2 -// Text for deletion query -// -//---------------------------------------------------- -// -RESOURCE TBUF r_qtn_op_context_name2 - { - buf = qtn_op_context_name2; - } - - -// --------------------------------------------------------- -// -// r_waitnote_delete -// Save wait note -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_waitnote_delete - { - flags = EAknProgressNoteFlags; - buttons = R_AVKON_SOFTKEYS_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtNote; - id = 1; - control = AVKON_NOTE - { - layout = EProgressLayout; - singular_label = qtn_fldr_deleting_wait_note; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_text_qtn_op_del_cont_no -// Error note when a context is active. -// -// --------------------------------------------------------- -// -RESOURCE TBUF r_text_qtn_op_del_cont_no - { - buf=qtn_op_del_cont_no; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Rss/ProvisioningCx_Caption.rss --- a/omaprovisioning/provisioning/ProvisioningCx/Rss/ProvisioningCx_Caption.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Application information resource file that defines short and long caption -* for ProvisioningCx application. -* -*/ - - -#include -#include - -RESOURCE CAPTION_DATA - { - caption=qtn_op_conf_cont_title; - } - - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Rss/ProvisioningCx_reg.rss --- a/omaprovisioning/provisioning/ProvisioningCx/Rss/ProvisioningCx_reg.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2004 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: -* -*/ - - -#include -#include -#include "ProvisioningUids.h" -#include - -UID2 KUidAppRegistrationResourceFile -UID3 KProvisioningCxUID3 // Define your application UID here - -RESOURCE APP_REGISTRATION_INFO - { - app_file = "ProvisioningCx"; - localisable_resource_file = APP_RESOURCE_DIR"\\ProvisioningCx"; - localisable_resource_id = R_PROVISIONINGCX_LOCALISABLE_APP_INFO; - hidden = KAppIsHidden; - embeddability = KAppEmbeddable; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxApp.cpp --- a/omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxApp.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Provisioning context list -* -*/ - - -// INCLUDE FILES -#include - -#include "CWPCxApp.h" -#include "CWPCxDocument.h" -#include "ProvisioningUIDs.h" - - -LOCAL_C CApaApplication* NewApplication() - { - return new CWPCxApp; - } - -GLDEF_C TInt E32Main() - { - return EikStart::RunApplication(NewApplication); - } - - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CWPCxApp::AppDllUid() -// --------------------------------------------------------- -// -TUid CWPCxApp::AppDllUid() const - { - return TUid::Uid( KProvisioningCxUID3 ); - } - -// --------------------------------------------------------- -// CWPCxApp::CreateDocumentL() -// --------------------------------------------------------- -// -CApaDocument* CWPCxApp::CreateDocumentL() - { - return CWPCxDocument::NewL( *this ); - } - -// End of File - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxAppUi.cpp --- a/omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxAppUi.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2002 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: Provisioning context list -* -*/ - - -// INCLUDE FILES -#include "CWPCxAppUi.h" - -#include -#include -#include -#include "CWPCxView.h" -#include "CWPCxContainer.h" -#include "provisioningCx.hrh" - -// ================= MEMBER FUNCTIONS ======================= -// -// ---------------------------------------------------------- -// CWPCxAppUi::ConstructL() -// ---------------------------------------------------------- -// -void CWPCxAppUi::ConstructL() - { - #ifdef __SERIES60_32__ - BaseConstructL( EAknEnableSkin | EAknEnableMSK); - #else - BaseConstructL( EAknEnableSkin); - #endif - - CWPCxView* view1 = new (ELeave) CWPCxView; - - CleanupStack::PushL( view1 ); - view1->ConstructL(); - AddViewL( view1 ); // transfer ownership to CAknViewAppUi - CleanupStack::Pop(); // view1 - } - -// Destructor -CWPCxAppUi::~CWPCxAppUi() - { - } - -// ---------------------------------------------------- -// CWPCxAppUi::HandleCommandL -// ---------------------------------------------------- -// -void CWPCxAppUi::HandleCommandL(TInt aCommand) - { - switch ( aCommand ) - { - case EAknCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), AppHelpContextL() ); - break; - } - case EEikCmdExit: - { - Exit(); - break; - } - - default: - break; - } - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxContainer.cpp --- a/omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxContainer.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -/* -* Copyright (c) 2002 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: Provisioning context list -* -*/ - - -// INCLUDE FILES -#include "CWPCxContainer.h" -#include -#include -#include -#include -#include -#include "CWPEngine.h" -#include "ProvisioningUids.h" -#include "ProvisioningCx.hrh" -#include "Provisioningdebug.h" - -// CONSTANTS -/// Granularity of the lines array -const TInt KLinesGranularity = 3; -/// Maximum number of characters in one line -const TInt KMaxLineLength = 128; -/// Number of tabs in front of the line -const TInt KNumTabsPrepended = 1; -/// Number of tabs in the end of the line -const TInt KNumTabsAppended = 2; - -//help resources -//_LIT(KPROV_HLP_CONFCONT,"PROV_HLP_CONFCONT"); -const TUint32 KGSUid = 0x100058ec; - -// ================= MEMBER FUNCTIONS ======================= - -// ----------------------------------------------------------------------------- -// CWPCxContainer::CWPCxContainer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPCxContainer::CWPCxContainer( CWPEngine& aEngine, CAknView& aAppView ) - : iEngine( aEngine ), iAppView( aAppView ) - { - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::ConstructL -// ----------------------------------------------------------------------------- -// -void CWPCxContainer::ConstructL( const TRect& aRect ) - { - CreateWindowL(); - - iListBox = new(ELeave) CAknSingleStyleListBox; - iListBox->SetContainerWindowL( *this); - - // Add vertical scroll bar for the list - CEikScrollBarFrame* sbFrame = iListBox->CreateScrollBarFrameL( ETrue ); - sbFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, - CEikScrollBarFrame::EAuto ); // vertical - TResourceReader rr; - CEikonEnv::Static()->CreateResourceReaderLC( rr, R_PROVISIONINGCX_LISTBOX ); - iListBox->SetContainerWindowL( *this ); - iListBox->ConstructFromResourceL( rr ); - CleanupStack::PopAndDestroy(); // rr - - iLines = new(ELeave) CDesCArrayFlat(KLinesGranularity); - UpdateContextsL(); - - iListBox->Model()->SetItemTextArray( iLines ); - iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); - - HBufC* emptyText = StringLoader::LoadLC( R_QTN_OP_CONF_CONT_EMPTY ); - iListBox->View()->SetListEmptyTextL( *emptyText ); - CleanupStack::PopAndDestroy( emptyText ); - - SetRect(aRect); - ActivateL(); - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPCxContainer::~CWPCxContainer() - { - delete iListBox; - delete iCxUids; - delete iLines; - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::CurrentContext -// ----------------------------------------------------------------------------- -// -TUint32 CWPCxContainer::CurrentContext() const - { - TInt current( iListBox->CurrentItemIndex() ); - - TUint32 result( KWPUidNoContext ); - if( current >= 0 ) - { - result = iCxUids->At( current ); - } - return result; - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::CurrentContextName -// ----------------------------------------------------------------------------- -// -TPtrC CWPCxContainer::CurrentContextName() const - { - TInt current( iListBox->CurrentItemIndex() ); - - TPtrC result( iLines->MdcaPoint( current ) ); - result.Set( result.Mid( KNumTabsPrepended ) ); - result.Set( result.Left( result.Length()-KNumTabsAppended ) ); - return result; - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::ContextCount -// ----------------------------------------------------------------------------- -// -TInt CWPCxContainer::ContextCount() const - { - return iLines->MdcaCount(); - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::UpdateContextsL -// ----------------------------------------------------------------------------- -// -void CWPCxContainer::UpdateContextsL() - { - FLOG( _L( "[Provisioning] CWPCxContainer::UpdateContextsL" ) ); - - delete iCxUids; - iCxUids = NULL; - iCxUids = iEngine.ContextUidsL(); - - iLines->Reset(); - - TInt defaultCount( 0 ); - const TInt numUids( iCxUids->Count() ); - for( TInt i( 0 ); i < numUids; i++ ) - { - FLOG( _L( "[Provisioning] CWPCxContainer::UpdateContextsL 1" ) ); - TBuf line; - - TUint32 uid( iCxUids->At( i ) ); - - HBufC* tps = iEngine.ContextTPSL( uid ); - CleanupStack::PushL( tps ); - HBufC* name = iEngine.ContextNameL( uid ); - if( name->Length() == 0 ) - { - FLOG( _L( "[Provisioning] CWPCxContainer::UpdateContextsL name length 0" ) ); - delete name; - if( defaultCount == 0 ) - { - name = StringLoader::LoadL( R_QTN_OP_CONTEXT_NAME ); - } - else - { - name = StringLoader::LoadL( R_QTN_OP_CONTEXT_NAME2, - defaultCount ); - } - defaultCount++; - } - CleanupStack::PushL( name ); - - line.Zero(); - line.Append( EKeyTab ); - line.Append( *name ); - line.Append( EKeyTab ); - line.Append( EKeyTab ); - - CleanupStack::PopAndDestroy( name ); - CleanupStack::PopAndDestroy( tps ); - - iLines->AppendL( line ); - } - - iListBox->HandleItemAdditionL(); - - TInt index = iListBox->CurrentItemIndex(); - TInt count = iListBox->Model()->NumberOfItems(); - - if ( (index < 0 || index >= count) && count > 0 ) - { - // sets the last item as focused - iListBox->SetCurrentItemIndexAndDraw(count-1); - iListBox->HandleItemRemovalL(); - } - FLOG( _L( "[Provisioning] CWPCxContainer::UpdateContextsL done" ) ); - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::SizeChanged -// ----------------------------------------------------------------------------- -// -void CWPCxContainer::SizeChanged() - { - iListBox->SetRect(Rect()); - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::CountComponentControls -// ----------------------------------------------------------------------------- -// -TInt CWPCxContainer::CountComponentControls() const - { - return 1; - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::ComponentControl -// ----------------------------------------------------------------------------- -// -CCoeControl* CWPCxContainer::ComponentControl( TInt /*aIndex*/ ) const - { - return iListBox; - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::HandleControlEventL -// ----------------------------------------------------------------------------- -// -void CWPCxContainer::HandleControlEventL( CCoeControl* /*aControl*/, - TCoeEvent /*aEventType*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::OfferKeyEventL -// ----------------------------------------------------------------------------- -// -TKeyResponse CWPCxContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, - TEventCode aType) - { - switch ( aKeyEvent.iCode ) - { - case EKeyBackspace: - { - iAppView.ProcessCommandL( EProvisioningCxCmdDeleteContext ); - break; - } - case EKeyOK: - { - iAppView.ProcessCommandL( EProvisioningCxCmdSelect ); - break; - } - default: - { - break; - } - } - - return iListBox->OfferKeyEventL( aKeyEvent, aType ); - } - -// ----------------------------------------------------------------------------- -// CWPCxContainer::GetHelpContext -// ----------------------------------------------------------------------------- -// -void CWPCxContainer::GetHelpContext( TCoeHelpContext& aContext ) const - { - aContext.iContext = KPROV_HLP_CONFCONT() ; - aContext.iMajor=TUid::Uid( KGSUid ); - } - -// --------------------------------------------------------------------------- -// CWPCxContainer::HandleResourceChange -// -// --------------------------------------------------------------------------- - -void CWPCxContainer::HandleResourceChange( TInt aType ) - { - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - TRect mainPaneRect; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, - mainPaneRect); - SetRect( mainPaneRect ); - DrawNow(); - } - CCoeControl::HandleResourceChange( aType ); - } - - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxDeleter.cpp --- a/omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxDeleter.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,291 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Helper class for saving Provisioning settings. Provides a progress note. -* -*/ - - -// INCLUDE FILES -#include "CWPCxDeleter.h" -#include -#include -#include -#include -#include -#include -#include - -// CONSTANTS -const TInt KMaxWaitTime = 2000000; -const TInt KRetryCount = 5; - -// CLASS DECLARATION - -// ================= MEMBER FUNCTIONS ======================= - -// C++ default constructor. -CWPCxDeleter::CWPCxDeleter( CWPEngine& aEngine, TUint32 aContext ) -: CActive( EPriorityStandard ), iEngine( aEngine ), - iContext( aContext ), - iCurrentItem( 0 ), iResult( KErrNone ) - { - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::ExecuteLD -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::PrepareLC() - { - // Assume ownership of this. - CleanupStack::PushL( this ); - - iApDbNotifier = CActiveApDb::NewL( EDatabaseTypeIAP ); - iApDbNotifier->AddObserverL( this ); - - User::LeaveIfError( iSession.Connect() ); - User::LeaveIfError( iBookmarkDb.Open( iSession, KBrowserBookmarks ) ); - iFavouritesNotifier = new(ELeave) CActiveFavouritesDbNotifier( iBookmarkDb, *this ); - - iFavouritesNotifier->Start(); - - iRetryTimer = CPeriodic::NewL( EPriorityStandard ); - - // Set up the dialog and callback mechanism. - iDialog = new(ELeave)CAknProgressDialog( - reinterpret_cast(&iDialog), EFalse ); - iDialog->SetCallback( this ); - iDialog->ExecuteLD(R_WAITNOTE_DELETE); - CEikProgressInfo* progressInfo = iDialog->GetProgressInfoL(); - progressInfo->SetAndDraw(iCurrentItem); - progressInfo->SetFinalValue(iEngine.ContextDataCountL(iContext)); - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::ExecuteLD -// ---------------------------------------------------------------------------- -// -TInt CWPCxDeleter::ExecuteLD( TInt& aNumDeleted ) - { - PrepareLC(); - - // Add us to active scheduler and make sure RunL() gets called. - CActiveScheduler::Add( this ); - CompleteRequest(); - iWait.Start(); - - // Progress note has been finished/cancelled. Cache the result - // and delete this. - TInt result( iResult ); - aNumDeleted = iCurrentItem; - CleanupStack::PopAndDestroy(); // this - - return result; - } - -// Destructor -CWPCxDeleter::~CWPCxDeleter() - { - Cancel(); - - delete iApDbNotifier; - - if( iFavouritesNotifier ) - { - iFavouritesNotifier->Cancel(); - delete iFavouritesNotifier; - } - - iBookmarkDb.Close(); - iSession.Close(); - - delete iRetryTimer; - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::DoCancel -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::DoCancel() - { - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::RunL -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::RunL() - { - // Choose whether to save or set as default - TBool more( EFalse ); - TRAPD( err, more = iEngine.DeleteContextDataL( iContext ) ); - - // If CommsDB or BookmarkDB are locked, schedule a retry - if( err == EWPCommsDBLocked ) - { - iWaitCommsDb = ETrue; - DelayedCompleteRequestL(); - return; - } - else if( err == EWPBookmarksLocked ) - { - iWaitFavourites = ETrue; - DelayedCompleteRequestL(); - return; - } - else if( err != KErrNone ) - { - // For all other errors, pass them through. - User::LeaveIfError( err ); - } - // Succesful save, so reset retry count - iRetryCount = 0; - - // Normal progress - if( !more ) - { - iDialog->ProcessFinishedL(); - } - else - { - CEikProgressInfo* progressInfo = iDialog->GetProgressInfoL(); - iCurrentItem++; - progressInfo->SetAndDraw(iCurrentItem); - CompleteRequest(); - } - } - -// --------------------------------------------------------- -// CWPCxDeleter::RunError -// --------------------------------------------------------- -// -TInt CWPCxDeleter::RunError( TInt aError ) - { - // There was a leave in RunL(). Store the error and - // stop the dialog. - iResult = aError; - iWait.AsyncStop(); - delete iDialog; - iDialog = NULL; - - return KErrNone; - } - -// --------------------------------------------------------- -// CWPCxDeleter::DialogDismissedL -// --------------------------------------------------------- -// -void CWPCxDeleter::DialogDismissedL( TInt aButtonId ) - { - if( aButtonId < 0 ) - { - iResult = KErrCancel; - } - - iWait.AsyncStop(); - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::CompleteRequest -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::CompleteRequest() - { - // Schedule an immediate complete. Make sure that there - // is no timer alive first - Cancel(); - iRetryTimer->Cancel(); - - SetActive(); - TRequestStatus* sp = &iStatus; - User::RequestComplete( sp, KErrNone ); - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::DelayedCompleteRequestL -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::DelayedCompleteRequestL() - { - if( iRetryCount < KRetryCount ) - { - // Schedule a delayed complete. - iRetryTimer->Cancel(); - iRetryTimer->Start( KMaxWaitTime, KMaxTInt32, TCallBack( Timeout, this ) ); - iRetryCount++; - } - else - { - User::Leave( KErrTimedOut ); - } - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::Retry -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::Retry() - { - // Immediate retry. Mark that we're not waiting - // for an event and complete request. - - iWaitCommsDb = EFalse; - iWaitFavourites = EFalse; - CompleteRequest(); - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::Timeout -// ---------------------------------------------------------------------------- -// -TInt CWPCxDeleter::Timeout(TAny* aSelf) - { - // There was a time-out. Retry saving even though we - // didn't get a notify from database. - CWPCxDeleter* self = STATIC_CAST(CWPCxDeleter*, aSelf); - self->Retry(); - - return KErrNone; - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::HandleApDbEventL -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::HandleApDbEventL( TEvent aEvent ) - { - // We received an event from CommsDB. Retry if we're - // waiting for it. - if( iWaitCommsDb && aEvent == EDbAvailable ) - { - Retry(); - } - } - -// ---------------------------------------------------------------------------- -// CWPCxDeleter::HandleFavouritesDbEventL -// ---------------------------------------------------------------------------- -// -void CWPCxDeleter::HandleFavouritesDbEventL( RDbNotifier::TEvent /*aEvent*/ ) - { - // We received an event from BookmarkDB. Retry if we're - // waiting for it. - if( iWaitFavourites ) - { - Retry(); - } - } - -// End of File - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxDocument.cpp --- a/omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxDocument.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2002 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: Dumper application -* -*/ - - -// INCLUDE FILES -#include "CWPCxDocument.h" -#include "CWPCxAppUi.h" - -// ================= MEMBER FUNCTIONS ======================= - -// C++ constructor -CWPCxDocument::CWPCxDocument( CEikApplication& aApp ) -: CAknDocument(aApp) - { - } - -// destructor -CWPCxDocument::~CWPCxDocument() - { - } - -// EPOC default constructor can leave. -void CWPCxDocument::ConstructL() - { - } - -// Two-phased constructor. -CWPCxDocument* CWPCxDocument::NewL( CEikApplication& aApp ) - { - CWPCxDocument* self = new (ELeave) CWPCxDocument( aApp ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - } - -// ---------------------------------------------------- -// CWPCxDocument::CreateAppUiL -// ---------------------------------------------------- -// -CEikAppUi* CWPCxDocument::CreateAppUiL() - { - return new (ELeave) CWPCxAppUi; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxView.cpp --- a/omaprovisioning/provisioning/ProvisioningCx/Src/CWPCxView.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,291 +0,0 @@ -/* -* Copyright (c) 2002 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: Dumper application -* -*/ - - -// INCLUDE FILES -#include "CWPCxView.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CWPEngine.h" -#include "CWPCxContainer.h" -#include "CWPCxDeleter.h" -#include "ProvisioningCx.hrh" -#include - -// CONSTANTS - -// ================= MEMBER FUNCTIONS ======================= - -// --------------------------------------------------------- -// CWPCxView::ConstructL -// Symbian second phase constructor -// --------------------------------------------------------- -// -void CWPCxView::ConstructL() - { - BaseConstructL( R_PROVISIONINGCX_VIEW1 ); - FeatureManager::InitializeLibL(); - iEngine = CWPEngine::NewL(); - iEngine->RegisterContextObserverL( this ); - } - -// --------------------------------------------------------- -// CWPCxView::~CWPCxView -// --------------------------------------------------------- -// -CWPCxView::~CWPCxView() - { - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; - delete iEngine; - FeatureManager::UnInitializeLib(); - } - -// --------------------------------------------------------- -// TUid CWPCxView::Id -// --------------------------------------------------------- -// -TUid CWPCxView::Id() const - { - return KProvisioningCxViewId; - } - -// --------------------------------------------------------- -// CWPCxView::HandleCommandL -// --------------------------------------------------------- -// -void CWPCxView::HandleCommandL(TInt aCommand) - { - switch ( aCommand ) - { - case EProvisioningCxCmdDeleteContext: - { - DeleteContextL(); - break; - } - case EAknSoftkeyBack: - { - AppUi()->HandleCommandL(EEikCmdExit); - break; - } - case EProvisioningCxCmdSelect: - { - LaunchPopupL(); - break; - } - default: - { - AppUi()->HandleCommandL(aCommand); - break; - } - } - } - -// --------------------------------------------------------- -// CWPCxView::HandleClientRectChange -// --------------------------------------------------------- -// -void CWPCxView::HandleClientRectChange() - { - if ( iContainer ) - { - iContainer->SetRect( ClientRect() ); - } - } - -// --------------------------------------------------------- -// CWPCxView::DoActivateL -// --------------------------------------------------------- -// -void CWPCxView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, - TUid /*aCustomMessageId*/, - const TDesC8& /*aCustomMessage*/) - { - iContainer = new (ELeave) CWPCxContainer( *iEngine, *this ); - iContainer->ConstructL( ClientRect() ); - iContainer->SetMopParent( this ); - AppUi()->AddToStackL( *this, iContainer ); - #ifdef __SERIES60_32__ - MenuBar()->SetContextMenuTitleResourceId( R_PROVISIONINGCX_CONTEXT_MENUBAR ); - - CEikButtonGroupContainer* bgc(NULL); - CCoeControl* MSK(NULL); - CEikCba* cba(NULL); - MopGetObject (bgc); - TInt count(iContainer->ContextCount()); - - - if (bgc) - { - cba = ( static_cast( bgc->ButtonGroup() ) ); // downcast from MEikButtonGroup - if (cba) - { - MSK = cba->Control(3); // MSK's position is 3 - } - - MSK->MakeVisible((count > 0)); - } - - #endif - } - -// --------------------------------------------------------- -// CWPCxView::DoDeactivate -// --------------------------------------------------------- -// -void CWPCxView::DoDeactivate() - { - if ( iContainer ) - { - AppUi()->RemoveFromStack( iContainer ); - } - - delete iContainer; - iContainer = NULL; - } - -// --------------------------------------------------------- -// CWPCxView::ContextChangeL -// --------------------------------------------------------- -// -void CWPCxView::ContextChangeL( RDbNotifier::TEvent /*aEvent*/ ) - { - iContainer->UpdateContextsL(); - - #ifdef __SERIES60_32__ - CEikButtonGroupContainer* bgc(NULL); - CCoeControl* MSK(NULL); - CEikCba* cba(NULL); - MopGetObject (bgc); - TInt count(iContainer->ContextCount()); - - - if (bgc) - { - cba = ( static_cast( bgc->ButtonGroup() ) ); // downcast from MEikButtonGroup - if (cba) - { - MSK = cba->Control(3); // MSK's position is 3 - } - - MSK->MakeVisible((count > 0)); - } - - #endif - } - -// ------------------------------------------------------------------------------ -// CWPCxView::::DynInitMenuPaneL -// ------------------------------------------------------------------------------ -// -void CWPCxView::DynInitMenuPaneL( - TInt aResourceId,CEikMenuPane* aMenuPane) - { - switch( aResourceId ) - { - case R_PROVISIONINGCX_APP_MENU: - { - if( !FeatureManager::FeatureSupported(KFeatureIdHelp) ) - { - aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); - } - - if( iContainer->ContextCount() == 0 ) - { - aMenuPane->SetItemDimmed( EProvisioningCxCmdDeleteContext, ETrue ); - } - - break; - } - - case R_PROVISIONINGCX_CONTEXT_MENU: - { - if( iContainer->ContextCount() == 0 ) - { - aMenuPane->SetItemDimmed( EProvisioningCxCmdDeleteContext, ETrue ); - } - break; - } - } - } - - -// ------------------------------------------------------------------------------ -// CWPCxView::::DeleteContextL -// ------------------------------------------------------------------------------ -// -void CWPCxView::DeleteContextL() - { - if(iContainer->ContextCount() == 0 ) - { - return; - } - TPtrC name( iContainer->CurrentContextName() ); - HBufC* query = StringLoader::LoadLC( R_QTN_OP_DELETE_CONTEXT, name ); - - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if ( dlg->ExecuteLD( R_PROVISIONCX_QUERY_DELETE, *query ) ) - { - TUint32 cx( iContainer->CurrentContext() ); - CWPCxDeleter* deleter = new(ELeave) CWPCxDeleter( *iEngine, cx ); - TInt numDeleted( 0 ); - TInt err( deleter->ExecuteLD( numDeleted ) ); - if( err == KErrNone ) - { - iEngine->DeleteContextL( cx ); - } - else if( err != KErrCancel ) - { - // Some problem in saving or user cancelled. - HBufC* text = StringLoader::LoadLC( R_TEXT_QTN_OP_DEL_CONT_NO ); - CAknErrorNote* note = new(ELeave)CAknErrorNote( ETrue ); - note->ExecuteLD(*text); - CleanupStack::PopAndDestroy(); // text - } - } - CleanupStack::PopAndDestroy(); // query - } - - -// ---------------------------------------------------- -// CWPCxView::LaunchPopupL -// ---------------------------------------------------- -// -void CWPCxView::LaunchPopupL() - { - CEikMenuBar* menu = MenuBar(); - - menu->SetMenuTitleResourceId( R_PROVISIONINGCX_CONTEXT_MENUBAR ); - TRAPD( err, menu->TryDisplayMenuBarL() ); - menu->SetMenuTitleResourceId( R_PROVISIONINGCX_MENUBAR_VIEW1 ); - - User::LeaveIfError( err ); - - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/aif/ProvisioningCxaif.rss --- a/omaprovisioning/provisioning/ProvisioningCx/aif/ProvisioningCxaif.rss Tue Jul 13 09:37:43 2010 +0530 +++ /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: -* RSS for creating the aif file for ProvisioningDump. -* Initial content was generated by Calypso Wizard. -* ?description_line -* -*/ -/* -* ============================================================================ -* Name : ProvisioningCxaif.rss -* Part of : ?module_name (e.g. Continuus subproject name) -* Origin : ?project,?company -* Created : Tue Oct 09 19:04:31 2007 by mohanraj -* Description: -* RSS for creating the aif file for ProvisioningDump. -* Initial content was generated by Calypso Wizard. -* ?description_line -* Version : -* %version: bh1s60#5 %, %date_modified: Wed Nov 11 14:02:02 2009 % by %derived_by: jobljose % -* --------------------------------------------------------------------------- -* Version history: -* Template version: 1.0, 28.2.2000 by maparnan -* -* -* Version: bh1s60#2, Tue Oct 09 19:04:32 2007 by mohanraj -* Ref: ?reference_to_reason_doc_if_any (e.g. ActionDb ID) -* ?change_reason_comment -* -* -* ============================================================================ -*/ - -#include -#include -#include "ProvisioningUids.h" - -RESOURCE AIF_DATA -{ - app_uid=KProvisioningCxUID3; - caption_list= - { - CAPTION { code=ELangEnglish; caption=qtn_op_conf_cont_title; } - }; - num_icons=1; - embeddability=KAppEmbeddable; - newfile=KAppDoesNotSupportNewFile; - hidden = KAppIsHidden; -} - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/Icons_aif_bitmaps.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/Icons_aif_bitmaps.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\system\apps\provisioningcx -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx_aif.mbm - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) \ - /c8,8 qgn_menu_set_lst.bmp \ - /c8,8 qgn_menu_set_cxt.bmp - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/Icons_aif_scalable.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/Icons_aif_scalable.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\system\apps\provisioningcx -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx_aif.mif - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) \ - /c8,8 qgn_menu_set.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/Icons_aif_scalable_dc.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/Icons_aif_scalable_dc.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx_aif.mif - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) \ - /c8,8 qgn_menu_set.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifbitmaps.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifbitmaps.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\system\apps\provisioningcx -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx_aif.mbm - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) \ - /c8,8 qgn_menu_set_lst.bmp \ - /c8,8 qgn_menu_set_cxt.bmp - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifbitmapsdc.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifbitmapsdc.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx_aif.mbm - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) \ - /c8,8 qgn_menu_set_lst.bmp \ - /c8,8 qgn_menu_set_cxt.bmp - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifscalable.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifscalable.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\system\apps\provisioningcx -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx_aif.mif - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) \ - /c8,8 qgn_menu_set.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifscalabledc.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/Iconscxaifscalabledc.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx_aif.mif - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) \ - /c8,8 qgn_menu_set.svg - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/ProvisioningCx.lnt --- a/omaprovisioning/provisioning/ProvisioningCx/group/ProvisioningCx.lnt Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ --w2 - --i..\Inc --d_UNICODE - -APP_LAYER_SYSTEMINCLUDE - -..\Src\*.cpp diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/ProvisioningCx.mmp --- a/omaprovisioning/provisioning/ProvisioningCx/group/ProvisioningCx.mmp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2002 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 is project specification file for the ProvisioningCx. -* -* -*/ - - -#include -#include -#include "../../Group/ProvisioningUIDs.h" - -TARGET ProvisioningCx.exe -TARGETTYPE exe - -UID KProvisioningCxUID2 KProvisioningCxUID3 - -CAPABILITY CAP_APPLICATION -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE CWPCxApp.cpp -SOURCE CWPCxAppUi.cpp -SOURCE CWPCxDocument.cpp -SOURCE CWPCxContainer.cpp -SOURCE CWPCxView.cpp -SOURCE CWPCxDeleter.cpp - -START RESOURCE ../rss/ProvisioningCx.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END // RESOURCE - -START RESOURCE ../rss/ProvisioningCx_reg.rss -DEPENDS provisioningcx.rsg -TARGETPATH /private/10003a3f/apps -END // RESOURCE - - -USERINCLUDE . ../Inc ../rss ../../Group ../../ProvisioningEngine/Inc -MW_LAYER_SYSTEMINCLUDE -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom -//SYSTEMINCLUDE /epoc32/include/cshelp - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikctl.lib -LIBRARY eikcoctl.lib -LIBRARY avkon.lib -LIBRARY provisioningengine.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib -LIBRARY featmgr.lib -LIBRARY hlplch.lib -LIBRARY apengine.lib -LIBRARY favouritesengine.lib -DEBUGLIBRARY flogger.lib - -SMPSAFE -// End of file - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/icons.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/icons.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\system\apps\provisioningcx -HEADERDIR=\epoc32\include -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx.mif -HEADERFILENAME=$(HEADERDIR)\provisioningcx.mbg - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c8,8 qgn_menu_set_cxt.bmp - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/group/iconscxdc.mk --- a/omaprovisioning/provisioning/ProvisioningCx/group/iconscxdc.mk Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -# -# Copyright (c) 2004 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: -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\provisioningcx.mif - -HEADERDIR=\epoc32\include -HEADERFILENAME=$(HEADERDIR)\provisioningcx.mbg - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \ - /c8,8 qgn_menu_set_cxt.bmp - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningCx/loc/ProvisioningCx.loc --- a/omaprovisioning/provisioning/ProvisioningCx/loc/ProvisioningCx.loc Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2002 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 is a localisation file for ProvisioningCx -* -* ------------------------------------------------------------------- -* -*/ - - - -// LOCALISATION STRINGS - -//**************************************************************************** - -//d:Command in options menu. -//d:Deletes a configuration context -//l:list_single_pane_t1_cp2 -#define qtn_op_opt_delete "Delete" - -//d: Application caption -//l: title_pane_t2/opt9 -#define qtn_op_conf_cont_title "Configuration contexts" - -//d:Text displayed when no configuration contexts exist -//l:main_list_empty_pane -// -#define qtn_op_conf_cont_empty "(no configuration contexts)" - -//d:Query presented when deleting a context -//l:popup_note_window -// -#define qtn_op_delete_context "Delete %U?" - -//d:Default context name -//l:list_single_pane_t1_cp2 -// -#define qtn_op_context_name "Configuration Context" - -//d:Default context name in case of name conflict -//l:list_single_pane_t1_cp2 -// -#define qtn_op_context_name2 "Configuration context %N" - -//d:Heading text for wait note in delete context operation -//l:popup_note_wait_window -// -#define qtn_op_deleting_contex "Deleting %U" - -//d:Error note when the context cannot be deleted -//l:popup_note_window -// -#define qtn_op_del_cont_no "Some settings are currently active. Context cannot be deleted" - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningParser/Src/CWPWbxmlParser.cpp --- a/omaprovisioning/provisioning/ProvisioningParser/Src/CWPWbxmlParser.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/omaprovisioning/provisioning/ProvisioningParser/Src/CWPWbxmlParser.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -22,7 +22,7 @@ #include "CWPWbxmlParser.h" #include "OMAProvisioningDictionary.h" #include "ProvisioningDebug.h" -#include +#include // EXTERNAL DATA STRUCTURES extern "C" NW_WBXML_Dictionary_t NW_omawapprovisioning_WBXMLDictionary; diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/ProvisioningParser/Src/OMAProvisioningDictionary.c --- a/omaprovisioning/provisioning/ProvisioningParser/Src/OMAProvisioningDictionary.c Tue Jul 13 09:37:43 2010 +0530 +++ b/omaprovisioning/provisioning/ProvisioningParser/Src/OMAProvisioningDictionary.c Tue Jul 13 09:51:41 2010 +0530 @@ -35,7 +35,7 @@ */ #include "OMAProvisioningDictionary.h" -#include "nw_wbxml_dictionary.h" +#include static const NW_Ucs2 NW_omawapprovisioning_ElementTag_wap_provisioningdoc[] = {'w','a','p','-','p','r','o','v','i','s','i','o','n','i','n','g','d','o','c','\0'}; diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/Rom/Provisioning.iby --- a/omaprovisioning/provisioning/Rom/Provisioning.iby Tue Jul 13 09:37:43 2010 +0530 +++ b/omaprovisioning/provisioning/Rom/Provisioning.iby Tue Jul 13 09:51:41 2010 +0530 @@ -24,58 +24,8 @@ file=ABI_DIR\BUILD_DIR\ProvisioningEngine.dll SHARED_LIB_DIR\ProvisioningEngine.dll // Parser file=ABI_DIR\BUILD_DIR\ProvisioningParser.dll SHARED_LIB_DIR\ProvisioningParser.dll -// BIO control -//file=ABI_DIR\BUILD_DIR\ProvisioningBC.dll SHARED_LIB_DIR\ProvisioningBC.dll // Handler ECOM_PLUGIN(ProvisioningHandler.dll,101F84D2.rsc) -// Access point adapter -//ECOM_PLUGIN(WPAPAdapter.dll,101F84D8.rsc) -#ifdef __MMS -// WAP adapter -ECOM_PLUGIN(WPWAPAdapter.dll,101F84DC.rsc) -#endif -// Streaming Adapter -ECOM_PLUGIN(WPStreamingAdapter.dll,101F85CB.rsc) - - -//Accesspoint adapter -ECOM_PLUGIN(WPAPAdapter.dll, WPAPAdapter.rsc) - -//Destination Adapter - -ECOM_PLUGIN( wpdestinationnwadapter.dll, 2000b4af.rsc ) - -// Mailbox Number adapter -ECOM_PLUGIN(WPMbxNbrAdapter.dll,10207281.rsc) // this publishes the DLL and the - // resource file to the correct location - - -#if ( defined (__ALWAYS_ONLINE_PDPCONTEXT) || defined (__ALWAYS_ONLINE_PDPCONTEXT2) ) -// ALWAYS ONLINE adapter -ECOM_PLUGIN(WPAlwaysOnAdapter.dll,200159E4.rsc) -#endif - - -// SIP adapter -//ECOM_PLUGIN(WPSIPAdapter.dll,101FB37E.rsc) - - -#ifdef __IM -// WV adapter -ECOM_PLUGIN(WPWVAdapter.dll,101F84E2.rsc) -#endif - -/*#ifdef __MULTIPLE_PROV_CTX -// Context list -file=ABI_DIR\BUILD_DIR\ProvisioningCx.exe PROGRAMS_DIR\ProvisioningCx.exe -//normal icons -//probably not needed, as no UI bitmaps used... -data=DATAZ_\APP_BITMAP_DIR\ProvisioningCx.MIF APP_BITMAP_DIR\ProvisioningCx.mif -#endif //__MULTIPLE_PROV_CTX*/ - -#ifdef __SMART_CARD_PROV - file=ABI_DIR\BUILD_DIR\ProvisioningSC.exe PROGRAMS_DIR\ProvisioningSC.exe -#endif #ifdef SYMBIAN_SECURE_DBMS data=ZPRIVATE\100012a5\policy\101F84D6.spd PRIVATE\100012a5\policy\101F84D6.spd diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/Rom/ProvisioningResources.iby --- a/omaprovisioning/provisioning/Rom/ProvisioningResources.iby Tue Jul 13 09:37:43 2010 +0530 +++ b/omaprovisioning/provisioning/Rom/ProvisioningResources.iby Tue Jul 13 09:51:41 2010 +0530 @@ -21,30 +21,9 @@ data=DATAZ_\RESOURCE_FILES_DIR\ProvisioningHandlerResource.rsc RESOURCE_FILES_DIR\ProvisioningHandler.rsc -//data=DATAZ_\RESOURCE_FILES_DIR\WPAPAdapterResource.rsc RESOURCE_FILES_DIR\WPAPAdapter.rsc -#ifdef __MMS - data=DATAZ_\RESOURCE_FILES_DIR\WPWAPAdapterResource.rsc RESOURCE_FILES_DIR\WPWAPAdapter.rsc -#endif -#ifdef __IM - data=DATAZ_\RESOURCE_FILES_DIR\WPWVAdapterResource.rsc RESOURCE_FILES_DIR\WPWVAdapter.rsc -#endif -data=DATAZ_\RESOURCE_FILES_DIR\WpstreamingadapterResource.rsc RESOURCE_FILES_DIR\Wpstreamingadapter.rsc - -data=DATAZ_\RESOURCE_FILES_DIR\WPMbxNbrAdapterResource.rsc RESOURCE_FILES_DIR\WPMbxNbrAdapter.rsc - -//data=DATAZ_\RESOURCE_FILES_DIR\WPSIPAdapterResource.rsc RESOURCE_FILES_DIR\WPSIPAdapter.rsc - -data=DATAZ_\RESOURCE_FILES_DIR\WPAPAdapterResource.rsc RESOURCE_FILES_DIR\WPAPAdapterResource.rsc -data=DATAZ_\RESOURCE_FILES_DIR\wpdestinationnwadapter.rsc RESOURCE_FILES_DIR\wpdestinationnwadapter.rsc - -// Resource files for OMA Provisioning - data=DATAZ_\RESOURCE_FILES_DIR\ProvisioningBC.rsc RESOURCE_FILES_DIR\ProvisioningBC.rsc - data=DATAZ_\RESOURCE_FILES_DIR\messaging\bif\prov.rsc resource\messaging\bif\prov.rsc -//data=DATAZ_\APP_RESOURCE_DIR\ProvisioningCx.rsc APP_RESOURCE_DIR\ProvisioningCx.rsc - #ifdef __SMART_CARD_PROV data=DATAZ_\RESOURCE_FILES_DIR\ProvisioningSC.rsc RESOURCE_FILES_DIR\ProvisioningSC.rsc #endif diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/StreamingAdapter/Data/101F85CB.rss --- a/omaprovisioning/provisioning/StreamingAdapter/Data/101F85CB.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2002 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 DLL interface & implementation description resource for -* this DLL. -* -*/ - - -// INCLUDES -#include - -#include "ProvisioningUIDs.h" - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// theInfo -// ECOM DLL interface & implementation description resource. -// -// ----------------------------------------------------------------------------- -// -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x101F85CB; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KProvisioningAdapterInterface; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x101F85CC; - version_no = 1; - display_name = "WP STREAMING PA";// Use short name to save RAM and ROM space - default_data = ""; - opaque_data = "10"; // Adapter priority - } - }; - } - }; - } - -// End of File - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/StreamingAdapter/Data/WPStreamingAdapterResource.rss --- a/omaprovisioning/provisioning/StreamingAdapter/Data/WPStreamingAdapterResource.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2002 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 file. -* -*/ - - -// INCLUDES -#include -#include - - -RESOURCE LBUF r_streaming_adapter_title - { - txt = qtn_op_head_streaming; - } - -// End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/StreamingAdapter/Group/StreamingAdapter.mmp --- a/omaprovisioning/provisioning/StreamingAdapter/Group/StreamingAdapter.mmp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Project specification file for streaming app settings adapter. -* -*/ - - -#include - -#include - -TARGET wpstreamingadapter.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x101F85CB -VENDORID VID_DEFAULT - -CAPABILITY CAP_ECOM_PLUGIN - -SOURCEPATH ../Src -SOURCE Streamingadapter.cpp -SOURCE StreamingadapterGroupProxy.cpp - -SOURCEPATH ../Data - -START RESOURCE 101F85CB.rss -TARGET wpstreamingadapter.rsc -END - -START RESOURCE WPStreamingAdapterResource.rss -HEADER -TARGET wpstreamingadapterresource.rsc -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - - -USERINCLUDE . -USERINCLUDE ../Inc -USERINCLUDE ../../Group - - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - -LIBRARY euser.lib -LIBRARY provisioningengine.lib -LIBRARY mpsettengine.lib -LIBRARY cmmanager.lib -LIBRARY commdb.lib -DEBUGLIBRARY flogger.lib - - -SMPSAFE -//end of file - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/StreamingAdapter/Inc/StreamingAdapter.h --- a/omaprovisioning/provisioning/StreamingAdapter/Inc/StreamingAdapter.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2002 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: Handles streaming app settings in OMA provisioning. -* -*/ - - -#ifndef STREAMINGADAPTER_H -#define STREAMINGADAPTER_H - -// INCLUDES - -#include -#include - -// FORWARD DECLARATIONS -class CMPSettingsModel; -struct TStreamingAdapterData; - -// CLASS DECLARATION - -/** - * CStreamingAdapter handles accesspoint settings. - */ -class CStreamingAdapter : public CWPAdapter, - public MWPContextExtension - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @return a instance of class. - */ - static CStreamingAdapter* NewL(); - - /** - * Destructor - */ - virtual ~CStreamingAdapter(); - - public: // Functions from base classes - - /** - * From CWPAdapter - */ - TInt ItemCount() const; - - /** - * From CWPAdapter - */ - const TDesC16& SummaryTitle(TInt aIndex) const; - - /** - * From CWPAdapter - */ - const TDesC16& SummaryText(TInt aIndex) const; - - /** - * From CWPAdapter - */ - TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); - - /** - * From CWPAdapter - */ - void SaveL(TInt aItem); - - /** - * From CWPAdapter - */ - TBool CanSetAsDefault(TInt aItem) const; - - /** - * From CWPAdapter - */ - void SetAsDefaultL(TInt aItem); - - /** - * From CWPAdapter - */ - void VisitL(CWPCharacteristic& aElement); - - /** - * From CWPAdapter - */ - void VisitL(CWPParameter& aElement); - - /** - * From CWPAdapter - */ - void VisitLinkL(CWPCharacteristic& aCharacteristic); - - /** - * From CWPAdapter - */ - TInt ContextExtension(MWPContextExtension*& aExtension); - - /** - * From MWPContextExtension - */ - const TDesC8& SaveDataL(TInt aIndex) const; - - /** - * From MWPContextExtension - */ - void DeleteL(const TDesC8& aSaveData); - - /** - * From MWPContextExtension - */ - TUint32 Uid() const; - - - private: // Default constructors - - /** - * C++ default constructor. - */ - CStreamingAdapter(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // New functions - - /** - * Validates the data in iTempData. - */ - TBool IsValid(); - - /** - * Parses an integer from a descriptor. - * Returns error code. - */ - TInt ParseIntegerL(const TDesC& aPtr, TInt& aInt); - - /** - * ResetAndDestroy() cleanup for ecom implementation array. - * @param aAny the implementation array - */ - static void Cleanup( TAny* aAny ); - - /** - * Initialise CMPSettingsModel - * @param None - * @return None - */ - void InitSettingsModelL(); - - private: // Data - - HBufC* iTitle; - CMPSettingsModel* iModel; - - TPtrC iAppId; - TStreamingAdapterData* iCurrentData; - TStreamingAdapterData* iTempData; - - TPckgBuf iSavedID; - - private: - friend class TM_CWPStreamingAdapterTestCase; - - - }; - -#endif // STREAMINGADAPTER_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/StreamingAdapter/Src/Streamingadapter.cpp --- a/omaprovisioning/provisioning/StreamingAdapter/Src/Streamingadapter.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,541 +0,0 @@ -/* -* Copyright (c) 2002 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: Handles streaming app settings in OMA provisioning. -* -*/ - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "WPAdapterUtil.h" -#include "StreamingAdapter.h" -#include "ProvisioningDebug.h" - -// CONSTANTS -#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw - _LIT( KAdapterName, "WPStreamingAdapterResource" ); -#else - _LIT( KAdapterName, "WPStreamingAdapter" ); -#endif -_LIT(KMaxBandwidthStr,"MAX-BANDWIDTH"); -_LIT(KMaxUdpPortStr,"MAX-UDP-PORT"); -_LIT(KMinUdpPortStr,"MIN-UDP-PORT"); -_LIT(KStreamingAppId, "554"); - -const TInt KInvalidValue = -1; -const TInt KProxyEnabled = 1; - -const TInt KMinUDPPort = 1024; //6970; -const TInt KMaxUDPPort = 65535; //32000; -const TInt KDefaultMinUDPPort = 6970; -const TInt KDefaultMaxUDPPort = 32000; - -const TInt KBandwidthValue1 = 9050; -const TInt KBandwidthValue2 = 13400; -const TInt KBandwidthValue3 = 18100; -const TInt KBandwidthValue4 = 26800; -const TInt KBandwidthValue5 = 27150; -const TInt KBandwidthValue6 = 40200; - -// MODULE DATA STRUCTURES -struct TStreamingAdapterData - { - TPtrC iName; - TInt iMaxBw; - TInt iMinUdpPort; - TInt iMaxUdpPort; - CWPCharacteristic* iNapDef; - }; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::CStreamingAdapter -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CStreamingAdapter::CStreamingAdapter() - { - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::ConstructL() - { - FLOG( _L( "[Provisioning] CStreamingAdapter::ConstructL:" ) ); - - TFileName fileName; - Dll::FileName( fileName ); - iTitle = WPAdapterUtil::ReadHBufCL( fileName, - KAdapterName, - R_STREAMING_ADAPTER_TITLE ); - - FLOG( _L( "[Provisioning] CStreamingAdapter::ConstructL: Done" ) ); - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CStreamingAdapter* CStreamingAdapter::NewL() - { - CStreamingAdapter* self = new(ELeave) CStreamingAdapter; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - return self; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::~CStreamingAdapter -// Destructor -// ----------------------------------------------------------------------------- -// -CStreamingAdapter::~CStreamingAdapter() - { - delete iTitle; - delete iCurrentData; - delete iTempData; - delete iModel; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::ItemCount -// ----------------------------------------------------------------------------- -// -TInt CStreamingAdapter::ItemCount() const - { - // If ItemCount() returns zero, the adapter is unloaded at startup. - // SummaryTitle(), SummaryText(), SaveL(), SetAsDefaultL() and - // CanSetAsDefault() are called ItemCount() times - return iCurrentData ? 1 : 0; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::SummaryTitle -// ----------------------------------------------------------------------------- -// -const TDesC16& CStreamingAdapter::SummaryTitle(TInt /*aIndex*/) const - { - return *iTitle; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::SummaryText -// ----------------------------------------------------------------------------- -// -const TDesC16& CStreamingAdapter::SummaryText(TInt /*aIndex*/) const - { - return iCurrentData->iName; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::DetailsL -// ----------------------------------------------------------------------------- -// -TInt CStreamingAdapter::DetailsL(TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/) - { - // Detail view is a feature for later release. - return KErrNotSupported; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::SaveL -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::SaveL( TInt /*aItem*/ ) - { - FLOG( _L( "[Provisioning] CStreamingAdapter::SaveL:" ) ); - - __ASSERT_DEBUG( iCurrentData->iNapDef, User::Leave( KErrCorrupt ) ); - - InitSettingsModelL(); - - // Load default values - iModel->LoadSettingsL(EConfigDefault); - - // Set max bandwidth value if valid - if (iCurrentData->iMaxBw != KInvalidValue) - { - iModel->SetMaxBandwidth(iCurrentData->iMaxBw, EBearerGPRS); - } - - // Set udp port range if valid - if (iCurrentData->iMinUdpPort != KInvalidValue && - iCurrentData->iMaxUdpPort != KInvalidValue) - { - iModel->SetMinUDPPort(iCurrentData->iMinUdpPort); - iModel->SetMaxUDPPort(iCurrentData->iMaxUdpPort); - } - - // Get the IAP id - - RCmManagerExt cmmanagerExt; - cmmanagerExt.OpenL(); - CleanupClosePushL(cmmanagerExt); - - TPckgBuf uid; - TBool proxyDefined(EFalse); - TBool apDefined(EFalse); - TBool apWithoutProxyDefined(EFalse); - - for (TInt i(0); iCurrentData->iNapDef->Data(i).Length() == uid.MaxLength() - && !(proxyDefined && apWithoutProxyDefined); i++) - { - uid.Copy(iCurrentData->iNapDef->Data(i)); - RCmConnectionMethodExt cm; - cm = cmmanagerExt.ConnectionMethodL( uid() ); - CleanupClosePushL( cm ); - - TBool useProxy = cm.GetBoolAttributeL( CMManager::ECmProxyUsageEnabled ); - - if (!apDefined || (!useProxy && !apWithoutProxyDefined)) - { - iModel->SetDefaultAp(uid()); - apDefined = ETrue; - - iSavedID.Copy(uid); - - if (!useProxy) - { - apWithoutProxyDefined = ETrue; - } - } - - if (!proxyDefined && useProxy) - { - // Get proxy port - TUint32 proxyPort = cm.GetIntAttributeL( CMManager::ECmProxyPortNumber ); - - - // Get proxy host name - const HBufC* proxyHost = cm.GetStringAttributeL( CMManager::ECmProxyServerName ); - - if(*proxyHost != KNullDesC && proxyPort <= 65535) - { - iModel->SetProxyHostNameL(*proxyHost); - iModel->SetProxyPort(static_cast(proxyPort)); - iModel->SetProxyMode(KProxyEnabled); - - proxyDefined = ETrue; - } - delete proxyHost; - } - CleanupStack::PopAndDestroy();//cm - } - - CleanupStack::PopAndDestroy(); // cmmanagerext - - iModel->StoreSettingsL(); - - FLOG( _L( "[Provisioning] CStreamingAdapter::SaveL: Done" ) ); - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CStreamingAdapter::CanSetAsDefault(TInt /*aItem*/) const - { - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::SetAsDefault -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::SetAsDefaultL(TInt /*aItem*/) - { - // This shouldn't be called because CanSetAsDefault - // always returns EFalse. - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::VisitL -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::VisitL(CWPCharacteristic& aCharacteristic) - { - switch(aCharacteristic.Type()) - { - case KWPApplication: - // Create new iTempData - if (iTempData) - { - delete iTempData; - iTempData = NULL; - } - - iTempData = new (ELeave) TStreamingAdapterData; - - // Initialize iTempData's members - iTempData->iName.Set(KNullDesC); - iTempData->iMaxBw = KInvalidValue; - iTempData->iMinUdpPort = KInvalidValue; - iTempData->iMaxUdpPort = KInvalidValue; - iTempData->iNapDef = NULL; - - // Accept characteristic - aCharacteristic.AcceptL(*this); - - // Check iAppId and validate data - if (iAppId == KStreamingAppId && IsValid()) - { - // iAppId is correct and data is valid - delete iCurrentData; - iCurrentData = iTempData; - iTempData = NULL; - } - else - { - // iAppId is incorrect or data is invalid - delete iTempData; - iTempData = NULL; - } - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::VisitL -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::VisitL(CWPParameter& aParameter) - { - // Check the contents of whole characteristic before overwriting iMaxBw, - // iMinUdpPort and iMaxUdpPort. Might be looking at the wrong application - // characteristic - - __ASSERT_DEBUG(iTempData, User::Leave(KErrCorrupt)); - - TInt value; - switch(aParameter.ID()) - { - case EWPParameterAppID: - iAppId.Set(aParameter.Value()); - break; - case EWPParameterName: - if (iTempData->iName == KNullDesC) - { - iTempData->iName.Set(aParameter.Value()); - } - break; - case EWPNamedParameter: - { - if( aParameter.Name().Compare( KMaxBandwidthStr ) == 0 - && !ParseIntegerL( aParameter.Value(), value ) ) - { - iTempData->iMaxBw = value; - } - else if( aParameter.Name().Compare( KMaxUdpPortStr ) == 0 - && !ParseIntegerL( aParameter.Value(), value ) ) - { - iTempData->iMaxUdpPort = value; - } - else if( aParameter.Name().Compare( KMinUdpPortStr ) == 0 - && !ParseIntegerL( aParameter.Value(), value ) ) - { - iTempData->iMinUdpPort = value; - } - break; - } - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::VisitLinkL -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::VisitLinkL(CWPCharacteristic& aCharacteristic) - { - // Here again, do not overwrite iPXLogical before you're sure - // you're looking at the correct APPLICATION - - __ASSERT_DEBUG(iTempData, User::Leave(KErrCorrupt)); - - switch(aCharacteristic.Type()) - { - //intentional fall-through - case KWPNapDef: - case KWPPxLogical: - iTempData->iNapDef = &aCharacteristic; - break; - default: - break; - } - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::ContextExtension -// ----------------------------------------------------------------------------- -// -TInt CStreamingAdapter::ContextExtension(MWPContextExtension*& aExtension) - { - aExtension = this; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::SaveDataL -// ----------------------------------------------------------------------------- -// -const TDesC8& CStreamingAdapter::SaveDataL(TInt /*aIndex*/) const - { - return iSavedID; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::DeleteL -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::DeleteL(const TDesC8& aSaveData) - { - TUint32 id; - - InitSettingsModelL(); - - iModel->GetDefaultAp(id); - - TPckgBuf pckg; - pckg.Copy(aSaveData); - - if (id == pckg()) - { - iModel->LoadSettingsL(EConfigDefault); - iModel->StoreSettingsL(); - } - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::Uid -// ----------------------------------------------------------------------------- -// -TUint32 CStreamingAdapter::Uid() const - { - return iDtor_ID_Key.iUid; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::IsValid -// ----------------------------------------------------------------------------- -// -TBool CStreamingAdapter::IsValid() - { - TBool validity(EFalse); - - if (iTempData->iNapDef) - { - // Validity checks for min and max UDP port values - if (iTempData->iMinUdpPort < KMinUDPPort) - { - iTempData->iMinUdpPort = KDefaultMinUDPPort; - } - - if (iTempData->iMaxUdpPort > KMaxUDPPort) - { - iTempData->iMaxUdpPort = KDefaultMaxUDPPort; - } - - if (iTempData->iMinUdpPort > iTempData->iMaxUdpPort) - { - iTempData->iMinUdpPort = KInvalidValue; - iTempData->iMaxUdpPort = KInvalidValue; - } - - // Validity check for max bandwidth value - switch (iTempData->iMaxBw) - { - case KBandwidthValue1: - case KBandwidthValue2: - case KBandwidthValue3: - case KBandwidthValue4: - case KBandwidthValue5: - case KBandwidthValue6: - // iMaxBw is valid - break; - default: - // iMaxBw is invalid - iTempData->iMaxBw = KInvalidValue; - break; - } - - validity = ETrue; - } - - return validity; - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::ParseIntegerL -// ----------------------------------------------------------------------------- -// -TInt CStreamingAdapter::ParseIntegerL(const TDesC& aPtr, TInt& aInt) - { - TLex lex(aPtr); - return lex.Val(aInt); - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::Cleanup -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::Cleanup( TAny* aAny ) - { - RImplInfoPtrArray* implArray = - reinterpret_cast< RImplInfoPtrArray*> ( aAny ); - implArray->ResetAndDestroy(); - implArray->Close(); - } - -// ----------------------------------------------------------------------------- -// CStreamingAdapter::InitSettingsModelL -// ----------------------------------------------------------------------------- -// -void CStreamingAdapter::InitSettingsModelL() - { - FLOG( _L( "[Provisioning] CStreamingAdapter::InitSettingsModelL:" ) ); - - if ( !iModel ) - { - RImplInfoPtrArray impl; - CleanupStack::PushL( TCleanupItem( Cleanup, &impl ) ); - CMPSettingsModel::ListImplementationsL( impl ); - if( impl.Count() > 0 ) - { - FLOG( _L( "[Provisioning] CStreamingAdapter::InitSettingsModelL: Creating CMPSettingsModel" ) ); - // using the first available implementation - iModel= CMPSettingsModel::NewL( impl[0]->ImplementationUid() ); - FLOG( _L( "[Provisioning] CStreamingAdapter::InitSettingsModelL: Creating CMPSettingsModel Done" ) ); - } - CleanupStack::PopAndDestroy(); // implArray - } - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/StreamingAdapter/Src/StreamingadapterGroupProxy.cpp --- a/omaprovisioning/provisioning/StreamingAdapter/Src/StreamingadapterGroupProxy.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Table of plugins for ECom -* -*/ - - - -// INCLUDE FILES -#include -#include -#include "StreamingAdapter.h" - - -// CONSTANTS -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x101F85CC, CStreamingAdapter::NewL ) -// {{0x101F85CC}, CStreamingAdapter::NewL}, - }; - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// ImplementationProxy -// ECOM implementation table entry. -// ----------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/StreamingAdapter/loc/StreamingAdapter.loc --- a/omaprovisioning/provisioning/StreamingAdapter/loc/StreamingAdapter.loc Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2002 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 is a localisation file for MediaSettings -* A .loc file is the one and only place where the logical strings -* to be localised are defined. -* -*/ - - - -// LOCALISATION STRINGS - -//d: Summary text for streaming settings -//l: popup_info_list_pane_t2/opt1 -// -#define qtn_op_head_streaming "Streaming settings" - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Data/101F84DC.rss --- a/omaprovisioning/provisioning/WAPAdapter/Data/101F84DC.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2002 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 file defining the ProvisioningAdapter plugin. -* -*/ - - - -// INCLUDES -#include -#include "ProvisioningUIDs.h" - - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// theInfo -// Resource defining the ProvisioningAdapter plugin. -// -// ----------------------------------------------------------------------------- -// - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = KProvisioningWAPAdapterDllUid3; - interfaces = - { - INTERFACE_INFO - { - interface_uid = KProvisioningAdapterInterface; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = KProvisioningMMSAdapterUid; - version_no = 1; - display_name = ""; - default_data = ""; - opaque_data = "101"; - }, - IMPLEMENTATION_INFO - { - implementation_uid = KProvisioningBrowserAdapterUid; - version_no = 1; - display_name = ""; - default_data = ""; - opaque_data = "100"; - } - }; - } - }; - } - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Data/WPWAPAdapterResource.rss --- a/omaprovisioning/provisioning/WAPAdapter/Data/WPWAPAdapterResource.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2002 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 file. -* -*/ - - - -// INCLUDES -#include -#include - -// Rich text labels - -RESOURCE LBUF r_qtn_op_head_browser - { - txt = qtn_op_head_browser; - } - -RESOURCE LBUF r_qtn_sm_mms_accesspoints - { - txt = qtn_sm_mms_accesspoints; - } - -RESOURCE LBUF r_qtn_sm_wapap_name - { - txt = qtn_sm_wapap_name; - } - -RESOURCE LBUF r_qtn_sm_bookmark_name - { - txt = qtn_sm_bookmark_name; - } - -RESOURCE LBUF r_qtn_sm_bookmarks - { - txt = qtn_sm_bookmarks; - } diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Group/WPWAPAdapter.mmp --- a/omaprovisioning/provisioning/WAPAdapter/Group/WPWAPAdapter.mmp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Project definition file for the WPWAPAdapter. -* -*/ - - -#include -#include -#include "../../Group/ProvisioningUIDs.h" -#include "../Inc/WPWAPDebug.h" - -TARGET wpwapadapter.dll -TARGETTYPE PLUGIN -UID KProvisioningWAPAdapterDllUid2 KProvisioningWAPAdapterDllUid3 - - -VENDORID VID_DEFAULT -CAPABILITY CAP_ECOM_PLUGIN - -SOURCEPATH ../Src -SOURCE CWPWAPAdapterBase.cpp -SOURCE CWPWAPMMSAdapter.cpp -SOURCE CWPWAPBrowserAdapter.cpp -SOURCE CWPWAPMMSItem.cpp -SOURCE CWPWAPBrowserItem.cpp -SOURCE CWPWAPBookmarkItem.cpp -SOURCE CWPWAPItemBAse.cpp -SOURCE WPWAPUtil.cpp -SOURCE WPWAPItemFactory.cpp -SOURCE WPWAPAdapterGroupProxy.cpp -SOURCE WPWAPAdapterMain.cpp - -SOURCEPATH ../Data -START RESOURCE 101F84DC.rss -TARGET wpwapadapter.rsc -END - -START RESOURCE WPWAPAdapterResource.rss -HEADER -TARGET wpwapadapterresource.rsc -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - -USERINCLUDE ../Inc ../Group ../../Group - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - -LIBRARY euser.lib -LIBRARY provisioningengine.lib -LIBRARY msgs.lib -LIBRARY cmmanager.lib -LIBRARY commdb.lib -LIBRARY commonengine.lib -LIBRARY favouritesengine.lib -LIBRARY centralrepository.lib - -DEBUGLIBRARY flogger.lib - -#ifdef __MESSAGING_API_V2__ -LIBRARY mmsserversettings.lib -#endif -SMPSAFE diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPAdapterBase.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPAdapterBase.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,112 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Base for WAP adapters. -* -*/ - - -#ifndef CWPWAPADAPTERBASE_H -#define CWPWAPADAPTERBASE_H - -// INCLUDES -#include -#include - -// FORWARD DECLARATIONS -class CWPCharacteristic; -class MWPWAPItemBase; -class CCommsDatabase; -class RCmConnectionMethodExt; -class RCmManagerExt; - -// CLASS DECLARATION - -/** - * CWPWAPAdapterBase is a base for WAP adapters. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class CWPWAPAdapterBase : public CWPAdapter, private MWPContextExtension - { - public: // Constructors and destructor - - /** - * Destructor. - */ - ~CWPWAPAdapterBase(); - - public: // from CWPAdapter - - TInt ItemCount() const; - const TDesC16& SummaryTitle(TInt aIndex) const; - const TDesC16& SummaryText(TInt aIndex) const; - void SaveL( TInt aItem ); - TBool CanSetAsDefault( TInt aItem ) const; - void SetAsDefaultL( TInt aItem ); - TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); - void VisitL(CWPCharacteristic& aElement); - void VisitL(CWPParameter& aElement); - void VisitLinkL(CWPCharacteristic& aCharacteristic ); - TInt ContextExtension( MWPContextExtension*& aExtension ); - - public: // from MWPContextExtension - virtual const TDesC8& SaveDataL( TInt aIndex ) const; - virtual void DeleteL( const TDesC8& aSaveData ); - TUint32 Uid() const; - - public: // New methods - /** - * Handles one application characteristic. - * @param aCharacteristic The application characteristic - */ - virtual void ApplicationL( CWPCharacteristic& aCharacteristic ) = 0; - - protected: // New functions - /** - * C++ default constructor. - */ - CWPWAPAdapterBase(); - - /** - * 2nd phase base constructor. Derived classes must call this. - */ - void BaseConstructL(); - - /** - * Create CCommsDatabase and APEngine if NULL. - */ - void CreateDbL(); - - protected: // Data - // The application if of the current characteristic - TPtrC iAppID; - - // The visible setting items. Owns. - RPointerArray iItems; - - // The hidden setting items. Owns. - RPointerArray iHiddenItems; - - // Comms database for saving. Owns. - CCommsDatabase* iCommsDb; - - // APEngine for saving. Owns. - RCmManagerExt* iCmManager; - }; - -#endif // CWPWAPADAPTERBASE_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBookmarkItem.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBookmarkItem.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,141 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: One bookmark item in browser settings. -* -*/ - - -#ifndef CWPWAPBOOKMARKITEM_H -#define CWPWAPBOOKMARKITEM_H - -// INCLUDES -#include -#include -#include -#include -#include "CWPWAPItemBAse.h" - - -// FORWARD DECLARATIONS -class CBookmarkDb; - -// CLASS DECLARATION - -/** - * CWPWAPBookmarkItem handles one bookmark item in browser settings. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class CWPWAPBookmarkItem : public CBase, public MWPWAPItemBase, private MWPVisitor - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aTitle The title to be returned in Name(). - * @param aDefaultName The default name for bookmarks. - * @param aCharacteristic The RESOURCE characteristic. - * @param aLink Link to NAPDEF - * @param aDb The bookmark database to use. Created if NULL. - * @return CWPWAPBookmarkItem instance - */ - static CWPWAPBookmarkItem* NewL( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CWPCharacteristic*& aLink, - RFavouritesDb aDb ); - - - /** - * Destructor. - */ - ~CWPWAPBookmarkItem(); - - public: // From MWPMMSItemBase - - const TDesC& Name() const; - const TDesC& Title() const; - TBool CanSetAsDefault() const; - void SaveL(); - void SetAsDefaultL(); - TBool ValidateL(); - void AddL( RPointerArray& aShownItems, - RPointerArray& aHiddenItems ); - const TDesC8& SaveData() const; - const TDesC& Address() const; - - public: // From MWPVisitor - - void VisitL(CWPCharacteristic& aCharacteristic); - void VisitL(CWPParameter& aParameter); - void VisitLinkL(CWPCharacteristic& aCharacteristic ); - - private: // New functions - /** - * C++ constructor. - * @param aTitle The title to be returned in Name(). - * @param aDefaultName The default name for bookmarks. - * @param aLink Link to access point - * @param aDb The bookmark database to use. Created if NULL. - */ - CWPWAPBookmarkItem( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic*& aLink, - RFavouritesDb aDb ); - - /** - * By default Symbian 2nd phase constructor is private. - * @param aCharacteristic The RESOURCE characteristic - * to scan. - */ - void ConstructL( CWPCharacteristic& aCharacteristic ); - - /** - * Create the bookmarks db. - */ - void CreateDbL(); - - private: - // The title for bookmark items - const TDesC& iTitle; - - // The default name for bookmarks. - const TDesC& iDefaultName; - - // The access point characteristic. Refs. - CWPCharacteristic*& iLink; - - // The name of the bookmark - TPtrC iName; - - // The URI of the bookmark - TPtrC iURI; - - // Startpage parameter - TBool iHasStartPage; - - RFavouritesDb iBookmarkDb; - RFavouritesSession iSession; - - // Access point uid. - TUint32 iUID; - - // UIDs of the saved items - TPckgBuf iSaveItem; - }; - -#endif // CWPWAPBOOKMARKITEM_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBrowserAdapter.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBrowserAdapter.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Handles browser settings in provisioning. -* -*/ - - -#ifndef CWPWAPBROWSERADAPTER_H -#define CWPWAPBROWSERADAPTER_H - -// INCLUDES -#include "CWPWAPAdapterBase.h" - -#include -#include - - -// FORWARD DECLARATIONS -class CWPCharacteristic; -class CBookmarkDb; -// CLASS DECLARATION - -/** - * CWPWAPBrowserAdapter handles browser settings. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class CWPWAPBrowserAdapter : public CWPWAPAdapterBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @return CWPWAPBrowserAdapter instance - */ - static CWPWAPBrowserAdapter* NewL(); - - /** - * Destructor. - */ - ~CWPWAPBrowserAdapter(); - - public: // from CWPWAPAdapterBase - - void ApplicationL( CWPCharacteristic& aCharacteristic ); - void DeleteL( const TDesC8& aSaveData ); - - private: // New functions - /** - * C++ default constructor. - */ - CWPWAPBrowserAdapter(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Create the bookmarks db. - */ - void CreateDbL(); - - private: // Data - // Title for browser items. Owns. - HBufC* iTitle; - - // Title for bookmarks. Owns. - HBufC* iBookmarkTitle; - - // Default name for browser items. Owns. - HBufC* iDefaultName; - - // Default name for bookmarks. Owns. - HBufC* iDefaultBookmarkName; - - // ETrue if one browser application has been processed. - TBool iProcessed; - - // Favourites database. Owns. - CBookmarkDb* iBookmarkDb; - - RFavouritesSession iSession; - - RFavouritesDb iFavouritesDb; - }; - -#endif // CWPWAPBROWSERADAPTER_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBrowserItem.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPBrowserItem.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,124 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Setting item for browser settings. -* -*/ - - -#ifndef CWPWAPBROWSERITEM_H -#define CWPWAPBROWSERITEM_H - -// INCLUDES -#include -#include -#include -#include "CWPWAPItemBAse.h" - -// FORWARD DECLARATIONS -class MWPWAPItemBase; -class CBookmarkDb; -class RCmManagerExt; -// CLASS DECLARATION - -/** - * CWPWAPBrowserItem handles one browser setting. - * - * @lib WPWAPAdapter - * @since 2.0 - */ - - -class CWPWAPBrowserItem : public CWPWAPItemBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aFirst ETrue if this browser item is first - * @param aTitle Title for browser items - * @param aBookmarkTitle Title for bookmark items - * @param aDefaultName Default name for browser items - * @param aDefaultBookmarkName Default name for bookmarks. - * @param aCharacteristic The APPLICATION characteristic - * @param aCommsDb The CommsDB to use. Created if NULL. - * @param aAPHandler The APEngine data handler to use. Created if NULL. - * @param aBookmarkDb The bookmark database to use. Created if NULL. - * @return CWPWAPBrowserItem instance - */ - static CWPWAPBrowserItem* NewL( TBool aFirst, - const TDesC& aTitle, - const TDesC& aBookmarkTitle, - const TDesC& aDefaultName, - const TDesC& aDefaultBookmarkName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager, - RFavouritesDb aBookmarkDb - ); - - /** - * Destructor. - */ - ~CWPWAPBrowserItem(); - - public: // From CWPMMSItemBase - - TBool CanSetAsDefault() const; - void SaveL(); - void SetAsDefaultL(); - TBool ValidateL(); - void ResourceL( CWPCharacteristic& aResource ); - void AddL( RPointerArray& aShownItems, - RPointerArray& aHiddenItems ); - - private: // New functions - /** - * C++ default constructor. - * @see CWPWAPBrowserItem::NewL() for description of parameters. - */ - CWPWAPBrowserItem( TBool aFirst, - const TDesC& aTitle, - const TDesC& aBookmarkTitle, - const TDesC& aDefaultName, - const TDesC& aDefaultBookmarkName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager, - RFavouritesDb aBookmarkDb - ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: - // The bookmarks. Owns. - RPointerArray iBookmarks; - - // The default name for bookmarks. - const TDesC& iDefaultBookmarkName; - - // The title for bookmarks - const TDesC& iBookmarkTitle; - - RFavouritesDb iDb; - - // ETrue if this browser item is first in list. - TBool iFirst; - }; - -#endif // CWPWAPBROWSERITEM_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPItemBAse.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPItemBAse.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Base class for WAP setting items. -* -*/ - - -#ifndef CWPWAPITEMBASE_H -#define CWPWAPITEMBASE_H - -// INCLUDES -#include -#include -#include "MWPWAPItemBase.h" -#include -#include - -// FORWARD DECLARATIONS -class CCommsDatabase; - - -// CLASS DECLARATION - -/** - * CWPWAPItemBase is a base class for browser settings. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class CWPWAPItemBase : public CBase, private MWPVisitor, public MWPWAPItemBase - { - public: // Constructors and destructor - - /** - * Destructor. - */ - ~CWPWAPItemBase(); - - public: // From MWPVisitor - - void VisitL(CWPCharacteristic& aCharacteristic); - void VisitL(CWPParameter& aParameter); - void VisitLinkL(CWPCharacteristic& aCharacteristic ); - - public: // From MWPWAPItemBase - - const TDesC& Name() const; - const TDesC& Title() const; - const TDesC& Address() const; - const TDesC8& SaveData() const; - - protected: // New methods - /** - * C++ default constructor. - * @param aTitle Title for items - * @param aDefaultName Default name for items - * @param aCharacteristic The APPLICATION characteristic - * @param aCommsDb The CommsDB to use. Created if NULL. - * @param aAPHandler The APEngine data handler to use. Created if NULL. - */ - CWPWAPItemBase( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager); - - /** - * 2nd phase base constructor. Derived classes must call this. - */ - void BaseConstructL(); - - /** - * Handles one resource item. - * @param aResource The RESOURCE item - */ - virtual void ResourceL( CWPCharacteristic& aResource ) = 0; - - /** - * Create CCommsDatabase and APEngine if NULL. - */ - void CreateDbL(); - - /** - * Writes a home page to an access point. If access point already - * has a home page, create a new one. - * @param aItem Access point to access - */ - void WriteHomePageL( RCmConnectionMethodExt& aCmItem ); - - /** - * Create a valid name for the access point. - * @param aName The base name for access point - * @param aDb CommsDb instance - */ - void MakeValidNameL( TDes& aName, CCommsDatabase& aDb ) const; - - protected: - // The parent characteristic. Refs. - CWPCharacteristic& iCharacteristic; - - // The preferred access point name - TPtrC iName; - - // The access point address, Owns. - HBufC* iAddr; - - // The UID of the access point - TUint32 iUID; - - // UID of the saved item - TPckgBuf iSaveItem; - - // Temporary current proxy while visiting. Refs. - CWPCharacteristic* iLink; - - // Text to return in SummaryTitle(). - const TDesC& iTitle; - - // Default name of access point. - const TDesC& iDefaultName; - - // Comms db. Refs. - CCommsDatabase*& iCommsDb; - - // @var Pointer to Connection Method Manager that is required to access - // Access Point data - RCmManagerExt*& iCmManager; - }; - -#endif // CWPWAPITEMBASE_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPMMSAdapter.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPMMSAdapter.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Handles MMS settings in provisioning. -* -*/ - - -#ifndef CWPWAPMMSADAPTER_H -#define CWPWAPMMSADAPTER_H - -// INCLUDES -#include "CWPWAPAdapterBase.h" - -// FORWARD DECLARATIONS -class CWPCharacteristic; - -// CLASS DECLARATION - -/** - * CWPWAPMMSAdapter handles MMS settings. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class CWPWAPMMSAdapter : public CWPWAPAdapterBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static CWPWAPMMSAdapter* NewL(); - - /** - * Destructor. - */ - ~CWPWAPMMSAdapter(); - - public: // from CWPWAPAdapterBase - - void ApplicationL( CWPCharacteristic& aCharacteristic ); - - private: // New functions - /** - * C++ default constructor. - */ - CWPWAPMMSAdapter(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - // Title for MMS items. Owns. - HBufC* iTitle; - - // Default name for MMS items. Owns. - HBufC* iDefaultName; - }; - -#endif // CWPWAPMMSADAPTER_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPMMSItem.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/CWPWAPMMSItem.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,106 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Setting item for MMS settings. -* -*/ - - -#ifndef CWPWAPMMSITEM_H -#define CWPWAPMMSITEM_H - -// INCLUDES -#include -#include -#include "CWPWAPItemBAse.h" - -// FORWARD DECLARATIONS -class CBookmarkDb; -class RCmManagerExt; - -// CLASS DECLARATION - -/** - * CWPWAPMMSItem contains one MMS setting. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class CWPWAPMMSItem : public CWPWAPItemBase, private MMsvSessionObserver - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aTitle Title for MMS items - * @param aDefaultName Default name for MMS items - * @param aCharacteristic The APPLICATION characteristic - * @param aCommsDb The CommsDB to use. Created if NULL. - * @param aAPHandler The APEngine data handler to use. Created if NULL. - */ - static CWPWAPMMSItem* NewL( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager); - - /** - * Destructor. - */ - ~CWPWAPMMSItem(); - - public: // From CWPWAPMMSItemBase - - TBool CanSetAsDefault() const; - void SaveL(); - void SetAsDefaultL(); - TBool ValidateL(); - void ResourceL( CWPCharacteristic& aResource ); - void AddL( RPointerArray& aShownItems, - RPointerArray& aHiddenItems ); - void VisitLinkL( CWPCharacteristic& aCharacteristic ); - - private: // from MMsvSessionObserver - - void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3); - - private: // New functions - /** - * C++ default constructor. - * @see CWPWAPMMSItem::NewL() for description of parameters. - */ - CWPWAPMMSItem( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - - - private: // Data - // The bookmarks database. Refs. - CBookmarkDb* iDb; - - // The potential links - RPointerArray iLinks; - }; - -#endif // CWPWAPMMSITEM_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/MWPWAPItemBase.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/MWPWAPItemBase.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Base class for WAP setting items. -* -*/ - - -#ifndef MWPWAPITEMBASE_H -#define MWPWAPITEMBASE_H - -// INCLUDES -#include - -// CONSTANTS -const TUint32 KWPWAPNoUID = 0; -const TUint32 KWPWAPItemTypeNone = 0; -const TUint32 KWPWAPItemTypeBookmark = 1; -const TUint32 KWPWAPItemTypeAccesspoint = 2; - -// FORWARD DECLARATIONS - -// CLASS DECLARATION - -/** - * MWPWAPItemBase is a base class for wap settings. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class MWPWAPItemBase - { - public: - struct TWPWAPSaveItem - { - TUint32 iSaveItemType; - TUint32 iUID; - }; - - public: // Constructors and destructor - - /** - * Destructor. - */ - virtual ~MWPWAPItemBase() {}; - - public: // New functions - - /** - * Returns the name of the item to be returned in - * SummaryText(). - * @return Name of the item - */ - virtual const TDesC& Name() const = 0; - - /** - * Returns the title of the item to be returned in - * SummaryTitle(). - * @return Name of the item - */ - virtual const TDesC& Title() const = 0; - - /** - * Returns the address of the service pointed by - * the item. - * @return Address of the service - */ - virtual const TDesC& Address() const = 0; - - /** - * Saves the item. Call BaseSaveL() in beginning. - */ - virtual void SaveL() = 0; - - /** - * Returns ETrue if the item can be saved as - * default setting. - * @return Whether the item can be made default - */ - virtual TBool CanSetAsDefault() const = 0; - - /** - * Sets the item as default setting. - */ - virtual void SetAsDefaultL() = 0; - - /** - * Returns ETrue if the item is valid. - * @return ETrue if valid - */ - virtual TBool ValidateL() = 0; - - /** - * Adds the item and its children to a list of items. - * @param aShownItems The list of shown items to be appended to - * @param aHiddenItems The list of hidden items to be appended to - */ - virtual void AddL( RPointerArray& aShownItems, - RPointerArray& aHiddenItems ) = 0; - - /** - * Returns the ID of the saved item. - * @return ID of the saved item, or KWPWAPNoUID - */ - virtual const TDesC8& SaveData() const = 0; - - }; - -#endif // MWPWAPITEMBASE_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPDebug.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPDebug.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2002 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: -* WPWAPDebug contains debug macros. -* -*/ - - -#ifndef WPWAPDEBUG_H -#define WPWAPDEBUG_H - -// MACROS - -// Define this to enable debug output -//#define WAPDEBUG - -// DEBUG can be used for outputting debug -#ifdef WAPDEBUG -#define DEBUG(TEXT) Debug( _L(#TEXT) ); -#define DVA(TEXT, ARG1) Debug( _L(#TEXT), (ARG1) ); -#define DVA2(TEXT, ARG1, ARG2) Debug( _L(#TEXT), (ARG1), (ARG2) ); -#define DVA3(TEXT, ARG1, ARG2, ARG3) Debug( _L(#TEXT), (ARG1), (ARG2), (ARG3) ); -#else -#define DEBUG(TEXT) -#define DVA(TEXT, ARG1) -#define DVA2(TEXT, ARG1, ARG2) -#define DVA3(TEXT, ARG1, ARG2, ARG3) -#endif - -#if defined(__WINS__) || defined(__EPOC32__) -GLDEF_C void Debug( TRefByValue aText, ...); -#endif - -#endif /* WPWAPDEBUG_H */ diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPItemFactory.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPItemFactory.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Factory for WAP items. -* -*/ - - -#ifndef WPITEMFACTORY_H -#define WPITEMFACTORY_H - -// INCLUDE FILES -#include - -// FORWARD DECLARATIONS -class MWPWAPItemBase; -class CWPCharacteristic; -class CCommsDatabase; -class RCmConnectionMethodExt; -class RCmDestinationExt; -class CBookmarkDb; -class RFavouritesDb; -// CLASS DECLARATION -class RCmManagerExt; -/** - * WPWAPItemFactory is a factory for all WAP items. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class WPWAPItemFactory - { - public: - /** - * Create an MMS item. - * @param aTitle Title for MMS items - * @param aDefaultName Default name for MMS items - * @param aCharacteristic The APPLICATION characteristic - * @param aCommsDb The CommsDB to use. Created if NULL. - * @param aAPHandler The APEngine data handler to use. Created if NULL. - * @return MWPWAPItemBase instance - */ - static MWPWAPItemBase* CreateMMSLC( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager ); - - - /** - * Create a browser item. - * @param aFirst ETrue if this browser item is first - * @param aTitle Title for browser items - * @param aBookmarkTitle Title for bookmark items - * @param aDefaultName Default name for browser items - * @param aCharacteristic The APPLICATION characteristic - * @param aDb The CommsDB to use. Created if NULL. - * @param aAPHandler The APEngine data handler to use. Created if NULL. - * @param aBookmarkDb The bookmark database to use. Created if NULL. - * @return MWPWAPItemBase instance - */ - static MWPWAPItemBase* CreateBrowserLC( TBool aFirst, - const TDesC& aTitle, - const TDesC& aBookmarkTitle, - const TDesC& aDefaultName, - const TDesC& aDefaultBookmarkName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager, - RFavouritesDb aBookmarkDb ); - - /** - * Create a bookmark item. - * @param aTitle The title to be returned in Name(). - * @param aDefaultName The default name for bookmarks. - * @param aResource The RESOURCE characteristic. - * @param aLink Link to NAPDEF - * @param aDb The bookmark database to use. Created if NULL. - * @return MWPWAPItemBase instance - */ - static MWPWAPItemBase* CreateBookmarkLC( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aResource, - CWPCharacteristic*& aNapdef, - RFavouritesDb aDb); - - }; - - -#endif // WPITEMFACTORY_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPUtil.h --- a/omaprovisioning/provisioning/WAPAdapter/Inc/WPWAPUtil.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2002 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: -* Utility class for reading resource strings. -* -*/ - - -#ifndef WPWAPUTIL_H -#define WPWAPUTIL_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class RResourceFile; - -// CLASS DECLARATION - -/** - * WPWAPUtil is a utility class for reading resource strings. - * - * @lib WPWAPAdapter - * @since 2.0 - */ -class WPWAPUtil - { - public: // New functions - /** - * Loads a specified resource string from resource file. - * @param aResourceId is of a resource string. - * @return pointer to loaded descriptor. - */ - static HBufC* ReadHBufCL( TInt aResourceId ); - - /** - * Searches for the resource file with the correct language extension - * for the language of the current locale, or failing this, the best - * matching file. - * @param aFs reference to file server. - * @param aResFileName resource file name. - * @param aResFile reference to resource file. - */ - static void FindAndOpenResourceFileLC(RFs& aFs, - const TDesC& aResFileName, - RResourceFile& aResFile); - - /** - * Checks if a URL is valid. - * @param aURL the URL to check - * @return ETrue if the URL is valid - */ - static TBool CheckURI( const TDesC& aUrl ); - - }; - -#endif // WPWAPUTIL_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPAdapterBase.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPAdapterBase.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,261 +0,0 @@ -/* -* Copyright (c) 2002 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: Base for WAP adapters. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include "CWPWAPItemBAse.h" -#include "CWPWAPAdapterBase.h" -#include "WPWAPDebug.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::CWPWAPAdapterBase -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPAdapterBase::CWPWAPAdapterBase() - : CWPAdapter() - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::BaseConstructL -// 2nd phase base class constructor. -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::BaseConstructL() - { - } - -// Destructor -CWPWAPAdapterBase::~CWPWAPAdapterBase() - { - iItems.ResetAndDestroy(); - iHiddenItems.ResetAndDestroy(); - delete iCommsDb; - - if ( iCmManager != NULL ) - { - iCmManager->Close(); - delete iCmManager; - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::SummaryCount -// ----------------------------------------------------------------------------- -// -TInt CWPWAPAdapterBase::ItemCount() const - { - return iItems.Count(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::SummaryTitle -// ----------------------------------------------------------------------------- -// -const TDesC16& CWPWAPAdapterBase::SummaryTitle(TInt aIndex) const - { - return iItems[aIndex]->Title(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::SummaryText -// ----------------------------------------------------------------------------- -// -const TDesC& CWPWAPAdapterBase::SummaryText(TInt aIndex) const - { - return iItems[aIndex]->Name(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::SaveL -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::SaveL(TInt aIndex) - { - iItems[aIndex]->SaveL(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CWPWAPAdapterBase::CanSetAsDefault(TInt aIndex) const - { - return iItems[aIndex]->CanSetAsDefault(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::SetAsDefaultL -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::SetAsDefaultL(TInt aIndex) - { - iItems[aIndex]->SetAsDefaultL(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::DetailsL -// ----------------------------------------------------------------------------- -// -TInt CWPWAPAdapterBase::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ ) - { - return KErrNotSupported; - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::VisitL( CWPCharacteristic& aCharacteristic ) - { - switch( aCharacteristic.Type() ) - { - case KWPApplication: - { - aCharacteristic.AcceptL( *this ); - ApplicationL( aCharacteristic ); - iAppID.Set( KNullDesC ); - break; - } - - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::VisitL( CWPParameter& aParameter ) - { - if( aParameter.ID() == EWPParameterAppID ) - { - iAppID.Set( aParameter.Value() ); - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::VisitLinkL( CWPCharacteristic& /*aLink*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::ContextExtension -// ----------------------------------------------------------------------------- -// -TInt CWPWAPAdapterBase::ContextExtension( MWPContextExtension*& aExtension ) - { - aExtension = this; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::SaveDataL -// ----------------------------------------------------------------------------- -// -const TDesC8& CWPWAPAdapterBase::SaveDataL( TInt aIndex ) const - { - return iItems[aIndex]->SaveData(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::DeleteL -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::DeleteL( const TDesC8& aSaveData ) - { - CreateDbL(); - - TPckgBuf pckg; - pckg.Copy( aSaveData ); - - // Base class handles only access point deletion - if( pckg().iSaveItemType == KWPWAPItemTypeAccesspoint ) - { - DVA( "DeleteL: Deleting access point %08x", pckg().iUID ); - TRAPD( err, iCmManager->ConnectionMethodL( pckg().iUID).DeleteL()); - DVA( "DeleteL: Deleted, %d", err ); - - switch( err ) - { - case KErrNotFound: - { - // Item not existing is what we want, so this error is ok - break; - } - - case KErrLocked: - { - // Transform the code so that the caller can retry - User::Leave( EWPCommsDBLocked ); - break; - } - - default: - { - User::LeaveIfError( err ); - break; - } - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::Uid -// ----------------------------------------------------------------------------- -// -TUint32 CWPWAPAdapterBase::Uid() const - { - return iDtor_ID_Key.iUid; - } - -// ----------------------------------------------------------------------------- -// CWPWAPAdapterBase::CreateDbL -// ----------------------------------------------------------------------------- -// -void CWPWAPAdapterBase::CreateDbL() - { - if( !iCommsDb ) - { - iCommsDb = CCommsDatabase::NewL(); - } - iCmManager = new RCmManagerExt; - iCmManager->OpenL(); - - - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBookmarkItem.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBookmarkItem.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: One bookmark item. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include // CFavouritesItemList -#include -#include -#include "CWPWAPBookmarkItem.h" -#include "WPWAPUtil.h" - -// CONSTANTS -const TInt KUrlMaxLength = 255; -const TInt KNameMaxLength = 50; - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::CWPWAPBookmarkItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPBookmarkItem::CWPWAPBookmarkItem( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic*& aLink, - RFavouritesDb aDb ) -: iTitle( aTitle ), iDefaultName( aDefaultName ), iLink( aLink ), -iBookmarkDb( aDb ) - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::ConstructL( CWPCharacteristic& aCharacteristic ) - { - aCharacteristic.AcceptL( *this ); - if( iName == KNullDesC ) - { - iName.Set( iDefaultName ); - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPWAPBookmarkItem* CWPWAPBookmarkItem::NewL( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CWPCharacteristic*& aLink, - RFavouritesDb aDb ) - { - CWPWAPBookmarkItem* self = new(ELeave) CWPWAPBookmarkItem( aTitle, - aDefaultName, aLink, aDb ); - CleanupStack::PushL(self); - self->ConstructL( aCharacteristic ); - CleanupStack::Pop(self); - return self; - } - -// Destructor -CWPWAPBookmarkItem::~CWPWAPBookmarkItem() - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::Name -// ----------------------------------------------------------------------------- -// -const TDesC& CWPWAPBookmarkItem::Name() const - { - return iName; - } - - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::Title -// ----------------------------------------------------------------------------- -// -const TDesC& CWPWAPBookmarkItem::Title() const - { - return iTitle; - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::Title -// ----------------------------------------------------------------------------- -// -const TDesC& CWPWAPBookmarkItem::Address() const - { - return iURI; - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::SaveID -// ----------------------------------------------------------------------------- -// -const TDesC8& CWPWAPBookmarkItem::SaveData() const - { - if( iSaveItem().iSaveItemType != KWPWAPItemTypeNone ) - { - return iSaveItem; - } - else - { - return KNullDesC8; - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::AddL -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::AddL( RPointerArray& aShownItems, - RPointerArray& /*aHiddenItems*/ ) - { - User::LeaveIfError( aShownItems.Append( this ) ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::SaveL -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::SaveL() - { - TPckgBuf uid; - if( iLink && iLink->Data().Length() == uid.MaxLength() ) - { - uid.Copy( iLink->Data() ); - iUID = uid(); - } - - CreateDbL(); - - CFavouritesItem* item = CFavouritesItem::NewL(); - CleanupStack::PushL( item ); - - item->SetType( CFavouritesItem::EItem ); - item->SetParentFolder( KFavouritesRootUid ); - item->SetNameL( iName ); - item->SetUrlL( iURI ); - - if( iUID != KWPWAPNoUID ) - { - TFavouritesWapAp ap; - ap.SetApId( iUID ); - item->SetWapAp( ap ); - } - TInt err( iBookmarkDb.Add( *item, ETrue ) ); - if( err == KErrLocked ) - { - err = EWPBookmarksLocked; - } - User::LeaveIfError( err ); - iSaveItem().iSaveItemType = KWPWAPItemTypeBookmark; - iSaveItem().iUID = item->Uid(); - - CleanupStack::PopAndDestroy(); // item - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CWPWAPBookmarkItem::CanSetAsDefault() const - { - // Startpage support. This can be set as default if this is to be - // interpreted as startpage. - return iHasStartPage; - } - - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::SetAsDefaultL -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::SetAsDefaultL() - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::ValidateL -// ----------------------------------------------------------------------------- -// -TBool CWPWAPBookmarkItem::ValidateL() - { - return iURI.Length() <= KUrlMaxLength - && iName.Length() <= KNameMaxLength - && iURI.Length() > 0 - && WPWAPUtil::CheckURI( iURI ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::VisitL( CWPCharacteristic& /*aCharacteristic*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::VisitL( CWPParameter& aParameter ) - { - switch( aParameter.ID() ) - { - case EWPParameterURI: - { - iURI.Set( aParameter.Value() ); - break; - } - - case EWPParameterName: - { - iName.Set( aParameter.Value() ); - break; - } - - case EWPParameterStartPage: - { - iHasStartPage = ETrue; - break; - } - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::VisitLinkL( CWPCharacteristic& /*aLink*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPBookmarkItem::CreateDbL -// ----------------------------------------------------------------------------- -// -void CWPWAPBookmarkItem::CreateDbL() - { - User::LeaveIfError( iSession.Connect() ); - User::LeaveIfError( iBookmarkDb.Open( iSession, KBrowserBookmarks ) ); - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserAdapter.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserAdapter.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Handles browser settings in provisioning. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include "CWPWAPBrowserAdapter.h" -#include "MWPWAPItemBase.h" -#include "WPWAPItemFactory.h" -#include "WPWAPUtil.h" -#include "WPWAPDebug.h" - -// CONSTANTS -_LIT( KBrowserAppID, "w2" ); - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserAdapter::CWPWAPBrowserAdapter -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPBrowserAdapter::CWPWAPBrowserAdapter() - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserAdapter::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserAdapter::ConstructL() - { - BaseConstructL(); - - iTitle = WPWAPUtil::ReadHBufCL( R_QTN_OP_HEAD_BROWSER ); - iBookmarkTitle = WPWAPUtil::ReadHBufCL( R_QTN_SM_BOOKMARKS ); - iDefaultName = WPWAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME ); - iDefaultBookmarkName = WPWAPUtil::ReadHBufCL( R_QTN_SM_BOOKMARK_NAME ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserAdapter::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPWAPBrowserAdapter* CWPWAPBrowserAdapter::NewL() - { - CWPWAPBrowserAdapter* self = new(ELeave) CWPWAPBrowserAdapter; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// Destructor -CWPWAPBrowserAdapter::~CWPWAPBrowserAdapter() - { - delete iTitle; - delete iBookmarkTitle; - delete iDefaultName; - delete iDefaultBookmarkName; - iFavouritesDb.Close(); - iSession.Close(); - } - - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserAdapter::ApplicationL -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserAdapter::ApplicationL( CWPCharacteristic& aCharacteristic ) - { - if( iAppID == KBrowserAppID ) - { - MWPWAPItemBase* item = WPWAPItemFactory::CreateBrowserLC( !iProcessed, *iTitle, - *iBookmarkTitle, *iDefaultName, *iDefaultBookmarkName, - aCharacteristic, iCommsDb, iCmManager, iFavouritesDb ); - - if( item->ValidateL() ) - { - iProcessed = ETrue; - item->AddL( iItems, iHiddenItems ); - CleanupStack::Pop(); // item - } - else - { - CleanupStack::PopAndDestroy(); // item - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserAdapter::DeleteL -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserAdapter::DeleteL( const TDesC8& aSaveData ) - { - CreateDbL(); - - TPckgBuf item; - item.Copy( aSaveData ); - - switch( item().iSaveItemType ) - { - case KWPWAPItemTypeAccesspoint: - { - // Access point deletion is handled by the base class - CWPWAPAdapterBase::DeleteL( aSaveData ); - break; - } - - case KWPWAPItemTypeBookmark: - { - DVA( "DeleteL: Deleting bookmark %08x", item().iUID ); - TInt err = iFavouritesDb.Begin( ETrue ); - iFavouritesDb.CleanupRollbackPushL(); // push a rollback - - DVA( "DeleteL: Transaction, %d", err ); - if( err == KErrNone ) - { - err = iFavouritesDb.Delete( item().iUID ); - DVA( "DeleteL: Deleted, %d", err ); - iFavouritesDb.Commit(); - DEBUG( "DeleteL: Committed" ); - } - CleanupStack::Pop(); // pop the rollback - - switch( err ) - { - case KErrNotFound: - { - // Item not existing is what we want, so this error is ok - break; - } - - case KErrLocked: - { - User::Leave( EWPBookmarksLocked ); - break; - } - - default: - { - User::LeaveIfError( err ); - break; - } - } - break; - } - - default: - { - // Don't know how to delete an item of this type. Better - // just ignore it. - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserAdapter::CreateDbL -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserAdapter::CreateDbL() - { - User::LeaveIfError( iSession.Connect() ); - User::LeaveIfError( iFavouritesDb.Open( iSession, KBrowserBookmarks ) ); - - CWPWAPAdapterBase::CreateDbL(); - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserItem.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPBrowserItem.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: One browser setting item. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include "CWPWAPBrowserItem.h" -#include "WPWAPItemFactory.h" -#include "ProvisioningDebug.h" - -// CONSTANTS -/// Delay to wait for WmlBrowser to catch up with changes in CommsDb. Microseconds. -const TInt KWmlDelay = 4*500000; -// Force browser to use User Defined AP -const TInt KUserDefined = 0; - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::CWPWAPBrowserItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPBrowserItem::CWPWAPBrowserItem( TBool aFirst, - const TDesC& aTitle, - const TDesC& aBookmarkTitle, - const TDesC& aDefaultName, - const TDesC& aDefaultBookmarkName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager, - RFavouritesDb aBookmarkDb - ) - : CWPWAPItemBase( aTitle, - aDefaultName, - aCharacteristic, - aCommsDb, - aCmManager ), - iDefaultBookmarkName( aDefaultBookmarkName ), - iBookmarkTitle( aBookmarkTitle ), - iDb( aBookmarkDb ), - iFirst( aFirst ) - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserItem::ConstructL() - { - BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPWAPBrowserItem* CWPWAPBrowserItem::NewL( TBool aFirst, - const TDesC& aTitle, - const TDesC& aBookmarkTitle, - const TDesC& aDefaultName, - const TDesC& aDefaultBookmarkName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager, - RFavouritesDb aBookmarkDb - ) - { - CWPWAPBrowserItem* self = new(ELeave) CWPWAPBrowserItem( aFirst, - aTitle, - aBookmarkTitle, - aDefaultName, - aDefaultBookmarkName, - aCharacteristic, - aCommsDb, - aCmManager, - aBookmarkDb ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPWAPBrowserItem::~CWPWAPBrowserItem() - { - iBookmarks.ResetAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::SaveL -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserItem::SaveL() - { - CreateDbL(); - - TPckg uid( iUID ); - // Check if the iLink->Data() contains an item of the same size as uid. - // This is an extra check to ensure that iLink->Data() contains a packaged - // TUin32. - if( iLink && iLink->Data().Length() == uid.MaxLength() ) - { - uid.Copy( iLink->Data() ); - } - RCmConnectionMethodExt cm; - cm = iCmManager->ConnectionMethodL( iUID ); - CleanupClosePushL( cm ); - if( iAddr ) - { - // Update the access point startpage - WriteHomePageL( cm ); - } - CleanupStack::PopAndDestroy(); // cm - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CWPWAPBrowserItem::CanSetAsDefault() const - { - return iUID != KWPWAPNoUID; - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::SetAsDefaultL -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserItem::SetAsDefaultL() - { - FLOG( _L( "[Provisioning] CWPWAPBrowserItem::SetAsDefaultL:" ) ); - - /* CreateDbL(); - TRAPD( err, iAPHandler->SetAsDefaultL( (TInt)iUID, EIspTypeWAPOnly) ); - if( err == KErrLocked ) - { - err = EWPCommsDBLocked; - } - // This function need to leave at the end of the function - // otherwise we dont set the default AP when db is locked - //User::LeaveIfError( err ); - - // There's some delay before the WmlBrowser can find the stored - // accesspoint from CommsDb so therefore we wait for a while before - // telling the WmlBrowser that default accesspoint should be changed. - // The value 500000 is chosen just by trying out. - User::After( KWmlDelay ); - - CRepository* repository = CRepository::NewLC( KCRUidBrowser ); - FTRACE(RDebug::Print( - _L("[Provisioning] CWPWAPBrowserItem::SetAsDefaultL: AP:(%d)"), - (TInt)iUID)); - - // Force the browser to use the User Defined AP selection mode. - User::LeaveIfError( repository->Set( KBrowserAccessPointSelectionMode, - KUserDefined ) ); - // This sets the accesspoint default for browser. - User::LeaveIfError( repository->Set( KBrowserDefaultAccessPoint, - (TInt)iUID ) ); - - //Set the HomePage to default - if(iUID) - { - User::LeaveIfError( repository->Set( KBrowserNGHomepageType, EBrowserCenRepAccessPoint) ); - } - - CleanupStack::PopAndDestroy(); // repository - FLOG( _L( "[Provisioning] CWPWAPBrowserItem::SetAsDefaultL: Set Done" ) ); - - User::LeaveIfError( err );*/ - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::ValidateL -// ----------------------------------------------------------------------------- -// -TBool CWPWAPBrowserItem::ValidateL() - { - return iLink != NULL; - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::ResourceL -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserItem::ResourceL( CWPCharacteristic& aResource ) - { - MWPWAPItemBase* item = WPWAPItemFactory::CreateBookmarkLC( - iBookmarkTitle, - iDefaultBookmarkName, - aResource, - iLink, - iDb ); - - if( item->CanSetAsDefault() && !iAddr ) - { - iAddr = item->Address().AllocL(); - CleanupStack::PopAndDestroy(); // item - } - else - { - User::LeaveIfError( iBookmarks.Append( item ) ); - CleanupStack::Pop(); // item - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPBrowserItem::AddL -// ----------------------------------------------------------------------------- -// -void CWPWAPBrowserItem::AddL( RPointerArray& aShownItems, - RPointerArray& aHiddenItems ) - { - for( TInt i( iBookmarks.Count()-1 ); i >= 0 ; i-- ) - { - MWPWAPItemBase* item = iBookmarks[i]; - - if( item->ValidateL() ) - { - // Transfer ownership of iBookmarks[i] to aItems - iBookmarks[i]->AddL( aShownItems, aHiddenItems ); - } - else - { - // invalid items get deleted - delete item; - } - iBookmarks.Remove( i ); - } - - // Only first browser item is shown to the user. - if( iFirst ) - { - User::LeaveIfError( aShownItems.Append( this ) ); - } - else - { - User::LeaveIfError( aHiddenItems.Append( this ) ); - } - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPItemBAse.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPItemBAse.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,298 +0,0 @@ -/* -* Copyright (c) 2002 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: Base class for WAP setting items. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CWPWAPItemBAse.h" -#include "ProvisioningDebug.h" -#include - -// CONSTANTS -const TInt KNamesGranularity = 1; -const TInt KNameMaxLength = 50; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::CWPWAPItemBase -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPItemBase::CWPWAPItemBase( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager) - : iCharacteristic( aCharacteristic ), - iTitle( aTitle ), - iDefaultName( aDefaultName ), - iCommsDb( aCommsDb ), - iCmManager( aCmManager ) - { - - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::BaseConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPWAPItemBase::BaseConstructL() - { - iCharacteristic.AcceptL( *this ); - - if( iName == KNullDesC ) - { - iName.Set( iDefaultName ); - } - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPWAPItemBase::~CWPWAPItemBase() - { - delete iAddr; - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPItemBase::VisitL( CWPCharacteristic& aCharacteristic ) - { - if( aCharacteristic.Type() == KWPResource ) - { - ResourceL( aCharacteristic ); - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::VisitL -// ----------------------------------------------------------------------------- -// -void CWPWAPItemBase::VisitL( CWPParameter& aParameter ) - { - switch( aParameter.ID() ) - { - case EWPParameterName: - { - iName.Set( aParameter.Value() ); - break; - } - - case EWPParameterAddr: - { - if( !iAddr ) - { - iAddr = aParameter.Value().AllocL(); - } - break; - } - - default: - { - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::VisitLinkL -// ----------------------------------------------------------------------------- -// -void CWPWAPItemBase::VisitLinkL( CWPCharacteristic& aLink ) - { - if( !iLink ) - { - iLink = &aLink; - - if( iName == KNullDesC ) - { - // Get the name - CArrayFix* names = new(ELeave) CArrayFixFlat( KNamesGranularity ); - CleanupStack::PushL( names ); - aLink.ParameterL( EWPParameterName, names ); - if( names->Count() > 0 ) - { - iName.Set( names->At(0) ); - } - CleanupStack::PopAndDestroy(); // names - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::Name -// ----------------------------------------------------------------------------- -// -const TDesC& CWPWAPItemBase::Name() const - { - return iName; - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::Title -// ----------------------------------------------------------------------------- -// -const TDesC& CWPWAPItemBase::Title() const - { - return iTitle; - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::Address -// ----------------------------------------------------------------------------- -// -const TDesC& CWPWAPItemBase::Address() const - { - if( iAddr ) - { - return *iAddr; - } - else - { - return KNullDesC; - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::SaveData -// ----------------------------------------------------------------------------- -// -const TDesC8& CWPWAPItemBase::SaveData() const - { - if( iSaveItem().iSaveItemType != KWPWAPItemTypeNone ) - { - return iSaveItem; - } - else - { - return KNullDesC8; - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::CreateDbL -// ----------------------------------------------------------------------------- -// -void CWPWAPItemBase::CreateDbL() - { - if( !iCommsDb ) - { - iCommsDb = CCommsDatabase::NewL(); - } - - if( !iCmManager ) - { - iCmManager = new RCmManagerExt; - iCmManager->OpenL(); - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::WriteHomePageL -// ----------------------------------------------------------------------------- -// -void CWPWAPItemBase::WriteHomePageL( RCmConnectionMethodExt& aCmItem ) - { - FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL:" ) ); - - if( iAddr ) - { - if( aCmItem.GetStringAttributeL(CMManager::ECmStartPage) > 0 ) - { - FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL: EApWapStartPage " ) ); - // Make a copy of the AP - RCmConnectionMethodExt cm = aCmItem.CreateCopyL(); - CleanupClosePushL( cm ); - - // Create a proper name for the copy - TBuf name( iName.Left( KNameMaxLength ) ); - // MakeValidNameL( name, *iCommsDb ); - - - // Write name - cm.SetStringAttributeL(CMManager::ECmName,name); - cm.SetStringAttributeL(CMManager::ENamingUnique,name); - - // Write MMSC address - cm.SetStringAttributeL(CMManager::ECmStartPage,*iAddr); - - // Create the new access point - TRAPD( err, cm.UpdateL() ); - - FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL err (%d)"), err)); - FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL iUID (%d)"), iUID)); - - if( err == KErrLocked ) - { - err = EWPCommsDBLocked; - } - User::LeaveIfError( err ); - - iSaveItem().iSaveItemType = KWPWAPItemTypeAccesspoint; - iSaveItem().iUID = iUID; - - CleanupStack::PopAndDestroy(); // newItem - } - else - { - FLOG( _L( "[Provisioning] CWPWAPItemBase::WriteHomePageL: EApWapStartPage 0 " ) ); - aCmItem.SetStringAttributeL(CMManager::ECmStartPage,*iAddr); - - // Update the access point - TBool nameChanged( EFalse ); - TRAPD( err, aCmItem.UpdateL() ); - FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL err (%d)"), err)); - if( err == KErrLocked ) - { - err = EWPCommsDBLocked; - } - User::LeaveIfError( err ); - iUID = aCmItem.GetIntAttributeL(CMManager::ECmIapId); - FTRACE(RDebug::Print(_L("[Provisioning] CWPWAPItemBase::WriteHomePageL: CreateFromDataL iUID (%d)"), iUID)); - } - } - } - -// ----------------------------------------------------------------------------- -// CWPWAPItemBase::MakeValidNameL -// ----------------------------------------------------------------------------- -// -void CWPWAPItemBase::MakeValidNameL( TDes& aName, CCommsDatabase& aDb ) const - { - /* CApUtils* utils = CApUtils::NewLC( aDb ); - utils->MakeValidNameL( aName ); - CleanupStack::PopAndDestroy(); // utils*/ - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSAdapter.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSAdapter.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* -* Copyright (c) 2002 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: Handles MMS settings in provisioning. -* -*/ - - - -// INCLUDE FILES -#include "CWPWAPMMSAdapter.h" -#include -#include -#include -#include -#include -#include "MWPWAPItemBase.h" -#include "WPWAPUtil.h" -#include "WPWAPItemFactory.h" - -// CONSTANTS -_LIT( KMMSAppID, "w4" ); - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPWAPMMSAdapter::CWPWAPMMSAdapter -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPMMSAdapter::CWPWAPMMSAdapter() - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSAdapter::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSAdapter::ConstructL() - { - BaseConstructL(); - - iTitle = WPWAPUtil::ReadHBufCL( R_QTN_SM_MMS_ACCESSPOINTS ); - iDefaultName = WPWAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSAdapter::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPWAPMMSAdapter* CWPWAPMMSAdapter::NewL() - { - CWPWAPMMSAdapter* self = new(ELeave) CWPWAPMMSAdapter; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// Destructor -CWPWAPMMSAdapter::~CWPWAPMMSAdapter() - { - delete iTitle; - delete iDefaultName; - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSAdapter::ApplicationL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSAdapter::ApplicationL( CWPCharacteristic& aCharacteristic ) - { - if( iItems.Count() == 0 && iAppID == KMMSAppID ) - { - MWPWAPItemBase* item = WPWAPItemFactory::CreateMMSLC( *iTitle, *iDefaultName, - aCharacteristic, iCommsDb, iCmManager ); - if( item->ValidateL() ) - { - item->AddL( iItems, iHiddenItems ); - CleanupStack::Pop(); // item - } - else - { - CleanupStack::PopAndDestroy(); // item - } - } - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSItem.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/CWPWAPMMSItem.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,253 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: One MMS setting item. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "CWPWAPMMSItem.h" -#include "WPWAPItemFactory.h" -#include "WPWAPUtil.h" - -#ifdef __MESSAGING_API_V2__ -#include -#endif - -// CONSTANTS -const TInt KUrlMaxLength = 255; - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::CWPWAPMMSItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPWAPMMSItem::CWPWAPMMSItem( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aDb, - RCmManagerExt*& aCmManager ) -: CWPWAPItemBase( aTitle, aDefaultName, aCharacteristic, aDb, aCmManager ) - { - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::ConstructL() - { - BaseConstructL(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPWAPMMSItem* CWPWAPMMSItem::NewL( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aDb, - RCmManagerExt*& aCmManager ) - { - CWPWAPMMSItem* self = new(ELeave) CWPWAPMMSItem( aTitle, aDefaultName, - aCharacteristic, aDb, aCmManager ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// Destructor -CWPWAPMMSItem::~CWPWAPMMSItem() - { - iLinks.Close(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::SaveL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::SaveL() - { - CreateDbL(); - TBool check = EFalse; - RCmConnectionMethodExt cm; - TUint32 bearer = 0; - for( TInt i( 0 ); i < iLinks.Count() && check == EFalse ; i++ ) - { - CWPCharacteristic* curr = iLinks[i]; - TPckgBuf uidPckg; - const TInt pkgLength( uidPckg.MaxLength() ); - for( TInt dataNum( 0 ); check == EFalse && curr->Data( dataNum ).Length() == pkgLength;dataNum++ ) - { - uidPckg.Copy( curr->Data( dataNum ) ); - // Read the access point pointed to by TO-NAPID or TO-PROXY - cm = iCmManager->ConnectionMethodL( uidPckg() ); - CleanupClosePushL( cm ); - bearer = cm.GetIntAttributeL( CMManager::ECmBearerType ); - if( bearer == KUidPacketDataBearerType ) - { - // Item left on cleanup stack - check = ETrue; - } - else - { - CleanupStack::PopAndDestroy(); // cm - } - } - } - - WriteHomePageL( cm ); - CleanupStack::PopAndDestroy(); // cm - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CWPWAPMMSItem::CanSetAsDefault() const - { - return ETrue; - } - - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::SetAsDefaultL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::SetAsDefaultL() - { - // Open Messaging Server session - CMsvSession* session = CMsvSession::OpenSyncL( *this ); - CleanupStack::PushL( session ); - - // Read the MMS client information via registry - CClientMtmRegistry* registry = CClientMtmRegistry::NewL( *session ); - CleanupStack::PushL( registry ); - - CMmsClientMtm* mmsClient = - static_cast( registry->NewMtmL( KUidMsgTypeMultimedia ) ); - CleanupStack::PushL( mmsClient ); - -#ifdef __MESSAGING_API_V2__ - - CMmsSettings* mmsSettings = CMmsSettings::NewL(); - CleanupStack::PushL( mmsSettings ); - - mmsClient->RestoreSettingsL(); - - mmsSettings->CopyL( mmsClient->MmsSettings() ); - TInt apCount = mmsSettings->AccessPointCount(); - TInt index; - for ( index = 0; index < apCount; index++) - { - mmsSettings->DeleteAccessPointL( 0 ); - } - mmsSettings->AddAccessPointL( iUID, 0 ); - - mmsClient->SetSettingsL( *mmsSettings ); - mmsClient->StoreSettingsL(); - - CleanupStack::PopAndDestroy(); // mmsSettings - -#else - - mmsClient->LoadMessageL(); - // Set the correct access point and save - mmsClient->SetFirstAccessPoint( iUID ); - mmsClient->SaveMessageL(); - -#endif - - CleanupStack::PopAndDestroy(3); // mmsClient, registry, session - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::ValidateL -// ----------------------------------------------------------------------------- -// -TBool CWPWAPMMSItem::ValidateL() - { - return iLinks.Count() > 0 - && iAddr - && iAddr->Length() <=KUrlMaxLength - && WPWAPUtil::CheckURI( *iAddr ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::ResourceL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::ResourceL( CWPCharacteristic& aResource ) - { - RFavouritesDb favouritesDb; - MWPWAPItemBase* item = WPWAPItemFactory::CreateBookmarkLC( KNullDesC, - KNullDesC, aResource, iLink, favouritesDb ); // iDb is NULL but it's not used. - - // Not supporting resources without startpage. - if ( item->CanSetAsDefault() && !iAddr ) - { - iAddr = item->Address().AllocL(); - } - CleanupStack::PopAndDestroy(); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::AddL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::AddL( RPointerArray& aShownItems, - RPointerArray& /*aHiddenItems*/ ) - { - User::LeaveIfError( aShownItems.Append( this ) ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::VisitLinkL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::VisitLinkL( CWPCharacteristic& aLink ) - { - CWPWAPItemBase::VisitLinkL( aLink ); - User::LeaveIfError( iLinks.Append( &aLink ) ); - } - -// ----------------------------------------------------------------------------- -// CWPWAPMMSItem::HandleSessionEventL -// ----------------------------------------------------------------------------- -// -void CWPWAPMMSItem::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, - TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/) - { - } - - - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/WPWAPAdapterGroupProxy.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/WPWAPAdapterGroupProxy.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2002 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: Table of plugins for ECom -* -*/ - - - -// INCLUDE FILES -#include -#include -#include "ProvisioningUIDs.h" -#include "CWPWAPMMSAdapter.h" -#include "CWPWAPBrowserAdapter.h" - -// CONSTANTS -const TImplementationProxy KImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY( KProvisioningMMSAdapterUid, CWPWAPMMSAdapter::NewL ) -// {{KProvisioningMMSAdapterUid}, CWPWAPMMSAdapter::NewL}, - , - IMPLEMENTATION_PROXY_ENTRY( KProvisioningBrowserAdapterUid, CWPWAPBrowserAdapter::NewL ) -// {{KProvisioningBrowserAdapterUid}, CWPWAPBrowserAdapter::NewL} - }; - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// ImplementationGroupProxy -// ----------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); - - return KImplementationTable; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/WPWAPAdapterMain.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/WPWAPAdapterMain.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: DLL entry point -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include "WPWAPDebug.h" - -// CONSTANTS - -#ifdef WAPDEBUG -#ifdef WINS -/// Folder where the log resides -_LIT( KLogFolder, "provisioning" ); - -/// The name of the log file -_LIT( KLogFileName, "wapadapter" ); - -/// The format in which the time is formatted in log -_LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); - -/// The length of the string produced by KLogTimeFormat -const TInt KLogTimeFormatLength = 16; - -/// How many characters a log line can contain -const TInt KLogLineLength = 256; -#endif -#endif - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// Debug -// ----------------------------------------------------------------------------- -// -#ifdef WAPDEBUG -GLDEF_C void Debug( TRefByValue aText, ... ) - { - #ifdef WINS - VA_LIST args; - VA_START( args, aText ); - - TBuf buf; - buf.FormatList( aText, args ); - - RFileLogger logger; - TInt ret=logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); - TBuf timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); - - VA_END( args ); - #else - RDebug::Print(aText); - #endif - } -#else -GLDEF_C void Debug( TRefByValue /*aText*/, ... ) - { - } -#endif - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/WPWAPItemFactory.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/WPWAPItemFactory.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: WPWAPItemFactory creates WAP settings items. -* -*/ - - - -// INCLUDE FILES -#include "WPWAPItemFactory.h" -#include "CWPWAPMMSItem.h" -#include "CWPWAPBrowserItem.h" -#include "CWPWAPBookmarkItem.h" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// WPWAPItemFactory::CreateMMSL -// ----------------------------------------------------------------------------- -// -MWPWAPItemBase* WPWAPItemFactory::CreateMMSLC( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager ) - { - CWPWAPMMSItem* item = CWPWAPMMSItem::NewL( aTitle, aDefaultName, - aCharacteristic, aCommsDb, aCmManager ); - CleanupStack::PushL( item ); - return item; - } - -// ----------------------------------------------------------------------------- -// WPWAPItemFactory::CreateBrowserL -// ----------------------------------------------------------------------------- -// -MWPWAPItemBase* WPWAPItemFactory::CreateBrowserLC( TBool aFirst, - const TDesC& aTitle, - const TDesC& aBookmarkTitle, - const TDesC& aDefaultName, - const TDesC& aDefaultBookmarkName, - CWPCharacteristic& aCharacteristic, - CCommsDatabase*& aCommsDb, - RCmManagerExt*& aCmManager, - RFavouritesDb aBookmarkDb ) - { - CWPWAPBrowserItem* item = CWPWAPBrowserItem::NewL( aFirst, aTitle, aBookmarkTitle, - aDefaultName, aDefaultBookmarkName, aCharacteristic, aCommsDb, aCmManager, aBookmarkDb ); - CleanupStack::PushL( item ); - return item; - } - -// ----------------------------------------------------------------------------- -// WPWAPItemFactory::CreateMMSL -// ----------------------------------------------------------------------------- -// -MWPWAPItemBase* WPWAPItemFactory::CreateBookmarkLC( const TDesC& aTitle, - const TDesC& aDefaultName, - CWPCharacteristic& aResource, - CWPCharacteristic*& aLink, - RFavouritesDb aDb) - { - CWPWAPBookmarkItem* item = CWPWAPBookmarkItem::NewL( aTitle, - aDefaultName, aResource, aLink, aDb ); - CleanupStack::PushL( item ); - return item; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/WAPAdapter/Src/WPWAPUtil.cpp --- a/omaprovisioning/provisioning/WAPAdapter/Src/WPWAPUtil.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2002 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: WPWAPUtil is a utility class for reading resource strings. -* -*/ - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include // TUriParser8 -#include "WPWAPUtil.h" - -// CONSTANTS -#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw - _LIT( KAdapterName, "WPWAPAdapterResource" ); -#else - _LIT( KAdapterName, "WPWAPAdapter" ); -#endif - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// WPWAPUtil::ReadHBufCL -// ----------------------------------------------------------------------------- -// -HBufC* WPWAPUtil::ReadHBufCL( TInt aResourceId ) - { - TFileName fileName; - Dll::FileName( fileName ); - - return WPAdapterUtil::ReadHBufCL( fileName, KAdapterName, aResourceId ); - } - -// ----------------------------------------------------------------------------- -// WPWAPUtil::CheckURL -// ----------------------------------------------------------------------------- -// -TBool WPWAPUtil::CheckURI( const TDesC& aUrl ) - { - return WPAdapterUtil::CheckURI( aUrl ); - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAccesspointItem.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAccesspointItem.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* Copyright (c) 2002 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 stores data for one accesspoint -* -*/ - - - -#ifndef CWPAPACCESSPOINTITEM_H -#define CWPAPACCESSPOINTITEM_H - -// INCLUDES -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CWPEngine; -class CWPAPItemBase; -class CWPParameter; -class CWPCharacteristic; -class CCommsDatabase; -class CWPAPNapdef; -class RCmManagerExt; - -// CLASS DECLARATION - -/** - * CWPAPAccesspointItem handles accesspoint settings. It links data from - * logical proxy, physical proxy and napdef into one item. - */ -class CWPAPAccesspointItem : public CBase - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aDefaultName The default name if none is found - * @param aLogicalProxy The logical proxy - * @param aPhysicalProxy The physical proxy - * @param aNapdef The napdef - * @param aCharacteristic The characteristic - */ - static CWPAPAccesspointItem* NewLC( - const TDesC& aDefaultName, - CWPAPItemBase* iLogicalProxy, - CWPAPItemBase* iPhysicalProxy, - CWPAPItemBase* aNapdef, - CWPCharacteristic& aCharacteristic ); - - /** - * Destructor. - */ - virtual ~CWPAPAccesspointItem(); - - public: // New methods - - /** - * Get the accesspoint name. - * @return reference to name. - */ - const TDesC& Name() const; - - /** - * Get the NAPdef pointer - * @return pointer to napdef. - */ - CWPAPItemBase* NapDef(); - - /** - * Set the pointer to the CM manager - * @return void - */ - void SetCMManager( RCmManagerExt* aCm ); - - /** - * Get the characteristic value - * @return iCharacteristic. - */ - TInt Characteristic(); - - /** - * Save this accesspoint to comms database. - * @param aCommsDb reference to CCommsdatabase - */ - TUint32 SaveL( CCommsDatabase& aCommsDb ); - - /** - * Return the UID of the saved access point. - * @return UID - */ - const TDesC8& Uid() const; - - /** - * Delete old data from engine model. - */ - void DeleteUidData() const; - - private: // New functions - - /** - * Store the accesspoint data to comms database. - * @param aCommsDb reference to CCommsdatabase - */ - TUint32 StoreL( CCommsDatabase& aCommsDb ); - - /** - * C++ default constructor. - * @param aDefaultName The default name if none is found - * @param aLogicalProxy The logical proxy - * @param aPhysicalProxy The physical proxy - * @param aNapdef The napdef - * @param aCharacteristic The characteristic - */ - CWPAPAccesspointItem( const TDesC& aDefaultName, - CWPAPItemBase* iLogicalProxy, - CWPAPItemBase* iPhysicalProxy, - CWPAPItemBase* aNapdef, - CWPCharacteristic& aCharacteristic ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data (Total ownership is assumed unless otherwise stated) - - /// The default name if no other is found - const TDesC& iDefaultName; - - /// The napdef - CWPAPItemBase* iNapdef; - - /// The physical proxy - CWPAPItemBase* iPhysicalProxy; - - /// The logical proxy - CWPAPItemBase* iLogicalProxy; - - /// The uid created when saving - TPckgBuf iUid; - - /// The characteristic the caused the creation of an access point - CWPCharacteristic& iCharacteristic; - RCmManagerExt* iCmManager; - - private: // For testing usage. - friend class T_CWPAPAccesspointItem; - friend class T_CWPAPAdapter; - friend class T_WPAPTestUtils; - }; - -#endif // CWPAPACCESSPOINTITEM_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAdapter.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPAdapter.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -/* -* Copyright (c) 2002 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: Main class for handling provisioning accesspoint data -* -*/ - - - -#ifndef CWPAPADAPTER_H -#define CWPAPADAPTER_H - -// INCLUDES - -#include -#include -#include - -// FORWARD DECLARATIONS - -class CWPAPAccesspointItem; -class CCommsDatabase; - -// CLASS DECLARATION - -/** - * CWPAPAdapter handles accesspoint settings. - */ -class CWPAPAdapter : public CWPAdapter, public MWPContextExtension - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @return a instance of class. - */ - static CWPAPAdapter* NewL(); - - /** - * Destructor - */ - ~CWPAPAdapter(); - - public: // From CWPAdapter - - TInt ItemCount() const; - const TDesC16& SummaryTitle(TInt aIndex) const; - const TDesC16& SummaryText(TInt aIndex) const; - TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor ); - void SaveL( TInt aItem ); - TBool CanSetAsDefault( TInt aItem ) const; - void SetAsDefaultL( TInt aItem ); - void VisitL(CWPCharacteristic& aElement); - void VisitL(CWPParameter& aElement); - void VisitLinkL(CWPCharacteristic& aCharacteristic ); - TInt ContextExtension( MWPContextExtension*& ); - - public: // From MWPContextExtension - - const TDesC8& SaveDataL( TInt aIndex ) const; - void DeleteL( const TDesC8& aSaveData ); - TUint32 Uid() const; - - private: // New functions - - /** - * C++ default constructor. - */ - CWPAPAdapter(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Check whether this characteristic is already linked. - * @param aCharacteristic characteristic to compare. - * @return ETrue if link to given characteristic was found. - */ - TBool IsAlreadyLinked( CWPCharacteristic& aCharacteristic ); - - private: // Data - - /// Array of linked NAPDEF and PXLOGICAL characteristics. Refs. - RPointerArray iLinks; - /// Array of data items for memory management. Owns. - RPointerArray iDataItems; - /// Array of save items. Owns. - RPointerArray iSaveItems; - /// Pointer to commsdatabase used in saving. Owns. - CCommsDatabase* iCommsDb; - /// Summary title. Owns. - HBufC* iTitle; - /// Default name. Owns. - HBufC* iDefaultName; - /// Indicates whether these settings are already saved. - TBool iAlreadySavedOnce; - // CMManager for managing connection methods - RCmManagerExt* iCmManager; - RArray iAPValue; - - private: // For testing. - friend class T_CWPAPAdapter; - }; - -#endif // CWPAPADAPTER_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPItemBase.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPItemBase.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a base class for all the items in WPAPAdapter -* -*/ - - - - - -#ifndef CWPAPITEMBASE_H -#define CWPAPITEMBASE_H - -// INCLUDES - -#include -#include -#include - -// DATA TYPES - -// Field types that can be marked received. -// Values defined to the power of to to enable masking. -enum TMarkedField - { - EWPParameterPxAddrType_id = 2, - EWPParameterPxAddrFQDN_id = 4, - EWPParameterNapID_id = 8, - EWPParameterService_id = 16, - EWPParameterPortNbr_id = 32, - EWPParameterPxAddr_id = 64, - EWPParameterAuthentication_id = 512, - EWPParameterIfNetworks_id = 1024, - EWPParameterInternet_id = 2048, - EWPParameterWlan_id = 4096 - }; - -// FORWARD DECLARATIONS - -class CWPAPAccesspointItem; -class CCommsDatabase; - -// CLASS DECLARATION - -/** - * CWPAPItemBase is a base class for all the items in WPAPAdapter. - */ -class CWPAPItemBase : public CBase - { - public: - - /** - * Destructor. - */ - ~CWPAPItemBase(); - - public: // New methods - - /** - * Store the item data to APEngine's accesspoint item. - * @param aAPItem item where data is stored. - */ - virtual void AddDataL( RCmConnectionMethodExt& ) = 0; - - /** - * Add access point items to an array. - * @param aItems The array to add to - * @param aLogicalProxy The related logical proxy, if any - * @param aPhysicalProxy The related physical proxy, if any - */ - virtual TInt AddItemsL( RPointerArray& aItems, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy ) = 0; - - /** - * The name of the item to be displayed to the user. - * @return The name - */ - virtual const TDesC& Name() = 0; - - /** - * SaveWlanDataL - */ - virtual void SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb ) = 0; - - virtual void UpdateLingerL(const TUint32 aIapId) = 0; - - protected: // New methods. Only for subclasses use. - - /** - * Base constructor. - * @param aDefaultName The default name to use for an access point - */ - CWPAPItemBase( const TDesC& aDefaultName ); - - /** - * Mark that this field has arrived and was correctly handled. - * @param aField received field enumeration - */ - void MarkReceived( TMarkedField aField ); - - /** - * Check has the given field been received. - * @param aField received field enumeration - * @return ETrue if the field has already been received and handled - */ - TBool IsReceived( TMarkedField aField ); - - protected: - - /// The default name for an access point - const TDesC& iDefaultName; - - private: // Data - - /// Received fields marked here. - TUint32 iReceivedFieldsFlags; - - private: // For testing. - friend class T_CWPAPItemBase; - }; - -#endif // CWPAPITEMBASE_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPLogicalProxy.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPLogicalProxy.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a class, which holds logical proxy information. -* -*/ - - - - - -#ifndef CWPAPLOGICALPROXY_H -#define CWPAPLOGICALPROXY_H - -// INCLUDES - -#include -#include "CWPAPItemBase.h" -#include - -// FORWARD DECLARATIONS - -class CWPAPPhysicalProxy; -class CWPAPAccesspointItem; -class CWPAPPort; - -// CLASS DECLARATION - -/** - * CWPAPLogicalProxy contains logical proxy data. - */ -class CWPAPLogicalProxy : public CWPAPItemBase, private MWPVisitor - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aDefaultName The default name of an access point - * @param aCharacteristic The PXLOGICAL characteristic - */ - static CWPAPLogicalProxy* NewLC( const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic ); - - /** - * Destructor. - */ - ~CWPAPLogicalProxy(); - - public: // From CWPAPItemBase - - TBool ValidateL(); - void AddDataL( RCmConnectionMethodExt& aCmItem ); - TInt AddItemsL( RPointerArray& aItems, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy ); - const TDesC& Name(); - void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {}; - - void UpdateLingerL(const TUint32 /*aIapId*/){}; - - private: // From CWPAPItemBase - - void VisitL(CWPCharacteristic& aElement); - void VisitL(CWPParameter& aElement); - void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {}; - - private: // New methods - - /** - * C++ default constructor. - * @param aDefaultName The default name of an access point - */ - CWPAPLogicalProxy( CWPCharacteristic& aCharacteristic, - const TDesC& aDefaultName ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - - /// Pointer to data model parameter. Refs. - CWPParameter* iHomepage; - - /// Pointer to data model parameter. Refs. - CWPParameter* iName; - - /// Pointer to port object. Owns. - CWPAPPort* iPort; - - /// Array of physical proxy objects. Owns. - RPointerArray iPhysicalProxies; - - /// Characteristic - CWPCharacteristic& iCharacteristic; - - private: // For testing - - friend class T_CWPAPLogicalProxy; - friend class T_CWPAPAdapter; - friend class T_WPAPTestUtils; - }; - -#endif // CWPAPLOGICALPROXY_H - -// End of File \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPNapdef.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,388 +0,0 @@ -/* -* Copyright (c) 2002-2006 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 stores data for one accesspoint -* -*/ - - - - - -#ifndef CWPAPNAPDEF_H -#define CWPAPNAPDEF_H - -// INCLUDES -#include -#include -#include -#include "CWPAPItemBase.h" -#include "WPAPDefs.h" -#include -#include -#include -#include - -// FORWARD DECLARATIONS -class CWPAPPhysicalProxy; - -class CWPParameter; -class CCommsDatabase; -class EAPSettings; -class EapCertificateEntry; -class RCmManagerExt; -class TEapExpandedType; - - -// CLASS DECLARATION - -/** - * CEapTypeElement is arrray element for several EapTypes - */ -class CEapTypeElement: public CBase - { - public: - ~CEapTypeElement(); - TBuf8 iEapTypeString; - TBuf8 iEncapsulatingExpandedEapId; - EAPSettings* iEAPSettings; - EapCertificateEntry* iCertificate; - }; - -struct SECssID - { - CWPParameter* iSSSID; - CWPParameter* iSUSSID; - }; -/** - * CWPAPNapdef handles NAPDEF characteristics. - */ -class CWPAPNapdef : public CWPAPItemBase, private MWPVisitor - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aFollowingLink ETrue if the NAPDEF was reached - * via a link. - * @param aDefaultName The default name of an access point - * @param aLogicalCharacteristic The PXLOGICAL, if following a link from - * there, or NAPDEF, if a direct link to NAPDEF. - * @param aLink The NAPDEF characteristic - */ - static CWPAPNapdef* NewLC( TBool aFollowingLink, - const TDesC& aDefaultName, - CWPCharacteristic& aLogicalCharacteristic, - CWPCharacteristic& aLink ); - - /** - * Destructor. - */ - virtual ~CWPAPNapdef(); - - public: // From CWPAPItemBase - - /** - * @precondition characteristic must be set otherwise Panics. - */ - TBool ValidateL(); - - /** - * AddDataL - */ - void AddDataL( RCmConnectionMethodExt& aCmItem ); - - /** - * AddItemsL - */ - TInt AddItemsL( RPointerArray& aItems, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy ); - /** - * Name - */ - const TDesC& Name(); - - /** - * SaveWlanDataL - */ - void SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb ); - - /** - * UpdateLingerL from the ItemBase - */ - - void UpdateLingerL(const TUint32 aIapId); - - /** - * Set The Internet Parameter Indicator - */ - void SetInternetIndicator(TInt value); - - /** - * Get The Internet Parameter Indicator - */ - TInt GetInternetIndicator(); - - - private: // From MWPVisitor - - /** - * VisitL - */ - void VisitL( CWPCharacteristic& aElement ); - - /** - * VisitL - */ - void VisitL( CWPParameter& aElement ); - - /** - * VisitLinkL - */ - void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {}; - - private: // New functions - - /** - * C++ default constructor. - * @param aFollowingLink ETrue if the NAPDEF was reached - * via a link. - * @param aDefaultName The default name of an access point - * @param aLogicalCharacteristic The PXLOGICAL, if following a link from - * there, or NAPDEF, if a direct link to NAPDEF. - */ - CWPAPNapdef( TBool aFollowingLink, - const TDesC& aDefaultName, - CWPCharacteristic& aLogicalCharacteristic ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Writes a DNS address in either IPv4 or IPv6 format - * to an access point item. - * @param aAPItem The access point item - * @param aValue The DNS address to write - */ - void WriteDNSAddressL( RCmConnectionMethodExt& aCmItem, - const TDesC& aValue ); - - /** - * AddWlanDataL - */ - void AddWlanDataL( RCmConnectionMethodExt& aCmItem ); - - /** - * HandleWLanParameters - */ - void HandleWLanParametersL( CWPParameter& aParameter ); - - void HandleEAPParametersCCL( CWPParameter& aParameter ); - - /** - * ConvertAsciiToHex - */ - void ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest ); - - /** - * StrCopy - */ - void StrCopy( TDes8& aTarget, const TDesC& aSource ); - - /** - * Add linger value - */ - void AddLingerL( const TInt , const TInt ); - - /** - * Update linger value - */ - void UdateligerValueL(CWPParameter* aLinger); - /** - * Isalpha - */ - TBool Notalpha(const TDesC& aValue); - /** - * CheckIPv4values - */ - TBool CheckIPv4values(const TDesC& aValue ); - - /** - * CheckAddressPart - */ - TBool CheckAddressPart( TLex& aLex ); - - /** - * ConvertEAPStringToIds - */ - void ConvertEAPStringToIds(const TDesC& aEAPString, TDes8& aExpandedId, TEapExpandedType& aID); - public: // new function - - /** - * NapId value - */ - const TDesC& NapId(); - /** - * Bearer value - */ - TUint Bearer(); - - /** - * SetCMManager - */ - void SetCMManager( RCmManagerExt* aCm ); - - private: // Data (Total ownership is assumed unless otherwise stated) - - enum TAPWEPKeyFormat - { - EAscii, // Ascii format - EHexadecimal // Hex format - }; - /// PXLOGICAL characteristic - CWPCharacteristic& iCharacteristic; - - /// The human-readable name of the connection. Refs. - CWPParameter* iConnectionName; - - /// The access point address. Refs. - CWPParameter* iAccesspointName; - - /// The access point address. Refs. - CWPParameter* iAccesspointNameType; - - /// The user name. Refs. - CWPParameter* iUserName; - - /// The password. Refs. - CWPParameter* iPassword; - - /// The IP address of the phone. Refs. - CWPParameter* iPhoneIPAddress; - - /// The network type of the access point. Refs. - CWPParameter* iIfNetworks; - - /// Array of name servers. Refs. - RPointerArray iNameServers; - - /// Number of IPv4 name servers found so far. - TInt iNumIPv4NameServers; - - /// Number of IPv6 name servers found so far. - TInt iNumIPv6NameServers; - - /// The bearer of the access point. - //TApBearerType iBearer; - TUint iBearer; - - // Received bearer was unsupported - TBool iBearerUnsupported; - - /// The PDP type of a GPRS access point. - TUint32 iPdpType; - - /// ETrue of secure authentication must be used. - TBool iSecureAuthentication; - - /// ETrue if the user must be prompted for password. - TBool iPromptPassword; - - /// ETrue if we arrived to NAPDEF via a link - TBool iFollowingLink; - -//JMan for WLan - - // Is WLAN supported (queried from Feature Manager) - TBool iWlanSupported; - - // The Network Access Point ID. - CWPParameter* iNapID; - - // WLAN characteristic parameters - - // The Primary Service Set Identifier name. - CWPParameter* iPriSSID; - - // The Used Primary Service Set Identifier name. - CWPParameter* iPriUSSID; - - // The Hidden Primary Service Set Identifier name. - CWPParameter* iPriHSSID; - - //for secssid - RPointerArray iSecSSID; - - - // The operation mode of the WLAN network. - TUint32 iNetMode; - - // The Security mode of the WLAN network. - TUint32 iSecMode; - - // The ascii formed pre-shared key. - CWPParameter* iWpaPresKeyAsc; - - // The wep authentication mode - CWPParameter* iWepAuthMode; - - // Indicates the default wepkey - TUint iDefaultWepKeyIndex; - - // WEPKEY characteristic parameters - - // The lenght of the wepkey - CWPParameter* iWepKeyLength; - - // The index of the wepkey - TUint iWepInd; - - // The wepkey data - CWPParameter* iWepKeyData; - - // Type of authentication (EAuthOpen, EAuthShared) - TWEPAuthentication iAuthentication; - - // Data of the key - TBuf8 iKeyData[KMaxNumberofKeys]; - - // Format of the key - TAPWEPKeyFormat iKeyFormat[KMaxNumberofKeys]; - - RPointerArray iEapTypeArray; - - // Pointer to Linger value parameter. Refs. - CWPParameter* iLinger; - - //linger value - TUint iLingerValue; - TBool iLingerFlag; - - // Pointer to the used CMManager, needed to save WLAN data - RCmManagerExt* iCm; - - //Internet parameter Indicator - TInt iInternetIndicator; - - private: // For testing usage. - friend class T_CWPAPNapdef; - friend class T_CWPAPAdapter; - friend class T_WPAPTestUtils; - }; - -#endif // CWPAPNAPDEF_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPhysicalProxy.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPhysicalProxy.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a class, which holds physical proxy information. -* -*/ - - - - - -#ifndef CWPAPPHYSICALPROXY_H -#define CWPAPPHYSICALPROXY_H - -// INCLUDES - -#include -#include "CWPAPItemBase.h" -#include - -// DATA TYPES - -enum TWPAPPxAddrType - { - EPxAddrTypeIPv4 = 1, - EPxAddrTypeIPv6, - EPxAddrTypeUnsupported // (IPv6, E164, ALPHA are not supported) - }; - -// FORWARD DECLARATIONS - -class CWPAPLogicalProxy; -class CWPAPPort; -class CWPAPNapdef; - -// CLASS DECLARATION - -/** - * CWPAPPhysicalProxy contains physical proxy information - */ -class CWPAPPhysicalProxy : public CWPAPItemBase, private MWPVisitor - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aDefaultName The default name of an access point - * @param aCharacteristic The PXPHYSICAL characteristic. - * @param aPort Reference to a pointer containing PORT of a PXLOGICAL. - */ - static CWPAPPhysicalProxy* NewLC( const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CWPCharacteristic& aLogicalCharacteristic, - CWPAPPort*& aPort ); - - /** - * Destructor. - */ - ~CWPAPPhysicalProxy(); - - public: // From CWPAPItemBase - - TBool ValidateL(); - void AddDataL( RCmConnectionMethodExt& aCmItem ); - TInt AddItemsL( RPointerArray& aItems, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy ); - const TDesC& Name(); - void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {}; - void UpdateLingerL(const TUint32 /*aIapId*/){}; - - private: // From CWPAPItemBase. Override default implementation. - - void VisitL( CWPCharacteristic& aElement ); - void VisitL( CWPParameter& aElement ); - void VisitLinkL( CWPCharacteristic& aCharacteristic ); - - private: // New functions - - /** - * C++ default constructor. - * @param aDefaultName The default name of an access point - * @param aPort Reference to a pointer containing PORT of a PXLOGICAL. - */ - CWPAPPhysicalProxy( const TDesC& aDefaultName, - CWPCharacteristic& aLogicalCharacteristic, - CWPAPPort*& aPort ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - - /// Pointer to data model parameter. Refs. - CWPParameter* iProxyAddr; - - /// Pointer to data model parameter. Refs. - CWPParameter* iName; - - /// Proxy address type - TWPAPPxAddrType iPxAddrType; - - /// Pointer to port object. Owns. - CWPAPPort* iPort; - - /// Pointer to port object owned by logical proxy. Refs. - CWPAPPort*& iLogicalPort; - - /// Napdefs linked to by PXPHYSICAL - RPointerArray iNapdefs; - - /// Pointer to characteristic - CWPCharacteristic& iLogicalCharacteristic; - - private: // For testing - - friend class T_CWPAPLogicalProxy; - friend class T_CWPAPAdapter; - friend class T_WPAPTestUtils; - }; - -#endif // CWPAPPHYSICALPROXY_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPort.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/CWPAPPort.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a class, which holds proxy port information. -* -*/ - - - - - -#ifndef CWPAPPORT_H -#define CWPAPPORT_H - -// INCLUDES - -#include -#include "CWPAPItemBase.h" - -// FORWARD DECLARATIONS - - - -// CLASS DECLARATION - -/** - * CWPAPPort contains port information - */ -class CWPAPPort : public CWPAPItemBase, private MWPVisitor - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @param aCharacteristic The PORT characteristic - */ - static CWPAPPort* NewLC( CWPCharacteristic& aCharacteristic ); - - /** - * Destructor. - */ - virtual ~CWPAPPort(); - - public: // From CWPAPItemBase - - TBool ValidateL(); - void AddDataL( RCmConnectionMethodExt& aCmItem ); //CMManager - TInt AddItemsL( RPointerArray& aItems, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy ); - const TDesC& Name(); - void SaveWlanDataL( TUint32 /*aIapId*/, CCommsDatabase& /*aCommsDb*/ ) {}; - void UpdateLingerL(const TUint32 /*aIapId*/){}; - - private: // From MWPVisitor - - void VisitL(CWPCharacteristic& aCharacteristic); - void VisitL(CWPParameter& aParameter); - void VisitLinkL( CWPCharacteristic& /*aLink*/ ) {}; - - private: // New functions - - /** - * Constructor. - */ - CWPAPPort(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - /** - * Helper method to set the internal values. - * @param aConnectionSecurity sets value for iConnectionSecurity. - * @param aSessionMode sets value for iSessionMode. - * @param aReceivedField marks the field as received - */ - void SetValues( TBool aConnectionSecurity, - TInt aSessionMode, - TMarkedField aReceivedField ); - - private: // Data - - /// ETrue if secure connection should be established - TBool iConnectionSecurity; - /// Session mode for WAP connections: connection oriented/less. - TInt iSessionMode; - /// Pointer to port number parameter. Refs. - CWPParameter* iPortNbr; - - private: - friend class T_CWPAPProxyData; - friend class T_CWPAPAdapter; - friend class T_WPAPTestUtils; - }; - -#endif // CWPAPPORT_H - -// End of File \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/ProvisioningDebug.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/ProvisioningDebug.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* -* Copyright (c) 2005 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 defines logging macros for Provisioning -* -*/ - - - - - - -#ifndef PROVISIONINGDEBUG_H -#define PROVISIONINGDEBUG_H - -#include -#include - -//Examples -//FLOG( _L( "[Provisioning] ProvisioningEngine::ConstructL:" ) ); -//FTRACE(RDebug::Print(_L("[Provisioning] ProvisioningEngine::ConstructL: err (%d)"), err)); -#ifdef _DEBUG - -const TInt KBTHexDumpWidth=16; -const TInt KBTLogBufferSize=100; -const TText KFullStopChar='.'; - -_LIT(KBTFirstFormatString,"%04x: "); -_LIT(KBTSecondFormatString,"%02x "); -_LIT(KBTThirdFormatString,"%c"); -_LIT(KBTThreeSpaces," "); -_LIT(KBTSeparator," "); - -inline void HexDump(const TUint8* aPtr, TInt aLen) - { - if( aPtr != NULL ) - { - TBuf line; - TInt i = 0; - - while (aLen>0) - { - TInt n = (aLen>KBTHexDumpWidth ? KBTHexDumpWidth : aLen); - line.AppendFormat(KBTFirstFormatString,i); - TInt j; - for (j=0; j126 || aPtr[i+j]==37) ? KFullStopChar : aPtr[i+j]); - - RDebug::Print(line); - - line.Zero(); - aLen-=n; - i+=n; - } - } - } - - -// ------------------------------------------ - -inline void FHex(const TUint8* aPtr, TInt aLen) - { - HexDump( aPtr, aLen ); - } - -// ------------------------------------------ - -inline void FHex(const TDesC8& aDes) - { - RFs fs; - RFile file; - _LIT( TmpOutputName, "C:\\provisioning.wbxml" ); - fs.Connect(); - CleanupClosePushL(fs); - //if( aFile.Open(aFileSession, TmpOutputName(), EFileShareAny|EFileWrite) == KErrNone ) - file.Replace(fs, TmpOutputName(), EFileShareAny|EFileWrite); - CleanupClosePushL(file); - TInt pos(0); - file.Seek(ESeekEnd, pos); -// HBufC8* tmp = HBufC8::NewLC(line.Size()); -// TPtr8 ptr = tmp->Des(); -// ptr.Copy(line); - TInt result = file.Write(aDes); - CleanupStack::PopAndDestroy(2); // file, fs -/////////////////////////////////////////////////// - -// HexDump(aDes.Ptr(), aDes.Length()); - } - -// =========================================================================== -#ifdef __WINS__ // File logging for WINS -// =========================================================================== -#include -#include -#include - -_LIT( KLogFile, "Provisioning.log" ); -_LIT( KLogDirFullName, "c:\\logs\\" ); -_LIT( KLogDir, "Provisioning" ); - -#define FLOG( a ) { FPrint(a); } -#define FTRACE( a ) { a; } - -// Declare the FPrint function -// -inline void FPrint( const TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - RFileLogger::WriteFormat( KLogDir, - KLogFile, - EFileLoggingModeAppend, - aFmt, - list ); - } - -// =========================================================================== -#else // RDebug logging for target HW -// =========================================================================== -/*#include - -#define FLOG( a ) { RDebug::Print( a ); } -#define FTRACE( a ) { a; } - -*/ - -//////////////MIKA/////////////// -#include -#include -#include - -_LIT( KLogFile, "Provisioning.log" ); -_LIT( KLogDirFullName, "c:\\logs\\" ); -_LIT( KLogDir, "Provisioning" ); - -#define FLOG( a ) { FPrint(a); } -#define FTRACE( a ) { a; } - -// Declare the FPrint function -// -inline void FPrint( const TRefByValue aFmt, ... ) - { - VA_LIST list; - VA_START( list, aFmt ); - RFileLogger::WriteFormat( KLogDir, - KLogFile, - EFileLoggingModeAppend, - aFmt, - list ); - } - -//////////////MIKA/////////////// - - -#endif //__WINS__ - -// =========================================================================== -#else // // No loggings --> Reduced binary size -// =========================================================================== -#define FLOG( a ) -#define FTRACE( a ) - -#endif // _DEBUG - -///////// Kailash /////////////////////// -inline void LOGX(TInt aSource) - { - HBufC *iMyBufNumber = HBufC::NewLC(255); - TPtr bufNumberPtr(iMyBufNumber->Des()); - bufNumberPtr.FillZ(); - bufNumberPtr.AppendFormat(_L("%d"),aSource); - FLOG(iMyBufNumber->Des()); - CleanupStack::PopAndDestroy(); - } -///////// Kailash /////////////////////// - -#endif // PROVISIONINGDEBUG_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/WPAPAdapter.pan --- a/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPAdapter.pan Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2002 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: Panic codes for Provisioning accesspoint adapter -* -*/ - - - - - -#ifndef WPAPADAPTER_PAN -#define WPAPADAPTER_PAN - -enum TWPAPAdapterPanicCodes - { - EDebugCode = 1000, - EIllegalCharacteristic, - EIllegalState, - EIndexOutOfBounds, - ENullPointer, - EPreConditionFail, - EPostConditionFail, - ESaveOperationAlreadyActive, - ENoUniqueNameResolved - }; - -GLDEF_C void Panic( TInt aPanic ); - -#endif \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/WPAPDefs.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPDefs.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Definitions to WPAPAdapter -* -*/ - - - - - -#ifndef WPAPDEFS_H -#define WPAPDEFS_H - -#include - -// CONSTANTS - -const TUint32 KMaxWEPKeyLength = 29; -// The maximum WPA Pre-Shared Key length. -const TUint KMaxWpaPskLength = 63; -// same as connection name max length in Prov req. -const TInt KNameMaxLength = 30; -const TInt KTwoNameServersPerNetworkType = 2; -// The maximum length of key data -const TUint KMaxLengthOfKeyData = 58; -const TUint KMaxLengthOfEapList = 50; -const TUint KExpandedEapIdLength = 8; -// Number of keys -const TUint KMaxNumberofKeys = 4; - -const TInt KInitialArraySize = 3; - -const TUint KMaxSubKeyLenght = 255; - -_LIT(KIPV4, "IPV4"); -_LIT(KIPV6, "IPV6"); -_LIT(KCLWSP, "CL-WSP"); -_LIT(KCOWSP, "CO-WSP"); -_LIT(KCLSECWSP, "CL-SEC-WSP"); -_LIT(KCOSECWSP, "CO-SEC-WSP"); -_LIT(K9200, "9200"); -_LIT(K9201, "9201"); -_LIT(K9202, "9202"); -_LIT(K9203, "9203"); -_LIT(K80, "80"); -_LIT(K8080, "8080"); -_LIT(K443, "443"); - -_LIT(KGSMGPRS, "GSM-GPRS"); - -//Characteristic WLAN -_LIT(KWLAN, "WLAN"); -_LIT(PRISSID, "PRI-SSID"); -_LIT(PRIUSSID, "PRI-U-SSID"); -_LIT(PRIHSSID, "PRI-H-SSID"); - -//Characteristic WLAN/SEC-SSID -_LIT(SECSSID, "SEC-SSID"); -_LIT(SSSID, "S-SSID"); -_LIT(SUSSID, "S-U-SSID"); - -_LIT(NETMODE, "NETMODE"); -_LIT(SECMODE, "SECMODE"); - -//Characteristic WLAN/EAP -_LIT(KEAP, "EAP"); -_LIT(EAPTYPE, "EAPTYPE"); -_LIT(EAPUSERNAME, "USERNAME"); -_LIT(EAPPASSWORD, "PASSWORD"); -_LIT(EAPREALM, "REALM"); -_LIT(EAPUSEPSEUD, "USE-PSEUD"); -_LIT(EAPMAXAUTHS, "MAXAUTHS"); -_LIT(EAPENCAPS, "ENCAPS"); -_LIT(EAPVERSERREALM, "VER-SER-REALM"); -_LIT(EAPCLIENTHAUTH, "CLIENTH-AUTH"); -_LIT(EAPSESVALTIME, "SES-VAL-TIME"); -_LIT(EAPCIPSUIT, "CIP-SUIT"); -_LIT(EAPPEAPV0, "PEAP-V0"); -_LIT(EAPPEAPV1, "PEAP-V1"); -_LIT(EAPPEAPV2, "PEAP-V2"); - -//Characteristic WLAN/EAP/CERT -_LIT(KCERT, "CERT"); -_LIT(EAPISSNAME, "ISS-NAME"); -_LIT(EAPSUBNAME, "SUB-NAME"); -_LIT(EAPCERTTYPE, "CERT-TYPE"); -_LIT(EAPSERNUM, "SER-NUM"); -_LIT(EAPSUBKEYID, "SUB-KEY-ID"); -_LIT(EAPTHUMBPRINT, "THUMBPRINT"); - -_LIT(EAPCERTUSER, "USER"); -_LIT(EAPCERTCA, "CA"); - -_LIT(WPAPRESKEYASC, "WPA-PRES-KEY-ASC"); -_LIT(WPAPRESKEYHEX, "WPA-PRES-KEY-HEX"); -_LIT(DEFAULTWEPIND, "WEPKEYIND"); -_LIT(WEPAUTHMODE, "WEPAUTHMODE"); - -//Characteristic WLAN/WEPKEY -_LIT(KWEP, "WEPKEY"); -_LIT(WEPKEYLENGTH, "LENGTH"); -_LIT(WEPKEYINDEX, "INDEX"); -_LIT(WEPKEYDATA, "DATA"); - -_LIT(KPAP, "PAP"); -_LIT(KCHAP, "CHAP"); -_LIT(KMD5, "MD5"); -_LIT(KANALOGMODEM, "ANALOG-MODEM"); -_LIT(KV110, "V.110"); -_LIT(KV120, "V.120"); -_LIT(KAUTOBAUDING, "AUTOBAUDING"); -_LIT(K9600, "9600"); -_LIT(K14400, "14400"); -_LIT(K19200, "19200"); -_LIT(K28800, "28800"); -_LIT(K38400, "38400"); -_LIT(K43200, "43200"); -_LIT(KIPv6, "IPv6"); -_LIT(KIPv4, "IPv4"); -_LIT(KAddrTypeE164, "E164"); -_LIT(KAddrTypeAPN, "APN"); - -_LIT(KADHOC, "ADHOC"); - -_LIT(KWEPSEC, "WEP"); -_LIT(KWPASEC, "WPA"); -_LIT(KWPA2SEC, "WPA2"); -_LIT(K8021XSEC, "8021X"); -_LIT(KWPAPRESSEC, "WPA-PRESHARED-KEY"); -_LIT(KWPA2PRESSEC, "WPA2-PRESHARED-KEY"); - - -_LIT(KEAPSIM, "EAP-SIM"); -_LIT(KEAPAKA, "EAP-AKA"); -_LIT(KEAPTLS, "EAP-TLS"); -_LIT(KEAPPEAP, "EAP-PEAP"); -_LIT(KEAPTTLS, "EAP-TTLS"); -_LIT(KEAPLEAP, "EAP-LEAP"); -_LIT(KEAPMSCHAPV2, "EAP-MSCHAPV2"); -_LIT(KEAPGTC, "EAP-GTC"); -_LIT(KEAPFAST, "EAP-FAST"); - -/* -_LIT8(KEapNone,"0"); -_LIT8(KEapGtc,"6"); -_LIT8(KEapTls, "13"); -_LIT8(KEapLeap,"17"); -_LIT8(KEapSim,"18"); -_LIT8(KEapTtls,"21"); -_LIT8(KEapAka,"23"); -_LIT8(KEapPeap,"25"); -_LIT8(KEapMschapv2,"26"); -_LIT8(KEapSecurid,"32"); -_LIT8(KEapFast,"43"); -*/ -_LIT8(KEapAll,"-017,-018,-023,-013,-025,-021,-043" ); - -const TUint8 KEapNoneId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -const TUint8 KEapTlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d}; -const TUint8 KEapGtcTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06}; -const TUint8 KEapLeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11}; -const TUint8 KEapSimTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12}; -const TUint8 KEapTtlsTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15}; -const TUint8 KEapAkaTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17}; -const TUint8 KEapPeapTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19}; -const TUint8 KEapMschapv2TypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A}; -const TUint8 KEapSecuridTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}; -const TUint8 KEapFastTypeId[] = {0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B}; - - -const TUint8 KEapPlus = '+'; - -_LIT(KWEPAUTHMODEOPEN, "OPEN"); -_LIT(KWEPAUTHMODESHARED, "SHARED"); - -enum TWEPAuthentication - { - EAuthOpen, // Open authentication - EAuthShared // Shared authentication - }; - -// DATA TYPES - -/** -* Data structure for storing a WEP key. -*/ -struct TWep - { - /** Specifies which key to add or remove. Range: 0-3 */ - TUint32 KeyIndex; - /** The length of KeyMaterial in bytes. Range: 0-29 */ - TUint32 KeyLength; - /** Array that stores the WEP key. */ - TUint8 KeyMaterial[KMaxWEPKeyLength]; - }; - -/** -* Data structure for storing a WPA Pre-Shared Key. -*/ -struct TWpaPsk - { - /** The length of KeyMaterial in bytes. Range: 0-63 */ - TUint KeyLength; - /** Array of that stores the WPA Pre-Shared Key. */ - TUint8 KeyMaterial[KMaxWpaPskLength]; - }; - - - -#endif // WPAPDEFS_H - -// End of File. diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/WPAPSharedDataKeys.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPSharedDataKeys.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2002 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: Shared data keys for operator AP settings -* -*/ - - - - - -#ifndef WPAPSHAREDDATAKEYS_H -#define WPAPSHAREDDATAKEYS_H - -// CONSTANTS - -// ----------------------------------------------------------------------------- -// AP Operator setting 0x101F466B -// ----------------------------------------------------------------------------- - -const TUid KSDUidOperatorSettings = {0x101F466B}; - -/** -* Modification of locked APs via OTA allowed -* -* Possible values: -* 0 (no) -* 1 (yes) -* -* Default value: 0 -**/ -_LIT( KOsOtaModificationAllowed, "A" ); - -#endif // WPAPSharedDataKeys_H - -// End of File \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Inc/WPAPUtil.h --- a/omaprovisioning/provisioning/accesspointadapter/Inc/WPAPUtil.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2002 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 offers common utility methods. -* -*/ - - - - - -#ifndef WPAPUTIL_H -#define WPAPUTIL_H - -// INCLUDES - -#include - -// CLASS DECLARATION - -/** - * WPAPUtil offers common helper methods. - */ -class WPAPUtil - { - public: // New methods - - /** - * Loads a specified resource string from resource file. - * @param aResourceId is of a resource string. - * @return pointer to loaded descriptor. - */ - static HBufC* ReadHBufCL( TInt aResourceId ); - - }; - -#endif // WPAPUTIL_H - -// End of File \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAccesspointItem.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAccesspointItem.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,320 +0,0 @@ -/* -* Copyright (c) 2002 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 stores data for one accesspoint -* -*/ - - - -// INCLUDE FILES - -#include "CWPAPAccesspointItem.h" // Own header - -#include -#include -#include - - -#include -#include // Feature manager -#include // Leave code for protected -#include "CWPAPItemBase.h" -#include "CWPAPNapdef.h" -#include "WPAPAdapter.pan" -#include "ProvisioningDebug.h" -#include -#include -#include -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::NewLC -// ----------------------------------------------------------------------------- -CWPAPAccesspointItem* CWPAPAccesspointItem::NewLC( - const TDesC& aDefaultName, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy, - CWPAPItemBase* aNapdef, - CWPCharacteristic& aCharacteristic ) - { - CWPAPAccesspointItem* self = - new(ELeave) CWPAPAccesspointItem( aDefaultName, - aLogicalProxy, - aPhysicalProxy, - aNapdef, - aCharacteristic ); - CleanupStack::PushL( self ); - self->ConstructL(); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPAPAccesspointItem::~CWPAPAccesspointItem() - { - } - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::Name -// ----------------------------------------------------------------------------- -// -const TDesC& CWPAPAccesspointItem::Name() const - { - if ( iLogicalProxy && iLogicalProxy->Name() != KNullDesC ) - { - return iLogicalProxy->Name(); - } - else if( iPhysicalProxy && iPhysicalProxy->Name() != KNullDesC ) - { - return iPhysicalProxy->Name(); - } - else if( iNapdef && iNapdef->Name() != KNullDesC ) - { - return iNapdef->Name(); - } - else - { - return iDefaultName; - } - } -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::NapDef -// ----------------------------------------------------------------------------- -// -CWPAPItemBase* CWPAPAccesspointItem::NapDef() - { - return iNapdef; - } - - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::SetCMManager -// ----------------------------------------------------------------------------- -// -void CWPAPAccesspointItem::SetCMManager( RCmManagerExt* aCm ) - { - iCmManager = aCm; - } - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::Characteristic -// ----------------------------------------------------------------------------- -// -TInt CWPAPAccesspointItem::Characteristic() - { - return iCharacteristic.Type(); - } - - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::SaveL -// ----------------------------------------------------------------------------- -// -TUint32 CWPAPAccesspointItem::SaveL( CCommsDatabase& aCommsDb ) - { - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::SaveL:" ) ); - - if ( FeatureManager::FeatureSupported( KFeatureIdSettingsProtection ) ) - { - // This protection check is no longer needed since CMManager - // initiates the transactions to the database - /*if( CApProtHandler::IsTableProtectedL( &aCommsDb ) ) - { - // Table protected -> leave with specific code. - User::Leave( EWPAccessPointsProtected ); - }*/ - } - - TUint32 iap = 0; - TRAPD( err,iap = StoreL( aCommsDb ) ); - if( err == KErrLocked ) - { - err = EWPCommsDBLocked; - } - User::LeaveIfError( err ); - return iap; - } - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::StoreL -// ----------------------------------------------------------------------------- -// -TUint32 CWPAPAccesspointItem::StoreL( CCommsDatabase& aCommsDb ) - { - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL:" ) ); - - // CMManager - // Create the cmIten, give the bearer as parameter if it is available - RCmConnectionMethodExt cmItem; - TBool created = EFalse; - TUint bearer; - TInt err(KErrNone); - - // If the NapDef object exists and the bearer is defined, then we can - // create the connection method using the bearer - if ( iNapdef != NULL ) - { - bearer = static_cast(iNapdef)->Bearer(); - if ( bearer != 0 ) - { - cmItem = iCmManager->CreateConnectionMethodL(bearer); - created = ETrue; - } - } - - // If the bearer id is not known we will use packet data - if ( !created) - { - cmItem = iCmManager->CreateConnectionMethodL(KUidPacketDataBearerType); - } - // Create the connection method into the DB - TRAP( err,cmItem.UpdateL() ); - // Leave if the creation fails for some reason - if(err!=KErrNone) - { - User::Leave(err); - } - - if( iNapdef ) - { - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: napdef" ) ); - - // CMManager - TRAP (err, iNapdef->AddDataL( cmItem )); - TRAP ( err,cmItem.UpdateL() ); - // Leave if the update of the parameters fails - if(err!=KErrNone) - { - User::Leave(err); - } - } - - if( iLogicalProxy ) - { - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: logicalproxy" ) ); - // CMManager - iLogicalProxy->AddDataL( cmItem ); - TRAP( err,cmItem.UpdateL() ); - // Leave if the update of the parameters fails - if(err!=KErrNone) - { - User::Leave(err); - } - } - - if( iPhysicalProxy ) - { - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: physicalproxy" ) ); - // CMManager - iPhysicalProxy->AddDataL( cmItem ); - TRAP( err,cmItem.UpdateL() ); - // Leave if the update of the parameters fails - if(err!=KErrNone) - { - User::Leave(err); - } - } - - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: cmItem.UpdateL" ) ); - - // CMManager - iUid = cmItem.GetIntAttributeL( CMManager::ECmWapId ); - - TInt test( KErrNone ); - // Update parameter data to CM - TRAP( test,cmItem.UpdateL() ); - FTRACE(RDebug::Print(_L("[AccessPointAdapter] CWPAPAccesspointItem::StoreL: UpdateL err: %d"), test )); - - TUint32 cmId = cmItem.GetIntAttributeL( CMManager::ECmId ); - cmItem.Close(); - - if( iNapdef ) - { - iNapdef->UpdateLingerL(iUid()); - } - - - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: SaveWlanDataL" ) ); - if( iNapdef ) - { - // Give CMManager pointer and save WLAN data - static_cast(iNapdef)->SetCMManager( iCmManager ); - iNapdef->SaveWlanDataL( cmId, aCommsDb ); - } - - - TInt i( 0 ); - TPtrC8 data( iCharacteristic.Data(i) ); - while( data != KNullDesC8 ) - { - i++; - data.Set( iCharacteristic.Data(i) ); - } - - iCharacteristic.SetDataL( iUid, i ); - - FLOG( _L( "[AccessPointAdapter] CWPAPAccesspointItem::StoreL: done" ) ); - return iUid(); - } - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::Uid -// ----------------------------------------------------------------------------- -// -const TDesC8& CWPAPAccesspointItem::Uid() const - { - return iUid; - } - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::DeleteUidData -// ----------------------------------------------------------------------------- -// -void CWPAPAccesspointItem::DeleteUidData() const - { - iCharacteristic.DeleteAllData(); - } - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::CWPAPAccesspointItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPAPAccesspointItem::CWPAPAccesspointItem( const TDesC& aDefaultName, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy, - CWPAPItemBase* aNapdef, - CWPCharacteristic& aCharacteristic ) - : iDefaultName( aDefaultName ), - iNapdef( aNapdef ), - iPhysicalProxy( aPhysicalProxy ), - iLogicalProxy( aLogicalProxy ), - iCharacteristic( aCharacteristic ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPAccesspointItem::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPAPAccesspointItem::ConstructL() - { - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAdapter.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPAdapter.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,452 +0,0 @@ -/* -* Copyright (c) 2002 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: Main class for handling provisioning accesspoint data -* -*/ - - - -// INCLUDE FILES - -#include "CWPAPAdapter.h" // Own header - -#include -#include -#include -#include // Feature manager -#include "WPAPUtil.h" -#include "CWPAPAccesspointItem.h" -#include "CWPAPNapdef.h" -#include "CWPAPLogicalProxy.h" -#include "WPAPAdapter.pan" -#include "CWPLog.h" -#include "ProvisioningDebug.h" -#include "WPAPDefs.h" -#include -#include -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::CWPAPAdapter -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPAPAdapter::CWPAPAdapter() : CWPAdapter(), - iLinks( KInitialArraySize ), - iDataItems( KInitialArraySize ), - iSaveItems( KInitialArraySize ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPAPAdapter::ConstructL() - { - FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::ConstructL:" ) ); - - iTitle = WPAPUtil::ReadHBufCL( R_QTN_SM_WML_ACCESSPOINTS ); - iDefaultName = WPAPUtil::ReadHBufCL( R_QTN_SM_WAPAP_NAME ); - - FeatureManager::InitializeLibL(); - - iCmManager = new RCmManagerExt; - iCmManager->OpenL(); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPAPAdapter* CWPAPAdapter::NewL() - { - CWPAPAdapter* self = new(ELeave) CWPAPAdapter; - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPAPAdapter::~CWPAPAdapter() - { - // Contents of iLinks array are not owned - iLinks.Close(); - - iDataItems.ResetAndDestroy(); - iDataItems.Close(); - - iSaveItems.ResetAndDestroy(); - iSaveItems.Close(); - iAPValue.Reset(); - - delete iTitle; - delete iDefaultName; - delete iCommsDb; - - if ( iCmManager != NULL ) - { - iCmManager->Close(); - delete iCmManager; - } - - FeatureManager::UnInitializeLib(); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::ItemCount -// ----------------------------------------------------------------------------- -// -TInt CWPAPAdapter::ItemCount() const - { - LOG1("Number of Access points: %d", iSaveItems.Count() ); - return iSaveItems.Count(); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::SummaryTitle -// ----------------------------------------------------------------------------- -// -const TDesC16& CWPAPAdapter::SummaryTitle(TInt aIndex) const - { - __ASSERT_DEBUG( aIndex >= 0 && aIndex < iSaveItems.Count(), - Panic( EIndexOutOfBounds )); - // The title is always the same. - return *iTitle; - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::SummaryText -// ----------------------------------------------------------------------------- -// -const TDesC16& CWPAPAdapter::SummaryText(TInt aIndex) const - { - __ASSERT_DEBUG( aIndex >= 0 && aIndex < iSaveItems.Count(), - Panic( EIndexOutOfBounds )); - return iSaveItems[ aIndex ]->Name(); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::DetailsL -// ----------------------------------------------------------------------------- -// -TInt CWPAPAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/) - { - // Detail view is a feature for later release. - return KErrNotSupported; - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::SaveL -// ----------------------------------------------------------------------------- -// -void CWPAPAdapter::SaveL( TInt aItem ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::SaveL:" ) ); - - __ASSERT_DEBUG(aItem >= 0 && - aItem < iSaveItems.Count(), - Panic( EPreConditionFail )); - - TBool internetparmfound = EFalse; - TInt err1; - - for (TInt i = 0; i < iAPValue.Count(); i++) - { - if (aItem == iAPValue[i]) - { - internetparmfound = ETrue; - break; - } - - } - - // Create the commsdb when the save is initiated first time. - // This stays alive until the adapter is destroyed. - if ( !iCommsDb ) - { - iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); - } - - if( iAlreadySavedOnce && aItem == 0 ) - { - for( TInt i( 0 ); i < iSaveItems.Count(); i++ ) - { - iSaveItems[i]->DeleteUidData(); - } - } - - // ********************************************************************************** // - // ***** check that the napdefs with a certain id are only saved once SKSS-79REKH *** // - // ********************************************************************************** // - TBool found = EFalse; - if (iSaveItems[ aItem ]->Characteristic() == KWPNapDef) - { - - // Get the napdef pointer from the saved items and check that it is not NULL - CWPAPNapdef* napdef = static_cast(iSaveItems[ aItem ]->NapDef()); - - if ( napdef ) - { - // Store the id of the NAP that is being saved now - TBufC napId = napdef->NapId(); - - // check whether napdef with same id has been already saved. - for ( TInt j( 0 ); j < aItem; j++ ) - { - // If a napdef is not in question we can move to the next item - if ( iSaveItems[ j ]->Characteristic() != KWPNapDef) - { - continue; - } - - // Store the pointer to to comparison napdef and make the nap id check if - // the pointer is other than NULL - CWPAPNapdef* tmpNap = static_cast(iSaveItems[ j ]->NapDef()); - - if ( tmpNap != NULL ) - { - // If the id was found, the napdef with this id is already stored - if ( tmpNap->NapId() == napId ) - { - found = ETrue; - break; - } - } - } - } - } - - // if access point is not already stored, then we store it - if ( !found ) - { - TUint32 iap = 0; - if (internetparmfound) - { - // Give pointer to cm manager to access point item - iSaveItems[ aItem ]->SetCMManager(iCmManager); - TRAPD(err,iap = iSaveItems[ aItem ]->SaveL( *iCommsDb)); - if(err!=KErrNone) - { - User::LeaveIfError(err); - } - - TRAP(err1, WPAdapterUtil::SetAPDetailsL(iap)); - if (err1 == KErrNone) - { - iAlreadySavedOnce = ETrue; - } - } - - if (!internetparmfound || (internetparmfound && err1 != KErrNone)) - { - // Give pointer to cm manager to access point item - iSaveItems[ aItem ]->SetCMManager(iCmManager); - TRAPD(err,iap = iSaveItems[ aItem ]->SaveL( *iCommsDb)); - if(err!=KErrNone) - { - User::LeaveIfError(err); - } - iAlreadySavedOnce = ETrue; - } - } - FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::SaveL: done" ) ); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::CanSetAsDefault -// ----------------------------------------------------------------------------- -// -TBool CWPAPAdapter::CanSetAsDefault( TInt /*aItem*/ ) const - { - return EFalse; - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::SetAsDefault -// ----------------------------------------------------------------------------- -// -void CWPAPAdapter::SetAsDefaultL( TInt /*aItem*/ ) - { - // This shouldn't be called because CanSetAsDefault - // always returns EFalse. - Panic( EPreConditionFail ); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPAdapter::VisitL( CWPCharacteristic& aCharacteristic ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL:" ) ); - - TInt type = aCharacteristic.Type(); - - if ( type == KWPApplication ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL: KWPApplication" ) ); - aCharacteristic.AcceptL( *this ); - } - // Check every NAPDEF characteristic. If it contains INTERNET - // parameter then new access point is created from NAPDEF data. - else if ( type == KWPNapDef && !IsAlreadyLinked( aCharacteristic ) ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL: KWPNapDef" ) ); - CWPAPNapdef* item = CWPAPNapdef::NewLC( EFalse, - *iDefaultName, - aCharacteristic, - aCharacteristic ); - if( item->AddItemsL( iSaveItems, NULL, NULL ) > 0 ) - { - User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) ); - } - User::LeaveIfError( iDataItems.Append( item ) ); - - - TInt val = item->GetInternetIndicator(); - if (val != -1) - { - iAPValue.Append(val); - } - CleanupStack::Pop( item ); - } - FLOG( _L( "[AccesspointAdapter] CWPAPAdapter::VisitL:done" ) ); - - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPAdapter::VisitL( CWPParameter& /*aParameter*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::VisitLinkL -// ----------------------------------------------------------------------------- -// -void CWPAPAdapter::VisitLinkL( CWPCharacteristic& aCharacteristic ) - { - if( !IsAlreadyLinked( aCharacteristic ) ) - { - switch( aCharacteristic.Type() ) - { - // This is link in APPLICATION characteristic to certain NAPDEF or LOGICAL proxy - case KWPPxLogical: - { - CWPAPLogicalProxy* item = CWPAPLogicalProxy::NewLC( - *iDefaultName, aCharacteristic ); - item->AddItemsL( iSaveItems, NULL, NULL ); - User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) ); - User::LeaveIfError( iDataItems.Append( item ) ); - CleanupStack::Pop( item ); - break; - } - case KWPNapDef: - { - CWPAPNapdef* item = CWPAPNapdef::NewLC( ETrue, - *iDefaultName, - aCharacteristic, - aCharacteristic ); - item->AddItemsL( iSaveItems, NULL, NULL ); - User::LeaveIfError( iLinks.InsertInAddressOrder( &aCharacteristic ) ); - User::LeaveIfError( iDataItems.Append( item ) ); - CleanupStack::Pop( item ); - break; - } - } - } - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::ContextExtension -// ----------------------------------------------------------------------------- -// -TInt CWPAPAdapter::ContextExtension( MWPContextExtension*& aContextExtension ) - { - aContextExtension = this; - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::SaveDataL -// ----------------------------------------------------------------------------- -// -const TDesC8& CWPAPAdapter::SaveDataL( TInt aIndex ) const - { - return iSaveItems[ aIndex ]->Uid(); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::DeleteL -// ----------------------------------------------------------------------------- -// -void CWPAPAdapter::DeleteL( const TDesC8& aSaveData ) - { - if ( !iCommsDb ) - { - iCommsDb = CCommsDatabase::NewL( EDatabaseTypeIAP ); - } - - TPckgBuf uid; - if( aSaveData.Length() == uid.MaxLength() ) - { - LOG1( "DeleteL: Deleting %08x", uid() ); - uid.Copy( aSaveData ); - - // CMManager - TRAPD( err, iCmManager->ConnectionMethodL( uid()).DeleteL() ); - - LOG1( "DeleteL: Result: %d", err ); - if( err == KErrLocked ) - { - User::Leave( EWPCommsDBLocked ); - } - else if ( err != KErrNone && err != KErrNotFound ) - { - User::Leave( err ); - } - } - - //CleanupStack::PopAndDestroy( dataHandler ); - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::Uid -// ----------------------------------------------------------------------------- -// -TUint32 CWPAPAdapter::Uid() const - { - return iDtor_ID_Key.iUid; - } - -// ----------------------------------------------------------------------------- -// CWPAPAdapter::IsAlreadyLinked -// ----------------------------------------------------------------------------- -// -TBool CWPAPAdapter::IsAlreadyLinked( CWPCharacteristic& aCharacteristic ) - { - return iLinks.FindInAddressOrder( &aCharacteristic ) >= 0; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPAPItemBase.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPItemBase.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a base class for all the items in WPAPAdapter -* -*/ - - - - - -// INCLUDE FILES - -#include "CWPAPItemBase.h" -#include "WPAPAdapter.pan" - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPAPItemBase::~CWPAPItemBase() - { - } - -// ----------------------------------------------------------------------------- -// C++ constructor -// ----------------------------------------------------------------------------- -CWPAPItemBase::CWPAPItemBase( const TDesC& aDefaultName ) - : iDefaultName( aDefaultName ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPItemBase::MarkReceived -// ----------------------------------------------------------------------------- -// -void CWPAPItemBase::MarkReceived( TMarkedField aField ) - { - iReceivedFieldsFlags |= aField; - } - -// ----------------------------------------------------------------------------- -// CWPAPItemBase::IsReceived -// ----------------------------------------------------------------------------- -// -TBool CWPAPItemBase::IsReceived( TMarkedField aField ) - { - return ( iReceivedFieldsFlags & aField ); - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPAPLogicalProxy.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPLogicalProxy.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,269 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a class, which holds logical proxy information. -* -*/ - - - - - -// INCLUDE FILES - -#include "CWPAPLogicalProxy.h" -#include -#include -#include -#include "CWPLog.h" -#include "CWPAPPhysicalProxy.h" -#include "CWPAPPort.h" -#include "WPAPAdapter.pan" -#include "WPAPDefs.h" -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPAPLogicalProxy* CWPAPLogicalProxy::NewLC( - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic ) - { - CWPAPLogicalProxy* self = new(ELeave) CWPAPLogicalProxy( aCharacteristic, - aDefaultName ); - CleanupStack::PushL( self ); - self->ConstructL(); - aCharacteristic.AcceptL( *self ); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CWPAPLogicalProxy::~CWPAPLogicalProxy() - { - delete iPort; - iPhysicalProxies.ResetAndDestroy(); - iPhysicalProxies.Close(); - } - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::ValidateL -// ----------------------------------------------------------------------------- -// -TBool CWPAPLogicalProxy::ValidateL() - { - // Logical proxy is valid if it contains either one or more - // physical proxies - return iPhysicalProxies.Count() > 0; - } - - - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::AddDataL -// ----------------------------------------------------------------------------- -// -void CWPAPLogicalProxy::AddDataL( RCmConnectionMethodExt& aCmItem ) - { - LOG("--CWPAP CWPAPLogicalProxy::AddDataL begin--"); - // This method is called by child physical proxy. - - // Store name if came along with the document. If missing then access point - // name is used. - if ( iName ) - { - // CMManager - aCmItem.SetStringAttributeL( CMManager::ECmName, iName->Value() ); - } - - // Store homepage if defined. - if ( iHomepage ) - { - // CMManager - TRAPD( err, aCmItem.SetStringAttributeL( CMManager::ECmStartPage, iHomepage->Value() )); - - LOG2("CWPAP EApWapStartPage, value: %S, err: %d", &iHomepage->Value(), err); - User::LeaveIfError( err ); - } - - // Store port data, which overrides the data stored by child physical proxy. - - if ( iPort ) - { - //CMManager - iPort->AddDataL (aCmItem); - - } - LOG("--CWPAP CWPAPLogicalProxy::AddDataL end--"); - } - - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::AddItemsL -// ----------------------------------------------------------------------------- -// -TInt CWPAPLogicalProxy::AddItemsL( RPointerArray& aItems, - CWPAPItemBase* /*aLogicalProxy*/, - CWPAPItemBase* /*aPhysicalProxy*/ ) - { - TInt count( 0 ); - for( TInt i( 0 ); i < iPhysicalProxies.Count(); i++ ) - { - CWPAPPhysicalProxy* pp = iPhysicalProxies[ i ]; - if( pp->ValidateL() ) - { - count += pp->AddItemsL( aItems, this, NULL ); - } - } - - return count; - } - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::Name -// ----------------------------------------------------------------------------- -// -const TDesC& CWPAPLogicalProxy::Name() - { - if ( iName ) - { - return iName->Value(); - } - else - { - return KNullDesC; - } - } - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPLogicalProxy::VisitL( CWPCharacteristic& aCharacteristic ) - { - TInt type = aCharacteristic.Type(); - - // KWPPort - - // One valid port is enough for us. - if ( type == KWPPort && !iPort ) - { - CWPAPPort* port = CWPAPPort::NewLC( aCharacteristic ); - - if ( port->ValidateL() ) - { - iPort = port; - CleanupStack::Pop( port ); - } - else // Data not valid. - { - CleanupStack::PopAndDestroy( port ); - } - } - - // KWPPxPhysical - - else if ( type == KWPPxPhysical ) - { - CWPAPPhysicalProxy* physicalProxy = CWPAPPhysicalProxy::NewLC( - iDefaultName, - aCharacteristic, - iCharacteristic, - iPort ); - - if ( physicalProxy->ValidateL() ) - { - User::LeaveIfError( iPhysicalProxies.Append( physicalProxy ) ); - CleanupStack::Pop( physicalProxy ); - } - else // Data not valid. - { - CleanupStack::PopAndDestroy( physicalProxy ); - } - } - else if ( type == KWPPxAuthInfo ) - { - // Not supported - } - } - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPLogicalProxy::VisitL( CWPParameter& aParameter) - { - TInt id = aParameter.ID(); - const TDesC& value = aParameter.Value(); - - if ( value.Length() == 0 ) - { - // No use process zero length value. - return; - } - - switch ( id ) - { - case EWPParameterStartPage: // iHomepage - { - if ( !iHomepage ) - { - iHomepage = &aParameter; - } - break; - } - case EWPParameterName: - { - if ( !iName ) - { - iName = &aParameter; - } - break; - } - default: - { - // Just let through - } - } - } - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::CWPAPLogicalProxy -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPAPLogicalProxy::CWPAPLogicalProxy( CWPCharacteristic& aCharacteristic, - const TDesC& aDefaultName ) - : CWPAPItemBase( aDefaultName ), - iPhysicalProxies( KInitialArraySize ), - iCharacteristic( aCharacteristic ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPLogicalProxy::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPAPLogicalProxy::ConstructL() - { - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPAPNapdef.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPNapdef.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2039 +0,0 @@ -/* -* Copyright (c) 2002-2008 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 stores data for one accesspoint -* -*/ - - - - -// INCLUDE FILES - -#include "CWPAPNapdef.h" -#include -#include -#include -#include -#include -#include "CWPAPAccesspointItem.h" -#include "WPAPAdapter.pan" -#include -#include -#include -#include "ProvisioningDebug.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -const TUint KIapColumn = 0x00000100; -const TUint KLingerColumn = 0x00000200; -const TUint KColumnMask = 0xFFFFFF00; -const TUint KRowMask = 0x000000FF; - -// Delay for comms db begintransaction retry (microseconds) -const TInt KBeginTransRetryDelay = 1000000; -// Maximum number of retries -const TInt KBeginTransRetryCount = 7; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::NewLC -// ----------------------------------------------------------------------------- -// -CWPAPNapdef* CWPAPNapdef::NewLC( TBool aFollowingLink, - const TDesC& aDefaultName, - CWPCharacteristic& aLogicalCharacteristic, - CWPCharacteristic& aLink ) - { - CWPAPNapdef* self = new(ELeave) CWPAPNapdef( aFollowingLink, - aDefaultName, - aLogicalCharacteristic ); - CleanupStack::PushL( self ); - self->ConstructL(); - aLink.AcceptL( *self ); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -CWPAPNapdef::~CWPAPNapdef() - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::~CWPAPNapdef" ) ); - - iEapTypeArray.ResetAndDestroy(); - iEapTypeArray.Close(); - iSecSSID.ResetAndDestroy(); - iSecSSID.Close(); - iNameServers.Close(); - - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::ValidateL -// ----------------------------------------------------------------------------- -// -TBool CWPAPNapdef::ValidateL() - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL" ) ); - - TBool result( ETrue ); - - if ( iBearer == KUidWlanBearerType ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan" ) ); - if ( iWlanSupported ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan supported" ) ); - return result; - } - else - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ValidateL wlan NOT supported" ) ); - return EFalse; - } - } - - // Received unsupported bearer - if( iBearerUnsupported ) - { - return EFalse; - } - - // Didn't receive a bearer value. - if ( iBearer == 0 ) - { - // Access point address type can also tell the bearer - if( iAccesspointNameType ) - { - TPtrC addrType( iAccesspointNameType->Value() ); - if( addrType == KAddrTypeAPN ) - { - iBearer =KUidPacketDataBearerType; - } - } - - // If still couldn't determine the bearer, default to GPRS - if( iBearer == 0 ) - { - iBearer = KUidPacketDataBearerType; - } - } - - // "NAP-ADDRESS" (Access point name) must be defined - if( iAccesspointName ) - { - if( iAccesspointName->Value() == KNullDesC ) - { - return EFalse; - } - } - else - { - return EFalse; - } - - /* - Combinations of authentication type, username and password and corressponding - value of prompt for password field. AuthType in this table means that provisioning document - contained authtype parameter and it was supported by the implementation. - Provisioning document names are used in table. - x means that value of the specified parameter is received and it was valid. - AuthType received & supported - | AuthName - | | AuthSecret - | | | "Prompt for Password" - no - x no - x no - x x yes - x no - x x yes - x x no - x x x no - */ - - // Set the "prompt password"-value. See the table above. Value is set to true - // only if we have supported authentication type and either username or password - // is empty. - if ( IsReceived( EWPParameterAuthentication_id ) && - ( ( !iPassword && iUserName ) ||( iPassword && !iUserName ) ) ) - { - iPromptPassword = ETrue; - } - - // IFNETWORKS is a list of possible protocols that a GPRS access points can be - // used for. - if( iBearer == KUidPacketDataBearerType && IsReceived( EWPParameterIfNetworks_id ) ) - { - TLex lex( iIfNetworks->Value() ); - lex.Mark(); - do - { - TChar ch( lex.Get() ); - - if( ( !iPdpType && !ch.IsAlphaDigit() ) || ( !iPdpType && lex.Eos() ) ) - { - if(!lex.Eos()) - { - lex.UnGet(); - } - TPtrC value( lex.MarkedToken() ); - if( !lex.Eos() ) - { - lex.Inc(); - } - - if( value == KIPv6 - && FeatureManager::FeatureSupported( KFeatureIdIPv6 ) ) - { - //iPdpType = EIPv6; - // CMManager - iPdpType = RPacketContext::EPdpTypeIPv6; - result = ETrue; - } - else if( value == KIPv6 - && !FeatureManager::FeatureSupported( KFeatureIdIPv6 ) ) - { - result = EFalse; - } - else if( value == KIPv4 ) - { - //iPdpType = EIPv4; - // CMManager - iPdpType = RPacketContext::EPdpTypeIPv4; - result = ETrue; - } - } - } while( !lex.Eos() ); - } - - return result; - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::AddItemsL -// ----------------------------------------------------------------------------- -// -TInt CWPAPNapdef::AddItemsL( RPointerArray& aItems, - CWPAPItemBase* aLogicalProxy, - CWPAPItemBase* aPhysicalProxy ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL" ) ); - - TInt count( 0 ); - - if( ( iFollowingLink || IsReceived( EWPParameterInternet_id ) - || IsReceived( EWPParameterWlan_id ) ) - && ValidateL() ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL append" ) ); - CWPAPAccesspointItem* item = CWPAPAccesspointItem::NewLC( - iDefaultName, - aLogicalProxy, - aPhysicalProxy, - this, - iCharacteristic ); - User::LeaveIfError( aItems.Append( item ) ); - //Internet Parameter is received - if (IsReceived(EWPParameterInternet_id) && !iFollowingLink) - { - SetInternetIndicator(aItems.Count() - 1); - } - - - count++; - CleanupStack::Pop( item ); - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddItemsL append done" ) ); - } - return count; - } - - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::SetInternetIndicator -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::SetInternetIndicator(TInt aValue) - { - iInternetIndicator = aValue; - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::GetInternetIndicator -// ----------------------------------------------------------------------------- -// -TInt CWPAPNapdef::GetInternetIndicator() - { - return iInternetIndicator; - } - - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::AddDataL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::AddDataL( /*CApAccessPointItem& aAPItem*/ RCmConnectionMethodExt& aCmItem ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL" ) ); - - TInt err( KErrNone ); - - if ( iBearer == KUidWlanBearerType ) - { - if ( iWlanSupported ) - { - // CMManager - AddWlanDataL( aCmItem); - } - else - { - // WLAN is disabled (or does not exist) in the device. - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL WLAN disabled." ) ); - User::Leave( KErrNotSupported ); - } - } - else - { - if ( iConnectionName ) - { - // CMManager - aCmItem.SetStringAttributeL( CMManager::ECmName, (iConnectionName->Value().Left( KNameMaxLength ))); - } - else // Use default name - { - // CMManager - aCmItem.SetStringAttributeL( CMManager::ECmName, iDefaultName ); - } - - if ( iAccesspointName ) - { - if ( iBearer == KUidPacketDataBearerType ) - { - // CMManager - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EPacketDataAPName, iAccesspointName->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL value: %S, err: %d"), - &iAccesspointName->Value(), err)); - } - else - { - // CMManager - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialDefaultTelNum, iAccesspointName->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::EApIspDefaultTelNumber value: %S, err: %d"), - &iAccesspointName->Value(), err ) ); - } - } - - TRAP ( err, aCmItem.UpdateL() ); - - if ( iUserName ) - { - // CMManager - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialLoginName, iUserName->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialLoginName value: %S, err: %d"), - &iUserName->Value(), err)); - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialIFAuthName, iUserName->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialIFAuthName value: %S, err: %d"), - &iUserName->Value(), err)); - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIFAuthName, iUserName->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFAuthName value: %S, err: %d"), - &iUserName->Value(), err)); - } - - // CMManager - TRAP ( err, aCmItem.SetBoolAttributeL( CMManager::ECmIFPromptForAuth, iPromptPassword)); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFPromptForAuth value: %d, err: %d"), - iPromptPassword, err )); - - if ( iPassword ) - { - // CMManager - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::EDialLoginPassword, iPassword->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EDialLoginPassword value: %d, err: %d"), - &iPassword->Value(), err ) ); - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIFAuthPass, iPassword->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL ECmIFAuthPass value: %d, err: %d"), - &iPassword->Value(), err ) ); - } - - // CMManager - TRAP ( err, aCmItem.SetBoolAttributeL( CMManager::ECmDisablePlainTextAuth, iSecureAuthentication )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EApEApIspDisablePlainTextAuth value: %d, err: %d"), - iSecureAuthentication, err ) ); - - - // IPv6 APs always have dynamic phone address - //CMManager - if ( iPhoneIPAddress && iPdpType != RPacketContext::EPdpTypeIPv6 ) - { - // CMManager IS CORRECT? - //err = aAPItem.WriteTextL( EApIspIPAddr, iPhoneIPAddress->Value() ); - TRAP ( err, aCmItem.SetStringAttributeL( CMManager::ECmIPAddress, iPhoneIPAddress->Value() )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddDataL EApIspIPAddr value: %S, err: %d"), - &iPhoneIPAddress->Value(), err ) ); - } - - TRAP ( err, aCmItem.UpdateL() ); - for( TInt i( 0 ); i < iNameServers.Count(); i++ ) - { - WriteDNSAddressL( aCmItem, iNameServers[i]->Value() ); - } - TRAP ( err, aCmItem.UpdateL() ); - if( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) - && iPdpType ) - { - // CMManager - TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EPacketDataPDPType, iPdpType )); - } - - if ( err ) err = 0; // prevent compiler warning - } - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddDataL" ) ); - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::AddWlanDataL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::AddWlanDataL( RCmConnectionMethodExt& aCmItem ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL" ) ); - - if ( !iWlanSupported ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL WLAN NOT supported." ) ); - User::Leave( KErrNotSupported); - } - - TInt err = KErrNone; - - if ( iConnectionName ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName" ) ); - - //Connection name - // CMManager - aCmItem.SetStringAttributeL( CMManager::ECmName, iConnectionName->Value().Left( KNameMaxLength ) ); - - // CMManager - // Network name - aCmItem.SetStringAttributeL( CMManager::EWlanSSID, iConnectionName->Value()); - - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName err (%d) (%S)"), err, &iConnectionName->Value())); - - } - else // Use default name - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL iConnectionName default" ) ); - aCmItem.SetStringAttributeL( CMManager::EWlanSSID, iDefaultName); - } - - //EApWlanNetworkMode Gives network mode, TUint32 - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanNetworkMode" ) ); - // CMManager - TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EWlanConnectionMode, iNetMode )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanNetworkMode err (%d)"), err)); - - //EApWlanSecurityMode The security mode, TUint32 - if ( iSecMode == 0 ) - { - // This is needed if Provisioning message does not contain SECMODE parameter - // AP does not work if secmode is not set - iSecMode = CMManager::EWlanSecModeOpen; - } - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanSecurityMode" ) ); - // CMManager, securitymode causes error -1, this will be set manually in SaveWlanData - //TRAP ( err, aCmItem.SetIntAttributeL( CMManager::EWlanSecurityMode, iSecMode )); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::AddWlanDataL EApWlanSecurityMode err (%d)"), err)); - - if (err) - { - err = KErrNone; - } - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::WriteDNSAddressL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::WriteDNSAddressL( /*CApAccessPointItem& aAPItem*/ RCmConnectionMethodExt& aCmItem, - const TDesC& aValue ) - { - // GPRS access points supports IPv6 only if explicitly stated. - // CMManager - TBool apSupportsIPv6( iPdpType == RPacketContext::EPdpTypeIPv6 | iBearer != KUidPacketDataBearerType ); - - // If IPv6 is supported, write the DNS address as IPv6 if - // bearer supports IPv6 and the address format is IPv6 - if( FeatureManager::FeatureSupported( KFeatureIdIPv6 ) - && apSupportsIPv6 - && WPAdapterUtil::CheckIPv6( aValue ) ) - { - // Two name servers per network type - if( iNumIPv6NameServers < KTwoNameServersPerNetworkType ) - { - // CMManager - TRAPD (err, aCmItem.SetStringAttributeL( CMManager::TConnectionMethodCommonAttributes( - ( CMManager::ECmIP6NameServer1 ) + iNumIPv6NameServers ), aValue ) ); - User::LeaveIfError( err ); - iNumIPv6NameServers++; - } - } - else if( CheckIPv4values( aValue) ) - { - // Two name servers per network type - if( iNumIPv4NameServers < KTwoNameServersPerNetworkType ) - { - // CMManager - TRAPD ( err, aCmItem.SetStringAttributeL( CMManager::TConnectionMethodCommonAttributes( - ( CMManager::ECmIPNameServer1 ) + iNumIPv4NameServers ), aValue ) ); - User::LeaveIfError( err ); - aCmItem.SetBoolAttributeL( CMManager::ECmIPDNSAddrFromServer, EFalse); - iNumIPv4NameServers++; - } - } - } -// ----------------------------------------------------------------------------- -// CWPAPNapdef::CheckAddressPart -// ----------------------------------------------------------------------------- -// - -TBool CWPAPNapdef:: CheckAddressPart( TLex& aLex ) - { - TBool result( aLex.Peek().IsDigit() ); - aLex.Inc(); - if( aLex.Peek().IsDigit() ) - { - aLex.Inc(); - if( aLex.Peek().IsDigit() ) - { - aLex.Inc(); - } - } - - return result; - } - - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::CheckIPv4values -// ----------------------------------------------------------------------------- -// - -TBool CWPAPNapdef::CheckIPv4values( const TDesC& aValue ) -{ - - TLex aLex( aValue ); - return CheckAddressPart( aLex ) - && aLex.Get() == '.' - && CheckAddressPart( aLex ) - && aLex.Get() == '.' - && CheckAddressPart( aLex ) - && aLex.Get() == '.' - && CheckAddressPart( aLex ) - && aLex.Get() == '\0'; - -} -// ----------------------------------------------------------------------------- -// CWPAPNapdef::Name -// ----------------------------------------------------------------------------- -// -const TDesC& CWPAPNapdef::Name() - { - if ( iConnectionName ) - { - return iConnectionName->Value(); - } - else - { - return KNullDesC; - } - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::VisitL( CWPCharacteristic& aCharacteristic ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic)" ) ); - - TInt type = aCharacteristic.Type(); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) type (%d)"), type)); - switch ( type ) - { - case KWPNapAuthInfo: - case KWPValidity: - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) normal" ) ); - aCharacteristic.AcceptL( *this ); - break; - } - case KWPWLAN: - case KWPWepKey: - { - if( iWlanSupported ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) accept WLAN characteristic" ) ); - aCharacteristic.AcceptL( *this ); - } - } - default: - { - if ( ( ( ( aCharacteristic.Name().Compare( KWLAN ) ) == 0 ) || - ( ( aCharacteristic.Name().Compare( SECSSID ) ) == 0 ) || - ( ( aCharacteristic.Name().Compare( KEAP ) ) == 0 ) || - ( ( aCharacteristic.Name().Compare( KCERT ) ) == 0 ) || - ( ( aCharacteristic.Name().Compare( KWEP ) ) == 0 ) ) && iWlanSupported ) - { - if(aCharacteristic.Name().Compare( KEAP ) == 0) - { - CEapTypeElement* newEap = new (ELeave) CEapTypeElement; - newEap->iEAPSettings = new (ELeave) EAPSettings; - newEap->iCertificate = new (ELeave) EapCertificateEntry; - iEapTypeArray.AppendL(newEap); - } - else if(aCharacteristic.Name().Compare( SECSSID ) == 0) - { - SECssID* newsecSSID = new (ELeave) SECssID; - newsecSSID->iSSSID = NULL; - newsecSSID->iSUSSID = NULL; - iSecSSID.AppendL(newsecSSID); - } - - aCharacteristic.AcceptL( *this ); - } - } - } - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::VisitL(CWPCharacteristic) done" ) ); - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::VisitL( CWPParameter& aParameter ) - { - TInt id = aParameter.ID(); - TPtrC value( aParameter.Value() ); - - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::VisitL(CWPParameter) id: %d value: %S"), id, &value)); - - switch ( id ) - { - case EWPParameterName: - { - if ( !iConnectionName ) - { - iConnectionName = &aParameter; - } - break; - } - case EWPParameterBearer: - { - if ( iBearer != 0 || iBearerUnsupported ) - { - break; // Already received a bearer information - } - - if ( value == KGSMGPRS ) - { - iBearer = KUidPacketDataBearerType; - } - else if ( value == KWLAN && iWlanSupported ) - { - iBearer = KUidWlanBearerType; - MarkReceived( EWPParameterWlan_id ); - } - else - { - // Unsupported bearer type - iBearerUnsupported = ETrue; - } - break; - } - case EWPParameterNapAddress: - { - if ( !iAccesspointName ) - { - iAccesspointName = &aParameter; - } - break; - } - case EWPParameterLinger: - { - iLinger = &aParameter; - UdateligerValueL( iLinger ); - break; - } - case EWPParameterNapAddrType: - { - if ( !iAccesspointNameType ) - { - iAccesspointNameType = &aParameter; - } - break; - } - case EWPParameterAuthName: - { - if ( !iUserName ) - { - iUserName = &aParameter; - } - break; - } - case EWPParameterAuthSecret: - { - if ( !iPassword ) - { - iPassword = &aParameter; - } - break; - } - case EWPParameterAuthType: - { - // If already received don't accept - if (IsReceived(EWPParameterAuthentication_id)) - { - break; - } - - if ( value == KCHAP || value == KMD5 ) - { - iSecureAuthentication = ETrue; - MarkReceived( EWPParameterAuthentication_id ); - } - else if ( value == KPAP ) - { - iSecureAuthentication = EFalse; - MarkReceived( EWPParameterAuthentication_id ); - } - else - { - // Not supported... - } - break; - } - case EWPParameterLocalAddr: // iPhoneIPAddress - { - if ( !iPhoneIPAddress ) - { - iPhoneIPAddress = &aParameter; - } - break; - } - case EWPParameterDNSAddr: - { - // All name servers must be stored, as some of them might - // be IPv6 and some IPv4 - User::LeaveIfError( iNameServers.Append( &aParameter ) ); - break; - } - case EWPParameterIfNetworks: - { - if( !iIfNetworks ) - { - iIfNetworks = &aParameter; - MarkReceived( EWPParameterIfNetworks_id ); - } - break; - } - case EWPParameterInternet: - { - MarkReceived( EWPParameterInternet_id ); - break; - } -//JMan for WLan - case EWPParameterNapID: - { - if ( !iNapID ) - { - iNapID = &aParameter; - } - break; - } - // Here case 0 are handled the WLAN parameters that are extensions - // to OMA Client Provisioning parameter set. - case 0: - { - if( iWlanSupported ) - { - HandleWLanParametersL( aParameter ); - } - break; - } -//JMan for WLan ends - default: - { - } - } - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::HandleWLanParametersL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::HandleWLanParametersL( CWPParameter& aParameter ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL" ) ); - - if( !iWlanSupported ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WLAN not supported." ) ); - User::Leave( KErrNotSupported ); - } - - SECssID* scssid = NULL; - if( iSecSSID.Count() ) - { - scssid = iSecSSID[iSecSSID.Count()-1]; - } - - TPtrC value( aParameter.Value() ); - if( ( aParameter.Name().Compare( PRISSID ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriSSID" ) ); - if ( !iPriSSID ) - { - iPriSSID = &aParameter; - } - } - else if( ( aParameter.Name().Compare( PRIUSSID ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriUSSID" ) ); - if ( !iPriUSSID ) - { - iPriUSSID = &aParameter; - } - }// else if - - else if( ( aParameter.Name().Compare( PRIHSSID ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) ); - if ( !iPriHSSID ) - { - iPriHSSID = &aParameter; - } - }// else if - - else if( ( aParameter.Name().Compare( SSSID ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) ); - if(scssid!=NULL) - { - scssid->iSSSID = &aParameter; - } - - - }// else if - - else if( ( aParameter.Name().Compare( SUSSID ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL iPriHSSID" ) ); - if(scssid!=NULL) - { - scssid->iSUSSID = &aParameter; - } - }// else if - - else if( ( aParameter.Name().Compare( NETMODE ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode" ) ); - if ( value == KADHOC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode adhoc" ) ); - iNetMode = CMManager::EAdhoc; - } - else // default is INFRA - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL netmode infra" ) ); - iNetMode =CMManager::EInfra; - } - } - - else if( ( aParameter.Name().Compare( SECMODE ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode" ) ); - if ( value == KWEPSEC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWEPSEC" ) ); - iSecMode = CMManager::EWlanSecModeWep; - } - else if( value == K8021XSEC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode K8021XSEC" ) ); - iSecMode = CMManager::EWlanSecMode802_1x; - } - else if( value == KWPASEC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPASEC" ) ); - - iSecMode = CMManager::EWlanSecModeWpa; - } - else if( value == KWPA2SEC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPA2SEC" ) ); - iSecMode = CMManager::EWlanSecModeWpa2; - } - else if( value == KWPAPRESSEC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPAPRESSEC" ) ); - iSecMode = CMManager::EWlanSecModeWpa; - } - else if( value == KWPA2PRESSEC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode KWPA2PRESSEC" ) ); - iSecMode = CMManager::EWlanSecModeWpa2; - } - else - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL secmode open" ) ); - iSecMode = CMManager::EWlanSecModeOpen; - } - } - - else if( ( aParameter.Name().Compare( WPAPRESKEYASC ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WPAPRESKEYASC" ) ); - if ( !iWpaPresKeyAsc ) - { - iWpaPresKeyAsc = &aParameter; - } - }// else if - // indicates the default wepkey index - else if( ( aParameter.Name().Compare( DEFAULTWEPIND ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepind" ) ); - - TLex lex( value ); - lex.Val( iDefaultWepKeyIndex ); - if ( iDefaultWepKeyIndex >= 4 ) - { - iDefaultWepKeyIndex = 0; - } - }// else if - - else if( ( aParameter.Name().Compare( WEPAUTHMODE ) ) == 0 ) - { - if ( value == KWEPAUTHMODEOPEN ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepauthmode OPEN" ) ); - iAuthentication = EAuthOpen; - } - else if ( value == KWEPAUTHMODESHARED ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL wepauthmode SHARED" ) ); - iAuthentication = EAuthShared; - } - }// else if - - else if( ( aParameter.Name().Compare( WEPKEYLENGTH ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYLENGTH" ) ); - if ( !iWepKeyLength ) - { - iWepKeyLength = &aParameter; - } - }// else if - else if( ( aParameter.Name().Compare( WEPKEYINDEX ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYINDEX" ) ); - TLex lex( value ); - lex.Val( iWepInd ); - }// else if - else if( ( aParameter.Name().Compare( WEPKEYDATA ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL WEPKEYDATA" ) ); - - if ( iWepInd < 4 ) - { - const TUint8 K40Bits = 5; - const TUint8 K104Bits = 13; - const TUint8 K232Bits = 29; - - TBuf8 buf8; - StrCopy( buf8, aParameter.Value() ); - - if(buf8.Length() == K232Bits || - buf8.Length() == K104Bits || - buf8.Length() == K40Bits ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL ASCI Wep Key" ) ); - HBufC8* buf8Conv = HBufC8::NewLC( KMaxLengthOfKeyData ); - ConvertAsciiToHex( buf8, buf8Conv ); - iKeyData[iWepInd] = *buf8Conv; - iKeyFormat[iWepInd] = CWPAPNapdef::EAscii; - CleanupStack::PopAndDestroy( buf8Conv ); - } - else if( buf8.Length()==K232Bits*2 || - buf8.Length()== K104Bits*2 || - buf8.Length() == K40Bits*2) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL HEX Wep Key" ) ); - iKeyData[iWepInd] = buf8; - iKeyFormat[iWepInd] = CWPAPNapdef::EHexadecimal; - } - } - - }// else if - - // Handle EAP parameter - HandleEAPParametersCCL( aParameter ); - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleWLanParametersL done" ) ); - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::HandleEAPParametersL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::HandleEAPParametersCCL( CWPParameter& aParameter ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL" ) ); - - CEapTypeElement* eap = NULL; - if ( iEapTypeArray.Count() ) - { - eap = iEapTypeArray[iEapTypeArray.Count()-1]; - } - if(!eap) - { - return; - } - - TPtrC value( aParameter.Value() ); - - if( ( aParameter.Name().Compare( EAPTYPE ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPTYPE" ) ); - - ConvertEAPStringToIds( value, eap->iEapTypeString, eap->iEAPSettings->iEAPExpandedType ); - - } - else if( ( aParameter.Name().Compare( EAPUSERNAME ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPUSERNAME" ) ); - if ( eap->iEAPSettings->iUsername.Length() == 0 ) - { - eap->iEAPSettings->iUsername = value; - eap->iEAPSettings->iUsernamePresent = ETrue; - eap->iEAPSettings->iUseAutomaticUsernamePresent = ETrue; - eap->iEAPSettings->iUseAutomaticUsername = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPPASSWORD ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPASSWORD" ) ); - if ( eap->iEAPSettings->iPassword.Length() == 0 ) - { - eap->iEAPSettings->iPassword = value; - eap->iEAPSettings->iPasswordPresent = ETrue; - eap->iEAPSettings-> iShowPassWordPromptPresent = ETrue; - eap->iEAPSettings-> iShowPassWordPrompt = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPREALM ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPREALM" ) ); - - if ( eap->iEAPSettings->iRealm.Length() == 0 ) - { - eap->iEAPSettings->iRealm = value; - eap->iEAPSettings->iRealmPresent = ETrue; - eap->iEAPSettings->iUseAutomaticRealmPresent = ETrue; - eap->iEAPSettings->iUseAutomaticRealm = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPUSEPSEUD ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPUSEPSEUD" ) ); - TInt pseudonyms; - TLex lex( value ); - lex.Val( pseudonyms ); - - eap->iEAPSettings->iUsePseudonymsPresent = ETrue; - if ( pseudonyms == 1 ) - { - eap->iEAPSettings->iUsePseudonyms = ETrue; - } - else - { - eap->iEAPSettings->iUsePseudonyms = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPMAXAUTHS ) ) == 0 ) - { - // not supported - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPMAXAUTHS" ) ); - }// else if - else if( ( aParameter.Name().Compare( EAPENCAPS ) ) == 0 ) - { - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPENCAPS" ) ); - - TEapExpandedType dummy; - ConvertEAPStringToIds( value, eap->iEncapsulatingExpandedEapId, dummy ); - - }// else if - else if( ( aParameter.Name().Compare( EAPVERSERREALM ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPVERSERREALM" ) ); - - TInt serverRealm; - TLex lex( value ); - lex.Val( serverRealm ); - - eap->iEAPSettings->iVerifyServerRealmPresent = ETrue; - - if ( serverRealm == 1 ) - { - eap->iEAPSettings->iVerifyServerRealm = ETrue; - } - else - { - eap->iEAPSettings->iVerifyServerRealm = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPCLIENTHAUTH ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCLIENTHAUTH" ) ); - - TInt clientAuthentication; - TLex lex( value ); - lex.Val( clientAuthentication ); - - eap->iEAPSettings->iRequireClientAuthenticationPresent = ETrue; - - if ( clientAuthentication == 1 ) - { - eap->iEAPSettings->iRequireClientAuthentication = ETrue; - } - else - { - eap->iEAPSettings->iRequireClientAuthentication = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPSESVALTIME ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSESVALTIME" ) ); - - TInt sessionValidityTime; - TLex lex( value ); - lex.Val( sessionValidityTime ); - eap->iEAPSettings->iSessionValidityTime = sessionValidityTime; - eap->iEAPSettings->iSessionValidityTimePresent = ETrue; - - }// else if - else if( ( aParameter.Name().Compare( EAPCIPSUIT ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCIPSUIT" ) ); - - TInt cipherSuites; - TLex lex( value ); - lex.Val( cipherSuites ); - eap->iEAPSettings->iCipherSuites.Append( cipherSuites ); - eap->iEAPSettings->iCipherSuitesPresent = ETrue; - - }// else if - else if( ( aParameter.Name().Compare( EAPPEAPV0 ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV0" ) ); - - TInt peap; - TLex lex( value ); - lex.Val( peap ); - - eap->iEAPSettings->iPEAPVersionsPresent = ETrue; - if ( peap == 1 ) - { - eap->iEAPSettings->iPEAPv0Allowed = ETrue; - } - else - { - eap->iEAPSettings->iPEAPv0Allowed = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPPEAPV1 ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV1" ) ); - TInt peap; - TLex lex( value ); - lex.Val( peap ); - eap->iEAPSettings->iPEAPVersionsPresent = ETrue; - if ( peap == 1 ) - { - eap->iEAPSettings->iPEAPv1Allowed = ETrue; - } - else - { - eap->iEAPSettings->iPEAPv1Allowed = EFalse; - } - }// else if - else if( ( aParameter.Name().Compare( EAPPEAPV2 ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPPEAPV2" ) ); - TInt peap; - TLex lex( value ); - lex.Val( peap ); - eap->iEAPSettings->iPEAPVersionsPresent = ETrue; - if ( peap == 1 ) - { - eap->iEAPSettings->iPEAPv2Allowed = ETrue; - } - else - { - eap->iEAPSettings->iPEAPv2Allowed = EFalse; - } - }// else if - - else if( ( aParameter.Name().Compare( EAPISSNAME ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPISSNAME" ) ); - - eap->iCertificate->SetSubjectName(value); - eap->iCertificate->SetSubjectNamePresent(); - }// else if - - else if( ( aParameter.Name().Compare( EAPSUBNAME ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSUBNAME" ) ); - - eap->iCertificate->SetIssuerName(value); - eap->iCertificate->SetIssuerNamePresent(); - }// else if - - else if( ( aParameter.Name().Compare( EAPCERTTYPE ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPCERTTYPE" ) ); - if ( value == EAPCERTCA ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EEapSim" ) ); - - eap->iCertificate->SetCertType(EapCertificateEntry::ECA); - eap->iEAPSettings-> iUseAutomaticCACertificatePresent = ETrue; - eap->iEAPSettings-> iUseAutomaticCACertificate = EFalse; - } - else - { - eap->iCertificate->SetCertType(EapCertificateEntry::EUser); - } - // Certificates must be present since this field was added - eap->iEAPSettings->iCertificatesPresent = ETrue; - eap->iCertificate->SetIsEnabledPresent(); - eap->iCertificate->SetIsEnabled(ETrue) ; - - }// else if - else if( ( aParameter.Name().Compare( EAPSERNUM ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSERNUM" ) ); - - eap->iCertificate->SetSerialNumber(value); - eap->iCertificate->SetSerialNumberPresent(); - }// else if - - else if( ( aParameter.Name().Compare( EAPSUBKEYID ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPSUBKEYID" ) ); - - _LIT(KHexIdLC, "0x"); - _LIT(KHexIdUC, "0X"); - TBuf<2> HexIdBuf; - TInt keyLen = aParameter.Value().Length(); - - // setting the given key to the key buffer - TBuf origKey; - origKey.SetLength(keyLen); - origKey = aParameter.Value(); - TBuf key; - TLex tmpByte; - TInt err(KErrNone); - TUint16 byte; - - // Remove possible spaces from the beginning - origKey.TrimLeft(); - - // if the key is over two chars long, then we have to check - // whether there is 0x or 0X in the beginning - if (origKey.Length() >= 2) - { - // Copy the two left most characters in to the buffer - HexIdBuf.Copy(origKey.Left(2)); - - // If the first characters are 0x or 0X, then they should be ignored - if (HexIdBuf.Compare(KHexIdLC) == 0 - || HexIdBuf.Compare(KHexIdUC) == 0) - { - // delete two characters - origKey.Delete(0, 2); - } - } - - // looping the subject key through, removing whitespaces - for (TInt i = 0; i < keyLen; i++) - { - // removing white spaces from the left side of the key - origKey.TrimLeft(); - // check that there are characters left - if (origKey.Length() >= 2) - { - // pick the two left most bytes from the key - tmpByte = origKey.Left(2); - // convert byte into binary format - err = tmpByte.Val(byte, EHex); - - // delete two characters from the left side of the character array in the buffer - origKey.Delete(0, 2); - - // check whether conversion to decimal went ok - if (err != KErrNone) - { - // if there are problems, then leave the loop - break; - } - - // store the appended byte into the key variable - key.Append(byte); - } - - else if (origKey.Length() == 1) - { - // pick the left most bytes from the key - tmpByte = origKey.Left(1); - // convert byte into binary format - err = tmpByte.Val(byte, EHex); - - // delete two characters from the left side of the character array in the buffer - origKey.Delete(0, 1); - - // check whether conversion to decimal went ok - if (err != KErrNone) - { - // if there are problems, then leave the loop - break; - } - - // store the appended byte into the key variable - key.Append(byte); - } - else - { - break; - } - } - TBuf8 keyIdentifier; - keyIdentifier.Copy(key); - // store key value only if no errors occurred - if (err == KErrNone) - { - eap->iCertificate->SetSubjectKeyId(keyIdentifier); - eap->iCertificate->SetSubjectKeyIdPresent(); - eap->iEAPSettings->iCertificatesPresent = ETrue; - } - } - - - else if( ( aParameter.Name().Compare( EAPTHUMBPRINT ) ) == 0 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::HandleEAPParametersL EAPTHUMBPRINT" ) ); - eap->iCertificate->SetThumbprintPresent(); - eap->iCertificate->SetThumbprint(value); - }// else if - } - - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::CWPAPNapdef -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPAPNapdef::CWPAPNapdef( TBool aFollowingLink, - const TDesC& aDefaultName, - CWPCharacteristic& aLogicalCharacteristic ) - : CWPAPItemBase( aDefaultName ), - iCharacteristic( aLogicalCharacteristic ), - iFollowingLink( aFollowingLink ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::ConstructL() - { - iLingerValue = NULL; - iLingerFlag = ETrue; - iInternetIndicator = -1; - //checks if Wlan feature is supported - FeatureManager::InitializeLibL(); - iWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); - FeatureManager::UnInitializeLib(); - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::SaveWlanDataL -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::SaveWlanDataL( TUint32 aIapId, CCommsDatabase& aCommsDb ) - { - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL APid: (%d)"), aIapId) ); - - if ( iBearer == KUidWlanBearerType ) - { - CCommsDbTableView* wLanServiceTable; - - // CMManager - // Search the Iap Service Id using the received IapId - RCmConnectionMethodExt cm = iCm->ConnectionMethodL( aIapId ); - TUint32 serviceId = cm.GetIntAttributeL( CMManager::ECmIapServiceId ); - - // The BeginTransaction might fail if someone else has locked CommsDat - TInt dberr = aCommsDb.BeginTransaction(); - if( dberr == KErrLocked ) - { - // Try BeginTransaction again to get lock - TInt retry = KBeginTransRetryCount; - while ( retry > 0 && dberr == KErrLocked ) - { - User::After(KBeginTransRetryDelay); - dberr = aCommsDb.BeginTransaction(); - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL: Database locked. BeginTransaction retry." ) ); - retry--; - } - if(dberr != KErrNone) - { - // Could not get lock to CommsDat at all - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL: BeginTransaction failed completely." ) ); - User::Leave( dberr ); - } - } - - TInt indexToSec = 0; - wLanServiceTable = aCommsDb.OpenViewMatchingUintLC( - TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), serviceId ); - TInt errorCode = wLanServiceTable->GotoFirstRecord(); - - if ( errorCode == KErrNone ) - { - indexToSec = serviceId; - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL updaterecord" ) ); - wLanServiceTable->UpdateRecord(); - } - else - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL insertrecord" ) ); - TUint32 dummyUid( 0 ); - User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) ); - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_SERVICE_ID" ) ); - // Save link to LAN service - wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), aIapId ); - indexToSec = aIapId; - } - - // Setting the security mode manually, because CMManager does not do that - wLanServiceTable->WriteUintL( TPtrC( WLAN_SECURITY_MODE ), iSecMode ); - - if( iSecSSID.Count() ) - { - CCommsDbTableView* wLanSecserviceTable; - wLanSecserviceTable = aCommsDb.OpenTableLC( TPtrC( WLAN_SECONDARY_SSID ) ); - //CleanupStack::Pop(wLanSecserviceTable); // wLanSecserviceTable - TBuf<4> blank; - blank.Append(KNullDesC); - - TBool sssid = EFalse; - TBool sussid = EFalse; - - for(TInt i = 0; i < iSecSSID.Count(); i++ ) - { - TUint32 id ; - - - TInt retval = wLanSecserviceTable->InsertRecord(id); - wLanSecserviceTable->WriteUintL(TPtrC(WLAN_SEC_SSID_SERVICE_ID), indexToSec ); - wLanSecserviceTable->WriteUintL(TPtrC(WLAN_SEC_SSID_ID), id ); - - if( iSecSSID[i]->iSSSID != NULL) - sssid = ETrue; - if(iSecSSID[i]->iSUSSID != NULL) - sussid = ETrue; - - if((sssid && iSecSSID[i]->iSSSID->Value() != blank) || (sussid && iSecSSID[i]->iSUSSID->Value() != blank )) - { - if( sssid ) - wLanSecserviceTable->WriteTextL(TPtrC(WLAN_SEC_SSID_SCANNED_SSID), iSecSSID[i]->iSSSID->Value()); - - if(sussid) - wLanSecserviceTable->WriteTextL(TPtrC(WLAN_SEC_SSID_USED_SSID), iSecSSID[i]->iSUSSID->Value()); - - } - wLanSecserviceTable->PutRecordChanges(); - sssid = EFalse; - sussid = EFalse; - } - CleanupStack::PopAndDestroy( wLanSecserviceTable ); - } - - iSecSSID.ResetAndDestroy(); - iSecSSID.Close(); - if ( iPriSSID ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_SSID" ) ); - // Save NU_WLAN_SSID - wLanServiceTable->WriteTextL( TPtrC(NU_WLAN_SSID), iPriSSID->Value() ); - } - if ( iPriUSSID ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_USED_SSID" ) ); - // Save WLAN_USED_SSID - wLanServiceTable->WriteTextL( TPtrC(WLAN_USED_SSID), iPriUSSID->Value() ); - } - if ( iPriHSSID ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_SCAN_SSID" ) ); - // Save WLAN_SCAN_SSID - wLanServiceTable->WriteBoolL( TPtrC(WLAN_SCAN_SSID), ETrue ); - } - else - { - wLanServiceTable->WriteBoolL( TPtrC(WLAN_SCAN_SSID), EFalse ); - } - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WEP_INDEX" ) ); - // Save index of key in use - wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_INDEX ), - (TUint32&) iDefaultWepKeyIndex ); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WEP_INDEX: (%d)"), iDefaultWepKeyIndex) ); - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL NU_WLAN_AUTHENTICATION_MODE" ) ); - // Open / Shared (0/1) - // Save index of key in use - wLanServiceTable->WriteUintL( TPtrC( NU_WLAN_AUTHENTICATION_MODE ), - ( TUint32& ) iAuthentication ); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL NU_WLAN_AUTHENTICATION_MODE: (%d)"), iAuthentication) ); - - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY1" ) ); - // Save first WEP key - wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY1 ), iKeyData[0] ); - wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY1_FORMAT ), - ( TUint32& ) iKeyFormat[0] ); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[0] ) ); - - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY2" ) ); - // Save second WEP key - wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY2 ), iKeyData[1] ); - wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY2_FORMAT ), - ( TUint32& ) iKeyFormat[1] ); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[1] ) ); - - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY3" ) ); - // Save third WEP key - wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY3 ), iKeyData[2] ); - wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY3_FORMAT ), - ( TUint32& ) iKeyFormat[2] ); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[2] ) ); - - - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL NU_WLAN_WEP_KEY4" ) ); - // Save fourth WEP key - wLanServiceTable->WriteTextL( TPtrC( NU_WLAN_WEP_KEY4 ), iKeyData[3] ); - wLanServiceTable->WriteUintL( TPtrC( WLAN_WEP_KEY4_FORMAT ), - ( TUint32& ) iKeyFormat[3] ); - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL (%S)"), &iKeyData[3] ) ); - - - if ( iWpaPresKeyAsc ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL convert WPAKEY to ascii" ) ); - // convert unicode to 8-bit ascii - TBuf8 wpaKey; - StrCopy( wpaKey, iWpaPresKeyAsc->Value() ); - - // Enable WPA Pre Shared key mode - wLanServiceTable->WriteBoolL( TPtrC( WLAN_ENABLE_WPA_PSK ), ETrue ); - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WPA_PRE_SHARED_KEY" ) ); - // Save PreShared Key - wLanServiceTable->WriteTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), - wpaKey ); - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteUintL WLAN_WPA_KEY_LENGTH" ) ); - // Save PreShared Key Length - wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), - wpaKey.Length() ); - } - - TBuf eapList; - eapList.Copy(KEapAll); - - for (TInt i=0;iiEAPSettings->iCertificatesPresent ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL Certificate was present." ) ); - eap->iEAPSettings->iCertificates.Append( eap->iCertificate ); - } - - // Save EAP list - if ( eap->iEapTypeString.Length() > 0 - && eap->iEncapsulatingExpandedEapId.Length() == 0) // AND method is not encapsulated - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL WriteTextL WLAN_EAPS" ) ); - - TBuf8<3> buf; - _LIT8(KFormat, "%d"); - // pick the last byte from the array - buf.Format(KFormat, eap->iEapTypeString[KExpandedEapIdLength - 1]); - // search for the correct offset for the eap type from the KEapAll literal - TInt index = KEapAll().Find(buf); - - const TUint8 offset = 2; //length = f "-0" string - // Add '+' to the correct offset, so that the eap is repsesented activated in the list - if(index >= offset) - { - eapList[index-offset] = KEapPlus; - } - - } - // Set iEncapsulatingEapTypes - for ( TInt j = 0; j < iEapTypeArray.Count(); j++ ) - { - // Check if any method has this method as the encapsulating method - if ( eap->iEapTypeString == iEapTypeArray[j]->iEncapsulatingExpandedEapId ) - { - // Append this method to iEncapsulatedEAPType - eap->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypes.Append( iEapTypeArray[j]->iEAPSettings->iEAPExpandedType ); - eap->iEAPSettings->iEnabledEncapsulatedEAPExpandedTypesPresent = ETrue; - } - } - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings CEapType::NewL" ) ); - CEapType* eapType = NULL; - - - TRAPD( error, ( eapType = CEapType::NewL( ELan, serviceId, eap->iEAPSettings->iEAPExpandedType ) ) ); - - if ( ( error == KErrNone ) && eapType ) - { - CleanupStack::PushL( eapType ); - - // Check if this type is tunneled - if ( eap->iEncapsulatingExpandedEapId.Length() > 0 ) - { - // It is tunneled. - eapType->SetTunnelingType( eap->iEncapsulatingExpandedEapId); - - } - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings SetConfigurationL" ) ); - TRAP_IGNORE( eapType->SetConfigurationL( *eap->iEAPSettings ) ); - - CleanupStack::PopAndDestroy( eapType ); - - } - else - { - FTRACE(RDebug::Print(_L("[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL CEapType::NewL err: %d"), error ) ); - } - - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL save EAP settings done" ) ); - } - - - - // Expanded EAP types in use. Write the eap list to the new columns. - - // generate appropriate entries in the new enabled and disabled list, - // overwriting those values - - // count the + and - signs to determine the size of enabled and - // disabled descriptors - - TLex lex( eapList ); - TInt numPlus = 0; - TInt numMinus = 0; - TChar ch; - while ( !lex.Eos() ) - { - ch = lex.Get(); - if ( ch == '+' ) ++numPlus; - else if ( ch == '-' ) ++numMinus; - } - // load general EAP settings If - CEapGeneralSettings* genSettings; - genSettings = CEapGeneralSettings::NewL(ELan, serviceId); - CleanupStack::PushL( genSettings ); - - // get lists of enabled/disabled EAPs for the IAP - - RArray enabledEapMethods; - RArray disabledEapMethods; - - enabledEapMethods.Reset(); - disabledEapMethods.Reset(); - - lex.Assign( eapList ); - - while ( !lex.Eos() ) - { - // beginning of implementation UID - TInt16 implUid = 0; - - if ( lex.Val( implUid ) != KErrNone || !implUid ) - { - break; - } - - // append it to the appropriate list ('+' enabled, '-' disabled) - _LIT8( KPadding, "\xFE\0\0\0\0\0\0" ); - _LIT8( KMsChapV2Padding, "\xFE\xFF\xFF\xFF\0\0\0"); - const TInt KPlainMsChapV2ImplUid = 99; - - if ( implUid > 0 ) - { - TBuf8 tempbuf; - if(Abs( implUid ) == KPlainMsChapV2ImplUid) - { - tempbuf.Append(KMsChapV2Padding); - } - else - { - tempbuf.Append(KPadding); - } - tempbuf.Append(Abs( implUid )); - TEapExpandedType expandedTypebuf(tempbuf); - enabledEapMethods.Append(expandedTypebuf); - } - - // swallow the delimiter (',') - lex.Get(); - } - - genSettings->SetEapMethods(enabledEapMethods, disabledEapMethods); - - CleanupStack::PopAndDestroy( genSettings ); - - - - - iEapTypeArray.ResetAndDestroy(); - wLanServiceTable->PutRecordChanges(); - - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL PutRecordChanges" ) ); - CleanupStack::PopAndDestroy( wLanServiceTable ); - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL done" ) ); - aCommsDb.CommitTransaction(); - } - else - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::SaveWlanDataL ignored not a WLAN AP" ) ); - } - - } - -//------------------------------------------------------------------------------ -// CWPAPNapdef::ConvertAsciiToHex -//------------------------------------------------------------------------------ -// -void CWPAPNapdef::ConvertAsciiToHex( const TDesC8& aSource, HBufC8*& aDest ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertAsciiToHex" ) ); - - _LIT( hex, "0123456789ABCDEF" ); - TInt size = aSource.Size(); - TPtr8 ptr = aDest->Des(); - for ( TInt ii = 0; ii < size; ii++ ) - { - TText8 ch = aSource[ii]; - ptr.Append( hex()[(ch/16)&0x0f] ); - ptr.Append( hex()[ch&0x0f] ); - } - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertAsciiToHex Done" ) ); - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::StrCopy -// String copy with lenght check. -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::StrCopy( TDes8& aTarget, const TDesC& aSource ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::StrCopy" ) ); - - TInt len = aTarget.MaxLength(); - if( len < aSource.Length() ) - { - aTarget.Copy( aSource.Left( len ) ); - return; - } - aTarget.Copy( aSource ); - - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::StrCopy Done" ) ); - } - -CEapTypeElement::~CEapTypeElement() - { - delete iEAPSettings; - delete iCertificate; - } - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::UpdateLingerL -// -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::UpdateLingerL(const TUint32 aIapId) -{ - if ( iLinger && ( !iLingerFlag ) ) - { - AddLingerL( aIapId , iLingerValue ); - } - -} - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::UdateligerValueL -// -// ----------------------------------------------------------------------------- -// -void CWPAPNapdef::UdateligerValueL(CWPParameter* aLinger) -{ - TInt err(KErrNone); - const TDesC& value = aLinger->Value(); - if( !Notalpha(value)) - { - TLex lex( value ); - TUint Linger = 0; - TInt lingerint; - err = lex.Val( Linger, EDecimal ); - if( err == KErrNone ) - { - lingerint = Linger; - if( lingerint >= 0 ) - { - iLingerValue = lingerint; - iLingerFlag = EFalse; - } - } - } -} - -// ----------------------------------------------------------------------------- -// CWPAPNapdef::UdateligerValueL -// -// ----------------------------------------------------------------------------- -// -TBool CWPAPNapdef::Notalpha(const TDesC& aValue) -{ - TBool NotAlpha = EFalse; - TChar character; - for(TInt i = 0 ; i < aValue.Length(); i++) - { - character = aValue[i]; - NotAlpha = character.IsAlpha(); - if(NotAlpha) - break; - } - - return NotAlpha; -} - - -// --------------------------------------------------------------------------- -// Adds iapID and linger interval to CentralRepository -// --------------------------------------------------------------------------- -// -void CWPAPNapdef::AddLingerL( const TInt aIapId, const TInt aLingerInterval ) - { - TInt err( KErrNone ); - - // Open repository - CRepository* repository = CRepository::NewLC( KCRUidPDPContextManager ); - - // Find if an entry for "iapId" already exists in CentRep - RArray< TUint32 > foundKeys; - foundKeys.Reset(); - - err = repository->FindEqL( KIapColumn, // partial key - KColumnMask, // key mask - aIapId, // value - foundKeys ); // found keys - - if ( err == KErrNone || err == KErrNotFound ) - { - if ( foundKeys.Count() == 0 ) - { - // Add a new entry - TInt arrayCount( 0 ); - - // Get number of iapId&linger entries in Centrep - err = repository->Get( KPdpContextManagerLingerArrayCount, - arrayCount ); - - if ( err == KErrNone ) - { - arrayCount++; - - err = repository->Create( ( KIapColumn | arrayCount ), aIapId ); - - if ( err == KErrNone ) - { - err = repository->Create( ( KLingerColumn | arrayCount ), - aLingerInterval ); - } - - if ( err == KErrNone ) - { - // Update number of iapId&linger entries in Centrep - err = repository->Set( KPdpContextManagerLingerArrayCount, - arrayCount ); - } - } - } - else - { - // Update existing entry on current row - TInt32 row = foundKeys[ 0 ] & KRowMask; - - err = repository->Set( ( KLingerColumn | row ), aLingerInterval ); - } - } - - foundKeys.Close(); - CleanupStack::PopAndDestroy( repository ); - - User::LeaveIfError( err ); - - } - -void CWPAPNapdef::ConvertEAPStringToIds( const TDesC& aEAPString, TDes8& aExpandedId, TEapExpandedType& aID) - { - if ( aEAPString == KEAPSIM ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapSim" ) ); - aExpandedId.Copy( KEapSimTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeSim.GetType(); - } - else if( aEAPString == KEAPAKA ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapAka" ) ); - aExpandedId.Copy( KEapAkaTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeAka.GetType(); - } - else if( aEAPString == KEAPTLS ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapTls" ) ); - aExpandedId.Copy( KEapTlsTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeTls.GetType(); - } - else if( aEAPString == KEAPPEAP ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapPeap" ) ); - aExpandedId.Copy( KEapPeapTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypePeap.GetType(); - } - else if( aEAPString == KEAPTTLS ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapTtls" ) ); - aExpandedId.Copy( KEapTtlsTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeTtls.GetType(); - } - else if( aEAPString == KEAPLEAP ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapLeap" ) ); - aExpandedId.Copy( KEapLeapTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeLeap.GetType(); - } - else if( aEAPString == KEAPMSCHAPV2 ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapMschapv2" ) ); - aExpandedId.Copy( KEapMschapv2TypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeMsChapv2.GetType(); - } - else if( aEAPString == KEAPGTC ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapGtc" ) ); - aExpandedId.Copy( KEapGtcTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeGtc.GetType(); - } - else if( aEAPString == KEAPFAST ) - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapFast" ) ); - aExpandedId.Copy( KEapFastTypeId, KExpandedEapIdLength ); - aID = *EapExpandedTypeFast.GetType(); - } - - else - { - FLOG( _L( "[AccesspointAdapter] CWPAPNapdef::ConvertEAPStringToIds EEapNone" ) ); - aExpandedId.Copy( KEapNoneId, KExpandedEapIdLength ); - aID = *EapExpandedTypeNone.GetType(); - } - - } - -// --------------------------------------------------------------------------- -// Returns the NAP-ID -// --------------------------------------------------------------------------- -// -const TDesC& CWPAPNapdef::NapId() - { - return iNapID->Value(); - } - -// --------------------------------------------------------------------------- -// Returns the bearer value -// --------------------------------------------------------------------------- -// -TUint CWPAPNapdef::Bearer() - { - return iBearer; - } - -// --------------------------------------------------------------------------- -// Returns the bearer value -// --------------------------------------------------------------------------- -// -void CWPAPNapdef::SetCMManager( RCmManagerExt* aCm ) - { - iCm = aCm; - } - - - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPhysicalProxy.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPhysicalProxy.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,349 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a class, which holds physical proxy information. -* -*/ - - - - - -// INCLUDE FILES - -#include "CWPAPPhysicalProxy.h" // Own header -#include -#include -#include -#include -#include "CWPAPLogicalProxy.h" -#include "CWPAPPort.h" -#include "CWPAPNapdef.h" -#include "WPAPAdapter.pan" -#include "CWPLog.h" -#include "WPAPDefs.h" -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPAPPhysicalProxy* CWPAPPhysicalProxy::NewLC( - const TDesC& aDefaultName, - CWPCharacteristic& aCharacteristic, - CWPCharacteristic& aLogicalCharacteristic, - CWPAPPort*& aPort ) - { - CWPAPPhysicalProxy* self = new(ELeave) CWPAPPhysicalProxy( - aDefaultName, - aLogicalCharacteristic, - aPort ); - CleanupStack::PushL( self ); - self->ConstructL(); - aCharacteristic.AcceptL( *self ); - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CWPAPPhysicalProxy::~CWPAPPhysicalProxy() - { - delete iPort; - - iNapdefs.ResetAndDestroy(); - iNapdefs.Close(); - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::ValidateL -// ----------------------------------------------------------------------------- -// -TBool CWPAPPhysicalProxy::ValidateL() - { - TBool isValid( EFalse ); - - // We must have proxy address otherwise this proxy isn't valid. - if ( iProxyAddr ) - { - switch ( iPxAddrType ) - { - case EPxAddrTypeIPv4: - { - isValid = WPAdapterUtil::CheckIPv4( iProxyAddr->Value() ); - break; - } - case EPxAddrTypeIPv6: - { - isValid = FeatureManager::FeatureSupported( KFeatureIdIPv6 ) - && WPAdapterUtil::CheckIPv6( iProxyAddr->Value() ); - break; - } - case EPxAddrTypeUnsupported: - { - isValid = EFalse; - break; - } - default: // default value is assumed to be EPxAddrTypeIPv4 - { - isValid = WPAdapterUtil::CheckIPv4( iProxyAddr->Value() ); - } - } - } - return isValid; - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::AddDataL -// ----------------------------------------------------------------------------- -// -void CWPAPPhysicalProxy::AddDataL( RCmConnectionMethodExt& aCmItem ) - { - LOG("--CWPAP CWPAPPhysicalProxy::AddDataL begin--"); - TInt err(KErrNone); - - // CMManager - aCmItem.SetStringAttributeL( CMManager::ECmWapIPGatewayAddress, iProxyAddr->Value()); - LOG2("CWPAP EApWapStartPage, value: %S, err: %d", - &iProxyAddr->Value(), err); - - //CMManager - aCmItem.SetStringAttributeL( CMManager::ECmIPGateway, iProxyAddr->Value()); - LOG2("CWPAP EApIspIPGateway, value: %S, err: %d", - &iProxyAddr->Value(), err); - - //CMManager - aCmItem.SetStringAttributeL( CMManager::ECmProxyServerName, iProxyAddr->Value() ); - LOG2("CWPAP EApProxyServerAddress, value: %S, err: %d", - &iProxyAddr->Value(), err); - - - // Store port data - if ( iPort ) - { - iPort->AddDataL( aCmItem ); - } - - if ( iLogicalPort) - { - iLogicalPort->AddDataL( aCmItem ); - } - if ( err ) err = 0; // prevent compiler warning - - LOG("--CWPAP CWPAPPhysicalProxy::AddDataL end--"); - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::AddItemsL -// ----------------------------------------------------------------------------- -// -TInt CWPAPPhysicalProxy::AddItemsL( RPointerArray& aItems, - CWPAPItemBase* iLogicalProxy, - CWPAPItemBase* /*iPhysicalProxy*/ ) - { - TInt count( 0 ); - for( TInt i( 0 ); i < iNapdefs.Count(); i++ ) - { - CWPAPNapdef* pp = iNapdefs[ i ]; - if( pp->ValidateL() ) - { - count += pp->AddItemsL( aItems, iLogicalProxy, this ); - } - } - - return count; - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::Name -// ----------------------------------------------------------------------------- -// -const TDesC& CWPAPPhysicalProxy::Name() - { - if( iName ) - { - return iName->Value(); - } - else - { - return KNullDesC; - } - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPPhysicalProxy::VisitL( CWPCharacteristic& aCharacteristic ) - { - TInt type = aCharacteristic.Type(); - - // Accept only KWPPort characteristics - // One valid port is enough for us - if ( type == KWPPort && !iPort ) - { - CWPAPPort* port = CWPAPPort::NewLC( aCharacteristic ); - - if ( port->ValidateL() ) - { - iPort = port; - CleanupStack::Pop( port ); - } - else // Data not valid. - { - CleanupStack::PopAndDestroy( port ); - } - } - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPPhysicalProxy::VisitL( CWPParameter& aParameter) - { - TInt id = aParameter.ID(); - const TDesC& value = aParameter.Value(); - - if ( value.Length() == 0 ) - { - // No use to store zero length value. - return; - } - - switch ( id ) - { - case EWPParameterPxAddrFQDN: // iGatewayIPAddress - { - // Implementation comments: - // The value of this field is a domain name but we can't - // at the moment resolve this to IP address - // (at least from this adapter). - // Therefore this field can't be used. - // EWPParameterPxAddr is supported - // and should be used. - - /// Validate the domain name - /// Resolve to IP address - - /* // Uncomment if domain name can be validated and IP address resolved - // Add only if we haven't already received this field - if ( !IsReceived( EWPParameterPxAddrFQDN_id )) - { - iGatewayIPAddress = &aParameter; - MarkReceived( EWPParameterPxAddrFQDN_id ); - } - */ - break; - } - case EWPParameterPxAddr: // iGatewayIPAddress - { - // Accept only first occurrence of either PxAddr or PxAddrFQDN - if ( IsReceived( EWPParameterPxAddrFQDN_id ) || - IsReceived( EWPParameterPxAddr_id ) ) - { - return; - } - else - { - // The max allowed lenght for proxy address is 45 bytes. - // Nothing is stored if max lenght is exceeded - if ( aParameter.Value().Length() < 46 ) - { - iProxyAddr = &aParameter; - MarkReceived( EWPParameterPxAddr_id ); - } - } - break; - } - case EWPParameterPxAddrType: - { - if ( !IsReceived( EWPParameterPxAddrType_id ) ) - { - // Only IPv4 addresses are supported. - if ( value == KIPV4 ) - { - iPxAddrType = EPxAddrTypeIPv4; - } - else if( value == KIPV6 ) - { - iPxAddrType = EPxAddrTypeIPv6; - } - else - { - iPxAddrType = EPxAddrTypeUnsupported; - } - MarkReceived( EWPParameterPxAddrType_id ); - } - break; - } - case EWPParameterName: - { - if( !iName ) - { - iName = &aParameter; - } - break; - } - default: - { - // Just let through - } - } - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPPhysicalProxy::VisitLinkL( CWPCharacteristic& aLink ) - { - CWPAPNapdef* item = CWPAPNapdef::NewLC( ETrue, - iDefaultName, - iLogicalCharacteristic, - aLink ); - User::LeaveIfError( iNapdefs.Append( item ) ); - CleanupStack::Pop( item ); // item - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::CWPAPPhysicalProxy -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPAPPhysicalProxy::CWPAPPhysicalProxy( - const TDesC& aDefaultName, - CWPCharacteristic& aLogicalCharacteristic, - CWPAPPort*& aPort ) - : CWPAPItemBase( aDefaultName ), - iLogicalPort( aPort ), - iNapdefs( KInitialArraySize ), - iLogicalCharacteristic( aLogicalCharacteristic ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPPhysicalProxy::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPAPPhysicalProxy::ConstructL() - { - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPort.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPAPPort.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +0,0 @@ -/* -* Copyright (c) 2002 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: Defines a class, which holds proxy port information. -* -*/ - - - - - -// INCLUDE FILES - -#include "CWPAPPort.h" // Own header -#include "WPAPAdapter.pan" -#include "CWPLog.h" -#include "WPAPDefs.h" - -#include -#include - - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CWPAPPort::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CWPAPPort* CWPAPPort::NewLC( CWPCharacteristic& aCharacteristic ) - { - CWPAPPort* self = new(ELeave) CWPAPPort(); - CleanupStack::PushL( self ); - self->ConstructL(); - aCharacteristic.AcceptL( *self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::CWPAPPort -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CWPAPPort::CWPAPPort() : CWPAPItemBase( KNullDesC ) - { - } - -// ----------------------------------------------------------------------------- -// Destructor -// ----------------------------------------------------------------------------- -// -CWPAPPort::~CWPAPPort() - { - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::Validate -// ----------------------------------------------------------------------------- -// -TBool CWPAPPort::ValidateL() - { - // If we got either service or portnumber and - // Those we successfully interpreted the port - // information is valid. - if ( IsReceived( EWPParameterService_id ) || - IsReceived( EWPParameterPortNbr_id )) - { - return ETrue; - } - LOG("CWPAP ERROR! Port not valid"); - return EFalse; // Nothing received so this is invalid. - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::AddData -// ----------------------------------------------------------------------------- -// -void CWPAPPort::AddDataL( RCmConnectionMethodExt& aCmItem ) - { - LOG("--CWPAP CWPAPPort::AddDataL begin--"); - TInt err(KErrNone); - - // CMManager - TRAP (err, aCmItem.SetBoolAttributeL( CMManager::ECmWapIPSecurity, iConnectionSecurity )); - LOG2("CWPAP EApWapSecurity, value: %d, err: %d", iConnectionSecurity, err); - - // CMManager - TRAP (err, aCmItem.SetIntAttributeL( CMManager::ECmWapIPWSPOption, iSessionMode )); - LOG2("CWPAP EApWapWspOption, value: %d, err: %d", iSessionMode, err); - - if ( iPortNbr ) - { - const TDesC& value = iPortNbr->Value(); - TLex lex( value ); - TUint32 intValue=0; - err = lex.Val( intValue, EDecimal ); - if ( err == KErrNone ) - { - if( intValue > 65535 ) - { - intValue = 0; - } - - // CMManager - TRAP (err, aCmItem.SetIntAttributeL( CMManager::ECmProxyPortNumber, intValue )); - LOG2("CWPAP EApProxyPortNumber, value: %d, err: %d", - intValue, err); - } - } - LOG("--CWPAP CWPAPPort::AddDataL end--"); - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::Name -// ----------------------------------------------------------------------------- -// -const TDesC& CWPAPPort::Name() - { - return KNullDesC; - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::AddItemsL -// ----------------------------------------------------------------------------- -// -TInt CWPAPPort::AddItemsL( RPointerArray& /*aItems*/, - CWPAPItemBase* /*aLogicalProxy*/, - CWPAPItemBase* /*aPhysicalProxy*/ ) - { - return KErrNone; - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPPort::VisitL( CWPCharacteristic& /*aCharacteristic*/ ) - { - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::VisitL -// ----------------------------------------------------------------------------- -// -void CWPAPPort::VisitL( CWPParameter& aParameter ) - { - TInt id = aParameter.ID(); - const TDesC& value = aParameter.Value(); - - if ( value.Length() == 0 ) - { - // No use of checking the zero legth parameter. - return; - } - - switch ( id ) - { - case EWPParameterService: // iConnectionSecurity and iSessionMode - { - // If EWPParameterService value have already received - // or service type has been solved from EWPParameterPortNbr value - // don't accept this anymore. - if ( IsReceived( EWPParameterService_id ) ) - { - break; - } - - if ( value == KCLWSP) - { - // CMManager - SetValues( EFalse, CMManager::ECmWapWspOptionConnectionless, - EWPParameterPortNbr_id ); - } - else if ( value == KCOWSP) - { - // CMManager - SetValues( EFalse, CMManager::ECmWapWspOptionConnectionOriented, - EWPParameterPortNbr_id ); - - } - else if ( value == KCLSECWSP) - { - // CMManager - SetValues( ETrue, CMManager::ECmWapWspOptionConnectionless, - EWPParameterPortNbr_id ); - } - else if ( value == KCOSECWSP) - { - // CMManager - SetValues( ETrue, CMManager::ECmWapWspOptionConnectionOriented, - EWPParameterPortNbr_id ); - } - else - { - // Not supported... - } - break; - } - case EWPParameterPortNbr: // iConnectionSecurity and iSessionMode - { - // If EWPParameterPortNbr value have already handled - // don't accept it anymore. - if ( IsReceived( EWPParameterPortNbr_id ) ) - { - break; - } - - // Store the pointer to port parameter - iPortNbr = &aParameter; - MarkReceived( EWPParameterPortNbr_id ); - - if ( value == K9200 ) - { - // CMManager - SetValues( EFalse, CMManager::ECmWapWspOptionConnectionless, - EWPParameterPortNbr_id ); - - // Type of service identified. - // No need for Service parameter anymore. - MarkReceived( EWPParameterService_id ); - } - else if ( value == K9201 || value == K80 || value == K8080) - { - // CMManager - SetValues( EFalse, CMManager::ECmWapWspOptionConnectionOriented, - EWPParameterPortNbr_id ); - MarkReceived( EWPParameterService_id ); - } - else if ( value == K9202 ) - { - // CMManager - SetValues( ETrue, CMManager::ECmWapWspOptionConnectionless, - EWPParameterPortNbr_id ); - MarkReceived( EWPParameterService_id ); - } - else if ( value == K9203 || value == K443 ) - { - // CMManager - SetValues( ETrue, CMManager::ECmWapWspOptionConnectionOriented, - EWPParameterPortNbr_id ); - MarkReceived( EWPParameterService_id ); - } - else - { - // Not supported... - } - break; - } - default: - { - // Just let through - } - } - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::SetValues -// ----------------------------------------------------------------------------- -// -void CWPAPPort::SetValues( TBool aConnectionSecurity, - TInt aSessionMode, - TMarkedField aReceivedField ) - { - __ASSERT_DEBUG( aReceivedField == EWPParameterService_id || - aReceivedField == EWPParameterPortNbr_id, - Panic( EPreConditionFail ) ); - - iConnectionSecurity = aConnectionSecurity; - iSessionMode = aSessionMode; - - MarkReceived( aReceivedField ); - } - -// ----------------------------------------------------------------------------- -// CWPAPPort::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CWPAPPort::ConstructL() - { - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2002 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 offers static utility functions for CWmlBMSubItem. -* -*/ - - - - -// INCLUDE FILES - -#include -#include "CWPLog.h" - - -#ifdef ENABLE_LOGGING -#include - -/// Folder where the WMLBC log resides -_LIT( KLogFolder, "ringbc" ); - -/// The name of the log file -_LIT( KLogFileName, "ringbc.txt" ); - -/// The format in which the time is formatted in log -_LIT( KLogTimeFormat, "%02d.%02d:%02d:%06d "); - -/// The length of the string produced by KLogTimeFormat -const TInt KLogTimeFormatLength = 16; - -/// How many characters a log line can contain -const TInt KLogLineLength = 256; - -#endif // ENABLE_LOGGING - -// ================= MEMBER FUNCTIONS ======================= - -#ifdef ENABLE_LOGGING -// --------------------------------------------------------- -// Log() -// -// --------------------------------------------------------- -void Log::DoLog( TRefByValue aText, ... ) - { - VA_LIST args; - VA_START( args, aText ); - - TBuf buf; - buf.FormatList( aText, args ); - -#ifdef _DEBUG -#ifdef LOG_TO_FILE - RFileLogger logger; - TInt ret = logger.Connect(); - if (ret==KErrNone) - { - logger.SetDateAndTime( EFalse,EFalse ); - logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend ); - TBuf timeStamp; - TTime now; - now.HomeTime(); - TDateTime dateTime; - dateTime = now.DateTime(); - timeStamp.Format( KLogTimeFormat, - dateTime.Hour(), dateTime.Minute(), - dateTime.Second(), dateTime.MicroSecond() ); - buf.Insert( 0, timeStamp ); - - logger.Write(buf); - } - - logger.Close(); - -#else - RDebug::Print( buf ); -#endif // LOG_TO_FILE -#endif // _DEBUG - VA_END( args ); - } - -#endif // ENABLE_LOGGING - -// End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.h --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPLog.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2002 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 class -* -*/ - - - - - -#ifndef CWPLOG_H -#define CWPLOG_H - -///////////////////////////////////////////////////////////////////////////// -// #Defines that control printing of additional information to debug stream. -///////////////////////////////////////////////////////////////////////////// - -// INCLUDES - -#include "CWPLogDef.h" -#include - -// DEFINES - -#ifdef ENABLE_LOGGING -#define LOG(s) Log::DoLog(_L(s)) -#define LOG1(s, v) Log::DoLog( _L(s), v ) -#define LOG2(s, v1, v2) Log::DoLog( _L(s), v1, v2 ) -#else -#define LOG(s) -#define LOG1(s, v) -#define LOG2(s, v1, v2) -#endif // ENABLE_LOGGING - -// DATA TYPES - - -// CLASS DECLARATION - -/** -* Class offers logging functionality. -*/ -class Log - { - - public: - - /** - * Log the message. - * @param aText text to be written to log. - */ - static void DoLog( TRefByValue aText, ... ); - - private: // constructor - - /// Prohibited default constructor - Log(); - - /// Prohibited copy constructor - Log( const Log& ); - - /// Prohibited assignment operator - Log& operator=( const Log& ); - }; - -#endif // CWPLOG_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/CWPLogDef.h --- a/omaprovisioning/provisioning/accesspointadapter/Src/CWPLogDef.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2002 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 class definition -* -*/ - - - - - -#ifndef CWPLOGDEF_H -#define CWPLOGDEF_H - -///////////////////////////////////////////////////////////////////////////// -// #Defines that control printing of additional information to debug stream. -///////////////////////////////////////////////////////////////////////////// - -// Defining this enables logging -//#define ENABLE_LOGGING - -// Defining this will direct all messages to a log file -//#define LOG_TO_FILE - -#endif // LOGDEF_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterGroupProxy.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterGroupProxy.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2002 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: Table of plugins for ECom -* -*/ - - - - - -// INCLUDE FILES -#include -#include -#include "CWPAPAdapter.h" - -// CONSTANTS -const TImplementationProxy KImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(0x101F84D9, CWPAPAdapter::NewL) - }; - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// ImplementationGroupProxy -// ----------------------------------------------------------------------------- -// -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy); - - return KImplementationTable; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterPanics.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/WPAPAdapterPanics.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2002 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: Panic implementation -* -*/ - - - - -// INCLUDES - -#include // for GLDEF_C -#include "WPAPAdapter.pan" - -// CONSTANTS - -_LIT(KWPAPAdapter, "wpapadapter.dll"); - -GLDEF_C void Panic( TInt aPanic ) - { - User::Panic( KWPAPAdapter, aPanic ); - } - -// End of file diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/Src/WPAPUtil.cpp --- a/omaprovisioning/provisioning/accesspointadapter/Src/WPAPUtil.cpp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2002 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 offers common utility methods. -* -*/ - - - - -// INCLUDE FILES - -#include "WPAPUtil.h" // Own header -#include - -// CONSTANTS -// Commented out by JN -//#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw - _LIT( KAdapterName, "WPAPAdapterResource" ); -//#else -// _LIT( KAdapterName, "WPAPAdapter" ); -//#endif - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// WPAPUtil::ReadHBufCLC -// ----------------------------------------------------------------------------- -// -HBufC* WPAPUtil::ReadHBufCL( TInt aResourceId ) - { - TFileName fileName; - Dll::FileName( fileName ); - - return WPAdapterUtil::ReadHBufCL( fileName, KAdapterName, aResourceId ); - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/group/101F84D8.rss --- a/omaprovisioning/provisioning/accesspointadapter/group/101F84D8.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2002 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 file defining the AccesspointAdapter plugin. -* -*/ - - - - -// INCLUDES -#include "registryinfo.rh" - - -// RESOURCE DEFINITIONS -// ----------------------------------------------------------------------------- -// -// theInfo -// Resource defining the ProvisioningAdapter plugin. -// -// ----------------------------------------------------------------------------- -// - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x101F84D8; - interfaces = - { - INTERFACE_INFO - { - interface_uid = 0x101F84D5; - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x101F84D9; - version_no = 1; - display_name = "WAP AP PA"; // Use short name to save RAM and ROM space - default_data = ""; - opaque_data = "0"; - } - }; - } - }; - } - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapter.mmp --- a/omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapter.mmp Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2002-2006 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: Project definition file for accesspoint adapter. -* -*/ - - - -#include -#include -#include - -TARGET WPAPAdapter.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x101F84D8 - - -VENDORID VID_DEFAULT -CAPABILITY CAP_ECOM_PLUGIN - -SOURCEPATH ../Src -SOURCE CWPAPAdapter.cpp -SOURCE CWPAPItemBase.cpp -SOURCE CWPAPAccesspointItem.cpp -SOURCE CWPAPNapdef.cpp -SOURCE CWPAPLogicalProxy.cpp -SOURCE CWPAPPhysicalProxy.cpp -SOURCE CWPAPPort.cpp -SOURCE WPAPUtil.cpp -SOURCE WPAPAdapterPanics.cpp -SOURCE WPAPAdapterGroupProxy.cpp -SOURCE CWPLog.cpp - -SOURCEPATH ../group - -START RESOURCE 101F84D8.rss -TARGET WPAPAdapter.rsc -END - -START RESOURCE WPAPAdapterResource.rss -HEADER -TARGET WPAPAdapterResource.rsc -TARGETPATH RESOURCE_FILES_DIR -LANGUAGE_IDS -END - - -USERINCLUDE ../Inc -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - -LIBRARY euser.lib -LIBRARY ProvisioningEngine.lib -LIBRARY commdb.lib -LIBRARY FeatMgr.lib -LIBRARY ecom.lib -LIBRARY centralrepository.lib -LIBRARY cmmanager.lib -LIBRARY eapsymbiantools.lib -LIBRARY eaptools.lib -LIBRARY eaptrace.lib -DEBUGLIBRARY flogger.lib // Only in debug builds - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapterResource.rss --- a/omaprovisioning/provisioning/accesspointadapter/group/WPAPAdapterResource.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2002 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 file. -* -*/ - - - - -// INCLUDES -#include -#include - -// Rich text labels - -RESOURCE LBUF r_qtn_sm_wapap_name - { - txt = qtn_sm_wapap_name; - } - -RESOURCE LBUF r_qtn_sm_wml_accesspoints - { - txt = qtn_sm_wml_accesspoints; - } diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/group/bld.inf --- a/omaprovisioning/provisioning/accesspointadapter/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2001-2007 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: Build information file for AccesspointAdapter CP adapter -* -*/ - - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS -../rom/WPAPAdapter.iby CORE_MW_LAYER_IBY_EXPORT_PATH(WPAPAdapter.iby) -../rom/WPAPAdapterResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(WPAPAdapterResources.iby) - -// export localised loc file -../loc/WPAPAdapter.loc MW_LAYER_LOC_EXPORT_PATH(wpapadapter.loc) - -PRJ_MMPFILES -WPAPAdapter.mmp - -PRJ_TESTMMPFILES - diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/loc/WPAPAdapter.loc --- a/omaprovisioning/provisioning/accesspointadapter/loc/WPAPAdapter.loc Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2002-2004 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 is a localisation file for AccesspointAdapter -* -*/ - - - - -// LOCALISATION STRINGS - -//d: Summary text for access points -//l: popup_info_list_pane_t2/opt1 -//r: 5.0 - -#define qtn_sm_wml_accesspoints "Access points:" - -//d:This is the default name for new WAP access point. -//l:query_popup_data_pane_t1/opt4 -//r: 5.0 - -#define qtn_sm_wapap_name "WAP access point" - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapter.iby --- a/omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapter.iby Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2007 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: Image description file for project wpapadapter -* -*/ - - - - -#ifndef WPAPADAPTER_IBY -#define WPAPADAPTER_IBY - -#include -#include - -ECOM_PLUGIN(WPAPAdapter.dll, WPAPAdapter.rsc) - -#endif // WPAPADAPTER_IBY diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapterResources.iby --- a/omaprovisioning/provisioning/accesspointadapter/rom/WPAPAdapterResources.iby Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2007 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: Image description file for project wpapadapter -* -*/ - - - - -#ifndef WPAPADAPTERRESOURCES_IBY -#define WPAPADAPTERRESOURCES_IBY - -#include -#include - -data=DATAZ_\RESOURCE_FILES_DIR\WPAPAdapterResource.rsc RESOURCE_FILES_DIR\WPAPAdapterResource.rsc - -#endif // WPAPADAPTERRESOURCES_IBY diff -r a36219ae6585 -r 2e64dc50f295 omaprovisioning/provisioning/conf/CI_s60provisioning.confml Binary file omaprovisioning/provisioning/conf/CI_s60provisioning.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/dmutilserver/group/DMUtilServer.mmp --- a/policymanagement/dmutilserver/group/DMUtilServer.mmp Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/dmutilserver/group/DMUtilServer.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -48,6 +48,10 @@ MW_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets + + #ifdef __TARM_SYMBIAN_CONVERGENCY SYSTEMINCLUDE /Epoc32/include/devman SYSTEMINCLUDE /Epoc32/include/syncml @@ -56,11 +60,13 @@ #endif // __TARM_SYMBIAN_CONVERGENCY // Symbian -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY bafl.lib -LIBRARY centralrepository.lib -LIBRARY flogger.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY centralrepository.lib +LIBRARY flogger.lib +LIBRARY HbCore.lib +LIBRARY HbWidgets.lib #ifdef __TARM_SYMBIAN_CONVERGENCY LIBRARY dmtreeclient.lib diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/dmutilserver/src/DMUtilSession.cpp --- a/policymanagement/dmutilserver/src/DMUtilSession.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/dmutilserver/src/DMUtilSession.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -31,7 +31,8 @@ #include #include - +#include +#include #include @@ -48,6 +49,10 @@ _LIT( MDriveColon, ":"); _LIT( KMMCEraseFlagFileName, "fmmc.dat"); +_LIT(KDMSettingsIndicatorType, "com.nokia.devicemanagement.settingsindicatorplugin/1.0"); +_LIT(KTarmTrustManagementActive, "ManagementActive"); +_LIT(KTarmTrustTerminalSecurity, "TerminalSecurity"); + // MACROS @@ -339,6 +344,9 @@ //get terminal security and management state from centrep TInt terminalSecurity = 0; TInt err( KErrNone ); + + CHbIndicatorSymbian *ind = CHbIndicatorSymbian::NewL(); + CleanupStack::PushL(ind); if ( !aCenRep) { @@ -357,19 +365,34 @@ if ( CDMUtilServer::iManagementActive ) { RDEBUG(" iManagementActive is ETrue -> ECoreAppUIsTarmMngActiveIndicatorOn"); - err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsTarmIndicator, ECoreAppUIsTarmMngActiveIndicatorOn); + //err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsTarmIndicator, ECoreAppUIsTarmMngActiveIndicatorOn); + + CHbSymbianVariant* parameter = CHbSymbianVariant::NewL(&KTarmTrustManagementActive, + CHbSymbianVariant::EDes); + ind->Activate(KDMSettingsIndicatorType, parameter ); + delete parameter; + } else if ( terminalSecurity ) { RDEBUG(" terminalSecurity is ETrue -> ECoreAppUIsTarmTerminalSecurityOnIndicatorOn"); - err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsTarmIndicator, ECoreAppUIsTarmTerminalSecurityOnIndicatorOn); + //err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsTarmIndicator, ECoreAppUIsTarmTerminalSecurityOnIndicatorOn); + + CHbSymbianVariant* parameter = CHbSymbianVariant::NewL(&KTarmTrustTerminalSecurity, + CHbSymbianVariant::EDes); + ind->Activate(KDMSettingsIndicatorType, parameter ); + delete parameter; } else { RDEBUG(" terminalSecurity is EFalse -> ECoreAppUIsTarmIndicatorsOff"); - err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsTarmIndicator, ECoreAppUIsTarmIndicatorsOff); + //err = RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsTarmIndicator, ECoreAppUIsTarmIndicatorsOff); + + ind->Deactivate(KDMSettingsIndicatorType); } + CleanupStack::PopAndDestroy(ind); + if( err != KErrNone ) { RDEBUG8_2("CDMUtilSession::SetIndicatorStateL ERROR: %d",err); diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/group/PolicyEngineServer.mmp --- a/policymanagement/policyengine/group/PolicyEngineServer.mmp Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/policyengine/group/PolicyEngineServer.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -59,6 +59,10 @@ SYSTEMINCLUDE /epoc32/include/platform/comms-infras/commdb/protection #endif +SYSTEMINCLUDE /epoc32/include/mw/hb/hbcore +SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets + + LIBRARY euser.lib LIBRARY efsrv.lib LIBRARY xmlframework.lib @@ -75,6 +79,7 @@ LIBRARY commsdat.lib LIBRARY flogger.lib LIBRARY featmgr.lib -LIBRARY inetprotutil.lib +LIBRARY HbWidgets.lib HbCore.lib +LIBRARY inetprotutil.lib SMPSAFE diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/group/bld.inf --- a/policymanagement/policyengine/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/policyengine/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -29,7 +29,7 @@ ../rom/policyengine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(policyengine.iby) ../rom/policyengineresources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(policyengineresources.iby) -../policyengineui/loc/PolicyEngineUI.loc MW_LAYER_LOC_EXPORT_PATH(policyengineui.loc) +//../policyengineui/loc/PolicyEngineUI.loc MW_LAYER_LOC_EXPORT_PATH(policyengineui.loc) PRJ_MMPFILES PolicyEngineClient.mmp diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengine.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengine.pro Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,25 @@ +# +# 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: Policy Engine project file +# +TEMPLATE = subdirs + +SUBDIRS += policyengineui + +CONFIG += ordered + +symbian: { +SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + } diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineserver/inc/PolicyProcessor.h --- a/policymanagement/policyengine/policyengineserver/inc/PolicyProcessor.h Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/policyengine/policyengineserver/inc/PolicyProcessor.h Tue Jul 13 09:51:41 2010 +0530 @@ -28,6 +28,9 @@ #include "RequestContext.h" #include "PolicyStorage.h" #include +#include +#include +#include // CONSTANTS // MACROS @@ -142,6 +145,34 @@ TInt iProcessorState; }; + +//Class to launch PolicyEngine Dialog +class CProcessorClient: public CActive,public MHbDeviceDialogObserver +{ +public: + CProcessorClient(); + ~CProcessorClient(); + TInt LaunchDialog(const TDesC8& aFringerPrint, const TDesC8& aServerName); + // from MHbDeviceDialogObserver + void DataReceived(CHbSymbianVariantMap& aData); + void DeviceDialogClosed(TInt aCompletionCode); + +protected: + // from CActive + void DoCancel(); + void RunL(); + TInt WaitUntilDeviceDialogClosed(); + void LaunchTrustNotificationDialog(const TDesC8& aServerName); +private: + CHbDeviceDialogSymbian* iDevDialog; + CActiveSchedulerWait* iWait; + TInt iCompletionCode; + TInt iUserResponse; +}; + + + + class TCombiningAlgorith { public: diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineserver/src/PolicyProcessor.cpp --- a/policymanagement/policyengine/policyengineserver/src/PolicyProcessor.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/policyengine/policyengineserver/src/PolicyProcessor.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -30,12 +30,19 @@ #include "PolicyEngineServer.h" #include "PolicyEngineClientServer.h" #include "debug.h" - -#include "PolicyEngineUi.h" - +#include +#include +#include // CONSTANTS const TUid KUidPolicyEngineUi = { 0x10207817 }; +const TUint KDelimeterChar = '|'; +_LIT8( KUserAcceptMark, "A"); +enum TUserResponse + { + EUserAccept, + EUserDeny, + }; // ----------------------------------------------------------------------------- // RAttributeContainer::AppendL() @@ -746,52 +753,24 @@ //resolve name and fingerprint const TDesC8& name = iTrustedSession->CommonNameForSubjectL( trustedSubject, iUseEditedElements); const TDesC8& fingerPrint = iTrustedSession->FingerPrintForSubjectL( trustedSubject, iUseEditedElements); - + TPtrC8 ptr = fingerPrint.Left(4); // send only first 4 digits. + + RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &fingerPrint); + RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &ptr); + + RDEBUG8_2("CPolicyProcessor::fingerPrint: %S", &fingerPrint); + RDEBUG8_2("CPolicyProcessor::fingerPrint: %S", &ptr); + TUserResponse response = EUserDeny; - if ( name.Length() && fingerPrint.Length()) - { - //create notifier -/* RNotifier notifier; - CleanupClosePushL( notifier); - User::LeaveIfError( notifier.Connect() ); -*/ - //create parameter descriptor - TBuf8<100> responseBuf; - HBufC8 * data = HBufC8::NewLC( name.Length() + fingerPrint.Length() + 1); - TPtr8 ptr = data->Des(); - ptr.Append(name); - ptr.Append(KDelimeterChar); - ptr.Append(fingerPrint.Left(4)); + CProcessorClient *client = new CProcessorClient(); + TInt res = client->LaunchDialog(ptr, name); + + if(res == 0) + response = EUserAccept; + else + response = EUserDeny; - //create CAsyncHandler to Auto start/stop CActiveScheduler - CASyncHandler * async = CASyncHandler::NewLC(); -// notifier.StartNotifierAndGetResponse( async->GetRequestStatus(), KUidPolicyEngineUi, ptr, responseBuf); - - //Start CActiveScheduler and execute stop when request is completed - async->WaitForRequest(); - CPolicyEngineServer::SetActiveSubSession( this); - - - if ( async->GetRequestStatus() > 0) //request pending... - { -// notifier.CancelNotifier( KUidPolicyEngineUi); - } - else - { - //Check response - if ( responseBuf == KUserAcceptMark) - { - RDEBUG("PolicyEngineServer: CPolicyProcessor user accept corporate policy!"); - response = EUserAccept; - } - } - - // CleanupStack::PopAndDestroy( 3, ¬ifier); //notifier, data, CASyncHandler - CleanupStack::PopAndDestroy( 2); - - - } MakeBooleanResponseL( response == EUserAccept, aResponseElement); } @@ -980,6 +959,185 @@ } +// ----------------------------------------------------------------------------- +// CProcessorClient::CProcessorClient() +// ----------------------------------------------------------------------------- +// + +CProcessorClient::CProcessorClient() + : CActive(EPriorityNormal) + { + CActiveScheduler::Add( this ); + iWait = new( ELeave ) CActiveSchedulerWait; + iCompletionCode = KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CProcessorClient::~CProcessorClient() +// ----------------------------------------------------------------------------- +CProcessorClient::~CProcessorClient() + { + delete iWait; + } + + +// ----------------------------------------------------------------------------- +// CProcessorClient::DataReceived() +// ----------------------------------------------------------------------------- +void CProcessorClient::DataReceived(CHbSymbianVariantMap& aData) +{ + _LIT(KResponse, "keyResponse"); + const CHbSymbianVariant* key = aData.Get(KResponse); + + if(key) + { + TInt *res = key->Value(); + iCompletionCode = *res; + iUserResponse = *res; + } +} + + +// ----------------------------------------------------------------------------- +// CProcessorClient::DeviceDialogClosed() +// ----------------------------------------------------------------------------- +void CProcessorClient::DeviceDialogClosed(TInt aCompletionCode) + { + iCompletionCode = aCompletionCode; + //iDevDialog->Cancel(); + TRequestStatus* status(&iStatus); + User::RequestComplete(status, KErrNone); + } + + +// ----------------------------------------------------------------------------- +// CProcessorClient::DoCancel() +// ----------------------------------------------------------------------------- +void CProcessorClient::DoCancel() +{ + if (iWait && iWait->IsStarted() && iWait->CanStopNow()) + { + iCompletionCode = KErrCancel; + iWait->AsyncStop(); + } +} + + +// ----------------------------------------------------------------------------- +// CProcessorClient::RunL() +// ----------------------------------------------------------------------------- +void CProcessorClient::RunL() +{ + if (iWait) + { + iWait->AsyncStop(); + } +} + + +// ----------------------------------------------------------------------------- +// CProcessorClient::LaunchDialog() +// ----------------------------------------------------------------------------- +TInt CProcessorClient::LaunchDialog(const TDesC8& aFringerPrint, + const TDesC8& aServerName) + { + _LIT(KHbNotifier,"com.nokia.hb.policymanagementdialog/1.0"); + _LIT(KFingerPrint, "fingerprint"); + _LIT(KServerdisplayname, "serverdisplayname"); + + RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &aFringerPrint); + RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &aServerName); + + CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); + CleanupStack::PushL(varMap); + + TBuf<10> fingerBuf; + fingerBuf.Copy(aFringerPrint); + + TInt serverNameLen = aServerName.Length(); + TBuf<50> serverName; + serverName.Copy(aServerName); + + RDEBUG_2("CPolicyProcessor::16 fingerPrint: %S", &fingerBuf); + RDEBUG_2("CPolicyProcessor::16 serverName : %S", &serverName); + + CHbSymbianVariant* fingerprintid = CHbSymbianVariant::NewL(&fingerBuf, + CHbSymbianVariant::EDes); + + CHbSymbianVariant* serverdisplayname = CHbSymbianVariant::NewL( + &serverName, CHbSymbianVariant::EDes); + + RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &fingerprintid); + RDEBUG_2("CPolicyProcessor::fingerPrint: %S", &serverdisplayname); + + varMap->Add(KFingerPrint, fingerprintid); + varMap->Add(KServerdisplayname, serverdisplayname); + + iDevDialog = CHbDeviceDialogSymbian::NewL(); + TInt err1 = iDevDialog->Show(KHbNotifier, *varMap, this); + TInt err = WaitUntilDeviceDialogClosed(); + + CleanupStack::PopAndDestroy(); + + if (iDevDialog) + { + iDevDialog->Cancel(); + delete iDevDialog; + iDevDialog = NULL; + } + + if (err == 0) + { + LaunchTrustNotificationDialog(aServerName); + } + + return iUserResponse; + } + + +// ----------------------------------------------------------------------------- +// CProcessorClient::WaitUntilDeviceDialogClosed() +// ----------------------------------------------------------------------------- +TInt CProcessorClient::WaitUntilDeviceDialogClosed() + { + iCompletionCode = KErrInUse; + if (!IsActive() && iWait && !iWait->IsStarted()) + { + iStatus = KRequestPending; + SetActive(); + iWait->Start(); + } + return iCompletionCode; + } + +void CProcessorClient::LaunchTrustNotificationDialog(const TDesC8& aServerName) +{ + _LIT(KFileName, "deviceupdates_"); + _LIT(KPath, "z:/resource/qt/translations/"); + _LIT(KDialogIcon, "note_info.svg"); + + TBool result = HbTextResolverSymbian::Init(KFileName, KPath); + + if (result) { + _LIT(KTrustEstablished,"txt_device_update_dpophead_trust_established"); + _LIT(KServerID,"txt_deviceupdate_dpopinfo_trust_establised_with_1"); + + HBufC* trustEstablishedText = HbTextResolverSymbian::LoadL(KTrustEstablished); + CleanupStack::PushL(trustEstablishedText); + + HBufC* serveridbuf = HBufC::NewLC(aServerName.Length()); + TPtr serveridbufptr = serveridbuf->Des(); + serveridbufptr.Copy(aServerName); + + HBufC* serverid = HbTextResolverSymbian::LoadL(KServerID,*serveridbuf); + CleanupStack::PushL(serverid); + + CHbDeviceNotificationDialogSymbian::NotificationL(KDialogIcon, *trustEstablishedText, *serverid); + + CleanupStack::PopAndDestroy(3); //trustEstablishedText,serveridbuf,serverid + } +} // ----------------------------------------------------------------------------- // TCombiningAlgorith::TCombiningAlgorith() diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/InputDialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengineui/InputDialog.docml Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/PolicyEngineUI.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengineui/PolicyEngineUI.pro Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,49 @@ +# Copyright (c) 2000 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 policymanagement components + + +TEMPLATE = lib +TARGET = PolicyEngUINotifiersplugin +CONFIG += hb\ + plugin + +DESTDIR = $${HB_BUILD_DIR}/plugins/devicedialogs + +QT += core \ + gui +HEADERS += ./inc/PolicyEngUINotifierplugin.h \ + ./inc/PolicyEngineUI.h +SOURCES += ./src/PolicyEngNotifierplugin.cpp \ + ./src/PolicyEngineUI.cpp +RESOURCES += PolicyEngineUI.qrc +LIBS += -lflogger + +symbian: { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = CAP_GENERAL_DLL + TARGET.UID3 = 0x10207817 + + hblib.sources = Hb.dll + hblib.path = \sys\bin + hblib.depends = "(0xEEF9EA38), 1, 0, 0, {\"Hb\"}" + + pluginstub.sources = PolicyEngUINotifiersplugin.dll + pluginstub.path = /resource/plugins/devicedialogs + DEPLOYMENT += pluginstub + } + !local { + target.path = $${HB_PLUGINS_DIR}/devicedialogs + INSTALLS += target +} + diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/PolicyEngineUI.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengineui/PolicyEngineUI.qrc Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,6 @@ + + + dialog.docml + InputDialog.docml + + diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/data/10207817.rss --- a/policymanagement/policyengine/policyengineui/data/10207817.rss Tue Jul 13 09:37:43 2010 +0530 +++ /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: Implementation of policymanagement components -* -*/ -// -// 10207817.RSS -// -// App-framework notifier plug-in resource file. -// - -#include -#include - -RESOURCE REGISTRY_INFO r_registry - { - dll_uid = 0x10207817; //should match name of this file - interfaces = - { - INTERFACE_INFO - { - interface_uid = KUikonUidPluginInterfaceNotifiers; // need to create this uid in the uid database - implementations = - { - IMPLEMENTATION_INFO - { - implementation_uid = 0x10207817; - version_no = 1; - display_name = "Policy Engine UI dialog"; - default_data = "TLS policyengine fialog"; - opaque_data = "0"; - } - }; - } - }; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/data/PolicyEngineUI.rss --- a/policymanagement/policyengine/policyengineui/data/PolicyEngineUI.rss Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2002-2004 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 PolicyEngineUI module. -* -*/ - - -NAME COUI - -#include -#include -#include -#include -#include -#include "policyengineui.hrh" -#include - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf = ""; } - -//------------------------------------------------------------------------------ -// -// r_policyengineui_confirmation_query -// Defines a common confirmation dialog with cancel softkey for policyengine ui -// -//------------------------------------------------------------------------------ -// - - -RESOURCE DIALOG r_policyengineui_confirmation_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - bmpfile = "z:\\resource\\apps\\avkon2.mbm"; - bmpid = EMbmAvkonQgn_note_info; - bmpmask = EMbmAvkonQgn_note_info_mask; - }; - } - }; - } - -//------------------------------------------------------------------------------ -// -// r_policyengineui_confirmation -// Defines a common confirmation dialog without cancel softkey for policyengine ui -// -//------------------------------------------------------------------------------ -// - -RESOURCE DIALOG r_policyengineui_confirmation - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_EMPTY; - items= - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationQueryLayout; - bmpfile = "z:\\resource\\apps\\avkon2.mbm"; - bmpid = EMbmAvkonQgn_note_info; - bmpmask = EMbmAvkonQgn_note_info_mask; - }; - } - }; - } - -//------------------------------------------------------------------------------ -// -// r_policyengineui_data_query -// Defines a common data query dialog for policyengine ui -// -//------------------------------------------------------------------------------ -// - -RESOURCE DIALOG r_policyengineui_data_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - control = EDWIN - { - flags = EEikEdwinNoHorizScrolling|EEikEdwinResizable; - lines = 1; - maxlength = RANDOM_PART_MAX_SIZE; - }; - }; - } - }; - } - -//------------------------------------------------------------------------------ -// -// r_swcommon_general_wait_dialog -// Defines a common wait dialog -// -//------------------------------------------------------------------------------ -// - -RESOURCE DIALOG r_policy_engine_possession_info - { - flags = EGeneralQueryFlags | EEikDialogFlagNoShadow; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items= - { - DLG_LINE - { - type = EAknCtPopupHeadingPane; - id = EAknMessageQueryHeaderId; - control = AVKON_HEADING - { - }; - }, - DLG_LINE - { - type = EAknCtMessageQuery; - id = EAknMessageQueryContentId; - control = AVKON_MESSAGE_QUERY - { - }; - } - }; - } - - -//------------------------------------------------------------------------------ -// -// String definitions -// -//------------------------------------------------------------------------------ -// - -//Confirmation dialog strings - -RESOURCE TBUF r_policyengineui_control_note_header { buf = qtn_policyengineui_control_note_header; } -RESOURCE TBUF r_policyengineui_control_note { buf = qtn_policyengineui_control_note; } -RESOURCE TBUF r_policyengineui_question_note { buf = qtn_policyengineui_question_note ;} -RESOURCE TBUF r_policyengineui_remove_note { buf = ""; } -RESOURCE TBUF r_policyengineui_denied_note { buf = qtn_policyengineui_denied_note; } -RESOURCE TBUF r_policyengineui_unmatch_note { buf = qtn_policyengineui_unmatch_note; } -RESOURCE TBUF r_policyengineui_security_info_note { buf = qtn_policyengineui_security_info_note; } -RESOURCE TBUF r_policyengineui_trust_established { buf = qtn_trust_established; } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/dialog.docml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengineui/dialog.docml Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/inc/Logger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengineui/inc/Logger.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2000 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 policymanagement components +* +*/ + +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#ifdef _DEBUG + #define LOGGING_ENABLED +#endif +#ifdef LOGGING_ENABLED // This must be enabled to use logging system + +#define LOGGER_LOGGING // Log to Logger + + + +#ifdef LOGGER_LOGGING + +// INCLUDES +#include + +// LOG SETTINGS +_LIT( KPMUILogFolder, "TARM" ); +_LIT( KPMUILogFile, "PMUI.TXT" ); + +#endif + +// CONSTANTS +// None. + +// MACROS +/* +----------------------------------------------------------------------------- + + INTERNAL MACROs. + + DO NOT USE THESE DIRECTLY !!! + SEE EXTERNAL MACROS + +----------------------------------------------------------------------------- +*/ + +#ifdef LOGGER_LOGGING + +_LIT( KTextFormat, "%S%S" ); +_LIT( KPnpUtil, "PnpUtil| " ); + +#define INTRLOGTEXT( AAA ) \ + { \ + RFileLogger::Write( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, AAA ); \ + } +#define INTRLOGSTRING( AAA ) \ + { \ + _LIT( tempLogDes, AAA ); \ + RFileLogger::Write( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, tempLogDes() ); \ + } +// 20 chars is left for the formatted item +#define INTRLOGSTRING2( AAA, BBB ) \ + { \ + _LIT( tempLogDes, AAA ); \ + RFileLogger::WriteFormat( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, TRefByValue( tempLogDes()), BBB ); \ + } +// 40 chars is left for the formatted items +#define INTRLOGSTRING3( AAA, BBB, CCC ) \ + { \ + _LIT( tempLogDes, AAA ); \ + RFileLogger::WriteFormat( KPMUILogFolder(), KPMUILogFile(), EFileLoggingModeAppend, TRefByValue( tempLogDes()), BBB, CCC ); \ + } +#else +#define INTRLOGTEXT( AAA ) +#define INTRLOGSTRING( AAA ) +#define INTRLOGSTRING2( AAA, BBB ) +#define INTRLOGSTRING3( AAA, BBB, CCC ) +#endif + +/* +----------------------------------------------------------------------------- + + EXTERNAL MACROs + + USE THESE MACROS IN YOUR CODE ! + +----------------------------------------------------------------------------- +*/ + + +#define LOGTEXT( AAA ) { \ + INTRLOGTEXT( AAA ); \ + } // Example: LOGTEXT( own_desc ); + +#define LOGSTRING( AAA ) { \ + INTRLOGSTRING( AAA ); \ + } // Example: LOGSTRING( "Test" ); + +#define LOGSTRING2( AAA, BBB ) { \ + INTRLOGSTRING2( AAA, BBB ); \ + } // Example: LOGSTRING( "Test %i", aValue ); + +#define LOGSTRING3( AAA, BBB, CCC ) { \ + INTRLOGSTRING3( AAA, BBB, CCC ); \ + } // Example: LOGSTRING( "Test %i %i", aValue1, aValue2 ); + + +#else // LOGGING_ENABLED + +#define LOGTEXT( AAA ) +#define LOGSTRING( AAA ) +#define LOGSTRING2( AAA, BBB ) +#define LOGSTRING3( AAA, BBB, CCC ) + +#endif // LOGGING_ENABLED + +// DATA TYPES +// None. + +// FUNCTION PROTOTYPES +// None. + +// FORWARD DECLARATIONS +// None. + +// CLASS DECLARATION +// None. + +#endif // __LOGGER_H__ diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/inc/PolicyEngUINotifierplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengineui/inc/PolicyEngUINotifierplugin.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2000 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 policymanagement components +* +*/ + +#ifndef POLICYENGUINOTIFIERPLUGIN_H_ +#define POLICYENGUINOTIFIERPLUGIN_H_ + +#include + + +class PolicyEngUINotifierplugin : public HbDeviceDialogPlugin + { + +public: + PolicyEngUINotifierplugin(); + ~PolicyEngUINotifierplugin(); + + //interface between client and plugin + HbDeviceDialogInterface *createDeviceDialog( + const QString &deviceDialogType, const QVariantMap ¶meters); + + bool accessAllowed(const QString &deviceDialogType, + const QVariantMap ¶meters, + const QVariantMap &securityInfo) const; + + bool deviceDialogInfo(const QString &deviceDialogType, + const QVariantMap ¶meters, DeviceDialogInfo *info) const; + QStringList deviceDialogTypes() const; + PluginFlags pluginFlags() const; + int error() const; + }; +#endif /* POLICYENGUINOTIFIERPLUGIN_H_ */ diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/inc/PolicyEngineUi.h --- a/policymanagement/policyengine/policyengineui/inc/PolicyEngineUi.h Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/policyengine/policyengineui/inc/PolicyEngineUi.h Tue Jul 13 09:51:41 2010 +0530 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2000 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" @@ -13,153 +13,55 @@ * * Description: Implementation of policymanagement components * -* */ - -#ifndef POLICTY_ENGINE_UI_HEADER_ -#define POLICTY_ENGINE_UI_HEADER_ - -// INCLUDES -#include -#include - -// CONSTANTS +#ifndef POLICYENGINEUI_H +#define POLICYENGINEUI_H -_LIT8( KUserAcceptMark, "A"); -_LIT8( KUserDenyMark, "D"); -const TUint KDelimeterChar = '|'; +#include +#include -enum TUserResponse - { - EUserAccept, - EUserDeny, - }; - -// FORWARD DECLARATIONS - -class CCoeEnv; -class CPolicyEngineUi; - +class HbDialog; +class HbLineEdit; -class CPolicyEngineNotifier : public CBase, public MEikSrvNotifierBase2 - { - public: - - CPolicyEngineNotifier(); - ~CPolicyEngineNotifier(); - static CPolicyEngineNotifier* NewL(); - void ConstructL(); - - void Complete( TUserResponse aResponse); - - public: //From MEikSrvNotifierBase2 - - void Release(); - TNotifierInfo RegisterL(); - TNotifierInfo Info() const; - TPtrC8 StartL(const TDesC8& aBuffer); - void StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage); - void Cancel(); - TPtrC8 UpdateL(const TDesC8& aBuffer); - - private: - CPolicyEngineUi * iPolicyEngineUi; - - /** - * refers connections is intialized or not - */ - TNotifierInfo iInfo; ///< Notifier info - - TInt iReplySlot; - RMessagePtr2 iMessage; - }; +class PolicyEngineUI : public HbDialog, public HbDeviceDialogInterface + { +Q_OBJECT - - -/** -* This class provides a wrapper for some common dialogs for the policy engine -* -* @lib policyengineui.lib -*/ -class CPolicyEngineUi : public CActive - { - public: // Constructors and destructor +public: + PolicyEngineUI(const QVariantMap& parameters); + ~PolicyEngineUI(); + void DisplayNotificationDialog(const QVariantMap ¶meters); + void ShowInputDialog(); + bool verifyFingerPrint(); - /** - * Constructor. - */ - CPolicyEngineUi(); - - /** - * Two-phased constructor. - */ - static CPolicyEngineUi* NewL(); - - /** - * Destructor. - */ - virtual ~CPolicyEngineUi(); - - void ActivateL( const TDesC8& aCorporate, const TDesC8& aRandomPart, CPolicyEngineNotifier* iNotifier); - - void RunL(); - void DoCancel(); - - public: +public slots: + void onOKSelected(); + void onCancelSelected(); + void establishTrust(); + void cancelTrust(); + void onTrustCreation(); + void codeTextChanged(); +public: + //derived from HbDeviceDialogInterface + bool setDeviceDialogParameters(const QVariantMap ¶meters); + int deviceDialogError() const; + void closeDeviceDialog(bool byClient); + HbDialog *deviceDialogWidget() const; - /** - * Execute corporate policy question chain, which user deny or accept. One response generated. - * @param aCorporate - Corparate name used in queries - * @param aRandomPart - Random part of certificate, which user must know. - * @return TUserResponse - Response value for user - */ - - TUserResponse ShowCorporateConfirmationDialogL( const TDesC8& aCorporate, - const TDesC8& aRandomPart); - private: - - //private enums - enum TDialog - { - EControl = 0, - EQuestion, - ERemove, - EDenied, - EUnMatch - }; - - enum TDlgResp - { - EOkResp, - ECancelResp - }; - - private: - - /** - * Two-phased constructor. - */ - void ConstructL(); +signals: + //signal to be sent to client + void deviceDialogClosed(); + void deviceDialogData(QVariantMap data); + +private: + // number of tries user does + int estbTrustCount; + QString iServerName; + QString iFingerprint; + QString iCode; + HbLineEdit *mContentEdit; + HbDialog* mdialog; + }; - - TInt ShowDialogL( const TDialog& aDialog); - TDlgResp ShowConfirmationQueryL( const TDesC& aText, const TBool& aWithCancel ); - TDlgResp ShowPossessionMessageQueryL(); - TDlgResp DataQueryL( const TDesC& aText, TDes& aInput ); - - private: // Data - - HBufC * iCorporate; - HBufC * iRandomPart; - TInt iState; - CPolicyEngineNotifier * iNotifier; - - TInt iResourceFileOffset; - CCoeEnv* iCoeEnv; // not owned - }; - - -#endif // POLICTY_ENGINE_UI_HEADER_ - -// End of File +#endif // POLICYENGINEUI_H diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/inc/policyengineui.hrh --- a/policymanagement/policyengine/policyengineui/inc/policyengineui.hrh Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2003 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: contains common definitions for menu id:s -* -*/ - - -#ifndef POLICYENGINEUI_HRH -#define POLICYENGINEUI_HRH - -#define RANDOM_PART_MAX_SIZE 4 - -#endif // APPINST -// End of File diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/loc/PolicyEngineUI.loc --- a/policymanagement/policyengine/policyengineui/loc/PolicyEngineUI.loc Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2005 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 files contains localised strings for policy engine ui -* -*/ - - -//------------------------------------------------------------------------------ -// Confirmation dialogs -//------------------------------------------------------------------------------ - -//d: Text in an first info note header in corporate policy installation -//d: Informs that corporate policy request is received from administrator -//l: heading_pane_t1 -//w: -//r:3.1 -// -#define qtn_policyengineui_control_note_header "Security info" - - -//d: Text in an first info note in corporate policy installation -//d: Informs that corporate policy request is received from administrator -//d: %U describes corporate name from certificate -//l: popup_info_list_pane_t1 -//w: -//r:3.1 -// -#define qtn_policyengineui_control_note "%U want to control your terminal. It means possibility to see, delete and control data. Accept control?" - - -//d: Text in an user input dialog, when user have to input part of certificate to confirm corporate policy -//d: %U describes corporate name from certificate -//l: popup_query_data_window -//w: -//r:3.1 -// -#define qtn_policyengineui_question_note "Write first 4 numbers of %U fingerprint" - -//d: Text in an dialog which informs user that the trust has been established -//l: popup_note_window -//w: -//r:3.2.2, 3.2.3, 5.0 -// -#define qtn_trust_established "Trust established" - -//d: Text in an dialog which informs that user denied corporate control -//d: %U describes corporate name from certificate -//l: popup_note_window -//w: -//r:3.1 -// -#define qtn_policyengineui_denied_note "%U Control request denied" - -//d: Text in an dialog which informs that user input is invalid -//l: popup_note_window -//w: -//r:3.1 -// -#define qtn_policyengineui_unmatch_note "Input does not match. Please try again" - -//d: Text in an dialog which informs that this is a security info -//l: popup_note_window -//w: -//r:3.1 -// -#define qtn_policyengineui_security_info_note "Security info" - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/src/PolicyEngNotifierplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policyengine/policyengineui/src/PolicyEngNotifierplugin.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2000 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 policymanagement components +* +*/ + +#include +#include "PolicyEngUINotifierplugin.h" +#include "PolicyEngineUI.h" + +Q_EXPORT_PLUGIN2(PolicyEngUINotifiersplugin, PolicyEngUINotifierplugin) + +static const struct + { + const char *mTypeString; + } dialogInfos[] = + { + { + "com.nokia.hb.policymanagementdialog/1.0" + } + }; + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::PolicyEngUINotifierplugin() +// ----------------------------------------------------------------------------- +PolicyEngUINotifierplugin::PolicyEngUINotifierplugin() + { + //policyEngUI = new QtPolicyEngineUI(); + } + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::~PolicyEngUINotifierplugin() +// ----------------------------------------------------------------------------- +PolicyEngUINotifierplugin::~PolicyEngUINotifierplugin() + { + //delete policyEngUI; + } + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::createDeviceDialog() +// ----------------------------------------------------------------------------- +HbDeviceDialogInterface* PolicyEngUINotifierplugin::createDeviceDialog( + const QString &deviceDialogType, const QVariantMap ¶meters) + { + Q_UNUSED(deviceDialogType); + // policyEngUI->DisplayNotificationDialog(parameters); + return new PolicyEngineUI(parameters); + } + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::accessAllowed() +// Check if client is allowed to use device dialog widget +// ----------------------------------------------------------------------------- +bool PolicyEngUINotifierplugin::accessAllowed( + const QString &deviceDialogType, const QVariantMap ¶meters, + const QVariantMap &securityInfo) const + { + Q_UNUSED(deviceDialogType); + Q_UNUSED(parameters); + Q_UNUSED(securityInfo); + // This plugin doesn't perform operations that may compromise security. + // All clients are allowed to use. + return true; + } + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::deviceDialogInfo() +// ----------------------------------------------------------------------------- +bool PolicyEngUINotifierplugin::deviceDialogInfo( + const QString &deviceDialogType, const QVariantMap ¶meters, + DeviceDialogInfo *info) const + { + Q_UNUSED(deviceDialogType); + Q_UNUSED(parameters); + info->group = GenericDeviceDialogGroup; + info->flags = NoDeviceDialogFlags; + info->priority = DefaultPriority; + return true; + } + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::deviceDialogTypes() +// Return device dialog types this plugin implements +// ----------------------------------------------------------------------------- +QStringList PolicyEngUINotifierplugin::deviceDialogTypes() const + { + QStringList types; + const int numTypes = sizeof(dialogInfos) / sizeof(dialogInfos[0]); + for (int i = 0; i < numTypes; i++) + { + types.append(dialogInfos[i].mTypeString); + } + + return types; + } + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::pluginFlags() +// Return plugin flags +// ----------------------------------------------------------------------------- +HbDeviceDialogPlugin::PluginFlags PolicyEngUINotifierplugin::pluginFlags() const + { + return NoPluginFlags; + } + + +// ----------------------------------------------------------------------------- +// PolicyEngUINotifierplugin::error() +// Return last error +// ----------------------------------------------------------------------------- +int PolicyEngUINotifierplugin::error() const + { + return 0; + } diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/policyengineui/src/PolicyEngineUi.cpp --- a/policymanagement/policyengine/policyengineui/src/PolicyEngineUi.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/policyengine/policyengineui/src/PolicyEngineUi.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2000 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" @@ -11,533 +11,436 @@ * * Contributors: * -* Description: This file contains the implementation of PolicyEngineUI +* Description: Implementation of policymanagement components * */ - -// INCLUDE FILES -#include "PolicyEngineUi.h" -#include "debug.h" -#include "policyengineui.hrh" -#include +#include "PolicyEngineUI.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Logger.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "SyncService.h" - -#include - - -_LIT( KCUIResourceFileName, "PolicyEngineUIDlgs.rsc" ); -const TUid KUidPolicyEngineUi = { 0x10207817 }; -const TUid KScreenOutputChannel = { 0x0000781F }; - -LOCAL_C void CreateNotifiersL( CArrayPtrFlat* aNotifiers ); +const int KMaxTries = 4; +const int KMaxCodeLength = 4; -// --------------------------------------------------------- -// CArrayPtr* NotifierArray() -// --------------------------------------------------------- -// - -LOCAL_C void CreateNotifiersL( CArrayPtrFlat* aNotifiers ) -{ - MEikSrvNotifierBase2 *policyEngineNotifier = CPolicyEngineNotifier::NewL(); - - CleanupStack::PushL( policyEngineNotifier ); - aNotifiers->AppendL( policyEngineNotifier ); - CleanupStack::Pop( policyEngineNotifier ); // serNotify - RDEBUG("PolicyEngineUI notifier created!"); -} - - - -CArrayPtr* NotifierArray() - { - CArrayPtrFlat* array = - new CArrayPtrFlat( 1 ); - - if (array) - { - TRAPD( err, CreateNotifiersL( array ) ); - if (err != KErrNone) - { - delete array; - array = NULL; - } - } - return array; +// ----------------------------------------------------------------------------- +// PolicyEngineUI::PolicyEngineUI() +// ----------------------------------------------------------------------------- +PolicyEngineUI::PolicyEngineUI(const QVariantMap& parameters) + { + estbTrustCount = KMaxTries; + DisplayNotificationDialog(parameters); } -const TImplementationProxy ImplementationTable[] = { {{0x10207817},(TProxyNewLPtr)NotifierArray} }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - RDEBUG("PolicyEngineUI notifier detected!"); - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy) ; - return ImplementationTable; - } - - -CPolicyEngineNotifier::CPolicyEngineNotifier() - { - } - +// ----------------------------------------------------------------------------- +// PolicyEngineUI::~PolicyEngineUI() +// ----------------------------------------------------------------------------- +PolicyEngineUI::~PolicyEngineUI() + { -CPolicyEngineNotifier::~CPolicyEngineNotifier() - { - //delete and close policy engine ui - delete iPolicyEngineUi; - } + } -CPolicyEngineNotifier* CPolicyEngineNotifier::NewL() - { - CPolicyEngineNotifier* self = new (ELeave) CPolicyEngineNotifier(); - - CleanupStack::PushL( self); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - } - -void CPolicyEngineNotifier::ConstructL() - { - } - +// ----------------------------------------------------------------------------- +// PolicyEngineUI::DisplayNotificationDialog() +// Read the parameters sent from client +// ----------------------------------------------------------------------------- +void PolicyEngineUI::DisplayNotificationDialog(const QVariantMap& parameters) + { + LOGSTRING( "+ DisplayNotificationDialog +" ); + QVariantMap::const_iterator i = parameters.constBegin(); -void CPolicyEngineNotifier::Release() - { - delete this; - } - + while (i != parameters.constEnd()) + { + if (i.key().toAscii() == "serverdisplayname") + { + iServerName = i.value().toString(); + } + else if (i.key().toAscii() == "fingerprint") + { + iFingerprint = i.value().toString(); + } + ++i; + } + + TBuf<50> server(iServerName.utf16()); + TBuf<10> buffer(iFingerprint.utf16()); -CPolicyEngineNotifier::TNotifierInfo CPolicyEngineNotifier::RegisterL() - { - //Registration info - iInfo.iUid = KUidPolicyEngineUi; - iInfo.iPriority = ENotifierPriorityHigh; - iInfo.iChannel = KScreenOutputChannel; - - return iInfo; - } + LOGSTRING2( "serverdisplayname %S", &server ); + LOGSTRING2( "fingerprint %S", &buffer ); - -CPolicyEngineNotifier::TNotifierInfo CPolicyEngineNotifier::Info() const - { - //Registration info - return iInfo; - } + ShowInputDialog(); + LOGSTRING( "- DisplayNotificationDialog -" ); + } -TPtrC8 CPolicyEngineNotifier::StartL(const TDesC8& /*aBuffer*/) - { - return KNullDesC8().Ptr(); - } - - -void CPolicyEngineNotifier::Complete( TUserResponse aResponse) - { - RDEBUG("CPolicyEngineNotifier::Complete"); +// ----------------------------------------------------------------------------- +// PolicyEngineUI::ShowInputDialog() +// Show the accept control dialog +// ----------------------------------------------------------------------------- +void PolicyEngineUI::ShowInputDialog() + { + LOGSTRING( "+ ShowInputDialog +" ); + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/dialog.docml", &ok); + if (!ok) + { + return; + } - //Write return value to message and compeltes it - if ( aResponse == EUserAccept ) - { - iMessage.Write( iReplySlot, KUserAcceptMark, 0); - } - else - { - iMessage.Write( iReplySlot, KUserDenyMark, 0); - } - - iManager->CancelNotifier( iInfo.iUid ); // Notify framework we've done - iMessage.Complete( KErrNone); - } + HbDialog *dialog1 = + qobject_cast (loader.findWidget("dialog")); - -void CPolicyEngineNotifier::StartL(const TDesC8& aBuffer, TInt aReplySlot, const RMessagePtr2& aMessage) - { - RDEBUG("CPolicyEngineNotifier::StartL!"); + //set heading content + HbLabel *contentheading = qobject_cast (loader.findWidget( + "qtl_dialog_pri_heading")); + QString heading(hbTrId("txt_device_update_title_security_information")); + contentheading->setPlainText(heading); - TInt index = aBuffer.Locate( KDelimeterChar); - - if ( index != KErrNotFound && !iPolicyEngineUi) - { - //decode name and fingerprint from message - TPtrC8 name = aBuffer.Left( index); - TPtrC8 fingerPrint = aBuffer.Mid( index + 1); + //set body content + HbLabel *contentbody = qobject_cast (loader.findWidget( + "qtl_dialog_pri5")); - iReplySlot = aReplySlot; - iMessage = aMessage; + QString body( + (hbTrId("txt_device_update_info_1_server_wants_to_contro").arg( + iServerName))); + contentbody->setTextWrapping(Hb::TextWordWrap); + contentbody->setPlainText(body); + + HbAction *primaryAction = qobject_cast ( + dialog1->actions().at(0)); + HbAction *secondaryAction = qobject_cast ( + dialog1->actions().at(1)); - //Show policy engine ui dialogs - iPolicyEngineUi = CPolicyEngineUi::NewL(); - iPolicyEngineUi->ActivateL( name, fingerPrint, this); - } - else - { - Complete( EUserDeny); - } - } + //set dialog properties + dialog1->setTimeout(HbPopup::NoTimeout); + dialog1->setDismissPolicy(HbPopup::NoDismiss); - -void CPolicyEngineNotifier::Cancel() - { - RDEBUG("CPolicyEngineNotifier::Cancel!"); + QObject::connect(primaryAction, SIGNAL(triggered()), this, + SLOT(onOKSelected())); + QObject::connect(secondaryAction, SIGNAL(triggered()), this, + SLOT(onCancelSelected())); - //Delete policy engine ui - delete iPolicyEngineUi; - iPolicyEngineUi = 0; - } + if (dialog1) + dialog1->show(); + + LOGSTRING( "- ShowInputDialog -" ); + } -TPtrC8 CPolicyEngineNotifier::UpdateL(const TDesC8& /*aBuffer*/) - { - return KNullDesC8().Ptr(); - } +// ----------------------------------------------------------------------------- +// PolicyEngineUI::onOKSelected() +// Show the user input dialog once control is accepted +// ----------------------------------------------------------------------------- +void PolicyEngineUI::onOKSelected() + { + + LOGSTRING( "+ onOKSelected +" ); + + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/InputDialog.docml", &ok); + if (!ok) + { + return; + } + + mdialog = qobject_cast (loader.findWidget("dialog")); + + //set heading content + HbLabel *contentheading = qobject_cast (loader.findWidget( + "qtl_dialog_pri_heading")); + QString heading(hbTrId("txt_device_update_title_security_information")); + contentheading->setPlainText(heading); -CPolicyEngineUi::CPolicyEngineUi() - : CActive( EPriorityStandard) - { + //set label + HbLabel *contentlabel = qobject_cast (loader.findWidget( + "HeadingLabel")); + contentlabel->setTextWrapping(Hb::TextWordWrap); + QString label( + (hbTrId("txt_device_update_info_enter_first_4_characters_of").arg( + iServerName))); + contentlabel ->setPlainText(label); + + //set length for editline + mContentEdit = qobject_cast (loader.findWidget("InputLine")); + mContentEdit->setMaxLength(KMaxCodeLength); + + //set dialog properties + mdialog->setTimeout(HbPopup::NoTimeout); + mdialog->setDismissPolicy(HbPopup::NoDismiss); + + HbAction* primaryAction = (HbAction*) (mdialog->actions().at(0)); + HbAction *secondaryAction = (HbAction*) (mdialog->actions().at(1)); + primaryAction->setEnabled(false); + + QObject::connect(primaryAction, SIGNAL(triggered()), this, + SLOT(establishTrust())); + QObject::connect(secondaryAction, SIGNAL(triggered()), this, + SLOT(cancelTrust())); + QObject::connect(mContentEdit, SIGNAL(contentsChanged()), this, + SLOT(codeTextChanged())); + + if (mdialog) + mdialog->show(); + + LOGSTRING( "- onOKSelected -" ); } -void CPolicyEngineUi::ConstructL() - { - RDEBUG("CPolicyEngineUi::ConstructL!"); - - //get pointer to CEikonEnv - iCoeEnv = CEikonEnv::Static(); - - if ( !iCoeEnv ) - { - RDEBUG("Policy engine ui: CoeEnv not found!"); - User::Leave( KErrGeneral ); - } - //Open resource file - TFileName fileName; - fileName.Zero(); +// ----------------------------------------------------------------------------- +// PolicyEngineUI::onCancelSelected() +// ----------------------------------------------------------------------------- +void PolicyEngineUI::onCancelSelected() + { + LOGSTRING( "+ onCancelSelected +" ); - TFileName drivePath; - Dll::FileName( drivePath ); - - fileName.Append( TParsePtrC( drivePath ).Drive() ); - fileName.Append( KDC_RESOURCE_FILES_DIR ); - fileName.Append( KCUIResourceFileName ); - - BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); + QVariantMap result; - //handle to resource file - iResourceFileOffset = iCoeEnv->AddResourceFileL( fileName ); - - RDEBUG("Policy engine ui resources loaded!"); - } - -CPolicyEngineUi* CPolicyEngineUi::NewL() - { - CPolicyEngineUi* self = new ( ELeave ) CPolicyEngineUi(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } + result.insert("keyResponse", -1); + emit + deviceDialogData(result); - -CPolicyEngineUi::~CPolicyEngineUi() - { - RDEBUG("CPolicyEngineUi::~CPolicyEngineUi()"); + emit + deviceDialogClosed(); - // Close non-modal dialogs - if( iResourceFileOffset ) - { - iCoeEnv->DeleteResourceFile( iResourceFileOffset ); - } - - delete iCorporate; - delete iRandomPart; - } + LOGSTRING( "- onCancelSelected -" ); + } -void CPolicyEngineUi::ActivateL( const TDesC8& aCorporate, const TDesC8& aRandomPart, CPolicyEngineNotifier* aNotifier) - { - RDEBUG("CPolicyEngineUi::ActivateL"); - - //reference to notifier (for message completion) - iNotifier = aNotifier; - - //allocate new space for parameters and save them - delete iCorporate; - iCorporate = NULL; - delete iRandomPart; - iRandomPart = NULL; - iCorporate = HBufC::NewL( aCorporate.Length()); - iRandomPart = HBufC::NewL( aRandomPart.Length()); - - iCorporate->Des().Copy( aCorporate); - iRandomPart->Des().Copy( aRandomPart); - - //add active object to active scheduler and set object active - CActiveScheduler::Add( this); - SetActive(); - - //complete request.... - TRequestStatus * status = &iStatus; - User::RequestComplete( status, KErrNone); - } - - - -void CPolicyEngineUi::RunL() - { - RDEBUG("CPolicyEngineUi::RunL()"); - - //in state ERemove user has already accepted query - if ( ERemove == iState ) - { - //show info, remove from scheduler - ShowDialogL( ERemove); - Deque(); - iNotifier->Complete( EUserAccept); - return; - } - - if ( EDenied == iState ) - { - //show info, remove from scheduler - ShowDialogL( EDenied); - Deque(); - iNotifier->Complete( EUserDeny); - return; - } +// ----------------------------------------------------------------------------- +// PolicyEngineUI::onTrustCreation() +// ----------------------------------------------------------------------------- +void PolicyEngineUI::onTrustCreation() + { + LOGSTRING( "+ onTrustCreation +" ); + QVariantMap result; - //Control dialog - if ( EUserAccept == ShowDialogL( (TDialog) iState)) - { - //if user cancel dialog, show deny-dialog and return - iState = iState + 1; - } - else - { - //user press cancel -> state = EDenied - iState = EDenied; - } - - //set active and complete message - SetActive(); - TRequestStatus * status = &iStatus; - User::RequestComplete( status, KErrNone); - } - - - -void CPolicyEngineUi::DoCancel() - { - } - - + result.insert("keyResponse", 0); + emit + deviceDialogData(result); -CPolicyEngineUi::TDlgResp CPolicyEngineUi::ShowConfirmationQueryL( - const TDesC& aText, const TBool& aWithCancel) - { - //create dialog - CAknQueryDialog* note = - CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone ); - - //select correct text resource - TInt resource = R_POLICYENGINEUI_CONFIRMATION_QUERY; - - if ( !aWithCancel ) - { - resource = R_POLICYENGINEUI_CONFIRMATION; - } - - //execute dialog, dialog contains self destruction - TInt response = note->ExecuteLD( resource, aText ); - - if ( response ) - { - return EOkResp; - } - - return ECancelResp; - } + emit + deviceDialogClosed(); - -CPolicyEngineUi::TDlgResp CPolicyEngineUi::DataQueryL( const TDesC& aText, TDes& aInput ) - { - - //Create dialog with reference to input descriptor - CAknTextQueryDialog* dlg = - CAknTextQueryDialog::NewL( aInput, CAknQueryDialog::ENoTone); - - //set prompt - CleanupStack::PushL( dlg); - dlg->SetPromptL( aText); - CleanupStack::Pop(); - - //execute dialog, dialog contains self destruction - TInt response = dlg->ExecuteLD( R_POLICYENGINEUI_DATA_QUERY); - - if ( response ) - { - return EOkResp; - } - - return ECancelResp; - } + LOGSTRING( "- onTrustCreation -" ); + } -TInt CPolicyEngineUi::ShowDialogL( const TDialog& aDialog) - { - TInt response = EUserDeny; +// ----------------------------------------------------------------------------- +// PolicyEngineUI::establishTrust() +// ----------------------------------------------------------------------------- +void PolicyEngineUI::establishTrust() + { + LOGSTRING( "+ establishTrust +" ); + bool retVal; // return value from code verification API. + estbTrustCount--; + retVal = verifyFingerPrint(); + + if (retVal) + { + LOGSTRING( "Trust Created" ); + //Reset the counter. + estbTrustCount = 0; + onTrustCreation(); - //select correct dialog - switch ( aDialog) - { - case EControl : - { - response = ShowPossessionMessageQueryL(); - break; - } - case ERemove: - { - //load resource - HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_TRUST_ESTABLISHED ); - - TInt length1 = displayString->Length(); - HBufC16* trustString = HBufC16::NewLC ( length1 ); - TPtr bufPtr = trustString -> Des(); - bufPtr.Append (*displayString); - // Hide background connecting note - CSyncService *syncService = - CSyncService::NewL(NULL, KDevManServiceStart); - if (syncService) - { - syncService->EnableProgressNoteL(EFalse); - } + } + else + { + //check the number of tries. + if (estbTrustCount == 0) + { + //Access denied. + LOGSTRING( "Access Denied" ); + HbMessageBox *msgBox = new HbMessageBox(); + msgBox->setHeadingWidget(new HbLabel(hbTrId( + "txt_device_update_title_security_information"))); + + msgBox->setText(hbTrId( + "txt_device_update_info_security_info_access_denied")); + msgBox->setTimeout(HbDialog::NoTimeout); + msgBox->setDismissPolicy(HbDialog::NoDismiss); + + HbAction *action = (HbAction*) (msgBox->actions().at(0)); + QObject::connect(action, SIGNAL(triggered()), this, + SLOT(onCancelSelected())); - delete syncService; - - response = ShowConfirmationQueryL( *trustString, EFalse); - CleanupStack::PopAndDestroy(); - CleanupStack::PopAndDestroy(); - - break; - } - case EDenied: - { - //load resource - TBuf<100> array(*iCorporate); - HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_DENIED_NOTE, array); - - //show dialog and get response - response = ShowConfirmationQueryL( *displayString, EFalse); - //delete resource - CleanupStack::PopAndDestroy(); - - break; - } - case EUnMatch: - { - //load resource - HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_UNMATCH_NOTE); - - //show dialog and get response - response = ShowConfirmationQueryL( *displayString, ETrue); - //delete resource - CleanupStack::PopAndDestroy(); - - break; - } - case EQuestion: - { - //question note prompt - TBuf<100> array(*iCorporate); - HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_QUESTION_NOTE,array); - TBuf input; - TBool ready = EFalse; + msgBox->show(); + } + else + { + LOGSTRING2( "tries left %i", estbTrustCount ); + //Code didnot match. + HbDocumentLoader loader; + bool ok = false; + loader.load(":/xml/InputDialog.docml", &ok); + if (!ok) + { + return; + } + + mdialog = qobject_cast (loader.findWidget("dialog")); + + //set heading content + HbLabel *contentheading = qobject_cast ( + loader.findWidget("qtl_dialog_pri_heading")); + contentheading->setTextWrapping(Hb::TextWordWrap); + QString heading(hbTrId( + "txt_device_update_title_security_information")); + contentheading->setPlainText(heading); - //until cancel pressed or valid user gives valid certificate part - while ( !ready) - { - //data query - CPolicyEngineUi::TDlgResp resp = DataQueryL( *displayString, input); - if ( resp == EUserAccept ) - { - if ( input.CompareF( *iRandomPart) != 0) - { - //if user input doesn't match - if ( EUserDeny == ShowDialogL( EUnMatch)) - { - //if user cancel dialog, show deny-dialog and return - response = EUserDeny; - break; - } - } - else - { - response = EUserAccept; - ready = ETrue; - } - } - else - { - //if user cancel dialog, show deny-dialog and return - response = EUserDeny; - break; - } - } - - //delete resource - CleanupStack::PopAndDestroy(); - break; - } - default: - break; - } - - return response; - } + //set label + HbLabel *contentlabel = qobject_cast ( + loader.findWidget("HeadingLabel")); + QString + label( + (hbTrId( + "txt_device_update_info_security_information_did_no").arg( + estbTrustCount))); + + contentlabel->setTextWrapping(Hb::TextWordWrap); + contentlabel->setPlainText(label); + + mContentEdit = qobject_cast (loader.findWidget( + "InputLine")); + mContentEdit->setMaxLength(KMaxCodeLength); + + mdialog->setTimeout(HbPopup::NoTimeout); + mdialog->setDismissPolicy(HbPopup::NoDismiss); + + HbAction* primaryAction = qobject_cast ( + mdialog->actions().at(0)); + HbAction *secondaryAction = qobject_cast ( + mdialog->actions().at(1)); + primaryAction->setEnabled(false); + + QObject::connect(primaryAction, SIGNAL(triggered()), this, + SLOT(establishTrust())); + QObject::connect(secondaryAction, SIGNAL(triggered()), this, + SLOT(cancelTrust())); + QObject::connect(mContentEdit, SIGNAL(contentsChanged()), this, + SLOT(codeTextChanged())); + + if (mdialog) + mdialog->show(); + } + } + LOGSTRING( "- establishTrust -" ); + } -CPolicyEngineUi::TDlgResp CPolicyEngineUi::ShowPossessionMessageQueryL() - { - HBufC* securityInfoString = StringLoader::LoadLC( R_POLICYENGINEUI_SECURITY_INFO_NOTE ); - TBuf<60> buffer; - buffer.Copy( *securityInfoString ); - CleanupStack::PopAndDestroy( securityInfoString ); - - //load resource - TBuf<100> array(*iCorporate); - HBufC* displayString = StringLoader::LoadLC( R_POLICYENGINEUI_CONTROL_NOTE, array); - - - //show dialog and get response - CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL( *displayString ); - dlg->PrepareLC( R_POLICY_ENGINE_POSSESSION_INFO ); - dlg->QueryHeading()->SetTextL( buffer ); - TInt response = dlg->RunLD(); - - CleanupStack::PopAndDestroy(); - - if ( response ) - { - return EOkResp; - } - - return ECancelResp; - } +// ----------------------------------------------------------------------------- +// PolicyEngineUI::cancelTrust() +// ----------------------------------------------------------------------------- +void PolicyEngineUI::cancelTrust() + { + LOGSTRING( "+ cancelTrust +" ); + //Reset the counter. + estbTrustCount = 0; + + QVariantMap result; + result.insert("keyResponse", -1); + emit + deviceDialogData(result); + + emit + deviceDialogClosed(); + LOGSTRING( "- cancelTrust -" ); + } + + +// ----------------------------------------------------------------------------- +// PolicyEngineUI::setDeviceDialogParameters() +// ----------------------------------------------------------------------------- +bool PolicyEngineUI::setDeviceDialogParameters(const QVariantMap ¶meters) + { + Q_UNUSED(parameters); + LOGSTRING( "+ setDeviceDialogParameters +" ); + return true; + } + + +// ----------------------------------------------------------------------------- +// PolicyEngineUI::deviceDialogError() +// Get error +// ----------------------------------------------------------------------------- +int PolicyEngineUI::deviceDialogError() const + { + LOGSTRING( "+ deviceDialogError +" ); + return 0; + } +// ----------------------------------------------------------------------------- +// PolicyEngineUI::PolicyEngineUI() +// Close device dialog +// ----------------------------------------------------------------------------- +void PolicyEngineUI::closeDeviceDialog(bool byClient) + { + Q_UNUSED(byClient); + LOGSTRING( "+ closeDeviceDialog +" ); + close(); + } + + +// ----------------------------------------------------------------------------- +// PolicyEngineUI::PolicyEngineUI() +// Return display widget +// ----------------------------------------------------------------------------- +HbDialog *PolicyEngineUI::deviceDialogWidget() const + { + LOGSTRING( "+ deviceDialogWidget +" ); + return const_cast (this); + } +// ----------------------------------------------------------------------------- +// PolicyEngineUI::PolicyEngineUI() +// Verify the user entered code +// ----------------------------------------------------------------------------- +bool PolicyEngineUI::verifyFingerPrint() + { + LOGSTRING( "+ verifyFingerPrint +" ); + QString enteredCode = mContentEdit->text(); + TBuf<10> buffer(enteredCode.utf16()); + + LOGSTRING2( "User entered code %i", &buffer); + LOGSTRING2( "User entered code %S", &buffer); + + if (enteredCode.compare(iFingerprint, Qt::CaseInsensitive) == 0) + { + LOGSTRING( "+ fingerprint MATCH !!!! +" ); + return true; + } + else + { + LOGSTRING( "+ fingerprint DOESNOT MATCH +" ); + return false; + } + } + + +// ----------------------------------------------------------------------------- +// PolicyEngineUI::codeTextChanged() +// checks the entered text length and enables the OK option accordingly. +// ----------------------------------------------------------------------------- +void PolicyEngineUI::codeTextChanged() + { + QString str = mContentEdit->text(); + + if (str.length() >= KMaxCodeLength) + mdialog->actions().at(0)->setEnabled(true); + else + mdialog->actions().at(0)->setEnabled(false); + } diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policyengine/rom/policyengine.iby --- a/policymanagement/policyengine/rom/policyengine.iby Tue Jul 13 09:37:43 2010 +0530 +++ b/policymanagement/policyengine/rom/policyengine.iby Tue Jul 13 09:51:41 2010 +0530 @@ -23,8 +23,10 @@ S60_APP_EXE(PolicyEngineServer) S60_APP_EXE(CentRepToolServer) file=ABI_DIR\BUILD_DIR\CentRepTool.dll SHARED_LIB_DIR\CentRepTool.dll - ECOM_PLUGIN(PolicyEngineUI.dll, PolicyEngineUI.rsc) ECOM_PLUGIN(PMRFsPlugin.dll, PMRFsPlugin.rsc) + +data=/epoc32/data/z/resource/plugins/devicedialogs/PolicyEngUINotifiersplugin.qtplugin resource/plugins/devicedialogs/PolicyEngUINotifiersplugin.qtplugin +file=ABI_DIR/BUILD_DIR/PolicyEngUINotifiersplugin.dll SHARED_LIB_DIR/PolicyEngUINotifiersplugin.dll //#endif #endif diff -r a36219ae6585 -r 2e64dc50f295 policymanagement/policymanagement.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/policymanagement/policymanagement.pro Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,25 @@ +# +# 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: Policy Management project file +# +TEMPLATE = subdirs + +SUBDIRS += policyengine + +CONFIG += ordered + +symbian: { +SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + } diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt.pro Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,26 @@ +# +# 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: Remote Management project file +# +TEMPLATE = subdirs + +SUBDIRS += policymanagement \ + fotaapplication + +CONFIG += ordered + +symbian: { +SYMBIAN_PLATFORMS = WINSCW \ + ARMV5 + } diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/devicemgmt_dialogs_api/group/bld.inf --- a/remotemgmt_plat/devicemgmt_dialogs_api/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/remotemgmt_plat/devicemgmt_dialogs_api/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -24,4 +24,5 @@ PRJ_EXPORTS -../inc/devicedialogconsts.h MW_LAYER_PLATFORM_EXPORT_PATH(devicedialogconsts.h) \ No newline at end of file +../inc/devicedialogconsts.h MW_LAYER_PLATFORM_EXPORT_PATH(devicedialogconsts.h) +../inc/dmindicatorconsts.h MW_LAYER_PLATFORM_EXPORT_PATH(dmindicatorconsts.h) \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/devicemgmt_dialogs_api/inc/devicedialogconsts.h --- a/remotemgmt_plat/devicemgmt_dialogs_api/inc/devicedialogconsts.h Tue Jul 13 09:37:43 2010 +0530 +++ b/remotemgmt_plat/devicemgmt_dialogs_api/inc/devicedialogconsts.h Tue Jul 13 09:51:41 2010 +0530 @@ -8,16 +8,17 @@ #ifndef DEVICEDIALOGCONSTS_H_ #define DEVICEDIALOGCONSTS_H_ +#include +#include /// Number of retries for PIN const TInt KPinRetries = 3; // PIN Max Length - const int KCPPinMaxLength = 20; + const TInt KCPPinMaxLength = 20; //Strings for CP PIN Query Dialog const QString pinquery = "omacppinquery"; -const QString returnkey = "returnkey"; const char devicedialogtype[] = "com.nokia.hb.devicemanagementdialog/1.0"; _LIT(KDeviceDialogType, "com.nokia.hb.devicemanagementdialog/1.0"); @@ -28,6 +29,15 @@ const QString keyparam1 = "Param1"; const QString keyparam2 = "Param2"; const QString keyparam3 = "Param3"; +const QString keyparam4 = "Param4"; +const QString returnkey = "returnkey"; + +_LIT(KKeyDialog, "Dialog"); +_LIT(KKeyParam1, "Param1"); +_LIT(KKeyParam2, "Param2"); +_LIT(KKeyParam3, "Param3"); +_LIT(KKeyParam4, "Param4"); +_LIT(KResult,"returnkey"); // Enumerations to show the type of dialog to be shown from FOTA. The Enumeration ranges from 1 to 100. @@ -37,6 +47,7 @@ EFwDLNeedMoreMemory = 100, EFwDLConnectionFailure, EFwDLGeneralFailure, + EFwDLNonResumableFailure, //Updated related notes EFwUpdNotEnoughBattery, diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/devicemgmt_dialogs_api/inc/dmindicatorconsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/devicemgmt_dialogs_api/inc/dmindicatorconsts.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,30 @@ +/* + * dmindicatorconsts.h + * + * Created on: Apr 20, 2010 + * Author: gnataraj + */ + +#ifndef DMINDICATORCONSTS_H_ +#define DMINDICATORCONSTS_H_ + +#include + +//Indicators strings +const QString KDMProgressIndicatorType = + "com.nokia.devicemanagement.progressindicatorplugin/1.0"; +const QString KDMNotificationIndicatorType = + "com.nokia.devicemanagement.notificationindicatorplugin/1.0"; +const QString KDMSettingsIndicatorType = + "com.nokia.devicemanagement.settingsindicatorplugin/1.0"; +const QString KScomoProgressIndicatorType = + "com.nokia.scomo.progressindicatorplugin/1.0"; +const QString KScomoNotificationIndicatorType = + "com.nokia.scomo.notificationindicatorplugin/1.0"; + + +const QString KTarmTrustManagementActive = "ManagementActive"; +const QString KTarmTrustTerminalSecurity = "TerminalSecurity"; + + +#endif /* DMINDICATORCONSTS_H_ */ diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_constant_definitions_api/inc/nsmldmconst.h --- a/remotemgmt_plat/dm_constant_definitions_api/inc/nsmldmconst.h Tue Jul 13 09:37:43 2010 +0530 +++ b/remotemgmt_plat/dm_constant_definitions_api/inc/nsmldmconst.h Tue Jul 13 09:51:41 2010 +0530 @@ -27,6 +27,13 @@ // SyncML notification MIME type _LIT( KNSmlDMNotificationMIMEType, "application/vnd.syncml.notification" ); // FOTA +const TUid KPSUidNSmlSOSServerKey = {0x101F99FB}; +const TUint32 KNSmlDMSilentJob = 0x0000005; +enum TDmSessionType +{ +ESilent = 1, +ENonSilent +}; const TInt KNSmlDMResetGenAlerts = -2; const TInt KNSmlMaxInt32Length = 10; // FOTA end diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/dm_device_dialog_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/dm_device_dialog_api.metaxml Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,18 @@ + + + DM Device Dialogs API + DM Device Dialogs + c++ + devicemgmtnotifications + + + + + + + + + yes + no + + diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006 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: File that exports the files belonging to +: DM Device Dialog API +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/dmdevdialogclient.h MW_LAYER_PLATFORM_EXPORT_PATH(dmdevdialogclient.h) + diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/inc/dmdevdialogclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/inc/dmdevdialogclient.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,105 @@ +/* +* 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 Dm device dialog client +* +*/ + +#ifndef __DMDEVDIALOG_H__ +#define __DMDEVDIALOG_H__ + +#include +#include + +class RDmDevDialog : public RSessionBase + { + public: + /** + * Launches Dm device dialog server + * @param None + * @return None + */ + IMPORT_C TInt OpenL(); + + /** + * Close server connection + * @param None + * @return None + */ + IMPORT_C void Close(); + + /** + * Asynchronous call to launche package zero device dialog + * @param aProfileId, ProfileId of the DM server + * @param ajobId, Id of the DM job created due to package zero + * @param aUimode, Server alert ui mode type + * @param aResponse, Response from device dialog + * @param aStatus, Status variable set after request completion + * @return None + */ + IMPORT_C void LaunchPkgZero( const TInt& aProfileId, const TInt& ajobId, + const TInt& aUimode, TDes8& aResponse,TRequestStatus& aStatus); + + + /** + * Synchronous call to check whether server alert + * connect note shown or not. + * @param aConectNoteShown, Status of the server alert connect note + * @return None. + */ + IMPORT_C TInt IsPkgZeroConnectNoteShown(TInt& aConectNoteShown); + + /** + * Synchronous call to dismiss connect dialog. + * Ongoing DM session won't stop. + * @param None. + * @return None. + */ + IMPORT_C TInt DismissConnectDialog(); + + /** + * Synchronous call to Show connect dialog, if connect dialog dismissed + * earlier + * @param None + * @return None. + */ + IMPORT_C TInt ShowConnectDialog(); + + /** + * Asynchronous call to Show Display(1100) alert dialog + * @param aNoteDisplayText, Text to be displayed on the note + * @param aStatus, Status variable set after request completion + * @return None. + */ + IMPORT_C void ShowDisplayAlert(const TDesC& aNoteDisplayText,TRequestStatus& aStatus); + + /** + * Asynchronous call to Show Confirmation(1101) alert dialog + * @param aTimeout, Timeout of the dialog. + * @param aNoteDisplayText, Text to be displayed on the note + * @param aNoteHeader, Text to be displayed as dialog header + * @param aStatus, Status variable set after request completion + * @return None. + */ + IMPORT_C void ShowConfirmationAlert(const TInt& aTimeout,const TDesC& aNoteHeader, + const TDesC& aNoteDisplayText,TRequestStatus& aStatus); + + /** + * Cancels earlier package zero note, if user doesn't respond + * @param None. + * @return None. + */ + IMPORT_C TInt CancelPkgZeroNote(); +}; + +#endif diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/conf/dmdevicedialogstest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/conf/dmdevicedialogstest.cfg Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,72 @@ +[Test] +title Example +create dmdevicedialogstest foobar +foobar Example pa ra me ters +delete foobar +[Endtest] + +[Test] +title ShowOnlyPkgZeroNoteL +create dmdevicedialogstest foobar +foobar ShowOnlyPkgZeroNoteL pa ra me ters +delete foobar +[Endtest] + +[Test] +pause 2000 +title ShowPkgZeroandConnectNoteL +create dmdevicedialogstest foobar +foobar ShowPkgZeroandConnectNoteL pa ra me ters +pause 9000 +foobar DismissConnectNoteL +pause 2000 +foobar ShowConnectNoteAgainL +delete foobar +[Endtest] + +[Test] +title JobCancelHide +create dmdevicedialogstest foobar +foobar ShowPkgZeroandConnectNoteL pa ra me ters +delete foobar +[Endtest] + +[Test] +pause 2000 +title ShowDisplayAlertL +create dmdevicedialogstest foobar +foobar ShowDisplayAlertL pa ra me ters +pause 2000 +delete foobar +[Endtest] + + +[Test] +pause 2000 +title ShowConfirmationAlertL +create dmdevicedialogstest foobar +foobar ShowConfirmationAlertL pa ra me ters +delete foobar +[Endtest] + +[Test] +title SilentPkgZeroL +create dmdevicedialogstest foobar +foobar SilentPkgZeroL +delete foobar +[Endtest] + +[Test] +title DefaultProfilePkgZeroL +create dmdevicedialogstest foobar +foobar DefaultProfilePkgZeroL +delete foobar +[Endtest] + +[Test] + +title realsilent +create dmdevicedialogstest foobar +foobar ShowPkgZeroandConnectNoteL +delete foobar +[Endtest] \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,59 @@ +/* +* 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: test code componnet for dm device dialogs +* This is part of remotemgmt_plat. +* +*/ + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// defaults to WINS MARM so you can ignore this if you just build these + + DEFAULT + +PRJ_TESTEXPORTS +// NOTE: If using ARS requirements all export operations should be done under this. +// 'abld test export' + +PRJ_EXPORTS +// Specify the source file followed by its destination here +// copy will be used to copy the source file to its destination +// If there's no destination then the source file will be copied +// to the same name in /epoc32/include +// Example: +/* +/agnmodel/inc/AGMCOMON.H +*/ + +PRJ_TESTMMPFILES + + dmdevicedialogstest.mmp + +PRJ_MMPFILES + +// Specify the .mmp files required for building the important component +// releasables. +// +// Specify "tidy" if the component you need to build doesn't need to be +// released. Specify "ignore" if the MMP file exists but should be +// ignored. +// Example: +/* +/agnmodel/group/agnmodel.mmp +#if defined(MARM) +/agnmodel/group/agsvexe.mmp +#endif +*/ + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/group/dmdevicedialogstest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/group/dmdevicedialogstest.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,78 @@ +/*TYPE TESTCLASS*/ +/* +* 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: MMP file for STIF Test Framework's TestScripter +* testclass test module. +* +*/ + +#include +#include +SMPSAFE + +TARGET dmdevicedialogstest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ +// SECUREID 0x00000000 + +//TARGETPATH ?target_path +DEFFILE dmdevicedialogstest.def + +USERINCLUDE ../inc + +OS_LAYER_SYSTEMINCLUDE +MW_LAYER_SYSTEMINCLUDE + +SOURCEPATH ../src + +SOURCE dmdevicedialogstest.cpp +SOURCE dmdevicedialogstestBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY dmdevdialogclient.lib NSmlPrivateAPI.lib centralrepository.lib +LANG SC + +/* +START WINS +?wins_specific_information +END + +START MARM +?marm_specific_information +END +*/ +// Other possible keywords: + +// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) +/* +START BITMAP ?target +TARGETPATH ?emulated_path_on_target_machine +HEADER +SOURCE ?color_depth ?source_bitmap +END +*/ +// DEFFILE ?filename +// AIF ?filename + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/group/dmdevicedialogstest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/group/dmdevicedialogstest.pkg Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,60 @@ +; +; 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 STIF +; + +; Languages +&EN + +; Provide value for uid +#{"STIF"},(0x00000000),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Logo +; None + +; Package signature - Optional +; None + +; Start of Package body + +; Condition blocks +; None + +; Options list +; None + +; Install files +"\epoc32\release\armv5\udeb\dmdevicedialogstest.dll" - "!:\Sys\Bin\dmdevicedialogstest.dll" + +; Embedded SIS +; None + +; End of Package body + +; PKG dependencies +; None + +; PKG capabilities +; None diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/inc/dmdevicedialogstest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/inc/dmdevicedialogstest.h Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,194 @@ +/* +* 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: STIF testclass declaration +* +*/ + +#ifndef DMDEVICEDIALOGSTEST_H +#define DMDEVICEDIALOGSTEST_H + +// INCLUDES +#include +#include +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KdmdevicedialogstestLogPath, "\\logs\\testframework\\dmdevicedialogstest\\" ); +// Log file +_LIT( KdmdevicedialogstestLogFile, "dmdevicedialogstest.txt" ); +_LIT( KdmdevicedialogstestLogFileWithTitle, "dmdevicedialogstest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cdmdevicedialogstest; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cdmdevicedialogstest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cdmdevicedialogstest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cdmdevicedialogstest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cdmdevicedialogstest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + protected: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + protected: // Functions from base classes + + /** + * From ?base_class ?member_description + */ + //?type ?member_function(); + + private: + + /** + * C++ default constructor. + */ + Cdmdevicedialogstest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + // Prohibit copy constructor if not deriving from CBase. + // ?classname( const ?classname& ); + // Prohibit assigment operator if not deriving from CBase. + // ?classname& operator=( const ?classname& ); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + + virtual TInt ShowOnlyPkgZeroNoteL( CStifItemParser& aItem ); + virtual TInt ShowPkgZeroandConnectNoteL( CStifItemParser& aItem ); + virtual TInt ShowConnectNoteAgainL( CStifItemParser& aItem ); + virtual TInt DismissConnectNoteL( CStifItemParser& aItem ); + virtual TInt IsConnectNoteShownL( CStifItemParser& aItem ); + virtual TInt ShowDisplayAlertL( CStifItemParser& aItem ); + virtual TInt ShowConfirmationAlertL( CStifItemParser& aItem ); + virtual TInt CancelPkgZeroNoteL( CStifItemParser& aItem ); + virtual TInt SilentPkgZeroL( CStifItemParser& aItem ); + virtual TInt DefaultProfilePkgZeroL( CStifItemParser& aItem ); + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + // ?one_line_short_description_of_data + //?data_declaration; + + // Reserved pointer for future extension + //TAny* iReserved; + + public: // Friend classes + //?friend_class_declaration; + protected: // Friend classes + //?friend_class_declaration; + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // DMDEVICEDIALOGSTEST_H + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/init/dmdevicedialogs.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/init/dmdevicedialogs.ini Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,218 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + # 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= testscripter +TestCaseFile= c:\TestFramework\dmdevicedialogstest.cfg +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +#CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +#HardwareBasePath= D:\LOGS\TestFramework\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/src/dmdevicedialogstest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/src/dmdevicedialogstest.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,199 @@ +/* +* 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 testclass implementation. +* +*/ + +// INCLUDE FILES +#include +#include "dmdevicedialogstest.h" +#include + +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cdmdevicedialogstest::Cdmdevicedialogstest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cdmdevicedialogstest::Cdmdevicedialogstest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cdmdevicedialogstest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cdmdevicedialogstest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KdmdevicedialogstestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KdmdevicedialogstestLogFile); + } + + iLog = CStifLogger::NewL( KdmdevicedialogstestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cdmdevicedialogstest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cdmdevicedialogstest* Cdmdevicedialogstest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cdmdevicedialogstest* self = new (ELeave) Cdmdevicedialogstest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cdmdevicedialogstest::~Cdmdevicedialogstest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cdmdevicedialogstest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cdmdevicedialogstest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("dmdevicedialogstest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) Cdmdevicedialogstest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/dm_device_dialog_api/tsrc/src/dmdevicedialogstestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remotemgmt_plat/dm_device_dialog_api/tsrc/src/dmdevicedialogstestBlocks.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,412 @@ +/* +* 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 testclass implementation. +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "dmdevicedialogstest.h" +#include +#include +#include +#include +// EXTERNAL DATA STRUCTURES +//extern ?external_data; + +// EXTERNAL FUNCTION PROTOTYPES +//extern ?external_function( ?arg_type,?arg_type ); + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def + +// LOCAL CONSTANTS AND MACROS +//const ?type ?constant_var = ?constant; +//#define ?macro_name ?macro_def + +// MODULE DATA STRUCTURES +//enum ?declaration +//typedef ?declaration + +// LOCAL FUNCTION PROTOTYPES +//?type ?function_name( ?arg_type, ?arg_type ); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// ============================= LOCAL FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// ?function_name ?description. +// ?description +// Returns: ?value_1: ?description +// ?value_n: ?description_line1 +// ?description_line2 +// ----------------------------------------------------------------------------- +// +/* +?type ?function_name( + ?arg_type arg, // ?description + ?arg_type arg) // ?description + { + + ?code // ?comment + + // ?comment + ?code + } +*/ + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Cdmdevicedialogstest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cdmdevicedialogstest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cdmdevicedialogstest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cdmdevicedialogstest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "Example", Cdmdevicedialogstest::ExampleL ), + ENTRY( "ShowOnlyPkgZeroNoteL", Cdmdevicedialogstest::ShowOnlyPkgZeroNoteL ), + ENTRY("ShowPkgZeroandConnectNoteL",Cdmdevicedialogstest::ShowPkgZeroandConnectNoteL), + ENTRY("DismissConnectNoteL",Cdmdevicedialogstest::DismissConnectNoteL), + ENTRY("ShowConnectNoteAgainL",Cdmdevicedialogstest::ShowConnectNoteAgainL), + ENTRY("ShowDisplayAlertL",Cdmdevicedialogstest::ShowDisplayAlertL), + ENTRY("ShowConfirmationAlertL",Cdmdevicedialogstest::ShowConfirmationAlertL), + ENTRY("CancelPkgZeroNoteL",Cdmdevicedialogstest::CancelPkgZeroNoteL), + ENTRY("SilentPkgZeroL",Cdmdevicedialogstest::SilentPkgZeroL), + ENTRY("DefaultProfilePkgZeroL",Cdmdevicedialogstest::DefaultProfilePkgZeroL), + + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cdmdevicedialogstest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cdmdevicedialogstest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI +/* _LIT( Kdmdevicedialogstest, "dmdevicedialogstest" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kdmdevicedialogstest, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, Kdmdevicedialogstest, + KParam, i, &string ); + i++; + }*/ + + RDmDevDialog DmDevdialog; + TInt err = DmDevdialog.OpenL(); + if(err) + return err; + DmDevdialog.Close(); + return KErrNone; + + } + +TInt Cdmdevicedialogstest::ShowOnlyPkgZeroNoteL( CStifItemParser& aItem ) + { + RDebug::Print(_L("Cdmdevicedialogstest::ShowOnlyPkgZeroNoteL")); + RDmDevDialog DmDevdialog; + + TInt err = DmDevdialog.OpenL(); + RDebug::Print(_L("Cdmdevicedialogstest::ShowOnlyPkgZeroNoteL after openL")); + if (err) + return err; + TRequestStatus status = KRequestPending; + TInt ProfileId = 1000001; + TInt Jobid = 0; + TInt uimode = 0; + //TBuf<100> name(_L("Server name 123")); + TPckgBuf iResBuf; + DmDevdialog.LaunchPkgZero(ProfileId, Jobid, uimode, iResBuf, status); + User::After(1000000 * 6); + //User::WaitForRequest(status); //working + err = DmDevdialog.CancelPkgZeroNote(); + //Different tests to be performed + //Close immediately + DmDevdialog.Close(); //See what happens to server whether it is closed or not + //Close later + /*if (status.Int() == KErrNone || status.Int() == KErrCancel) + return KErrNone; + else + return KErrNotFound;*/ + return err; + } +TInt Cdmdevicedialogstest::SilentPkgZeroL( CStifItemParser& aItem ) + { + RDebug::Print(_L("Cdmdevicedialogstest::SilentPkgZeroL")); + RDmDevDialog DmDevdialog; + + TInt err = DmDevdialog.OpenL(); + RDebug::Print(_L("Cdmdevicedialogstest::SilentPkgZeroL after openL")); + if (err) + return err; + TRequestStatus status = KRequestPending; + TInt ProfileId = 1000001; + TInt Jobid = 0; + TInt uimode = 1; + TBuf<100> name(_L("Silent server")); + TPckgBuf iResBuf; + DmDevdialog.LaunchPkgZero(ProfileId, Jobid, uimode, iResBuf, status); + // User::After(1000000 * 6); + User::WaitForRequest(status); //working + //err = DmDevdialog.CancelPkgZeroNote(); + //Different tests to be performed + //Close immediately + DmDevdialog.Close(); //See what happens to server whether it is closed or not + //Close later + if (status.Int() == KErrNone || status.Int() == KErrCancel) + return KErrNone; + else + return KErrNotFound; + return err; + } + +TInt Cdmdevicedialogstest::DefaultProfilePkgZeroL( CStifItemParser& aItem ) + { + RDebug::Print(_L("Cdmdevicedialogstest::DefaultProfilePkgZeroL")); + // Device manager key UID + const TUid KCRUidNSmlDMSyncApp = {0x101f6de5}; + // CenRep keys for default dm profile used in the + // firmware update over the air. + const TUint32 KNSmlDMDefaultFotaProfileKey = 0x00000002; + TInt ProfileId = 1000001; + CRepository* centrep = NULL; + TRAPD( err, centrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) ); + RDebug::Print(_L("Cdmdevicedialogstest::DefaultProfilePkgZeroL cenrep created")); + User::LeaveIfError( err ); + RDebug::Print(_L("Cdmdevicedialogstest::DefaultProfilePkgZeroL cenrep fine")); + centrep->Set( KNSmlDMDefaultFotaProfileKey, ProfileId ); + RDebug::Print(_L("Cdmdevicedialogstest::DefaultProfilePkgZeroL cenrep set fine")); + delete centrep; + + RDmDevDialog DmDevdialog; + + err = DmDevdialog.OpenL(); + RDebug::Print(_L("Cdmdevicedialogstest::DefaultProfilePkgZeroL after openL")); + if (err) + return err; + TRequestStatus status = KRequestPending; + + TInt Jobid = 0; + TInt uimode = 0; + TBuf<100> name(_L("non silent def")); + TPckgBuf iResBuf; + DmDevdialog.LaunchPkgZero(ProfileId, Jobid, uimode, iResBuf, status); + // User::After(1000000 * 6); + User::WaitForRequest(status); //working + //err = DmDevdialog.CancelPkgZeroNote(); + //Different tests to be performed + //Close immediately + DmDevdialog.Close(); //See what happens to server whether it is closed or not + //Close later + if (status.Int() == KErrNone || status.Int() == KErrCancel) + return KErrNone; + else + return KErrNotFound; + return err; + } + +TInt Cdmdevicedialogstest::ShowPkgZeroandConnectNoteL( CStifItemParser& aItem ) +{ +RNSmlPrivateAPI privateApi; + TPtrC8 messageBody(_L8("test")); + + TRAPD(openErr, privateApi.OpenL()); + + if ( openErr != KErrNone ) + { + return openErr; + } + + TRAPD(err,privateApi.SendL( messageBody, ESmlDevMan, ESmlVersion1_2 )); + privateApi.Close(); + return err; +} + +TInt Cdmdevicedialogstest::ShowConnectNoteAgainL( CStifItemParser& aItem ) + { + + RDebug::Print(_L("Cdmdevicedialogstest::ShowConnectNoteAgainL")); + RDmDevDialog DmDevdialog; + + TInt err = DmDevdialog.OpenL(); + RDebug::Print(_L("Cdmdevicedialogstest::ShowConnectNoteAgainL after openL")); + if (err) + return err; + TInt Status(KErrNotFound); + err = DmDevdialog.ShowConnectDialog(); + + DmDevdialog.Close(); + return err; + } + +TInt Cdmdevicedialogstest::CancelPkgZeroNoteL( CStifItemParser& aItem ) + { + + RDebug::Print(_L("Cdmdevicedialogstest::CancelPkgZeroNoteL")); + RDmDevDialog DmDevdialog; + + TInt err = DmDevdialog.OpenL(); + RDebug::Print(_L("Cdmdevicedialogstest::CancelPkgZeroNoteL after openL")); + if (err) + return err; + TInt Status(KErrNotFound); + err = DmDevdialog.CancelPkgZeroNote(); + + DmDevdialog.Close(); + return err; + } +TInt Cdmdevicedialogstest::DismissConnectNoteL( CStifItemParser& aItem ) + { + RDebug::Print(_L("Cdmdevicedialogstest::DismissConnectNoteL")); + RDmDevDialog DmDevdialog; + + TInt err = DmDevdialog.OpenL(); + RDebug::Print(_L("Cdmdevicedialogstest::ShowOnlyPkgZeroNoteL after openL")); + if (err) + return err; + TInt Status(KErrNotFound); + err = DmDevdialog.IsPkgZeroConnectNoteShown(Status); + if (err) + { + DmDevdialog.Close(); + return err; + } + if(Status == 1) + { + err = DmDevdialog.DismissConnectDialog(); + /* if (err) + { + DmDevdialog.Close(); + return err; + }*/ + } + else + return KErrNone; + //Different tests to be performed + //Close immediately + DmDevdialog.Close(); //See what happens to server whether it is closed or not + return err; + //Close later + + } +TInt Cdmdevicedialogstest::IsConnectNoteShownL( CStifItemParser& aItem ) + { + return KErrNone; + } +TInt Cdmdevicedialogstest::ShowDisplayAlertL( CStifItemParser& aItem ) + { + RDmDevDialog DmDevdialog; + TInt err = DmDevdialog.OpenL(); + if(err) + return err; + + TRequestStatus status = KRequestPending; +TBuf<100> ServerMsg(_L("Information alert....")); + DmDevdialog.ShowDisplayAlert(ServerMsg,status); + + + User::WaitForRequest(status); + +DmDevdialog.Close(); + return KErrNone; + } +TInt Cdmdevicedialogstest::ShowConfirmationAlertL( CStifItemParser& aItem ) + { + RDmDevDialog DmDevdialog; + TInt err = DmDevdialog.OpenL(); + if(err) + return err; + + TRequestStatus status = KRequestPending; +TBuf<100> ServerMsg(_L("Confirmation alert....")); + + TInt timeout = 30; // dummy + TBuf<30> header; // dummy + DmDevdialog.ShowConfirmationAlert(timeout,header,ServerMsg,status); + + + User::WaitForRequest(status); + +DmDevdialog.Close(); + return KErrNone; + } + + + +// ----------------------------------------------------------------------------- +// Cdmdevicedialogstest::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +/* +TInt Cdmdevicedialogstest::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/fota_engine_api/group/bld.inf --- a/remotemgmt_plat/fota_engine_api/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/remotemgmt_plat/fota_engine_api/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -24,6 +24,5 @@ PRJ_EXPORTS -../inc/FotaEngStream.h MW_LAYER_PLATFORM_EXPORT_PATH(fotaengstream.h) ../inc/fotaconst.h MW_LAYER_PLATFORM_EXPORT_PATH(fotaConst.h) ../inc/FotaEngine.h MW_LAYER_PLATFORM_EXPORT_PATH(fotaengine.h) diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/fota_engine_api/inc/FotaEngStream.h --- a/remotemgmt_plat/fota_engine_api/inc/FotaEngStream.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* -* Copyright (c) 2005-2006 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: Stream to memorybased chunk -* -*/ - - - -#ifndef __FOTAENGSTREAM_H__ -#define __FOTAENGSTREAM_H__ - -// INCLUDES -#include -#include -#include - -// FORWARD DECLARATIONS -class RFotaEngineSession; -class RFotaWriteStream; - - -const TInt KDefaultWriteLimit( 5000000 ); - -// CLASS DECLARATION -/** -* Memory buffer -* -* Saves streams data to chunk. -* -* @lib fotaengine.lib -* @since Series 60 v3.1 -*/ -class TDP2StreamBuf : public TStreamBuf -{ - friend class RFotaWriteStream; - -public: - - TDP2StreamBuf (); - - /** Resets write area - * - * @param None - * @return None - */ - void ResetL(); - -private: - - /** Handles overflow of write area - * - * @param None - * @return None - */ - virtual void OverflowL(); - - - /** Handles underflow of write area - * - * @param aMaxLength - * @return Error code - */ - virtual TInt UnderflowL(TInt aMaxLength); - - - /** Handles releasing of stream/buffer - * - * @param None - * @return None - */ - virtual void DoRelease(); - - - /** - * Bytes written to stream - */ - TInt iBytesWritten; - - - /** - * Chunks sent to server - */ - TInt iSentChunks; - - - /** - * Reference to parent stream - */ - RFotaWriteStream* iMyWriteStream; - -}; - - -/** - * RFotaWriteStream saves swupd to memory chunk - * - * Saves written content via TDP2StreamBuf to - * the chunk. - * - * @lib fotaengine.lib - * @since S60 3.1 - */ -class RFotaWriteStream : public RWriteStream - { - friend class RFotaEngineSession; - - friend class TDP2StreamBuf; - -public: - - RFotaWriteStream (); - - /** Opens stream - * - * @param aPkgId package id - * @return Error code - */ - TInt OpenL (const TInt aPkgId); - -private: - - /** - * Memory buffer - */ - TDP2StreamBuf iBuf; - - /** - * Reference to parent session - */ - RFotaEngineSession* iFotaEngineSession; - - /** - * Max package size. If exceeded, must throw error in this class. - */ - TInt iWriteLimit; - }; - - -#endif // __FOTAENGSTREAM_H__ \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/fota_engine_api/inc/FotaEngine.h --- a/remotemgmt_plat/fota_engine_api/inc/FotaEngine.h Tue Jul 13 09:37:43 2010 +0530 +++ b/remotemgmt_plat/fota_engine_api/inc/FotaEngine.h Tue Jul 13 09:51:41 2010 +0530 @@ -11,70 +11,47 @@ * * Contributors: * -* Description: Fotaengine hdr + * Description: Fotaengine api * */ - - #ifndef __FOTAENGINE_H__ #define __FOTAENGINE_H__ // INCLUDES #include #include -#include -#include #include -#include -#include -#include -#include -#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#else -#include -#include -#endif - -#include "fotaengstream.h" #include "fotaConst.h" +#include // CONSTANTS /** FOTA Server commands */ enum TFotaIPCCmds - { - EFotaFirstCommand = RApaAppServiceBase::KServiceCmdBase, - EDeletePackage, - EFotaDownload, - EFotaDownloadAndUpdate, - EGetResult, - EGetState, - EIsPackageStoreSizeAvailable, - EFotaOpenUpdatePackageStore, - // Command for getting the downloaded & full size of the update package - EFotaGetDownloadUpdatePackageSize, - // Command to attempt resuming of the download session for downloading the remaining parts of the update package. - // This service is restriced to DM UI and FMS Server. - EFotaTryResumeDownload, - EFotaUpdate, - EUpdatePackageDownloadComplete, - EFotaSendChunk, - EFotaReleaseChunkHandle, - EGetUpdatePackageIds, - EGetUpdateTimestamp, - EGenericAlertSentForPackage, - EScheduledUpdate - }; + { + EFotaDownload, // The download command + EFotaDownloadAndUpdate, // The download and update command + EFotaUpdate, // The update command + EPauseDownload, // The download pause command + EFotaTryResumeDownload, // The download resume command + EGetState, // The get state command + EGetResult, // The get result command + EDeletePackage, // The package delete command + EGetUpdateTimestamp, // The get command for updated timestamp + EGetUpdatePackageIds, // The get command for all package ids + EGenericAlertSentForPackage, // The generic alert sent notification command + EScheduledUpdate, // The schedule update command + EGetCurrFwDetails // The get command for reading current firmware package details + }; - +/** Fota start up action states */ enum TFotaUpdateStates { - EFotaDefault, - EFotaPendingGenAlert, - EFotaDownloadInterrupted, - EFotaUpdateInterrupted + EFotaDefault, // No action + EFotaPendingGenAlert, // Send pending generic alert + EFotaDownloadInterrupted, // Try to resume download + EFotaUpdateInterrupted // Try to resume update }; class TFotaScheduledUpdate; @@ -82,436 +59,376 @@ // CLASS DECLARATION /** -* A client handle to a FOTA engine session. -* @lib fotaengine.lib -* @since Series 60 3.1 -*/ -class RFotaEngineSession : public RAknAppServiceBase - { + * A client handle to a FOTA engine session. + * @lib fotaengine.lib + * @since SF4 + */ +//class RFotaEngineSession : public RAknAppServiceBase // 10.1 changes +class RFotaEngineSession : public RSessionBase + { - friend class TDP2StreamBuf; // TDP2StreamBuf will use iChunk - -public: // enums +public: + // enums /** - * An enumeration of the firmware update progress state codes as specified - * in FUMO spec. - */ + * An enumeration of the firmware update progress state codes as specified + * in FUMO spec. + */ enum TState - { - /** No firmware update has been started */ - EIdle = 10, - /** Client has sent a client initiated request */ - EClientRequest = 5, - /** There is no data available and download is about to start */ - EStartingDownload = 15, - /** Download failed and there is no data received */ - EDownloadFailed = 20, - /** Download is progressing with resume support. This is an internal state and is not a valid FUMO state. - * Only DM UI and Fota Server can get this state; others get state 30 instead.*/ - EDownloadProgressingWithResume = 25, - /** Download is progressing without resume support. */ - EDownloadProgressing = 30, - /** Have data and download has been completed successfully */ - EDownloadComplete = 40, - /** Have data and about to start update */ - EStartingUpdate = 50, - /** Denotes that the update is currently running, but has not yet - completed */ - EUpdateProgressing = 60, - /** Have data but update failed */ - EUpdateFailed = 70, - /** Update failed and data deleted or removed */ - EUpdateFailedNoData = 80, - /** Update complete and data still available */ - EUpdateSuccessful = 90, - /** Data deleted or removed after a successful update */ - EUpdateSuccessfulNoData = 100, - }; + { + /** No firmware update has been started */ + EIdle = 10, + /** Client has sent a client initiated request */ + EClientRequest = 5, + /** There is no data available and download is about to start */ + EStartingDownload = 15, + /** Download failed and there is no data received */ + EDownloadFailed = 20, + /** Download is progressing without resume support. */ + EDownloadProgressing = 30, + /** Have data and download has been completed successfully */ + EDownloadComplete = 40, + /** Have data and about to start update */ + EStartingUpdate = 50, + /** Denotes that the update is currently running, but has not yet + completed */ + EUpdateProgressing = 60, + /** Have data but update failed */ + EUpdateFailed = 70, + /** Update failed and data deleted or removed */ + EUpdateFailedNoData = 80, + /** Update complete and data still available */ + EUpdateSuccessful = 90, + /** Data deleted or removed after a successful update */ + EUpdateSuccessfulNoData = 100, + }; - /** - * An enumeration of the firmware update result codes as specified - * in the OMA Firmware Update Management Oobject specification. - */ - + /** + * An enumeration of the firmware update result codes as specified + * in the OMA Firmware Update Management Oobject specification. + */ enum TResult { - EResSuccessful = 200, - EResUserCancelled = 401, - EResCorruptedFWUPD = 402, - EResPackageMismatch = 403, - EResFailedSignatureAuthentication = 404, - EResUndefinedError = 409, - EResUpdateFailed = 410, - EResMalformedOrBadURL = 411, - EResAlternateDLServerUnavailable = 412, - EResDLFailDueToDeviceOOM = 501, - EResDLFailDueToNWIssues = 503 - }; - -public: // Constructors + /** Requested operation is successful */ + EResSuccessful = 200, + /** Requested operation is cancelled by user */ + EResUserCancelled = 401, + /** Firmware update is corrupt */ + EResCorruptedFWUPD = 402, + /** Firmware update mismatches with the device */ + EResPackageMismatch = 403, + /** Not used */ + EResFailedSignatureAuthentication = 404, + /** Undefined error occured during the operation */ + EResUndefinedError = 409, + /** Update has failed */ + EResUpdateFailed = 410, + /** Download failed due to malformed or bad url */ + EResMalformedOrBadURL = 411, + /** The OMA DL server is unavailable */ + EResAlternateDLServerUnavailable = 412, + /** Download paused due to out of memory */ + EResDLFailDueToDeviceOOM = 501, + /** Download paused due to network error */ + EResDLFailDueToNWIssues = 503, - IMPORT_C RFotaEngineSession(); - -public: // new functions - /** - * Opens session to Fota Engine - * - * @since Series 60 3.1 - * @param None - * @return None - */ - IMPORT_C void OpenL(); - - /** - * Closes session to Fota Engine - * - * @since Series 60 3.1 - * @param None - * @return None - */ - IMPORT_C void Close(); - - - /** - * Called when DM server calls execute command to - * Firmware update object URI ./FUMO//Download - * Initiates a firmware download for the specified update package. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. - * Mapped to Mgmt URI ./FUMO/ in DM Framework - * @param aPkgURL Contains the URL where the firmware update package - * or download - * descriptor is located. This URL is used for - * alternative download - * mechanism such as Descriptor Based Download. - * Mgmt URI ./FUMO//Download/PkgURL - * @param aProfileId ProfileId of the DM server that send the execute - * command - * @param aPkgName Name associated with the firmware update package, - * may be empty - * Mgmt URI ./FUMO//PkgName - * @param aPkgVersion Version information for the firmware update - * package, - * may be empty. - * Mgmt URI./FUMO//PkgVersion - * @return Immediate result of the command - * KErrNotFound: url doesn't exist - */ - IMPORT_C TInt Download( - const TInt aPkgId - ,const TDesC8& aPkgURL - ,const TSmlProfileId aProfileId - ,const TDesC8& aPkgName - ,const TDesC8& aPkgVersion); - - - /** - * Called when DM server calls execute command to - * Firmware update object URI ./FUMO//DownloadAndUpdate - * Initiates a firmware download and an immediate update for the specified - * update package. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. - * Mapped to Mgmt URI ./FUMO/ in DM Framework - * @param aPkgURL Contains the URL where the firmware update package or - * download descriptor is located. This URL is used for - * alternative download mechanism such as Descriptor - * Based Download. - * Mgmt URI ./FUMO//DownloadAndUpdate/PkgURL - * @param aProfileId ProfileId of the DM server that send the execute - * command - * @param aPkgName Name associated with the firmware update package, - * may be empty. - * Mgmt URI ./FUMO//PkgName - * @param aPkgVersion Version information for the firmware update - * package, may be empty. - * Mgmt URI./FUMO//PkgVersion - * @return Immediate result of the command - */ - IMPORT_C TInt DownloadAndUpdate( - const TInt aPkgId - ,const TDesC8& aPkgURL - ,const TSmlProfileId aProfileId - ,const TDesC8& aPkgName - ,const TDesC8& aPkgVersion); - + //Vendor specific errors + /** Download failed due to content type mismatch */ + EResContentMisMatch = 600, + /** Download failed due to invalid OMA DL1.0 descriptor */ + EResInvalidDownloadDescriptor = 601, + /** Update suspended due to low battery */ + EResLowBattery = 602 + }; + +public: + // Constructors + + IMPORT_C RFotaEngineSession(); + +public: + // new functions + /** + * Opens session to Fota Engine + * + * @since SF4 + * @param None + * @return None + */ + IMPORT_C void OpenL(); + + /** + * Closes session to Fota Engine + * + * @since SF4 + * @param None + * @return None + */ + IMPORT_C void Close(); - /** - * Called when DM server calls execute command to - * Firmware update object URI ./FUMO//Update - * Initiates a firmware update for the specified update package. - * Firmware Update Package should be already downloaded to the device - * either using DM Large Object or OMA OTA download mechanisms. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. - * @param aProfileId ProfileId of the DM server that send the execute - * command - * @param aPkgName Name associated with the firmware update package, may - * be empty. - * Mgmt URI ./FUMO//PkgName - * @param aPkgVersion Version information for the firmware update - * package, may be empty. - * Mgmt URI./FUMO//PkgVersion - * @return Immediate result of the command - */ - IMPORT_C TInt Update( - const TInt aPkgId - ,const TSmlProfileId aProfileId - ,const TDesC8& aPkgName - ,const TDesC8& aPkgVersion); - - - /** - * Called when DM server is about to start sending - * new firmware update package using DM Large Object download. - * This function is used to enquire if there is enough space available - * for the firmware update package. - * e.g when DM server is about to start sending new firmware update package using - * DM Large Object download. - - * - * @since Series 60 3.1 - * @param aSize Size of the firmware update package. Since - * continuation of interrupted downloads is not supported - * , this means new update package. - * @return ETrue if there is enough space available, EFalse - * otherwise - */ - IMPORT_C TBool IsPackageStoreSizeAvailable( const TInt aSize ); - - - /** - * Opens stream to update package storage. - * Call UpdatePackageDownloadComplete when package is completely written. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. Download mgr - * may use value -1. - * @param aPkgStore On return, open stream in which file may be written - * to. - * @return Immediate result of the command. KErrInUse store is - * already opened - */ - IMPORT_C TInt OpenUpdatePackageStore( const TInt aPkgId - , RWriteStream*& aPkgStore ); + /** + * Called when DM server calls execute command to + * Firmware update object URI ./FUMO//Download + * Initiates a firmware download for the specified update package. + * + * @since SF4 + * @param aPkgId Unique identifier of the update package. + * Mapped to Mgmt URI ./FUMO/ in DM Framework + * @param aPkgURL Contains the URL where the firmware update package + * or download + * descriptor is located. This URL is used for + * alternative download + * mechanism such as Descriptor Based Download. + * Mgmt URI ./FUMO//Download/PkgURL + * @param aProfileId ProfileId of the DM server that send the execute + * command + * @param aPkgName Name associated with the firmware update package, + * may be empty + * Mgmt URI ./FUMO//PkgName + * @param aPkgVersion Version information for the firmware update + * package, + * may be empty. + * Mgmt URI./FUMO//PkgVersion + * @param aSilent Decides whether the download has to be silent or not + * @return Immediate result of the command + * KErrNotFound: url doesn't exist + */ + IMPORT_C TInt Download(const TInt aPkgId, const TDesC8& aPkgURL, + const TSmlProfileId aProfileId, const TDesC8& aPkgName, + const TDesC8& aPkgVersion, TBool aSilentDownload = EFalse); - /** - * Gets the downloaded and full size of the update package. - * Called by Download Manager during resume operation to know the size of partially downloaded package. - * @since Series 60 3.2.2 - * @param aPkgId Unique identifier of the update package. - * @param aDownloadedSize On return, size of the downloaded package in bytes - * @param aTotalSize On return, full size of the download package in bytes - * - * @return KErrNone when successful, else System wide errors - * - */ - - IMPORT_C TInt GetDownloadUpdatePackageSize( const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize ); - - /** - * Requests to resume the suspended download of the update package. - * Called by Fota Monitory Service. for ex, when network is available again. - * @since Series 60 3.2.2 - * @param None - * - * @return KErrNone when successful, else System wide errors - * - */ - - IMPORT_C TInt TryResumeDownload(); + /** + * Called when DM server calls execute command to + * Firmware update object URI ./FUMO//DownloadAndUpdate + * Initiates a firmware download and an immediate update for the specified + * update package. + * + * @since SF4 + * @param aPkgId Unique identifier of the update package. + * Mapped to Mgmt URI ./FUMO/ in DM Framework + * @param aPkgURL Contains the URL where the firmware update package or + * download descriptor is located. This URL is used for + * alternative download mechanism such as Descriptor + * Based Download. + * Mgmt URI ./FUMO//DownloadAndUpdate/PkgURL + * @param aProfileId ProfileId of the DM server that send the execute + * command + * @param aPkgName Name associated with the firmware update package, + * may be empty. + * Mgmt URI ./FUMO//PkgName + * @param aPkgVersion Version information for the firmware update + * package, may be empty. + * Mgmt URI./FUMO//PkgVersion + * @param aSilent Decides whether the download has to be silent or not + * @return Immediate result of the command + */ + IMPORT_C TInt DownloadAndUpdate(const TInt aPkgId, const TDesC8& aPkgURL, + const TSmlProfileId aProfileId, const TDesC8& aPkgName, + const TDesC8& aPkgVersion, TBool aSilentDownload = EFalse); - - /** - * Call this when download of update package is completed. In case of - * software error or network interruption, this is not called and package - * store is left empty. When this is called, fotaengine closes the stream - * and associated storage. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. Download - * mgr may use value -1. - * @return None - */ - IMPORT_C void UpdatePackageDownloadComplete( const TInt aPkgId ); - - - /** - * Called when caller wants to enquire State of specified - * firmware update. If the State is unknown to FOTA Engine, then it should - * return EIdle. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. - * @return State reached by specified firmware update package - */ - IMPORT_C TState GetState( const TInt aPkgId ); - - - /** - * Called when caller wants to enquire Final Result Code of specified - * firmware update operation. If the update operation is not yet reached - * final stage, then -1 should be returned to the caller. Possible Final - * Result Codes are specified in OMA FUMO Specification. Note that Download - * operation also ends to final result code e.g. 202 - Successful Download. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. - * @return Result code as specified in FUMO specification, -1 if - * not yet reached final result. - */ - IMPORT_C TInt GetResult( const TInt aPkgId ); - - - /** - * Called when DM server deletes firmware update management object - * from device's management tree. I.e. Delete to mgmt URI ./FUMO/. - * If FOTA Engine has not yet deleted specified update package, then it - * should do so. - * - * @since Series 60 3.1 - * @param aPkgId Unique identifier of the update package. - * @return Result code - */ - IMPORT_C TInt DeleteUpdatePackage( const TInt aPkgId ); - + /** + * Called when DM server calls execute command to + * Firmware update object URI ./FUMO//Update + * Initiates a firmware update for the specified update package. + * Firmware Update Package should be already downloaded to the device + * either using DM Large Object or OMA OTA download mechanisms. + * + * @since SF4 + * @param aPkgId Unique identifier of the update package. + * @param aProfileId ProfileId of the DM server that send the execute + * command + * @param aPkgName Name associated with the firmware update package, may + * be empty. + * Mgmt URI ./FUMO//PkgName + * @param aPkgVersion Version information for the firmware update + * package, may be empty. + * Mgmt URI./FUMO//PkgVersion + * @return Immediate result of the command + */ + IMPORT_C TInt Update(const TInt aPkgId, const TSmlProfileId aProfileId, + const TDesC8& aPkgName, const TDesC8& aPkgVersion); + + /** + * Requests to pause the ongoing download. + * + * @since Symbian 4 + * @param None + * @return KErrNone if pause is successful, or any system-wide error. + */ + IMPORT_C TInt PauseDownload(); /** - * Retrieves the timestamp of last succesful update. - * - * @since Series 60 3.1 - * @param aUpdate On return, contains time of last succesfull update - * @return Error code. KErrUnknown if device has never been - * updated. - */ - IMPORT_C TInt LastUpdate( TTime& aUpdate ); + * Requests to resume the suspended download of the update package. + * Called by Fota Monitory Service. for ex, when network is available again. + * @since 3.2.2 + * @param aSilent Decides whether the download has to be silent or not + * + * @return KErrNone when successful, else System wide errors + * + */ + + IMPORT_C TInt TryResumeDownload(TBool aSilentDownload = EFalse); + + /** + * Called when caller wants to enquire State of specified + * firmware update. If the State is unknown to FOTA Engine, then it should + * return EIdle. + * + * @since SF4 + * @param aPkgId Unique identifier of the update package. + * @return State reached by specified firmware update package + */ + IMPORT_C TState GetState(const TInt aPkgId); + + /** + * Called when caller wants to enquire Final Result Code of specified + * firmware update operation. If the update operation is not yet reached + * final stage, then -1 should be returned to the caller. Possible Final + * Result Codes are specified in OMA FUMO Specification. Note that Download + * operation also ends to final result code e.g. 202 - Successful Download. + * + * @since SF4 + * @param aPkgId Unique identifier of the update package. + * @return Result code as specified in FUMO specification, -1 if + * not yet reached final result. + */ + IMPORT_C TInt GetResult(const TInt aPkgId); + + /** + * Called when DM server deletes firmware update management object + * from device's management tree. I.e. Delete to mgmt URI ./FUMO/. + * If FOTA Engine has not yet deleted specified update package, then it + * should do so. + * + * @since SF4 + * @param aPkgId Unique identifier of the update package. + * @return Result code + */ + IMPORT_C TInt DeleteUpdatePackage(const TInt aPkgId); + + /** + * Retrieves the timestamp of last succesful update. + * + * @since SF4 + * @param aUpdate On return, contains time of last succesfull update + * @return Error code. KErrUnknown if device has never been + * updated. + */ + IMPORT_C TInt LastUpdate(TTime& aUpdate); + + /** + * Tells device FW version + * + * @since SF4 + * @param aSWVersion On return, contains FW version of device. + * @return Error code + */ + IMPORT_C TInt CurrentVersion(TDes& aSWVersion); - /** - * Tells device FW version - * - * @since Series 60 3.1 - * @param aSWVersion On return, contains FW version of device. - * @return Error code - */ - IMPORT_C TInt CurrentVersion( TDes& aSWVersion ); + /** + * Gets IDs of the present update packages. + * + * @since SF4 + * @param aPackageIdList On return, contains array of pkg ids + * @return Error code + */ + IMPORT_C TInt GetUpdatePackageIds(TDes16& aPackageIdList); + + /** + * Version of the fota server + * + * @since SF4 + * @return version + */ + IMPORT_C TVersion Version() const; + + /** + * Tells fotaserver that generic alert for package is sent. + * When fotaengine session is closed, cleanup for package + * is done. + * + * @since SF4 + * @param aPackageId + * @return Error code + */ + IMPORT_C void GenericAlertSentL(const TInt aPackageID); - /** - * Gets IDs of the present update packages. - * - * @since Series 60 3.1 - * @param aPackageIdList On return, contains array of pkg ids - * @return Error code - */ - IMPORT_C TInt GetUpdatePackageIds( TDes16& aPackageIdList ); + /** + * Like Update, but called by scheduler mechanism. + * Needed package details (profile id etc are already known) + * + * @since 3.2 + * @param aSchedule Schedule data + * @return Error code + */ + IMPORT_C TInt ScheduledUpdateL(TFotaScheduledUpdate aSchedule); - IMPORT_C TVersion Version() const; + /** + * Gets the details for current/last firmware update. + * + * @since SF4 + * @param aName - name of the firmware + * @param aVersion - version of the firmware + * @param aSize - size of the firmware in bytes + * @return, on return all the params would be filled. Can leave with system wide error. + */ + IMPORT_C void GetCurrentFirmwareDetailsL(TDes8& aName, TDes8& aVersion, + TInt& aSize); + + IMPORT_C TBool IsPackageStoreSizeAvailable(const TInt aSize); + + + IMPORT_C TInt OpenUpdatePackageStore(const TInt aPkgId + ,RWriteStream*& aPkgStore); + + IMPORT_C TInt GetDownloadUpdatePackageSize(const TInt aPkgId, TInt& aDownloadedSize, TInt& aTotalSize); + + IMPORT_C void UpdatePackageDownloadComplete( + const TInt aPkgId); + +private: + + /** Returns the UID of the service that this session provides an + * interface for. Client side service implementations must implement this + * function to return the UID for the service that they implement. + * + * @since SF4 + * @param None + * @return The UID of the service implemented by the derived class. + */ + TUid ServiceUid() const; - /** - * Tells fotaserver that generic alert for package is sent. - * When fotaengine session is closed, cleanup for package - * is done. - * - * @since Series 60 3.1 - * @param aPackageId - * @return Error code - */ - IMPORT_C void GenericAlertSentL( const TInt aPackageID ) ; - - - /** - * Like Update, but called by scheduler mechanism. - * Needed package details (profile id etc are already known) - * - * @since Series 60 3.2 - * @param aSchedule Schedule data - * @return Error code - */ - IMPORT_C TInt ScheduledUpdateL( TFotaScheduledUpdate aSchedule ); - - -private: // From RApaAppServiceBase - - /** Returns the UID of the service that this session provides an - * interface for. Client side service implementations must implement this - * function to return the UID for the service that they implement. - * - * @since Series 60 3.1 - * @param None - * @return The UID of the service implemented by the derived class. - */ - TUid ServiceUid() const; - - IMPORT_C virtual void ExtensionInterface( - TUid aInterfaceId - ,TAny*& aImplementation ); - -private: // New methods +private: /** - * Signals the server to read chunk contents - * - * @since Series 60 3.1 - * @param aP1 Pointer to beginning of content - * @param aP2 Pointer to end of content - * @return - **/ - void SendChunkL(const TUint8* aP1, const TUint8* aP2); + * Starts fotaserver server application. + * + * @since SF4 + * @param aNameUid Differentiator. + * @param aAppServerUid FotaServer app uid + * @return None + **/ + void StartApplicationL(const TUid& aNameUid, const TUid& aAppServerUid); /** - * Signals the server to release chunk handle - * - * @since Series 60 3.1 - * @param None - * @return - **/ - TInt ReleaseChunkHandle(); - - /** - * Starts fotaserver server application. - * - * @since Series 60 3.1 - * @param aNameUid Differentiator. - * @param aAppServerUid FotaServer app uid - * @return None - **/ - void StartApplicationL( const TUid& aNameUid,const TUid& aAppServerUid ); - - - /** - * Connects to running fotaserver instance - * - * @since Series 60 3.1 - * @param aNameUid Differentiator. - * @param aAppServerUid FotaServer app uid - * @return None - **/ - void ConnectToServerL( const TUid& aNameUid,const TUid& aAppServerUid ); + * Connects to the server + * + * @since SF4 + * @return KErrNone if successful, otherwise system wide errors + **/ + + TBool connectToHbServer(); private: // Data - /** - * Stream for writing swupd file to chunk - */ - RFotaWriteStream* iStream; /** - * Chunk for sending swupd contents to fotaserver - */ - RChunk iChunk; - - - /** * If not -1 , indicates that generic alert has been sent for this package */ TInt iGenericAlertSentPkgID; - }; - + }; #endif // __FOTAENGINE_H__ diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/fota_engine_api/inc/fotaconst.h --- a/remotemgmt_plat/fota_engine_api/inc/fotaconst.h Tue Jul 13 09:37:43 2010 +0530 +++ b/remotemgmt_plat/fota_engine_api/inc/fotaconst.h Tue Jul 13 09:51:41 2010 +0530 @@ -23,7 +23,6 @@ // Definition of app server uid and service uid #define KFotaServerUid 0x102072C4 #define KFotaServiceUid 0x102072C5 -#define KStorageIFUid 0x10207384 #define KDMHostServer1Uid 0x101F9A02 #define KSosServerUid 0x101f99fb #define KOmaDMAppUid 0x101F6DE5 @@ -38,9 +37,6 @@ const TInt KDefaultSmlTryCount = 4; const TInt KMaximumSmlTryCount = 1000; -// Chunk used to transfer swupd -const TInt KFotaChunkMinSize = 131072;//128 KB size -const TInt KFotaChunkMaxSize = 3000000; const TInt KFotaMaxPkgURLLength ( 2048 ); const TInt KFotaMaxPkgNameLength ( 80 ); @@ -50,6 +46,21 @@ const TInt KBmpMargin(21); _LIT8( KNSmlIAPId, "NSmlIapId" ); -_LIT( KFotaPanic, "Download"); +_LIT( KFotaPanic, "FotaServer"); +_LIT(KFotaServerName,"FotaServer"); +_LIT( KFotaServerScem, "FotaServer_10247628"); + +enum TFotaClient + { + EUnknown = 0, + EDMHostServer = 1, + EOMADMAppUi = 2, + EFotaScheduler = 3, + EStarter = 4, + EFMSServer = 5, + EFotaTestApp = 6, + ESoftwareChecker = 7, + ESoftwareCheckerBackground = 8 + }; #endif \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/group/bld.inf --- a/remotemgmt_plat/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/remotemgmt_plat/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -46,8 +46,8 @@ #include "../fota_engine_api/group/bld.inf" #include "../update_package_storage_plugin_api/group/bld.inf" #include "../syncml_notifier_roaming_api/group/bld.inf" -#include "../sync_service_api/group/bld.inf" #include "../dcmo_adapter_api/group/bld.inf" #include "../dcmo_control_api/group/bld.inf" #include "../ds_capability_mgmt_plugin_api/group/bld.inf" -#include "../devicemgmt_dialogs_api/group/bld.inf" \ No newline at end of file +#include "../devicemgmt_dialogs_api/group/bld.inf" +#include "../dm_device_dialog_api/group/bld.inf" \ No newline at end of file diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/sync_service_api/group/bld.inf --- a/remotemgmt_plat/sync_service_api/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2006 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: File that exports the files belonging to -: Sync Service API -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/SyncServiceParams.h MW_LAYER_PLATFORM_EXPORT_PATH(SyncServiceParams.h) -../inc/SyncServiceConst.h MW_LAYER_PLATFORM_EXPORT_PATH(SyncServiceConst.h) -../inc/SyncService.rh MW_LAYER_PLATFORM_EXPORT_PATH(SyncService.rh) -../inc/SyncService.h MW_LAYER_PLATFORM_EXPORT_PATH(SyncService.h) -../inc/SyncServiceSession.h MW_LAYER_PLATFORM_EXPORT_PATH(SyncServiceSession.h) diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/sync_service_api/inc/SyncService.h --- a/remotemgmt_plat/sync_service_api/inc/SyncService.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ -/* -* Copyright (c) 2005 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 service implementations -* -*/ - - -#ifndef SYNCSERVICE_H -#define SYNCSERVICE_H - -#include -#include - -#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS -#include -#else -#include -#endif - - -struct TSyncServiceParam - { - TUint iJobId; - TUint iProfileId; - TUint iServiceId; - TUint iSilent; - }; - -/** -* RSyncService -* -* Lower level client side service class -* -* @lib syncservice.lib -* @since Series 60 3.0 -*/ -class RSyncService : public RAknAppServiceBase - { - public: - /** - * Sends the synchronisation start command to the - * server side with parameters aParams - */ - void StartSyncL( TSyncServiceParam aParam ); - - /** - * Sends command that enables or disables the SyncML session - * progress notes to the server side. - * @param aEnabled Should the progress note be enabled or disabled. - */ - void EnableProgressNoteL( TBool aEnabled ); - - private: // From RApaAppServiceBase - /** - * Returns the uid of the service - */ - TUid ServiceUid() const; - }; - -/** -* CSyncService -* -* Higher level client side service class -* -* @lib syncservice.lib -* @since Series 60 3.0 -*/ -class CSyncService : public CBase - { - public: - - /** - * Two-phased constructor. - */ - IMPORT_C static CSyncService* NewL( MAknServerAppExitObserver* aObserver, - TUint aServiceId ); - - /** - * Destructor. - */ - virtual ~CSyncService(); - - public: - - /** - * StartSyncL - * - * @param aParam Parameters for the service so that it - * knows which service command to issue - * @return None - */ - IMPORT_C TUid StartSyncL( TSyncServiceParam aParam ); - - /** - * Sends a command to the sync or devman application to - * indicate that the progress note should be enabled - * or disabled. - * @param aEnabled Should the progress not be shown. - * @return None - */ - IMPORT_C void EnableProgressNoteL( TBool aEnabled ); - - private: - - /** - * C++ default constructor. - */ - CSyncService(); - - /** - * 2nd phase constructor - * First calls Discover to find the right application with aParams. - * Then calls iService to connect to right application. - * Creates an instance of CApaServerAppExitMonitor - * Creates an instance of CSyncService. - * Sets itself as observer for the service. - * - * @param aObserver pointer of MAknServerAppExitObserver to be passed to iMonitor - * @param aServiceId parameters for the service so that it - * knows which application to start - * @return None - */ - void ConstructL( MAknServerAppExitObserver* aObserver, - TUint aServiceId ); - - /** - * DiscoverL - * Finds the right application id to be started and returns it. - * Connects RApaLsSession and initializes - * it with GetServerApps command. Then gets all the services that - * implement the service by using GetServiceImplementationsLC. - * Calls TryMatchL for each service and if there's a match, - * the appId is returned. If no implementation is found, 0 is returned. - * - * @param aServiceId parameters for the service so that it - * knows which application to start - * @return None - */ - TUid DiscoverL( TUint aServiceId ); - - /** - * TryMatchL - * Reads the service type information from OpaqueData. - * Sets aAppUi as the application id. - * - * @param aInfo Application service information. - * @param aAppUid Application Uid - * @param aServiceId Parameters for the service so that it - * knows which application to start - * @return Boolean ETrue if not found, returns EFalse. - */ - TBool TryMatchL( const TApaAppServiceInfo aInfo, - TUid& aAppUid, - TUint aServiceId ); - - private: - // Lower level client-side service implementation - RSyncService iService; - // Monitor for checking events from the server side - CApaServerAppExitMonitor* iMonitor; - TSyncServiceParam iParameters; - TUid iUid; - TUint iServiceId; - }; - -#endif // SYNCSERVICE_H - -// End of File - diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/sync_service_api/inc/SyncService.rh --- a/remotemgmt_plat/sync_service_api/inc/SyncService.rh Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005 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: definition of syncservice constants/exported methods -* This is part of remotemgmt_plat. -*/ - - -// Service struct for DM and DS -// Set KSyncServiceStart in type -// (defined in SyncServiceConst.h) - -#include - -STRUCT SYNC_SERVICE_STRUCT - { - LONG type = 0; - } - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/sync_service_api/inc/SyncServiceConst.h --- a/remotemgmt_plat/sync_service_api/inc/SyncServiceConst.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2005 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: definition of syncservice constants/exported methods -* This is part of remotemgmt_plat. -*/ - - -#ifndef SYNCSERVICECONST_H -#define SYNCSERVICECONST_H - -// Definition of service -#define KSyncServiceUid 0x101F8769 - -// Service types -#define KDevManServiceStart 1 -#define KDataSyncServiceStart 2 - -#endif // SYNCSERVICECONST_H - diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/sync_service_api/inc/SyncServiceParams.h --- a/remotemgmt_plat/sync_service_api/inc/SyncServiceParams.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2005 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: definition of syncservice constants/exported methods -* This is part of remotemgmt_plat. -*/ - - -#ifndef SYNCSERVICEPARAMS_H -#define SYNCSERVICEPARAMS_H - -// INCLUDE FILES - -#include - -// CLASS DECLARATION - -// CONSTANTS -const TUid KUidSyncParameterValue = {0x101F8769}; - -const TInt KSyncServCmdNone = -1; -const TInt KSyncServCmdStartSync = 1; -const TInt KSyncServCmdShowProgress = 2; - -const TInt KSyncServDisabled = 0; -const TInt KSyncServEnabled = 1; - -//_LIT( KDevManServiceName, "101F6DE5_NSmlDMSync" ); -_LIT( KDataSyncServiceName, "101F6DE4_NSmlDSSync" ); - -/** -* TSyncParameters -* -* @lib syncservice.lib -* @since Series 60 3.0 -*/ -class TSyncParameters - { - public: - - /** - * TSyncParameters - */ - inline TSyncParameters(); - - /** - * TSyncParameters - */ - inline TSyncParameters( const TSyncParameters& aParams ); - - /** - * ExternalizeL - */ - inline void ExternalizeL( RWriteStream& aStream ) const; - - /** - * InternalizeL - */ - inline void InternalizeL( RReadStream& aStream ); - - public: - TInt iCommand; - TInt iJobId; - TInt iProfileId; - TInt iSilent; - }; - -// ---------------------------------------------------------------------------- -// TSyncParameters::TSyncParameters -// ---------------------------------------------------------------------------- -// -inline TSyncParameters::TSyncParameters() -: iCommand( KSyncServCmdNone ), - iJobId( 0 ), - iProfileId( 0 ) - ,iSilent(-1) - {} - -// ---------------------------------------------------------------------------- -// TSyncParameters::TSyncParameters( aParams ) -// ---------------------------------------------------------------------------- -// -inline TSyncParameters::TSyncParameters( const TSyncParameters& aParams ) -: iCommand( aParams.iCommand ), - iJobId( aParams.iJobId ), - iProfileId( aParams.iProfileId ) - ,iSilent(aParams.iSilent) - {} - -// ---------------------------------------------------------------------------- -// TSyncParameters::ExternalizeL -// ---------------------------------------------------------------------------- -// -inline void TSyncParameters::ExternalizeL( RWriteStream& aStream ) const - { - aStream.WriteInt32L( iCommand ); - aStream.WriteInt32L( iJobId ); - aStream.WriteInt32L( iProfileId ); - aStream.WriteInt32L( iSilent ); - } - -// ---------------------------------------------------------------------------- -// TSyncParameters::InternalizeL -// ---------------------------------------------------------------------------- -// -inline void TSyncParameters::InternalizeL( RReadStream& aStream ) - { - iCommand = aStream.ReadInt32L(); - iJobId = aStream.ReadInt32L(); - iProfileId = aStream.ReadInt32L(); - iSilent = aStream.ReadInt32L(); - } - -#endif //SYNCSERVICEPARAMS_H - -// End of File diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/sync_service_api/inc/SyncServiceSession.h --- a/remotemgmt_plat/sync_service_api/inc/SyncServiceSession.h Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* -* Copyright (c) 2005 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: definition of syncservice constants/exported methods -* This is part of remotemgmt_plat. -*/ - - -#ifndef SYNCSERVICESESSION_H -#define SYNCSERVICESESSION_H - -#include -#include - -enum TSyncServiceCmds - { - ESyncServiceCommand = RApaAppServiceBase::KServiceCmdBase - }; - -/** -* CSyncServiceSession -* -* @lib syncservice.lib -* @since Series 60 3.0 -*/ -class CSyncServiceSession : public CAknAppServiceBase - { - public: - - /** - * C++ default constructor. - */ - IMPORT_C CSyncServiceSession( ); - - /** - * C++ Destructor - */ - virtual ~CSyncServiceSession(); - - protected: // from CSession2 - - /** - * Just basecalls CAknAppServiceBase - */ - void CreateL(); - - /** - * Checks the function from aMessage. If it is - * ESyncServiceStart -> calls - * OpenEmbedded. Otherwise basecalls CAknAppServiceBase. - * @param aMessage - * @return None - */ - void ServiceL( const RMessage2& aMessage ); - - /** - * Basecalls CAknAppServiceBase. - * @param aMessage - * @param aError - * @return None - */ - void ServiceError( const RMessage2& aMessage, TInt aError ); - - private: - - /** - * Constructs TSyncParameters from aMessage - * Externalizes the params to store and restore - * CEikDocument from there (ie. starts DS DM sync observing). - * Completes aMessage. - * @param aMessage - * @return None - */ - void OpenEmbeddedL( const RMessage2& aMessage ); - - private: - CEikDocument* iDoc; - }; - -#endif //SYNCSERVICESESSION_H diff -r a36219ae6585 -r 2e64dc50f295 remotemgmt_plat/sync_service_api/sync_service_api.metaxml --- a/remotemgmt_plat/sync_service_api/sync_service_api.metaxml Tue Jul 13 09:37:43 2010 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - Sync Service API - This API is used to send a start command to the corresponding application server (either DS or DM). Also a request to enbale/disable a progress note can be sent. - c++ - omads - - - - - - - - - yes - no - - diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/common/alertqueue/src/NSmlDMAlertParser11.cpp --- a/syncmlfw/common/alertqueue/src/NSmlDMAlertParser11.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/common/alertqueue/src/NSmlDMAlertParser11.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -20,6 +20,8 @@ #include #include "NSmlAlertQueue.h" #include "nsmldebug.h" +#include +#include // --------------------------------------------------------- // CNSmlDSAlertParser11(CSmlAlertInfo& aAlertInfo, CSyncMLHistoryPushMsg& aHistoryInfo ) // Returns pointer to the buffer @@ -72,6 +74,16 @@ delete centrep; if( SanSupport == 1 ) { + static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy); + static _LIT_SECURITY_POLICY_C1(KAllowWriteDeviceDataPolicy, ECapabilityWriteDeviceData); + RProperty::Define(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,RProperty::EInt,KAllowAllPolicy,KAllowWriteDeviceDataPolicy); + RProperty::Set(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,KErrNone); + + if(uiMode == ESilent) //silent + { + TInt r2=RProperty::Set(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob,ESilent); + DBG_FILE_CODE( r2, _S8("CNSmlDMAlertParser11::ParseMessageL() KNSmlDMSilentJob set error code") ); + } iAlertInfo.SetUimode(uiMode); } if (uiMode == 0) diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/common/sosserver/bld/nsmlsosserver.mmp --- a/syncmlfw/common/sosserver/bld/nsmlsosserver.mmp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/common/sosserver/bld/nsmlsosserver.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -89,8 +89,8 @@ LIBRARY syncmldatafilter.lib LIBRARY nsmlagentlog.lib LIBRARY policyengine.lib -LIBRARY abclient.lib +LIBRARY abclient.lib dmdevdialogclient.lib LIBRARY centralrepository.lib //tarm -LIBRARY featmgr.lib flogger.lib HbWidgets.lib HbCore.lib +LIBRARY featmgr.lib flogger.lib SMPSAFE diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/common/sosserver/inc/nsmlsosthread.h --- a/syncmlfw/common/sosserver/inc/nsmlsosthread.h Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/common/sosserver/inc/nsmlsosthread.h Tue Jul 13 09:51:41 2010 +0530 @@ -21,6 +21,7 @@ #include #include +#include #include #include #include "nsmlsosserver.h" @@ -194,7 +195,7 @@ TRequestStatus& iCallerStatus; // RNotifier iNotifier; - TSyncMLAppLaunchNotifRetValPckg iResBuf; + TPckgBuf iResBuf; CNSmlThreadParams& iThreadParams; CNSmlNotifierTimeOut iNotifierTimeOut; @@ -203,7 +204,7 @@ CHbDeviceDialogSymbian* iDevDialog; RProperty iProperty; TBool iHbSyncmlNotifierEnabled; - + RDmDevDialog iDmDevdialog; }; diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/common/sosserver/src/nsmlsosthread.cpp --- a/syncmlfw/common/sosserver/src/nsmlsosthread.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/common/sosserver/src/nsmlsosthread.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -29,6 +29,7 @@ #include #include #include +#include enum TSyncmlHbNotifierKeys @@ -120,7 +121,8 @@ CActiveScheduler::Start(); } } - + LOGSTRING("P&S is deleted"); + RProperty::Delete(KPSUidNSmlSOSServerKey,KNSmlDMSilentJob); delete scheduler; if ( endStatus == KErrNone ) @@ -818,7 +820,8 @@ } else { - iProperty.Close(); + if(iDmDevdialog.Handle() ) + iDmDevdialog.Close(); } Cancel(); @@ -834,10 +837,10 @@ _DBG_FILE( "CNSmlNotifierObserver::ConnectToNotifierL:Begin" ); iTimeOut = EFalse; - if ( !IsActive() ) + /*if ( !IsActive() ) { SetActive(); - } + }*/ TSyncMLAppLaunchNotifParamsPckg data( aParam ); @@ -862,8 +865,13 @@ } else { + iStatus = KRequestPending; HbNotifierObserverL(aParam); } + if ( !IsActive() ) + { + SetActive(); + } } else { @@ -911,90 +919,10 @@ { LOGSTRING2("iCallerStatus before HbNotifierObserverL creation %d", iCallerStatus.Int()); - - _LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0"); - - _LIT(KNotifierId, "aasyncmlfw"); - _LIT(KProfileId, "profileid"); - _LIT(KUImode, "uimode"); - _LIT(KServerdisplayname, "serverdisplayname"); - - CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(varMap); - - HBufC* notifierid = HBufC::NewL(10); - CleanupStack::PushL(notifierid); - *notifierid =KNotifierId; - - - HBufC* profileid = HBufC::NewL(10); - CleanupStack::PushL(profileid); - *profileid = KProfileId; - - HBufC* uimode = HBufC::NewL(10); - CleanupStack::PushL(uimode); - *uimode = KUImode; - - HBufC* serverdisplay = HBufC::NewL(20); - CleanupStack::PushL(serverdisplay); - *serverdisplay = KServerdisplayname; - - TBuf<256> servername; - - CNSmlDMSettings* settings = CNSmlDMSettings::NewLC(); - CNSmlDMProfile* prof = settings->ProfileL( - aParam.iProfileId); - CleanupStack::PushL(prof); - - servername = prof->StrValue(EDMProfileDisplayName); - - CleanupStack::PopAndDestroy(2); - - TInt id =1000000; - - CHbSymbianVariant* notifieridvar = CHbSymbianVariant::NewL(&id, - CHbSymbianVariant::EInt); - - - CHbSymbianVariant* infoprofileid = CHbSymbianVariant::NewL(&aParam.iProfileId, - CHbSymbianVariant::EInt); - - //CleanupStack::PushL(infoprofileid); - - CHbSymbianVariant* infouimode = CHbSymbianVariant::NewL(&aParam.iUimode, - CHbSymbianVariant::EInt); - - CHbSymbianVariant* serverdisplayname = CHbSymbianVariant::NewL(&servername, - CHbSymbianVariant::EDes); - //CleanupStack::PushL(infouimode); - - varMap->Add(*notifierid, notifieridvar); - varMap->Add(*profileid, infoprofileid); // takes ownership - varMap->Add(*uimode, infouimode); - varMap->Add(*serverdisplay, serverdisplayname); - - /*subscribe key value*/ - TInt err = RProperty::Define(sosserverpsuid, EHbSOSNotifierKeyStatus, RProperty::EInt); - - err = RProperty::Define(sosserverpsuid, EHbSOSNotifierKeyStatusReturn, RProperty::EInt); - - err = iProperty.Attach(sosserverpsuid, EHbSOSNotifierKeyStatus); - - iProperty.Subscribe(iStatus); - - - - iDevDialog = CHbDeviceDialogSymbian::NewL(); - iDevDialog->Show(KHbNotifier, *varMap); - - CleanupStack::PopAndDestroy(5); - - - - LOGSTRING2("CNSmlNotifierObserver hb notifier %d before subscribe", iStatus.Int()); - - - + TInt err = iDmDevdialog.OpenL(); + User::LeaveIfError(err); + iDmDevdialog.LaunchPkgZero(aParam.iProfileId,aParam.iJobId,aParam.iUimode,iResBuf,iStatus); + LOGSTRING2("CNSmlNotifierObserver hb notifier %d after subscribe", iStatus.Int()); LOGSTRING2("iCallerStatus before HbNotifierObserverL creation %d", iCallerStatus.Int()); @@ -1041,24 +969,7 @@ void CNSmlNotifierObserver::RunL() { - if (iDevDialog && iHbSyncmlNotifierEnabled) - { - - TInt status = KErrNone; - - TInt err = RProperty::Get(sosserverpsuid,EHbSOSNotifierKeyStatusReturn , status); - - LOGSTRING2("status is %d", status); - - LOGSTRING2("err of ps key is %d", err); - - if(status == KErrCancel) - iStatus = KErrCancel; - - iDevDialog->Cancel(); - delete iDevDialog; - } LOGSTRING("CNSmlNotifierObserver RunL start"); @@ -1071,7 +982,7 @@ if ( ret == KErrNone ) { - TInt sid = iResBuf().iSecureId.iUid; // read secure id from notifier. + TInt sid = iResBuf(); // read secure id from notifier. // Check the response and error code. If there is a fail, dump the job. // Also compare sid to creator id saved for current job to secure that listener owns the job. diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/conf/CI_devman.confml Binary file syncmlfw/conf/CI_devman.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/conf/devman.confml Binary file syncmlfw/conf/devman.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/dmnetworkmon/src/DMNetworkMon.cpp --- a/syncmlfw/dm/dmnetworkmon/src/DMNetworkMon.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/dm/dmnetworkmon/src/DMNetworkMon.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -480,14 +480,14 @@ RSyncMLDevManJob dmJob; - TInt IAPID = -1; + TInt IAPID = -2; TBuf<10> genalertap,temp; genalertap.Zero(); temp.Zero(); genalertap.Append(KNSmlDMJobIapPrefix); temp.Num(iapid);//Decimal Iap if( temp.Length() <= KNSmlHalfTransportIdLength && - iapid > KErrNotFound) + iapid >= -2) { genalertap.AppendFill('0',KNSmlHalfTransportIdLength-temp.Length()); genalertap.Append(temp); diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp --- a/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/dm/provisioningadapter/src/NSmlDmProvisioningAdapter.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -40,6 +40,8 @@ #include "NSmlTransportHandler.h" #include +#define KMINPORT 0 +#define KMAXPORT 65536 // ============================ MEMBER FUNCTIONS =============================== @@ -184,7 +186,35 @@ iAuthSecretLimitIndicator = 0; User::Leave(KErrOverflow); } - + + //check for incorrect port + //Only port address between 1 to 65536 is allowed. + if( iProfiles[aItem]->iPort ) + { + const TDesC& port = iProfiles[aItem]->iPort->Des(); + TInt len = port.Length(); + if(len > 0) + { + HBufC* bufPort = port.AllocL(); + TLex aLex(*bufPort); + TInt portNum ; + TInt err = aLex.Val(portNum); + if(bufPort) + { + delete bufPort; + bufPort = NULL; + } + if(err != KErrNone) + { + User::Leave(KErrGeneral); + } + if(!((portNum > KMINPORT) && (portNum < KMAXPORT))) + { + User::Leave(KErrGeneral); + } + } + } + TPckgBuf uid; RSyncMLDevManProfile profile,ProfileToSearch; @@ -289,7 +319,7 @@ connection.SetPropertyL( KNSmlIAPId, *iapBuf ); - CleanupStack::PopAndDestroy( 2 ); //cmmanager,cm + CleanupStack::PopAndDestroy( 3 ); //cmmanager,cm, iapBuf } if( iProfiles[aItem]->iHostAddress ) diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/settings/bld/bld.inf --- a/syncmlfw/dm/settings/bld/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/dm/settings/bld/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -20,7 +20,7 @@ PRJ_EXPORTS ../conf/factorydmprofiles.gcfml MW_LAYER_GCFML(factorydmprofiles.gcfml) -../conf/factorydmprofiles.confml MW_LAYER_CONFML(factorydmprofiles.confml) +../conf/CI_factorydmprofiles.confml MW_LAYER_CONFML(CI_factorydmprofiles.confml) PRJ_MMPFILES nsmldmsettings.mmp diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/settings/conf/CI_factorydmprofiles.confml Binary file syncmlfw/dm/settings/conf/CI_factorydmprofiles.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/settings/conf/factorydmprofiles.confml Binary file syncmlfw/dm/settings/conf/factorydmprofiles.confml has changed diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/settings/inc/DMprofileContentHandler.h --- a/syncmlfw/dm/settings/inc/DMprofileContentHandler.h Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/dm/settings/inc/DMprofileContentHandler.h Tue Jul 13 09:51:41 2010 +0530 @@ -22,8 +22,8 @@ // INCLUDES #include #include -#include "MXMLAttributes.h" -#include "MXMLContentHandler.h" +#include +#include #include "NSmlDMResourceProfile.h" const TInt KNSmlDmFileNameLength=255; diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/settings/src/NSmlDMSettings.cpp --- a/syncmlfw/dm/settings/src/NSmlDMSettings.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/dm/settings/src/NSmlDMSettings.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -19,18 +19,17 @@ #include #include #include - #include #include #include #include +#include +#include #include "nsmldmsettings.h" #include "barsc.h" #include "bautils.h" #include "NSmlDMResourceProfile.h" #include "DMprofileContentHandler.h" -#include "RXMLReader.h" -#include #include "DevManInternalCRKeys.h" //------------------------------------------------------------------------------ diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/syncagent/bld/nsmldmagent.mmp --- a/syncmlfw/dm/syncagent/bld/nsmldmagent.mmp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/dm/syncagent/bld/nsmldmagent.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -71,7 +71,7 @@ LIBRARY nsmldmmodule.lib // FOTA LIBRARY featmgr.lib -LIBRARY centralrepository.lib +LIBRARY centralrepository.lib dmdevdialogclient.lib // FOTA end //LIBRARY nsmldmtestmodule.lib diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/dm/syncagent/src/nsmldmcmds.cpp --- a/syncmlfw/dm/syncagent/src/nsmldmcmds.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/dm/syncagent/src/nsmldmcmds.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -60,6 +60,7 @@ #include "nsmldmagconstants.h" #include "NSmlDMCmds.h" #include "nsmldmerror.h" +#include #include "OnlineSupportLogger.h" #ifdef __TEST_TREEMODULE #include "nsmldmtestmodule.h" @@ -76,7 +77,7 @@ #endif -const TUid KNSmlSyncDialogUid = { 0x101F876A }; +//const TUid KNSmlSyncDialogUid = { 0x101F876A }; // FOTA const TInt KNSmlDmNoRequest = -1; // FOTA end @@ -1768,89 +1769,26 @@ void CNSmlDMCmds::ServerHbNotifierL(TSyncMLDlgNoteTypes& aNotetype, TDesC& aServerMsg) { - LOGSTRING("HandleDisplayAlertL ServerHbNotifier start"); - - _LIT(KHbNotifier,"com.nokia.hb.devicemanagementdialog/1.0"); - - _LIT(KNotifierId, "syncmlfw"); - _LIT(KServerpushalertInfo, "serverpushinformative"); - _LIT(KServerpushalertConfirm, "serverpushconfirmative"); - - TBuf<25> serverpushalertval; - + LOGSTRING("HandleDisplayAlertL ServerHbNotifier start"); + RDmDevDialog DmDevdialog; + TInt err = DmDevdialog.OpenL(); + User::LeaveIfError(err); + TRequestStatus status = KRequestPending; if(aNotetype == ESyncMLInfoNote) - serverpushalertval.Copy(KServerpushalertInfo); + { + DmDevdialog.ShowDisplayAlert(aServerMsg,status); + } + else - serverpushalertval.Copy(KServerpushalertConfirm); - - CHbDeviceDialogSymbian *devDialog = NULL; - - CHbSymbianVariantMap* varMap = CHbSymbianVariantMap::NewL(); - CleanupStack::PushL(varMap); - - - HBufC* keyBuf = HBufC::NewL(25); - CleanupStack::PushL(keyBuf); - - *keyBuf = KNotifierId; - - HBufC* servalertmsg = HBufC::NewL(25); - CleanupStack::PushL(servalertmsg); - - *servalertmsg = serverpushalertval; - - TInt id =0; - - CHbSymbianVariant* notifierid = CHbSymbianVariant::NewL(&id, - CHbSymbianVariant::EInt); - - - CHbSymbianVariant* serveralertmsg = CHbSymbianVariant::NewL(&aServerMsg, - CHbSymbianVariant::EDes); + { + TInt timeout = 30; // dummy + TBuf<30> header; // dummy + DmDevdialog.ShowConfirmationAlert(timeout,header,aServerMsg,status); + } + + User::WaitForRequest(status); - varMap->Add(*keyBuf,notifierid); - varMap->Add(*servalertmsg, serveralertmsg); // takes ownership - - LOGSTRING("HandleDisplayAlertL ServerHbNotifier step 2"); - - - RProperty propertykey; - - TRequestStatus status; - - TInt err = RProperty::Define(dmagentuid , EHbDMSyncNotifierKeyStatus, RProperty::EInt); - - err = RProperty::Define(dmagentuid , EHbDMSyncNotifierKeyStatusReturn, RProperty::EInt); - - TInt err1 = propertykey.Attach(dmagentuid , EHbDMSyncNotifierKeyStatus); - - propertykey.Subscribe(status); - - LOGSTRING2(" err = %d", err); - LOGSTRING2(" err1 = %d", err1); - - - LOGSTRING("HandleDisplayAlertL ServerHbNotifier step 3"); - - - devDialog = CHbDeviceDialogSymbian::NewL(); - devDialog->Show(KHbNotifier, *varMap); - - User::WaitForRequest(status); - - propertykey.Close(); - - - - - CleanupStack::PopAndDestroy(3); - - - if(devDialog) - { - delete devDialog; - devDialog = NULL; - } +DmDevdialog.Close(); LOGSTRING("HandleDisplayAlertL ServerHbNotifier end"); } diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/ds/settings/bld/nsmldssettings.mmp --- a/syncmlfw/ds/settings/bld/nsmldssettings.mmp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/ds/settings/bld/nsmldssettings.mmp Tue Jul 13 09:51:41 2010 +0530 @@ -54,6 +54,7 @@ SYSTEMINCLUDE /epoc32/include/libc SYSTEMINCLUDE /epoc32/include/ecom MW_LAYER_SYSTEMINCLUDE +OS_LAYER_SYSTEMINCLUDE LIBRARY bafl.lib ecom.lib efsrv.lib edbms.lib estor.lib euser.lib sysutil.lib diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/ds/settings/inc/NSmlProfileContentHandler.h --- a/syncmlfw/ds/settings/inc/NSmlProfileContentHandler.h Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/ds/settings/inc/NSmlProfileContentHandler.h Tue Jul 13 09:51:41 2010 +0530 @@ -24,8 +24,8 @@ #include #include #include //JIM is this needed ?? -#include "MXMLAttributes.h" -#include "MXMLContentHandler.h" +#include "xml/MXMLAttributes.h" +#include "xml/MXMLContentHandler.h" #include "nsmldssettings.h" //#include "nsmldsresourceprofiledefs.h" diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/ds/settings/src/NSmlDSSettings.cpp --- a/syncmlfw/ds/settings/src/NSmlDSSettings.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/ds/settings/src/NSmlDSSettings.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -26,7 +26,7 @@ #include "bautils.h" #include "nsmlroam.h" //XML profiles -#include "RXMLReader.h" +#include "xml/RXMLReader.h" #include "NSmlProfileContentHandler.h" #include //CRepository diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/ds/settings/src/pcsuite/NSmlDSProfileRes.rss --- a/syncmlfw/ds/settings/src/pcsuite/NSmlDSProfileRes.rss Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/ds/settings/src/pcsuite/NSmlDSProfileRes.rss Tue Jul 13 09:51:41 2010 +0530 @@ -120,7 +120,8 @@ profiledisplayname="Intellisync"; //username=""; //password=""; - serverurl="http://82.77.123.71:8080/services/syncml"; + // serverurl="http://82.77.123.71:8080/services/syncml"; + serverurl="https://sync.ovi.com:443/services/syncml"; serverid="Ovi.com"; profilehidden=0; transportid=0x101F99F0; diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/ds/syncagent/src/nsmldsagent.cpp --- a/syncmlfw/ds/syncagent/src/nsmldsagent.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/ds/syncagent/src/nsmldsagent.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -972,7 +972,7 @@ if ( !iDSContent->ClientItemCountAsked() ) { iDSContent->SetClientItemCountAsked(); - iDSObserver->OnSyncMLSyncProgress( MSyncMLProgressObserver::ESmlSendingModificationsToServer, iDSContent->ClientItemCount(), 0 ); + iDSObserver->OnSyncMLSyncProgress( MSyncMLProgressObserver::ESmlSendingModificationsToServer, iDSContent->ClientItemCount(), iDSContent->TaskId() ); } break; case CNSmlCmdsBase::EReturnBufferFull: diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/ds/syncagent/src/nsmldscmds.cpp --- a/syncmlfw/ds/syncagent/src/nsmldscmds.cpp Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/ds/syncagent/src/nsmldscmds.cpp Tue Jul 13 09:51:41 2010 +0530 @@ -1954,7 +1954,7 @@ } iDSObserver.OnSyncMLSyncProgress( MSyncMLProgressObserver::ESmlReceivingModificationsFromServer, - iDSContent.ServerItemCount(), 0 ); + iDSContent.ServerItemCount(), iDSContent.TaskId() ); } // If number of changes is more than batch limit then batch is used if diff -r a36219ae6585 -r 2e64dc50f295 syncmlfw/group/bld.inf --- a/syncmlfw/group/bld.inf Tue Jul 13 09:37:43 2010 +0530 +++ b/syncmlfw/group/bld.inf Tue Jul 13 09:51:41 2010 +0530 @@ -25,6 +25,7 @@ ../conf/datasync.confml MW_LAYER_CONFML(datasync.confml) ../conf/datasync_2000CF7E.crml MW_LAYER_CRML(datasync_2000CF7E.crml) ../conf/devman.confml MW_LAYER_CONFML(devman.confml) +../conf/CI_devman.confml MW_LAYER_CONFML(CI_devman.confml) ../conf/devman_101F9A0A.crml MW_LAYER_CRML(devman_101F9A0A.crml) ../conf/nsmlemailadapter.confml MW_LAYER_CONFML(nsmlemailadapter.confml) ../conf/nsmlemailadapter_101F99DF.crml MW_LAYER_CRML(nsmlemailadapter_101F99DF.crml) @@ -149,6 +150,3 @@ // Disabling OTA configuration //#include "../ds/ota/bld/bld.inf" -#include "../syncmlnotifier/group/bld.inf" -#include "../syncservice/group/bld.inf" - diff -r a36219ae6585 -r 2e64dc50f295 sysdef_1_5_1.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_5_1.dtd Tue Jul 13 09:51:41 2010 +0530 @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +