# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1251348187 -10800 # Node ID fc9cf246af832f3860ee56301baa3749ad47db44 # Parent 989d2f495d90b90c6aa157b080d618cff898a193 Revision: 200931 Kit: 200935 diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/group/sapiincludes.mmpi --- a/serviceproviders/group/sapiincludes.mmpi Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/group/sapiincludes.mmpi Thu Aug 27 07:43:07 2009 +0300 @@ -12,8 +12,8 @@ * Contributors: * * Description: Sapi include path dependencies. -* %created_by: lgaur % -* %date_created: Mon May 04 19:02:04 2009 % +* %created_by: vahegde % +* %date_created: Wed Jun 24 18:02:52 2009 % * Copyright © 2006-2007 Nokia. All rights reserved. * This material, including documentation and any related computer * programs, is protected by copyright controlled by Nokia. All @@ -31,6 +31,7 @@ #include SYSTEMINCLUDE \Epoc32\include\icl +SYSTEMINCLUDE \Epoc32\include\libc APP_LAYER_SYSTEMINCLUDE diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/conf/tappmgrprovider.cfg --- a/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/conf/tappmgrprovider.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/conf/tappmgrprovider.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -166,13 +166,3 @@ foobar getlisttest UserInstalledPackage NULL NULL 0 Temp 0 delete foobar [Endtest] - - - -[Test] -title LaunchDoc_Cancel -create tappmgrprovider foobar -//path handle MimeType mode callback expectedresult -foobar cancellaunchDoc c:\Data\vista.txt NULL NULL NULL callback 0 -delete foobar -[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/conf/tappmgrprovider_manual.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/conf/tappmgrprovider_manual.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,21 @@ +/* =========================================================================== + * Copyright © 2006-2007 Nokia Corporation. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia Corporation. All rights are reserved. Copying, + * including reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia Corporation. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia Corporation. + * ============================================================================ + */ + + +[Test] +title LaunchDoc_Cancel +create tappmgrprovider foobar +//path handle MimeType mode callback expectedresult +foobar cancellaunchDoc c:\Data\vista.txt NULL NULL NULL callback 0 +delete foobar +[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/data/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/data/readme.txt Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,22 @@ +/* +* ============================================================================== +* Copyright (c) 2007 Nokia Corporation. +* This material, including documentation and any related +* computer programs, is protected by copyright controlled by +* Nokia Corporation. All rights are reserved. Copying, +* including reproducing, storing, adapting or translating, any +* or all of this material requires the prior written consent of +* Nokia Corporation. This material also contains confidential +* information which may not be disclosed to others without the +* prior written consent of Nokia Corporation. +* ============================================================================== +*/ + +This readme describes the limitations for executing AppManager cases in Automated Mode + +The following cases are not working in Automated mode and has to be run Manually for verification +1)LaunchDoc_Cancel + +Pre-Requisites: +vista.txt has to be copied to c:\Data\vista.txt + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/init/testframework.ini --- a/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/init/testframework.ini Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrprovider/init/testframework.ini Thu Aug 27 07:43:07 2009 +0300 @@ -76,6 +76,7 @@ ModuleName= testscripter IniFile=c:\testframework\TestFramework.ini TestCaseFile= c:\TestFramework\tappmgrprovider.cfg +TestCaseFile= c:\TestFramework\tappmgrprovider_manual.cfg [End_Module] # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/conf/tappmgrtest.cfg --- a/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/conf/tappmgrtest.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/conf/tappmgrtest.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -89,15 +89,6 @@ delete foobar [Endtest] ----------------------------------------------------------------- - -[Test] -title LaunchApp_CancellaunchAppL_2 -create tappmgrtest foobar -// scheme uid commmandline doc mode postion callback expected -foobar CancellaunchAppL s60uid: 0x100058ca NULL NULL NULL NULL Callback 0 -delete foobar -[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/conf/tappmgrtest_manual.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/conf/tappmgrtest_manual.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,20 @@ +/* =========================================================================== + * Copyright © 2006-2007 Nokia Corporation. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia Corporation. All rights are reserved. Copying, + * including reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia Corporation. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia Corporation. + * ============================================================================ + */ + +[Test] +title LaunchApp_CancellaunchAppL_2 +create tappmgrtest foobar +// scheme uid commmandline doc mode postion callback expected +foobar CancellaunchAppL s60uid: 0x100058ca NULL NULL NULL NULL Callback 0 +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/data/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/data/readme.txt Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,22 @@ +/* +* ============================================================================== +* Copyright (c) 2007 Nokia Corporation. +* This material, including documentation and any related +* computer programs, is protected by copyright controlled by +* Nokia Corporation. All rights are reserved. Copying, +* including reproducing, storing, adapting or translating, any +* or all of this material requires the prior written consent of +* Nokia Corporation. This material also contains confidential +* information which may not be disclosed to others without the +* prior written consent of Nokia Corporation. +* ============================================================================== +*/ + +This readme describes the limitations for executing AppManager cases in Automated Mode + +The following cases are not working in Automated mode and has to be run Manually for verification +1)LaunchApp_CancellaunchAppL_2 + +Pre-Requisites: +-None + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/init/testframework.ini --- a/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/init/testframework.ini Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_applicationmanager/tsrc/testing/tappmgrtest/init/testframework.ini Thu Aug 27 07:43:07 2009 +0300 @@ -76,6 +76,7 @@ ModuleName= testscripter IniFile= c:\testframework\TestFramework.ini TestCaseFile= c:\testframework\tappmgrtest.cfg +TestCaseFile= c:\testframework\tappmgrtest_manual.cfg [End_Module] # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/bwins/calendarserviceu.def --- a/serviceproviders/sapi_calendar/calendarservice/bwins/calendarserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/bwins/calendarserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -115,4 +115,9 @@ ?Type@CRepeatInfo@@QAE?AW4TType@TCalRRule@@XZ @ 114 NONAME ; enum TCalRRule::TType CRepeatInfo::Type(void) ?UntilDate@CRepeatInfo@@QAEAAVTCalTime@@XZ @ 115 NONAME ; class TCalTime & CRepeatInfo::UntilDate(void) ?WeekStart@CRepeatInfo@@QAE?AW4TDay@@XZ @ 116 NONAME ; enum TDay CRepeatInfo::WeekStart(void) + ?GetListL@CCalendarService@@QAEXABVTDesC16@@PAVCCalendarFilter@@PAVMCalCallbackBase@@@Z @ 117 NONAME ; void CCalendarService::GetListL(class TDesC16 const &, class CCalendarFilter *, class MCalCallbackBase *) + ?GetListL@CCalendarService@@QAEXABVTDesC16@@ABVTDesC8@@PAVMCalCallbackBase@@@Z @ 118 NONAME ; void CCalendarService::GetListL(class TDesC16 const &, class TDesC8 const &, class MCalCallbackBase *) + ?GetListL@CCalendarService@@QAEXABVTDesC16@@KPAVMCalCallbackBase@@@Z @ 119 NONAME ; void CCalendarService::GetListL(class TDesC16 const &, unsigned long, class MCalCallbackBase *) + ?GlobalUid@CEntryAttributes@@QAE?AVTPtrC8@@XZ @ 120 NONAME ; class TPtrC8 CEntryAttributes::GlobalUid(void) + ?SetUidL@CEntryAttributes@@QAEXABVTDesC8@@@Z @ 121 NONAME ; void CEntryAttributes::SetUidL(class TDesC8 const &) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/eabi/calendarserviceu.def --- a/serviceproviders/sapi_calendar/calendarservice/eabi/calendarserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/eabi/calendarserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -141,4 +141,11 @@ _ZTV20CCalendarSessionInfo @ 140 NONAME ; ## _ZTV21CAsyncRequestObserver @ 141 NONAME ; ## _ZTV21CCalendarExportParams @ 142 NONAME ; ## + _ZN16CCalendarService8GetListLERK7TDesC16P15CCalendarFilterP16MCalCallbackBase @ 143 NONAME + _ZTI16CCalendarGetList @ 144 NONAME ; ## + _ZTV16CCalendarGetList @ 145 NONAME ; ## + _ZN16CCalendarService8GetListLERK7TDesC16RK6TDesC8P16MCalCallbackBase @ 146 NONAME + _ZN16CCalendarService8GetListLERK7TDesC16mP16MCalCallbackBase @ 147 NONAME + _ZN16CEntryAttributes7SetUidLERK6TDesC8 @ 148 NONAME + _ZN16CEntryAttributes9GlobalUidEv @ 149 NONAME diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/group/calendarservice.mmp --- a/serviceproviders/sapi_calendar/calendarservice/group/calendarservice.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/group/calendarservice.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -41,6 +41,7 @@ SOURCE calendarexport.cpp SOURCE addentry.cpp SOURCE entryattributes.cpp +SOURCE calendargetlist.cpp LIBRARY euser.lib diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/inc/addentry.h --- a/serviceproviders/sapi_calendar/calendarservice/inc/addentry.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/inc/addentry.h Thu Aug 27 07:43:07 2009 +0300 @@ -84,6 +84,14 @@ * @param aEntry The calendar entry to be modified */ void UpdateEntryAttributesL( CCalEntry* aEntry ); + /** + * Retrieves the instance for the given uid + * @param aInsStTime Instance start time + * @param aUid Uid + * @return CCalInstance* + */ + CCalInstance* GetGlobalInstanceL( const TCalTime& aInsStTime, + const TDesC8& aUid ); /** * Retrieves the instance for the given local uid diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/inc/calendargetlist.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_calendar/calendarservice/inc/calendargetlist.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,237 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface to GetListing the contents to a Calender +* +*/ + + +#ifndef CALENDARGETLIST_H_ +#define CALENDARGETLIST_H_ + + +//System Includes +#include + + +//Forward Declarations +class CCalSession; +class CCalEntryView; +class CCalendarSessionInfo; +class MCalCallbackBase; +class CCalendarFilter; +class CCalEntry; +class CCalInstance; + +/** + * This class provides functionality for Calendar GetList + * provides four versions of GetList Functionality Sync and Async + * @since S60_3_2_200726 + */ +class CCalendarGetList : public CCalendarASyncRequest/*, public CActive*/ + { + + enum TGetListOption + { + EGetListAll = 0, + EGetListGUid, + EGetListLocalUid, + EGetListTimeRange, + }; + + public: //*********************Public Members(Behaviours)******************************************/ + + /** + * Static Method which either returns the Two Phase constructed Object or Leave + * + * @param CCalendarSessionInfo to set the iCalenderSessionInfo which is used to access various resources + * like CCalSession, CCalEntryView etc + * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats + * + * @param aInputBuffer contains the data to be GetListed to the specified calendar + * + * @param CAsyncRequestObserver For ASyncronous usage of this Object this paramater is set / Default is NULL + * Set in case of Asynchronous call only + * @param MCalCallbackBase For Asyncronous usage of this Object this paramater is set + * + * NOTE: Ownership of any of the parameters is not taken through this function call + * NOTE: Therefore the User of this function needs to take care of neccessary cleanup of passed parameters + * @return CCalendarExport + */ + static CCalendarGetList* NewL ( CCalendarSessionInfo* aCalSessionInfo, + const TDesC8& aGuid, + CAsyncRequestObserver* aAsyncRequestObserver = NULL, + MCalCallbackBase* aCallBack = NULL ); + + static CCalendarGetList* NewL ( CCalendarSessionInfo* aCalSessionInfo, + const TCalLocalUid aLocalUid, + CAsyncRequestObserver* aAsyncRequestObserver = NULL, + MCalCallbackBase* aCallBack = NULL ); + + static CCalendarGetList* NewL ( CCalendarSessionInfo* aCalSessionInfo, + CCalendarFilter* aFilter, + CAsyncRequestObserver* aAsyncRequestObserver = NULL, + MCalCallbackBase* aCallBack = NULL ); + /** + * Destructor. + */ + ~CCalendarGetList(); + + /** + * Inherited from MAsyncRequest class + */ + void CancelRequest(); + + /** + * Inherited from MAsyncRequest class. + */ + // TInt32 GetTransactionID(); + + /** + * Synchronous Version of GetList which takes InputBuffer set at the time of Construction of this object through NewL + * and GetLists them to the Calender opened in CalSession of CalendarSessionInfoL object passed to this object + * It sets the LUids and GUids in the aOutputLocalUidArray, this object is not the owner of aOutputLocalUidArray + * @since S60_3_2_200726 + * + * @param aOutputLocalUidArray Output which is the array of LocalUIDs after StoreL on the Calender file + * + * @return void + */ + void GetListL(const TDesC8& aGuid, RPointerArray& aEntryList ); + + void GetListL(const TCalLocalUid aLocalUid, RPointerArray& aEntryList ); + + void GetListL( RPointerArray& aInstanceList ); + + /** + * ASynchronous Version of GetList which takes InputBuffer set at the time of Construction of this object through NewL + * and GetLists to the Calender(outputis passed through callback) + * + * @since S60_3_2_200726 + * + * @return void + */ + void GetListL(); + + private: //*********************Private Member(Behaviours)******************************************/ + + /** + * Constructor. + * @param CCalendarSessionInfo to set the iCalenderSessionInfo which is used to access various resources + * like CCalSession, CCalEntryView etc + * @param CAsyncRequestObserver For Asyncronous usage of this Object this paramater is set / Default is NULL + * @param MCalCallbackBase For Asyncronous usage of this Object this paramater is set + */ + CCalendarGetList( CCalendarSessionInfo* aCalSessionInfo, + CAsyncRequestObserver* aAsyncRequestObserver = NULL, + MCalCallbackBase* aCallBack = NULL ); + + /** + * 2nd Phase of Two Phase Construction + * @param aFormat used to set the iFormat it can be either ICAL or VCAL, two popular Calendar formats + * + * @param aInputBuffer contains the data to be GetListed to the specified calendar + * @return void + */ + void ConstructL( const TDesC8& aGuid ); + void ConstructL( const TCalLocalUid aLocalUid ); + void ConstructL( CCalendarFilter* aFilter ); + /** + * Service Functions to Enable Proper Completion of Asynchronous Request called at the end of RUNL to send output + * @param aReason Give the reason it can be KErrNone or any error + * + * @return void + */ + void NotifyRequestResult( TInt aReason ); + /** + * Inherited from CActive class...Active Object for Aynchronous Support + */ + virtual void DoCancel(); + + + /** + * Initializes delete option based in input filter + */ + void InitializeGetListOption(); + + /** + * Start Fetching Entries + */ + void StartFetchingL(); + + /** + * Gets Entries based on GUid + */ + void GetGUidL(); + /** + * Gets Entries based on LocalUid + */ + void GetLocalUidL(); + + /** + * Delete Instances based on Time Range + */ + void GetTimeRangeL(); + + /** + * Inherited from CActive class...Active Object for Aynchronous Support + */ + virtual void RunL(); + + /** + * Service Functions to activate the Asynchronous Request by activating the Active Object using SetActive() + * @param aReason Give the reason it can be KErrNone or any error + * + * @return void + */ + void ActivateRequest( TInt aReason ); + + private: //*********************Private Member(Properties)******************************************/ + + /** + * This is the handle to CCalendarSessionInfo Service class which is used to access various resources + * like CCalSession, CCalEntryView etc + * Pure USES A Relalationship...This class doesnot own this and So, it wont delete it + */ + CCalendarSessionInfo* iSessionInfo ; + + /** + * For Syncronous usage of this Object this paramater is set / Default is NULL + * Own. This class is responsible for deleting it. HAS A Relationship + */ + MCalCallbackBase* iCallBack; + + + /** + * For Syncronous usage of this Object this paramater is set / Default is NULL + * Own. This class is responsible for deleting it. HAS A Relationship + */ + + CAsyncRequestObserver* iAsyncRequestObserver; + + /** + * Filter Object + */ + CCalendarFilter* iFilter; + HBufC8* iGuid; + TUint32 iLocalUid; + + TGetListOption iGetListOption; + + RPointerArray iEntryList; + + RPointerArray iInstanceList; + }; + + +#endif CALENDARGETLIST_H_ diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/calendarservice/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -106,6 +106,28 @@ */ IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); + /** * Add new calendar in device. * @param aCalendarName Calendar Name diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/calendarservice/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -347,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -539,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -669,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -790,6 +804,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/src/addentry.cpp --- a/serviceproviders/sapi_calendar/calendarservice/src/addentry.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/src/addentry.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -73,7 +73,9 @@ void CCalendarAddEntry::AddL( TUIDSet*& aGuidAdded ) { if ( iCalendarEntry->ModifiedAttributes() & CEntryAttributes::ELocalUid ) - UpdateEntryL( aGuidAdded ); + UpdateEntryL( aGuidAdded ); + else if( iCalendarEntry->ModifiedAttributes() & CEntryAttributes::EGlobalUid ) + UpdateEntryL( aGuidAdded ); else AddNewEntryL( aGuidAdded ); } @@ -164,7 +166,10 @@ { aGuidAdded = new(ELeave) TUIDSet; - CleanupStack::PushL( aGuidAdded ); + CleanupStack::PushL( aGuidAdded ); + + TPtrC8 globaluid(KNullDesC8); + globaluid.Set( iCalendarEntry->GlobalUid()); // Instance Modification as the instance start time has been specified if( iCalendarEntry->ModifiedAttributes() & CEntryAttributes::EInsStartTime ) @@ -173,9 +178,21 @@ User::Leave( KErrArgument ); TCalTime instanceStTime = iCalendarEntry->InstanceStartTime(); + + CCalInstance* instance; + - // Fetch instance having start time specified - CCalInstance* instance = GetInstanceL( instanceStTime, iCalendarEntry->LocalUid() ); + // Fetch instance having start time and LocalUid specified and GlobalUid specified + if(iCalendarEntry->ModifiedAttributes() & CEntryAttributes::ELocalUid) + { + instance = GetInstanceL( instanceStTime, iCalendarEntry->LocalUid() ); + } + else if(iCalendarEntry->ModifiedAttributes() & CEntryAttributes::EGlobalUid) + { + instance = GetGlobalInstanceL(instanceStTime, globaluid); + } + + ///add code here if ( !instance ) User::Leave( KErrArgument ); @@ -245,8 +262,22 @@ else { // Fetch entry to be modified - CCalEntry* entry = iSessionInfo->EntryView()->FetchL( iCalendarEntry->LocalUid() ); - + CCalEntry* entry ; + + if(iCalendarEntry->ModifiedAttributes() & CEntryAttributes::ELocalUid) + { + entry = iSessionInfo->EntryView()->FetchL( iCalendarEntry->LocalUid() ); + } + else if(iCalendarEntry->ModifiedAttributes() & CEntryAttributes::EGlobalUid) + { + RPointerArray entryList; + CleanupStack::PushL( TCleanupItem(CleanupCCalEntryArray, &entryList) ); + iSessionInfo->EntryView()->FetchL( globaluid, entryList); + entry = entryList[0]; + entryList[0] = NULL; + CleanupStack::PopAndDestroy( &entryList ); + } + //Invalid LocalUID if( !entry ) User::Leave( KErrArgument ); @@ -644,7 +675,40 @@ return instance; } +// --------------------------------------------------------------------------- +// CCalendarAddEntry::GetGlobalInstanceL +// Retrieves the Instance for the given global Uid +// --------------------------------------------------------------------------- +// +CCalInstance* CCalendarAddEntry::GetGlobalInstanceL( const TCalTime& aInsStTime, + const TDesC8& aUid ) + { + CCalInstance* instance = NULL; + RPointerArray insArray( KArrayGran ); + + CleanupStack::PushL( TCleanupItem(CleanupCCalInstanceArray, &insArray) ); + + // Find instance having the instance start time specified + iSessionInfo->InstanceView()->FindInstanceL(insArray, CalCommon::EIncludeAll, + CalCommon::TCalTimeRange(aInsStTime, aInsStTime)); + + TInt count = insArray.Count(); + + for( TInt index = 0 ; index < count; index++ ) + { + if ( insArray[index]->Entry().UidL() == aUid ) + { + instance = insArray[index]; + insArray[index] = NULL; + break; + } + } + CleanupStack::PopAndDestroy( &insArray ); + + return instance; + + } // --------------------------------------------------------------------------- // CCalendarAddEntry::SetStartEndTimeL // Set instance start and end time diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/src/calendargetlist.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_calendar/calendarservice/src/calendargetlist.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,401 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +//System Includes +#include //for RPointerArray +#include //For CCalSession +#include +#include +#include +#include +#include +#include +#include +#include +//User Include +#include "calendarheader.h" +#include "calendarconstants.h" +#include "asyncreqobserver.h" +#include "calendargetlist.h" +#include "calendarheader.h" + +void CleanupCCalEntryArray(TAny* aPointer); +void CleanupCCalInstanceArray(TAny* aPointer); + +// -------------------------------------------------------------------------------------------------------- +// Static Method which either returns the Two Phase constructed Object or Leave +// NOTE: Ownership of any of the parameters is not taken through this function call +// NOTE: Therefore the User of this function needs to take care of neccessary cleanup of passed parameters +// -------------------------------------------------------------------------------------------------------- +// +CCalendarGetList* CCalendarGetList::NewL ( CCalendarSessionInfo* aCalSessionInfo, + const TDesC8& aGuid, + CAsyncRequestObserver* aAsyncRequestObserver, + MCalCallbackBase* aCallBack ) + { + CCalendarGetList* self = new (ELeave) CCalendarGetList( aCalSessionInfo, aAsyncRequestObserver, aCallBack ); + + CleanupStack::PushL(self); + + self->ConstructL( aGuid ); + + CleanupStack::Pop(self); + + return self; + } +// -------------------------------------------------------------------------------------------------------- +// Static Method which either returns the Two Phase constructed Object or Leave +// NOTE: Ownership of any of the parameters is not taken through this function call +// NOTE: Therefore the User of this function needs to take care of neccessary cleanup of passed parameters +// -------------------------------------------------------------------------------------------------------- +// +CCalendarGetList* CCalendarGetList::NewL ( CCalendarSessionInfo* aCalSessionInfo, + const TCalLocalUid aLocalUid, + CAsyncRequestObserver* aAsyncRequestObserver, + MCalCallbackBase* aCallBack ) + { + CCalendarGetList* self = new (ELeave) CCalendarGetList( aCalSessionInfo, aAsyncRequestObserver, aCallBack ); + + CleanupStack::PushL(self); + + self->ConstructL( aLocalUid ); + + CleanupStack::Pop(self); + + return self; + } +// -------------------------------------------------------------------------------------------------------- +// Static Method which either returns the Two Phase constructed Object or Leave +// NOTE: Ownership of any of the parameters is not taken through this function call +// NOTE: Therefore the User of this function needs to take care of neccessary cleanup of passed parameters +// -------------------------------------------------------------------------------------------------------- +// +CCalendarGetList* CCalendarGetList::NewL ( CCalendarSessionInfo* aCalSessionInfo, + CCalendarFilter* aFilter, + CAsyncRequestObserver* aAsyncRequestObserver, + MCalCallbackBase* aCallBack ) + { + CCalendarGetList* self = new (ELeave) CCalendarGetList( aCalSessionInfo, aAsyncRequestObserver, aCallBack ); + + CleanupStack::PushL(self); + // Construct filter object which determines the type of get + self->ConstructL( aFilter ); + + CleanupStack::Pop(self); + + return self; + } + + +// -------------------------------------------------------------------------------------------------------- +// Destructor. +// -------------------------------------------------------------------------------------------------------- +// +CCalendarGetList::~CCalendarGetList() + { + Cancel(); + + delete iFilter; + + delete iGuid; + + iEntryList.Reset(); + iInstanceList.Reset(); + } + + +// -------------------------------------------------------------------------------------------------------- +// Constructor. +// -------------------------------------------------------------------------------------------------------- +// +CCalendarGetList::CCalendarGetList( CCalendarSessionInfo* aCalSessionInfo, + CAsyncRequestObserver* aAsyncRequestObserver, + MCalCallbackBase* aCallBack ): + //CActive( EPriorityStandard ), + iSessionInfo (aCalSessionInfo ), + iCallBack( aCallBack ), + iAsyncRequestObserver(aAsyncRequestObserver) + { + + } + + +// -------------------------------------------------------------------------------------------------------- +// 2nd-phased constructor of two phase construction +// -------------------------------------------------------------------------------------------------------- +// +void CCalendarGetList::ConstructL( const TDesC8& aGuid ) + { + if(aGuid.Length()) + { + iGuid = aGuid.AllocL();// = aGuid ; + iGetListOption = EGetListGUid; + } + } + +void CCalendarGetList::ConstructL( const TCalLocalUid aLocalUid ) + { + + iLocalUid = aLocalUid; + iGetListOption = EGetListLocalUid; + } +// -------------------------------------------------------------------------------------------------------- +// GetList implementation +// -------------------------------------------------------------------------------------------------------- +// +void CCalendarGetList::ConstructL( CCalendarFilter* aFilter ) + { + + iFilter = CCalendarFilter::NewL(); + *iFilter = *aFilter; + iGetListOption = EGetListTimeRange; + + } + +void CCalendarGetList::GetListL( const TDesC8& aGuid, RPointerArray& aEntryList ) + { + iSessionInfo ->EntryView()->FetchL( aGuid, aEntryList ); + } + +void CCalendarGetList::GetListL(const TCalLocalUid aLocalUid, RPointerArray& aEntryList ) + { + CCalEntry* entry = iSessionInfo ->EntryView()->FetchL( aLocalUid ); + if( entry ) + { + aEntryList.Append( entry ); + } + } + +void CCalendarGetList::GetListL( RPointerArray& aInstanceList ) + { + // iInstanceList = aInstanceList; + CalCommon::TCalTimeRange range = iFilter->TimeRange(); + if( (range.EndTime().TimeLocalL()) < (range.StartTime().TimeLocalL()) ) + User::Leave( KErrArgument ); + if ( iFilter->FilterText().Length() ) + { + // Search and return all instances which match filter text and time range + CCalInstanceView::TCalSearchParams searchParam( iFilter->FilterText(), CalCommon::EFoldedTextSearch ); + iSessionInfo ->InstanceView()->FindInstanceL( aInstanceList, + iFilter->FilterType(), + iFilter->TimeRange(), searchParam ) ; + } + else + { + // Search and return all instances which match filter type and time range + iSessionInfo ->InstanceView()->FindInstanceL( aInstanceList, + iFilter->FilterType(), + iFilter->TimeRange() ) ; + } + } + +void CCalendarGetList::GetListL() + { + if( iCallBack ) // making call as asynchronous + { + if(!iAsyncRequestObserver ) + User::Leave( KErrArgument ); + + CActiveScheduler::Add ( this ); + + ActivateRequest( KErrNone ); + } + } +// -------------------------------------------------------------------------------------------------------- +// Notifies callback the result for asynchronous request. +// -------------------------------------------------------------------------------------------------------- +// +void CCalendarGetList::NotifyRequestResult( TInt aReason ) + { + + if ( iCallBack ) + { + iAsyncRequestObserver->RequestComplete( iCallBack->iTransactionId ); + + if( iGetListOption == EGetListGUid ) + { + TRAPD( err, iCallBack->NotifyResultL( aReason, ( TAny * )( & iEntryList ))); + } + else if( iGetListOption == EGetListLocalUid ) + { + TRAPD( err, iCallBack->NotifyResultL( aReason, ( TAny * )( & iEntryList ))); + } + else + { + TRAPD( err, iCallBack->NotifyResultL( aReason, ( TAny * )( & iInstanceList ))); + } + } + if ( aReason != KErrCancel ) + delete this; + } +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +// +void CCalendarGetList::DoCancel() + { + + NotifyRequestResult( KErrCancel ); + } + +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +// +void CCalendarGetList::RunL() + { + TInt err = iStatus.Int(); + + if ( err == KErrNone ) + { + // Performs the actual delete depending on the parameters set + TRAP(err, StartFetchingL()); + } + + NotifyRequestResult( err ); + } + +// -------------------------------------------------------------------------------------------------------- +// retrieves asynchronous request transactionid. +// -------------------------------------------------------------------------------------------------------- +// +/*TInt32 CCalendarGetList::GetTransactionID() + { + return(iCallBack->GetTransactionID()); + }*/ + + +// --------------------------------------------------------------------------- +// retrieves Instances based on Time Range +// --------------------------------------------------------------------------- +// +void CCalendarGetList::GetTimeRangeL() + { + + CalCommon::TCalTimeRange range = iFilter->TimeRange(); + if( (range.EndTime().TimeLocalL()) < (range.StartTime().TimeLocalL()) ) + User::Leave( KErrArgument ); + if ( iFilter->FilterText().Length() ) + { + // Search and return all instances which match filter text and time range + CCalInstanceView::TCalSearchParams searchParam( iFilter->FilterText(), CalCommon::EFoldedTextSearch ); + iSessionInfo ->InstanceView()->FindInstanceL( iInstanceList, + iFilter->FilterType(), + iFilter->TimeRange(), searchParam ) ; + } + else + { + // Search and return all instances which match filter type and time range + iSessionInfo ->InstanceView()->FindInstanceL( iInstanceList, + iFilter->FilterType(), + iFilter->TimeRange() ) ; + } + } + +// --------------------------------------------------------------------------- +// retrives Entries based in GlobalUid +// --------------------------------------------------------------------------- +// +void CCalendarGetList::GetGUidL() + { + TPtrC8 guid(iGuid->Des()); + + iSessionInfo ->EntryView()->FetchL( guid, iEntryList ); + } + +// --------------------------------------------------------------------------- +// retrives Entries based in LocalUid +// --------------------------------------------------------------------------- +// +void CCalendarGetList::GetLocalUidL() + { + + CCalEntry* entry = iSessionInfo ->EntryView()->FetchL( iLocalUid/*(*iFilter->LocalUidList())[0], iEntryList*/ ); + if( entry ) + { + iEntryList.Append( entry ); + } + } + +// --------------------------------------------------------------------------- +// Call the appropriate getlist based in getlist option +// --------------------------------------------------------------------------- +// +void CCalendarGetList::StartFetchingL() + { + switch ( iGetListOption ) + { + case EGetListGUid: // get guid - entries + GetGUidL(); + break; + + case EGetListLocalUid: // get localid - entries + GetLocalUidL(); + break; + + case EGetListTimeRange: // get time range - instances + GetTimeRangeL(); + break; + + default: + break; + } + } + +// --------------------------------------------------------------------------- +// Initialises getlist option +// --------------------------------------------------------------------------- +// +void CCalendarGetList::InitializeGetListOption() + { + //Filter having only GUids + if ( iFilter->Filter() == EFilterGUid ) + { + iGetListOption = EGetListGUid; + } + //Filter having only GUids + else if ( iFilter->Filter() == EFilterLUid ) + { + iGetListOption = EGetListLocalUid; + } + + //Filter having time range only (No GUid/LocalUid) + else + { + iGetListOption = EGetListTimeRange; + } + } +// --------------------------------------------------------------------------- +// Activates the asynchronous request +// --------------------------------------------------------------------------- +// +void CCalendarGetList::ActivateRequest( TInt aReason ) + { + + SetActive(); + + iStatus = KRequestPending; + + TRequestStatus* temp = &iStatus; + + User::RequestComplete( temp, aReason ); + + } + + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/src/calendarservice.cpp --- a/serviceproviders/sapi_calendar/calendarservice/src/calendarservice.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/src/calendarservice.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -34,7 +34,7 @@ #include "calendarexport.h" #include "addentry.h" #include "asyncreqobserver.h" - +#include "calendargetlist.h" // --------------------------------------------------------------------------- // Two-phased constructor. @@ -206,7 +206,13 @@ CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); // Get list of calendar entries using CCalEntryView - sessionInfo->EntryView()->FetchL( aGuid, aEntryList ); + CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aGuid ); + + CleanupStack::PushL( getlistObj ); + + getlistObj->GetListL( aGuid, aEntryList ); + + CleanupStack::PopAndDestroy( getlistObj ); } // --------------------------------------------------------------------------- @@ -216,13 +222,15 @@ EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, RPointerArray& aEntryList) { CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); - - // Fetch only that entry having local uid aLocalUid - CCalEntry* entry = sessionInfo->EntryView()->FetchL( aLocalUid ); - if( entry ) - { - aEntryList.Append( entry ); - } + + CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aLocalUid ); + + CleanupStack::PushL( getlistObj ); + + getlistObj->GetListL( aLocalUid, aEntryList ); + + CleanupStack::PopAndDestroy( getlistObj ); + } // --------------------------------------------------------------------------- @@ -236,27 +244,81 @@ User::Leave( KErrArgument ); CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); - CalCommon::TCalTimeRange range = aFilter->TimeRange(); - if( (range.EndTime().TimeLocalL()) < (range.StartTime().TimeLocalL()) ) - User::Leave( KErrArgument ); - if ( aFilter->FilterText().Length() ) - { - // Search and return all instances which match filter text and time range - CCalInstanceView::TCalSearchParams searchParam( aFilter->FilterText(), CalCommon::EFoldedTextSearch ); - sessionInfo->InstanceView()->FindInstanceL( aInstanceList, - aFilter->FilterType(), - aFilter->TimeRange(), searchParam ) ; - } - else - { - // Search and return all instances which match filter type and time range - sessionInfo->InstanceView()->FindInstanceL( aInstanceList, - aFilter->FilterType(), - aFilter->TimeRange() ) ; - } + + CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aFilter ); + + CleanupStack::PushL( getlistObj ); + + getlistObj->GetListL( aInstanceList ); + + CleanupStack::PopAndDestroy( getlistObj ); + } // --------------------------------------------------------------------------- +// Returns list of calendar instances from given calendar based on input filter and callback. +// --------------------------------------------------------------------------- +// +EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, + MCalCallbackBase* aCallBack ) + { + if ( !aFilter ) + User::Leave( KErrArgument ); + + CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); + + //Instantiate the getlist CoreClass Object + CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aFilter, iAsyncReqObserver, aCallBack ); + + //Push the GetlistObject onto the cleanup stack as the getlist function can Leave + CleanupStack::PushL( getlistObj ); + + getlistObj->GetListL(); + + AddAsyncObjL( aCallBack->iTransactionId, getlistObj ); + + CleanupStack::Pop( getlistObj ); + + } +// --------------------------------------------------------------------------- +// Returns list of calendar entries from given calendar with the given Global UID. +// --------------------------------------------------------------------------- +// +EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack) + { + CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); + + CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aGuid, iAsyncReqObserver, aCallBack ); + + CleanupStack::PushL( getlistObj ); + + getlistObj->GetListL(); + + AddAsyncObjL( aCallBack->iTransactionId, getlistObj ); + + CleanupStack::Pop( getlistObj ); + + } +// --------------------------------------------------------------------------- +// Returns list of calendar entries from given calendar with the given Local UID. +// --------------------------------------------------------------------------- +// +EXPORT_C void CCalendarService::GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack) + { + CCalendarSessionInfo* sessionInfo = CalendarSessionInfoL( aCalendarName ); + + CCalendarGetList* getlistObj = CCalendarGetList::NewL( sessionInfo, aLocalUid, iAsyncReqObserver, aCallBack ); + + CleanupStack::PushL( getlistObj ); + + getlistObj->GetListL(); + + AddAsyncObjL( aCallBack->iTransactionId, getlistObj ); + + CleanupStack::Pop( getlistObj ); + + } +// --------------------------------------------------------------------------- // Adds new calendar // --------------------------------------------------------------------------- // diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/calendarservice/src/entryattributes.cpp --- a/serviceproviders/sapi_calendar/calendarservice/src/entryattributes.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/calendarservice/src/entryattributes.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -453,6 +453,7 @@ delete iLocation; delete iPhoneOwner; delete iOrganizer; + delete iUid; iRepeatDates.Close(); iExDates.Close(); @@ -856,7 +857,18 @@ iLocal = aLUid; iSetAttributes |= ELocalUid; } - +// --------------------------------------------------------------------------- +// CEntryAttributes::SetUid +// --------------------------------------------------------------------------- +// +EXPORT_C void CEntryAttributes::SetUidL( const TDesC8& aUid ) + { + if( aUid.Length() ) + { + iUid = aUid.AllocL(); + iSetAttributes |= EGlobalUid; + } + } // --------------------------------------------------------------------------- // CEntryAttributes::SetRepeatRule // --------------------------------------------------------------------------- @@ -1058,6 +1070,14 @@ { return iLocal; } +// --------------------------------------------------------------------------- +// CEntryAttributes::GlobalUid +// --------------------------------------------------------------------------- +// +EXPORT_C TPtrC8 CEntryAttributes::GlobalUid() + { + return iUid ? TPtrC8( *iUid ) : TPtrC8(); + } // --------------------------------------------------------------------------- // CEntryAttributes::ModifiedAttributes diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/inc/calendarcallback.h --- a/serviceproviders/sapi_calendar/inc/calendarcallback.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/inc/calendarcallback.h Thu Aug 27 07:43:07 2009 +0300 @@ -26,6 +26,8 @@ #include #include "calendarheader.h" +class CCalendarInterface; + /** * Implemenation of abstract MCalCallbackBase interface for Buffer output * Used in Async Export operation @@ -33,6 +35,50 @@ * @see MCalCallbackBase * */ + +class CCalCallbackCalEntryList: public CBase, public MCalCallbackBase + { + public: + + /** + * Two-phase Constructor + * @return CMsgCallbackBase* + */ + static CCalCallbackCalEntryList* NewL( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, const TDesC& aCalendarName, TInt32 aTransactionId, TBool aIsEntryArray ); + + /** + * Gives the result of asynchronous SAPI + * @param aErrCode errcode + * @param aResult Result + * @return void + */ + void NotifyResultL(TInt aErrCode, TAny* aResult); + + // TInt32 GetTransactionID(); + ~CCalCallbackCalEntryList(); + private: + + /** + * Constructor + */ + CCalCallbackCalEntryList( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, TInt32 aTransactionId, TBool aIsEntryArray ); + void ConstructL( const TDesC& aCalendarName ); + + private: + TBool iIsEntryArray; + CCalendarInterface& iInterface; + /** + * Calendar Name + */ + HBufC* iCalendarName; + + /* MLiwNotifyCallback* iCallback; + TInt32 iTransactionId; + + */ + + }; + class CCalCallbackBaseBuffer: public CBase, public MCalCallbackBase //USED IN CASE OF EXPORT ASYNC { public: diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -116,6 +116,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -327,8 +349,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -574,6 +599,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/src/calendarcallback.cpp --- a/serviceproviders/sapi_calendar/src/calendarcallback.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/src/calendarcallback.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -23,6 +23,106 @@ // Two-phase Constructor // --------------------------------------------------------------------------- // +CCalCallbackCalEntryList* CCalCallbackCalEntryList::NewL( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, + const TDesC& aCalendarName, + TInt32 aTransactionId, TBool aIsEntryArray) + { + CCalCallbackCalEntryList* self = new(ELeave) CCalCallbackCalEntryList( aCalendarInterface, aPtrNotifyCallback, aTransactionId, aIsEntryArray ); + CleanupStack::PushL( self ) ; + self->ConstructL(aCalendarName); + CleanupStack::Pop(); + return self; + + // return new (ELeave) CCalCallbackCalEntryList( aCalendarInterface, aPtrNotifyCallback, aCalendarName, aTransactionId, aIsEntryArray ); + } +// --------------------------------------------------------------------------- +// Two-Phase constructor +// --------------------------------------------------------------------------- +// +void CCalCallbackCalEntryList::ConstructL( const TDesC& aCalendarName ) + { + if( aCalendarName.Length() ) + iCalendarName = aCalendarName.AllocL(); + } +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CCalCallbackCalEntryList::CCalCallbackCalEntryList( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, + TInt32 aTransactionId, + TBool aIsEntryArray ):iInterface( aCalendarInterface ) + + { + iPtrNotifyCallback = aPtrNotifyCallback; + iTransactionId = aTransactionId; + iIsEntryArray = aIsEntryArray; + } +CCalCallbackCalEntryList::~CCalCallbackCalEntryList() + { + delete iCalendarName; + } + +// ----------------------------------------------------------------------------- +// CCalendarCallback::GetTransactionId +// Gets transaction id for ongoing asynchronous method execution. +// ----------------------------------------------------------------------------- +// +/*TInt32 CCalCallbackCalEntryList::GetTransactionID() + { + return iTransactionId; + }*/ +// --------------------------------------------------------------------------- +// Gives the result of asynchronous SAPI for Export +// --------------------------------------------------------------------------- +// +void CCalCallbackCalEntryList::NotifyResultL( TInt aErrCode, TAny* aResult ) + { + CleanupStack::PushL( this ); + + CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); + + CleanupStack::PushL( outParams ); + + TPtrC calendarName( iCalendarName ? iCalendarName->Des() : TPtrC() ); + + outParams->AppendL( TLiwGenericParam(KErrorCode, + TLiwVariant(CCalendarInterface::ErrCodeConversion(aErrCode)))); + if( aResult ) + { + if(iIsEntryArray) + { + iInterface.SetCalEntryOutputL( *(RPointerArray*)( aResult ), *outParams, calendarName ); + } + else + { + iInterface.SetCalInstanceOutputL(*(RPointerArray*)( aResult ), *outParams, calendarName); + } + } + TInt event = KLiwEventInProgress; + + if ( aErrCode == KErrCancel ) + { + event = KLiwEventCanceled; + } + else if ( aErrCode != KErrNone ) + { + event = KLiwEventStopped; + outParams->AppendL( TLiwGenericParam(KErrorMessage, + TLiwVariant(_L("Calendar:GetList:Error fetching entries")))); + } + + ((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, + event, + *outParams, + *((CLiwGenericParamList*)iPtrInParamList) ); + CleanupStack::PopAndDestroy( 2,this ); + + } + +// --------------------------------------------------------------------------- +// Two-phase Constructor +// --------------------------------------------------------------------------- +// CCalCallbackBaseBuffer* CCalCallbackBaseBuffer::NewL( MLiwNotifyCallback *aPtrNotifyCallback, const CLiwGenericParamList& aPtrInParamList, TInt32 aTransactionId ) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/src/calendarinterface.cpp --- a/serviceproviders/sapi_calendar/src/calendarinterface.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/src/calendarinterface.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -175,21 +175,22 @@ else if ( aCmdName.CompareF( KCmdGetList ) == 0 ) { - if( !aCallback ) - { + if ( contentType.CompareF( KContentCalendar ) == 0 ) { - TRAP(errcode, GetListCalendarL( aInParamList, aOutParamList, posBased )); + if( !aCallback ) + { + TRAP(errcode, GetListCalendarL( aInParamList, aOutParamList, posBased )); + } + else + { + AppendErrorMessageL(aCmdName, KNullDesC8, KAsyncNotSupported); + } } else if ( contentType.CompareF( KContentCalendarEntry ) == 0 ) { - TRAP(errcode, GetListCalendarEntryL( aInParamList, aOutParamList, posBased )); + TRAP(errcode, GetListCalendarEntryL( aInParamList, aOutParamList, aCmdOptions, aCallback, posBased, transactionId )); } - } - else - { - AppendErrorMessageL(aCmdName, KNullDesC8, KAsyncNotSupported); - } } else if ( aCmdName.CompareF( KCmdReqNot ) == 0 ) @@ -512,8 +513,11 @@ // --------------------------------------------------------------------------- // void CCalendarInterface::GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ) + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId) { const TLiwGenericParam* filterParam = NULL; @@ -620,9 +624,48 @@ if( calName ) CleanupStack::PushL(calName); TPtrC calendarName( calName ? calName->Des() : TPtrC() ); + + //asynchronous version of getlist is called if callback is provided + if ( aCallback && ( KLiwOptASyncronous & aCmdOptions ) ) + { + aTransactionId = aCallback->GetTransactionID(); + + CCalCallbackCalEntryList* callback = NULL; + + + + + if(( filter->Filter() & EFilterGUid ) || ( filter->Filter() & EFilterLUid )) + { + callback = CCalCallbackCalEntryList::NewL( *this, aCallback, calendarName, aTransactionId, ETrue ); + } + else + { + callback = CCalCallbackCalEntryList::NewL( *this, aCallback, calendarName, aTransactionId, EFalse ); + } + + CleanupStack::PushL( callback ); + if ( filter->Filter() & EFilterGUid ) + { + // In case of GlobalUid only one entry is returned. + iCalService->GetListL( calendarName, (*filter->GuidList())[0], callback); + } + else if( filter->Filter() & EFilterLUid ) + { + // In case of LocalUid there can be more than one entry(child entries) + iCalService->GetListL( calendarName, (filter->LocalUidList())[0], callback); + } + else + { + iCalService->GetListL( calendarName , filter, callback ); + } + aOutParamList.AppendL(TLiwGenericParam( KTransactionID, TLiwVariant( aTransactionId ))); + + CleanupStack::Pop( callback ); + } // Return list of CalendarEntries if any of LocalUid or GlobalUid is passed as Filter. - if ( ( filter->Filter() & EFilterGUid ) || + else if ( ( filter->Filter() & EFilterGUid ) || ( filter->Filter() & EFilterLUid ) ) { CIterableCalEntryList* iterEntryList = CIterableCalEntryList::NewL( *this, calendarName, ETrue ); @@ -1176,6 +1219,8 @@ CleanupStack::PushL( entryAttributes ); + TBool id; + const TLiwGenericParam* param = NULL; if ( aPosBasedSearch ) @@ -1203,6 +1248,7 @@ TInt entryType = -1; if ( inMap->FindL( KLocalId, inParam ) ) { + id = EFalse; ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, KCmdAdd, KLocalId, KInvalid ); @@ -1212,6 +1258,19 @@ entryAttributes->SetLocalUid( localUid ); isUpdate = ETrue; } + if ( inMap->FindL( KId, inParam ) ) + { + id = ETrue; + ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, + KCmdAdd, KId, KInvalid ); + + HBufC8* globalUid = HBufC8::NewL(inParam.AsDes().Length()); + CleanupStack::PushL( globalUid ); + GetGlobalUid(inParam.AsDes(), globalUid->Des()); + entryAttributes->SetUidL( globalUid->Des() ); + CleanupStack::PopAndDestroy( globalUid ); + isUpdate = ETrue; + } if ( inMap->FindL( KType, inParam ) ) { @@ -1233,7 +1292,14 @@ //Get the type of the original entry. User cannot change the type if( isUpdate ) { - entryType = GetEntryType( aCalendarName, entryAttributes->LocalUid() ); + if(id) + { + entryType = GetEntryType( aCalendarName, entryAttributes->GlobalUid() ); + } + else + { + entryType = GetEntryType( aCalendarName, entryAttributes->LocalUid() ); + } if ( entryType == -1 ) { AppendErrorMessageL( KCmdAdd, KLocalId, KInvalid ); @@ -2393,7 +2459,64 @@ CleanupStack::Pop( uIDList ); } +// --------------------------------------------------------------------------- +// Set getlist output to output parameter +// --------------------------------------------------------------------------- +// +void CCalendarInterface::SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ) + { + + TInt arrCount = aOutputCalEntry.Count(); + + CIterableCalEntryList* iterEntryList = CIterableCalEntryList::NewL( *this, aCalendarName, ETrue ); + CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterEntryList ) ); + + for( TInt index = 0; index < arrCount; ++index ) + { + iterEntryList->EntryArray().Append(aOutputCalEntry[index]); + } + //Appending the Iterator over List of Maps to the outParamList CLiwGenericParamList + aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterEntryList ) ) ); + + iterEntryList->DecRef(); + + iArrayCalEntryList.Append( iterEntryList ); + + CleanupStack::Pop( iterEntryList ); + + } +// --------------------------------------------------------------------------- +// Set getlist output to output parameter +// --------------------------------------------------------------------------- +// +void CCalendarInterface::SetCalInstanceOutputL( RPointerArray& aOutputCalInstance, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName) + { + TInt arrCount = aOutputCalInstance.Count(); + + CIterableCalEntryList* iterInstanceList = CIterableCalEntryList::NewL( *this, aCalendarName, EFalse ); + CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterInstanceList ) ); + + for( TInt index = 0; index < arrCount; ++index ) + { + iterInstanceList->InstanceArray().Append(aOutputCalInstance[index]); + } + + // Appending the Iterator over List of Maps to the outParamList CLiwGenericParamList + aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterInstanceList ) ) ); + + iterInstanceList->DecRef(); + + iArrayCalEntryList.Append( iterInstanceList ); + + CleanupStack::Pop( iterInstanceList ); + + + } // --------------------------------------------------------------------------- // Set Change Notification output to output parameter // --------------------------------------------------------------------------- @@ -2912,7 +3035,22 @@ entryArray.ResetAndDestroy(); return entryType; } - +// --------------------------------------------------------------------------- +// Return Entry Type for given GlobalUid +// --------------------------------------------------------------------------- +// +TInt CCalendarInterface::GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ) + { + TInt entryType = -1; + RPointerArray entryArray; + iCalService->GetListL( aCalendarName, aGuid, entryArray); + if( entryArray.Count() ) + { + entryType = entryArray[0]->EntryTypeL(); + } + entryArray.ResetAndDestroy(); + return entryType; + } // --------------------------------------------------------------------------- // Check if given calendar is in use by other resources // --------------------------------------------------------------------------- diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -328,8 +328,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +578,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendaradditer3/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -117,6 +117,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +350,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +600,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarchangenotifyiter3/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -117,6 +117,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +350,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +600,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendardeleteiter3/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -117,6 +117,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +350,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +600,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarexportiter3/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/conf/tcalendargenerictest.cfg --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/conf/tcalendargenerictest.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/conf/tcalendargenerictest.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -441,7 +441,7 @@ title GetListCallWithAsyncParam create tcalendargenerictest foobar //foobar CheckInputArgumentType service InterfaceName Command Synchronousbit Callback varname vartype value Finish expectedvalue -foobar CheckInputArgumentType Service.Calendar IDataSource GetList 1 callback Type UnicodeString CalendarEntry Item Map SeqNum Int -1000 Type UnicodeString ToDo EndTime UnicodeString 20080101:083900 End Finish 1004 Done +foobar CheckInputArgumentType Service.Calendar IDataSource GetList 1 callback Type UnicodeString CalendarEntry Item Map SeqNum Int 50 Type UnicodeString ToDo EndTime UnicodeString 20080101:083900 End Finish 0 Done delete foobar [Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -117,6 +117,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +350,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +600,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargenerictest/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/conf/tcalendargetlistiter3.cfg --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/conf/tcalendargetlistiter3.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/conf/tcalendargetlistiter3.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -67,3 +67,86 @@ foobar GetListInvalidGUID delete foobar [Endtest] + +[Test] +title GetListGUidFilterAsync test +create tcalendargetlistiter3 foobar +foobar GetListGUidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListLocalUidFilterAsync test +create tcalendargetlistiter3 foobar +foobar GetListLocalUidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTimeRangeFilterAsync test +create tcalendargetlistiter3 foobar +foobar GetListTimeRangeFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTextFilterAsync test +create tcalendargetlistiter3 foobar +foobar GetListTextFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTypeFilterAsync test +create tcalendargetlistiter3 foobar +foobar GetListTypeFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListInvalidGUidFilterAsync test +create tcalendargetlistiter3 foobar +foobar GetListInvalidGUidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListInvalidLocalUidFilterAsync test +create tcalendargetlistiter3 foobar +foobar GetListInvalidLocalUidFilterAsync +delete foobar +[Endtest] +[Test] +title GetListGUidFilterCancelAsync test +create tcalendargetlistiter3 foobar +foobar GetListGUidFilterCancelAsync +delete foobar +[Endtest] + +[Test] +title GetListLocalUidFilterCancelAsync test +create tcalendargetlistiter3 foobar +foobar GetListLocalUidFilterCancelAsync +delete foobar +[Endtest] + +[Test] +title GetListTimeRangeFilterCancelAsync test +create tcalendargetlistiter3 foobar +foobar GetListTimeRangeFilterCancelAsync +delete foobar +[Endtest] + +[Test] +title GetListTextFilterCancelAsync test +create tcalendargetlistiter3 foobar +foobar GetListTextFilterCancelAsync +delete foobar +[Endtest] + +[Test] +title GetListTypeFilterCancelAsync test +create tcalendargetlistiter3 foobar +foobar GetListTypeFilterCancelAsync +delete foobar +[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -117,6 +117,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +350,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +600,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/tcalendargetlisttest.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/tcalendargetlisttest.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/inc/tcalendargetlisttest.h Thu Aug 27 07:43:07 2009 +0300 @@ -152,6 +152,21 @@ virtual TInt GetListInvalidLUID(CStifItemParser &aItem ); virtual TInt GetListInvalidGUID(CStifItemParser &aItem ); virtual TInt GetListInvalidCalName(CStifItemParser &aItem ); + + virtual TInt GetListGUidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListLocalUidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListTimeRangeFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListTextFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListTypeFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListInvalidGUidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListInvalidLocalUidFilterAsync(CStifItemParser &aItem ); + + virtual TInt GetListGUidFilterCancelAsync(CStifItemParser &aItem ); + virtual TInt GetListLocalUidFilterCancelAsync(CStifItemParser &aItem ); + virtual TInt GetListTimeRangeFilterCancelAsync(CStifItemParser &aItem ); + virtual TInt GetListTextFilterCancelAsync(CStifItemParser &aItem ); + virtual TInt GetListTypeFilterCancelAsync(CStifItemParser &aItem ); + public: // Data diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/src/tcalendargetlisttestblocks.cpp --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/src/tcalendargetlisttestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendargetlistiter3/src/tcalendargetlisttestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -45,6 +45,106 @@ void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid ); TDesC& GetEntry(MLiwInterface* interface, CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, TPtrC globaluid, const TDesC& calname); +class CCalGetListCallback : public MLiwNotifyCallback + { + public: + + static CCalGetListCallback* NewL(CActiveSchedulerWait* aWaitSchedular, TInt& aResult ); + + virtual ~CCalGetListCallback(){} + + TInt HandleNotifyL(TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + TInt iEntryAdded; + + private: + + CCalGetListCallback(CActiveSchedulerWait* aWaitSchedular, TInt& aResult ):iWaitSchedular(aWaitSchedular), iResult(aResult){ } + + CActiveSchedulerWait* iWaitSchedular; + TInt& iResult; + + + }; + +class CTestAsync : public CActive +{ +enum TTestCaseType + { + KGetlistGuidFilterAsync, + KGetlistLuidFilterAsync, + KGetlistTmRgFilterAsync, + KGetlistTextFilterAsync, + KGetlistTypeFilterAsync, + KGetlistInvalidGuidFilterAsync, + KGetlistInvalidLuidFilterAsync, + KGetlistGuidFilterCancelAsync, + KGetlistLuidFilterCancelAsync, + KGetlistTmRgFilterCancelAsync, + KGetlistTextFilterCancelAsync, + KGetlistTypeFilterCancelAsync, + }; + +public: + static CTestAsync* NewL(); + ~CTestAsync(); + void Start(); + + void TestGetlistGuidFilterAsyncL(); + void TestGetlistLuidFilterAsyncL(); + void TestGetlistTmRgFilterAsyncL(); + void TestGetlistTextFilterAsyncL(); + void TestGetlistTypeFilterAsyncL(); + void TestGetlistInvalidGuidFilterAsyncL(); + void TestGetlistInvalidLuidFilterAsyncL(); + + void TestGetlistGuidFilterCancelAsyncL(); + void TestGetlistLuidFilterCancelAsyncL(); + void TestGetlistTmRgFilterCancelAsyncL(); + void TestGetlistTextFilterCancelAsyncL(); + void TestGetlistTypeFilterCancelAsyncL(); + + void GuidAsyncL(); + void LuidAsyncL(); + void TmRgFilterAsyncL(); + void TextFilterAsyncL(); + void TypeFilterAsyncL(); + void InvalidGuidAsyncL(); + void InvalidLuidAsyncL(); + + void GuidCancelAsyncL(); + void LuidCancelAsyncL(); + void TmRgFilterCancelAsyncL(); + void TextFilterCancelAsyncL(); + void TypeFilterCancelAsyncL(); + + TInt Result(); + +private: + void ConstructL(); + CTestAsync(); + + virtual void DoCancel(); + virtual void RunL(); + + void TestFunc(); + + +private: + CLiwServiceHandler* iServiceHandler; + CActiveSchedulerWait* iWaitSchedular; + TInt iResult; + TInt iEntryAdded; + CCalGetListCallback* iCallback; + MLiwInterface* interface; + TInt32 iTransactionId; + TBool iEntryArray; + TTestCaseType iTestCaseType; +}; + +_LIT8(KCmdCancel, "Cancel"); _LIT8(KIDataSource, "IDataSource"); _LIT8(KService, "Service.Calendar"); @@ -93,6 +193,20 @@ ENTRY( "GetListInvalidCalName", CTCalendarGetListTest::GetListInvalidCalName ), ENTRY( "GetListInvalidGUID" , CTCalendarGetListTest::GetListInvalidGUID ), ENTRY( "GetListInvalidLUID" , CTCalendarGetListTest::GetListInvalidLUID ), + + ENTRY( "GetListGUidFilterAsync", CTCalendarGetListTest::GetListGUidFilterAsync ), + ENTRY( "GetListLocalUidFilterAsync", CTCalendarGetListTest::GetListLocalUidFilterAsync ), + ENTRY( "GetListTimeRangeFilterAsync",CTCalendarGetListTest::GetListTimeRangeFilterAsync ), + ENTRY( "GetListTextFilterAsync", CTCalendarGetListTest::GetListTextFilterAsync ), + ENTRY( "GetListTypeFilterAsync", CTCalendarGetListTest::GetListTypeFilterAsync ), + ENTRY( "GetListInvalidGUidFilterAsync", CTCalendarGetListTest::GetListInvalidGUidFilterAsync ), + ENTRY( "GetListInvalidLocalUidFilterAsync", CTCalendarGetListTest::GetListInvalidLocalUidFilterAsync ), + + ENTRY( "GetListGUidFilterCancelAsync", CTCalendarGetListTest::GetListGUidFilterCancelAsync ), + ENTRY( "GetListLocalUidFilterCancelAsync", CTCalendarGetListTest::GetListLocalUidFilterCancelAsync ), + ENTRY( "GetListTimeRangeFilterCancelAsync",CTCalendarGetListTest::GetListTimeRangeFilterCancelAsync ), + ENTRY( "GetListTextFilterCancelAsync", CTCalendarGetListTest::GetListTextFilterCancelAsync ), + ENTRY( "GetListTypeFilterCancelAsync", CTCalendarGetListTest::GetListTypeFilterCancelAsync ), }; const TInt count = sizeof( KFunctions ) / @@ -1404,7 +1518,236 @@ return result; } - +//_LIT8(KErrorCode,"ErrorCode"); +TInt CTCalendarGetListTest::GetListGUidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistGuidFilterAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + + } +TInt CTCalendarGetListTest::GetListLocalUidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistLuidFilterAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + } + +TInt CTCalendarGetListTest::GetListTimeRangeFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistTmRgFilterAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + + } + + +// +//Whats done here? +// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt +// +TInt CTCalendarGetListTest::GetListTextFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistTextFilterAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + + + } + + +// +//Whats done here? +// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt +// +TInt CTCalendarGetListTest::GetListTypeFilterAsync(CStifItemParser& /*aItem*/ ) + { + + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistTypeFilterAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + + } +TInt CTCalendarGetListTest::GetListInvalidGUidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistInvalidGuidFilterAsyncL(); + result = test->Result(); + if(result == KErrGeneral) + { + result = KErrNone; + } + delete test; + + __UHEAP_MARKEND; + + return result; + + } +TInt CTCalendarGetListTest::GetListInvalidLocalUidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistInvalidLuidFilterAsyncL(); + result = test->Result(); + if(result == KErrGeneral) + { + result = KErrNone; + } + delete test; + + __UHEAP_MARKEND; + + return result; + } + +TInt CTCalendarGetListTest::GetListGUidFilterCancelAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistGuidFilterCancelAsyncL(); + result = test->Result(); + // test->CancelNotification(); + delete test; + + __UHEAP_MARKEND; + + return result; + + } +TInt CTCalendarGetListTest::GetListLocalUidFilterCancelAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistLuidFilterCancelAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + } + +TInt CTCalendarGetListTest::GetListTimeRangeFilterCancelAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistTmRgFilterCancelAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + + } + + +// +//Whats done here? +// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt +// +TInt CTCalendarGetListTest::GetListTextFilterCancelAsync(CStifItemParser& /*aItem*/ ) + { + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistTextFilterCancelAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + + + } + + +// +//Whats done here? +// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt +// +TInt CTCalendarGetListTest::GetListTypeFilterCancelAsync(CStifItemParser& /*aItem*/ ) + { + + TInt result=KErrNone; + + __UHEAP_MARK; + + CTestAsync* test = CTestAsync::NewL(); + test->TestGetlistTypeFilterCancelAsyncL(); + result = test->Result(); + delete test; + + __UHEAP_MARKEND; + + return result; + + } TInt RemoveProvCalendar(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, MLiwInterface* interface, const TDesC& aCalendar) { @@ -1921,4 +2264,1523 @@ return err; }; - \ No newline at end of file + +/** + * Callback class for asynchronous SAPI message header +*/ +CCalGetListCallback* CCalGetListCallback::NewL(CActiveSchedulerWait* aWaitSchedular, TInt& aResult) + { + return new (ELeave) CCalGetListCallback(aWaitSchedular, aResult); + } + +TInt CCalGetListCallback::HandleNotifyL(TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList) + { + TInt pos = 0; + TInt result = KErrNone; + const TLiwGenericParam* output = aEventParamList.FindFirst( pos,_L8("ReturnValue")); + + if(output) + { + CLiwIterable* iterlist = output->Value().AsIterable(); + + TInt returnItems = 0; + + if(iterlist) + { + TLiwVariant data; + + while ( iterlist->NextL(data) ) + returnItems++; + + data.Reset(); + } + if ( iWaitSchedular && iWaitSchedular->IsStarted()) + { + iWaitSchedular->AsyncStop(); + } + + if(returnItems == 0) + { + return KErrGeneral; + } + } + + return 0; + } +CTestAsync* CTestAsync::NewL() + { + CTestAsync* self = new (ELeave) CTestAsync(); + self->ConstructL(); + return self; + } + +CTestAsync::~CTestAsync() + { + Cancel(); + + interface->Close(); + + delete iServiceHandler; + + delete iCallback; + + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + + delete iWaitSchedular; + } + + +void CTestAsync::ConstructL() + { + CActiveScheduler::Add(this); + iWaitSchedular = new(ELeave) CActiveSchedulerWait(); + } + + +CTestAsync::CTestAsync() : +CActive(EPriorityStandard) + { + interface = NULL ; + iResult = KErrNone; + // iResult = KErrGeneral; + } + +void CTestAsync::DoCancel() + { + + } + +void CTestAsync::TestGetlistGuidFilterAsyncL() + { + iTestCaseType = KGetlistGuidFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistLuidFilterAsyncL() + { + iTestCaseType = KGetlistLuidFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistTmRgFilterAsyncL() + { + iTestCaseType = KGetlistTmRgFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistTextFilterAsyncL() + { + iTestCaseType = KGetlistTextFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistTypeFilterAsyncL() + { + iTestCaseType = KGetlistTypeFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistInvalidGuidFilterAsyncL() + { + iTestCaseType = KGetlistInvalidGuidFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistInvalidLuidFilterAsyncL() + { + iTestCaseType = KGetlistInvalidLuidFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistGuidFilterCancelAsyncL() + { + iTestCaseType = KGetlistGuidFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistLuidFilterCancelAsyncL() + { + iTestCaseType = KGetlistLuidFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistTmRgFilterCancelAsyncL() + { + iTestCaseType = KGetlistTmRgFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistTextFilterCancelAsyncL() + { + iTestCaseType = KGetlistTextFilterAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::TestGetlistTypeFilterCancelAsyncL() + { + iTestCaseType = KGetlistTypeFilterCancelAsync; + + if(iResult == KErrNone) + Start(); + } + +void CTestAsync::RunL() + { + switch( iTestCaseType ) + { + case KGetlistGuidFilterAsync : + GuidAsyncL(); + break; + case KGetlistLuidFilterAsync : + LuidAsyncL(); + break; + case KGetlistTmRgFilterAsync : + TmRgFilterAsyncL(); + break; + case KGetlistTextFilterAsync : + TextFilterAsyncL(); + break; + case KGetlistTypeFilterAsync : + TypeFilterAsyncL(); + break; + case KGetlistInvalidGuidFilterAsync : + InvalidGuidAsyncL(); + break; + case KGetlistInvalidLuidFilterAsync : + InvalidLuidAsyncL(); + break; + case KGetlistGuidFilterCancelAsync : + GuidCancelAsyncL(); + break; + case KGetlistLuidFilterCancelAsync : + LuidCancelAsyncL(); + break; + case KGetlistTmRgFilterCancelAsync : + TmRgFilterCancelAsyncL(); + break; + case KGetlistTextFilterCancelAsync : + TextFilterCancelAsyncL(); + break; + case KGetlistTypeFilterCancelAsync : + TypeFilterCancelAsyncL(); + break; + + } + } +TInt CTestAsync::Result() + { + return iResult; + } +void CTestAsync::Start() + { + SetActive(); + TRequestStatus* temp = &iStatus; + User::RequestComplete(temp, KErrNone); + iWaitSchedular->Start(); + } + +void CTestAsync::GuidAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + + TBuf<100> gid; + gid.Copy( arruids[0]->iGlobalUID->Des() ); + map->InsertL(_L8("id"), TLiwVariant(gid) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::LuidAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + TBuf<50> globaluid; + TBuf<10> luid; + //luid.Num(TInt64(arruids[0]->iLocalUID)); + globaluid.Copy(arruids[0]->iGlobalUID->Des()); + luid.Num(TInt64(arruids[0]->iLocalUID)); + // luid = GetEntry(interface, inParamList, outParamList, globaluid, KTestCal1File); + map->InsertL(_L8("LocalId"), TLiwVariant(luid)); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::TmRgFilterAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("StartRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))) ); + map->InsertL(_L8("EndRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,30,0,0))) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::TextFilterAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("SearchText"), TLiwVariant(_L("Meeting")) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::TypeFilterAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("Type"), TLiwVariant(_L("Meeting")) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::InvalidGuidAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("id"), TLiwVariant(_L("abc")) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::InvalidLuidAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("LocalId"), TLiwVariant(_L("0")) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } + +void CTestAsync::GuidCancelAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + + TBuf<100> gid; + gid.Copy( arruids[0]->iGlobalUID->Des() ); + map->InsertL(_L8("id"), TLiwVariant(gid) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + inParamList->AppendL(iTransactionId); + TRAPD(err1, interface->ExecuteCmdL(KCmdCancel, *inParamList, *outParamList, KLiwOptCancel )); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::LuidCancelAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + TBuf<50> globaluid; + TBuf<10> luid; + //luid.Num(TInt64(arruids[0]->iLocalUID)); + globaluid.Copy(arruids[0]->iGlobalUID->Des()); + luid.Num(TInt64(arruids[0]->iLocalUID)); + // luid = GetEntry(interface, inParamList, outParamList, globaluid, KTestCal1File); + map->InsertL(_L8("LocalId"), TLiwVariant(luid)); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + inParamList->AppendL(iTransactionId); + TRAPD(err1, interface->ExecuteCmdL(KCmdCancel, *inParamList, *outParamList, KLiwOptCancel )); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::TmRgFilterCancelAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("StartRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,23,10,0,0,0))) ); + map->InsertL(_L8("EndRange"), TLiwVariant(TTime(TDateTime(2007,EOctober,30,10,30,0,0))) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + inParamList->AppendL(iTransactionId); + TRAPD(err1, interface->ExecuteCmdL(KCmdCancel, *inParamList, *outParamList, KLiwOptCancel )); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::TextFilterCancelAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("SearchText"), TLiwVariant(_L("Meeting")) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + inParamList->AppendL(iTransactionId); + TRAPD(err1, interface->ExecuteCmdL(KCmdCancel, *inParamList, *outParamList, KLiwOptCancel )); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } +void CTestAsync::TypeFilterCancelAsyncL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + + outParamList->FindFirst(pos,KIDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + + RemoveProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + AddProvCalendar(inParamList, outParamList, interface, KTestCal1File); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddProvAppointmentDailyRepeat(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddProvEvent(inParamList, outParamList, interface, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + map->InsertL(_L8("CalendarName"), TLiwVariant(KTestCal1File) ); + map->InsertL(_L8("Type"), TLiwVariant(_L("Meeting")) ); + + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + TInt err =0 ; + iCallback = CCalGetListCallback::NewL(iWaitSchedular, iResult); + + TRAP(err, interface->ExecuteCmdL( KCmdGetList ,*inParamList ,*outParamList,KLiwOptASyncronous,iCallback)); + pos = 0; + const TLiwGenericParam* output = outParamList->FindFirst( pos,_L8("TransactionID")); + + if(output) + { + iTransactionId = output->Value().AsTInt32(); + inParamList->AppendL(iTransactionId); + TRAPD(err1, interface->ExecuteCmdL(KCmdCancel, *inParamList, *outParamList, KLiwOptCancel )); + } + else + { + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + } + inParamList->Reset(); + outParamList->Reset(); + + arruids.ResetAndDestroy(); + } + else + iResult = KErrGeneral; + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -117,6 +117,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +350,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +600,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarimportiter3/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/conf/tcalendarupdateiter3.cfg --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/conf/tcalendarupdateiter3.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/conf/tcalendarupdateiter3.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -54,3 +54,45 @@ foobar UpdateTodoEntry delete foobar [Endtest] + +[Test] +title UpdateAppointmentEntryWithGlobalId test +create tcalendarupdateiter3 foobar +foobar UpdateAppointmentEntryWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateReminderWithGlobalId test +create tcalendarupdateiter3 foobar +foobar UpdateReminderWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateAnniversaryWithGlobalId test +create tcalendarupdateiter3 foobar +foobar UpdateAnniversaryWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateDayEventWithGlobalId test +create tcalendarupdateiter3 foobar +foobar UpdateDayEventWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateTodoEntryWithGlobalId test +create tcalendarupdateiter3 foobar +foobar UpdateTodoEntryWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateAppointmentEntryWithNewTimeAndGlobalId test +create tcalendarupdateiter3 foobar +foobar UpdateAppointmentEntryWithNewTimeAndGlobalId +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -117,6 +117,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +350,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +600,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/tcalendarupdatetest.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/tcalendarupdatetest.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/inc/tcalendarupdatetest.h Thu Aug 27 07:43:07 2009 +0300 @@ -149,8 +149,14 @@ virtual TInt UpdateDayEventL(CStifItemParser &aItem ); virtual TInt UpdateReminderL(CStifItemParser &aItem ); virtual TInt UpdateTodoEntryL(CStifItemParser &aItem ); - - + + virtual TInt UpdateAppointmentEntryWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateAnniversaryWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateDayEventWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateReminderWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateTodoEntryWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateAppointmentEntryWithNewTimeAndGlobalIdL(CStifItemParser &aItem ); + public: // Data //?data_declaration; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/src/tcalendarupdatetestblocks.cpp --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/src/tcalendarupdatetestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendarprovidertest/tcalendarupdateiter3/src/tcalendarupdatetestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -74,6 +74,13 @@ int UpdateDayEventL(); int UpdateReminderL(); int UpdateTodoEntryL(); + int UpdateAppointmentEntryWithGlobalIdL(); + int UpdateAnniversaryWithGlobalIdL(); + int UpdateDayEventWithGlobalIdL(); + int UpdateReminderWithGlobalIdL(); + int UpdateTodoEntryWithGlobalIdL(); + int UpdateAppointmentEntryWithNewTimeAndGlobalIdL(); + TDesC& GetEntry(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, TPtrC globaluid, const TDesC& calname); CTestUpdateSync(); ~CTestUpdateSync(); @@ -152,6 +159,13 @@ ENTRY( "UpdateReminder", CTCalendarUpdateTest::UpdateReminderL), ENTRY( "UpdateTodoEntry", CTCalendarUpdateTest::UpdateTodoEntryL), + ENTRY( "UpdateAppointmentEntryWithGlobalId", CTCalendarUpdateTest::UpdateAppointmentEntryWithGlobalIdL), + ENTRY( "UpdateAnniversaryWithGlobalId", CTCalendarUpdateTest::UpdateAnniversaryWithGlobalIdL), + ENTRY( "UpdateDayEventWithGlobalId", CTCalendarUpdateTest::UpdateDayEventWithGlobalIdL), + ENTRY( "UpdateReminderWithGlobalId", CTCalendarUpdateTest::UpdateReminderWithGlobalIdL), + ENTRY( "UpdateTodoEntryWithGlobalId", CTCalendarUpdateTest::UpdateTodoEntryWithGlobalIdL), + ENTRY( "UpdateAppointmentEntryWithNewTimeAndGlobalId", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndGlobalIdL ), + }; const TInt count = sizeof( KFunctions ) / @@ -163,8 +177,8 @@ // ----------------------------------------------------------------------------- -// CTCalendarUpdateTest::ImportAsync -// Test Method to test the ImportAsync(ASynchronous) +// CTCalendarUpdateTest::UpdateAppointmentEntryL +// Test Method to test the UpdateAsync(ASynchronous) // Functionality of CalenderService // ----------------------------------------------------------------------------- // @@ -311,7 +325,112 @@ // __UHEAP_MARKEND; return result; } +TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithGlobalIdL(CStifItemParser& /*aItem*/) + { + //__UHEAP_MARK; + TInt result=KErrNone; + + __UHEAP_MARK; + CTestUpdateSync* test = CTestUpdateSync::NewL(); + int res = test->UpdateAppointmentEntryWithGlobalIdL(); + delete test; + __UHEAP_MARKEND; + return res; + + +// __UHEAP_MARKEND; + return result; + } + +TInt CTCalendarUpdateTest::UpdateAnniversaryWithGlobalIdL(CStifItemParser& /*aItem*/) + { + //__UHEAP_MARK; + + TInt result=KErrNone; + + __UHEAP_MARK; + CTestUpdateSync* test = CTestUpdateSync::NewL(); + int res = test->UpdateAnniversaryWithGlobalIdL(); + delete test; + __UHEAP_MARKEND; + return res; + + +// __UHEAP_MARKEND; + return result; + } + +TInt CTCalendarUpdateTest::UpdateDayEventWithGlobalIdL(CStifItemParser& /*aItem*/) + { + //__UHEAP_MARK; + + TInt result=KErrNone; + + __UHEAP_MARK; + CTestUpdateSync* test = CTestUpdateSync::NewL(); + int res = test->UpdateDayEventWithGlobalIdL(); + delete test; + __UHEAP_MARKEND; + return res; + + +// __UHEAP_MARKEND; + return result; + } + +TInt CTCalendarUpdateTest::UpdateReminderWithGlobalIdL(CStifItemParser& /*aItem*/) + { + //__UHEAP_MARK; + + TInt result=KErrNone; + + __UHEAP_MARK; + CTestUpdateSync* test = CTestUpdateSync::NewL(); + int res = test->UpdateReminderWithGlobalIdL(); + delete test; + __UHEAP_MARKEND; + return res; + + +// __UHEAP_MARKEND; + return result; + } +TInt CTCalendarUpdateTest::UpdateTodoEntryWithGlobalIdL(CStifItemParser& /*aItem*/) + { + //__UHEAP_MARK; + + TInt result=KErrNone; + + __UHEAP_MARK; + CTestUpdateSync* test = CTestUpdateSync::NewL(); + int res = test->UpdateReminderWithGlobalIdL(); + delete test; + __UHEAP_MARKEND; + return res; + + +// __UHEAP_MARKEND; + return result; + } +TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndGlobalIdL(CStifItemParser& /*aItem*/) + { + //__UHEAP_MARK; + + TInt result=KErrNone; + + __UHEAP_MARK; + CTestUpdateSync* test = CTestUpdateSync::NewL(); + int res = test->UpdateAppointmentEntryWithNewTimeAndGlobalIdL(); + delete test; + __UHEAP_MARKEND; + return res; + + +// __UHEAP_MARKEND; + return result; + } + TInt CTestUpdateSync::UpdateAppointmentEntryL() { iServiceHandler = CLiwServiceHandler::NewL(); @@ -1638,7 +1757,904 @@ return retvalue; } - + +TInt CTestUpdateSync::UpdateAppointmentEntryWithGlobalIdL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + + TInt err; + RCriteriaArray interest; + CleanupClosePushL(interest); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + CleanupStack::PushL(crit); + interest.AppendL(crit); + + iServiceHandler->AttachL(interest); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + TInt pos = 0; + + outparam->FindFirst( pos, KTestInterface ); + if(pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + CleanupStack::PopAndDestroy(crit); + CleanupStack::PopAndDestroy(&interest); + + outparam->Reset(); + inparam->Reset(); + + AddProvCalendar(inparam, outparam, interface, KKCalFileName11); + TUIDSet* uidset1; + TBuf<50> globaluid; + TBuf<10> localuid; + //AddProvAppointmentDailyRepeatAndAttendees(inparam, outparam, interface, KKCalFileName11 ,uidset1 ); + AddProvAppointmentWithoutRepeat(inparam, outparam, interface, KKCalFileName11 ,uidset1); + //localuid.Num(TInt64(uidset1->iLocalUID)); + globaluid.Copy(uidset1->iGlobalUID->Des()); + localuid = GetEntry( inparam, outparam, globaluid, KKCalFileName11); + + CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map1); + + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inparam->AppendL(element1); + content.Reset(); + element1.Reset(); + + + map1->InsertL(_L8("CalendarName"), TLiwVariant(KKCalFileName11) ); + map1->InsertL(_L8("id"),TLiwVariant(globaluid)); + map1->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,3,10,0,0,0)))); + map1->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,3,10,30,0,0)))); + map1->InsertL(_L8("AlarmTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,3,9,30,0,0)))); + TLiwGenericParam element; + element.SetNameAndValueL(_L8("Item"),TLiwVariant(map1)); + + inparam->AppendL(element); + element.Reset(); + map1->DecRef(); + CleanupStack::Pop(map1); + + TRAPD(err1, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam )); + + inparam->Reset(); + outparam->Reset(); + + TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); + inparam->AppendL(dsNameParam); + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + inparam->AppendL(filterParam); + filterMap->DecRef(); + + filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA"))); + filterMap->InsertL(_L8("LocalId"),TLiwVariant(localuid)); + + TRAP(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam)); + + pos = 0 ; + + const TLiwGenericParam* finaloutput = outparam->FindFirst( pos,_L8("ReturnValue")); + TInt count = 0; + CLiwMap* map; + TInt retvalue = KErrNone; + if ( finaloutput ) + { + CLiwIterable* iterlist = finaloutput->Value().AsIterable(); + if(iterlist) + { + TLiwVariant data1; + while(iterlist->NextL(data1) ) + { + const CLiwMap* res = data1.AsMap(); + if ( res ) + { + TLiwVariant data; + if(res->FindL(_L8("StartTime"), data)) + { + TTime ostime(TDateTime(2007,EOctober,3,10,0,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + if(res->FindL(_L8("EndTime"), data)) + { + TTime ostime(TDateTime(2007,EOctober,3,10,30,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + data.Reset(); + } + } + data1.Reset(); + } + } + + inparam->Reset(); + outparam->Reset(); + delete uidset1; + RemoveProvCalendar(inparam, outparam, interface, KKCalFileName11); + return retvalue; + } +TInt CTestUpdateSync::UpdateAnniversaryWithGlobalIdL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + + TInt err; + RCriteriaArray interest; + CleanupClosePushL(interest); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + CleanupStack::PushL(crit); + interest.AppendL(crit); + + iServiceHandler->AttachL(interest); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + TInt pos = 0; + + outparam->FindFirst( pos, KTestInterface ); + if(pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + CleanupStack::PopAndDestroy(crit); + CleanupStack::PopAndDestroy(&interest); + + outparam->Reset(); + inparam->Reset(); + + AddProvCalendar(inparam, outparam, interface, KKCalFileName11); + TUIDSet* uidset1; + TBuf<50> globaluid; + TBuf<10> localuid; + //AddProvAppointmentDailyRepeatAndAttendees(inparam, outparam, interface, KKCalFileName11 ,uidset1 ); + AddProvAnni(inparam, outparam, interface, KKCalFileName11 ,uidset1); + //localuid.Num(TInt64(uidset1->iLocalUID)); + globaluid.Copy(uidset1->iGlobalUID->Des()); + localuid = GetEntry( inparam, outparam, globaluid, KKCalFileName11); + CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map1); + + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inparam->AppendL(element1); + content.Reset(); + element1.Reset(); + + + map1->InsertL(_L8("CalendarName"), TLiwVariant(KKCalFileName11) ); + map1->InsertL(_L8("id"),TLiwVariant(globaluid)); + map1->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EDecember,28,0,0,0,0)))); + map1->InsertL(_L8("Replication"), TLiwVariant(_L("Open"))); + map1->InsertL(_L8("Priority"), TLiwVariant(TInt32(1))); + + TLiwGenericParam element; + element.SetNameAndValueL(_L8("Item"),TLiwVariant(map1)); + + inparam->AppendL(element); + element.Reset(); + map1->DecRef(); + CleanupStack::Pop(map1); + + TRAPD(err1, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam )); + TInt pos1 = 0 ; + + const TLiwGenericParam* output = outparam->FindFirst( pos1,_L8("ErrorCode")); + TBuf<10> local; + if(output) + { + err = output->Value().AsTInt32(); + if ( err == KErrNone ) + { + output = outparam->FindFirst( pos1,_L8("ReturnValue")); + if(output) + { + TPtrC uidval = (TPtrC)(output->Value().AsDes()); + local = GetEntry( inparam, outparam, uidval, KKCalFileName11); + } + else + err = -1; + } + } + //TBuf<10> localuid1; + //localuid1.Num(TInt64(local)); + + inparam->Reset(); + outparam->Reset(); + + TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); + inparam->AppendL(dsNameParam); + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + inparam->AppendL(filterParam); + filterMap->DecRef(); + + filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA"))); + filterMap->InsertL(_L8("LocalId"),TLiwVariant(local)); + + TRAP(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam)); + + pos = 0 ; + + const TLiwGenericParam* finaloutput = outparam->FindFirst( pos,_L8("ReturnValue")); + TInt count = 0; + CLiwMap* map; + TInt retvalue = KErrNone; + if ( finaloutput ) + { + CLiwIterable* iterlist = finaloutput->Value().AsIterable(); + if(iterlist) + { + TLiwVariant data1; + while(iterlist->NextL(data1) ) + { + const CLiwMap* res = data1.AsMap(); + if ( res ) + { + TLiwVariant data; + if(res->FindL(_L8("StartTime"), data)) + { + TTime ostime(TDateTime(2007,EDecember,28,0,0,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + data.Reset(); + } + } + data1.Reset(); + } + } + + inparam->Reset(); + outparam->Reset(); + delete uidset1; + RemoveProvCalendar(inparam, outparam, interface, KKCalFileName11); + return retvalue; + } + +TInt CTestUpdateSync::UpdateTodoEntryWithGlobalIdL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + + TInt err; + RCriteriaArray interest; + CleanupClosePushL(interest); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + CleanupStack::PushL(crit); + interest.AppendL(crit); + + iServiceHandler->AttachL(interest); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + TInt pos = 0; + + outparam->FindFirst( pos, KTestInterface ); + if(pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + CleanupStack::PopAndDestroy(crit); + CleanupStack::PopAndDestroy(&interest); + + outparam->Reset(); + inparam->Reset(); + + AddProvCalendar(inparam, outparam, interface, KKCalFileName11); + TUIDSet* uidset1; + TBuf<50> globaluid; + TBuf<10> localuid; + //AddProvAppointmentDailyRepeatAndAttendees(inparam, outparam, interface, KKCalFileName11 ,uidset1 ); + AddProvToDo(inparam, outparam, interface, KKCalFileName11 ,uidset1); + //localuid.Num(TInt64(uidset1->iLocalUID)); + globaluid.Copy(uidset1->iGlobalUID->Des()); + localuid = GetEntry( inparam, outparam, globaluid, KKCalFileName11); + + CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map1); + + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inparam->AppendL(element1); + content.Reset(); + element1.Reset(); + + + map1->InsertL(_L8("CalendarName"), TLiwVariant(KKCalFileName11) ); + map1->InsertL(_L8("id"),TLiwVariant(globaluid)); + map1->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EAugust,19,0,0,0,0)))); + + TLiwGenericParam element; + element.SetNameAndValueL(_L8("Item"),TLiwVariant(map1)); + + inparam->AppendL(element); + element.Reset(); + map1->DecRef(); + CleanupStack::Pop(map1); + + TRAPD(err1, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam )); + TInt pos1 = 0 ; + + const TLiwGenericParam* output = outparam->FindFirst( pos1,_L8("ErrorCode")); + TBuf<10> local; + if(output) + { + err = output->Value().AsTInt32(); + if ( err == KErrNone ) + { + output = outparam->FindFirst( pos1,_L8("ReturnValue")); + if(output) + { + TPtrC uidval = (TPtrC)(output->Value().AsDes()); + local = GetEntry( inparam, outparam, uidval, KKCalFileName11); + } + else + err = -1; + } + } + //TBuf<10> localuid1; + //localuid1.Num(TInt64(local)); + + inparam->Reset(); + outparam->Reset(); + + TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); + inparam->AppendL(dsNameParam); + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + inparam->AppendL(filterParam); + filterMap->DecRef(); + + filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA"))); + filterMap->InsertL(_L8("LocalId"),TLiwVariant(local)); + + TRAP(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam)); + + pos = 0 ; + + const TLiwGenericParam* finaloutput = outparam->FindFirst( pos,_L8("ReturnValue")); + TInt count = 0; + CLiwMap* map; + TInt retvalue = KErrNone; + if ( finaloutput ) + { + CLiwIterable* iterlist = finaloutput->Value().AsIterable(); + if(iterlist) + { + TLiwVariant data1; + while(iterlist->NextL(data1) ) + { + const CLiwMap* res = data1.AsMap(); + if ( res ) + { + TLiwVariant data; + if(res->FindL(_L8("StartTime"), data)) + { + TTime ostime(TDateTime(2007,EAugust,19,0,0,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + data.Reset(); + } + } + data1.Reset(); + } + } + + inparam->Reset(); + outparam->Reset(); + delete uidset1; + RemoveProvCalendar(inparam, outparam, interface, KKCalFileName11); + return retvalue; + } +TInt CTestUpdateSync::UpdateDayEventWithGlobalIdL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + + TInt err; + RCriteriaArray interest; + CleanupClosePushL(interest); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + CleanupStack::PushL(crit); + interest.AppendL(crit); + + iServiceHandler->AttachL(interest); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + TInt pos = 0; + + outparam->FindFirst( pos, KTestInterface ); + if(pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + CleanupStack::PopAndDestroy(crit); + CleanupStack::PopAndDestroy(&interest); + + outparam->Reset(); + inparam->Reset(); + + AddProvCalendar(inparam, outparam, interface, KKCalFileName11); + TUIDSet* uidset1; + TBuf<50> globaluid; + TBuf<10> localuid; + //AddProvAppointmentDailyRepeatAndAttendees(inparam, outparam, interface, KKCalFileName11 ,uidset1 ); + AddProvReminder(inparam, outparam, interface, KKCalFileName11 ,uidset1); + //localuid.Num(TInt64(uidset1->iLocalUID)); + globaluid.Copy(uidset1->iGlobalUID->Des()); + localuid = GetEntry( inparam, outparam, globaluid, KKCalFileName11); + + + CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map1); + + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inparam->AppendL(element1); + content.Reset(); + element1.Reset(); + + + map1->InsertL(_L8("CalendarName"), TLiwVariant(KKCalFileName11) ); + map1->InsertL(_L8("id"),TLiwVariant(globaluid)); + map1->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EJuly,22,11,30,0,0)))); + map1->InsertL(_L8("Description"), TLiwVariant(_L("New reminder created"))); + + TLiwGenericParam element; + element.SetNameAndValueL(_L8("Item"),TLiwVariant(map1)); + + inparam->AppendL(element); + element.Reset(); + map1->DecRef(); + CleanupStack::Pop(map1); + + TRAPD(err1, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam )); + TInt pos1 = 0 ; + + const TLiwGenericParam* output = outparam->FindFirst( pos1,_L8("ErrorCode")); + TBuf<10> local; + if(output) + { + err = output->Value().AsTInt32(); + if ( err == KErrNone ) + { + output = outparam->FindFirst( pos1,_L8("ReturnValue")); + if(output) + { + TPtrC uidval = (TPtrC)(output->Value().AsDes()); + local = GetEntry( inparam, outparam, uidval, KKCalFileName11); + } + else + err = -1; + } + } + //TBuf<10> localuid1; + //localuid1.Num(TInt64(local)); + + inparam->Reset(); + outparam->Reset(); + + TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); + inparam->AppendL(dsNameParam); + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + inparam->AppendL(filterParam); + filterMap->DecRef(); + + filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA"))); + filterMap->InsertL(_L8("LocalId"),TLiwVariant(local)); + + TRAP(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam)); + + pos = 0 ; + + const TLiwGenericParam* finaloutput = outparam->FindFirst( pos,_L8("ReturnValue")); + TInt count = 0; + CLiwMap* map; + TInt retvalue = KErrNone; + if ( finaloutput ) + { + CLiwIterable* iterlist = finaloutput->Value().AsIterable(); + if(iterlist) + { + TLiwVariant data1; + while(iterlist->NextL(data1) ) + { + const CLiwMap* res = data1.AsMap(); + if ( res ) + { + TLiwVariant data; + if(res->FindL(_L8("StartTime"), data)) + { + TTime ostime(TDateTime(2007,EJuly,22,11,30,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + data.Reset(); + } + } + data1.Reset(); + } + } + + inparam->Reset(); + outparam->Reset(); + delete uidset1; + RemoveProvCalendar(inparam, outparam, interface, KKCalFileName11); + return retvalue; + + } + +TInt CTestUpdateSync::UpdateReminderWithGlobalIdL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + + TInt err; + RCriteriaArray interest; + CleanupClosePushL(interest); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + CleanupStack::PushL(crit); + interest.AppendL(crit); + + iServiceHandler->AttachL(interest); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + TInt pos = 0; + + outparam->FindFirst( pos, KTestInterface ); + if(pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + CleanupStack::PopAndDestroy(crit); + CleanupStack::PopAndDestroy(&interest); + + outparam->Reset(); + inparam->Reset(); + + AddProvCalendar(inparam, outparam, interface, KKCalFileName11); + TUIDSet* uidset1; + TBuf<50> globaluid; + TBuf<10> localuid; + //AddProvAppointmentDailyRepeatAndAttendees(inparam, outparam, interface, KKCalFileName11 ,uidset1 ); + AddProvDayEvent(inparam, outparam, interface, KKCalFileName11 ,uidset1); + //localuid.Num(TInt64(uidset1->iLocalUID)); + globaluid.Copy(uidset1->iGlobalUID->Des()); + localuid = GetEntry( inparam, outparam, globaluid, KKCalFileName11); + + CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map1); + + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inparam->AppendL(element1); + content.Reset(); + element1.Reset(); + + + map1->InsertL(_L8("CalendarName"), TLiwVariant(KKCalFileName11) ); + map1->InsertL(_L8("id"),TLiwVariant(globaluid)); + map1->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EJuly,26,8,0,0,0)))); + map1->InsertL(_L8("Replication"), TLiwVariant(_L("Open"))); + + TLiwGenericParam element; + element.SetNameAndValueL(_L8("Item"),TLiwVariant(map1)); + + inparam->AppendL(element); + element.Reset(); + map1->DecRef(); + CleanupStack::Pop(map1); + + TRAPD(err1, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam )); + TInt pos1 = 0 ; + + const TLiwGenericParam* output = outparam->FindFirst( pos1,_L8("ErrorCode")); + TBuf<10> local; + if(output) + { + err = output->Value().AsTInt32(); + if ( err == KErrNone ) + { + output = outparam->FindFirst( pos1,_L8("ReturnValue")); + if(output) + { + TPtrC uidval = (TPtrC)(output->Value().AsDes()); + local = GetEntry( inparam, outparam, uidval, KKCalFileName11); + } + else + err = -1; + } + } + // TBuf<10> localuid1; + // localuid1.Num(TInt64(local)); + + inparam->Reset(); + outparam->Reset(); + + TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); + inparam->AppendL(dsNameParam); + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + inparam->AppendL(filterParam); + filterMap->DecRef(); + + filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA"))); + filterMap->InsertL(_L8("LocalId"),TLiwVariant(local)); + + TRAP(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam)); + + pos = 0 ; + + const TLiwGenericParam* finaloutput = outparam->FindFirst( pos,_L8("ReturnValue")); + TInt count = 0; + CLiwMap* map; + TInt retvalue = KErrNone; + if ( finaloutput ) + { + CLiwIterable* iterlist = finaloutput->Value().AsIterable(); + if(iterlist) + { + TLiwVariant data1; + while(iterlist->NextL(data1) ) + { + const CLiwMap* res = data1.AsMap(); + if ( res ) + { + TLiwVariant data; + if(res->FindL(_L8("StartTime"), data)) + { + TTime ostime(TDateTime(2007,EJuly,26,8,0,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + data.Reset(); + } + } + data1.Reset(); + } + } + + inparam->Reset(); + outparam->Reset(); + delete uidset1; + RemoveProvCalendar(inparam, outparam, interface, KKCalFileName11); + return retvalue; + + } +TInt CTestUpdateSync::UpdateAppointmentEntryWithNewTimeAndGlobalIdL() + { + iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + + TInt err; + RCriteriaArray interest; + CleanupClosePushL(interest); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KTestInterface,KTestContent); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + CleanupStack::PushL(crit); + interest.AppendL(crit); + + iServiceHandler->AttachL(interest); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + TInt pos = 0; + + outparam->FindFirst( pos, KTestInterface ); + if(pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + CleanupStack::PopAndDestroy(crit); + CleanupStack::PopAndDestroy(&interest); + + outparam->Reset(); + inparam->Reset(); + + AddProvCalendar(inparam, outparam, interface, KKCalFileName11); + TUIDSet* uidset1; + TBuf<50> globaluid; + TBuf<10> localuid; + //AddProvAppointmentDailyRepeatAndAttendees(inparam, outparam, interface, KKCalFileName11 ,uidset1 ); + AddProvAppointmentDailyRepeat(inparam, outparam, interface, KKCalFileName11 ,uidset1); + //localuid.Num(TInt64(uidset1->iLocalUID)); + globaluid.Copy(uidset1->iGlobalUID->Des()); + localuid = GetEntry( inparam, outparam, globaluid, KKCalFileName11); + CLiwDefaultMap* map1 = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map1); + + TLiwVariant content(_L("CalendarEntry")); + TLiwGenericParam element1; + element1.SetNameAndValueL(_L8("Type"),content); + inparam->AppendL(element1); + content.Reset(); + element1.Reset(); + + + map1->InsertL(_L8("CalendarName"), TLiwVariant(KKCalFileName11) ); + map1->InsertL(_L8("id"),TLiwVariant(globaluid)); + map1->InsertL(_L8("StartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,14,30,0,0)))); + map1->InsertL(_L8("EndTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,15,30,0,0)))); + map1->InsertL(_L8("InstanceStartTime"), TLiwVariant(TTime(TDateTime(2007,EOctober,25,10,0,0,0)))); + + TLiwGenericParam element; + element.SetNameAndValueL(_L8("Item"),TLiwVariant(map1)); + + inparam->AppendL(element); + element.Reset(); + map1->DecRef(); + CleanupStack::Pop(map1); + + TRAPD(err1, interface->ExecuteCmdL( KCmdAdd, *inparam,*outparam )); + TInt pos1 = 0 ; + + const TLiwGenericParam* output = outparam->FindFirst( pos1,_L8("ErrorCode")); + TBuf<10> local; + if(output) + { + err = output->Value().AsTInt32(); + if ( err == KErrNone ) + { + output = outparam->FindFirst( pos1,_L8("ReturnValue")); + if(output) + { + TPtrC uidval = (TPtrC)(output->Value().AsDes()); + TBuf<50> uidg; + uidg.Copy(uidval); + local = GetEntry( inparam, outparam, uidg, KKCalFileName11); + } + else + err = -1; + } + } + //TBuf<10> localuid1; + //localuid1.Num(TInt64(local)); + + inparam->Reset(); + outparam->Reset(); + + TLiwGenericParam dsNameParam(KContentType, TLiwVariant(_L("CalendarEntry"))); + inparam->AppendL(dsNameParam); + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + inparam->AppendL(filterParam); + filterMap->DecRef(); + + filterMap->InsertL(KCalendarName,TLiwVariant(_L("C:CalendarFileA"))); + filterMap->InsertL(_L8("LocalId"),TLiwVariant(local)); + + TRAP(err,interface->ExecuteCmdL( _L8("GetList") ,*inparam ,*outparam)); + + pos = 0 ; + + const TLiwGenericParam* finaloutput = outparam->FindFirst( pos,_L8("ReturnValue")); + TInt count = 0; + CLiwMap* map; + TInt retvalue = KErrNone; + if ( finaloutput ) + { + CLiwIterable* iterlist = finaloutput->Value().AsIterable(); + if(iterlist) + { + TLiwVariant data1; + while(iterlist->NextL(data1) ) + { + const CLiwMap* res = data1.AsMap(); + if ( res ) + { + TLiwVariant data; + if(res->FindL(_L8("StartTime"), data)) + { + TTime ostime(TDateTime(2007,EOctober,25,14,30,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + if(res->FindL(_L8("EndTime"), data)) + { + TTime ostime(TDateTime(2007,EOctober,25,15,30,0,0)); + TTime stime = data.AsTTime(); + if( ostime != stime) + { + retvalue = KErrGeneral; + break; + } + } + + data.Reset(); + } + } + data1.Reset(); + } + } + + inparam->Reset(); + outparam->Reset(); + delete uidset1; + RemoveProvCalendar(inparam, outparam, interface, KKCalFileName11); + return retvalue; + } + + TDesC& CTestUpdateSync::GetEntry(CLiwGenericParamList* inparam, CLiwGenericParamList* outparam, TPtrC globaluid, const TDesC& calname) { inparam->Reset(); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendaradditer1/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendaradditer1/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendaradditer1/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendaradditer1/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendaradditer1/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendaradditer1/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarchangenotifyiter1/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarchangenotifyiter1/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarchangenotifyiter1/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarchangenotifyiter1/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarchangenotifyiter1/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarchangenotifyiter1/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendardeleteiter1/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendardeleteiter1/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendardeleteiter1/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendardeleteiter1/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendardeleteiter1/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendardeleteiter1/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarexportiter1/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarexportiter1/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarexportiter1/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarexportiter1/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarexportiter1/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarexportiter1/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/conf/tcalendargetlistiter1.cfg --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/conf/tcalendargetlistiter1.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/conf/tcalendargetlistiter1.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -69,3 +69,51 @@ delete foobar [Endtest] +[Test] +title GetListGuidFilterAsync test +create tcalendargetlistiter1 foobar +foobar GetListGuidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListLuidFilterAsync test +create tcalendargetlistiter1 foobar +foobar GetListLuidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTimeRangeFilterAsync test +create tcalendargetlistiter1 foobar +foobar GetListTimeRangeFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTextFilterAsync test +create tcalendargetlistiter1 foobar +foobar GetListTextFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTypeFilterAsync test +create tcalendargetlistiter1 foobar +foobar GetListTypeFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListInvalidGuidFilterAsync test +create tcalendargetlistiter1 foobar +foobar GetListInvalidGuidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListInvalidLuidFilterAsync test +create tcalendargetlistiter1 foobar +foobar GetListInvalidLuidFilterAsync +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/group/tcalendargetlistiter1.mmp --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/group/tcalendargetlistiter1.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/group/tcalendargetlistiter1.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -41,6 +41,7 @@ SOURCEPATH ../src SOURCE tcalendargetlisttest.cpp SOURCE tcalendargetlisttestblocks.cpp +SOURCE calgetlisttestcases.cpp USERINCLUDE ../inc //USERINCLUDE ../../../inc diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/calgetlisttestcases.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/calgetlisttestcases.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,107 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#ifndef CALGETLISTTESTCASES_H +#define CALGETLISTTESTCASES_H + +#include + +#include "calendarheader.h" +//#include "teststartconsolealarmserver.h" + +class CCalendarService; +class CEntryAttributes; + +class CCalGetlistTestCases: public CActive, public MCalCallbackBase + { + + enum TTestCaseType + { + KGetlistGuidFilterAsync, + KGetlistLuidFilterAsync, + KGetlistTmRgFilterAsync, + KGetlistTextFilterAsync, + KGetlistTypeFilterAsync, + KGetlistInvalidGuidFilterAsync, + KGetlistInvalidLuidFilterAsync, + }; + public: + + static CCalGetlistTestCases* NewL( TInt& aResult, TBool aEntryArray = ETrue); + + ~CCalGetlistTestCases(); + + void TestGetlistGuidFilterAsyncL(); + + void TestGetlistLuidFilterAsyncL(); + + void TestGetlistTmRgFilterAsyncL(); + + void TestGetlistTextFilterAsyncL(); + + void TestGetlistTypeFilterAsyncL(); + + void TestGetlistInvalidGuidFilterAsyncL(); + + void TestGetlistInvalidLuidFilterAsyncL(); + + + TInt Result(); + + void addSomeEntries( const TDesC& aName ); + + private: + + void ConstructL(); + + CCalGetlistTestCases(TInt& aResult, TBool aEntryArray = ETrue); + + + //for the sake of ActiveObject + virtual void DoCancel(); + + virtual void RunL(); + + + void Start(); + + void NotifyResultL(TInt aErrCode, TAny* aResult); + + private: + + CActiveSchedulerWait* iWaitSchedular; + + CCalendarService* iCalendarService; + + TInt& iResult; + + TBool iEntryArray; + + TTestCaseType iTestCaseType; + + + // RPointerArray entryList; + // RPointerArray instanceList; + RPointerArray iArruids; + }; + + + +#endif // CALGETLISTTESTCASES_H + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/tcalendargetlisttest.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/tcalendargetlisttest.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/inc/tcalendargetlisttest.h Thu Aug 27 07:43:07 2009 +0300 @@ -153,6 +153,14 @@ virtual TInt GetListInvalidGUID(CStifItemParser &aItem ); virtual TInt GetListInvalidCalName(CStifItemParser &aItem ); + virtual TInt GetListTimeRangeFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListGuidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListLuidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListTextFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListTypeFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListInvalidGuidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListInvalidLuidFilterAsync(CStifItemParser &aItem ); + public: // Data //?data_declaration; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/src/calgetlisttestcases.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/src/calgetlisttestcases.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,578 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +// SYSTEM INCLUDE FILES +#include +#include //for RFile and Rfs + +#include //for CCalEntry +#include //for CCalInstance +#include //for Filter Type Enum Constants +#include +#include + +// USER INCLUDE FILES +#include "calgetlisttestcases.h" +#include "entryattributes.h" +//#include +#include "calendarservice.h" +#include "calendarconstants.h" + + + +CCalGetlistTestCases* CCalGetlistTestCases::NewL( TInt& aResult, TBool aEntryArray) + { + CCalGetlistTestCases* self = new(ELeave)CCalGetlistTestCases( aResult, aEntryArray); + + self->ConstructL(); + + return self; + } + +CCalGetlistTestCases::~CCalGetlistTestCases() + { + Cancel(); + + + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + + if(iCalendarService) + delete iCalendarService; + + if(iWaitSchedular) + delete iWaitSchedular; + + + + } + + +_LIT(KGetlistTestCalNameGetlistGuidFilterAsync ,"c:getlistcalguidFilterasync"); + +_LIT(KGetlistTestCalNameGetlistLuidFilterAsync ,"c:getlistcalluidFilterasync"); + +_LIT(KGetlistTestCalNameGetlistTmRgFilterAsync ,"c:getlistcaltmrgFilterasync"); + +_LIT(KGetlistTestCalNameGetlistTextFilterAsync ,"c:getlistcaltextFilterasync"); + +_LIT(KGetlistTestCalNameGetlistTypeFilterAsync ,"c:getlistcaltypeFilterasync"); + +_LIT(KGetlistTestCalNameGetlistInvalidGuidFilterAsync ,"c:getlistcalinvalidguidFilterasync"); + +_LIT(KGetlistTestCalNameGetlistInvalidLuidFilterAsync ,"c:getlistcalinvalidluidFilterasync"); + +void CCalGetlistTestCases::TestGetlistGuidFilterAsyncL() + { + iTestCaseType = KGetlistGuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistGuidFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistGuidFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistGuidFilterAsync.operator()() ) ); + + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistLuidFilterAsyncL() + { + iTestCaseType = KGetlistLuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistLuidiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistLuidFilterAsync.operator()() ) ); + + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistLuidFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistTmRgFilterAsyncL() + { + iTestCaseType = KGetlistTmRgFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistTmRgiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistTextFilterAsyncL() + { + iTestCaseType = KGetlistTextFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistTextiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistTypeFilterAsyncL() + { + iTestCaseType = KGetlistTypeFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistTypeiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistTypeFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistTypeFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistInvalidGuidFilterAsyncL() + { + iTestCaseType = KGetlistInvalidGuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistGuidFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistInvalidGuidFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistInvalidGuidFilterAsync.operator()() ) ); + + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistInvalidLuidFilterAsyncL() + { + iTestCaseType = KGetlistInvalidLuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistLuidiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistInvalidLuidFilterAsync.operator()() ) ); + + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistInvalidLuidFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +TInt CCalGetlistTestCases::Result() + { + return iResult; + } + +void CCalGetlistTestCases::ConstructL() + { + CActiveScheduler::Add(this); + + iCalendarService = CCalendarService::NewL(); + + iWaitSchedular = new(ELeave) CActiveSchedulerWait(); + } + +CCalGetlistTestCases::CCalGetlistTestCases( TInt& aResult, TBool aEntryArray) : CActive(EPriorityStandard), iResult(aResult), + iEntryArray(aEntryArray) + { + + } + +//for the sake of ActiveObject +void CCalGetlistTestCases::DoCancel() + { + + } + +_LIT(KSearchTexttest ,"Meeting"); +void CCalGetlistTestCases::RunL() + { + CCalendarFilter *filter; + + CEntryAttributes* entryObj; + + RPointerArray arruids(5); + TUIDSet* uids = NULL; + + switch( iTestCaseType ) + { + case KGetlistGuidFilterAsync : + + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistGuidFilterAsync,entryObj,uids) ; + + arruids.Append(uids); + uids = NULL; + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistGuidFilterAsync, *(arruids[0]->iGlobalUID), this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + + /* if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + }*/ + delete entryObj; + arruids.ResetAndDestroy(); + break; + case KGetlistLuidFilterAsync : + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistLuidFilterAsync,entryObj,uids) ; + arruids.Append(uids); + uids = NULL; + delete entryObj; + entryObj = CEntryAttributes::NewL( KEntryEvent ); + + entryObj->SetDescriptionL(_L("New Event entry created")); + entryObj->SetSummaryL(_L("Event Entry")); + TTime stTime1(TDateTime(2007, EJuly, 25, 0, 0, 0, 0)); + entryObj->SetStartTimeL(stTime1); + entryObj->SetReplicationL(KReplPrivate); + + iCalendarService->AddL(KGetlistTestCalNameGetlistLuidFilterAsync,entryObj,uids); + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistLuidFilterAsync, arruids[0]->iLocalUID, this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + delete entryObj; + arruids.ResetAndDestroy(); + + break; + case KGetlistTmRgFilterAsync : + iEntryArray = EFalse; + + entryObj = CEntryAttributes::NewL(KEntryAppt); + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + TCalTime stTime; + stTime.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + entryObj->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + TCalTime endTime; + endTime.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + CRepeatInfo* rrule = CRepeatInfo::NewL(TCalRRule::EWeekly); + rrule->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + RArray dayArray; + dayArray.Append( stTime.TimeLocalL().DayNoInWeek() ); + rrule->SetDaysInWeek( dayArray ); + rrule->SetCount( 10 ); + + entryObj->SetRepeatRule( rrule ); + dayArray.Reset(); + delete rrule; + + + iCalendarService->AddL(KGetlistTestCalNameGetlistTmRgFilterAsync.operator()(),entryObj,uids); + + + //delete uids; + + + arruids.Append(uids); + uids = NULL; + //delete uids; + + if ( arruids.Count() > 0 ) + { + // addSomeEntries( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() );//adds the entries and fills up iArruids with UIDSets + filter = CCalendarFilter::NewL(); + filter->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + filter->SetEndTimeL(TTime(TDateTime(2008, EAugust, 8, 9, 0, 0, 0))); + + TRAP( iResult, iCalendarService->GetListL( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() , filter , this ) ); + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + delete filter; + + break; + case KGetlistTextFilterAsync : + iEntryArray = EFalse; + entryObj = CEntryAttributes::NewL(KEntryAppt); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Meeting Happens from 9 to 9:30")); + + TCalTime stTime3; + stTime3.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + entryObj->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + TCalTime endTime3; + endTime3.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistTextFilterAsync.operator()(),entryObj,uids); + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + // addSomeEntries( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() );//adds the entries and fills up iArruids with UIDSets + filter = CCalendarFilter::NewL(); + filter->SetFilterTextL( KSearchTexttest ); + + TRAP( iResult, iCalendarService->GetListL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() , filter , this ) ); + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + delete filter; + + break; + case KGetlistTypeFilterAsync : + iEntryArray = EFalse; + entryObj = CEntryAttributes::NewL(KEntryAppt); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Meeting Happens from 9 to 9:30")); + + TCalTime stTime2; + stTime2.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + entryObj->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + TCalTime endTime2; + endTime2.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistTextFilterAsync.operator()(),entryObj,uids); + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + // addSomeEntries( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() );//adds the entries and fills up iArruids with UIDSets + filter = CCalendarFilter::NewL(); + filter->SetFilterTypeL( KEntryAppt ); + + TRAP( iResult, iCalendarService->GetListL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() , filter , this ) ); + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + delete filter; + + break; + case KGetlistInvalidGuidFilterAsync : + + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistInvalidGuidFilterAsync,entryObj,uids) ; + + arruids.Append(uids); + uids = NULL; + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistInvalidGuidFilterAsync,_L8("xyz"), this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + break; + case KGetlistInvalidLuidFilterAsync : + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistInvalidLuidFilterAsync,entryObj,uids) ; + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistInvalidLuidFilterAsync, _L8("0"), this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + + break; + + } + + } + +void CCalGetlistTestCases::Start() + { + SetActive(); + TRequestStatus* temp = &iStatus; + + User::RequestComplete(temp, KErrNone); + + iWaitSchedular->Start(); + } + + +void CCalGetlistTestCases::NotifyResultL(TInt aErrCode, TAny* aResult) + { + //******************* set iResult **************************** + iResult = aErrCode; + //******************* set iResult **************************** + //write the result to the corresponding file basing on the iTestCaseType + RPointerArray entryList; + + RPointerArray instanceList; + + if(iEntryArray) + { + entryList = *(RPointerArray*)(aResult); + } + else + { + instanceList = *(RPointerArray*)(aResult); + } + switch( iTestCaseType ) + { + case KGetlistGuidFilterAsync : + case KGetlistLuidFilterAsync : + case KGetlistTmRgFilterAsync : + case KGetlistTextFilterAsync : + case KGetlistTypeFilterAsync : + if(iEntryArray) + { + if ( entryList.Count() == 0) + { + iResult = KErrGeneral; + } + else + { + for(TInt i = 0; i 0) + { + iResult = KErrGeneral; + } + break; + } + iWaitSchedular->AsyncStop(); + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/src/tcalendargetlisttestblocks.cpp --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/src/tcalendargetlisttestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendargetlistiter1/src/tcalendargetlisttestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -34,7 +34,7 @@ #include "tcalendargetlisttest.h" #include "teststartconsolealarmserver.h" - +#include "calgetlisttestcases.h" // ============================ MEMBER FUNCTIONS =============================== @@ -76,6 +76,15 @@ ENTRY( "GetListInvalidCalName", CTCalendarGetListTest::GetListInvalidCalName ), ENTRY( "GetListInvalidGUID" , CTCalendarGetListTest::GetListInvalidGUID ), ENTRY( "GetListInvalidLUID" , CTCalendarGetListTest::GetListInvalidLUID ), + + ENTRY( "GetListTimeRangeFilterAsync", CTCalendarGetListTest::GetListTimeRangeFilterAsync ), + ENTRY( "GetListGuidFilterAsync", CTCalendarGetListTest::GetListGuidFilterAsync ), + ENTRY( "GetListLuidFilterAsync", CTCalendarGetListTest::GetListLuidFilterAsync ), + ENTRY( "GetListTextFilterAsync", CTCalendarGetListTest::GetListTextFilterAsync ), + ENTRY( "GetListTypeFilterAsync", CTCalendarGetListTest::GetListTypeFilterAsync ), + ENTRY( "GetListInvalidGuidFilterAsync", CTCalendarGetListTest::GetListInvalidGuidFilterAsync ), + ENTRY( "GetListInvalidLuidFilterAsync", CTCalendarGetListTest::GetListInvalidLuidFilterAsync ), + }; const TInt count = sizeof( KFunctions ) / @@ -702,4 +711,128 @@ EIncludeAll Include all entries (appointments, day events, anniversaries and todos). */ +// +//Whats done here? +// Get the default system Calendar using GetList of CCalendarService and output that to GetListdefaultCalendar.txt +// +TInt CTCalendarGetListTest::GetListTimeRangeFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistTmRgFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } + +TInt CTCalendarGetListTest::GetListGuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistGuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + // delete calGetlistTest; + + __UHEAP_MARKEND; + return result; + + } +TInt CTCalendarGetListTest::GetListLuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistLuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt CTCalendarGetListTest::GetListTextFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistTextFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt CTCalendarGetListTest::GetListTypeFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistTypeFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt CTCalendarGetListTest::GetListInvalidGuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistInvalidGuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt CTCalendarGetListTest::GetListInvalidLuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistInvalidLuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarimportiter1/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarimportiter1/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarimportiter1/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarimportiter1/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarimportiter1/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarimportiter1/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/conf/tcalendarupdateiter1.cfg --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/conf/tcalendarupdateiter1.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/conf/tcalendarupdateiter1.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -54,3 +54,45 @@ foobar UpdateAppointmentEntryWithNewAttendees delete foobar [Endtest] + +[Test] +title UpdateAppointmentEntryWithGlobalId test +create tcalendarupdateiter1 foobar +foobar UpdateAppointmentEntryWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateTodoEntryWithGlobalId test +create tcalendarupdateiter1 foobar +foobar UpdateTodoEntryWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateDayEventWithGlobalId test +create tcalendarupdateiter1 foobar +foobar UpdateDayEventWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateAnniversaryWithGlobalId test +create tcalendarupdateiter1 foobar +foobar UpdateAnniversaryWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateReminderWithGlobalId test +create tcalendarupdateiter1 foobar +foobar UpdateReminderWithGlobalId +delete foobar +[Endtest] + +[Test] +title UpdateAppointmentEntryWithNewTimeAndGlobalId test +create tcalendarupdateiter1 foobar +foobar UpdateAppointmentEntryWithNewTimeAndGlobalId +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -105,7 +105,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -348,26 +348,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +541,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +678,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +805,11 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; /** * Indicates which entries have new values for the update operation diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/tcalendarupdatetest.h --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/tcalendarupdatetest.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/inc/tcalendarupdatetest.h Thu Aug 27 07:43:07 2009 +0300 @@ -151,6 +151,13 @@ virtual TInt UpdateAppointmentEntryWithNewAttendeesL(CStifItemParser &aItem ); virtual TInt UpdateAppointmentEntryWithNewRepeatL(CStifItemParser &aItem ); //virtual TInt UpdateAppointmentEntryWithNewTimeAndAttendeesL(CStifItemParser &aItem ); + virtual TInt UpdateAppointmentEntryWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateTodoEntryWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateAnniversaryWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateDayEventWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateReminderWithGlobalIdL(CStifItemParser &aItem ); + virtual TInt UpdateAppointmentEntryWithNewTimeAndGlobalIdL(CStifItemParser &aItem ); + public: // Data //?data_declaration; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/src/tcalendarupdatetestblocks.cpp --- a/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/src/tcalendarupdatetestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/dev/tcalendartest/tcalendarupdateiter1/src/tcalendarupdatetestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -69,6 +69,13 @@ ENTRY( "UpdateAppointmentEntryWithNewAttendees", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewAttendeesL), ENTRY( "UpdateAppointmentEntryWithNewRepeat", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewRepeatL), //ENTRY( "UpdateAppointmentEntryWithNewTimeAndAttendees", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndAttendeesL), + + ENTRY( "UpdateAppointmentEntryWithGlobalId", CTCalendarUpdateTest::UpdateAppointmentEntryWithGlobalIdL), + ENTRY( "UpdateTodoEntryWithGlobalId", CTCalendarUpdateTest::UpdateTodoEntryWithGlobalIdL), + ENTRY( "UpdateAnniversaryWithGlobalId", CTCalendarUpdateTest::UpdateAnniversaryWithGlobalIdL), + ENTRY( "UpdateDayEventWithGlobalId", CTCalendarUpdateTest::UpdateDayEventWithGlobalIdL), + ENTRY( "UpdateReminderWithGlobalId", CTCalendarUpdateTest::UpdateReminderWithGlobalIdL), + ENTRY( "UpdateAppointmentEntryWithNewTimeAndGlobalId", CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndGlobalIdL), }; const TInt count = sizeof( KFunctions ) / @@ -774,6 +781,491 @@ return result; } + +TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithGlobalIdL(CStifItemParser &aItem ) + { + + + TInt result = KErrNone; + + __UHEAP_MARK; + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); + AddCalendarFile( service, KTestCal1File ); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddAppointmentWithAttendees(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + + TTime stTime(TDateTime(2007, EAugust, 8, 11, 0, 0, 0)); + entryObj->SetStartTimeL(stTime); + + TTime endTime(TDateTime(2007, EAugust, 8, 12, 0, 0, 0)); + entryObj->SetEndTimeL(endTime); + + + CCalAlarm* alarm = CCalAlarm::NewL(); + TTime alarmTime(TDateTime(2007,EAugust, 8, 10, 30, 0, 0)); + entryObj->SetAlarm(alarmTime); + delete alarm; + + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + } + + TUIDSet* newuids = NULL; + entryArray.ResetAndDestroy(); + TRAPD( err, service->AddL(KTestCal1File,entryObj,newuids) ); + delete newuids; + if ( err == KErrNone ) + { + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + if( entryArray.Count() == 1 ) + { + CCalAlarm* entryalarm = entryArray[0]->AlarmL(); + if( !(entryArray[0]->StartTimeL().TimeUtcL() == stTime && + entryArray[0]->EndTimeL().TimeUtcL() == endTime && + entryalarm->TimeOffset() == TTimeIntervalMinutes(30) )) + { + result = KErrGeneral; + delete entryalarm; + } + else + delete entryalarm; + } + } + else + { + result = KErrGeneral; + } + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + __UHEAP_MARKEND; + + return result; + + } + +TInt CTCalendarUpdateTest::UpdateTodoEntryWithGlobalIdL(CStifItemParser &aItem ) + { + + TInt result = KErrNone; + + __UHEAP_MARK; + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); + AddCalendarFile( service, KTestCal1File ); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddToDo(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + + TTime endTime(TDateTime(2007, EAugust, 22, 0, 0, 0, 0)); + entryObj->SetEndTimeL(endTime); + + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + } + + TCalLocalUid modifiedEntryId; + TUIDSet* entryUids = NULL; + TRAPD( err, service->AddL(KTestCal1File,entryObj,entryUids) ); + delete entryUids; + entryArray.ResetAndDestroy(); + if ( err == KErrNone ) + { + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + if( entryArray.Count() == 1 ) + { + if( !(entryArray[0]->EndTimeL().TimeUtcL() == endTime )) + { + result = KErrGeneral; + } + } + } + else + { + result = KErrGeneral; + } + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + __UHEAP_MARKEND; + + return result; + + + } + +TInt CTCalendarUpdateTest::UpdateAnniversaryWithGlobalIdL(CStifItemParser &aItem )//try + { + + TInt result = KErrNone; + + __UHEAP_MARK; + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); + AddCalendarFile( service, KTestCal1File ); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddAnny(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + TCalTime stTime; + stTime.SetTimeLocalFloatingL(TTime(TDateTime(2007, EDecember, 28, 0, 0, 0, 0))); + TTime startTime(TDateTime(2007, EDecember, 28, 0, 0, 0, 0)); + entryObj->SetStartTimeL(startTime); + + /*TCalRRule rrule(TCalRRule::EYearly); + rrule.SetDtStart(stTime); + rrule.SetInterval(1); + + TCalTime uTime; + uTime.SetTimeLocalFloatingL(TCalTime::MaxTime()); + rrule.SetUntil(uTime); + + entryObj->SetRepeatRule(rrule); */ + + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + } + + TUIDSet* uids = NULL; + entryArray.ResetAndDestroy(); + TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); + delete uids; + if ( err == KErrNone ) + { + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + if( entryArray.Count() == 1 ) + { + TCalRRule rRule; + entryArray[0]->GetRRuleL( rRule ); + TCalTime utTime; + utTime.SetTimeLocalFloatingL(TTime(TDateTime(2100, EDecember, 28, 0, 0, 0, 0))); + if( !( entryArray[0]->StartTimeL().TimeLocalL() == stTime.TimeLocalL() ) && rRule.Until().TimeLocalL() == utTime.TimeLocalL()) + { + result = KErrGeneral; + } + } + } + else + { + result = KErrGeneral; + } + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + __UHEAP_MARKEND; + + return result; + + } + +TInt CTCalendarUpdateTest::UpdateDayEventWithGlobalIdL(CStifItemParser &aItem )//try + { + TInt result = KErrNone; + + __UHEAP_MARK; + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); + AddCalendarFile( service, KTestCal1File ); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddEvent(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + + entryObj->SetDescriptionL(_L("Day event modified")); + entryObj->SetPriority(2); + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + } + + TUIDSet* uids = NULL; + TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); + delete uids; + entryArray.ResetAndDestroy(); + if ( err == KErrNone ) + { + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + if( entryArray.Count() == 1 ) + { + if( !( entryArray[0]->DescriptionL().CompareF(_L("Day event modified")) == 0 && entryArray[0]->PriorityL() == 2 ) ) + { + result = KErrGeneral; + } + } + } + else + { + result = KErrGeneral; + } + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + __UHEAP_MARKEND; + + return result; + + } + +TInt CTCalendarUpdateTest::UpdateReminderWithGlobalIdL(CStifItemParser &aItem ) + { + TInt result = KErrNone; + + __UHEAP_MARK; + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); + AddCalendarFile( service, KTestCal1File ); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddReminder(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + entryObj->SetSummaryL(KString1); + TTime stTime(TDateTime(2007, EJuly, 23, 11, 30, 0, 0)); + entryObj->SetStartTimeL(stTime); + + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + } + + TUIDSet* uids = NULL; + TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); + delete uids; + entryArray.ResetAndDestroy(); + if ( err == KErrNone ) + { + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + if( entryArray.Count() == 1 ) + { + if( !( entryArray[0]->SummaryL().CompareF( KString1 ) == 0 && entryArray[0]->StartTimeL().TimeUtcL() == stTime)) + { + result = KErrGeneral; + } + } + } + else + { + result = KErrGeneral; + } + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + __UHEAP_MARKEND; + + return result; + + } +TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndGlobalIdL(CStifItemParser &aItem ) + { + TInt result = KErrNone; + + __UHEAP_MARK; + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); + AddCalendarFile( service, KTestCal1File ); + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + if(AddRepeatingAppointmentEntryL(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + + + TTime stTime(TDateTime(2007, ESeptember, 17, 9, 0, 0, 0)); + entryObj->SetInstanceStartTimeL(stTime); + TTime startTime(TDateTime(2007, ESeptember, 17, 14, 0, 0, 0)); + entryObj->SetStartTimeL(startTime); + TTime endTime(TDateTime(2007, ESeptember, 17, 17, 30, 0, 0)); + entryObj->SetEndTimeL(endTime); + + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + } + + TUIDSet* uids = NULL; + TCalLocalUid modifiedEntryId; + TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); + //modifiedEntryId = uids->iLocalUID; + // modifiedEntryId = uids->iGlobalUID; + delete uids; + entryArray.ResetAndDestroy(); + if ( err == KErrNone ) + { + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + if( entryArray.Count() == 1 ) + { + if( !( entryArray[0]->StartTimeL().TimeUtcL() == startTime && + entryArray[0]->EndTimeL().TimeUtcL() == endTime )) + { + result = KErrGeneral; + } + } + + } + else + { + result = KErrGeneral; + } + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + __UHEAP_MARKEND; + + return result; + + } + + + #if 0 TInt CTCalendarUpdateTest::UpdateAppointmentEntryWithNewTimeAndAttendeesL(CStifItemParser &aItem ) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: Defination of class CCalendarInterface +* Description: Defination of class CCalendarInterface * */ - #ifndef __CALENDARINTERFACE_H #define __CALENDARINTERFACE_H @@ -117,6 +116,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -328,8 +349,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -575,6 +599,15 @@ * @return Entry type */ TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + /** * Check if given calendar is in use. @@ -607,4 +640,4 @@ }; -#endif __CALENDARINTERFACE_H \ No newline at end of file +#endif __CALENDARINTERFACE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcal_providertest/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_add/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_add/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_add/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_add/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_add/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_add/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/calendarinterface.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/calendarinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/calendarinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: Defination of class CCalendarInterface +* Description: Defination of class CCalendarInterface * */ - #ifndef __CALENDARINTERFACE_H #define __CALENDARINTERFACE_H @@ -31,8 +30,10 @@ #include #include "calendarheader.h" +#include "calendarconstants.h" class CCalendarService; +class CIterableCalEntryList; class CEntryAttributes; class TUIDSet; @@ -115,6 +116,28 @@ static void SetImportOutputL( RPointerArray& aOutputUIDSet, CLiwGenericParamList& aOutParamList ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalEntryOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + /** + * Set Getlist output to output parameter + * @param aOutputCalEntry getlist output + * @param aOutParamList Output parammeter + * + * @return void + */ + void SetCalInstanceOutputL( RPointerArray& aOutputCalEntry, + CLiwGenericParamList& aOutParamList, + const TDesC& aCalendarName ); + + /** * Set Change Notification output to output parameter * @param aOutputChangeSet Notifications list @@ -241,6 +264,15 @@ */ static TPtrC GetMethodL( const CCalEntry::TMethod aMethod ); + /** + * Removes the reference of CIterableCalEntryList from the table maintained + * by interface + * @param aCalEntryList Element that need to be removed from the table + * + * @return void + */ + void RemoveCalEntryListFromArray( CIterableCalEntryList* aCalEntryList ); + private: @@ -317,8 +349,11 @@ * @return void */ void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, - CLiwGenericParamList& aOutParamList, - const TBool aPosBased ); + CLiwGenericParamList& aOutParamList, + TUint aCmdOptions, + MLiwNotifyCallback* aCallback , + const TBool aPosBased, + TInt32& aTransactionId ); /** * Issues Import Calendar Entry request to Calendar Service @@ -388,7 +423,7 @@ * * @return void */ - void GetGlobalUid( const TDesC& aGlobalUid, TDes8& aOutGlobalUid ); + void GetGlobalUid( const TDesC& aGlobalUid, TPtr8 aOutGlobalUid ); /** * Extracts ContentType from the input param list @@ -407,44 +442,82 @@ * * @return void */ - TInt GetTransactionId( const CLiwGenericParamList& aInParamList, + void GetTransactionIdL( const CLiwGenericParamList& aInParamList, TInt32& aTransactionId ); /** * Extracts CalendarName from the input param list * @param aInParamList Input param list + * @param aCmdName Command Name + * @param aField ParameterName to read * @param aPosBased ETrue for position pased parameters * @param aCalendarName Output param for Calendar Name * * @return void */ - void GetCalendarNameL( const CLiwGenericParamList& aInParamList, + void GetCalendarNameL( const CLiwGenericParamList& aInParamList, + const TDesC8& aCmdName, + const TDesC8& aField, TBool aPosBased, - TDes& aCalendarName ); + HBufC*& aCalendarName ); + + /** + * Extracts Descriptor Field from Map in input param list + * @param aInParamList Input param list + * @param aCmdName Command Name + * @param aMapName Map name in input param list + * @param aFieldName Filed name to read from map + * @param aPosBased ETrue for position pased parameters + * @param aOutputField Output param for Field value + * + * @return void + */ + void CCalendarInterface::GetDesCFieldFromMapL( const CLiwGenericParamList& aInParamList, + const TDesC8& aCmdName, + const TDesC8& aMapName, + const TDesC8& aFieldName, + TBool aPosBased, + HBufC*& aOutputField ); + + /** + * Extracts 8-bit Descriptor Field from Map in input param list + * @param aInParamList Input param list + * @param aCmdName Command Name + * @param aMapName Map name in input param list + * @param aFieldName Filed name to read from map + * @param aPosBased ETrue for position pased parameters + * @param aOutputField Output param for Field value + * + * @return void + */ + void CCalendarInterface::GetDesC8FieldFromMapL( const CLiwGenericParamList& aInParamList, + const TDesC8& aCmdName, + const TDesC8& aMapName, + const TDesC8& aFieldName, + TBool aPosBased, + HBufC8*& aOutputField ); /** * Extracts Entry attributes for Add/Update request * @param aInParamList Input param list + * @param aCalendarName CalendarName * @param aPosBased ETrue for position pased parameters - * @param aCalendar Output param for Calendar Name * * @return CEntryAttributes* EntryAttributes object */ CEntryAttributes* GetAddParametersL( const CLiwGenericParamList& aInParamList, - TBool aPosBased, - TDes& aCalendar ); + const TDesC& aCalendarName, + TBool aPosBased); /** * Extracts Filter for Delete request * @param aInParamList Input param list - * @param aCalendarName Output param for Calendar Name * @param aFilter Output param for Filter * @param aPosBased ETrue for position pased parameters * * @return void */ void GetDeleteEntryFilterL(const CLiwGenericParamList& aInParamList, - TDes& aCalendarName, CCalendarFilter& aFilter, const TBool aPosBased ); @@ -471,40 +544,100 @@ * @param aInParamList Input param list * @param aPosBased ETrue for position pased parameters * @param aCalExportParams Output param for Export parameters - * @param aCalendarFormat Output param for Calendar Format to be used (ICal/VCal) - * @param aCalendarName Output param for Calendar Name * * @return void */ void GetExportInputL( const CLiwGenericParamList& aInParamList, TBool aPosBased, - CCalendarExportParams& aCalExportParams, - TDes8& aCalendarFormat, - TDes& aCalendarName ); + CCalendarExportParams& aCalExportParams); /** * Extracts Inputs for Change Notification request * @param aInParamList Input param list - * @param aCalendarName Output param for Calendar Name * @param aFileter Output param for Change Notification filter * @param aPosBased ETrue for position pased parameters * * @return void */ - void GetNotificationFilterL(const CLiwGenericParamList& aInParamList, - TDes& aCalendarName, + void GetNotificationFilterL( const CLiwGenericParamList& aInParamList, CCalendarFilter& aFilter, const TBool aPosBased ); + /** + * Appends error message + * @param aCmdName Command Name + * @param aParameter Parameter Name + * @param aMessage Error message + * + * @return void + */ + void AppendErrorMessageL( const TDesC8& aCmdName, + const TDesC8& aParameter, + const TDesC& aMessage ); + /** + * Checks for the valid data type of Parameter. + * @param aParam Input parameter + * @param aExpectedtype Expected type for input parameter + * @param aCmdName Command Name + * @param aParameter Parameter Name + * @param aErrorMessage Error message in case of type mismatch + * + * @return void + */ + void ValidateParamTypeL( TLiwVariant& aParam, + LIW::TVariantTypeId aExpectedtype, + const TDesC8& aCmdName, + const TDesC8& aParameter, + const TDesC& aMessage ); + + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); + /** + * Returns entry type for given LocalUid. + * @param aCalendarName CalendarName + * @param aLocalUid LocalUid + * + * @return Entry type + */ + TInt GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ); + + + /** + * Check if given calendar is in use. + * @param aCalendarName CalendarName + * + * @return True if given calendar is in use + */ + TBool CCalendarInterface::CheckCalendarInUse( const TDesC& aCalendarName ); + private: /** * CCalendarService class pointer + * @internal */ CCalendarService* iCalService; + /** + * Error Message object + * @internal + */ + HBufC* iErrorMessage; + + /** + * Array containing the list of CalEntryList. + * @internal + */ + RPointerArray iArrayCalEntryList; + }; -#endif __CALENDARINTERFACE_H \ No newline at end of file +#endif __CALENDARINTERFACE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_changenotify/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_delete/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_delete/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_delete/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_delete/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_delete/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_delete/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_export/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_export/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_export/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_export/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_export/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_export/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/conf/tcal_getlist.cfg --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/conf/tcal_getlist.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/conf/tcal_getlist.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -87,4 +87,53 @@ create tcal_getlist foobar foobar GetCalEntByTypeFilter delete foobar +[Endtest] + +[Test] +title GetListGuidFilterAsync test +create tcal_getlist foobar +foobar GetListGuidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListLuidFilterAsync test +create tcal_getlist foobar +foobar GetListLuidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTimeRangeFilterAsync test +create tcal_getlist foobar +foobar GetListTimeRangeFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTextFilterAsync test +create tcal_getlist foobar +foobar GetListTextFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListTypeFilterAsync test +create tcal_getlist foobar +foobar GetListTypeFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListInvalidGuidFilterAsync test +create tcal_getlist foobar +foobar GetListInvalidGuidFilterAsync +delete foobar +[Endtest] + +[Test] +title GetListInvalidLuidFilterAsync test +create tcal_getlist foobar +foobar GetListInvalidLuidFilterAsync +delete foobar [Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/group/tcal_getlist.mmp --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/group/tcal_getlist.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/group/tcal_getlist.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -57,6 +57,7 @@ SOURCEPATH ../src SOURCE tcal_getlist.cpp SOURCE tcal_getlistBlocks.cpp +SOURCE calgetlisttestcases.cpp //RESOURCE resource_file //RESOURCE resource_file2 diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/calgetlisttestcases.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/calgetlisttestcases.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,107 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#ifndef CALGETLISTTESTCASES_H +#define CALGETLISTTESTCASES_H + +#include + +#include "calendarheader.h" +//#include "teststartconsolealarmserver.h" + +class CCalendarService; +class CEntryAttributes; + +class CCalGetlistTestCases: public CActive, public MCalCallbackBase + { + + enum TTestCaseType + { + KGetlistGuidFilterAsync, + KGetlistLuidFilterAsync, + KGetlistTmRgFilterAsync, + KGetlistTextFilterAsync, + KGetlistTypeFilterAsync, + KGetlistInvalidGuidFilterAsync, + KGetlistInvalidLuidFilterAsync, + }; + public: + + static CCalGetlistTestCases* NewL( TInt& aResult, TBool aEntryArray = ETrue); + + ~CCalGetlistTestCases(); + + void TestGetlistGuidFilterAsyncL(); + + void TestGetlistLuidFilterAsyncL(); + + void TestGetlistTmRgFilterAsyncL(); + + void TestGetlistTextFilterAsyncL(); + + void TestGetlistTypeFilterAsyncL(); + + void TestGetlistInvalidGuidFilterAsyncL(); + + void TestGetlistInvalidLuidFilterAsyncL(); + + + TInt Result(); + + void addSomeEntries( const TDesC& aName ); + + private: + + void ConstructL(); + + CCalGetlistTestCases(TInt& aResult, TBool aEntryArray = ETrue); + + + //for the sake of ActiveObject + virtual void DoCancel(); + + virtual void RunL(); + + + void Start(); + + void NotifyResultL(TInt aErrCode, TAny* aResult); + + private: + + CActiveSchedulerWait* iWaitSchedular; + + CCalendarService* iCalendarService; + + TInt& iResult; + + TBool iEntryArray; + + TTestCaseType iTestCaseType; + + + // RPointerArray entryList; + // RPointerArray instanceList; + RPointerArray iArruids; + }; + + + +#endif // CALGETLISTTESTCASES_H + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/tcal_getlist.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/tcal_getlist.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/inc/tcal_getlist.h Thu Aug 27 07:43:07 2009 +0300 @@ -154,6 +154,15 @@ virtual TInt GetCalEntByTimeFilter( CStifItemParser& aItem ); virtual TInt GetCalEntByTypeFilter( CStifItemParser& aItem ); + virtual TInt GetListTimeRangeFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListGuidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListLuidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListTextFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListTypeFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListInvalidGuidFilterAsync(CStifItemParser &aItem ); + virtual TInt GetListInvalidLuidFilterAsync(CStifItemParser &aItem ); + + //ADD NEW METHOD DEC HERE public: // Data diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/src/calgetlisttestcases.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/src/calgetlisttestcases.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,578 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +// SYSTEM INCLUDE FILES +#include +#include //for RFile and Rfs + +#include //for CCalEntry +#include //for CCalInstance +#include //for Filter Type Enum Constants +#include +#include + +// USER INCLUDE FILES +#include "calgetlisttestcases.h" +#include "entryattributes.h" +//#include +#include "calendarservice.h" +#include "calendarconstants.h" + + + +CCalGetlistTestCases* CCalGetlistTestCases::NewL( TInt& aResult, TBool aEntryArray) + { + CCalGetlistTestCases* self = new(ELeave)CCalGetlistTestCases( aResult, aEntryArray); + + self->ConstructL(); + + return self; + } + +CCalGetlistTestCases::~CCalGetlistTestCases() + { + Cancel(); + + + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + + if(iCalendarService) + delete iCalendarService; + + if(iWaitSchedular) + delete iWaitSchedular; + + + + } + + +_LIT(KGetlistTestCalNameGetlistGuidFilterAsync ,"c:getlistcalguidFilterasync"); + +_LIT(KGetlistTestCalNameGetlistLuidFilterAsync ,"c:getlistcalluidFilterasync"); + +_LIT(KGetlistTestCalNameGetlistTmRgFilterAsync ,"c:getlistcaltmrgFilterasync"); + +_LIT(KGetlistTestCalNameGetlistTextFilterAsync ,"c:getlistcaltextFilterasync"); + +_LIT(KGetlistTestCalNameGetlistTypeFilterAsync ,"c:getlistcaltypeFilterasync"); + +_LIT(KGetlistTestCalNameGetlistInvalidGuidFilterAsync ,"c:getlistcalinvalidguidFilterasync"); + +_LIT(KGetlistTestCalNameGetlistInvalidLuidFilterAsync ,"c:getlistcalinvalidluidFilterasync"); + +void CCalGetlistTestCases::TestGetlistGuidFilterAsyncL() + { + iTestCaseType = KGetlistGuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistGuidFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistGuidFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistGuidFilterAsync.operator()() ) ); + + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistLuidFilterAsyncL() + { + iTestCaseType = KGetlistLuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistLuidiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistLuidFilterAsync.operator()() ) ); + + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistLuidFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistTmRgFilterAsyncL() + { + iTestCaseType = KGetlistTmRgFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistTmRgiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistTextFilterAsyncL() + { + iTestCaseType = KGetlistTextFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistTextiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistTypeFilterAsyncL() + { + iTestCaseType = KGetlistTypeFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistTypeiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistTypeFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistTypeFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistInvalidGuidFilterAsyncL() + { + iTestCaseType = KGetlistInvalidGuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistGuidFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistInvalidGuidFilterAsync.operator()() ) ); + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistInvalidGuidFilterAsync.operator()() ) ); + + + if(iResult == KErrNone) + Start(); + } + +void CCalGetlistTestCases::TestGetlistInvalidLuidFilterAsyncL() + { + iTestCaseType = KGetlistInvalidLuidFilterAsync; + + //RemoveCalendarFile(iCalendarService, KGetlistTestCalNameGetlistLuidiiFilterAsync.operator()()); + TRAP( iResult , iCalendarService->DeleteL( KGetlistTestCalNameGetlistInvalidLuidFilterAsync.operator()() ) ); + + TRAP( iResult , iCalendarService->AddL( KGetlistTestCalNameGetlistInvalidLuidFilterAsync.operator()() ) ); + + if(iResult == KErrNone) + Start(); + } + +TInt CCalGetlistTestCases::Result() + { + return iResult; + } + +void CCalGetlistTestCases::ConstructL() + { + CActiveScheduler::Add(this); + + iCalendarService = CCalendarService::NewL(); + + iWaitSchedular = new(ELeave) CActiveSchedulerWait(); + } + +CCalGetlistTestCases::CCalGetlistTestCases( TInt& aResult, TBool aEntryArray) : CActive(EPriorityStandard), iResult(aResult), + iEntryArray(aEntryArray) + { + + } + +//for the sake of ActiveObject +void CCalGetlistTestCases::DoCancel() + { + + } + +_LIT(KSearchTexttest ,"Meeting"); +void CCalGetlistTestCases::RunL() + { + CCalendarFilter *filter; + + CEntryAttributes* entryObj; + + RPointerArray arruids(5); + TUIDSet* uids = NULL; + + switch( iTestCaseType ) + { + case KGetlistGuidFilterAsync : + + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistGuidFilterAsync,entryObj,uids) ; + + arruids.Append(uids); + uids = NULL; + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistGuidFilterAsync, *(arruids[0]->iGlobalUID), this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + + /* if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + }*/ + delete entryObj; + arruids.ResetAndDestroy(); + break; + case KGetlistLuidFilterAsync : + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistLuidFilterAsync,entryObj,uids) ; + arruids.Append(uids); + uids = NULL; + delete entryObj; + entryObj = CEntryAttributes::NewL( KEntryEvent ); + + entryObj->SetDescriptionL(_L("New Event entry created")); + entryObj->SetSummaryL(_L("Event Entry")); + TTime stTime1(TDateTime(2007, EJuly, 25, 0, 0, 0, 0)); + entryObj->SetStartTimeL(stTime1); + entryObj->SetReplicationL(KReplPrivate); + + iCalendarService->AddL(KGetlistTestCalNameGetlistLuidFilterAsync,entryObj,uids); + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistLuidFilterAsync, arruids[0]->iLocalUID, this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + delete entryObj; + arruids.ResetAndDestroy(); + + break; + case KGetlistTmRgFilterAsync : + iEntryArray = EFalse; + + entryObj = CEntryAttributes::NewL(KEntryAppt); + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + TCalTime stTime; + stTime.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + entryObj->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + TCalTime endTime; + endTime.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + CRepeatInfo* rrule = CRepeatInfo::NewL(TCalRRule::EWeekly); + rrule->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + RArray dayArray; + dayArray.Append( stTime.TimeLocalL().DayNoInWeek() ); + rrule->SetDaysInWeek( dayArray ); + rrule->SetCount( 10 ); + + entryObj->SetRepeatRule( rrule ); + dayArray.Reset(); + delete rrule; + + + iCalendarService->AddL(KGetlistTestCalNameGetlistTmRgFilterAsync.operator()(),entryObj,uids); + + + //delete uids; + + + arruids.Append(uids); + uids = NULL; + //delete uids; + + if ( arruids.Count() > 0 ) + { + // addSomeEntries( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() );//adds the entries and fills up iArruids with UIDSets + filter = CCalendarFilter::NewL(); + filter->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + filter->SetEndTimeL(TTime(TDateTime(2008, EAugust, 8, 9, 0, 0, 0))); + + TRAP( iResult, iCalendarService->GetListL( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() , filter , this ) ); + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + delete filter; + + break; + case KGetlistTextFilterAsync : + iEntryArray = EFalse; + entryObj = CEntryAttributes::NewL(KEntryAppt); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Meeting Happens from 9 to 9:30")); + + TCalTime stTime3; + stTime3.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + entryObj->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + TCalTime endTime3; + endTime3.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistTextFilterAsync.operator()(),entryObj,uids); + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + // addSomeEntries( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() );//adds the entries and fills up iArruids with UIDSets + filter = CCalendarFilter::NewL(); + filter->SetFilterTextL( KSearchTexttest ); + + TRAP( iResult, iCalendarService->GetListL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() , filter , this ) ); + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + delete filter; + + break; + case KGetlistTypeFilterAsync : + iEntryArray = EFalse; + entryObj = CEntryAttributes::NewL(KEntryAppt); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Meeting Happens from 9 to 9:30")); + + TCalTime stTime2; + stTime2.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + entryObj->SetStartTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0))); + + TCalTime endTime2; + endTime2.SetTimeLocalL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistTextFilterAsync.operator()(),entryObj,uids); + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + // addSomeEntries( KGetlistTestCalNameGetlistTmRgFilterAsync.operator()() );//adds the entries and fills up iArruids with UIDSets + filter = CCalendarFilter::NewL(); + filter->SetFilterTypeL( KEntryAppt ); + + TRAP( iResult, iCalendarService->GetListL( KGetlistTestCalNameGetlistTextFilterAsync.operator()() , filter , this ) ); + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + delete filter; + + break; + case KGetlistInvalidGuidFilterAsync : + + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistInvalidGuidFilterAsync,entryObj,uids) ; + + arruids.Append(uids); + uids = NULL; + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistInvalidGuidFilterAsync,_L8("xyz"), this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + break; + case KGetlistInvalidLuidFilterAsync : + entryObj = CEntryAttributes::NewL( KEntryAppt ); + + entryObj->SetDescriptionL(_L("SAPI weekly meeting")); + entryObj->SetLocationL(_L("Hara")); + entryObj->SetEntryStatusL(KStatusConfirmed); + entryObj->SetMethodL(KMethodNone); + entryObj->SetPriority(5); + entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); + + entryObj->SetStartTimeL( TTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)) ); + + entryObj->SetEndTimeL(TTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0))); + + iCalendarService->AddL(KGetlistTestCalNameGetlistInvalidLuidFilterAsync,entryObj,uids) ; + arruids.Append(uids); + uids = NULL; + + if ( arruids.Count() > 0 ) + { + TRAPD( err , iCalendarService->GetListL( KGetlistTestCalNameGetlistInvalidLuidFilterAsync, _L8("0"), this )); + if(err != KErrNone) + { + iResult = KErrGeneral; + } + } + if(iResult != KErrNone) + { + iWaitSchedular->AsyncStop(); + } + delete entryObj; + arruids.ResetAndDestroy(); + + break; + + } + + } + +void CCalGetlistTestCases::Start() + { + SetActive(); + TRequestStatus* temp = &iStatus; + + User::RequestComplete(temp, KErrNone); + + iWaitSchedular->Start(); + } + + +void CCalGetlistTestCases::NotifyResultL(TInt aErrCode, TAny* aResult) + { + //******************* set iResult **************************** + iResult = aErrCode; + //******************* set iResult **************************** + //write the result to the corresponding file basing on the iTestCaseType + RPointerArray entryList; + + RPointerArray instanceList; + + if(iEntryArray) + { + entryList = *(RPointerArray*)(aResult); + } + else + { + instanceList = *(RPointerArray*)(aResult); + } + switch( iTestCaseType ) + { + case KGetlistGuidFilterAsync : + case KGetlistLuidFilterAsync : + case KGetlistTmRgFilterAsync : + case KGetlistTextFilterAsync : + case KGetlistTypeFilterAsync : + if(iEntryArray) + { + if ( entryList.Count() == 0) + { + iResult = KErrGeneral; + } + else + { + for(TInt i = 0; i 0) + { + iResult = KErrGeneral; + } + break; + } + iWaitSchedular->AsyncStop(); + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/src/tcal_getlistblocks.cpp --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/src/tcal_getlistblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_getlist/src/tcal_getlistblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -33,6 +33,7 @@ #include #include "teststartconsolealarmserver.h" +#include "calgetlisttestcases.h" // EXTERNAL DATA STRUCTURES //extern ?external_data; @@ -152,7 +153,15 @@ ENTRY( "GetCalEntBySearchFilter" , Ctcal_getlist::GetCalEntBySearchFilter ), ENTRY( "GetCalEntByTimeFilter" , Ctcal_getlist::GetCalEntByTimeFilter ), ENTRY( "GetCalEntByTypeFilter" , Ctcal_getlist::GetCalEntByTypeFilter ), - + + ENTRY( "GetListTimeRangeFilterAsync", Ctcal_getlist::GetListTimeRangeFilterAsync ), + ENTRY( "GetListGuidFilterAsync", Ctcal_getlist::GetListGuidFilterAsync ), + ENTRY( "GetListLuidFilterAsync", Ctcal_getlist::GetListLuidFilterAsync ), + ENTRY( "GetListTextFilterAsync", Ctcal_getlist::GetListTextFilterAsync ), + ENTRY( "GetListTypeFilterAsync", Ctcal_getlist::GetListTypeFilterAsync ), + ENTRY( "GetListInvalidGuidFilterAsync", Ctcal_getlist::GetListInvalidGuidFilterAsync ), + ENTRY( "GetListInvalidLuidFilterAsync", Ctcal_getlist::GetListInvalidLuidFilterAsync ), + //ADD NEW ENTRY HERE }; @@ -1927,7 +1936,129 @@ __UHEAP_MARKEND; return result; } + +TInt Ctcal_getlist::GetListTimeRangeFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistTmRgFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } + +TInt Ctcal_getlist::GetListGuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistGuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + // delete calGetlistTest; + + __UHEAP_MARKEND; + return result; + + } +TInt Ctcal_getlist::GetListLuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistLuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt Ctcal_getlist::GetListTextFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistTextFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt Ctcal_getlist::GetListTypeFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistTypeFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt Ctcal_getlist::GetListInvalidGuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistInvalidGuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } +TInt Ctcal_getlist::GetListInvalidLuidFilterAsync(CStifItemParser& /*aItem*/ ) + { + TInt result = KErrNone; + __UHEAP_MARK; + + CCalGetlistTestCases *calGetlistTest = CCalGetlistTestCases::NewL(result); + + CleanupStack::PushL( calGetlistTest ); + + calGetlistTest->TestGetlistInvalidLuidFilterAsyncL(); + + CleanupStack::PopAndDestroy( calGetlistTest ); + + __UHEAP_MARKEND; + return result; + + } + // Helper function TInt AddRepeatingAptEntryL(CCalendarService* aService, const TDesC& name, TUIDSet*& uids) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_import/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_import/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_import/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_import/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_import/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_import/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/conf/tcal_update.cfg --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/conf/tcal_update.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/conf/tcal_update.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -47,6 +47,17 @@ delete foobar [Endtest] - +[Test] +title UpdateToDoWithGlobalId +create tcal_update foobar +foobar UpdateToDoWithGlobalId +delete foobar +[Endtest] +[Test] +title UpdateInstanceWithGlobalId +create tcal_update foobar +foobar UpdateInstanceWithGlobalId +delete foobar +[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/calendarservice.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/calendarservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/calendarservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,12 +11,11 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARSERVICE_H #define __CALENDARSERVICE_H @@ -105,7 +104,29 @@ * @param aFilter Filter, Ownership is passed * @param aInstanceList output param gives Calendar Instance List */ - IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aEntryList); + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, RPointerArray& aInstanceList); + + /** + * Returns list of calendar instance from given calendar with the given Filter. + * @param aCalendarName Calendar Name + * @param aFilter Filter, Ownership is passed + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, CCalendarFilter* aFilter, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TDesC8& aGuid, MCalCallbackBase* aCallBack); + /** + * Returns list of calendar entries from given calendar with the given Global UID. + * @param aCalendarName Calendar Name + * @param aGuid Global UID + * @param aCallBack For ASyncronous usage of this Object this paramater is mandatory to be set + */ + IMPORT_C void GetListL( const TDesC& aCalendarName, const TCalLocalUid aLocalUid, MCalCallbackBase* aCallBack); /** * Add new calendar in device. @@ -233,4 +254,4 @@ }; -#endif __CALENDARSERVICE_H \ No newline at end of file +#endif __CALENDARSERVICE_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/entryattributes.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/entryattributes.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/entryattributes.h Thu Aug 27 07:43:07 2009 +0300 @@ -11,11 +11,10 @@ * * Contributors: * -* Description: +* Description: * */ - #ifndef __CALENDARENTRY_H #define __CALENDARENTRY_H @@ -348,26 +347,27 @@ */ enum TModifiedParameters { - ESummary =0x00001, - ESeqNum =0x00002, - EStartTime =0x00004, - EEndTime =0x00008, - EReplication =0x00010, - EDescription =0x00020, - EPriority =0x00040, - EMethod =0x00080, - EAlarmTime =0x00100, - ELocation =0x00200, - EStatus =0x00400, - ERepeatRule =0x00800, - EExDates =0x01000, - ERepeatDates =0x02000, - EPhoneOwner =0x04000, - EOrganizer =0x08000, - EAttendees =0x10000, - ELocalUid =0x20000, - EEntryType =0x40000, - EInsStartTime =0x80000, + ESummary =0x000001, + ESeqNum =0x000002, + EStartTime =0x000004, + EEndTime =0x000008, + EReplication =0x000010, + EDescription =0x000020, + EPriority =0x000040, + EMethod =0x000080, + EAlarmTime =0x000100, + ELocation =0x000200, + EStatus =0x000400, + ERepeatRule =0x000800, + EExDates =0x001000, + ERepeatDates =0x002000, + EPhoneOwner =0x004000, + EOrganizer =0x008000, + EAttendees =0x010000, + ELocalUid =0x020000, + EEntryType =0x040000, + EInsStartTime =0x080000, + EGlobalUid =0x100000, }; public: @@ -540,6 +540,13 @@ * @return void */ IMPORT_C void SetLocalUid( const TCalLocalUid aLUid); + /** + * Sets the uid for the calendar entry. + * @param aUid It is the uid of the entry to be modified + * @return void + */ + IMPORT_C void SetUidL( const TDesC8& aUid ); + /** * Gets the start time for the calendar entry. @@ -670,6 +677,12 @@ * @return void */ IMPORT_C TCalLocalUid LocalUid(); + /** + * Gets the GlobalUid for the calendar entry. + * @return void + */ + IMPORT_C TPtrC8 GlobalUid(); + /** * Gets the attributes that have changed for the calendar entry. @@ -791,6 +804,12 @@ * Local Uid of an entry which can uniquely identify entries having the same Global Uid */ TCalLocalUid iLocal; + + /** + * Global Uid of an entry which can uniquely identify entries having the same Global Uid + */ + HBufC8* iUid; + /** * Indicates which entries have new values for the update operation @@ -798,4 +817,4 @@ TInt32 iSetAttributes; }; -#endif __CALENDARENTRY_H \ No newline at end of file +#endif __CALENDARENTRY_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/tcal_update.h --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/tcal_update.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/inc/tcal_update.h Thu Aug 27 07:43:07 2009 +0300 @@ -145,7 +145,9 @@ virtual TInt UpdateAptWithAttendees( CStifItemParser& aItem ); virtual TInt UpdateRepeatDate( CStifItemParser& aItem ); virtual TInt UpdateInstance( CStifItemParser& aItem ); - + + virtual TInt UpdateToDoWithGlobalId( CStifItemParser& aItem ); + virtual TInt UpdateInstanceWithGlobalId( CStifItemParser& aItem ); //ADD NEW METHOD DEC HERE public: // Data diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/src/tcal_updateblocks.cpp --- a/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/src/tcal_updateblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_calendar/tsrc/testing/tcalendarservice/tcal_update/src/tcal_updateblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -114,7 +114,10 @@ ENTRY( "UpdateAptWithAttendees", Ctcal_update::UpdateAptWithAttendees ), ENTRY( "UpdateRepeatDate", Ctcal_update::UpdateRepeatDate ), ENTRY( "UpdateInstance", Ctcal_update::UpdateInstance ), - + + ENTRY( "UpdateToDoWithGlobalId", Ctcal_update::UpdateToDoWithGlobalId ), + ENTRY( "UpdateInstanceWithGlobalId", Ctcal_update::UpdateInstanceWithGlobalId ), + //ADD NEW ENTRY HERE }; @@ -983,3 +986,227 @@ // None // End of File +TInt Ctcal_update::UpdateToDoWithGlobalId( CStifItemParser& /*aItem*/ ) + { + + TInt result = KErrNone; + + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); +// TRAPD(err_add,AddCalendarFile( service, KTestCalTestFile )); + AddCalendarFile( service, KTestCal1File); + + + RPointerArray arruids(5); + + TUIDSet* uids = NULL; + + TInt err_addtodo; + +// TInt test_addtodo = AddToDo(service, KTestCalTestFile, uids); + +// if(test_addtodo != KErrNone) + err_addtodo = AddToDo(service, KTestCal1File, uids); + + if(err_addtodo == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + delete uids; + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + + + entryObj->SetEntryStatusL(KStatusTodoCompleted); + + + + + TRAPD(err_rep,entryObj->SetReplicationL(KTestRep)); + if(err_rep != KErrNone) + entryObj->SetReplicationL(KReplPrivate); + + + + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + + } + + TCalLocalUid modifiedEntryId; + TUIDSet* entryUids = NULL; + TRAPD( err, service->AddL(KTestCal1File,entryObj,entryUids) ); + TInt err_new; + TInt err_add; + + delete entryUids; + entryArray.ResetAndDestroy(); + if ( err == KErrNone ) + { + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + if( entryArray.Count() == 1 ) + { + if( !(entryArray[0]->ReplicationStatusL() == CCalEntry::EPrivate && entryArray[0]->StatusL() == CCalEntry::ETodoCompleted)) + { + result = KErrGeneral; + } + } + } + else + { + result = KErrGeneral; + } + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + + + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + return result; + + + } + +TInt Ctcal_update::UpdateInstanceWithGlobalId( CStifItemParser& /*aItem*/ ) + { + + TInt result = KErrNone; + + __UHEAP_MARK; + + CCalendarService* service = CCalendarService::NewL(); + + RemoveCalendarFile( service, KTestCal1File ); + AddCalendarFile( service, KTestCal1File ); + + RPointerArray arruids(5); + + RPointerArray calInstanceArray; + + CCalendarFilter *getListfilter2 = CCalendarFilter::NewL(); + + getListfilter2->SetFilterTypeL( KIncludeAll ); + + TUIDSet* uids = NULL; + + if(AddRepeatingAppointmentEntryL(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + if(AddEvent(service, KTestCal1File, uids) == KErrNone && uids) + { + arruids.Append(uids); + uids = NULL; + } + + service->GetListL( KTestCal1File, getListfilter2 , calInstanceArray ); + + TInt count = calInstanceArray.Count(); + + calInstanceArray.ResetAndDestroy(); + + + if ( arruids.Count() > 0 ) + { + RPointerArray entryArray; + + CEntryAttributes* entryObj = CEntryAttributes::NewL(); + + TTime stTime(TDateTime(2007, ESeptember, 17, 9, 0, 0, 0)); + entryObj->SetInstanceStartTimeL(stTime); + TTime startTime(TDateTime(2007, ESeptember, 17, 14, 0, 0, 0)); + entryObj->SetStartTimeL(startTime); + TTime endTime(TDateTime(2007, ESeptember, 17, 17, 30, 0, 0)); + entryObj->SetEndTimeL(endTime); + + CAttendeeInfo* attendee = CAttendeeInfo::NewL(_L("carendar@yahoo.com")); + CleanupStack::PushL(attendee); + attendee->SetRoleL(KAttRoleReqParticipant); + attendee->SetStatusL(KAttStatusTentative); + attendee->SetRsvp(EFalse); + + entryObj->AddAttendeeL(attendee); + CleanupStack::PopAndDestroy(attendee); + + attendee = CAttendeeInfo::NewL(_L("bettinapinto@gmail.com")); + CleanupStack::PushL(attendee); + attendee->SetCommonNameL(_L("SAPI")); + attendee->SetRoleL(KAttRoleReqParticipant); + attendee->SetStatusL(KAttStatusTentative); + attendee->SetRsvp(EFalse); + + entryObj->AddAttendeeL(attendee); + CleanupStack::PopAndDestroy(attendee); + + service->GetListL( KTestCal1File, *(arruids[0]->iGlobalUID) , entryArray ); + + if( entryArray.Count() == 1 ) + { + entryObj->SetUidL( *(arruids[0]->iGlobalUID) ); + } + + TUIDSet* uids = NULL; + // TCalLocalUid modifiedEntryId; + TRAPD( err, service->AddL(KTestCal1File,entryObj,uids) ); + //modifiedEntryId = uids->iLocalUID; + delete uids; + entryArray.ResetAndDestroy(); + if ( err == KErrNone ) + { + + getListfilter2->SetFilterTypeL( KIncludeAll ); + + service->GetListL( KTestCal1File, getListfilter2 , calInstanceArray ); + + TInt new_count = calInstanceArray.Count(); + if(new_count != count) + { + + result = KErrGeneral; + } + calInstanceArray.ResetAndDestroy(); + delete getListfilter2; + } + else + { + result = KErrGeneral; + } + + + entryArray.ResetAndDestroy(); + arruids.ResetAndDestroy(); + delete entryObj; + } + else + result = KErrGeneral; + + RemoveCalendarFile( service, KTestCal1File ); + + delete service; + + + __UHEAP_MARKEND; + + return result; + + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/bwins/contactserviceu.def --- a/serviceproviders/sapi_contacts_vpbk/contactservice/bwins/contactserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/bwins/contactserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -1,6 +1,6 @@ EXPORTS ?AddFieldToContactL@CSingleContact@@QAEXPBVCSingleContactField@@@Z @ 1 NONAME ; void CSingleContact::AddFieldToContactL(class CSingleContactField const *) - ?AddL@CContactService@@QAEXPAVCSingleContact@@ABVTDesC8@@ABVTDesC16@@2@Z @ 2 NONAME ; void CContactService::AddL(class CSingleContact *, class TDesC8 const &, class TDesC16 const &, class TDesC16 const &) + ?AddL@CContactService@@QAEPAVHBufC8@@PAVCSingleContact@@ABVTDesC8@@ABVTDesC16@@2@Z @ 2 NONAME ; class HBufC8 * CContactService::AddL(class CSingleContact *, class TDesC8 const &, class TDesC16 const &, class TDesC16 const &) ?AddL@CContactService@@QAEXPAVMContactCallback@@HPAVCSingleContact@@ABVTDesC8@@ABVTDesC16@@3@Z @ 3 NONAME ; void CContactService::AddL(class MContactCallback *, int, class CSingleContact *, class TDesC8 const &, class TDesC16 const &, class TDesC16 const &) ?AppendL@CSearchFields@@QAEXAAVTDesC8@@@Z @ 4 NONAME ; void CSearchFields::AppendL(class TDesC8 &) ?Cancel@CContactService@@QAEHJ@Z @ 5 NONAME ; int CContactService::Cancel(long) @@ -14,9 +14,9 @@ ?GetDateTime@CSingleContactField@@QAE?AVTTime@@XZ @ 13 NONAME ; class TTime CSingleContactField::GetDateTime(void) ?GetFieldDataL@CSingleContactField@@QAEXAAVTPtrC16@@AAV?$RPointerArray@VTDesC8@@@@@Z @ 14 NONAME ; void CSingleContactField::GetFieldDataL(class TPtrC16 &, class RPointerArray &) ?GetFieldDataL@CSingleContactField@@QAEXAAVTPtrC8@@AAVTPtrC16@@1@Z @ 15 NONAME ; void CSingleContactField::GetFieldDataL(class TPtrC8 &, class TPtrC16 &, class TPtrC16 &) - ?GetListL@CContactService@@QAEPAVCContactIter@@W4Ttype@@ABVTDesC8@@ABVTDesC16@@PAVCSearchFields@@W4TOrder@@2@Z @ 16 NONAME ; class CContactIter * CContactService::GetListL(enum Ttype, class TDesC8 const &, class TDesC16 const &, class CSearchFields *, enum TOrder, class TDesC16 const &) + ?GetListL@CContactService@@QAEPAVCContactIter@@W4Ttype@@ABVTDesC8@@ABVTDesC16@@PAVCSearchFields@@W4TOrder@@2W4TCmdType@@@Z @ 16 NONAME ; class CContactIter * CContactService::GetListL(enum Ttype, class TDesC8 const &, class TDesC16 const &, class CSearchFields *, enum TOrder, class TDesC16 const &, enum TCmdType) ?GetListL@CContactService@@QAEXAAVCContactIter@@@Z @ 17 NONAME ; void CContactService::GetListL(class CContactIter &) - ?GetListL@CContactService@@QAEXPAVMContactCallback@@HW4Ttype@@ABVTDesC8@@ABVTDesC16@@PAVCSearchFields@@W4TOrder@@3@Z @ 18 NONAME ; void CContactService::GetListL(class MContactCallback *, int, enum Ttype, class TDesC8 const &, class TDesC16 const &, class CSearchFields *, enum TOrder, class TDesC16 const &) + ?GetListL@CContactService@@QAEXPAVMContactCallback@@HW4Ttype@@ABVTDesC8@@ABVTDesC16@@PAVCSearchFields@@W4TOrder@@3W4TCmdType@@@Z @ 18 NONAME ; void CContactService::GetListL(class MContactCallback *, int, enum Ttype, class TDesC8 const &, class TDesC16 const &, class CSearchFields *, enum TOrder, class TDesC16 const &, enum TCmdType) ?ImportVCardToStoreL@CContactService@@QAEXABV?$TBuf@$0BAA@@@ABVTDesC16@@@Z @ 19 NONAME ; void CContactService::ImportVCardToStoreL(class TBuf<256> const &, class TDesC16 const &) ?ImportVCardToStoreL@CContactService@@QAEXPAVMContactCallback@@HABV?$TBuf@$0BAA@@@ABVTDesC16@@@Z @ 20 NONAME ; void CContactService::ImportVCardToStoreL(class MContactCallback *, int, class TBuf<256> const &, class TDesC16 const &) ?NewL@CContactIter@@SAPAV1@XZ @ 21 NONAME ; class CContactIter * CContactIter::NewL(void) @@ -37,4 +37,9 @@ ?GetFieldKeyFromId@CSearchFields@@SA?AVTPtrC8@@H@Z @ 36 NONAME ; class TPtrC8 CSearchFields::GetFieldKeyFromId(int) ?GetIdFromFieldKey@CSearchFields@@SAHAAVTDesC8@@@Z @ 37 NONAME ; int CSearchFields::GetIdFromFieldKey(class TDesC8 &) ?GetErrKey@CContactService@@QAEHXZ @ 38 NONAME ; int CContactService::GetErrKey(void) - + ?GetUriFieldParamL@CSingleContactField@@QAEXAAV?$RPointerArray@VHBufC16@@@@@Z @ 39 NONAME ; void CSingleContactField::GetUriFieldParamL(class RPointerArray &) + ?GetIdsL@CContactService@@QAEAAV?$RPointerArray@VHBufC8@@@@W4Ttype@@ABVTDesC16@@PAVCSearchFields@@W4TOrder@@1W4TCmdType@@@Z @ 40 NONAME ; class RPointerArray & CContactService::GetIdsL(enum Ttype, class TDesC16 const &, class CSearchFields *, enum TOrder, class TDesC16 const &, enum TCmdType) ?GetUriFieldParamL@CSingleContactField@@QAEXAAV?$RPointerArray@VHBufC16@@@@@Z @ 23 NONAME ; void CSingleContactField::GetUriFieldParamL(class RPointerArray &) + ?GetXspidDataL@CSingleContactField@@QAEXAAV?$RPointerArray@VHBufC16@@@@@Z @ 41 NONAME ; void CSingleContactField::GetXspidDataL(class RPointerArray &) + ?SetUriData@CSingleContactField@@QAEXVTPtrC16@@@Z @ 42 NONAME ; void CSingleContactField::SetUriData(class TPtrC16) + ?SetUriFieldParamsL@CSingleContactField@@QAEXABVTDesC8@@ABVTDesC16@@V?$RPointerArray@VHBufC16@@@@@Z @ 43 NONAME ; void CSingleContactField::SetUriFieldParamsL(class TDesC8 const &, class TDesC16 const &, class RPointerArray) + ?SetXspidDataL@CSingleContactField@@QAEXABVTDesC8@@ABVTDesC16@@AAV?$RPointerArray@VHBufC16@@@@@Z @ 44 NONAME ; void CSingleContactField::SetXspidDataL(class TDesC8 const &, class TDesC16 const &, class RPointerArray &) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/eabi/contactserviceu.def --- a/serviceproviders/sapi_contacts_vpbk/contactservice/eabi/contactserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/eabi/contactserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -25,8 +25,8 @@ _ZN15CContactService6CancelEl @ 24 NONAME _ZN15CContactService7DeleteLEP16MContactCallbackiR13RPointerArrayI6TDesC8ERK7TDesC16 @ 25 NONAME _ZN15CContactService7DeleteLER13RPointerArrayI6TDesC8ERK7TDesC16 @ 26 NONAME - _ZN15CContactService8GetListLE5TtypeRK6TDesC8RK7TDesC16P13CSearchFields6TOrderS6_ @ 27 NONAME - _ZN15CContactService8GetListLEP16MContactCallbacki5TtypeRK6TDesC8RK7TDesC16P13CSearchFields6TOrderS8_ @ 28 NONAME + _ZN15CContactService8GetListLE5TtypeRK6TDesC8RK7TDesC16P13CSearchFields6TOrderS6_8TCmdType @ 27 NONAME + _ZN15CContactService8GetListLEP16MContactCallbacki5TtypeRK6TDesC8RK7TDesC16P13CSearchFields6TOrderS8_8TCmdType @ 28 NONAME _ZN15CContactService8GetListLER12CContactIter @ 29 NONAME _ZN19CSingleContactField11GetDateTimeEv @ 30 NONAME _ZN19CSingleContactField13GetFieldDataLER6TPtrC8R7TPtrC16S3_ @ 31 NONAME @@ -67,4 +67,9 @@ _ZN13CSearchFields17GetFieldKeyFromIdEi @ 66 NONAME _ZN13CSearchFields17GetIdFromFieldKeyER6TDesC8 @ 67 NONAME _ZN15CContactService9GetErrKeyEv @ 68 NONAME - + _ZN15CContactService7GetIdsLE5TtypeRK7TDesC16P13CSearchFields6TOrderS3_8TCmdType @ 69 NONAME + _ZN19CSingleContactField10SetUriDataE7TPtrC16 @ 70 NONAME + _ZN19CSingleContactField13GetXspidDataLER13RPointerArrayI7HBufC16E @ 71 NONAME + _ZN19CSingleContactField13SetXspidDataLERK6TDesC8RK7TDesC16R13RPointerArrayI7HBufC16E @ 72 NONAME + _ZN19CSingleContactField17GetUriFieldParamLER13RPointerArrayI7HBufC16E @ 73 NONAME + _ZN19CSingleContactField18SetUriFieldParamsLERK6TDesC8RK7TDesC1613RPointerArrayI7HBufC16E @ 74 NONAME \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactcallback.h --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactcallback.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactcallback.h Thu Aug 27 07:43:07 2009 +0300 @@ -40,6 +40,15 @@ virtual void HandleReturnIter(const TInt& aError, CContactIter* aIter, TInt aTransId ) = 0; + + virtual void HandleReturnId(const TInt& aError, + HBufC8* aId, + TInt aTransId ) = 0; + + + virtual void HandleReturnArray(const TInt& aError, + RPointerArray& aArray, + TInt aTransId ) = 0; }; #endif // M_CONTACTCALLBACK_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactservice.h --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -116,7 +116,8 @@ const TDesC& aSearchVal = KNullDesC, CSearchFields* aSearchFields = NULL, TOrder aSortOrder = EAsc, - const TDesC& aStoreUri = VPbkContactStoreUris::DefaultCntDbUri()); + const TDesC& aStoreUri = VPbkContactStoreUris::DefaultCntDbUri(), + TCmdType val = EGetList); /* Get the list of databases currently open @@ -191,8 +192,22 @@ const TDesC& aSearchVal=KNullDesC, CSearchFields* aSearchFields=NULL, TOrder aSortOrder=EAsc, - const TDesC& aStoreUri=VPbkContactStoreUris:: - DefaultCntDbUri()); + const TDesC& aStoreUri=VPbkContactStoreUris::DefaultCntDbUri(), + TCmdType val=EGetList); + + /** + * Synchronous implementation of GetIds api. + * Get the list of ids of contacts/groups in the database satisfying the criteria in the SearchVal + * + * @return Integer indicating requestion submission. + */ + IMPORT_C + RPointerArray& GetIdsL(Ttype atype, + const TDesC& aSearchVal=KNullDesC, + CSearchFields* aSearchFields=NULL, + TOrder aSortOrder = EAsc, + const TDesC& aStoreUri=VPbkContactStoreUris::DefaultCntDbUri(), + TCmdType aval=EGetIds); /** * Synchronous implementation of AddL api. @@ -200,7 +215,7 @@ * 2) Editing a contact/group from the contacts database. * @return Integer indicating requestion submission. */ - IMPORT_C void AddL(CSingleContact* aContact, + IMPORT_C HBufC8* AddL(CSingleContact* aContact, const TDesC8& aGroupId = KNullDesC8, const TDesC& aGroupLabel = KNullDesC, const TDesC& aStoreUri = VPbkContactStoreUris:: diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactservice.hrh --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactservice.hrh Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactservice.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -56,4 +56,9 @@ EOpError }; +enum TCmdType + { + EGetList, + EGetIds + }; #endif // C_CONTACTSERVICE_HRH diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactsynccallback.h --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactsynccallback.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactsynccallback.h Thu Aug 27 07:43:07 2009 +0300 @@ -47,7 +47,12 @@ *@return value TInt, integer error code KErrNone if no error *occured else can be any system wide error code. */ + void GetArray(RPointerArray*); TInt GetErrorCode(); + + HBufC8* GetId(); + + /** *setter method for the wait shceduler shallow copy owned by core class. *@return void. @@ -71,13 +76,19 @@ *@return void. */ virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); + virtual void HandleReturnArray( const TInt& aError, RPointerArray& idArray, TInt aTransId ); + + virtual void HandleReturnId(const TInt& aError, HBufC8* acntId, TInt aTransId ); private: //Pointer to the CContactIter class. CContactIter* iIter; + RPointerArray iIDArray; //Integer error code. TInt iError; //Scheduler pointer owned by core class used by this class CActiveSchedulerWait *iWaitScheduler; + HBufC8* icntId; + public: TInt iErrKey; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactviewobserver.h --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactviewobserver.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/contactviewobserver.h Thu Aug 27 07:43:07 2009 +0300 @@ -54,7 +54,8 @@ const TDesC& aStoreUri, TOrder aSortOrder, TInt aTransId, - CActiveSchedulerWait* aSchedulerWait); + CActiveSchedulerWait* aSchedulerWait, + TCmdType val); @@ -84,7 +85,8 @@ MContactCallback* aCallback, TOrder aSortOrder, TInt aTransId, - CActiveSchedulerWait* aSchedulerWait); + CActiveSchedulerWait* aSchedulerWait, + TCmdType val = EGetList); void ReturnDefaultView(); @@ -130,6 +132,7 @@ //ContactService Handle CContactService* iContactService; + TCmdType iVal; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/fieldkeys.hrh --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/fieldkeys.hrh Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/fieldkeys.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -99,6 +99,7 @@ _LIT8(KSyncClass, "SyncClass"); _LIT8(KLOCPrivacy, "LOCPrivacy"); _LIT8(KGenLabel, "GenLabel"); +_LIT8(KXspid, "IMPP"); #endif // C_FIELDKEYS_HRH #endif //C_CONTACTINTERFACE_HRH \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/getliststorelistobserver.h --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/getliststorelistobserver.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/getliststorelistobserver.h Thu Aug 27 07:43:07 2009 +0300 @@ -54,7 +54,8 @@ CContactIter* aIter, Ttype atype, TInt aTransId, - MVPbkContactStore* aContactStore); + MVPbkContactStore* aContactStore, + TCmdType val); ~CGetListStoreListObserver(); @@ -109,7 +110,7 @@ TOrder aSortOrder,MContactCallback *aCallback, CContactService *aContactService, CContactIter* aIter, enum Ttype atype, - TInt aTransId,MVPbkContactStore* aContactStore); + TInt aTransId,MVPbkContactStore* aContactStore, TCmdType val); /** * Sets the view of the database and also creates a filtered view @@ -157,6 +158,7 @@ * RetrieveL() Handle */ MVPbkContactOperationBase* iRetOp; + TCmdType iVal; }; #endif//C_GETLISTSTORELISTOBSERVER_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/singlecontact.h --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/singlecontact.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/singlecontact.h Thu Aug 27 07:43:07 2009 +0300 @@ -88,6 +88,7 @@ CSingleContactField* NextFieldL(MVPbkStoreContact* aSingleContact, TInt aIndex); + CSingleContactField* GetXSPIDFieldL(MVPbkStoreContact* aSingleContact, TInt& aIndex); /* *Get the number of fields in the contact */ diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/inc/singlecontactfield.h --- a/serviceproviders/sapi_contacts_vpbk/contactservice/inc/singlecontactfield.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/inc/singlecontactfield.h Thu Aug 27 07:43:07 2009 +0300 @@ -71,7 +71,11 @@ IMPORT_C void SetFieldParamsL(const TDesC8& Fieldkey, const TDesC& aLabel, const TDesC& aValue); - + IMPORT_C void SetUriFieldParamsL(const TDesC8& aFieldKey, + const TDesC& aLabel, + const RPointerArray aValue); + + IMPORT_C void GetUriFieldParamL(RPointerArray& axspidArray); /** * Sets the Label and the id arrray of the group. * @param aGroupLabel A reference that holds the Label. @@ -80,6 +84,11 @@ */ void SetFieldParamsL(const TPtrC& aGroupLabel, RPointerArray& aArray); + IMPORT_C void SetXspidDataL(const TDesC8& aFieldKey, + const TDesC& aLabel, + RPointerArray& axspidArray); + + IMPORT_C void GetXspidDataL(RPointerArray& axspidArray); /** * Get Method for time. @@ -94,6 +103,7 @@ * @return None. */ IMPORT_C void SetDateTime(TTime aDateTime); + IMPORT_C void SetUriData(TPtrC aUri); /** * CSingleContactField Destructor. @@ -123,13 +133,15 @@ HBufC8* iFieldKey; HBufC* iLabel; HBufC* iValue; - + RPointerArray iArrayValue; //In case the value is of type TTime TTime iDateAndTime; //In case we are iterating a group HBufC* iGroupLabel; RPointerArray iContactIdArray; + RPointerArray iUriData; + RPointerArray iidArray; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/addcontactobserver.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/addcontactobserver.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/addcontactobserver.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -31,6 +31,7 @@ #include #include #include +#include /* ------------------------------------------------------------------------------------- @@ -162,12 +163,17 @@ TPtrC8 fieldKey(KNullDesC8); TPtrC label(KNullDesC); TPtrC value(KNullDesC); + TBool labelFound = EFalse; iErrorID = 0; - + TBuf16<100> bufVal; + int len =0; + TBool xspidField = EFalse; + TBool secTime = EFalse; TInt fieldCount = iStoreContact->FieldCount(); const CVPbkContactManager* contactManager = &(iContactService->GetContactManager()); for(TInt index = 0; index < fieldCount; index++) { + xspidField = EFalse; CSingleContactField* field = iStoreContact->FieldAt(index); field->GetFieldDataL(fieldKey, label, value); @@ -189,16 +195,73 @@ TTime timeVal = field->GetDateTime(); (MVPbkContactFieldDateTimeData::Cast(cntField->FieldData())).SetDateTime( timeVal ); } + else if(EVPbkFieldStorageTypeUri == storageType ) + { + + + xspidField = ETrue; + RPointerArray xspidArray; + //CleanupClosePushL(xspidArray); + field->GetXspidDataL(xspidArray); + TInt count = xspidArray.Count(); + for(int i=0; iCreateFieldLC( * contactManager->FieldTypes().Find( fieldTypeResId ) ); + + iErrorID = 0; + + storageType = cntField->FieldData().DataType(); + + } + secTime = ETrue; + + HBufC* val = xspidArray[i]; + bufVal.Copy(val->Des()); + TDes16 desVal = bufVal; + TPtrC ptrVal; //desVal.Left(0); + TInt valLen = val->Length(); + (MVPbkContactFieldUriData::Cast(cntField->FieldData())).SetUriL( bufVal ); + + len = val->Find(_L(":")); + + if(len != -1) + { + TInt trimLen = valLen - len; + ptrVal.Set(val->Left(valLen - (trimLen))); + len =0; + + TRAP_IGNORE(cntField->SetFieldLabelL(ptrVal)); + + iContact->AddFieldL(cntField); + CleanupStack::Pop(); //cntField + } + else + { + CleanupStack::Pop(); //cntField + User::Leave(KErrArgument); + } + + // delete val; + } + xspidArray.Reset(); + //CleanupStack::Pop(); + } else { (MVPbkContactFieldTextData::Cast(cntField->FieldData())).SetTextL( value ); } - + if(xspidField == EFalse) + { TRAP_IGNORE(cntField->SetFieldLabelL(label)); iContact->AddFieldL(cntField); CleanupStack::Pop(); //cntField + } } } @@ -277,12 +340,16 @@ aResult.iOpCode == EContactLock && ((*iGroupId != KNullDesC8) && (*iGroupLabel != KNullDesC)) ) { - (iContact->Group())->SetGroupLabelL(*iGroupLabel); + MVPbkContactGroup* grpintf = iContact->Group(); + if(grpintf != NULL) + { + grpintf->SetGroupLabelL(*iGroupLabel); (iContact->Group())->CommitL(*this); //set lock flag to false, as it is done. iLockFlag = EFalse; //set return value to ErrNone...completed successfully. retVal = KErrNone; + } } //lock is success, so update the fields in the contact and commit. else if( iLockFlag && aResult.iOpCode == EContactLock ) @@ -341,14 +408,61 @@ //if lock operation is successfull then it enters here... //call DoCommitL(), to commit the contact into the contact store. TRAPD(error, error = DoCommitL(aResult)); - + if(error == KErrNone) + { //notify the user with the status of the operation. if((aResult.iOpCode != EContactLock) || (error != KErrNone)) { - iContactService->RequestComplete(iTransId); - iCallback->HandleReturnValue(EOpComplete, error, iTransId); - delete this; + //iContactService->RequestComplete(iTransId); + //iCallback->HandleReturnValue(EOpComplete, error, iTransId); + if(iGroupLabel->Compare(KNullDesC) != 0) //.Compare(KNullDesC)) != 0) + { + if(iGroup != NULL) + { + iContactService->RequestComplete(iTransId); + MVPbkContactLink* link = iGroup->CreateLinkLC(); + HBufC8* grpId = link->PackLC(); + CleanupStack::Pop(grpId); + iCallback->HandleReturnId(error, grpId, iTransId); + CleanupStack::PopAndDestroy(); + //delete grpId; + delete this; + } + else + { + iContactService->RequestComplete(iTransId); + iCallback->HandleReturnValue(EOpComplete, error, iTransId); + delete this; + } + } + else + { + if(iContact != NULL) + { + iContactService->RequestComplete(iTransId); + MVPbkContactLink* link = iContact->CreateLinkLC(); + HBufC8* cntId = link->PackLC(); + CleanupStack::Pop(cntId); + iCallback->HandleReturnId(error, cntId, iTransId); + CleanupStack::PopAndDestroy(); + // delete cntId; + delete this; + } + else + { + iContactService->RequestComplete(iTransId); + iCallback->HandleReturnValue(EOpComplete, error, iTransId); + delete this; + } + } + } } + else + { + iContactService->RequestComplete(iTransId); + iCallback->HandleReturnValue(EOpError, error, iTransId); + delete this; + } } /* diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/contactiter.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactiter.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactiter.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -221,7 +221,8 @@ self, EOthers, iTransId, - NULL) ; + NULL, + EGetList) ; if(iContactStore) { iContactStore->OpenL( *iGetListStoreListObserver ); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/contactservice.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactservice.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactservice.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -431,7 +431,7 @@ const TDesC& aSearchVal, CSearchFields* aSearchFields, TOrder aSortOrder, - const TDesC& aStoreUri) + const TDesC& aStoreUri, TCmdType val) { TInt retVal = KErrGeneral; CContactIter* iter; @@ -472,7 +472,7 @@ iter, type, aTransId, - iContactStore) ; + iContactStore,val) ; CleanupStack::PushL(getListOpenObserver); @@ -510,7 +510,7 @@ iter, type, aTransId, - iContactStore) ; + iContactStore,val) ; CleanupStack::PushL(getListOpenObserver); //Opens the database and goes to observer's StoreReady() function. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/contactsyncapi.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactsyncapi.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactsyncapi.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -35,7 +35,8 @@ const TDesC& aSearchVal, CSearchFields* aSearchFields, TOrder aSortOrder, - const TDesC& aStoreUri) + const TDesC& aStoreUri, + TCmdType aval) { //create the callback object internally CContactSyncCallback* callback = new(ELeave) CContactSyncCallback(); @@ -53,7 +54,8 @@ aSearchVal, aSearchFields, aSortOrder, - aStoreUri)); + aStoreUri, + aval)); //TRAP harness is used to unset the sync flag in leaving condition //since we r using the same async apis for sync implementation if(KErrNone != err) @@ -77,7 +79,63 @@ } +/* +----------------------------------------------------------------------------- + CContactService :: GetIdsL + Description : synchronous implementation of GetIds api. + Return values : RPointerArray& +----------------------------------------------------------------------------- +*/ +EXPORT_C +RPointerArray& CContactService::GetIdsL(Ttype atype, + const TDesC& aSearchVal, + CSearchFields* aSearchFields, + TOrder aSortOrder, + const TDesC& aStoreUri, + TCmdType aval) + { + //create the callback object internally + CContactSyncCallback* callback = new(ELeave) CContactSyncCallback(); + CleanupStack::PushL(callback); + //create the wait scheduler instance + CActiveSchedulerWait* waitScheduler = new(ELeave) CActiveSchedulerWait(); + CleanupStack::PushL(waitScheduler); + //needed to stop the scheduler by the callback instance + callback->SetWaitScheduler(waitScheduler); + //call the asynch sapi with all the params + TRAPD(err,GetListL(callback, + 0, + atype, + KNullDesC8, + aSearchVal, + aSearchFields, + aSortOrder, + aStoreUri, + aval)); + //TRAP harness is used to unset the sync flag in leaving condition + //since we r using the same async apis for sync implementation + if(KErrNone != err) + { + User::Leave(err); + } + //start the wait scheduler and wait untill the operation finishes + waitScheduler->Start(); + //Unset the callbak pointer + callback->SetWaitScheduler(NULL); + //check for any errors + TInt error = callback->GetErrorCode(); + if(KErrNone != error) + { + User::Leave(error); + } + RPointerArray* tempArray = new (ELeave) RPointerArray; + //get the array of ids of contacts/groups + callback->GetArray(tempArray); + CleanupStack::PopAndDestroy(waitScheduler); + CleanupStack::PopAndDestroy(callback); + return *tempArray; + } /* ----------------------------------------------------------------------------- CContactService :: AddL @@ -87,7 +145,7 @@ */ EXPORT_C -void CContactService:: AddL( CSingleContact* aContact, +HBufC8* CContactService:: AddL( CSingleContact* aContact, const TDesC8& aGroupId, const TDesC& aGroupLabel, const TDesC& aStoreUri) @@ -128,8 +186,13 @@ } User::Leave(error); } - CleanupStack::PopAndDestroy(waitScheduler); - CleanupStack::PopAndDestroy(callback); + + HBufC8* cntIdVal = callback->GetId(); + + CleanupStack::PopAndDestroy(waitScheduler); + CleanupStack::PopAndDestroy(callback); + return cntIdVal; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/contactsynccallback.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactsynccallback.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactsynccallback.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -126,3 +126,41 @@ //can be CActiveScheduler::Stop(); or to be replaced by wait scheduler. iWaitScheduler->AsyncStop(); } + + + void CContactSyncCallback :: HandleReturnId(const TInt& /*aError*/,HBufC8* acntId , TInt /*aTransId*/ ) + { + icntId = acntId; + + iWaitScheduler->AsyncStop(); + } + + + HBufC8* CContactSyncCallback :: GetId() + { + return icntId; + } + + void CContactSyncCallback :: HandleReturnArray( const TInt& /*aError*/, RPointerArray& idArray, TInt /*aTransId*/ ) + { + //iIDArray = idArray; + for(TInt i = 0; iAllocL(); + iIDArray.AppendL(idBufVal); + } + //can be CActiveScheduler::Stop(); or to be replaced by wait scheduler. + iWaitScheduler->AsyncStop(); + } + +void CContactSyncCallback::GetArray(RPointerArray* aArray) + { + for(TInt i = 0; iAllocL(); + aArray->AppendL(idBufVal); + delete idVal; + } + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/contactviewobserver.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactviewobserver.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/contactviewobserver.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -21,6 +21,7 @@ #include "contactiter.h" #include "contactviewobserver.h" +#include //--------------------------------------------------------------------------- @@ -31,32 +32,86 @@ { if((iFlag == EContactFilteredView) || ((iFlag == EContactDefaultView) && (iDefaultView))) { - CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewL(); - CleanupStack::PushL(linkArray); - TInt viewCount = aView.ContactCountL(); - if(viewCount) - { - for(TInt i=0; i < viewCount; i++) + TInt viewCount = aView.ContactCountL(); + + + if(viewCount) + { + CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewL(); + CleanupStack::PushL(linkArray); + RPointerArray idArray(viewCount); + if(iVal == EGetList) + { + MVPbkContactLink* link = NULL; + for(TInt i=0; i < viewCount; i++) + { + + link = aView.CreateLinkLC(i); + linkArray->AppendL(link); + CleanupStack::Pop(); + } + } + else + { + if(iSortOrder == EDesc) { - linkArray->AppendL(aView.CreateLinkLC(i)); - } - - //Set the params for iterator - iIter->SetParams(linkArray, *iStoreUri, iSortOrder, iTransId, EContacts, iContactService); - - //Notify the user - iCallback->HandleReturnIter(KErrNone, iIter, iTransId); - - CleanupStack::Pop(viewCount); - } + for(TInt i=(viewCount-1); i >= 0; i--) + { + MVPbkContactLink* link = NULL; + link = aView.CreateLinkLC(i); + idArray.AppendL( link->PackLC()); + CleanupStack::Pop(); //PackLC puts every element into cleanup stack + //CleanupStack::PopAndDestroy(); + } + } + else + { + for(TInt j=0; j < viewCount; j++) + { + MVPbkContactLink* link = NULL; + link = aView.CreateLinkLC(j); + idArray.AppendL( link->PackLC()); + CleanupStack::Pop(); //PackLC puts every element into cleanup stack + //CleanupStack::PopAndDestroy(); + } + } + } + + + + if(iVal == EGetList) + { + //Set the params for iterator + iIter->SetParams(linkArray, *iStoreUri, iSortOrder, iTransId, EContacts, iContactService); + //Notify the user + iCallback->HandleReturnIter(KErrNone, iIter, iTransId); + // CleanupStack::Pop(viewCount); //All Contacts are put in clean up stack. Pop em + CleanupStack::Pop(linkArray); + + } + else + { + //iContactService->RequestComplete(iTransId); + //Notify the user + //iCallback->HandleReturnIter(KErrNone, iIter, iTransId); + + iCallback->HandleReturnArray(KErrNone, idArray, iTransId); + CleanupStack::PopAndDestroy(viewCount); + CleanupStack::PopAndDestroy(linkArray); + //idArray.Reset(); + delete iIter; + } + + + } else { //Notify User iCallback->HandleReturnValue(EOpComplete, KErrNotFound, iTransId); - delete iIter; + delete iIter; iIter = NULL; } - CleanupStack::Pop(linkArray); + } } @@ -84,9 +139,9 @@ // NewL() //--------------------------------------------------------------------------- -CContactViewObserver* CContactViewObserver::NewL( MContactCallback* aCallback, enum TViewFlag aFlag, CContactIter* iIter,CContactService* aContactService,const TDesC& aStoreUri, TOrder aSortOrder, TInt aTransId, CActiveSchedulerWait* aSchedulerWait) +CContactViewObserver* CContactViewObserver::NewL( MContactCallback* aCallback, enum TViewFlag aFlag, CContactIter* iIter, CContactService* aContactService,const TDesC& aStoreUri, TOrder aSortOrder, TInt aTransId, CActiveSchedulerWait* aSchedulerWait, TCmdType val) { - CContactViewObserver* self = new( ELeave ) CContactViewObserver( aStoreUri, aFlag, iIter, aContactService, aCallback, aSortOrder, aTransId, aSchedulerWait); + CContactViewObserver* self = new( ELeave ) CContactViewObserver( aStoreUri, aFlag, iIter,aContactService, aCallback, aSortOrder, aTransId, aSchedulerWait, val); return self; } @@ -96,7 +151,7 @@ //--------------------------------------------------------------------------- -CContactViewObserver::CContactViewObserver(const TDesC& aStoreUri, enum TViewFlag aFlag, CContactIter* aIter, CContactService* aContactService, MContactCallback* aCallback, TOrder aSortOrder, TInt aTransId, CActiveSchedulerWait* aSchedulerWait ) +CContactViewObserver::CContactViewObserver(const TDesC& aStoreUri, enum TViewFlag aFlag, CContactIter* aIter, CContactService* aContactService, MContactCallback* aCallback, TOrder aSortOrder, TInt aTransId, CActiveSchedulerWait* aSchedulerWait, TCmdType val ) : iStoreUri (&aStoreUri), iFlag (aFlag), iIter (aIter), @@ -105,7 +160,8 @@ iTransId (aTransId), iDefaultView (EFalse), iSchedulerWait(aSchedulerWait), - iContactService(aContactService) + iContactService(aContactService), + iVal(val) { } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/getliststorelistobserver.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/getliststorelistobserver.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/getliststorelistobserver.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -150,7 +150,7 @@ iUri, iSortOrder, iTransId, - schedulerWait); + schedulerWait, iVal); CleanupStack::PushL(defaultView); if(iSearchVal->Length() <= 0) { @@ -205,7 +205,7 @@ iUri, iSortOrder, iTransId, - schedulerWait); + schedulerWait,iVal); CleanupStack::PushL(filteredView); //Filtering the view to find the iFindStrings @@ -228,22 +228,52 @@ { //Get the linkarray of the groups in the database MVPbkContactLinkArray* array = aContactStore.ContactGroupsLC(); - if(array->Count()) - { - //Set the iterator with the result - iIter->SetParams(array, iUri, EAsc, iTransId, EGroups, iContactService); - - iContactService->RequestComplete(iTransId); - //Notify the user - iCallback->HandleReturnIter(KErrNone, iIter, iTransId); - } - else - { - iContactService->RequestComplete(iTransId); + TInt count = array->Count(); + if(count) + { + if(iVal == EGetList) + { + //Set the iterator with the result + iIter->SetParams(array, iUri, EAsc, iTransId, EGroups, iContactService); + + iContactService->RequestComplete(iTransId); + //Notify the user + iCallback->HandleReturnIter(KErrNone, iIter, iTransId); + } + else + { + RPointerArray idArray(count); + MVPbkContactLink *link = NULL; + //Set the array with the ids + for(TInt index(0); index < count; index++) + { + link = const_cast(&((*array)[index])); + idArray.AppendL(link->PackLC()); + CleanupStack::Pop(); + } + //iIter->SetIdsPtr(idArray, count); + iContactService->RequestComplete(iTransId); + //Notify the user + iCallback->HandleReturnArray(KErrNone , idArray , iTransId); + idArray.Reset(); + //CleanupStack::PopAndDestroy(link); + delete link; + link = NULL; + //CleanupStack::Pop(); + //delete array; + //array = NULL; + //iCallback->HandleReturnIter(KErrNone, iIter, iTransId); + } + } + else + { + iContactService->RequestComplete(iTransId); //Notify the user iCallback->HandleReturnValue(EOpComplete, KErrNotFound, iTransId); + delete iIter; + iIter = NULL; } - CleanupStack::Pop(); + CleanupStack::Pop(); } else if(iType == EOthers) { @@ -292,7 +322,7 @@ CContactService *aContactService, CContactIter* aIter, enum Ttype aType, TInt aTransId, - MVPbkContactStore* aContactStore) + MVPbkContactStore* aContactStore, TCmdType val) { CGetListStoreListObserver* self = @@ -306,7 +336,7 @@ aIter, aType, aTransId, - aContactStore); + aContactStore, val); self->ConstructL(aContactId, aSearchVal); return self; } @@ -336,7 +366,7 @@ CContactService *aContactService, CContactIter* aIter, enum Ttype aType, TInt aTransId, - MVPbkContactStore* aContactStore) + MVPbkContactStore* aContactStore, TCmdType val) { iUri = aUri; iSearchFields = aSearchFields; @@ -349,6 +379,7 @@ iFieldsList = NULL; iRetOp = NULL; iContactStore = aContactStore; + iVal = val; } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/searchfields.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/searchfields.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/searchfields.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -89,7 +89,7 @@ {R_VPBK_FIELD_TYPE_NOTE , _L8("Note")}, // {R_VPBK_FIELD_TYPE_THUMBNAILPIC , _L8("ThumbNailPic")}, {R_VPBK_FIELD_TYPE_RINGTONE , _L8("Ringtone")}, -// {R_VPBK_FIELD_TYPE_CALLEROBJIMG , _L8("CallerObjImg")}, + {R_VPBK_FIELD_TYPE_CALLEROBJIMG , _L8("CallerObjImg")}, // {R_VPBK_FIELD_TYPE_CALLEROBJTEXT , _L8("CallerObjText")}, {R_VPBK_FIELD_TYPE_MIDDLENAME , _L8("MiddleName")}, {R_VPBK_FIELD_TYPE_DEPARTMENT , _L8("Department")}, @@ -102,6 +102,7 @@ {R_VPBK_FIELD_TYPE_SYNCCLASS , _L8("SyncClass")}, {R_VPBK_FIELD_TYPE_LOCPRIVACY , _L8("LOCPrivacy")}, // {R_VPBK_FIELD_TYPE_GENLABEL , _L8("GenLabel")}, + {R_VPBK_FIELD_TYPE_IMPP , _L8("IMPP")}, }; //Gets the size of the mappingTable diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontact.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontact.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontact.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -29,6 +29,9 @@ #include #include #include +#include +_LIT8(KXSPID,"IMPP"); +_LIT(KXSPIDLabel,"IMPP"); #include "singlecontact.h" @@ -69,6 +72,7 @@ void CSingleContact::ConvertContactToFieldListL(MVPbkStoreContact* aSingleContact) { + TBool XSPID = EFalse; if(aSingleContact) { @@ -76,6 +80,36 @@ CSingleContactField* field = NULL; for(TInt fieldIndex = 0; fieldIndex < fieldCount ; fieldIndex++) { + TPtrC8 fieldKey; + if(XSPID == EFalse) + { + MVPbkStoreContactField& fieldval = aSingleContact->Fields().FieldAt(fieldIndex); + + //Get the fieldKey of the field + fieldKey.Set(CSearchFields::GetFieldKeyFromId(fieldval.BestMatchingFieldType()->FieldTypeResId())); + + } + else + { + fieldIndex--; + MVPbkStoreContactField& fieldval = aSingleContact->Fields().FieldAt(fieldIndex); + + //Get the fieldKey of the field + fieldKey.Set(CSearchFields::GetFieldKeyFromId(fieldval.BestMatchingFieldType()->FieldTypeResId())); + XSPID = EFalse; + } + + if(fieldKey.Compare(KXSPID) == 0) + { + XSPID = ETrue; + field = GetXSPIDFieldL(aSingleContact, fieldIndex); + if(field != NULL) + { + iFields.Append(field); + } + } + else + { field = NextFieldL(aSingleContact, fieldIndex); if(field !=NULL) { @@ -83,9 +117,61 @@ } } } + } delete aSingleContact; } +CSingleContactField* CSingleContact::GetXSPIDFieldL(MVPbkStoreContact* aSingleContact, TInt& aIndex) + { + CSingleContactField* contactField = CSingleContactField::NewL(); + CleanupStack::PushL(contactField); + TPtrC uri; + if(iIndicator == EContacts) + { + MVPbkStoreContactField& field = aSingleContact->Fields().FieldAt(aIndex); + + //Get the fieldKey of the field + TPtrC8 fieldKeyXspid = CSearchFields::GetFieldKeyFromId(field.BestMatchingFieldType()->FieldTypeResId()); + if(fieldKeyXspid.Compare(KNullDesC8) == 0) + { + CleanupStack::PopAndDestroy(contactField); + return NULL; + } + + RPointerArray xspidArray; + + while(fieldKeyXspid.Compare(KXSPID) == 0) + { + TPtrC label(field.FieldLabel()); + + TVPbkFieldStorageType storageType = field.FieldData().DataType(); + + if(EVPbkFieldStorageTypeUri == storageType ) + { + //TDesC val = label.Alloc(); + uri.Set((MVPbkContactFieldUriData::Cast(field.FieldData())).Uri()); + /* TBuf<10> bufVal1; + bufVal1.Copy(label); + TBuf<100> bufVal2; + bufVal2.Copy(uri); + bufVal1.Append(_L(":")); + bufVal1.Append(bufVal2); + HBufC* xspidVal = bufVal1.AllocLC();*/ + xspidArray.AppendL(uri.AllocL()); + } + aIndex++; + MVPbkStoreContactField& field = aSingleContact->Fields().FieldAt(aIndex); + + fieldKeyXspid.Set(CSearchFields::GetFieldKeyFromId(field.BestMatchingFieldType()->FieldTypeResId())); + + } + + contactField->SetUriFieldParamsL(KXSPID,KXSPIDLabel,xspidArray); + CleanupStack::Pop(contactField); + return contactField; + } + return NULL; + } //Returns the Next field in the contact if any, otherwise returns NULL CSingleContactField* CSingleContact::NextFieldL(MVPbkStoreContact* aSingleContact, TInt aIndex) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontactfield.cpp --- a/serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontactfield.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/contactservice/src/singlecontactfield.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -59,7 +59,15 @@ TPtrC& aLabel, TPtrC& aValue) { - if(iFieldKey && iLabel && iValue) + if(iFieldKey->Compare(KXspid) == 0) + { + if(iFieldKey && iLabel) + { + aFieldKey.Set(*iFieldKey); + aLabel.Set(*iLabel); + } + } + else if(iFieldKey && iLabel && iValue) { aFieldKey.Set(*iFieldKey); aLabel.Set(*iLabel); @@ -106,6 +114,50 @@ iValue = aValue.AllocL(); } + +EXPORT_C void CSingleContactField:: + SetUriFieldParamsL(const TDesC8& aFieldKey, + const TDesC& aLabel, + const RPointerArray aValue) + { + if(iFieldKey) + { + delete iFieldKey; + iFieldKey = NULL; + } + if( iLabel ) + { + delete iLabel; + iLabel = NULL; + } + if( iValue ) + { + delete iValue; + iValue = NULL; + } + iFieldKey= aFieldKey.AllocL(); + iLabel = aLabel.AllocL(); + iidArray.ResetAndDestroy(); + iidArray = aValue; + } + +EXPORT_C void CSingleContactField::GetUriFieldParamL(RPointerArray& axspidArray) + { + TInt count = iidArray.Count(); + if(count != 0) + { + + for(TInt i=0;i& axspidArray) + { + if(iFieldKey) + { + delete iFieldKey; + iFieldKey = NULL; + } + if( iLabel ) + { + delete iLabel; + iLabel = NULL; + } + iFieldKey= aFieldKey.AllocL(); + iLabel = aLabel.AllocL(); + iArrayValue = axspidArray; + } + + +EXPORT_C void CSingleContactField::GetXspidDataL(RPointerArray& axspidArray) + { + TInt count = iArrayValue.Count(); + if(count != 0) + { + + for(TInt i=0;i& aArray, + TInt aTransId ) = 0; }; #endif // M_CONTACTCALLBACK_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/inc/contacterrormessage.hrh --- a/serviceproviders/sapi_contacts_vpbk/inc/contacterrormessage.hrh Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/inc/contacterrormessage.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -22,8 +22,11 @@ //GetList _LIT(KGetListContentTypeMissing, "Contacts : GetList : Type is Missing"); _LIT(KGetListInvalidContentType, "Contacts: GetList : Invalid value for Type, Must be Contact/Group/Database"); +_LIT(KGetIdsInvalidContentType, "Contacts: GetIds : Invalid value for Type, Must be Contact/Group"); _LIT(KGetListInvalidSortType, "Contacts : GetList : Invalid Sort Type, Map is required"); _LIT(KGetListSortOrderValue,"Contacts : GetList : Sort Order Value is not a String"); +_LIT(KGetIdsBadArgCntId, "Contacts: GetIds : Invalid Contact Id input"); +_LIT(KGetIdsBadArgGrpId, "Contacts: GetIds : Invalid Group Id input"); //new GetList _LIT(KGetListInvalidFilterType,"Contacts : GetList : Invalid Type of Filter, Map is required"); @@ -58,6 +61,7 @@ _LIT(KAddGroupLabelEmpty,"Contacts : Add : Group Label is Empty"); _LIT(KAddInvalidFieldKey,"Contacts : Add : Invalid Field Key : "); _LIT(KAddFieldKeyNotSupported,"Contacts : Add :Field Key Not Supported on this Database: "); +_LIT(KAddXspidInvalidFormat,"Contacts : Add :Invalid format of value for IMPP field"); //cannot be determined ///////////////_LIT(KAddWrongFieldKey,"Contacts : Add : Invalid Field Key"); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/inc/contactinterface.h --- a/serviceproviders/sapi_contacts_vpbk/inc/contactinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/inc/contactinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -165,7 +165,8 @@ CLiwGenericParamList& aOutParamList, MLiwNotifyCallback* aCallback, TUint aCmdOptions, - TInt aTransId); + TInt aTransId, + TCmdType aVal); /** * Parses the input list and calls the Add API. * diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/inc/contactinterface.hrh --- a/serviceproviders/sapi_contacts_vpbk/inc/contactinterface.hrh Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/inc/contactinterface.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -29,6 +29,7 @@ _LIT8( KCmdImport, "Import" ); _LIT8( KCmdExport, "Export" ); _LIT8( KCmdGetList, "GetList"); +_LIT8( KCmdGetIds, "GetIds"); _LIT8( KCmdAdd, "Add" ); _LIT8( KCmdDelete, "Delete" ); _LIT8( KCmdOrganiseGroups, "Organise" ); @@ -36,7 +37,7 @@ // Constant for the appending Error code _LIT8( KErrorCode, "ErrorCode" ); _LIT8( KErrorMessage, "ErrorMessage" ); - +_LIT8(KIdsLabel,"IdList"); // Constant for the appending TransactionID _LIT8( KTransactionID, "TransactionID" ); @@ -75,6 +76,7 @@ _LIT(KAscending, "Ascending"); _LIT(KDescending, "Descending"); +_LIT(KXspidLabel,"IMPP"); #ifndef C_FIELDKEYS_HRH @@ -156,6 +158,7 @@ _LIT8(KSyncClass, "SyncClass"); _LIT8(KLOCPrivacy, "LOCPrivacy"); _LIT8(KGenLabel, "GenLabel"); +_LIT8(KXspid, "IMPP"); #endif // C_FIELDKEYS_HRH #endif // C_CONTACTINTERFACE_HRH diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/inc/contactinterfacecallback.h --- a/serviceproviders/sapi_contacts_vpbk/inc/contactinterfacecallback.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/inc/contactinterfacecallback.h Thu Aug 27 07:43:07 2009 +0300 @@ -50,6 +50,7 @@ */ static CContactInterfaceCallback* NewL(CSingleContact* aContact); + static void ContactIDToUTF(HBufC* aContactID); /** * Destructor */ @@ -86,6 +87,9 @@ */ virtual void HandleReturnIter(const TInt& aError,CContactIter* aIter, TInt aTransId ); + virtual void HandleReturnId(const TInt& aError, HBufC8* acntId, TInt aTransId ); + + virtual void HandleReturnArray( const TInt& aError, RPointerArray& idArray, TInt aTransId ); private: //Pointer to the MLiwNotifyCallback callback passed by consumer. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/src/contactinterface.cpp --- a/serviceproviders/sapi_contacts_vpbk/src/contactinterface.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/src/contactinterface.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -26,6 +26,11 @@ #include #include +#include +#include +#include +#include + // User Includes #include "contactservice.h" #include "contactinterface.h" @@ -205,6 +210,7 @@ case R_VPBK_FIELD_TYPE_EMAILGEN : case R_VPBK_FIELD_TYPE_EMAILWORK: case R_VPBK_FIELD_TYPE_EMAILHOME: + case R_VPBK_FIELD_TYPE_IMPP: { fieldmaxlength = KMaxLengthOneHundredAndFifty; break; @@ -218,6 +224,7 @@ } case R_VPBK_FIELD_TYPE_LOCPRIVACY: case R_VPBK_FIELD_TYPE_RINGTONE: + case R_VPBK_FIELD_TYPE_CALLEROBJIMG: { fieldmaxlength = KMaxLengthTwoHundredAndFiftySix; break; @@ -391,6 +398,8 @@ CSingleContact* aContact, CLiwGenericParamList& aOutParamList) { + TBool xspid = EFalse; + TBool xspidIsDes = EFalse; TBool atleastOneField = EFalse; iDburi = HBufC::NewL(VPbkContactStoreUris::DefaultCntDbUri().Length()); //set the DBUri to the default value. @@ -449,8 +458,8 @@ { //if the key is not uri and is not a contact id //search for the field - if(CSearchFields::GetIdFromFieldKey(fieldKey) == -1) - { + if(CSearchFields::GetIdFromFieldKey(fieldKey) != -1) + /* { TBuf<25> buff; buff.Copy(fieldKey); TBuf errmsg(KAddInvalidFieldKey); @@ -458,7 +467,9 @@ aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, TLiwVariant(errmsg))); User::Leave(KErrArgument); - } + } + else*/ + { aMap->FindL(fieldKey,fieldVal); if(EVariantTypeMap == fieldVal.TypeId()) { @@ -503,7 +514,50 @@ //Set contact item field value if(pMap->FindL(KFieldValue, valueVar)) { - if((fieldKey.Compare(KDate) == 0 || (fieldKey.Compare(KAnniversary) == 0))) + if(fieldKey.Compare(KXspid) == 0) + { + xspid = ETrue; + if(EVariantTypeList != valueVar.TypeId()) + { + if(EVariantTypeDesC == valueVar.TypeId()) + { + //xspidIsDes = ETrue; + CLiwList* xspidList = NULL; + xspidList = CLiwDefaultList::NewL(); + /* TPtrC val = valueVar.AsDes(); + + TBuf<1000> bufVal; + bufVal.Copy(val); + HBufC* xspidVal = bufVal.AllocLC();*/ + + xspidList->AppendL(valueVar); + valueVar.Reset(); + valueVar.Set(xspidList); + } + else + { + TPtr16 err(iErrorMess->Des()); + TBuf buf; + buf.Copy(valueVar.AsData()); + err.Append(KAddCnt); + err.Append(buf); + err.Append(KAddInvalidTime); + + aOutParamList.AppendL( TLiwGenericParam ( KErrorMessage,TLiwVariant(*iErrorMess) ) ); + CleanupStack::Pop(&nextVar); + nextVar.Reset(); + CleanupStack::Pop(&valueVar); + valueVar.Reset(); + CleanupStack::Pop(&labelVar); + labelVar.Reset(); + CleanupStack::Pop(&fieldVal); + fieldVal.Reset(); + err.Delete(0,iErrorMess->Length()); + User::Leave(KErrArgument); + } + } + } + if((fieldKey.Compare(KDate) == 0 || (fieldKey.Compare(KAnniversary) == 0))) // || (fieldKey.Compare(KBirthDay) == 0)) { if(EVariantTypeTTime != valueVar.TypeId()) { @@ -528,8 +582,7 @@ } date = ETrue; } - - if((EVariantTypeDesC != valueVar.TypeId()) && (date == EFalse)) + if((EVariantTypeDesC != valueVar.TypeId()) && (date == EFalse) && (xspid == EFalse)) { TPtr16 err(iErrorMess->Des()); TBuf buf; @@ -561,6 +614,34 @@ KNullDesC); field->SetDateTime(valueVar.AsTTime()); } + else if(xspid && !xspidIsDes) + { + RPointerArray xspidArray; + const CLiwList* xspidList = valueVar.AsList(); + TInt count = xspidList->Count(); + for(int i =0; i< count; i++) + { + TLiwVariant xspidVal; + if(xspidList->AtL(i,xspidVal)) + { + TPtrC ptrVal = xspidVal.AsDes(); + HBufC *pHeap1 = ptrVal.AllocLC(); + xspidArray.Append(pHeap1); + TInt len = pHeap1->Find(_L(":")); + if(len == -1) + { + aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, + TLiwVariant(KAddXspidInvalidFormat))); + User::Leave(KErrArgument); + } + CleanupStack::Pop(pHeap1); + } + } + field->SetXspidDataL(fieldKey, + labelVar.AsDes(), + xspidArray); + xspid = EFalse; + } else { field->SetFieldParamsL(fieldKey, @@ -622,6 +703,7 @@ User::Leave(KErrArgument); } + } } CleanupStack::Pop(&fieldVal); fieldVal.Reset(); @@ -637,8 +719,32 @@ contactfield = aContact->FieldAt(i); if(contactfield) { - contactfield->GetFieldDataL(fieldKey, fieldLabel, fieldValue); - if(!(fieldKey.Compare(KDate) == 0 || fieldKey.Compare(KAnniversary) == 0)) + contactfield->GetFieldDataL(fieldKey, fieldLabel, fieldValue); + if(fieldKey.Compare(KXspid) == 0) + { + RPointerArray xspidArr; + contactfield->GetXspidDataL(xspidArr); + for(TInt j=0;jLength() > GetFieldMaxLength(CSearchFields::GetIdFromFieldKey(fieldKey), *iDburi)) + { + TPtr16 err(iErrorMess->Des()); + TBuf fld; + fld.Copy(fieldKey); + err.Append(_L("Contacts : Add : Field Value too long for key : ")); + err.Append(fld); + + aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, + TLiwVariant(*iErrorMess))); + + err.Delete(0,iErrorMess->Length()); + User::Leave(KErrArgument); + } + } + } + else if(!(fieldKey.Compare(KDate) == 0 || fieldKey.Compare(KAnniversary) == 0)) { if(fieldValue.Length() > GetFieldMaxLength(CSearchFields::GetIdFromFieldKey(fieldKey), *iDburi)) { @@ -794,8 +900,19 @@ aOutParamList, aCallback, aCmdOptions, - transId); + transId, + EGetList); } + //Passing arguments for GetIds command + else if( aCmdName.CompareF( KCmdGetIds ) == 0 ) + { + GetListCommandL(aInParamList, + aOutParamList, + aCallback, + aCmdOptions, + transId, + EGetIds); + } else { //Leave with the error code @@ -823,7 +940,7 @@ CLiwGenericParamList& aOutParamList, MLiwNotifyCallback* aCallback, TUint aCmdOptions, - TInt aTransId) + TInt aTransId, TCmdType aVal) { const TLiwGenericParam* paramContentType = NULL; const TLiwGenericParam* paramGetListData = NULL; @@ -940,6 +1057,12 @@ switch(listType) { case EDatabase: + if(aVal == EGetIds) + { + aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, + TLiwVariant(KGetIdsInvalidContentType))); + User::Leave(KErrArgument); + } //In case it is GetList of dabases, the call is synchronous iter = CContactIter::NewL(); CleanupStack::PushL(iter); @@ -998,21 +1121,24 @@ KNullDesC, NULL, EAsc, - dbUri); + dbUri,aVal); CleanupStack :: Pop(contactCallback); CleanupStack::PopAndDestroy(cntid); } else { - //it is assumed that the call is synchronous + if(aVal == EGetList) + { + //it is assumed that the call is synchronous CContactIter* iter = iContactService->GetListL(listType, *cntid, KNullDesC, NULL, EAsc, - dbUri); + dbUri, + aVal); aOutParamList.AppendL(TLiwGenericParam( KErrorCode, TLiwVariant((TInt32)SErrNone))); //Setting the output param @@ -1022,6 +1148,13 @@ TLiwVariant(iterator))); CleanupStack::Pop(iterator); iterator->DecRef(); + } + else + { + aOutParamList.AppendL(TLiwGenericParam( KErrorCode, + TLiwVariant((TInt32)SErrBadArgumentType))); + aOutParamList.AppendL( TLiwGenericParam ( KErrorMessage,TLiwVariant(KGetIdsBadArgGrpId) ) ); + } CleanupStack::PopAndDestroy(cntid); CleanupStack::Pop(&groupId); groupId.Reset(); @@ -1047,20 +1180,24 @@ KNullDesC, NULL, EAsc, - dbUri); + dbUri, + aVal); CleanupStack :: Pop(contactCallback); } else { - //it is assumed that the call is synchronous + if(aVal == EGetList) + { + //it is assumed that the call is synchronous CContactIter* iter = iContactService->GetListL(listType, ptrToCntId, KNullDesC, NULL, EAsc, - dbUri); + dbUri, + aVal); //Setting the output param CContactIterator* iterator=CContactIterator::NewL(iter); CleanupStack::PushL(iterator); @@ -1068,6 +1205,52 @@ TLiwVariant(iterator) )); CleanupStack::Pop(iterator); iterator->DecRef(); + } + else + { + //call the GetIds() service api + RPointerArray& arrayid = + iContactService->GetIdsL(listType, + KNullDesC, + NULL, + EAsc, + dbUri, + aVal); + + + + + aOutParamList.AppendL(TLiwGenericParam( KErrorCode, + TLiwVariant((TInt32)SErrNone))); + //Setting the output param + if(arrayid.Count() > 0) + { + CLiwList* iList = NULL; + iList = CLiwDefaultList::NewL(); + TLiwVariant outputVal; + TInt count = arrayid.Count(); + TInt i; + for(i=0; iLength()); + CleanupStack :: PushL(cntIdUnicode); + cntIdUnicode->Des().Copy(*idVal); + CContactInterfaceCallback::ContactIDToUTF(cntIdUnicode); + outputVal.Set(*cntIdUnicode); + iList->AppendL(outputVal); + CleanupStack :: Pop(cntIdUnicode); + } + CLiwMap* pFieldLinkedMap = CLiwDefaultMap::NewL(); + CleanupClosePushL(*pFieldLinkedMap); + pFieldLinkedMap->InsertL(KIdsLabel,TLiwVariant(iList)); + + aOutParamList.AppendL(TLiwGenericParam(KReturnValue, + TLiwVariant(pFieldLinkedMap))); + CleanupStack::PopAndDestroy(pFieldLinkedMap); + arrayid.ResetAndDestroy(); + } + } CleanupStack::Pop(&groupId); groupId.Reset(); CleanupStack::Pop(&uriofDb); @@ -1106,28 +1289,31 @@ &aInParamList); //Call GetList in case of retrieval of a //single contact whose id is known - iContactService->GetListL(contactCallback, + iContactService->GetListL(contactCallback, aTransId, listType, *cntid, KNullDesC, NULL, EAsc, - dbUri); - + dbUri, + aVal); CleanupStack :: Pop(contactCallback); CleanupStack::PopAndDestroy(cntid); } else { //it is assumed that the call is synchronous - CContactIter* iter = + if(aVal == EGetList) + { + CContactIter* iter = iContactService->GetListL(listType, *cntid, KNullDesC, NULL, EAsc, - dbUri); + dbUri, + aVal); aOutParamList.AppendL(TLiwGenericParam( KErrorCode, TLiwVariant((TInt32)SErrNone))); //Setting the output param @@ -1137,6 +1323,14 @@ TLiwVariant(iterator))); CleanupStack::Pop(iterator); iterator->DecRef(); + } + else + { + aOutParamList.AppendL(TLiwGenericParam( KErrorCode, + TLiwVariant((TInt32)SErrBadArgumentType))); + aOutParamList.AppendL( TLiwGenericParam ( KErrorMessage, + TLiwVariant(KGetIdsBadArgCntId) ) ); + } CleanupStack::PopAndDestroy(cntid); CleanupStack::Pop(&contactId); contactId.Reset(); @@ -1241,20 +1435,24 @@ srchVal, searchFields, srtOrder, - dbUri); + dbUri, + aVal); CleanupStack :: Pop(contactCallback); } else { //it is assumed that the call is synchronous + if(aVal == EGetList) + { CContactIter* iter = iContactService->GetListL(listType, ptrToCntId, srchVal, searchFields, srtOrder, - dbUri); + dbUri, + aVal); aOutParamList.AppendL(TLiwGenericParam(KErrorCode, TLiwVariant((TInt32)SErrNone))); @@ -1265,7 +1463,49 @@ aOutParamList.AppendL(TLiwGenericParam(KReturnValue, TLiwVariant(iterator))); CleanupStack::Pop(iterator); - iterator->DecRef(); + iterator->DecRef(); + } + else + { + RPointerArray& arrayid = + iContactService->GetIdsL(listType, + srchVal, + searchFields, + srtOrder, + dbUri, + aVal); + aOutParamList.AppendL(TLiwGenericParam( KErrorCode, + TLiwVariant((TInt32)SErrNone))); + //Setting the output param + if(arrayid.Count() > 0) + { + CLiwList* iList = NULL; + iList = CLiwDefaultList::NewL(); + TLiwVariant outputVal; + TInt count = arrayid.Count(); + TInt i; + for(i=0; iLength()); + CleanupStack :: PushL(cntIdUnicode); + cntIdUnicode->Des().Copy(*idVal); + CContactInterfaceCallback::ContactIDToUTF(cntIdUnicode); + outputVal.Set(*cntIdUnicode); + iList->AppendL(outputVal); + CleanupStack :: Pop(cntIdUnicode); + } + CLiwMap* pFieldLinkedMap = CLiwDefaultMap::NewL(); + CleanupClosePushL(*pFieldLinkedMap); + pFieldLinkedMap->InsertL(KIdsLabel,TLiwVariant(iList)); + + aOutParamList.AppendL(TLiwGenericParam(KReturnValue, + TLiwVariant(pFieldLinkedMap))); + CleanupStack::PopAndDestroy(pFieldLinkedMap); + arrayid.ResetAndDestroy(); + } + + } CleanupStack::Pop(&order); order.Reset(); CleanupStack::Pop(&searchFieldKeys); @@ -1469,10 +1709,14 @@ else { //it is assumed that the call is synchronous - TRAPD(err,iContactService->AddL(contact, - KNullDesC8, //group id - KNullDesC, //group label - *iDburi)); + + HBufC8* cntIdVal = NULL; + TRAPD(err, cntIdVal = iContactService->AddL(contact, + KNullDesC8, //group id + KNullDesC, //group label + *iDburi)); + + if(err == KErrNotSupported) { TInt errkey = iContactService->GetErrKey(); @@ -1484,8 +1728,25 @@ aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, TLiwVariant(errmsg))); User::Leave(err); + } + + if(err == KErrNone) + { + HBufC* cntIdUnicode = HBufC::NewL(cntIdVal->Length()); + CleanupStack :: PushL(cntIdUnicode); + cntIdUnicode->Des().Copy(*cntIdVal); + delete cntIdVal; + cntIdVal = NULL; + CContactInterfaceCallback::ContactIDToUTF(cntIdUnicode); + aOutParamList.AppendL(TLiwGenericParam(KReturnValue,TLiwVariant(*cntIdUnicode))); + CleanupStack :: Pop(cntIdUnicode); } - } + else + { + User::Leave(err); + } + } + CleanupStack::Pop(contact); } //end of if pMap else @@ -1528,6 +1789,7 @@ } if(EFalse != pMap->FindL(KGroupId,valueGrpid)) { + TInt typeofgrpId = valueGrpid.TypeId(); TPtrC grpIdUnicode = valueGrpid.AsDes(); if(grpIdUnicode == NULL) { @@ -1549,6 +1811,8 @@ { if(EVariantTypeDesC != valueGrplabel.TypeId()) { + CleanupStack::Pop(&valueUri); + valueUri.Reset(); CleanupStack::Pop(&valueGrplabel); valueGrplabel.Reset(); CleanupStack::Pop(&valueGrpid); @@ -1601,7 +1865,8 @@ else { //it is assumed that the call is synchronous - TRAPD(err,iContactService->AddL(NULL, + HBufC8* grpId = NULL; + TRAPD(err,grpId = iContactService->AddL(NULL, *groupId, grpLabel, dbUri)); @@ -1616,7 +1881,27 @@ aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, TLiwVariant(errmsg))); User::Leave(err); - } + } + if(err == KErrNone) + { + if(grpId) + { + HBufC* grpIdUnicode = HBufC::NewL(grpId->Length()); + CleanupStack :: PushL(grpIdUnicode); + grpIdUnicode->Des().Copy(*grpId); + delete grpId; + grpId = NULL; + CContactInterfaceCallback::ContactIDToUTF(grpIdUnicode); + + aOutParamList.AppendL(TLiwGenericParam(KReturnValue,TLiwVariant(*grpIdUnicode))); + CleanupStack :: Pop(grpIdUnicode); + } + } + else + { + User::Leave(err); + } + } CleanupStack :: PopAndDestroy(groupId); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/src/contactinterfacecallback.cpp --- a/serviceproviders/sapi_contacts_vpbk/src/contactinterfacecallback.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/src/contactinterfacecallback.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -236,3 +236,120 @@ } CleanupStack::PopAndDestroy(this); } + +void CContactInterfaceCallback :: HandleReturnId(const TInt& aError,HBufC8* acntId , TInt aTransId ) + { + TInt err = 0; + CleanupStack::PushL(this); + if( iCallback ) + { + if( iEventParamList ) + { + iEventParamList->Reset(); + } + else + { + iEventParamList = CLiwGenericParamList::NewL(); + } + //Append Error Code + TInt32 sapiError = CContactInterface::SapiError(aError); + iEventParamList->AppendL(TLiwGenericParam( KErrorCode, + TLiwVariant((TInt32)sapiError))); + + if(acntId) + { + HBufC* cntIdUnicode = HBufC::NewL(acntId->Length()); + CleanupStack :: PushL(cntIdUnicode); + cntIdUnicode->Des().Copy(*acntId); + delete acntId; + acntId = NULL; + ContactIDToUTF(cntIdUnicode); + iEventParamList->AppendL(TLiwGenericParam(KReturnValue, + TLiwVariant(*cntIdUnicode))); + CleanupStack :: Pop(cntIdUnicode); + } + + //Call HandleNotify + TRAP(err,iCallback->HandleNotifyL(aTransId, + KLiwEventCompleted, + *iEventParamList, + *iInParamList)); + } + CleanupStack::PopAndDestroy(this); + } + + + +void CContactInterfaceCallback::HandleReturnArray(const TInt& aError, + RPointerArray& aArray, + TInt aTransId) + { + TInt err = 0; + CleanupStack::PushL(this); + if( iCallback ) + { + if( iEventParamList ) + { + iEventParamList->Reset(); + } + else + { + iEventParamList = CLiwGenericParamList::NewL(); + } + //Append Error Code + TInt32 sapiError = CContactInterface::SapiError(aError); + iEventParamList->AppendL(TLiwGenericParam( KErrorCode, + TLiwVariant((TInt32)sapiError))); + + if(aArray.Count() > 0) + { + CLiwList* IdList = NULL; + TLiwVariant outputVal; + TInt count = aArray.Count(); + TInt i; + IdList = CLiwDefaultList::NewL(); + for(i=0; iAllocL(); + HBufC* cntIdUnicode = HBufC::NewL(idBufVal->Length()); + CleanupStack :: PushL(cntIdUnicode); + cntIdUnicode->Des().Copy(*idBufVal); + delete idBufVal; + idBufVal = NULL; + ContactIDToUTF(cntIdUnicode); + outputVal.Set(*cntIdUnicode); + IdList->AppendL(outputVal); + CleanupStack :: Pop(cntIdUnicode); + } + CLiwMap* pFieldLinkedMap = CLiwDefaultMap::NewL(); + CleanupClosePushL(*pFieldLinkedMap); + pFieldLinkedMap->InsertL(KIdsLabel,TLiwVariant(IdList)); + + //Append Iterator in case it is valid + iEventParamList->AppendL(TLiwGenericParam(KReturnValue, + TLiwVariant(pFieldLinkedMap))); + CleanupStack::PopAndDestroy(pFieldLinkedMap); + + } + + //Call HandleNotify + TRAP(err,iCallback->HandleNotifyL(aTransId, + KLiwEventCompleted, + *iEventParamList, + *iInParamList)); + } + CleanupStack::PopAndDestroy(this); + } + + + +void CContactInterfaceCallback :: ContactIDToUTF(HBufC* aContactID) + { + TInt len = aContactID->Length(); + TUint16* ptr16 = const_cast (aContactID->Des().Ptr()); + for(TInt i=0; i xspidArray; + CLiwList* IdList = NULL; + TLiwVariant outputVal; //If iterator is iterating over contacts if(iContactIter->iIndicator == EContacts) { @@ -120,6 +122,7 @@ TPtrC fieldValue; TTime fieldTime; TBool date = EFalse; + TBool xspid = EFalse; CleanupStack :: PushL(contact); @@ -148,7 +151,29 @@ //Get field data and populate the map structure field->GetFieldDataL(fieldName, fieldLabel, fieldValue); - if((fieldName.Compare(KDate) == 0) || (fieldName.Compare(KAnniversary) == 0)) + if(fieldName.Compare(KXspid) == 0) + { + xspid = ETrue; + fieldLabel.Set(KXspidLabel); + field->GetUriFieldParamL(xspidArray); + if(xspidArray.Count() > 0) + { + + TInt count = xspidArray.Count(); + TInt i; + IdList = CLiwDefaultList::NewL(); + for(i=0; iAppendL(outputVal); + } + + } + xspidArray.ResetAndDestroy(); + + } + if((fieldName.Compare(KDate) == 0) || (fieldName.Compare(KAnniversary) == 0)) // || fieldName.Compare(KBirthDay) == 0) { date = ETrue; fieldTime = field->GetDateTime(); @@ -163,6 +188,12 @@ { pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldTime)); } + else if(xspid) + { + // CLiwMap* pFieldLinkedMap = CLiwDefaultMap::NewL(); + // CleanupClosePushL(*pFieldLinkedMap); + pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(IdList)); + } else { pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldValue)); @@ -178,6 +209,11 @@ date = EFalse; pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldTime)); } + else if(xspid) + { + xspid = EFalse; + pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(IdList)); + } else { pFieldLinkedMap->InsertL(KFieldValue,TLiwVariant(fieldValue)); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/group/bld.inf --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/group/bld.inf Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/group/bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -31,4 +31,6 @@ #include "../tprovidertest_vpbk/group/bld.inf" +#include "../tcontactsgetidsprovidertest/group/bld.inf" + // End of File \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/conf/tcontactprovidertest.cfg --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/conf/tcontactprovidertest.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/conf/tcontactprovidertest.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -223,3 +223,24 @@ foobar CancelDeleteContact delete foobar [Endtest] + +[Test] +title AddContactASyncTest +create tcontactprovidertest foobar +foobar AddContactASyncTest +delete foobar +[Endtest] + +[Test] +title AddGroupASyncTest +create tcontactprovidertest foobar +foobar AddGroupASyncTest +delete foobar +[Endtest] + +[Test] +title GetListNewFieldsTest +create tcontactprovidertest foobar +foobar GetListNewFieldsTest +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/inc/tcomplugin.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/inc/tcomplugin.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/inc/tcomplugin.h Thu Aug 27 07:43:07 2009 +0300 @@ -83,7 +83,10 @@ EVerifyOrganizeDelete, EModifyContact, EModifyContactComplete, - EModifyContactVerify + EModifyContactVerify, + EAddContactASyncTest, + EAddGroupASyncTest, + EGetListNewFieldsTest }; public: // Constructors and destructor @@ -391,11 +394,18 @@ virtual TInt CancelOrganiseAdd(CStifItemParser& /*aItem*/) ; virtual TInt CancelDeleteContact(CStifItemParser& /*aItem*/) ; virtual TInt CancelExportL(CStifItemParser& /*aItem*/) ; - virtual TInt CancelImportL(CStifItemParser& /*aItem*/) ; - + virtual TInt CancelImportL(CStifItemParser& /*aItem*/) ; + //virtual TInt AddContactSyncTestL(CStifItemParser& /*aItem*/) ; + virtual TInt AddContactASyncTestL(CStifItemParser& /*aItem*/) ; + virtual TInt AddGroupASyncTestL(CStifItemParser& /*aItem*/) ; + virtual TInt GetListNewFieldsTestL(CStifItemParser& /*aItem*/) ; + + + void AddOneContactL(const TDesC& aName); - void AddOneGroupL(const TDesC& aName); + void AddOneGroupL(const TDesC& aName); + TInt AddOneContactNewFieldsL(); public: // Data // ?one_line_short_description_of_data //?data_declaration; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/src/tcompluginblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/src/tcompluginblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest/src/tcompluginblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -189,6 +189,7 @@ _LIT8(KSyncClass, "SyncClass"); _LIT8(KLOCPrivacy, "LOCPrivacy"); _LIT8(KGenLabel, "GenLabel"); +_LIT8(KXSPID, "IMPP"); //---------------------------------------------------------------------------- @@ -254,7 +255,11 @@ ENTRY("CancelOrganiseAdd" , CTestProvider :: CancelOrganiseAdd), ENTRY("CancelDeleteContact" , CTestProvider :: CancelDeleteContact), ENTRY("CancelExport" , CTestProvider :: CancelExportL), - ENTRY("CancelImport" , CTestProvider :: CancelImportL) + ENTRY("CancelImport" , CTestProvider :: CancelImportL), + ENTRY("AddContactASyncTest" , CTestProvider :: AddContactASyncTestL), + ENTRY("AddGroupASyncTest" , CTestProvider :: AddGroupASyncTestL), + ENTRY("GetListNewFieldsTest" , CTestProvider :: GetListNewFieldsTestL) + }; @@ -641,7 +646,135 @@ { iResult = code; } - } + } + else if(iCase == EAddContactASyncTest || iCase == EAddGroupASyncTest) + { + if(aEventId == KLiwEventCompleted && code == KErrNone) + { + TInt pos = 0; + const TLiwGenericParam* param; + + param = aEventParamList.FindFirst( pos, KReturnValue ); + + TLiwVariant cntId = param->Value(); + + TPtrC idVal = cntId.AsDes(); + if(idVal.Compare(KNullDesC) != 0) + { + iResult = KErrNone; + } + else + { + iResult = KErrGeneral; + } + } + else + { + iResult = code; + } + } + else if(iCase == EGetListNewFieldsTest) + { + iResult = KErrNone; + if(aEventId == KLiwEventCompleted && code == KErrNone) + { + TInt pos = 0; + TBuf<255> firstName; + TBuf<255> secName; + TBuf<255> callerObjImg; + TBuf<255> Note; + TLiwVariant cntId; + TLiwVariant mapfield; + TLiwVariant firstname; + TLiwVariant secname; + TLiwVariant callerobjimg; + TLiwVariant xspidarr; + TLiwVariant note; + TLiwVariant entry; + const CLiwMap* map = NULL; + const CLiwMap* mapField = NULL; + const CLiwList* xspid = NULL; + + param = aEventParamList.FindFirst(pos, KReturnValue); + TLiwVariant iterator = param->Value(); + CLiwIterable* iter = iterator.AsIterable(); + if(iter->NextL(entry)) + { + map = entry.AsMap(); + TInt count1 = map->Count(); + map->FindL(KContactId, cntId); + TPtrC8 ptr = cntId.AsData(); + if(map->FindL(KFirstName,mapfield)) + mapField = mapfield.AsMap(); + + TInt count = mapField->Count(); + firstname.Reset(); + mapField->FindL(KFieldValue,firstname); + firstName = firstname.AsDes(); + if(firstName.CompareF(_L("Barbie")) != 0) + { + iResult = KErrGeneral; + return; + } + + if(map->FindL(KSecondName,mapfield)) + mapField = mapfield.AsMap(); + count = mapField->Count(); + mapField->FindL(KFieldValue,secname); + secName = secname.AsDes(); + if(secName.CompareF(_L("Doll")) != 0) + { + iResult = KErrGeneral; + return; + } + + if(map->FindL(KCallerObjImg,mapfield)) + mapField = mapfield.AsMap(); + count = mapField->Count(); + mapField->FindL(KFieldValue,callerobjimg); + callerObjImg = callerobjimg.AsDes(); + if(callerObjImg.CompareF(_L("C:\\data\\images\\pic.jpg")) != 0) + { + iResult = KErrGeneral; + return; + } + if(map->FindL(KNote,mapfield)) + mapField = mapfield.AsMap(); + count = mapField->Count(); + mapField->FindL(KFieldValue,note); + Note = note.AsDes(); + if(Note.CompareF(_L("Lead role in Barbie, the island princess")) != 0) + { + iResult = KErrGeneral; + return; + } + + if(map->FindL(KXSPID,mapfield)) + mapField = mapfield.AsMap(); + //count = mapField->Count(); + mapField->FindL(KFieldValue,xspidarr); + xspid = xspidarr.AsList(); + for(TInt index =0;indexCount(); index++) + { + TLiwVariant xspidVal; + if(xspid->AtL(index,xspidVal)) + { + TPtrC ptrVal = xspidVal.AsDes(); + if(ptrVal.CompareF(_L("Yahoo:Barbie@yahoo.co.in")) != 0 && ptrVal.CompareF(_L("Google:Barbie@gmail.com")) != 0) + { + iResult = KErrGeneral; + return; + } + } + } + + } + } + else + { + iResult = code; + } + } } void CTestProvider::LoadService() @@ -2401,10 +2534,275 @@ } + + +TInt CTestProvider :: AddContactASyncTestL(CStifItemParser& /*aItem */) + { + + iResult = KErrGeneral; + iCase = EAddContactASyncTest; + LoadService(); + + CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); + TInt pos = 0; + + pMap->InsertL(KContactId, TLiwVariant( _L(""))); + CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); + fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); + + fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); + + pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); + + CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); + fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); + + fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); + + pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); + + CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); + + fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); + + fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Lead role in Barbie, the island princess"))); + + pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); + + CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); + anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); + anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); + CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); + dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); + dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KDate, TLiwVariant(dateMap)); + + + CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); + fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); + + fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); + + pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); + + CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); + fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); + + fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); + + pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); + + CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); + CLiwList* list = CLiwDefaultList::NewL(); + list->AppendL(TLiwVariant(_L("Yahoo:barbie@yahoo.co.in"))); + list->AppendL(TLiwVariant(_L("Google:barbie@gmail.com"))); + fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); + + fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); + + pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); + const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; + + inList ->AppendL( paramContentType ); + inList ->AppendL( paramAddData ); + + iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + if(code == SErrNone) + { + CActiveScheduler::Start(); + } + pMap->DecRef(); + fieldMap->DecRef(); + fieldMap->DecRef(); + + inList->Reset(); + outList->Reset(); + + return iResult; + } + + +TInt CTestProvider :: AddGroupASyncTestL(CStifItemParser& /*aItem*/) + { + LoadService(); + CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); + iCase = EAddGroupASyncTest; + TInt pos = 0; + + pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb"))); + pMap->InsertL(KGroupId, TLiwVariant(_L8(""))); + pMap->InsertL(KGroupLabel, TLiwVariant(_L("TestAddGroup"))); + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group"))); + const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; + + inList ->AppendL( paramContentType ); + inList ->AppendL( paramAddData ); + iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, KLiwOptASyncronous, this); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + inList->Reset(); + outList->Reset(); + + if(code == SErrNone) + { + CActiveScheduler::Start(); + } + pMap->DecRef(); + return iResult; + } +TInt CTestProvider :: AddOneContactNewFieldsL() + { + //LoadService(); + + CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); + + TInt pos = 0; + pMap->InsertL(KContactId, TLiwVariant( _L(""))); + CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); + fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); + + fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); + + pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); + + CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); + fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); + + fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); + + pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); + + CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); + + fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); + + fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Lead role in Barbie, the island princess"))); + + pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); + +CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); + anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); + anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); + CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); + dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); + dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KDate, TLiwVariant(dateMap)); + + + + + CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); + fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); + + fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); + + pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); + + CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); + fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); + + fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); + + pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); + + CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); + CLiwList* list = CLiwDefaultList::NewL(); + list->AppendL(TLiwVariant(_L("Yahoo:barbie@yahoo.co.in"))); + list->AppendL(TLiwVariant(_L("Google:barbie@gmail.com"))); + fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); + + fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); + + pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); + const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; + + inList ->AppendL( paramContentType ); + inList ->AppendL( paramAddData ); + + iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + + pMap->DecRef(); + fieldMap->DecRef(); + fieldMap->DecRef(); + inList->Reset(); + outList->Reset(); + if(code == SErrNone) + { + return KErrNone; + } + return KErrGeneral; + } + + +TInt CTestProvider :: GetListNewFieldsTestL(CStifItemParser& /*aItem */) + { + LoadService(); + TInt addRes = AddOneContactNewFieldsL(); + if(addRes != KErrNone) + { + return KErrGeneral; + } + + _LIT8(KFilter, "Filter"); + _LIT8(KSearchVal, "SearchVal"); + iResult = KErrGeneral; + + TInt pos = 0; + iCase = EGetListNewFieldsTest; + + //const TLiwGenericParam paramGetListSortOrder; + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); + inList ->AppendL( paramContentType ); + + CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); + CleanupStack::PushL(map); + map->InsertL(KSearchVal,_L("Barbie")); + + const TLiwGenericParam paramData(KFilter, TLiwVariant(map)); + inList ->AppendL( paramData ); + + iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, KLiwOptASyncronous, this); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + if(code == SErrNone) + { + CActiveScheduler::Start(); + } + + CleanupStack::Pop(map); + map->DecRef(); + inList->Reset(); + outList->Reset(); + return iResult; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/conf/tcontactprovidertest_sync.cfg --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/conf/tcontactprovidertest_sync.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/conf/tcontactprovidertest_sync.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -93,3 +93,24 @@ foobar DeleteContact delete foobar [Endtest] + +[Test] +title GetListNewFieldsSyncTest +create tcontactprovidertest_sync foobar +foobar GetListNewFieldsTestSync +delete foobar +[Endtest] + +[Test] +title AddContactNewFieldsSyncTest +create tcontactprovidertest_sync foobar +foobar AddContactNewFieldsSynTest +delete foobar +[Endtest] + +[Test] +title AddGroupSyncTest +create tcontactprovidertest_sync foobar +foobar AddGroupSynTest +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/inc/tcomplugin.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/inc/tcomplugin.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/inc/tcomplugin.h Thu Aug 27 07:43:07 2009 +0300 @@ -401,6 +401,9 @@ // virtual TInt ModifyGroup(CStifItemParser& aItem); virtual TInt ExportVCard(CStifItemParser& /*aItem*/); virtual TInt ImportVCard(CStifItemParser& /*aItem*/); + virtual TInt GetListNewFieldsTestSync(CStifItemParser& /*aItem*/) ; + virtual TInt AddContactNewFieldsSynTest(CStifItemParser& /*aItem */); + virtual TInt AddGroupSynTest(CStifItemParser& /*aItem */); //virtual TInt GetLocationUpdateOpts(CStifItemParser& /*aItem*/) ; //virtual TInt MoveCoordinates(CStifItemParser& /*aItem*/) ; public: // Data @@ -416,6 +419,7 @@ // ?one_line_short_description_of_data //?data_declaration; TInt CTestGetLocation() ; + TInt AddOneContactNewFieldsL(); // Reserved pointer for future extension //TAny* iReserved; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/src/tcompluginblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/src/tcompluginblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactprovidertest_sync/src/tcompluginblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -188,6 +188,8 @@ _LIT8(KSyncClass, "SyncClass"); _LIT8(KLOCPrivacy, "LOCPrivacy"); _LIT8(KGenLabel, "GenLabel"); +_LIT8(KXSPID, "IMPP"); + //---------------------------------------------------------------------------- // CTestProvider :: Delete() //---------------------------------------------------------------------------- @@ -233,6 +235,11 @@ //ENTRY("ModifyGroup" , CTestProvider:: ModifyGroup), ENTRY("ExportVCard" , CTestProvider :: ExportVCard), ENTRY("ImportVCard" , CTestProvider :: ImportVCard), + ENTRY("GetListNewFieldsTestSync" , CTestProvider :: GetListNewFieldsTestSync), + ENTRY("AddContactNewFieldsSynTest" , CTestProvider :: AddContactNewFieldsSynTest), + ENTRY("AddGroupSynTest" , CTestProvider :: AddGroupSynTest), + + }; @@ -1470,3 +1477,410 @@ //__UHEAP_MARKEND; } + + + + TInt CTestProvider :: AddOneContactNewFieldsL() + { + CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); + + TInt pos = 0; + pMap->InsertL(KContactId, TLiwVariant( _L(""))); + CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); + fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); + + fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); + + pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); + + CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); + fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); + + fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); + + pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); + + CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); + + fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); + + fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Lead role in Barbie, the island princess"))); + + pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); + +CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); + anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); + anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); + + + CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); + dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); + dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KDate, TLiwVariant(dateMap)); + + + + CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); + fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); + + fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); + + pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); + + CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); + fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); + + fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); + + pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); + + CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); + CLiwList* list = CLiwDefaultList::NewL(); + list->AppendL(TLiwVariant(_L("Yahoo:barbie@yahoo.co.in"))); + list->AppendL(TLiwVariant(_L("Google:barbie@gmail.com"))); + fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); + + fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); + + pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); + const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; + + inList ->AppendL( paramContentType ); + inList ->AppendL( paramAddData ); + + iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + + pMap->DecRef(); + fieldMap->DecRef(); + fieldMap->DecRef(); + + inList->Reset(); + outList->Reset(); + if(code == SErrNone) + { + return KErrNone; + } + return KErrGeneral; + } + + + TInt CTestProvider :: GetListNewFieldsTestSync(CStifItemParser& /*aItem */) + { + LoadService(); + TInt addRes = AddOneContactNewFieldsL(); + if(addRes != KErrNone) + { + return KErrGeneral; + } + + _LIT8(KFilter, "Filter"); + _LIT8(KSearchVal, "SearchVal"); + TInt iResult = KErrNone; + TInt pos = 0; + + //const TLiwGenericParam paramGetListSortOrder; + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); + inList ->AppendL( paramContentType ); + + CLiwDefaultMap* map = CLiwDefaultMap :: NewL(); + CleanupStack::PushL(map); + map->InsertL(KSearchVal,_L("Barbie")); + + const TLiwGenericParam paramData(KFilter, TLiwVariant(map)); + inList ->AppendL( paramData ); + + iIface->ExecuteCmdL(KCmdGetList, *inList, *outList, 0, NULL); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + if(code == SErrNone) + { + TInt pos = 0; + TBuf<255> firstName; + TBuf<255> secName; + TBuf<255> callerObjImg; + TBuf<255> Note; + TLiwVariant cntId; + TLiwVariant mapfield; + TLiwVariant firstname; + TLiwVariant secname; + TLiwVariant callerobjimg; + TLiwVariant xspidarr; + TLiwVariant note; + TLiwVariant entry; + const CLiwMap* map = NULL; + const CLiwMap* mapField = NULL; + const CLiwList* xspid = NULL; + + param = outList->FindFirst(pos, KReturnValue); + TLiwVariant iterator = param->Value(); + CLiwIterable* iter = iterator.AsIterable(); + if(iter->NextL(entry)) + { + map = entry.AsMap(); + TInt count1 = map->Count(); + map->FindL(KContactId, cntId); + TPtrC8 ptr = cntId.AsData(); + if(map->FindL(KFirstName,mapfield)) + mapField = mapfield.AsMap(); + + TInt count = mapField->Count(); + firstname.Reset(); + mapField->FindL(KFieldValue,firstname); + firstName = firstname.AsDes(); + if(firstName.CompareF(_L("Barbie")) != 0) + { + iResult = KErrGeneral; + } + + if(map->FindL(KSecondName,mapfield)) + mapField = mapfield.AsMap(); + count = mapField->Count(); + mapField->FindL(KFieldValue,secname); + secName = secname.AsDes(); + if(secName.CompareF(_L("Doll")) != 0) + { + iResult = KErrGeneral; + } + + if(map->FindL(KCallerObjImg,mapfield)) + mapField = mapfield.AsMap(); + count = mapField->Count(); + mapField->FindL(KFieldValue,callerobjimg); + callerObjImg = callerobjimg.AsDes(); + if(callerObjImg.CompareF(_L("C:\\data\\images\\pic.jpg")) != 0) + { + iResult = KErrGeneral; + } + if(map->FindL(KNote,mapfield)) + mapField = mapfield.AsMap(); + count = mapField->Count(); + mapField->FindL(KFieldValue,note); + Note = note.AsDes(); + if(Note.CompareF(_L("Lead role in Barbie, the island princess")) != 0) + { + iResult = KErrGeneral; + } + + if(map->FindL(KXSPID,mapfield)) + mapField = mapfield.AsMap(); + //count = mapField->Count(); + mapField->FindL(KFieldValue,xspidarr); + xspid = xspidarr.AsList(); + TInt xspidcount = xspid->Count(); + for(TInt index =0;index < xspidcount; index++) + { + TLiwVariant xspidVal; + if(xspid->AtL(index,xspidVal)) + { + TPtrC ptrVal = xspidVal.AsDes(); + if(ptrVal.CompareF(_L("Yahoo:Barbie@yahoo.co.in")) != 0 && ptrVal.CompareF(_L("Google:Barbie@gmail.com")) != 0) + { + iResult = KErrGeneral; + break; + } + } + } + + } + } + + CleanupStack::Pop(map); + map->DecRef(); + inList->Reset(); + outList->Reset(); + return iResult; + } + + + + + TInt CTestProvider :: AddContactNewFieldsSynTest(CStifItemParser& /*aItem */) + { + LoadService(); + + CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); + + TInt pos = 0; + pMap->InsertL(KContactId, TLiwVariant( _L(""))); + CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL(); + fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname"))); + + fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Barbie"))); + + pMap->InsertL(KFirstName, TLiwVariant(fieldMap)); + + CLiwDefaultMap* fieldPrefixMap = CLiwDefaultMap::NewL(); + fieldPrefixMap->InsertL(KFieldLabel,TLiwVariant(_L("Prefix"))); + + fieldPrefixMap->InsertL(KFieldValue,TLiwVariant(_L("Princess"))); + + pMap->InsertL(KPrefix, TLiwVariant(fieldPrefixMap)); + + CLiwDefaultMap* fieldNoteMap = CLiwDefaultMap::NewL(); + + fieldNoteMap->InsertL(KFieldLabel,TLiwVariant(_L("Note"))); + + fieldNoteMap->InsertL(KFieldValue,TLiwVariant(_L("Sister of Princess Barbie"))); + + pMap->InsertL(KNote, TLiwVariant(fieldNoteMap)); + + +CLiwDefaultMap* anniMap = CLiwDefaultMap::NewL(); + anniMap->InsertL(KFieldLabel,TLiwVariant(_L("Anniversary"))); + anniMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KAnniversary, TLiwVariant(anniMap)); + + + CLiwDefaultMap* dateMap = CLiwDefaultMap::NewL(); + dateMap->InsertL(KFieldLabel,TLiwVariant(_L("Date"))); + dateMap->InsertL(KFieldValue,TLiwVariant(TTime(TDateTime(2007,EOctober,25,0,0,0,0)))); + pMap->InsertL(KDate, TLiwVariant(dateMap)); + + + CLiwDefaultMap* fieldSecNameMap = CLiwDefaultMap::NewL(); + fieldSecNameMap->InsertL(KFieldLabel,TLiwVariant(_L("SecondName"))); + + fieldSecNameMap->InsertL(KFieldValue,TLiwVariant(_L("Doll"))); + + pMap->InsertL(KSecondName, TLiwVariant(fieldSecNameMap)); + + CLiwDefaultMap* fieldPhotoMap = CLiwDefaultMap::NewL(); + fieldPhotoMap->InsertL(KFieldLabel,TLiwVariant(_L("CallerObjImg"))); + + fieldPhotoMap->InsertL(KFieldValue,TLiwVariant(_L("C:\\data\\images\\pic.jpg"))); + + pMap->InsertL(KCallerObjImg, TLiwVariant(fieldPhotoMap)); + + CLiwDefaultMap* fieldXspidMap = CLiwDefaultMap::NewL(); + CLiwList* list = CLiwDefaultList::NewL(); + list->AppendL(TLiwVariant(_L("Yahoo:kelly@yahoo.co.in"))); + list->AppendL(TLiwVariant(_L("Google:kelly@gmail.com"))); + fieldXspidMap->InsertL(KFieldLabel,TLiwVariant(_L("IMPP"))); + + fieldXspidMap->InsertL(KFieldValue,TLiwVariant(list)); + + pMap->InsertL(KXSPID, TLiwVariant(fieldXspidMap)); + + + + + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); + const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; + + inList ->AppendL( paramContentType ); + inList ->AppendL( paramAddData ); + + + iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + + + if(code == SErrNone) + { + pos =0; + param = outList->FindFirst( pos, KReturnValue ); + + TLiwVariant cntId = param->Value(); + + TPtrC idVal = cntId.AsDes(); + if(idVal.Compare(KNullDesC) != 0) + { + pMap->DecRef(); + fieldMap->DecRef(); + fieldMap->DecRef(); + + inList->Reset(); + outList->Reset(); + return KErrNone; + } + else + { + pMap->DecRef(); + fieldMap->DecRef(); + fieldMap->DecRef(); + + inList->Reset(); + outList->Reset(); + return KErrGeneral; + } + } + pMap->DecRef(); + fieldMap->DecRef(); + fieldMap->DecRef(); + + inList->Reset(); + outList->Reset(); + return KErrGeneral; + } + + + + + TInt CTestProvider :: AddGroupSynTest(CStifItemParser& /*aItem*/) + { + LoadService(); + CLiwDefaultMap* pMap = CLiwDefaultMap::NewL(); + TInt pos = 0; + + pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb"))); + pMap->InsertL(KGroupId, TLiwVariant(_L8(""))); + pMap->InsertL(KGroupLabel, TLiwVariant(_L("TestAddSyncGroup"))); + + const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Group"))); + const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ; + + inList ->AppendL( paramContentType ); + inList ->AppendL( paramAddData ); + iIface->ExecuteCmdL(KCmdAdd, *inList, *outList, 0, NULL); + + const TLiwGenericParam* param = outList->FindFirst( pos, KExitCode ); + TLiwVariant err = param->Value(); + TInt code = err.AsTInt32(); + + + if(code == SErrNone) + { + pos =0; + param = outList->FindFirst( pos, KReturnValue ); + + TLiwVariant cntId = param->Value(); + + TPtrC idVal = cntId.AsDes(); + if(idVal.Compare(KNullDesC) != 0) + { + + inList->Reset(); + outList->Reset(); + return KErrNone; + } + else + { + + inList->Reset(); + outList->Reset(); + return KErrGeneral; + } + } + + inList->Reset(); + outList->Reset(); + return KErrGeneral; + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/inc/tcontacts_async.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/inc/tcontacts_async.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/inc/tcontacts_async.h Thu Aug 27 07:43:07 2009 +0300 @@ -148,6 +148,8 @@ */ virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + virtual void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); /* * Called when creating a new contact or retrieving a contact is successful */ diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tadd_cancel.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tadd_cancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tadd_cancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -50,7 +50,8 @@ void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); private: CActiveSchedulerWait* iWaitSchedular; CContactService* iContactService; @@ -108,7 +109,10 @@ User::RequestComplete(temp, KErrNone); iWaitSchedular->Start(); } - +void CAddTestAsync::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } void CAddTestAsync::HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId) { //******************* set iResult **************************** @@ -129,7 +133,11 @@ } - + +void CAddTestAsync::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } TInt CAddTestAsync::Result() { return iResult; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tcontacts_async_blocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tcontacts_async_blocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tcontacts_async_blocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -110,8 +110,15 @@ return RunInternalL( KFunctions, count, aItem ); } +void CContactsUT::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } - +void CContactsUT::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } void CContactsUT::HandleReturnValue(TOperationEvent /*aEvent*/, const TInt& aError, TInt /*aTransId*/ ) { CActiveScheduler::Stop(); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tdelete_cancel.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tdelete_cancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tdelete_cancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -49,7 +49,8 @@ void HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId); void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); private: CActiveSchedulerWait* iWaitSchedular; @@ -153,7 +154,15 @@ delete singleContact; delete aIter; } +void CDeleteTestAsync::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } +void CDeleteTestAsync::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } TInt CDeleteTestAsync::Result() { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/texport_cancel.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/texport_cancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/texport_cancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -61,7 +61,9 @@ void HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId); void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); + private: CActiveSchedulerWait* iWaitSchedular; @@ -122,6 +124,10 @@ User::RequestComplete(temp, KErrNone); iWaitSchedular->Start(); } +void CExportTestAsync::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } void CExportTestAsync::HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId) { @@ -156,7 +162,10 @@ delete aIter; } - +void CExportTestAsync::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } TInt CExportTestAsync::Result() { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tgetlist_cancel.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tgetlist_cancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tgetlist_cancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -49,7 +49,9 @@ void HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId); void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); + private: CActiveSchedulerWait* iWaitSchedular; @@ -109,6 +111,13 @@ iWaitSchedular->Start(); } + +void CGetListTestAsync::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } + + void CGetListTestAsync::HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId) { //******************* set iResult **************************** @@ -129,7 +138,11 @@ } - + +void CGetListTestAsync::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } TInt CGetListTestAsync::Result() { return iResult; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tgetlistsrh_cancel.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tgetlistsrh_cancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/tgetlistsrh_cancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -50,7 +50,8 @@ void HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId); void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); private: CActiveSchedulerWait* iWaitSchedular; @@ -109,7 +110,15 @@ User::RequestComplete(temp, KErrNone); iWaitSchedular->Start(); } +void CGetListTestSrhAsync::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } +void CGetListTestSrhAsync::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } void CGetListTestSrhAsync::HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId) { //******************* set iResult **************************** diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/timport_cancel.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/timport_cancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/timport_cancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -50,7 +50,9 @@ void HandleReturnIter(const TInt& aError, CContactIter* aIter, TInt aTransId ); + void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); private: CActiveSchedulerWait* iWaitSchedular; CContactService* iContactService; @@ -107,6 +109,10 @@ User::RequestComplete(temp, KErrNone); iWaitSchedular->Start(); } +void CImportTestAsync::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } void CImportTestAsync::HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId) { @@ -127,7 +133,10 @@ iResult = KErrGeneral; } - +void CImportTestAsync::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } TInt CImportTestAsync::Result() { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/torganise_cancel.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/torganise_cancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_async/src/torganise_cancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -50,8 +50,9 @@ void HandleReturnValue(TOperationEvent aEvent, const TInt& aError , TInt aTransId); void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); + void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); - + void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); private: CActiveSchedulerWait* iWaitSchedular; CContactService* iContactService; @@ -181,7 +182,15 @@ } } +void CTestAsync::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } +void CTestAsync::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } TInt CTestAsync::Result() { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sim/inc/tcallback.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sim/inc/tcallback.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sim/inc/tcallback.h Thu Aug 27 07:43:07 2009 +0300 @@ -47,7 +47,9 @@ virtual void HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ); virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + + virtual void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); /** * Destructor. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sim/src/tcallback.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sim/src/tcallback.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sim/src/tcallback.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -55,7 +55,16 @@ } +void CContactCallBack::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } +void CContactCallBack::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } + void CContactCallBack::HandleReturnValue(TOperationEvent aEventId, const TInt& aError, TInt aTransId ) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sync/inc/tcontacts_sync.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sync/inc/tcontacts_sync.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sync/inc/tcontacts_sync.h Thu Aug 27 07:43:07 2009 +0300 @@ -132,6 +132,10 @@ */ virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + + virtual void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); + /* * Called when creating a new contact or retrieving a contact is successful */ diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sync/src/tcontacts_sync_blocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sync/src/tcontacts_sync_blocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontacts_sync/src/tcontacts_sync_blocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -95,7 +95,16 @@ return RunInternalL( KFunctions, count, aItem ); } +void CContactsUT::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } +void CContactsUT::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } + void CContactsUT::HandleReturnValue( TOperationEvent /*aEvent*/, const TInt& aError, TInt /*aTransId*/ ) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/bwins/tcontactsgetidsprovidertestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/bwins/tcontactsgetidsprovidertestu.def Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/conf/tcontactsgetidsprovidertest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/conf/tcontactsgetidsprovidertest.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,363 @@ +/* =========================================================================== + * Copyright © 2006-2007 Nokia Corporation. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia Corporation. All rights are reserved. Copying, + * including reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia Corporation. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia Corporation. + * ============================================================================ + + +NOTE: +1. NULL input means not passing any value for the placeholder +2. NULLVALUE means a NULL is passed as value to the placeholder +3. "NULL" as input to a parameter means a Null string or a string of value "NULL" is passed as input +4. All the fields in input is mandatory, if no value is to be passed for any field, a value NULL can be passed. And if NULL is to be passed as value, then + value "NULLVALUE" needs to be passed. +5. The key-value pair in Expected output can be in any order and all are optional. + + +//Testcase format: +//Description of the testcase +//Input: Input values +//Expected:(+ve/-ve case) Expected output or behaviour +[Test] +title Sample +create tcontactsgetidsprovidertest foobar +//foobar GetIdsL +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL NULL Ascending 0 +delete foobar +[Endtest] + +*/ + +############################################### Test cases starts ############################################### + +//Get the ids without passing any input +//Input: No input. Note here NULL value refers to nothing being passed +//Expected: errorcode 1003-MissingArgument error is expected as Type input is mandatory +[Test] +title GetIdsNoInput +create tcontactsgetidsprovidertest foobar +foobar GetIdsL NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetIds with type as the only input and Contact as value for Type +//Input: Contact as value for Type and no other values are passed +//Expected: zero as error code is expected +[Test] +title GetIdsValidTypeAlone1 +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetIds with valid input Group for type and type as the only input. This returns the list of ids of all groups +//Input: Group as value for Type and no other values are passed +//Expected: zero as error code is expected +[Test] +title GetIdsValidTypeAlone2 +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Group NULL NULL NULL 0 +delete foobar +[Endtest] + +//Getids with value Database which is valid for getLIst as input for Type +//Input: Database as value for Type and no other values are passed +//Expected: non-zero error code is expected +[Test] +title GetIdsDatabaseAsType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Database NULL NULL NULL 1002 //1004 +delete foobar +[Endtest] + +//getids with a valid string value like Dummy as value for Type +//Input: Dummy as value for Type and no other values are passed +//Expected: 1002 errorcode- BadArgumentType error is expected +[Test] +title GetIdsDummyType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Dummy NULL NULL NULL 1002 +delete foobar +[Endtest] + +//getids with a value of type other than string like an integer value 12 as value for type +//Input: 12 as value for Type and no other values are passed +//Expected: 1002 errorcode- BadArgumentType error is expected +[Test] +title GetIdsIntegerType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL 12 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//getids with a huge string with more than 255 characters as value for type +//Input: a huge string with more than 255 characters as value for Type and no other values are passed +//Expected: 1002 errorcode- BadArgumentType error is expected +[Test] +title GetIdsHugeStringAsType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz NULL NULL NULL 1002 +delete foobar +[Endtest] + +//getids with null asvalue for Type +//Input: NULLVALUE as value for Type and no other values are passed +//Expected: 1002 errorcode- MissingArgument error is expected +[Test] +title GetIdsNullType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL NULLVALUE NULL NULL NULL 1002 +delete foobar +[Endtest] + +//getids with a valid value cntdb://c:contacts.cdb as value for DBUri, with Type as Contact +//Expected: zero errorcode +[Test] +title GetIdsPhoneDBUri +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL NULL 0 +delete foobar +[Endtest] + +//getids with a valid value sim://global_adn as value for DBUri, with Type as Contact +//Expected: zero errorcode +[Test] +title GetIdsSimDBUri +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact sim:\/\/global_adn NULL NULL 0 +delete foobar +[Endtest] + +//getids with a valid value cntdb://c:contacts.cdb as value for DBUri, with Type as Group +//Expected: zero errorcode +[Test] +title GetIdsPhoneDBUriGrpType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Group cntdb:\/\/c:contacts.cdb NULL NULL 0 +delete foobar +[Endtest] + +//getids with a valid value sim://global_adn as value for DBUri, with Type as Group +//Expected: 1012-ServiceNotsupported as errorcode +[Test] +title GetIdsSimDBUriGrpType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Group sim:\/\/global_adn NULL NULL 1012 +delete foobar +[Endtest] + +//getids with a value cntda://c:contacts.cda as value for DBUri and Contact as value for Type +//Expected: 1014-BadArgumentType as errorcode +[Test] +title GetIdsInvalidDBUri +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntda:\/\/c:contacts.cda NULL NULL 1014 +delete foobar +[Endtest] + +//getids with an empty string as value for DBUri +//Expected: 1014-BadArgumentType as errorcode +[Test] +title GetIdsEmptyStringDBUri +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact "" NULL NULL 1014 +delete foobar +[Endtest] + +//getids with a null value for DBUri +//Expected: 0 as errorcode +[Test] +title GetIdsNullDBUri +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact NULLVALUE NULL NULL 0 +delete foobar +[Endtest] + +//getids with an integer value 12 for DBUri +//Expected: 1014-BadArgumentType as errorcode +[Test] +title GetIdsIntegerDBUri +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact 12 NULL NULL 1014 +delete foobar +[Endtest] + + +//getids with a huge string with more than 255 characters as value for DBUri +//Expected: 1002-BadArgumentType as errorcode +[Test] +title GetIdsHugeStringDBUri +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz NULL NULL 1002 +delete foobar +[Endtest] + +//getids with a valid string value for searchval and Type as Contact and cntdb://c:contacts.cdb as DBUri +//Expected: zero errorcode +[Test] +title GetIdsValidSrchVal +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb Arnold NULL 0 +delete foobar +[Endtest] + +//getids with a valid string value for searchval and Type as Group and cntdb://c:contacts.cdb as DBUri +//Expected: zero errorcode +[Test] +title GetIdsValidSrchValForGrpType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Group cntdb:\/\/c:contacts.cdb Group1 NULL 0 +delete foobar +[Endtest] + +//getids with a valid string value for searchval and Type as Contact and sim://global_adn as DBUri +//Expected: 1012 errorcode +[Test] +title GetIdsValidSrchValForSimDbCntType +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact sim:\/\/global_adn Bob NULL 1012 +delete foobar +[Endtest] + +//getids with a valid string value for SearchVal which does not result in any output. Give the search for the contact which does not exist +//Expected: 1012 errorcode +[Test] +title GetIdsValidNotExistSrchVal +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NotExists NULL 1012 +delete foobar +[Endtest] + +//getids with an integer value for searchval input +//Expected: 1012 errorcode +[Test] +title GetIdsIntegerSrchVal +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb 12 NULL 1012 +delete foobar +[Endtest] + +//getids with a null value for searchval input and other inputs having valid values +//Expected: 0 errorcode +[Test] +title GetIdsNullSrchVal +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULLVALUE NULL 0 +delete foobar +[Endtest] + +//getids with a long string with more than 255 characters as value for searchval input +//Expected: 1012 errorcode +[Test] +title GetIdsHugeStringSrchVal +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz NULL 1012 +delete foobar +[Endtest] + +//getids with an empty string as value for searchVal input +//Expected: 1012 errorcode +[Test] +title GetIdsEmptyStringSrchVal +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb "" NULL 1012 +delete foobar +[Endtest] + +//Get the ids of all contacts in the phone database in ascending order +//Input: Contact as Type, cntdb:\/\/c:contacts.cdb as DBUri and Ascending as sort order +//Expected: errorcode 0 is expected +[Test] +title GetIdsAllContactsInPhone +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL Ascending 0 +delete foobar +[Endtest] + +//get the ids of all contacts in phone database in descending order +//Input: Contact as Type, cntdb:\/\/c:contacts.cdb as DBUri and Descending as sort order +//Expected: errorcode 0 is expected +[Test] +title GetIdsDescOrderPhoneDB +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact cntdb:\/\/c:contacts.cdb NULL Descending 0 +delete foobar +[Endtest] + +//get the ids of all contacts in sim database in ascending order +//Input: Contact as Type, sim:\/\/global_adn as DBUri and Ascending as sort order +//Expected: errorcode 0 is expected +[Test] +title GetIdsAscOrderSimDB +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact sim:\/\/global_adn NULL Ascending 0 +delete foobar +[Endtest] + + +//get the ids of all contacts in sim database in descending order +//Input: Contact as Type, sim:\/\/global_adn as DBUri and Descending as sort order +//Expected: errorcode 0 is expected +[Test] +title GetIdsDescOrderSimDB +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact sim:\/\/global_adn NULL Descending 0 +delete foobar +[Endtest] + +//get the ids by passing a valid sort order and Type value as Group +//Input: Group as Type, nothing passed as DBUri and Descending as sort order +//Expected: errorcode 0 is expected +[Test] +title GetIdsDescOrderGrp +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Group NULL NULL Descending 0 +delete foobar +[Endtest] + +//get the ids by passing null as value for sort order +//Input: Contact as Type, nothing passed as DBUri and NULLVALUE as sort order +//Expected: errorcode 1002 is expected +[Test] +title GetIdsNullOrder +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact NULL NULL NULLVALUE 1002 +delete foobar +[Endtest] + +//get the ids of all contacts by passing an integer value 12 as value for sort order +//Input: Contact as Type, nothing passed as DBUri and 12 as sort order +//Expected: errorcode 1002 is expected +[Test] +title GetIdsIntegerOrder +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact NULL NULL 12 1002 +delete foobar +[Endtest] + +//get the ids of all contacts by passing a long string of more than 255 characters as value for sort order +//Input: Contact as Type, nothing passed as DBUri and string with more than 255 characters as sort order +//Expected: errorcode 1002 is expected +[Test] +title GetIdsHugeStringOrder +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact NULL NULL abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz 1002 +delete foobar +[Endtest] + +//get the ids by passing an empty string as value for sort order +//Input: Contact as Type, nothing passed as DBUri and empty string as sort order +//Expected: errorcode 1002 is expected +[Test] +title GetIdsEmptyStringOrder +create tcontactsgetidsprovidertest foobar +foobar GetIdsL Contact NULL NULL "" 1002 +delete foobar +[Endtest] +################################################################ End ############################################################ diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/eabi/tcontactsgetidsprovidertestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/eabi/tcontactsgetidsprovidertestu.def Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI28Ctcontactsgetidsprovidertest @ 2 NONAME ; ## + _ZTV28Ctcontactsgetidsprovidertest @ 3 NONAME ; ## + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/group/bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,23 @@ +/* +============================================================================ + Name : bld.inf + Author : reethu j + Copyright : Your copyright notice + Description : This file provides the information required for building the + whole of a tcontactsgetidsprovidertest. +============================================================================ +*/ + +PRJ_PLATFORMS +WINSCW ARMV5 + +PRJ_TESTEXPORTS +../conf/tcontactsgetidsprovidertest.cfg /epoc32/WINSCW/C/TestFramework/tcontactsgetidsprovidertest.cfg +PRJ_EXPORTS +//All files under this section are been moved to PRJ_TESTEXPORTS + + + +PRJ_TESTMMPFILES +tcontactsgetidsprovidertest.mmp +PRJ_MMPFILES diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/group/tcontactsgetidsprovidertest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/group/tcontactsgetidsprovidertest.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#include "../../../../../group/sapiincludes.mmpi" + +TARGET tcontactsgetidsprovidertest.dll +TARGETTYPE dll +UID 0x1000008d 0x0779BA00 + +CAPABILITY ALL -TCB + +DEFFILE tcontactsgetidsprovidertest.def + +SOURCEPATH ../src +SOURCE tcontactsgetidsprovidertest.cpp +SOURCE tcontactsgetidsprovidertestblocks.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../contactservice/inc + + +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY contactservice.lib +LIBRARY stiftestinterface.lib +LIBRARY vpbkeng.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY VPbkVCardEng.lib +LIBRARY stiftestengine.lib +LIBRARY liwServiceHandler.lib + +LANG SC + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/group/tcontactsgetidsprovidertest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/group/tcontactsgetidsprovidertest.pkg Thu Aug 27 07:43:07 2009 +0300 @@ -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 the License "Eclipse Public License v1.0" +; which accompanies 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 tcontactsgetidsprovidertest dll +; +; This is an auto-generated PKG file by Carbide. +; This file uses variables specific to Carbide builds that will not work +; on command-line builds. If you want to use this generated PKG file from the +; command-line tools you will need to modify the variables with the appropriate +; values: $(EPOCROOT), $(PLATFORM), $(TARGET) + +; +; UID is the dll's UID +; + + +;Languages +&EN + +;Header +#{"tcontactsgetidsprovidertest DLL"},(0x0779BA00),1,0,0 + +;Supports S60 3.0 +[0x101F7371], 0, 0, 0, {"S60ProductID"} + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;SAPI Binaries to Install + +;Contactservice binaries +;"..\..\..\..\..\..\..\epoc32\release\armv5\urel\contactservice.dll"-"C:\sys\bin\contactservice.dll" +"..\..\..\..\..\..\..\epoc32\release\armv5\urel\tcontactsgetidsprovidertest.dll"-"C:\sys\bin\tcontactsgetidsprovidertest.dll" + + + +;ini file +"..\init\Testframework.ini"-"c:\Testframework\Testframework.ini" + +"../conf/tcontactsgetidsprovidertest.cfg" - "!:/TestFramework/tcontactsgetidsprovidertest.cfg" + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/inc/tcontactsgetidsprovidertest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/inc/tcontactsgetidsprovidertest.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// This file defines the API for tcontactsgetidsprovidertest.dll + +#ifndef TCONTACTSGETIDSPROVIDERTEST_H +#define TCONTACTSGETIDSPROVIDERTEST_H + +// INCLUDES +#include +#include +#include +#include +#include + +#include +#include +#include + +#include // CBase +#include // TBuf + +// Constants +// Logging path +_LIT( KLogPath, "\\logs\\testframework\\" ); +// Log file +_LIT( KLogFile, "tcontactsgetidsprovidertest.txt" ); +_LIT( KLogFileWithTitle, "tcontactsgetidsprovidertest_[%S].txt" ); + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Class Definitions + +class Ctcontactsgetidsprovidertest : public CScriptBase, public MLiwNotifyCallback + { + public:// Constructors and destructor + enum TFileType + { + EContacts, + EGroups, + ENone + }; + /** + * Two-phased constructor. + */ + static Ctcontactsgetidsprovidertest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Ctcontactsgetidsprovidertest(); + + private: + + /** + * C++ default constructor. + */ + Ctcontactsgetidsprovidertest(CTestModuleIf& aTestModuleIf); + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + /** + * Frees all resources allocated from test methods. + */ + void Delete(); + /** + * loades the contacts service. + * @return MLiwInterface pointer. + */ + void LoadServiceL(); + /** + * Test methods are listed below. + */ + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt GetIdsL(CStifItemParser& aItem); + /** + * This method parses the input from cfg file and prepare the input list. + * @param aItem input list contaning input params from cfg file. + * @return Symbian OS error code. + */ + void ParseStiffInput(CStifItemParser& aItem); + /** + * This method parses the input from cfg file and prepare the Expected out put list. + * @param aItem input list contaning input params from cfg file. + * @return Symbian OS error code. + */ + void SetExpectedOutputMap(CStifItemParser& aItem); + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @param aItem Script line containing method name and parameters. + * @return Symbian OS error code. + */ + virtual TInt RunMethodL(CStifItemParser& aItem); + + /** + * From the MLiwNotifyCallback interface it is called by the contacts service. + * @param aCmdId Script line containing method name and parameters. + * @return Symbian OS error code. + */ + TInt HandleNotifyL(TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); + + private: // Data + //An array to hold the expected result maps. + RPointerArray iExpectedOutPutArray; + //the expected output error code + TInt iExpErrorCode; + //result of the test case. + TInt iResult; + //input parameter list + CLiwGenericParamList* iInList; + //output parameter list + CLiwGenericParamList* iOutList; + //service handler pointer + CLiwServiceHandler* iServicehandler; + //interface handle + MLiwInterface* iIface; + //file type + TFileType itype; + }; + +#endif // __TCONTACTSGETIDSPROVIDERTEST_H__ + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/inc/tcontactsgetidsprovidertest.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/inc/tcontactsgetidsprovidertest.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,95 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 TCONTACTSGETIDSPROVIDERTEST_HRH +#define TCONTACTSGETIDSPROVIDERTEST_HRH + +_LIT8(command8,"GetIds"); +_LIT8(KService, "Service.Contact"); +_LIT8(KIDataSource,"IDataSource"); + +_LIT(KContactType, "Contact"); +_LIT(KGroupType, "Group"); + +_LIT(KExpectedStart,"ExpectedStart"); +_LIT(KExpectedEnd,"ExpectedEnd"); + +_LIT8(KType, "Type"); +_LIT(KNullValue, "NULLVALUE"); + +_LIT8(KDBUri, "DBUri"); +_LIT8(KCntOrGrpId, "id"); +_LIT8(KSearchVal, "SearchVal"); +_LIT8(KSort,"Sort"); +_LIT8(KSortOrder,"Order"); + + + +_LIT8(KDsName,"Type");// used by interface class +_LIT8(KKey,"Key"); +_LIT8(KFileType,"FileType"); +_LIT8(KStartRange,"StartRange"); +_LIT8(KEndRange,"EndRange"); +_LIT8(KOrder,"Order"); + + + + + + +_LIT(KServiceOpen,"Service handle created"); +_LIT(KServiceClose,"Service handle deleted"); + + // Filter Map +_LIT8(KFilter,"Filter"); + +// Sorting Map + + +//Output Keys/arguments +_LIT8(KErrorCode,"ErrorCode"); +_LIT8(KResponse,"ReturnValue"); + +_LIT8(KTransactionID,"TransactionID"); + +//Keys for all the result maps. +_LIT8( KMgFileName, "FileName" ); +_LIT8( KMgFileExtension, "FileExtension" ); +_LIT8( KMgDrive, "Drive" ); +_LIT8( KMgFileSize, "FileSize" ); +_LIT8( KMgFileDate, "FileDate" ); +_LIT8( KMgMediaType, "MediaType" ); +_LIT8( KMgMimeType, "MimeType" ); +_LIT8( KMgFileNameAndPath, "FileNameAndPath"); + +//additional keys for music map. +_LIT8( KMgSongName, "SongName" ); +_LIT8( KMgArtist, "Artist" ); +_LIT8( KMgAlbum, "Album" ); +_LIT8( KMgTrackNumber, "TrackNumber" ); +_LIT8( KMgGenre, "Genre" ); +_LIT8( KMgComposer, "Composer" ); + +//additional keys for streamingURL map. +_LIT8( KMgLinkFirstURL, "LinkFirstURL" ); + + +_LIT( EMgPhoneMemory,"C:" ); +_LIT( EMgMmc,"E:" ); +_LIT( KMediaType, "Media"); + + +#endif //end of TMEDIAPROVIDERTESTING_HRH diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/inc/tcontactsgetidsprovidertest.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/inc/tcontactsgetidsprovidertest.pan Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,25 @@ +/* + ============================================================================ + Name : tcontactsgetidsprovidertest.pan + Author : reethu j + Copyright : Your copyright notice + Description : Panic codes + ============================================================================ + */ + +#ifndef __TCONTACTSGETIDSPROVIDERTEST_PAN__ +#define __TCONTACTSGETIDSPROVIDERTEST_PAN__ + +// Data Types + +enum TtcontactsgetidsprovidertestPanic + { + EtcontactsgetidsprovidertestNullPointer + }; + +// Function Prototypes + +GLREF_C void Panic(TtcontactsgetidsprovidertestPanic aPanic); + +#endif // __TCONTACTSGETIDSPROVIDERTEST_PAN__ + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/init/testframework.ini Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,171 @@ +# +# This is STIFTestFramework 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'. +# +# - 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. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: + # 'Summary', 'Environment', 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +[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= YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= NormalCases.txt +# TestCaseFile= SmokeCases.txt +# TestCaseFile= 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 +IniFile= c:\testframework\TestFramework.ini +#TestCaseFile= c:\testframework\tprovidertest_vpbk.cfg +#TestCaseFile= c:\testframework\tcontactprovidertest_sync.cfg +#TestCaseFile= c:\testframework\tcontacts_async.cfg +#TestCaseFile= c:\testframework\tcontacts_sim.cfg +#TestCaseFile= c:\testframework\tcontacts_sync.cfg +#TestCaseFile= c:\testframework\tcontactsprovider_sim.cfg +#TestCaseFile= c:\testframework\tcontact_import.cfg +#TestCaseFile= c:\testframework\tcontact_export.cfg +#TestCaseFile= c:\testframework\tcontact_getIds.cfg +TestCaseFile= c:\testframework\tcontactsgetidsprovidertest.cfg + +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework 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. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +#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 + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/src/tcontactsgetidsprovidertest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/src/tcontactsgetidsprovidertest.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,160 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// Include Files + +#include "tcontactsgetidsprovidertest.h" // Ctcontactsgetidsprovidertest +#include "tcontactsgetidsprovidertest.hrh" +#include +#include +// Member Functions + + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Ctmediaprovidertesting::Ctmediaprovidertesting +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Ctcontactsgetidsprovidertest::Ctcontactsgetidsprovidertest( + CTestModuleIf& aTestModuleIf ): + CScriptBase(aTestModuleIf), + iExpErrorCode(-1), + iResult(-2), + iInList(NULL), + iOutList(NULL), + iServicehandler(NULL), + iIface(NULL), + itype(ENone) + { + } + +// ----------------------------------------------------------------------------- +// Ctmediaprovidertesting::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Ctcontactsgetidsprovidertest::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(KLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KLogFile); + } + + iLog = CStifLogger::NewL( KLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Ctmediaprovidertesting::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Ctcontactsgetidsprovidertest* Ctcontactsgetidsprovidertest::NewL( + CTestModuleIf& aTestModuleIf ) + { + Ctcontactsgetidsprovidertest* self = new (ELeave) Ctcontactsgetidsprovidertest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Ctcontactsgetidsprovidertest::~Ctcontactsgetidsprovidertest() + { + + // Delete resources allocated from test methods + Delete(); + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Ctmediaprovidertesting::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Ctcontactsgetidsprovidertest::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("tcontactsgetidsprovidertest.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* ) Ctcontactsgetidsprovidertest::NewL( aTestModuleIf ); + } + + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/src/tcontactsgetidsprovidertestblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/src/tcontactsgetidsprovidertestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,374 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// Include Files + +#include // GLDEF_C +#include "tcontactsgetidsprovidertest.h" // panic codes +#include "tcontactsgetidsprovidertest.hrh" +#include +#include +#include +#include + + + + +using namespace LIW; + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// Ctcontactsgetidsprovidertest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Ctcontactsgetidsprovidertest::Delete() + { + TInt count = iExpectedOutPutArray.Count(); + for(TInt index =0 ;indexDecRef(); + } + iExpectedOutPutArray.Close(); + iIface->Close(); + delete iServicehandler; + delete iInList; + delete iOutList; + } + + +/* -------------------------------------------------------------------------- + Ctcontactsgetidsprovidertest :: LoadServiceL + Loads the mediamanagement service. +----------------------------------------------------------------------------- +*/ +void Ctcontactsgetidsprovidertest :: LoadServiceL() + { + TInt pos = 0; + iInList = CLiwGenericParamList::NewL(); + + iOutList = CLiwGenericParamList::NewL(); + + iServicehandler = CLiwServiceHandler::NewL(); + + CLiwCriteriaItem* criteria = CLiwCriteriaItem::NewL(1, + KIDataSource, + KService); + CleanupStack :: PushL(criteria); + + criteria->SetServiceClass(TUid::Uid(KLiwClassBase)); + RCriteriaArray critArray; + critArray.AppendL(criteria); + + iServicehandler->AttachL(critArray); + iServicehandler->ExecuteServiceCmdL(*criteria, + *iInList, + *iOutList); + + iOutList->FindFirst( pos, KIDataSource ); + if(pos != KErrNotFound) + { + iIface = (*iOutList)[pos].Value().AsInterface(); + } + else + { + User::Leave(KErrNotFound); + } + iInList->Reset(); + iOutList->Reset(); + CleanupStack :: PopAndDestroy(criteria); + critArray.Close(); + } + + +// ----------------------------------------------------------------------------- +// Ctcontactsgetidsprovidertest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Ctcontactsgetidsprovidertest::RunMethodL(CStifItemParser& aItem) + { + static TStifFunctionInfo const KFunctions[] = + { + ENTRY("GetIdsL", Ctcontactsgetidsprovidertest::GetIdsL) + }; + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + return RunInternalL( KFunctions, count, aItem ); + } + +// ----------------------------------------------------------------------------- +// Callback:: HandleNotifyL +// Call Back Function Called by the Contacts SAPI. +// ----------------------------------------------------------------------------- +// + TInt Ctcontactsgetidsprovidertest:: HandleNotifyL(TInt /*aCmdId*/, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& /*aInParamList*/) + { + TInt pos = 0; + TInt error = KErrGeneral; + iResult = KErrGeneral; + + TBuf<25> errorcodedes(KNullDesC); + const TLiwGenericParam* errorCode = NULL; + const TLiwGenericParam* resultList = NULL; + CLiwIterable* iterator = NULL; + + CActiveScheduler::Stop(); + + errorCode = aEventParamList.FindFirst(pos, KErrorCode); // Finding Error Code + resultList = aEventParamList.FindFirst(pos, KResponse); // Finding Iterator for the result list + + if(errorCode) + { + error = errorCode->Value().AsTInt32(); + errorcodedes.Num(error); + iLog->Log(_L("Error code:")); + iLog->Log(errorcodedes); + } + if(iExpErrorCode != error) + { + iLog->Log(_L("Expected Error code does not match")); + User::Leave(KErrGeneral); + } + iResult = KErrNone; + /* if(resultList) + { + // iterator = resultList->Value().AsIterable(); + // if(IsExpectedResult(iterator)) + // { + + // } + } + else + { + if(iExpectedOutPutArray.Count() != 0) + { + iLog->Log(_L("Result Iterator Not Found")); + User::Leave(KErrNotFound); + } + } */ + } + +/* -------------------------------------------------------------------------- + Ctmediaprovidertesting :: GetImageFilesL + Calls the Getlist of Media management SAPI. +----------------------------------------------------------------------------- +*/ +TInt Ctcontactsgetidsprovidertest::GetIdsL( CStifItemParser& aItem ) + { + TInt error = KErrGeneral; + TBuf<25> errcodedes(KNullDesC); + LoadServiceL(); + + ParseStiffInput(aItem); + + iIface->ExecuteCmdL(command8, + *iInList, + *iOutList, + KLiwOptASyncronous, + this); + TInt pos = 0; + const TLiwGenericParam* p = iOutList->FindFirst(pos, + KErrorCode); // Finding Error Code + if(p) + { + TInt retcode = p->Value().AsTInt32(); + errcodedes.Num(retcode); + iLog->Log(_L("return code:")); + iLog->Log(errcodedes); + if(KErrNone == retcode) + { + CActiveScheduler::Start(); + } + else + { + if(iExpErrorCode == retcode) + { + iResult = KErrNone; + } + else + { + User::Leave(KErrGeneral); + } + } + } + iInList->Reset(); + iOutList->Reset(); + iLog->Log(_L("")); + return iResult; + } + + +void Ctcontactsgetidsprovidertest::ParseStiffInput(CStifItemParser& aItem) + { + TBuf<25> errorCode(KNullDesC); + + TPtrC16 expectedStart(KNullDesC); + TPtrC16 type(KNullDesC); + TPtrC16 dburi(KNullDesC); + TPtrC16 srchval(KNullDesC); + TPtrC16 sortorder(KNullDesC); + + aItem.GetNextString(type); + aItem.GetNextString(dburi); + aItem.GetNextString(srchval); + aItem.GetNextString(sortorder); + + aItem.GetNextInt(iExpErrorCode); +// aItem.GetNextString(expectedStart); + + + /* if(type.CompareF(KContactType) == 0) + { + itype = EContacts; + } + else if(type.CompareF(KGroupType) == 0) + { + itype = EGroups; + } + //check for expected key + //if it is there then get the expected result and put it into the map. + if(expectedStart.CompareF(KExpectedStart) == 0) + { + SetExpectedOutputMap(aItem); + } */ + iLog->Log(_L("The Input Parameters are:")); + iLog->Log(type); + iLog->Log(dburi); + iLog->Log(srchval); + iLog->Log(sortorder); + + errorCode.Num(iExpErrorCode); + iLog->Log(_L("Expected Error code:")); + iLog->Log(errorCode); + + CLiwDefaultMap *sortMap = NULL; + + //set the content type to the fileinfo. + if(type.Compare(_L("NULL")) != 0) + { + if(type.Compare(_L("NULLVALUE")) == 0) type.Set(KNullDesC); + const TLiwGenericParam paramContentType(KType, TLiwVariant(type)); + iInList->AppendL(paramContentType); + } + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(filterMap); + + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + iInList->AppendL(filterParam); + filterMap->DecRef(); + + //Set the DBUri input if it is specified. + if(dburi.Compare(_L("NULL")) != 0) + { + if(dburi.Compare(_L("NULLVALUE")) == 0) dburi.Set(KNullDesC); + filterMap->InsertL(KDBUri,TLiwVariant(dburi)); + } + //Get the contact or group id if it is specified. + /* if(cntorgrpid.Compare(_L("NULL")) != 0) + { + if(cntorgrpid.Compare(_L("NULLVALUE")) == 0) cntorgrpid.Set(KNullDesC); + filterMap->InsertL(KCntOrGrpId,TLiwVariant(cntorgrpid)); + } */ + //Get the search valu input if it is specified. + if(srchval.Compare(_L("NULL")) != 0) + { + if(srchval.Compare(_L("NULLVALUE")) == 0) srchval.Set(KNullDesC); + filterMap->InsertL(KSearchVal,TLiwVariant(srchval)); + } + if(sortorder.Compare(_L("NULL")) != 0) + { + sortMap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(sortMap); + if(sortorder.Compare(_L("NULLVALUE"))== 0) sortorder.Set(KNullDesC); + sortMap->InsertL(KSortOrder,TLiwVariant(sortorder)); + TLiwGenericParam sortParam(KSort, TLiwVariant(sortMap)); + iInList->AppendL(sortParam); + sortMap->DecRef(); + } + //end of input params now look for expected params + if(sortMap) + { + CleanupStack::Pop(sortMap); + } + CleanupStack::Pop(filterMap); + } + + + +/* -------------------------------------------------------------------------- + Ctcontactsgetidsprovidertest :: SetExpectedImageOutputMap. + This method fills the expected output map. +----------------------------------------------------------------------------- +*/ +void Ctcontactsgetidsprovidertest :: SetExpectedOutputMap(CStifItemParser& aItem) + { + /* TPtrC16 nextString(KNullDesC); + + iLog->Log(_L("Inside SetExpectedOutputMap")); + + aItem.GetNextString(nextString); + /* + * The expected output is in the format. + * [ExpectredStart StartMap Key Value[...]EndMap[...]ExpectedEnd]. + */ + /* while(nextString.CompareF(KExpectedEnd)!=0) + { + if(nextString.CompareF(KMapStart) == 0) + { + CLiwDefaultMap* expectedOutPutMap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(expectedOutPutMap); + aItem.GetNextString(nextString); + + while(nextString.CompareF(KMapEnd)!= 0) + { + TPtrC key; + TPtrC value; + TBuf8<255> insertKey; + + key.Set(nextString); + insertKey.Copy(key); + + if(key.CompareF(_L("FileSize"))==0) + { + TInt fileSize = -1; + aItem.GetNextInt(fileSize); + expectedOutPutMap->InsertL(insertKey, (TInt32)fileSize); + } + else + { + aItem.GetNextString(nextString); + value.Set(nextString); + expectedOutPutMap->InsertL(insertKey, value); + } + aItem.GetNextString(nextString); + } + + iExpectedOutPutArray.Append(expectedOutPutMap); + CleanupStack::Pop(expectedOutPutMap); + } + aItem.GetNextString(nextString); + }*/ + } + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/group/bld.inf --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/group/bld.inf Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/group/bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -25,6 +25,7 @@ #include "../tContact_export/group/bld.inf" #include "../tContact_getlist/group/bld.inf" #include "../tContact_organise/group/bld.inf" +#include "../tcontact_getIds/group/bld.inf" // End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/conf/tcontact_add.cfg --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/conf/tcontact_add.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/conf/tcontact_add.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -93,3 +93,32 @@ foobar Add_Test13 0 delete foobar [Endtest] + + +[Test] +title AddNewFields +create tContact_add foobar +foobar Add_Test14 0 +delete foobar +[Endtest] + +[Test] +title AddNewFieldsSync +create tContact_add foobar +foobar Add_Test15 0 +delete foobar +[Endtest] + +[Test] +title AddGroupASync +create tContact_add foobar +foobar Add_Test16 0 +delete foobar +[Endtest] + +[Test] +title AddGroupSync +create tContact_add foobar +foobar Add_Test17 0 +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/inc/tcontact_add.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/inc/tcontact_add.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/inc/tcontact_add.h Thu Aug 27 07:43:07 2009 +0300 @@ -67,6 +67,10 @@ virtual void HandleReturnIter(const TInt& aError, CContactIter* aIter, TInt aTransId ); + virtual void HandleReturnId(const TInt& aError, HBufC8* acntId, TInt aTransId ); + virtual void HandleReturnArray(const TInt& aError, + RPointerArray& aArray, + TInt aTransId ); TInt iError; @@ -201,7 +205,12 @@ virtual TInt Add_Test10L( CStifItemParser& aItem ); virtual TInt Add_Test11L( CStifItemParser& aItem ); virtual TInt Add_Test12L( CStifItemParser& aItem ); - virtual TInt Add_Test13L( CStifItemParser& aItem ); + virtual TInt Add_Test13L( CStifItemParser& aItem ); + virtual TInt Add_Test14L( CStifItemParser& aItem ); + virtual TInt Add_Test15L( CStifItemParser& aItem ); + virtual TInt Add_Test16L( CStifItemParser& aItem ); + virtual TInt Add_Test17L( CStifItemParser& aItem ); + //ADD NEW METHOD DEC HERE diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/src/tcontact_add.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/src/tcontact_add.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/src/tcontact_add.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -98,9 +98,9 @@ CStifLogger::EFile, EFalse ); - icontactservice=CContactService::NewL(); + //icontactservice=CContactService::NewL(); - icallback=new(ELeave) CContactCallback; + // icallback=new(ELeave) CContactCallback; } @@ -128,8 +128,8 @@ // Delete resources allocated from test methods Delete(); - delete icallback; - delete icontactservice; + // delete icallback; +// delete icontactservice; // Delete logger delete iLog; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/src/tcontact_addblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/src/tcontact_addblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_add/src/tcontact_addblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -72,13 +72,17 @@ ?code } */ - +TInt cmdNum = 0; TInt Iterator_cnt=0; //HBufC8 *contactid ; HBufC8* contactid=NULL; CSingleContact* myContact=NULL; - +void CContactCallback::HandleReturnArray( const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + iError= aError ; + } void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) @@ -95,22 +99,111 @@ CActiveScheduler::Stop(); - CSingleContactField* field = NULL; - HBufC8* buf = NULL; - TBuf8<100> buf1; - TBuf<100> buf2; - TBuf<100> buf3; - TInt count=0 ; - - + + if(cmdNum == 10) + { + aIter->NextL(myContact,contactid); + delete aIter; + if(contactid) + { + delete contactid; + } +return; + } if(aError==KErrNone) { aIter->NextL(myContact,contactid); + if(contactid) + { + delete contactid; + } + if(myContact) + { + delete myContact; + } } delete aIter; return; } + + void CContactCallback:: HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + + /*RFs fs; + RFile file; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + TInt errfile =file.Replace(fs,_L("C:\\iter.txt"), EFileWrite | EFileStreamText); + file.Write(_L8("\n Starting logs")); + file.Flush(); */ + CActiveScheduler::Stop(); + //HBufC8* cntId = acntId; + iError = aError; + if(acntId == NULL) + { + /*file.Write(_L8("\n cntid is nul")); + file.Flush(); */ + iError = KErrGeneral; + return; + } + if(cmdNum == 14) + { + CContactService* cntservice=CContactService::NewL(); + _LIT8(KField,"FirstName"); + _LIT(KLabel,"FirstName"); + _LIT(KValue,"Barbie"); + TPtrC8 fieldKey(KNullDesC8); + TPtrC label(KNullDesC); + TPtrC value(KNullDesC); + //CContactCallback* callbk=new(ELeave) CContactCallback; + TPtr8 cntIdPtrVal(acntId->Des()); + CContactIter* iterVal; + TRAPD(err, iterVal = cntservice->GetListL(EContacts,cntIdPtrVal)); + if(err != KErrNone) + { + /*file.Write(_L8("\n err code of getlist is non zero")); + file.Flush(); */ + iError = KErrGeneral; + return; + } + iterVal->NextL(myContact,contactid); + if(myContact) + { + for(TInt i=0;iFieldCount(); i++) + { + CSingleContactField* field = myContact->FieldAt(i); + field->GetFieldDataL(fieldKey,label,value); + if(value.Compare(KValue) == 0) + { + iError = KErrNone; + break; + } + } + } + else + { + /*file.Write(_L8("\n no contact is got")); + file.Flush(); */ + iError = KErrGeneral; + } + delete cntservice; + delete iterVal; + if(myContact) + { + delete myContact; + } + if(contactid) + { + delete contactid; + } +} + /*file.Write(_L8("\n return")); + file.Flush(); + + file.Close();*/ + delete acntId; + } // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -151,6 +244,11 @@ ENTRY( "Add_Test11", Ctdeleteadd::Add_Test11L ), ENTRY( "Add_Test12", Ctdeleteadd::Add_Test12L ), ENTRY( "Add_Test13", Ctdeleteadd::Add_Test13L ), + ENTRY( "Add_Test14", Ctdeleteadd::Add_Test14L ), + ENTRY( "Add_Test15", Ctdeleteadd::Add_Test15L ), + ENTRY( "Add_Test16", Ctdeleteadd::Add_Test16L ), + ENTRY( "Add_Test17", Ctdeleteadd::Add_Test17L ), + }; @@ -167,7 +265,9 @@ TInt Ctdeleteadd::Add_Test1L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; TInt count =KErrGeneral ; _LIT8(KFirstName,"FirstName"); _LIT(KName,"Aaaa"); @@ -175,7 +275,9 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); CSingleContactField* singleContactField = CSingleContactField::NewL(); + CleanupStack::PushL(singleContactField); singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); @@ -190,18 +292,31 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; - - } /* Adding contact with invalid fieldname */ TInt Ctdeleteadd::Add_Test2L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; TInt count =KErrGeneral ; _LIT8(KFirstName,"FrstName"); _LIT(KName,"Aaaa"); @@ -209,7 +324,9 @@ /* create contactitem with invalid fieldname "FrstName */ CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); CSingleContactField* singleContactField = CSingleContactField::NewL(); + CleanupStack::PushL(singleContactField); singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); @@ -223,8 +340,21 @@ /* check whether Add api returns the expected error code */ if(-1 == icallback->iError ) + { + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; } @@ -232,8 +362,9 @@ /* adding contact with more fields */ TInt Ctdeleteadd::Add_Test3L( CStifItemParser& aItem ) { - - + + icallback=new(ELeave) CContactCallback; + CSingleContact* singleContact = CSingleContact::NewL(); TInt count =KErrGeneral ; _LIT8(KFirstName,"FirstName"); _LIT(KFName,"XYZ"); @@ -260,19 +391,28 @@ //instantiate service class object /* create contactitem to add */ CSingleContactField* FName = CSingleContactField::NewL(); + //CleanupStack::PushL(FName); CSingleContactField* LName = CSingleContactField::NewL(); + //CleanupStack::PushL(LName); CSingleContactField* Pfix = CSingleContactField::NewL(); + //CleanupStack::PushL(Pfix); CSingleContactField* Sfix = CSingleContactField::NewL(); + //CleanupStack::PushL(Sfix); CSingleContactField* Landno = CSingleContactField::NewL(); + //CleanupStack::PushL(Landno); CSingleContactField* Mobno = CSingleContactField::NewL(); + //CleanupStack::PushL(Mobno); CSingleContactField* Faxno = CSingleContactField::NewL(); + //CleanupStack::PushL(Faxno); CSingleContactField* Note = CSingleContactField::NewL(); + //CleanupStack::PushL(Note); CSingleContactField* Job = CSingleContactField::NewL(); + //CleanupStack::PushL(Job); CSingleContactField* Mail = CSingleContactField::NewL(); + //CleanupStack::PushL(Mail); CSingleContactField* Ring = CSingleContactField::NewL(); - - CSingleContact* singleContact = CSingleContact::NewL(); - + //CleanupStack::PushL(Ring); + FName->SetFieldParamsL(KFirstName,KNullDesC,KFName); singleContact->AddFieldToContactL(FName); @@ -309,11 +449,22 @@ aItem.GetNextInt(count) ; - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + CSingleContact* singleContact1 = CSingleContact::NewL(); + CleanupStack::PushL(singleContact1); + CSingleContactField* FName1 = CSingleContactField::NewL(); + CleanupStack::PushL(FName1); + FName1->SetFieldParamsL(KFirstName,KNullDesC,KFName); + singleContact1->AddFieldToContactL(FName1); /* Add the contactitem */ icontactservice->AddL(icallback,0,singleContact); CActiveScheduler::Start(); - + CleanupStack::Pop(FName1); + CleanupStack::Pop(singleContact1); + delete singleContact1; + delete icontactservice; + TPtrC String; // TPtrC db1(_L("cntdb://c:testcontacts2.cdb")); @@ -323,10 +474,29 @@ { _LIT(Kerr ,"Failed to read input file name") ; iLog->Log(Kerr) ; + +//CleanupStack::Pop(11); +//CleanupStack::Pop(singleContact); +//delete singleContact; +//delete singleContact; +/*delete FName; + delete LName; + delete Pfix; + delete Sfix; + delete Landno; + delete Mobno; + delete Faxno; + delete Note; + delete Job; + delete Mail; + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND;*/ return KErrGeneral ; } - TBuf<256> string1; + /* TBuf<256> string1; string1.Copy(String); icontactservice->GetListL(icallback,1,EContacts,KNullDesC8) ; @@ -336,13 +506,18 @@ icontactservice->ExportVCardL(icallback,2,string1,*contactid); CActiveScheduler::Start(); - + */ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { + delete icallback; + __UHEAP_MARKEND; return KErrNone ; - - return KErrGeneral ; + } + delete icallback; + __UHEAP_MARKEND; + return KErrGeneral ; } @@ -351,7 +526,9 @@ /* Adding a group */ TInt Ctdeleteadd::Add_Test4L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); _LIT( KExample, "In GetList_Test1L" ); @@ -373,8 +550,15 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; } @@ -385,7 +569,9 @@ /* Adding the same group name twice */ TInt Ctdeleteadd::Add_Test5L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); _LIT( KExample, "In GetList_Test1L" ); @@ -411,8 +597,15 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) - return KErrNone ; - + { + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; + return KErrNone ; + } + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; } @@ -421,7 +614,9 @@ TInt Ctdeleteadd::Add_Test6L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; TInt count =KErrGeneral ; _LIT8(KFirstName,"FirstName"); _LIT(KName,"Aaaa"); @@ -429,7 +624,9 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); CSingleContactField* singleContactField = CSingleContactField::NewL(); + CleanupStack::PushL(singleContactField); singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); @@ -447,8 +644,21 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; @@ -457,7 +667,9 @@ // same contact twice to different database TInt Ctdeleteadd::Add_Test7L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; _LIT(KCntDbUri, "cntdb://c:contacts.cdb"); TInt count =KErrGeneral ; _LIT8(KFirstName,"FirstName"); @@ -466,7 +678,9 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); CSingleContactField* singleContactField = CSingleContactField::NewL(); + CleanupStack::PushL(singleContactField); singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); @@ -484,8 +698,22 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } + + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; @@ -495,8 +723,9 @@ TInt Ctdeleteadd::Add_Test8L( CStifItemParser& aItem ) { - - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; TInt count =KErrGeneral ; _LIT8(KLandline,"LandPhoneHome"); @@ -510,8 +739,11 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); +CleanupStack::PushL(singleContact); CSingleContactField* singleContactField1 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField1); CSingleContactField* singleContactField2 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField2); singleContactField1->SetFieldParamsL(KLandline,Land1,KLandno1); singleContactField2->SetFieldParamsL(KLandline,Land2,KLandno2); @@ -519,12 +751,14 @@ singleContact->AddFieldToContactL(singleContactField2); CSingleContactField* singleContactField3 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField3); CSingleContactField* singleContactField4 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField4); singleContactField3->SetFieldParamsL(KLandline,Land1,KLandno1); singleContactField4->SetFieldParamsL(KLandline,Land2,KLandno2); - singleContact->AddFieldToContactL(singleContactField1); - singleContact->AddFieldToContactL(singleContactField2); + singleContact->AddFieldToContactL(singleContactField3); + singleContact->AddFieldToContactL(singleContactField4); aItem.GetNextInt(count) ; /* Add the contactitem */ @@ -533,8 +767,23 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { + + CleanupStack::Pop(4); + CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } + + CleanupStack::Pop(4); + CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; @@ -578,7 +827,10 @@ /* Adding single contact to default database using contactid*/ TInt Ctdeleteadd::Add_Test10L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + cmdNum =10; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; _LIT(KCntDbUri, "cntdb://c:contacts.cdb"); _LIT(KCntDbUri1, "cntdb://c:singlecontacts.cdb"); TInt count =KErrGeneral ; @@ -588,7 +840,9 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); CSingleContactField* singleContactField = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField); singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); @@ -605,7 +859,7 @@ TBuf8<15> fstname(_L8("FirstName")); CSearchFields *srchfield =CSearchFields :: NewL(icontactservice); - + //CleanupStack::PushL(srchfield); srchfield->AppendL(fstname); iLog->Log(_L("Calling GetList")); @@ -632,18 +886,46 @@ if(err1!=0 ) { iLog->Log(_L("Error returned while calling add")); +//CleanupStack::Pop(srchfield); +CleanupStack::Pop(singleContactField); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + delete myContact; + //delete srchfield; + __UHEAP_MARKEND; return KErrNone ; } - iLog->Log(_L("Starting Schudular")); + iLog->Log(_L("Starting Scheuduler")); CActiveScheduler::Start(); iLog->Log(_L("Error %d\n"),icallback->iError); iLog->Log(_L("Add successful")); if(count == icallback->iError ) + { +//CleanupStack::Pop(srchfield); +CleanupStack::Pop(singleContactField); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + delete myContact; + //delete srchfield; + __UHEAP_MARKEND; return KErrNone ; - + } +//CleanupStack::Pop(srchfield); +CleanupStack::Pop(singleContactField); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + delete myContact; + //delete srchfield; + __UHEAP_MARKEND; return KErrGeneral ; @@ -652,7 +934,9 @@ /* Adding a group and contact together*/ TInt Ctdeleteadd::Add_Test11L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); _LIT( KExample, "In GetList_Test1L" ); @@ -672,7 +956,9 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); +CleanupStack::PushL(singleContact); CSingleContactField* singleContactField = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField); singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); @@ -684,13 +970,34 @@ TInt err1; TRAPD(err,icontactservice->AddL(icallback,0,singleContact,KNullDesC8,KGroup)); if(err || err1) + { +CleanupStack::Pop(singleContactField); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone; + } CActiveScheduler::Start(); /* check whether add api returns the expected error code */ if(count == icallback->iError ) - return KErrNone ; - + { +CleanupStack::Pop(singleContactField); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; + return KErrNone ; + } +CleanupStack::Pop(singleContactField); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; } @@ -700,8 +1007,9 @@ TInt Ctdeleteadd::Add_Test12L( CStifItemParser& aItem ) { - - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; TInt count =KErrGeneral ; _LIT(KCntDbUri, "cntdb://c:contacts.cdb"); _LIT8(KLandline,"LandPhoneHome"); @@ -715,8 +1023,11 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); +CleanupStack::PushL(singleContact); CSingleContactField* singleContactField1 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField1); CSingleContactField* singleContactField2 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField2); singleContactField1->SetFieldParamsL(KLandline,Land1,KLandno1); singleContactField2->SetFieldParamsL(KLandline,Land2,KLandno2); @@ -724,12 +1035,14 @@ singleContact->AddFieldToContactL(singleContactField2); CSingleContactField* singleContactField3 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField3); CSingleContactField* singleContactField4 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField4); singleContactField3->SetFieldParamsL(KLandline,Land1,KLandno1); singleContactField4->SetFieldParamsL(KLandline,Land2,KLandno2); - singleContact->AddFieldToContactL(singleContactField1); - singleContact->AddFieldToContactL(singleContactField2); + singleContact->AddFieldToContactL(singleContactField3); + singleContact->AddFieldToContactL(singleContactField4); aItem.GetNextInt(count) ; /* Add the contactitem */ @@ -738,8 +1051,27 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { +CleanupStack::Pop(singleContactField4); +CleanupStack::Pop(singleContactField3); +CleanupStack::Pop(singleContactField2); +CleanupStack::Pop(singleContactField1); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } +CleanupStack::Pop(singleContactField4); +CleanupStack::Pop(singleContactField3); +CleanupStack::Pop(singleContactField2); +CleanupStack::Pop(singleContactField1); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; @@ -751,7 +1083,9 @@ TInt Ctdeleteadd::Add_Test13L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; TInt count =KErrGeneral ; _LIT(KCntDbUri, "cntdb://c:contacts.cdb"); _LIT8(KLandline,"LandPhoneHome"); @@ -765,8 +1099,11 @@ /* create contactitem to add */ CSingleContact* singleContact = CSingleContact::NewL(); +CleanupStack::PushL(singleContact); CSingleContactField* singleContactField1 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField1); CSingleContactField* singleContactField2 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField2); singleContactField1->SetFieldParamsL(KLandline,Land1,KLandno1); singleContactField2->SetFieldParamsL(KLandline,Land1,KLandno2); @@ -774,7 +1111,9 @@ singleContact->AddFieldToContactL(singleContactField2); CSingleContactField* singleContactField3 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField3); CSingleContactField* singleContactField4 = CSingleContactField::NewL(); +CleanupStack::PushL(singleContactField4); singleContactField3->SetFieldParamsL(KLandline,Land1,KLandno1); singleContactField4->SetFieldParamsL(KLandline,Land1,KLandno2); @@ -788,13 +1127,344 @@ /* check whether add api returns the expected error code */ if(count == icallback->iError ) + { +CleanupStack::Pop(singleContactField4); +CleanupStack::Pop(singleContactField3); +CleanupStack::Pop(singleContactField2); +CleanupStack::Pop(singleContactField1); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; - + } +CleanupStack::Pop(singleContactField4); +CleanupStack::Pop(singleContactField3); +CleanupStack::Pop(singleContactField2); +CleanupStack::Pop(singleContactField1); +CleanupStack::Pop(singleContact); +delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral ; } +TInt Ctdeleteadd::Add_Test14L(CStifItemParser& aItem ) + { + + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + TInt count =KErrGeneral ; + _LIT8(KFirstName,"FirstName"); + _LIT(KName,"Aaaa"); + //instantiate service class object + _LIT8(KPrefix,"Prefix"); + _LIT(KPfix,"Princess"); + _LIT8(KNote,"Note"); + _LIT(KNoteVal,"Lead role in Barbie, the island princess"); +_LIT8(KAnniversary,"Anniversary"); + _LIT8(KBday,"Date"); + _LIT8(KNickName,"SecondName"); + _LIT(KNickNameVal,"Doll"); + _LIT8(KPhoto,"CallerObjImg"); + _LIT(KPhotoVal,"C:\\data\\images\\pic.jpg"); + _LIT8(KImpp,"IMPP"); + _LIT(KImppLabel,"IMPP"); + + /* create contactitem to add */ + CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); + CSingleContactField* singleContactField = CSingleContactField::NewL(); + CleanupStack::PushL(singleContactField); + CSingleContactField* prefix = CSingleContactField::NewL(); +CleanupStack::PushL(prefix); + CSingleContactField* note = CSingleContactField::NewL(); +CleanupStack::PushL(note); + CSingleContactField* anni = CSingleContactField::NewL(); +CleanupStack::PushL(anni); + CSingleContactField* bday = CSingleContactField::NewL(); +CleanupStack::PushL(bday); + CSingleContactField* nkname = CSingleContactField::NewL(); +CleanupStack::PushL(nkname); + CSingleContactField* photo = CSingleContactField::NewL(); +CleanupStack::PushL(photo); +CSingleContactField* xspid = CSingleContactField::NewL(); +CleanupStack::PushL(xspid); + singleContactField->SetFieldParamsL(KFirstName,KNullDesC,KName); + singleContact->AddFieldToContactL(singleContactField); + prefix->SetFieldParamsL(KPrefix,KNullDesC,KPfix); + singleContact->AddFieldToContactL(prefix); + + note->SetFieldParamsL(KNote,KNullDesC,KNoteVal); + singleContact->AddFieldToContactL(note); + + + anni->SetFieldParamsL(KAnniversary,KNullDesC,KNullDesC); + anni->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + singleContact->AddFieldToContactL(anni); + + + bday->SetFieldParamsL(KBday,KNullDesC,KNullDesC); + bday->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + singleContact->AddFieldToContactL(bday); + + nkname->SetFieldParamsL(KNickName,KNullDesC,KNickNameVal); + singleContact->AddFieldToContactL(nkname); + + photo->SetFieldParamsL(KPhoto,KNullDesC,KPhotoVal); + singleContact->AddFieldToContactL(photo); + + RPointerArray xspidarr; + xspidarr.Append((_L("Yahoo:barbie@yahoo.co.in")).AllocL()); + xspidarr.Append((_L("Google:barbie@gmail.com")).AllocL()); + xspid->SetXspidDataL(KImpp,KImppLabel,xspidarr); + singleContact->AddFieldToContactL(xspid); + + //aItem.GetNextInt(count); + + /* Add the contactitem */ + icontactservice->AddL(icallback,0,singleContact); + CActiveScheduler::Start(); + + /* check whether add api returns the expected error code */ + if(KErrNone == icallback->iError ) + { + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; + return KErrNone ; + } + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; + return KErrGeneral ; + + } + +TInt Ctdeleteadd::Add_Test15L(CStifItemParser& aItem ) + { + __UHEAP_MARK; + + cmdNum = 15; +TInt count =KErrGeneral ; + _LIT8(KFirstName,"FirstName"); + _LIT(KFName,"Barbie"); + _LIT8(KPrefix,"Prefix"); + _LIT(KPfix,"Princess"); + _LIT8(KNote,"Note"); + _LIT(KNoteVal,"Lead role in Barbie, the island princess"); + _LIT8(KAnniversary,"Anniversary"); + // _LIT(KAnniVal,"20090521:023443:000000"); + //TTime annival; + //annival.Set(KAnniVal); + //_LIT(KAniiVal,"08216666"); + _LIT8(KBday,"Date"); + // _LIT(KBDayVal,"20099420:023443:000000"); + // TTime bdayval; + // bdayval.Set(KBDayVal); + _LIT8(KNickName,"SecondName"); + _LIT(KNickNameVal,"Doll"); + _LIT8(KPhoto,"CallerObjImg"); + _LIT(KPhotoVal,"C:\\data\\images\\pic.jpg"); + _LIT8(KImpp,"IMPP"); + _LIT(KImppLabel,"IMPP"); + + + //instantiate service class object + /* create contactitem to add */ + CSingleContact* singleContact = CSingleContact::NewL(); + //CleanupStack::PushL(singleContact); + CSingleContactField* FName = CSingleContactField::NewL(); +//CleanupStack::PushL(FName); + CSingleContactField* prefix = CSingleContactField::NewL(); +//CleanupStack::PushL(prefix); + CSingleContactField* note = CSingleContactField::NewL(); +//CleanupStack::PushL(note); + CSingleContactField* anni = CSingleContactField::NewL(); +//CleanupStack::PushL(anni); + CSingleContactField* bday = CSingleContactField::NewL(); +//CleanupStack::PushL(bday); + CSingleContactField* nkname = CSingleContactField::NewL(); +//CleanupStack::PushL(nkname); + CSingleContactField* photo = CSingleContactField::NewL(); +//CleanupStack::PushL(photo); + CSingleContactField* xspid = CSingleContactField::NewL(); +//CleanupStack::PushL(xspid); + + + FName->SetFieldParamsL(KFirstName,KNullDesC,KFName); + singleContact->AddFieldToContactL(FName); + + prefix->SetFieldParamsL(KPrefix,KNullDesC,KPfix); + singleContact->AddFieldToContactL(prefix); + + note->SetFieldParamsL(KNote,KNullDesC,KNoteVal); + singleContact->AddFieldToContactL(note); + + anni->SetFieldParamsL(KAnniversary,KNullDesC,KNullDesC); + anni->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + singleContact->AddFieldToContactL(anni); + + + bday->SetFieldParamsL(KBday,KNullDesC,KNullDesC); + bday->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + singleContact->AddFieldToContactL(bday); + + nkname->SetFieldParamsL(KNickName,KNullDesC,KNickNameVal); + singleContact->AddFieldToContactL(nkname); + + photo->SetFieldParamsL(KPhoto,KNullDesC,KPhotoVal); + singleContact->AddFieldToContactL(photo); + + _LIT(KYahooId,"Yahoo:barbie@yahoo.co.in"); + //_LIT8(); + + RPointerArray xspidarr; + //CleanClosePushL(xspidarr); + xspidarr.Append((_L("Yahoo:barbie@yahoo.co.in")).AllocL()); + xspidarr.Append((_L("Google:barbie@gmail.com")).AllocL()); + xspid->SetXspidDataL(KImpp,KImppLabel,xspidarr); + singleContact->AddFieldToContactL(xspid); + + + + + + aItem.GetNextInt(count) ; + + icontactservice=CContactService::NewL(); + /* Add the contactitem */ + HBufC8* cntId; + TRAPD(error,cntId= icontactservice->AddL(singleContact)); + + + if(error == KErrNone) + { +delete cntId; + delete singleContact; + //xspidarr.Reset(); + delete icontactservice; + __UHEAP_MARKEND; + + return KErrNone ; + } +delete cntId; + delete singleContact; + //xspidarr.Reset(); + delete icontactservice; + __UHEAP_MARKEND; + return KErrGeneral; + + + + + } + +/* Adding a group */ +TInt Ctdeleteadd::Add_Test16L( CStifItemParser& aItem ) +{ +__UHEAP_MARK; +icontactservice=CContactService::NewL(); +icallback=new(ELeave) CContactCallback; + // Print to UI + _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetList_Test16L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample ); + + + TInt count; + + /* Group1 to add to phonebook */ + _LIT(KGroup,"Group16") ; + + aItem.GetNextInt(count) ; + + /*Add group1 to phonebook */ + icontactservice->AddL(icallback,0,NULL,KNullDesC8,KGroup); + CActiveScheduler::Start(); + +/* check whether add api returns the expected error code */ +if(count == icallback->iError ) + { + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; + return KErrNone ; + } + delete icallback; + delete icontactservice; +__UHEAP_MARKEND; + return KErrGeneral ; + +} + +/* Adding a group */ +TInt Ctdeleteadd::Add_Test17L( CStifItemParser& aItem ) +{ +__UHEAP_MARK; +icontactservice=CContactService::NewL(); +icallback=new(ELeave) CContactCallback; + + // Print to UI + _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetList_Test17L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample ); + + HBufC8* grpId; + TInt count; + + /* Group1 to add to phonebook */ + _LIT(KGroup,"Group17") ; + + aItem.GetNextInt(count) ; + + /*Add group1 to phonebook */ + TRAPD(err,grpId = icontactservice->AddL(NULL,KNullDesC8,KGroup)); + + if(err != KErrNone) + { + delete icallback; + delete icontactservice; + delete grpId; + __UHEAP_MARKEND; + return KErrGeneral; + } + delete icallback; + delete icontactservice; + delete grpId; + __UHEAP_MARKEND; + return KErrNone; + +} // End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_delete/inc/tcontact_delete.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_delete/inc/tcontact_delete.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_delete/inc/tcontact_delete.h Thu Aug 27 07:43:07 2009 +0300 @@ -64,7 +64,9 @@ virtual void HandleReturnValue(TOperationEvent aEventId, const TInt& aError, TInt aTransId ); virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + + virtual void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); TInt iError; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_delete/src/tcontact_deleteblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_delete/src/tcontact_deleteblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_delete/src/tcontact_deleteblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -79,7 +79,16 @@ TBuf8<100> contactid; CSingleContact* myContact=NULL; +void CContactCallback::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } +void CContactCallback::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } + void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_edit/inc/tcontact_edit.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_edit/inc/tcontact_edit.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_edit/inc/tcontact_edit.h Thu Aug 27 07:43:07 2009 +0300 @@ -64,6 +64,9 @@ virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + + virtual void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); TInt iError; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_edit/src/tcontact_editblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_edit/src/tcontact_editblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_edit/src/tcontact_editblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -124,6 +124,16 @@ delete aIter; } + + void CContactCallback::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } + + void CContactCallback::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } // ============================ MEMBER FUNCTIONS =============================== diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_export/inc/tcontact_export.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_export/inc/tcontact_export.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_export/inc/tcontact_export.h Thu Aug 27 07:43:07 2009 +0300 @@ -101,6 +101,10 @@ virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + + virtual void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); + TInt iError; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_export/src/tcontact_exportblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_export/src/tcontact_exportblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_export/src/tcontact_exportblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -77,6 +77,16 @@ HBufC8* contactid=NULL; CSingleContact* myContact=NULL; + + void CContactCallback::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + } + + void CContactCallback::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/bwins/tcontact_getIdsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/bwins/tcontact_getIdsu.def Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/conf/tcontact_getIds.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/conf/tcontact_getIds.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,70 @@ + +[Test] +title GetAllContactIdsInPhoneDB +create tcontact_getIds foobar +foobar GetIds_Test1 +delete foobar +[Endtest] + +[Test] +title GetAllGroupsInAscOrder +create tcontact_getIds foobar +foobar GetIds_Test2 +delete foobar +[Endtest] + + +[Test] +title GetFilteredContactIdsInPhoneDB +create tcontact_getIds foobar +foobar GetIds_Test3 +delete foobar +[Endtest] + + +[Test] +title GetAllContactsInDesOrderFromPhoneDB +create tcontact_getIds foobar +foobar GetIds_Test4 +delete foobar +[Endtest] + +[Test] +title GetAllGroupsInDesOrder +create tcontact_getIds foobar +foobar GetIds_Test5 +delete foobar +[Endtest] + + + +[Test] +title GetAllContactIdsFromSimDB +create tcontact_getIds foobar +foobar GetIds_Test6 +delete foobar +[Endtest] + + +[Test] +title GetFilteredContactsFromSimDB +create tcontact_getIds foobar +foobar GetIds_Test7 +delete foobar +[Endtest] + + +[Test] +title GetAllContactsInDEfaultOrder +create tcontact_getIds foobar +foobar GetIds_Test8 +delete foobar +[Endtest] + + +[Test] +title GetAllGroupsInDEfaultOrder +create tcontact_getIds foobar +foobar GetIds_Test9 +delete foobar +[Endtest] \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/eabi/tcontact_getIdsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/eabi/tcontact_getIdsu.def Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI16CContactCallback @ 2 NONAME ; ## + _ZTV16CContactCallback @ 3 NONAME ; ## + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/group/bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + + +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' +../conf/tcontact_getIds.cfg /epoc32/winscw/c/testframework/tcontact_getIds.cfg + + +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 +tcontact_getIds.mmp +// NOTE: If using ARS requirements .mmp file operation should be done under this. +// 'abld test build' + +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 \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/group/tcontact_getIds.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/group/tcontact_getIds.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,102 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +/*TYPE TESTCLASS*//* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#include "../../../../../group/sapiincludes.mmpi" +#include + + +TARGET tcontact_getIds.dll +TARGETTYPE dll +UID 0x1000008d 0x080DDAF6 +//SECUREID 0x101FB3E3 +//CAPABILITY ReadUserData WriteUserData +#if defined(EKA2) +CAPABILITY ALL -TCB +/* Remove comments and replace 0x00000000 with correct vendor id */ +// VENDORID 0x00000000 +/* Remove comments and replace 0x00000000 with correct secure id */ + +#endif + +//TARGETPATH ?target_path +DEFFILE tcontact_getIds.def + +SOURCEPATH ../src +SOURCE tcontact_getIds.cpp +SOURCE tContact_getIdsBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 +EPOCALLOWDLLDATA +USERINCLUDE ../inc + +USERINCLUDE ../../../../contactservice/inc + + + + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY cntmodel.lib +LIBRARY vpbkeng.lib +LIBRARY contactservice.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY bafl.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 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/group/tcontact_getIds.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/group/tcontact_getIds.pkg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,43 @@ +; ============================================================================ +; 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 the License "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: package file for Service API package +; ============================================================================ + +;Languages +&EN + +;Header +#{"contactstest"},(0x204864AB),1,0,0 + +;Supports S60 3.0 +[0x301F7961], 0, 0, 0, {"S60ProductID"} + +;Localised Vendor name +%{"Nokia"} + +;Unique Vendor name +:"Nokia" + +;SAPI Binaries to Install + +;Contactservice binaries +;"..\..\..\..\..\..\..\epoc32\release\armv5\urel\contactservice.dll"-"C:\sys\bin\contactservice.dll" +"..\..\..\..\..\..\..\epoc32\release\armv5\urel\tcontact_getIds.dll"-"C:\sys\bin\tcontact_getIds.dll" + + +;ini file +"..\init\Testframework.ini"-"c:\Testframework\Testframework.ini" + +;cfg file +"..\conf\tcontact_getIds.cfg"-"c:\Testframework\tcontact_getIds.cfg" diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/inc/tcontact_getIds.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/inc/tcontact_getIds.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,234 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + + +#ifndef TMANUALCONTACTS_H +#define TMANUALCONTACTS_H + +// INCLUDES +#include +#include +#include +#include //for StringLoaderLC +#include //resource reader +#include //for note +#include //for the vcard engin +#include // for iContactManager +#include // for iContactStore +#include //used in SetupL +#include //used in SetupL to get contact stores +#include //used in AddFieldToContactL +#include // used in many function to get the store contact +#include //for the field text data +#include //used in CreateFieldTypeL() +#include //return type of CreateFieldTypeL() +#include //for observer +#include //Used in AddDateFieldToContactL +#include //for param in ContactsSaved() +#include //used in SetupL +#include "contactservice.h" + #include + #include + #include +#include +#include +#include "contactiter.h" +#include "contactcallback.h" +#include +#include +#include +#include + + +class CContactCallback : public MContactCallback + { + public: + + + virtual void HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ); + + virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); + + + virtual void HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ); + virtual void HandleReturnId(const TInt& aError, HBufC8* aId, TInt aTransId ); + TInt iError; + }; + + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +// Logging path +_LIT( KtmanualcontactsLogPath, "\\logs\\testframework\\tmanualcontacts\\" ); +// Log file +_LIT( KtmanualcontactsLogFile, "tmanualcontacts.txt" ); + + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Ctcontactgetids; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Ctmanualcontacts test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Ctcontactgetids) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Ctcontactgetids* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Ctcontactgetids(); + + 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. + */ + Ctcontactgetids( 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 GetIds_Test1L( CStifItemParser& aItem ); + virtual TInt GetIds_Test2L( CStifItemParser& aItem ); + virtual TInt GetIds_Test3L( CStifItemParser& aItem ); + virtual TInt GetIds_Test4L( CStifItemParser& aItem ); + virtual TInt GetIds_Test5L( CStifItemParser& aItem ); + virtual TInt GetIds_Test6L( CStifItemParser& aItem ); + virtual TInt GetIds_Test7L( CStifItemParser& aItem ); + virtual TInt GetIds_Test8L( CStifItemParser& aItem ); + virtual TInt GetIds_Test9L( CStifItemParser& aItem ); +// virtual TInt GetIds_Test10L( CStifItemParser& aItem ); + + //ADD NEW METHOD DEC HERE + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + CContactService* icontactservice; + CContactCallback* icallback; + + // ?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 // TMANUALCONTACTS_H + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/init/testframework.ini Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,161 @@ +# +# This is STIFTestFramework 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'. +# +# - 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. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: + # 'Summary', 'Environment', 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +[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= YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= NormalCases.txt +# TestCaseFile= SmokeCases.txt +# TestCaseFile= 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 +IniFile= c:\testframework\TestFramework.ini +TestCaseFile= c:\testframework\tcontact_getIds.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework 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. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +#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 + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/src/tcontact_getIds.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/src/tcontact_getIds.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + + +// INCLUDE FILES +#include +#include "tcontact_getIds.h" + +// 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 =============================== + +// ----------------------------------------------------------------------------- +// Ctcontactgetids::Ctcontactgetids +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Ctcontactgetids::Ctcontactgetids( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Ctcontactgetids::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Ctcontactgetids::ConstructL() + { + /* iLog = CStifLogger::NewL( KtmanualcontactsLogPath, + KtmanualcontactsLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse );*/ + + + // icontactservice=CContactService::NewL(); + + //icallback=new(ELeave) CContactCallback; + + } + +// ----------------------------------------------------------------------------- +// Ctcontactgetids::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Ctcontactgetids* Ctcontactgetids::NewL( + CTestModuleIf& aTestModuleIf ) + { + Ctcontactgetids* self = new (ELeave) Ctcontactgetids( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Ctcontactgetids::~Ctcontactgetids() + { + + // Delete resources allocated from test methods + Delete(); + // delete icallback; + // delete icontactservice; + // Delete logger + + //delete iLog; + } + +// ========================== 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* ) Ctcontactgetids::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/src/tcontact_getIdsblocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getIds/src/tcontact_getIdsblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,736 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + + +// INCLUDE FILES +#include +#include +#include +#include "tcontact_getIds.h" + +// 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 =============================== +_LIT(KCntDbUri, "cntdb://c:contacts.cdb"); +_LIT(KCntDbUri1, "sim://global_adn"); +TInt cmdFlag = 1; +TInt tCount = 0; +TInt tIdCount=0; + HBufC8* contactid; + CSingleContact* myContact=NULL; + _LIT(KContactId, "id"); + + void CContactCallback::HandleReturnId(const TInt& aError, HBufC8* aId, TInt aTransId ) + { + CActiveScheduler::Stop(); + iError = aError; + } + + + void CContactCallback::HandleReturnArray(const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + iError = aError; + tIdCount = aArray.Count(); + aArray.ResetAndDestroy(); + } + +void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) +{ +CActiveScheduler::Stop(); +iError= aError; +} + + + void CContactCallback:: HandleReturnIter(const TInt& aError, CContactIter* aIter, TInt aTransId ) + { + CActiveScheduler::Stop(); + CSingleContactField* field = NULL; + TPtrC8 buf1; + TPtrC buf2; + TPtrC buf3; + TInt count=0 ; + if(cmdFlag == 0) + { + tCount = 0; + if(aError==KErrNone) + { + aIter->NextL(myContact,contactid); + if(contactid) + { + delete contactid; + contactid = NULL; + } + + while(myContact) + { + tCount++; + if(myContact) + { + count++; + TInt len,i ; + len=myContact->FieldCount(); + for(i=0;iFieldAt(i); + CleanupStack::PushL(field); + if(field!=NULL) + { + field->GetFieldDataL(buf1,buf2,buf3); + + //if(buf1.CompareF(_L8("emailgen"))==0) break; + } + CleanupStack::Pop(field); + + } //for + + } //if + if(myContact) + { + delete myContact; + myContact = NULL; + } + aIter->NextL(myContact,contactid); + if(contactid) + { + delete contactid; + contactid = NULL; + } + + } //while + delete aIter; + } + } +} + + // ----------------------------------------------------------------------------- +// Ctcontactgetids::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Ctcontactgetids::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Ctcontactgetids::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Ctcontactgetids::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( "GetIds_Test1", Ctcontactgetids::GetIds_Test1L ), + ENTRY( "GetIds_Test2", Ctcontactgetids::GetIds_Test2L ), + ENTRY( "GetIds_Test3", Ctcontactgetids::GetIds_Test3L ), + ENTRY( "GetIds_Test4", Ctcontactgetids::GetIds_Test4L ), + ENTRY( "GetIds_Test5", Ctcontactgetids::GetIds_Test5L ), + ENTRY( "GetIds_Test6", Ctcontactgetids::GetIds_Test6L ), + ENTRY( "GetIds_Test7", Ctcontactgetids::GetIds_Test7L ), + ENTRY( "GetIds_Test8", Ctcontactgetids::GetIds_Test8L ), + ENTRY( "GetIds_Test9", Ctcontactgetids::GetIds_Test9L ), +/* ENTRY( "GetIds_Test10", Ctcontactgetids::GetIds_Test10L ), + ENTRY( "GetIds_Test11", Ctcontactgetids::GetIds_Test11L ),*/ + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Ctcontactgetids::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + + /*Get the list of all contact ids in phone database*/ + TInt Ctcontactgetids::GetIds_Test1L( CStifItemParser& /*aItem */) + { + ////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + // Print to UI + /*_LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test1L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample );*/ + //TInt val =1; + //cmdFlag = 0; + // icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri); + // CActiveScheduler::Start(); + //cmdFlag = 1; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri,EGetIds); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + // _LIT(KErrCode, "ErrorCode is 0"); + // iLog->Log(KErrCode); + if(tIdCount >= tCount) + { + /* _LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrNone; + } + } +// delete this; + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + + +/* get all contacts from the phonebook ie contacts.cdb*/ +/*TInt Ctcontactgetids::GetIds_Test2L( CStifItemParser& aItem ) +{ + + // Print to UI + _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetList_Test1L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample ); + + cmdFlag = 0; + icontactservice->GetListL(icallback,1,EContacts); + CActiveScheduler::Start(); + cmdFlag = 1; + TInt val =1; + _LIT(KCntDbUri, "cntdb://c:contacts.cdb"); + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri,val); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + _LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode); + if(tIdCount >= tCount) + { + _LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo); + return KErrNone; + } + } + return KErrGeneral; + + + } +*/ + + +/*Get the list of all the groups in the phone database*/ + TInt Ctcontactgetids::GetIds_Test2L( CStifItemParser& /*aItem*/ ) + { + //__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + // Print to UI + /* _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test2L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample ); + cmdFlag = 0; + /*icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri); + CActiveScheduler::Start(); + if(icallback->iError != KErrNone) + { + return KErrGeneral; + }*/ + cmdFlag = 1; + TInt val =1; + + icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri,EGetIds); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + /*_LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /*_LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrNone; + } + } + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + + +/*get the list of contact ids based on a search criteria*/ + TInt Ctcontactgetids::GetIds_Test3L( CStifItemParser& /*aItem*/ ) + { + //////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; +/* _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test3L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample );*/ + _LIT8(KFirstName,"FirstName"); + _LIT(KName,"Jerry"); + _LIT(KFirst,"First Name"); + /* create contactitem with invalid fieldname "FrstName */ + CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); + CSingleContactField* singleContactField = CSingleContactField::NewL(); + CleanupStack::PushL(singleContactField); + singleContactField->SetFieldParamsL(KFirstName,KFirst,KName); + singleContact->AddFieldToContactL(singleContactField); + /* Add the contactitem */ + icontactservice->AddL(icallback,0,singleContact,KNullDesC8,KNullDesC,KCntDbUri); + CActiveScheduler::Start(); + if(icallback->iError != KErrNone) + { + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + // //__UHEAP_MARKEND; + return KErrGeneral; + } + _LIT(Kname,"Lee"); + TBuf8<15> fstname(_L8("FirstName")); + + CSearchFields *srchfield =CSearchFields :: NewL(icontactservice); + srchfield->AppendL(fstname); + TPtrC searchval(_L("Jerry")); + TOrder sortorder =EAsc; + + cmdFlag = 0; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,searchval,srchfield,EAsc,KCntDbUri); + CActiveScheduler::Start(); + TBuf8<15> fstName(_L8("FirstName")); + CSearchFields *searchfield =CSearchFields :: NewL(icontactservice); + searchfield->AppendL(fstName); + TPtrC srchval(_L("Jerry")); + + TInt val =1; + cmdFlag = 1; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,srchval,searchfield,EAsc,KCntDbUri,EGetIds); + CActiveScheduler::Start(); + + if(icallback->iError == KErrNone) + { + /* _LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /*_LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + ////__UHEAP_MARKEND; + return KErrNone; + } + } + CleanupStack::Pop(singleContactField); + CleanupStack::Pop(singleContact); + delete singleContact; + delete icallback; + delete icontactservice; + ////__UHEAP_MARKEND; + return KErrGeneral; + } + +/*get the ids of all contacts in phone database in descending order*/ + TInt Ctcontactgetids::GetIds_Test4L( CStifItemParser& /*aItem*/ ) + { + ////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; +/* _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test4L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample );*/ + TInt val =1; + cmdFlag = 0; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EDesc,KCntDbUri); + CActiveScheduler::Start(); + cmdFlag = 1; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EDesc,KCntDbUri,EGetIds); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + /*_LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /*_LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrNone; + } + } + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + + /*get all the group ids in phone db in descending order*/ + TInt Ctcontactgetids::GetIds_Test5L( CStifItemParser& /*aItem*/ ) + { + ////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + /*_LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test5L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample ); + cmdFlag = 0;*/ + /*icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,KNullDesC,NULL,EDesc,KCntDbUri); + CActiveScheduler::Start(); + if(icallback->iError != KErrNone) + { + return KErrGeneral; + }*/ + cmdFlag = 1; + TInt val =1; + + icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,KNullDesC,NULL,EDesc,KCntDbUri,EGetIds); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + /*_LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /*_LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrNone; + } + } + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + + + /*get the list of all contact ids in sim database*/ + TInt Ctcontactgetids::GetIds_Test6L( CStifItemParser& /*aItem*/ ) + { + ////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + /*_LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test6L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample );*/ + TInt val =1; + cmdFlag = 0; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri1); + CActiveScheduler::Start(); + cmdFlag = 1; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri1,EGetIds); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + /*_LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /*_LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrNone; + } + } + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + + TInt Ctcontactgetids::GetIds_Test7L( CStifItemParser& /*aItem*/ ) + { + ////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + /*_LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test7L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample );*/ + /* _LIT8(KFirstName,"FirstName"); + _LIT(KName,"Tom"); + _LIT(KFirst,"First Name"); + + CSingleContact* singleContact = CSingleContact::NewL(); + CSingleContactField* singleContactField = CSingleContactField::NewL(); + singleContactField->SetFieldParamsL(KFirstName,KFirst,KName); + singleContact->AddFieldToContactL(singleContactField); + // Add the contactitem + icontactservice->AddL(icallback,0,singleContact,KNullDesC8,KNullDesC,KCntDbUri1); + CActiveScheduler::Start(); + if(icallback->iError != KErrNone) + { + return KErrGeneral; + }*/ + _LIT(Kname,"Lee"); + TBuf8<15> fstname(_L8("FirstName")); + + CSearchFields *srchfield =CSearchFields :: NewL(icontactservice); + srchfield->AppendL(fstname); + TPtrC searchval(_L("Arnold")); + TOrder sortorder =EAsc; + + cmdFlag = 0; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,searchval,srchfield,EAsc,KCntDbUri,EGetList); + CActiveScheduler::Start(); + if(icallback->iError != KErrNone) + { + /*_LIT( KErrorMsg, "The GetList returned non zero error" ); + iLog->Log( KErrorMsg ); + TBuf<25> errorcodedes(KNullDesC); + errorcodedes.Num(icallback->iError); + iLog->Log(_L("Error code:")); + iLog->Log(errorcodedes); */ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + TBuf8<15> fstName(_L8("FirstName")); + CSearchFields *searchfield =CSearchFields :: NewL(icontactservice); + searchfield->AppendL(fstName); + TPtrC srchval(_L("Arnold")); + + TInt val =1; + cmdFlag = 1; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,srchval,searchfield,EAsc,KCntDbUri1,EGetIds); + CActiveScheduler::Start(); + + if(icallback->iError == KErrNone) + { + /*_LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /* _LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrNone; + } + } + /*_LIT( KErrorMsg2, "The GetIds returned non zero error" ); + iLog->Log( KErrorMsg2 ); + delete icontactservice;*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + /*get the ids of all contacts in phone database in default order*/ + TInt Ctcontactgetids::GetIds_Test8L( CStifItemParser& /*aItem*/ ) + { + ////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + /*_LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test8L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample );*/ + TInt val =1; + cmdFlag = 0; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,ENULL,KCntDbUri); + CActiveScheduler::Start(); + cmdFlag = 1; + icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,ENULL,KCntDbUri,EGetIds); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + /*_LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /*_LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrNone; + } + } + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; + return KErrGeneral; + } + /*get the list of all group ids in default sort order*/ + TInt Ctcontactgetids::GetIds_Test9L( CStifItemParser& /*aItem*/ ) + { + ////__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + // Print to UI + /*_LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetIds_Test9L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample ); + cmdFlag = 0;*/ + /* icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,KNullDesC,NULL,ENULL,KCntDbUri); + CActiveScheduler::Start(); + if(icallback->iError != KErrNone) + { + return KErrGeneral; + }*/ + cmdFlag = 1; + TInt val =1; + + icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,KNullDesC,NULL,ENULL,KCntDbUri,EGetIds); + CActiveScheduler::Start(); + if(icallback->iError == KErrNone) + { + /*_LIT(KErrCode, "ErrorCode is 0"); + iLog->Log(KErrCode);*/ + if(tIdCount >= tCount) + { + /*_LIT(KLogInfo, "Count: "); + iLog->Log(KLogInfo); + TBuf8<16> logInfo; + logInfo.Num(tIdCount); + iLog->Log(logInfo);*/ + delete icallback; + delete icontactservice; + ////__UHEAP_MARKEND; + return KErrNone; + } + } + delete icallback; + delete icontactservice; + ////__UHEAP_MARKEND; + return KErrGeneral; + } +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/conf/tcontact_getlist.cfg --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/conf/tcontact_getlist.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/conf/tcontact_getlist.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -70,3 +70,19 @@ delete foobar [Endtest] + +[Test] +title GetListNewFieldsASync +create tContact_getlist foobar +foobar GetList_Test11 +delete foobar +[Endtest] + + +[Test] +title GetListNewFieldsSync +create tContact_getlist foobar +foobar GetList_Test12 +delete foobar +[Endtest] + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/inc/tcontact_getlist.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/inc/tcontact_getlist.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/inc/tcontact_getlist.h Thu Aug 27 07:43:07 2009 +0300 @@ -64,7 +64,8 @@ virtual void HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ); virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + virtual void HandleReturnArray(const TInt& aError,RPointerArray& aArray,TInt aTransId ); TInt iError; }; @@ -194,7 +195,8 @@ virtual TInt GetList_Test8L( CStifItemParser& aItem ); virtual TInt GetList_Test9L( CStifItemParser& aItem ); virtual TInt GetList_Test10L( CStifItemParser& aItem ); - //virtual TInt GetList_Test11L( CStifItemParser& aItem ); + virtual TInt GetList_Test11L( CStifItemParser& aItem ); + virtual TInt GetList_Test12L( CStifItemParser& aItem ); //ADD NEW METHOD DEC HERE public: // Data diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/src/tcontact_getlist.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/src/tcontact_getlist.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/src/tcontact_getlist.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -99,9 +99,9 @@ EFalse ); - icontactservice=CContactService::NewL(); + // icontactservice=CContactService::NewL(); - icallback=new(ELeave) CContactCallback; + //icallback=new(ELeave) CContactCallback; } @@ -129,8 +129,8 @@ // Delete resources allocated from test methods Delete(); - delete icallback; - delete icontactservice; + //delete icallback; + // delete icontactservice; // Delete logger delete iLog; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/src/tcontact_getlistblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/src/tcontact_getlistblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_getlist/src/tcontact_getlistblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -79,7 +79,27 @@ TInt tCount=0; HBufC8* contactid; CSingleContact* myContact=NULL; + TBool newFields = EFalse; + _LIT8(KFirstNameKey,"FirstName"); + _LIT(KValue,"Barbie"); + void CContactCallback::HandleReturnArray(const TInt& aError,RPointerArray& aArray,TInt aTransId ) + { + CActiveScheduler::Stop(); + iError = aError; + } + + void CContactCallback:: HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + //HBufC8* cntId = acntId; + iError = aError; + if(aError == KErrNone) + { + delete acntId; + acntId = NULL; + } + } void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) { iError= aError; @@ -92,9 +112,8 @@ CActiveScheduler::Stop(); - +iError = aError; CSingleContactField* field = NULL; - HBufC8* buf = NULL; TPtrC8 buf1; TPtrC buf2; TPtrC buf3; @@ -104,9 +123,14 @@ if(aError==KErrNone) { aIter->NextL(myContact,contactid); + if(contactid) + { + delete contactid; + contactid = NULL; + } while(myContact) - { + { tCount++; if(myContact) { @@ -119,23 +143,44 @@ if(field!=NULL) { field->GetFieldDataL(buf1,buf2,buf3); + if(newFields != EFalse) + { + if(buf1.CompareF(KFirstNameKey) == 0) + { + if(buf3.CompareF(KValue) != 0) + { + iError = KErrGeneral; + newFields =EFalse; + break; + } + } + newFields = EFalse; + break; + } //if(buf1.CompareF(_L8("emailgen"))==0) break; } } //for } //if - + if(myContact) + { + delete myContact; + myContact = NULL; + } aIter->NextL(myContact,contactid); - + + if(contactid) + { + delete contactid; + contactid = NULL; + } } //while - delete aIter; + } //if - - - - } +delete aIter; +} // ----------------------------------------------------------------------------- // Ctmanualcontacts::Delete @@ -172,7 +217,8 @@ ENTRY( "GetList_Test8", Ctmanualcontacts::GetList_Test8L ), ENTRY( "GetList_Test9", Ctmanualcontacts::GetList_Test9L ), ENTRY( "GetList_Test10", Ctmanualcontacts::GetList_Test10L ), - //ENTRY( "GetList_Test11", Ctmanualcontacts::GetList_Test11L ), + ENTRY( "GetList_Test11", Ctmanualcontacts::GetList_Test11L ), + ENTRY( "GetList_Test12", Ctmanualcontacts::GetList_Test12L ), }; @@ -193,7 +239,9 @@ /* get database lists ,manual,only contacts.cdb will be listed*/ TInt Ctmanualcontacts::GetList_Test1L( CStifItemParser& aItem ) { - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); _LIT( KExample, "In GetList_Test1L" ); @@ -213,6 +261,10 @@ iter->NextL(buf); } + delete iter; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; } @@ -221,7 +273,9 @@ /* get all contacts from the phonebook ie contacts.cdb,manual*/ TInt Ctmanualcontacts::GetList_Test2L( CStifItemParser& aItem ) { - +__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); _LIT( KExample, "In GetList_Test1L" ); @@ -233,8 +287,10 @@ icontactservice->GetListL(icallback,1,EContacts); CActiveScheduler::Start(); + delete icallback; + delete icontactservice; - + __UHEAP_MARKEND; return KErrNone ; @@ -256,23 +312,36 @@ TBuf8<15> fstname(_L8("FirstName")); TBufC8<25> cid ; - CSearchFields *srchfield =CSearchFields :: NewL(icontactservice); + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + //CSearchFields *srchfield =CSearchFields :: NewL(icontactservice); TPtrC searchval(_L("Getlist_test")); - srchfield->AppendL(fstname); + // srchfield->AppendL(fstname); + icallback=new(ELeave) CContactCallback; + icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,searchval,NULL,EAsc,KCntDbUri); CActiveScheduler::Start(); - + delete icallback; + // delete srchfield; + delete icontactservice; + __UHEAP_MARKEND; if(myContact ==NULL) - return KErrNone ; - + { + return KErrNone ; + } + //delete icallback; + //delete icontactservice; + //__UHEAP_MARKEND; return KErrGeneral; } /* get group list ,groups are there but no contacts in it */ TInt Ctmanualcontacts::GetList_Test4L( CStifItemParser& aItem ) { - +__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); _LIT( KExample, "In GetList_Test1L" ); @@ -292,7 +361,13 @@ CActiveScheduler::Start(); if(tCount!=0) + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrGeneral; @@ -304,7 +379,10 @@ TInt Ctmanualcontacts::GetList_Test5L( CStifItemParser& aItem ) { - +__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + // Print to UI _LIT(KCntDbUri1, "cntdb://c:tmp.cdb"); _LIT( Ktsapicontacts, "tsapicontacts" ); @@ -353,8 +431,18 @@ CActiveScheduler::Start(); if(tCount!=0) - return KErrNone ; + { + delete icallback; + delete icontactservice; + delete singleContact; + __UHEAP_MARKEND; + return KErrNone ; + } + delete icallback; + delete icontactservice; + delete singleContact; + __UHEAP_MARKEND; return KErrGeneral ; } @@ -363,7 +451,9 @@ TInt Ctmanualcontacts::GetList_Test6L( CStifItemParser& aItem ) { - +__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); _LIT(KCntDbUri, "cntdb://c:tmp.cdb"); @@ -411,16 +501,29 @@ CActiveScheduler::Start(); if(tCount ==0) + { + delete icallback; + delete icontactservice; + delete singleContact; + __UHEAP_MARKEND; return KErrNone ; - - else + } + + delete icallback; + delete icontactservice; + delete singleContact; + __UHEAP_MARKEND; return KErrGeneral; - } + +} /* list contacts in descending order */ TInt Ctmanualcontacts::GetList_Test7L( CStifItemParser& aItem ) { +__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; _LIT(KCntDbUri, "cntdb://c:tmp.cdb"); // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); @@ -434,7 +537,9 @@ CActiveScheduler::Start(); - + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; } @@ -452,12 +557,16 @@ // Print to log file iLog->Log( KExample ); - +__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; icontactservice->GetListL(icallback,1,EGroups,KNullDesC8,KNullDesC,NULL,EDesc,KCntDbUri); //,cid,KCntDbUri1,searchval,srchfield); CActiveScheduler::Start(); - + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; } @@ -465,7 +574,9 @@ /* list contacts ,ENULL cannot be used in sortingorder*/ TInt Ctmanualcontacts::GetList_Test9L( CStifItemParser& aItem ) { - +__UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; _LIT(KCntDbUri, "cntdb://c:tmp_ENul.cdb"); // Print to UI _LIT( Ktsapicontacts, "tsapicontacts" ); @@ -479,7 +590,9 @@ icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc); //,cid,KCntDbUri1,searchval,srchfield); CActiveScheduler::Start(); - + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; return KErrNone ; @@ -496,7 +609,9 @@ // Print to log file iLog->Log( KExample ); - + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; _LIT(KCntDbUri1, "cntdb://c:tmp.cdb"); icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri1); //,cid,KCntDbUri1,searchval,srchfield); @@ -504,7 +619,10 @@ CContactIter* iter = CContactIter::NewL(); icontactservice->GetListL(*iter); - + delete iter; + delete icallback; + delete icontactservice; + __UHEAP_MARKEND; TPtrC buf(_L("")); iter->NextL(buf); @@ -514,12 +632,397 @@ iter->NextL(buf); } if(count==2) + { + return KErrNone ; - + } +delete iter; + delete icallback; + delete icontactservice; + //__UHEAP_MARKEND; return KErrGeneral; } +/* get all contacts from the phonebook ie contacts.cdb,manual*/ +TInt Ctmanualcontacts::GetList_Test11L( CStifItemParser& aItem ) +{ + // Print to UI + _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetList_Test11L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + __UHEAP_MARK; + icontactservice=CContactService::NewL(); + icallback=new(ELeave) CContactCallback; + iLog->Log( KExample ); +// TInt count =KErrGeneral ; + _LIT8(KFirstName,"FirstName"); + _LIT(KFName,"Barbie"); + _LIT8(KPrefix,"Prefix"); + _LIT(KPfix,"Princess"); + _LIT8(KNote,"Note"); + _LIT(KNoteVal,"Lead role in Barbie, the island princess"); + _LIT8(KAnniversary,"Anniversary"); + //_LIT(KAniiVal,"08216666"); + _LIT8(KBday,"Date"); + _LIT8(KNickName,"SecondName"); + _LIT(KNickNameVal,"Doll"); + _LIT8(KPhoto,"CallerObjImg"); + _LIT(KPhotoVal,"C:\\data\\images\\pic.jpg"); + _LIT8(KImpp,"IMPP"); + _LIT(KImppLabel,"IMPP"); + + + //instantiate service class object + /* create contactitem to add */ +CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); + CSingleContactField* FName = CSingleContactField::NewL(); +CleanupStack::PushL(FName); + CSingleContactField* prefix = CSingleContactField::NewL(); +CleanupStack::PushL(prefix); + CSingleContactField* note = CSingleContactField::NewL(); +CleanupStack::PushL(note); + CSingleContactField* anni = CSingleContactField::NewL(); +CleanupStack::PushL(anni); + CSingleContactField* bday = CSingleContactField::NewL(); +CleanupStack::PushL(bday); + CSingleContactField* nkname = CSingleContactField::NewL(); +CleanupStack::PushL(nkname); + CSingleContactField* photo = CSingleContactField::NewL(); +CleanupStack::PushL(photo); + CSingleContactField* xspid = CSingleContactField::NewL(); +CleanupStack::PushL(xspid); + + + FName->SetFieldParamsL(KFirstName,KNullDesC,KFName); + singleContact->AddFieldToContactL(FName); + + prefix->SetFieldParamsL(KPrefix,KNullDesC,KPfix); + singleContact->AddFieldToContactL(prefix); + + note->SetFieldParamsL(KNote,KNullDesC,KNoteVal); + singleContact->AddFieldToContactL(note); + + anni->SetFieldParamsL(KAnniversary,KNullDesC,KNullDesC); + anni->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + //anni->SetDateTime(annival); + singleContact->AddFieldToContactL(anni); + + + bday->SetFieldParamsL(KBday,KNullDesC,KNullDesC); + bday->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + //bday->SetDateTime(bdayval); + singleContact->AddFieldToContactL(bday); + + nkname->SetFieldParamsL(KNickName,KNullDesC,KNickNameVal); + singleContact->AddFieldToContactL(nkname); + + photo->SetFieldParamsL(KPhoto,KNullDesC,KPhotoVal); + singleContact->AddFieldToContactL(photo); + + _LIT(KYahooId,"Yahoo:barbie@yahoo.co.in"); + //_LIT8(); + RPointerArray xspidarr; + xspidarr.Append((_L("Yahoo:barbie@yahoo.co.in")).AllocL()); + xspidarr.Append((_L("Google:barbie@gmail.com")).AllocL()); + xspid->SetXspidDataL(KImpp,KImppLabel,xspidarr); + singleContact->AddFieldToContactL(xspid); + + //aItem.GetNextInt(count) ; + _LIT( KLog4, "before calling add" ); + iLog->Log( KLog4 ); + /* Add the contactitem */ + HBufC8* cntId; + TRAPD(err,cntId= icontactservice->AddL(singleContact)); + + TPtr8 cntIdPtrVal(cntId->Des()); + if(err != KErrNone) + {CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; +delete cntId; + delete icallback; + delete icontactservice; + _LIT( KLog1, "false case uheapmarkend" ); + iLog->Log( KLog1 ); + __UHEAP_MARKEND; + return KErrGeneral ; + } + /*else + { + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; + delete cntId; + delete icallback; + delete icontactservice; + _LIT( KLog1, "false case uheapmarkend" ); + iLog->Log( KLog1 ); + __UHEAP_MARKEND; + return KErrNone; + + } + */ + newFields = ETrue; + _LIT(KCntDbUri,"cntdb://c:contacts.cdb"); + //icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc,KCntDbUri1); + //icontactservice->GetListL(icallback,1,EContacts,KNullDesC8,KNullDesC,NULL,EAsc); + icontactservice->GetListL(icallback,1,EContacts,cntIdPtrVal); //,KNullDesC,NULL,EAsc,KCntDbUri,EGetList); + + CActiveScheduler::Start(); + + if(icallback->iError == KErrNone) + { + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; +delete cntId; + delete icallback; + delete icontactservice; + _LIT( KLog2, "true case uheapmarkend" ); + iLog->Log( KLog2 ); + __UHEAP_MARKEND; + return KErrNone ; + } + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; +delete cntId; + delete icallback; + delete icontactservice; + _LIT( KLog3, "false case uheapmarkend 2" ); + iLog->Log( KLog3 ); + __UHEAP_MARKEND; + return KErrGeneral; + + + } + + +/* get all contacts from the phonebook ie contacts.cdb,manual*/ +TInt Ctmanualcontacts::GetList_Test12L( CStifItemParser& aItem ) +{ +__UHEAP_MARK; +icontactservice=CContactService::NewL(); + // Print to UI + _LIT( Ktsapicontacts, "tsapicontacts" ); + _LIT( KExample, "In GetList_Test11L" ); + TestModuleIf().Printf( 0, Ktsapicontacts, KExample ); + // Print to log file + iLog->Log( KExample ); +// TInt count =KErrGeneral ; + _LIT8(KFirstName,"FirstName"); + _LIT(KFName,"Kelly"); + _LIT8(KPrefix,"Prefix"); + _LIT(KPfix,"Princess"); + _LIT8(KNote,"Note"); + _LIT(KNoteVal,"Sister of Princess Barbie"); + _LIT8(KAnniversary,"Anniversary"); + _LIT8(KBday,"Date"); + _LIT8(KNickName,"SecondName"); + _LIT(KNickNameVal,"Doll"); + _LIT8(KPhoto,"CallerObjImg"); + _LIT(KPhotoVal,"C:\\data\\images\\pic.jpg"); + _LIT8(KImpp,"IMPP"); + _LIT(KImppLabel,"IMPP"); + TPtrC8 fieldKey(KNullDesC8); + TPtrC label(KNullDesC); + TPtrC value(KNullDesC); + _LIT(KValue,"Kelly"); + //instantiate service class object + /* create contactitem to add */ + CSingleContact* singleContact = CSingleContact::NewL(); + CleanupStack::PushL(singleContact); + CSingleContactField* FName = CSingleContactField::NewL(); +CleanupStack::PushL(FName); + CSingleContactField* prefix = CSingleContactField::NewL(); +CleanupStack::PushL(prefix); + CSingleContactField* note = CSingleContactField::NewL(); +CleanupStack::PushL(note); + CSingleContactField* anni = CSingleContactField::NewL(); +CleanupStack::PushL(anni); + CSingleContactField* bday = CSingleContactField::NewL(); +CleanupStack::PushL(bday); + CSingleContactField* nkname = CSingleContactField::NewL(); +CleanupStack::PushL(nkname); + CSingleContactField* photo = CSingleContactField::NewL(); +CleanupStack::PushL(photo); + CSingleContactField* xspid = CSingleContactField::NewL(); +CleanupStack::PushL(xspid); + + FName->SetFieldParamsL(KFirstName,KNullDesC,KFName); + singleContact->AddFieldToContactL(FName); + + prefix->SetFieldParamsL(KPrefix,KNullDesC,KPfix); + singleContact->AddFieldToContactL(prefix); + + note->SetFieldParamsL(KNote,KNullDesC,KNoteVal); + singleContact->AddFieldToContactL(note); + + anni->SetFieldParamsL(KAnniversary,KNullDesC,KNullDesC); + //anni->SetDateTime(annival); + anni->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + singleContact->AddFieldToContactL(anni); + + + bday->SetFieldParamsL(KBday,KNullDesC,KNullDesC); + //bday->SetDateTime(bdayval); + bday->SetDateTime(TTime(TDateTime(2007,EOctober,25,0,0,0,0))); + singleContact->AddFieldToContactL(bday); + + nkname->SetFieldParamsL(KNickName,KNullDesC,KNickNameVal); + singleContact->AddFieldToContactL(nkname); + + photo->SetFieldParamsL(KPhoto,KNullDesC,KPhotoVal); + singleContact->AddFieldToContactL(photo); + + _LIT(KYahooId,"Yahoo:kelly@yahoo.co.in"); + //_LIT8(); + RPointerArray xspidarr; + xspidarr.Append((_L("Yahoo:kelly@yahoo.co.in")).AllocL()); + xspidarr.Append((_L("Google:kelly@gmail.com")).AllocL()); + xspid->SetXspidDataL(KImpp,KImppLabel,xspidarr); + + + singleContact->AddFieldToContactL(xspid); + + // aItem.GetNextInt(count) ; + + /* Add the contactitem */ + HBufC8* cntId; + TRAPD(err,cntId= icontactservice->AddL(singleContact)); + TPtr8 cntIdPtrVal(cntId->Des()); + + if(err != KErrNone) + { + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; +delete cntId; + delete icontactservice; + __UHEAP_MARKEND; + return KErrGeneral ; + } + newFields = ETrue; + CContactIter* iterVal; + + TPtr8 cntIdPtr(cntId->Des()); + TRAPD(error, iterVal = icontactservice->GetListL(EContacts,cntIdPtr)); + + if(error != KErrNone) + { + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; + delete cntId; + delete iterVal; + _LIT( KLog1, "false case uheapmarkend 1" ); + iLog->Log( KLog1 ); + __UHEAP_MARKEND; + return KErrGeneral; + } + iterVal->NextL(myContact,contactid); + if(contactid) + { + delete contactid; + contactid = NULL; + } + if(myContact) + { + for(TInt i=0;iFieldCount(); i++) + { + CSingleContactField* field = myContact->FieldAt(i); + field->GetFieldDataL(fieldKey,label,value); + if(value.Compare(KValue) == 0) + { + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; + delete cntId; + delete iterVal; + delete myContact; + delete icontactservice; + _LIT( KLog2, "true case uheapmarkend" ); + iLog->Log( KLog2 ); + __UHEAP_MARKEND; + return KErrNone; + } + } + delete myContact; + } + CleanupStack::Pop(xspid); + CleanupStack::Pop(photo); + CleanupStack::Pop(nkname); + CleanupStack::Pop(bday); + CleanupStack::Pop(anni); + CleanupStack::Pop(note); + CleanupStack::Pop(prefix); + CleanupStack::Pop(FName); + CleanupStack::Pop(singleContact); + delete singleContact; +delete cntId; + delete iterVal; + delete icontactservice; + _LIT( KLog3, "false case uheapmarkend" ); + iLog->Log( KLog3 ); + __UHEAP_MARKEND; + + return KErrGeneral; + + + + } /* get group list ,groups are there in the simdatabase TInt Ctmanualcontacts::GetList_Test11L( CStifItemParser& aItem ) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/cagent.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/cagent.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,39 @@ +BEGIN:VCARD +VERSION:2.1 +AAA.ADR:;;AThe Street;London;;;UK +AAA.DDD.EE.FFFF.GHIJKL.TITLE:AMonster +AAA.N:AX;Bob +BBBB.N:BX;Bob +BBBB.TITLE:BMonster +BBBB.ADR:;;BThe Street;London;;;UK +CC.ADR:;;CThe Street;London;;;UK +CC.TITLE:CMonster +N:X;Bob +ADR:;;The Street;London;;;UK +TITLE;X-DEF=abc\;def;X-DEFa=ghi;X-DEFb=jkl\;mno:Monster +TEL;PREF;WORK;VOICE:1234567890 +TEL;HOME;VOICE:1234567890 +LOGO;GIF;ENCODING=BASE64: + R0lGODlhogBNAPEAAP////+AgP8AAAAAACH5BAEAAAAALAAAAACiAE0AAAL/BISp + y+1iopy02ouz3rzTB4aMR5bmiXriCqbuC8cVSy/yjeddzev+/+PRgMRiTLgyKpck + ZIgJjWKcD6n1eqCOsFyo1tYNG7+J0+B8FqszZEgJDV/LP18T/D7PG+qku18/p2Xn + FwcoRzVImGa45mSmuMiohvQIKXlYk2J52TjkQsgZyAKDF4opYpp6kqTauvPkGrsB + K1tr0WKbO+Og2yvB6xucBfYT+TZQobihHLOJspXz11coAWlMYY2smX2toiCTrRFe + za1Nzl1ZfhKgEPBZbo6tbgB/XR+/fI/fEcCO0L8N3QV49PRF0LdvIEIT/fw1DDjO + AkGEaSjmK3UOo4eG/+w4NmMmbt7BehMiKtRYktpGjiw/guIgMGXMjC8lSjuZUAPL + naRAhvQpzxrOm0FVniyxk+cLZz+J2gQqs2ZUo0+RJm35TmoGpk+dJoNa0OvXnBeu + KoWIEgPXsWKnUgUAdiwJs2fTpR361i2apnfjBl1J1yPavGzv6u1WtK/WG4HrHluM + d+9WvyMXr43R2PE0yF0N0yRc2etlGJk1dxhdGHTYtp8lt0b8onRSu6pfkw3tGTdV + 1Chkz07EOnFt3qvTEmfo2zTf2rpdR4ZtW7hz0smVT+acenp26M27CZVR/beH491v + Fx8O9Tv18FjHUz5sHu57+ZbJc2AvHub88su1S//3bp9O+FnXGXPn+Qdff4ipl8KA + +SkYH3/XBXfgggGW5SCB/0VYYXzHXWYSchm2B+Fp830YV4iAjSjYRRRGN2FuHRb4 + ogUsPvgch/S9iCJ2MyVDwY040shdgjGqxiB8iu0j5JBKRqiibdxF2aFIETTppEVS + bqLllrtRxCSWpnVZJZcLPZnXmRKIOSSZO5L0JkFoIhjnhcLokeSd8ugJVy/m6AgF + oBJt5YOgyxykRjyGvlEoEIs2Co42Ff3pmmSTyofpOat9lak9kXyq1qeWImMMNYVc + GsciqkpKKqsljUQPogXNmimtrnYaqq2yghorp32KqmufsQJbq7C9GktpsMeL/imr + scLiw6yzkqrVbELROlvNq9kie2y3z2q7bLXijsvted5GK81t11JaabPgnhtuWPBi + qyi5625bbr74xmsttfzie+279MabLbTzEnxvtwkjiy64t3470LirkpsSObCWyyyx + Bku8MLv00drpqB6HXKq1E5OM6V4InlrpxKa2DG2ryU56a5F8ykIACgA7 + +END:VCARD + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/details.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/details.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,11 @@ +BEGIN:VCARD +VERSION:2.1 +N:123;XYZ;;Z;A +TITLE:software engg +TEL;CELL;HOME:9900870 +TEL;HOME:08216666 +TEL;FAX;HOME:12345 +EMAIL;WORK;INTERNET;ENCODING=QUOTED-PRINTABLE:xyz=40mail.com +NOTE:my details +X-CLASS:private +END:VCARD diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/doublecontact.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/doublecontact.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,7 @@ +BEGIN:VCARD +VERSION:2.1 +REV:20000120T041246Z +N:testing;import;;; +TEL:341 +TEL:342 +END:VCARD diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/empty.vcf diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/halfline.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/halfline.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,11 @@ +BEGIN:VCARD +VERSION:2.1 +REV:20000101T101150Z +UID:00-e03abcd3d10591-2 +N:Name.LastName;Name.Firstname;Name.Extra1;Name.Extra2;Name.Extra3 +ADR;HOME:AdrHome.Extra1;AdrHome.Extra2;AdrHome.Address;AdrHome.City;AdrHome.State;AdrHome.ZipCode;Country +TITLE:Title +TEL;WORK;VOICE:TelWorkVoice +TEL;HOME;VOICE:TelHomeVoice +TEL;WORK;VOICE;CELL:TelWorkVoiceCell +TEL;HOME; \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/mti.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/mti.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,6 @@ +BEGIN:VCARD +VERSION:2.1 +N:;;;; +FN: +TEL;WORK;FAX: +END:VCARD diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact.txt Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,7 @@ +BEGIN:VCARD +VERSION:2.1 +REV:20000120T041246Z +N:Lee;Williams;;; +TEL:341 +TEL:342 +END:VCARD diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,7 @@ +BEGIN:VCARD +VERSION:2.1 +REV:20000120T041246Z +N:Lee;Williams;;; +TEL:341 +TEL:342 +END:VCARD diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact1.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact1.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,7 @@ +BEGIN:VCARD +VERSION:2.1 +REV:20000120T041246Z +N:second1;first;;; +TEL:341 +TEL:342 +END:VCARD \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact2.vcf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/data/c/singlecontact2.vcf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,7 @@ +BEGIN:VCARD +VERSION:2.1 +REV:20000120T041246Z +N:second2;first;;; +TEL:111 +TEL:222 +END:VCARD \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/group/tcontact_import.pkg --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/group/tcontact_import.pkg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/group/tcontact_import.pkg Thu Aug 27 07:43:07 2009 +0300 @@ -35,6 +35,17 @@ ;"..\..\..\..\..\..\..\epoc32\release\armv5\urel\contactservice.dll"-"C:\sys\bin\contactservice.dll" "..\..\..\..\..\..\..\epoc32\release\armv5\urel\tContact_import.dll"-"C:\sys\bin\tContact_import.dll" +;vcf files +"..\data\c\cagent.vcf"-"c:\data\cagent.vcf" +"..\data\c\details.vcf"-"c:\data\details.vcf" +"..\data\c\doublecontact.vcf"-"c:\data\doublecontact.vcf" +"..\data\c\empty.vcf"-"c:\data\empty.vcf" +"..\data\c\halfline.vcf"-"c:\data\halfline.vcf" +"..\data\c\mti.vcf"-"c:\data\mti.vcf" +"..\data\c\singlecontact1.vcf"-"c:\data\singlecontact1.vcf" +"..\data\c\singlecontact2.vcf"-"c:\data\singlecontact2.vcf" +"..\data\c\singlecontact.vcf"-"c:\data\singlecontact.vcf" +"..\data\c\singlecontact.txt"-"c:\data\singlecontact.txt" ;ini file "..\init\Testframework.ini"-"c:\Testframework\Testframework.ini" diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/inc/tcontact_import.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/inc/tcontact_import.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/inc/tcontact_import.h Thu Aug 27 07:43:07 2009 +0300 @@ -96,7 +96,8 @@ virtual void HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ); virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + virtual void HandleReturnArray(const TInt& aError,RPointerArray& aArray,TInt aTransId ); TInt iError; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/src/tcontact_importblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/src/tcontact_importblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_import/src/tcontact_importblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -78,6 +78,16 @@ HBufC8* contactid; CSingleContact* myContact=NULL; + void CContactCallback::HandleReturnArray( const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + iError= aError ; + } + + void CContactCallback::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_organise/inc/tcontact_organise.h --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_organise/inc/tcontact_organise.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_organise/inc/tcontact_organise.h Thu Aug 27 07:43:07 2009 +0300 @@ -64,7 +64,8 @@ virtual void HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ); virtual void HandleReturnIter( const TInt& aError, CContactIter* aIter, TInt aTransId ); - + virtual void HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ); + virtual void HandleReturnArray(const TInt& aError,RPointerArray& aArray,TInt aTransId ); TInt iError; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_organise/src/tcontact_organiseblocks.cpp --- a/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_organise/src/tcontact_organiseblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_contacts_vpbk/tsrc/testing/tcontact_organise/src/tcontact_organiseblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -32,7 +32,17 @@ TBuf<25> KCompare ; TBuf8<100> contactid ; enum flag {GROUP = 1,CONTACT }status; - + void CContactCallback::HandleReturnArray( const TInt& aError, RPointerArray& aArray, TInt aTransId ) + { + CActiveScheduler::Stop(); + iError= aError ; + } + void CContactCallback::HandleReturnId( const TInt& aError, HBufC8* acntId, TInt aTransId ) + { + CActiveScheduler::Stop(); + } + + void CContactCallback::HandleReturnValue( TOperationEvent aEventId, const TInt& aError, TInt aTransId ) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_landmarks/src/landmarkinterface.cpp --- a/serviceproviders/sapi_landmarks/src/landmarkinterface.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_landmarks/src/landmarkinterface.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -295,12 +295,12 @@ User::Leave (SErrInvalidServiceArgument ); } - if ( aCmdName == KCancel && (KLiwOptCancel & aCmdOptions) ) + if ( !aCmdName.CompareF(KCancel) && (KLiwOptCancel & aCmdOptions) ) { Cancel (aInParamList, aOutParamList, aCmdOptions, aCallback ); } else - if ( aCmdName == KGetList ) + if ( !aCmdName.CompareF(KGetList) ) { GetListL (aInParamList, aOutParamList, aCmdOptions, aCallback ); } @@ -313,36 +313,36 @@ User::Leave (SErrInvalidServiceArgument ); } else - if ( aCmdName == KAdd ) + if ( !aCmdName.CompareF(KAdd) ) { AddL (aInParamList, aOutParamList, aCmdOptions, aCallback ); } else - if ( aCmdName == KRemove ) + if ( !aCmdName.CompareF(KRemove) ) { RemoveL (aInParamList, aOutParamList, aCmdOptions, aCallback ); } else - if ( aCmdName == KOrganise ) + if ( !aCmdName.CompareF(KOrganise) ) { OrganiseL (aInParamList, aOutParamList, aCmdOptions, aCallback ); } else - if ( aCmdName == KImport ) + if ( !aCmdName.CompareF(KImport) ) { ImportL (aInParamList, aOutParamList, aCmdOptions, aCallback ); } else - if ( aCmdName == KExport ) + if ( !aCmdName.CompareF(KExport) ) { ExportL (aInParamList, aOutParamList, aCmdOptions, aCallback ); } else - if ( aCmdName == KNew ) + if ( !aCmdName.CompareF(KNew) ) { NewTemplateL (aInParamList, aOutParamList, aCmdOptions, diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_landmarks/tsrc/dev/landmarks_inputparams/conf/landmarks_inputparams.cfg --- a/serviceproviders/sapi_landmarks/tsrc/dev/landmarks_inputparams/conf/landmarks_inputparams.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_landmarks/tsrc/dev/landmarks_inputparams/conf/landmarks_inputparams.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -78,7 +78,7 @@ [Test] title AddMultipleLandmarks create landmarks_inputparams foobar -foobar Add Multiple Landmark 100 +foobar Add Multiple Landmark 5 delete foobar [Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_landmarks/tsrc/dev/landmarks_inputparams/src/landmarks_inputparamsblocks.cpp --- a/serviceproviders/sapi_landmarks/tsrc/dev/landmarks_inputparams/src/landmarks_inputparamsblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_landmarks/tsrc/dev/landmarks_inputparams/src/landmarks_inputparamsblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -246,9 +246,9 @@ CLiwDefaultMap* area = CLiwDefaultMap::NewL(); CleanupStack::PushL(area); area->InsertL(_L8("NorthLatitude"),TLiwVariant(12.12)); - area->InsertL(_L8("SouthLatitude"),TLiwVariant(13.13)); + area->InsertL(_L8("SouthLatitude"),TLiwVariant(11.13)); area->InsertL(_L8("EastLongitude"),TLiwVariant(14.14)); - area->InsertL(_L8("WestLongitude"),TLiwVariant(15.15)); + area->InsertL(_L8("WestLongitude"),TLiwVariant(13.15)); filter->InsertL(_L8("BoundedArea"),TLiwVariant(area)); @@ -264,12 +264,17 @@ - iLandmarkIf->ExecuteCmdL(_L8("GetList"),inList,outList,0,0); + iLandmarkIf->ExecuteCmdL(_L8("getList"),inList,outList,0,0); + - CleanupStack::PopAndDestroy(sort); - CleanupStack::PopAndDestroy(area); - CleanupStack::PopAndDestroy(position); - CleanupStack::PopAndDestroy(filter); + CleanupStack::Pop(sort); + sort->DecRef(); + CleanupStack::Pop(area); + area->DecRef(); + CleanupStack::Pop(position); + position->DecRef(); + CleanupStack::Pop(filter); + filter->DecRef(); TInt index = 0; @@ -306,7 +311,8 @@ iLandmarkIf->ExecuteCmdL(_L8("GetList"),inList,outList,0,0); - CleanupStack::PopAndDestroy(filter); + CleanupStack::Pop(filter); + filter->DecRef(); TInt index = 0; @@ -361,10 +367,11 @@ inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(sort))); iLandmarkIf->ExecuteCmdL(_L8("GetList"),inList,outList,0,0); - - CleanupStack::PopAndDestroy(sort); - CleanupStack::PopAndDestroy(filter); - + + CleanupStack::Pop(sort); + sort->DecRef(); + CleanupStack::Pop(filter); + filter->DecRef(); TInt index = 0; const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); @@ -413,8 +420,10 @@ iLandmarkIf->ExecuteCmdL(_L8("GetList"),inList,outList,0,0); - CleanupStack::PopAndDestroy(sort); - CleanupStack::PopAndDestroy(filter); + CleanupStack::Pop(sort); + sort->DecRef(); + CleanupStack::Pop(filter); + filter->DecRef(); TInt index = 0; @@ -551,10 +560,13 @@ iLandmarkIf->ExecuteCmdL(_L8("Add"),inList,outList,0,0); - CleanupStack::PopAndDestroy(fields); - CleanupStack::PopAndDestroy(position); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(fields); + fields->DecRef(); + CleanupStack::Pop(position); + position->DecRef(); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; const TLiwGenericParam* outParam = outList.FindFirst(index,_L8("ErrorCode")); @@ -638,10 +650,12 @@ iLandmarkIf->ExecuteCmdL(_L8("Add"),inList,outList,0,0); - CleanupStack::PopAndDestroy(fields); - CleanupStack::PopAndDestroy(position); - //CleanupStack::PopAndDestroy(category); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(fields); + fields->DecRef(); + CleanupStack::Pop(position); + position->DecRef(); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; @@ -698,7 +712,8 @@ iLandmarkIf->ExecuteCmdL(_L8("Add"),inList,outList,0,0); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; @@ -771,13 +786,14 @@ CleanupStack::PushL(data); data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); - data->InsertL(_L8("LandmarkId"),TLiwVariant(_L("0"))); + data->InsertL(_L8("id"),TLiwVariant(_L("0"))); inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); iLandmarkIf->ExecuteCmdL(_L8("Delete"),inList,outList,0,0); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; @@ -811,13 +827,14 @@ CleanupStack::PushL(data); data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); - data->InsertL(_L8("CategoryId"),TLiwVariant(_L("0"))); + data->InsertL(_L8("id"),TLiwVariant(_L("0"))); inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); iLandmarkIf->ExecuteCmdL(_L8("Delete"),inList,outList,0,0); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; @@ -881,7 +898,8 @@ iLandmarkIf->ExecuteCmdL(_L8("Import"),inList,outList,0,0); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; @@ -895,7 +913,7 @@ outList.Reset(); Delete(); //__UHEAP_MARKEND; - if( index == 1013 ) + if( index == 1012 ) { index = 0; } @@ -954,7 +972,7 @@ CLiwDefaultList* list = CLiwDefaultList::NewL(); CleanupStack::PushL(list); list->AppendL(TLiwVariant(_L("0"))); - data->InsertL(_L8("LandmarkIdList"),TLiwVariant(list)); + data->InsertL(_L8("IdList"),TLiwVariant(list)); data->InsertL(_L8("MimeType"),TLiwVariant(_L("application/vnd.nokia.landmarkcollection+xml"))); @@ -962,8 +980,10 @@ iLandmarkIf->ExecuteCmdL(_L8("Export"),inList,outList,0,0); - CleanupStack::PopAndDestroy(list); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(list); + list->DecRef(); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; @@ -1025,12 +1045,12 @@ CleanupStack::PushL(data); data->InsertL(_L8("DatabaseURI"),TLiwVariant(_L("c:eposlm.ldb"))); - data->InsertL(_L8("CategoryId"),TLiwVariant(_L("0"))); + data->InsertL(_L8("id"),TLiwVariant(_L("0"))); CLiwDefaultList* list = CLiwDefaultList::NewL(); CleanupStack::PushL(list); list->AppendL(TLiwVariant(_L("0"))); - data->InsertL(_L8("LandmarkIdList"),TLiwVariant(list)); + data->InsertL(_L8("IdList"),TLiwVariant(list)); inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(data))); @@ -1039,8 +1059,10 @@ iLandmarkIf->ExecuteCmdL(_L8("Organise"),inList,outList,0,0); - CleanupStack::PopAndDestroy(list); - CleanupStack::PopAndDestroy(data); + CleanupStack::Pop(list); + list->DecRef(); + CleanupStack::Pop(data); + data->DecRef(); TInt index = 0; @@ -1097,7 +1119,7 @@ //Type mandatory inList.AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant((TInt32)0))); - iLandmarkIf->ExecuteCmdL(_L8("Cancel"),inList,outList,0,0); + iLandmarkIf->ExecuteCmdL(_L8("Cancel"),inList,outList,KLiwOptCancel,0); TInt index = 0; @@ -1157,7 +1179,9 @@ map->InsertL(KNullDesC8,variant); TRAP_IGNORE(OperationsL(map)); param->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(map))); - CleanupStack::PopAndDestroy(map); + + CleanupStack::Pop(map); + map->DecRef(); TLiwGenericParam outParam; param->AtL(0,outParam); const CLiwMap* outMap = outParam.Value().AsMap(); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/inc/locationcb.h --- a/serviceproviders/sapi_location/inc/locationcb.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/inc/locationcb.h Thu Aug 27 07:43:07 2009 +0300 @@ -33,7 +33,7 @@ * @see MLocationCallBack in locationservice.h for details. */ -class LocationInterfaceCB : public MLocationCallBack +class LocationInterfaceCB : public CBase , public MLocationCallBack { private : MLiwNotifyCallback *iCallBack ; @@ -119,23 +119,27 @@ * object, */ - inline TUint GetRequestType(void) + TUint GetRequestType(void) { return iRequestType ; } - MLiwNotifyCallback* GetCallBackobj() - { - return iCallBack; - } + /** + * This function returns transcation id associated with the Async request for + * which this callback is used + */ + TInt32 GetTransactionId(void) + { + return iTransactionId ; + } /** - * GetTransactionId function returns transcation id associated with current async object - * + * Retruns the MLiwNotifyCallback object owned by this class */ - inline TInt32 GetTransactionId(void) - { - return iTransactionId ; - } + + MLiwNotifyCallback* GetCallBackobj() + { + return iCallBack; + } /** * HandleL, an internal utility funtion which is called by HandleNotifyL method, * This methods encapsulates all the leaving methods which could be traped by diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/inc/locationerrormessage.hrh --- a/serviceproviders/sapi_location/inc/locationerrormessage.hrh Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/inc/locationerrormessage.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -37,6 +37,8 @@ _LIT(KMissingDistanceParam, "location : Calculate : Missing argument - MoveByThisDistance"); _LIT(KMissingBearingParam, "location : Calculate : Missing argument - MoveByThisBearing"); +_LIT(KGetLocationBadEnableHighAcc, "location : GetLocation : EnableHighAccuracy Type mismatch"); +_LIT(KTraceBadEnableHighAcc, "location : Trace : EnableHighAccuracy Type mismatch"); _LIT(KGetLocationWrongupdateMap, "location : GetLocation : BadArgument - Updateoptions"); _LIT(KCalWrongSource, "location : Calculate : Wrong Argument - SourceParam"); _LIT(KCalWrongDest, "location : Calculate : Wrong Argument - Paramdestination"); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/inc/locationinterface.h --- a/serviceproviders/sapi_location/inc/locationinterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/inc/locationinterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -50,8 +50,8 @@ _LIT8( KCmdGetLocation , "GetLocation" ) ; _LIT8( KCmdTraceLocation, "Trace" ) ; _LIT8( KCmdCancelRequest, "CancelNotification" ) ; -_LIT8( KCmdSetIdentity, "SetIdentity"); +_LIT8(KCmdLastLocation,"GetLastPosition"); _LIT( KRequestTrace ,"TraceCancel") ; _LIT( KRequestGetLoc , "GetLocCancel" ) ; _LIT8( KRequestCalculate , "Calculate") ; @@ -82,6 +82,10 @@ _LIT8(KUpdateOptionTimeOut,"UpdateTimeOut"); _LIT8(KUpdateOptionMaxAge,"UpdateMaxAge"); _LIT8(KPartialUpdates , "PartialUpdates"); +/** + * EnableHighAccuracy parameter + */ +_LIT8(KEnableHighAccuracy,"EnableHighAccuracy"); /** * Class of Location Information ;user is @@ -136,12 +140,6 @@ _LIT8(KPositionFieldMagneticCourse , "MagneticCourse") ; _LIT8(KPositionFieldMagneticCourseError , "MagneticCourseError") ; -/** - * NMEA information which will be part of outparam list - */ - -_LIT8(KPositionFieldNMEASentences , "NMEASentence") ; -_LIT8(KPositionFieldNMEASentencesStart , "NMEASentenceStart") ; /** * Enum specifier for postion Info Category @@ -211,7 +209,7 @@ virtual void Close() {delete this;} private : - static void ConvertPosToGenricListL( TPosition &aPos , CLiwGenericParamList &aOutList ) ; + /** * Internal private function which extracts coordinate information from CLiwMap @@ -234,6 +232,11 @@ private : /** + * By default Symbian 2nd phase constructor is private. + * + */ + void ConstructL(); + /** *Default constructor */ @@ -279,15 +282,7 @@ void GetLocationInfo( CLiwGenericParamList& aOutParamList,TInt aPosInfoCategory) ; - /** - * Internal function which cancels the asynchronous using transaction id of the - * async request - * - * @param aTransactionId Transaction id of the asynchronous request to be cancelled - */ - - MLiwNotifyCallback* RequestCancel(TInt32 aTransactionId/*,MLiwNotifyCallback** aCallBack*/) ; - + /** * Handle to core location class for performing location operations @@ -310,6 +305,10 @@ * Class member which contains module information which is used for location esitmation */ TPositionModuleInfo iModuleInfo ; + /** + * Class member which is used to obtain updates of Last Known Position + */ + TPosition iPosition; /** * Class member which contains all the field ids of all the supported Hposition info fields diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/locationservice/bwins/locationu.def --- a/serviceproviders/sapi_location/locationservice/bwins/locationu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/locationservice/bwins/locationu.def Thu Aug 27 07:43:07 2009 +0300 @@ -2,12 +2,12 @@ ??0CLocationService@@IAE@XZ @ 1 NONAME ; CLocationService::CLocationService(void) ??1CLocationService@@UAE@XZ @ 2 NONAME ; CLocationService::~CLocationService(void) ?CancelOnGoingService@CLocationService@@QAEHH@Z @ 3 NONAME ; int CLocationService::CancelOnGoingService(int) - ?DoInitialiseL@CLocationService@@IAEXXZ @ 4 NONAME ; void CLocationService::DoInitialiseL(void) - ?GetLocationL@CLocationService@@QAEHPAVMLocationCallBack@@HQAGPBVTPositionUpdateOptions@@@Z @ 5 NONAME ; int CLocationService::GetLocationL(class MLocationCallBack *, int, unsigned short * const, class TPositionUpdateOptions const *) - ?GetLocationL@CLocationService@@QAEHPAVTPositionInfoBase@@PBVTPositionUpdateOptions@@@Z @ 6 NONAME ; int CLocationService::GetLocationL(class TPositionInfoBase *, class TPositionUpdateOptions const *) + ?CancelService@CLocationService@@QAEHH@Z @ 4 NONAME ; int CLocationService::CancelService(int) + ?GetLocationL@CLocationService@@QAEXPAVMLocationCallBack@@HQAGPBVTPositionUpdateOptions@@H@Z @ 5 NONAME ; void CLocationService::GetLocationL(class MLocationCallBack *, int, unsigned short * const, class TPositionUpdateOptions const *, int) + ?GetLocationL@CLocationService@@QAEXPAVTPositionInfoBase@@PBVTPositionUpdateOptions@@H@Z @ 6 NONAME ; void CLocationService::GetLocationL(class TPositionInfoBase *, class TPositionUpdateOptions const *, int) ?GetModuleInfo@CLocationService@@QBEHAAVTPositionModuleInfoBase@@@Z @ 7 NONAME ; int CLocationService::GetModuleInfo(class TPositionModuleInfoBase &) const ?MathOperation@CLocationService@@QAEHAAU_INPPARM@@@Z @ 8 NONAME ; int CLocationService::MathOperation(struct _INPPARM &) - ?NewL@CGetLoc@@SAPAV1@AAVRPositionServer@@QAGHH@Z @ 9 NONAME ; class CGetLoc * CGetLoc::NewL(class RPositionServer &, unsigned short * const, int, int) + ?NewL@CGetLoc@@SAPAV1@AAVRPositionServer@@QAGHHVTUid@@@Z @ 9 NONAME ; class CGetLoc * CGetLoc::NewL(class RPositionServer &, unsigned short * const, int, int, class TUid) ?NewL@CLocationService@@SAPAV1@XZ @ 10 NONAME ; class CLocationService * CLocationService::NewL(void) - ?TraceL@CLocationService@@QAEHPAVMLocationCallBack@@HQAGPBVTPositionUpdateOptions@@@Z @ 11 NONAME ; int CLocationService::TraceL(class MLocationCallBack *, int, unsigned short * const, class TPositionUpdateOptions const *) - + ?TraceL@CLocationService@@QAEXPAVMLocationCallBack@@HQAGPBVTPositionUpdateOptions@@H@Z @ 11 NONAME ; void CLocationService::TraceL(class MLocationCallBack *, int, unsigned short * const, class TPositionUpdateOptions const *, int) + ?GetLastKnownLoc@CLocationService@@QAEHAAVTPosition@@@Z @ 12 NONAME ; int CLocationService::GetLastKnownLoc(class TPosition &) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/locationservice/eabi/locationu.def --- a/serviceproviders/sapi_location/locationservice/eabi/locationu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/locationservice/eabi/locationu.def Thu Aug 27 07:43:07 2009 +0300 @@ -1,20 +1,20 @@ EXPORTS - _ZN16CLocationService12GetLocationLEP17MLocationCallBackiPtPK22TPositionUpdateOptions @ 1 NONAME - _ZN16CLocationService12GetLocationLEP17TPositionInfoBasePK22TPositionUpdateOptions @ 2 NONAME - _ZN16CLocationService13DoInitialiseLEv @ 3 NONAME - _ZN16CLocationService13MathOperationER8_INPPARM @ 4 NONAME + _ZN16CLocationService12GetLocationLEP17MLocationCallBackiPtPK22TPositionUpdateOptionsi @ 1 NONAME + _ZN16CLocationService12GetLocationLEP17TPositionInfoBasePK22TPositionUpdateOptionsi @ 2 NONAME + _ZN16CLocationService13CancelServiceEi @ 3 NONAME + _ZN16CLocationService13MathOperationER8_INPPARM @ 4 NONAME _ZN16CLocationService20CancelOnGoingServiceEi @ 5 NONAME _ZN16CLocationService4NewLEv @ 6 NONAME - _ZN16CLocationService6TraceLEP17MLocationCallBackiPtPK22TPositionUpdateOptions @ 7 NONAME + _ZN16CLocationService6TraceLEP17MLocationCallBackiPtPK22TPositionUpdateOptionsi @ 7 NONAME _ZN16CLocationServiceC1Ev @ 8 NONAME _ZN16CLocationServiceC2Ev @ 9 NONAME _ZN16CLocationServiceD0Ev @ 10 NONAME _ZN16CLocationServiceD1Ev @ 11 NONAME _ZN16CLocationServiceD2Ev @ 12 NONAME - _ZN7CGetLoc4NewLER15RPositionServerPtii @ 13 NONAME + _ZN7CGetLoc4NewLER15RPositionServerPtii4TUid @ 13 NONAME _ZNK16CLocationService13GetModuleInfoER23TPositionModuleInfoBase @ 14 NONAME _ZTI16CLocationService @ 15 NONAME ; ## _ZTI7CGetLoc @ 16 NONAME ; ## _ZTV16CLocationService @ 17 NONAME ; ## _ZTV7CGetLoc @ 18 NONAME ; ## - + _ZN16CLocationService15GetLastKnownLocER9TPosition @ 19 NONAME diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/locationservice/inc/locationcoreimp.h --- a/serviceproviders/sapi_location/locationservice/inc/locationcoreimp.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/locationservice/inc/locationcoreimp.h Thu Aug 27 07:43:07 2009 +0300 @@ -53,13 +53,15 @@ * @param aRequestorInfoStack requestor indenty * @param aList List of position fields that should be retrived * @param aLocationInfoCategory information type required(Basic, Generic) - * + * @param aModuleId the unique id of the module which should be used to + * open the subsession with location server */ IMPORT_C static CGetLoc* NewL( RPositionServer &aPositionServer , TPositionFieldIdList aList , TInt aRequestType, - TInt aLocationInfoCategory ) ; + TInt aLocationInfoCategory, + TPositionModuleId aModuleId) ; /** * Destructor. @@ -68,28 +70,18 @@ - /** - * Gets users current location Asynchronously calls the users callback - * function when updates are recived from location server - * - * @param aCallBackObj callback object for updates notification - * @param aUpdatesOptions update options for asynchronous calls - * - */ - TInt GetLocation( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions =NULL ); + /** + * Gets users current location Asynchronously calls the users callback + * function when updates are recived from location server + * @param aLocationService pointer to the CLocationService class used in RunL + * @param aCallBackObj callback object for updates notification + * @param aUpdatesOptions update options for asynchronous calls + * + * @see TPositionUpdateOptions in LbsCommon.h for details + */ + TInt GetLocationUpdates( CLocationService* aLocationService, MLocationCallBack* aCallBackObj , + const TPositionUpdateOptions* aUpdateOptions = NULL ); - /** - * Traces users location change - * Any location change is informed to user via callback function - * - * @param aCallBackObj callback handle for async trace call - * @param aUpdateOptions updateoptions for trace call - * - * @see TPositionUpdateOptions in LbsCommon.h for details - */ - TInt GetLocationUpdates( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions = NULL ); void SetStatusComplete() { @@ -102,9 +94,14 @@ else return true; } - - - + /* + * Returns the MLocationCallBack object pointer stored by this class + */ + + MLocationCallBack* GetCallBackobj() const + { + return iCallBack; + } protected: @@ -117,11 +114,19 @@ private: - /** - * By default Symbian 2nd phase constructor is private. - */ - - void ConstructL(); + /** + * By default Symbian 2nd phase constructor is private. + * @param aPositionServer subsession to location server + * @param aList List of position fields that should be retrived + * @param aRequestType The type of request serviced by this Active object(GetLocation,Trace) + * @param aModuleId aModuleId the unique id of the module which should be used to + * open the subsession with location server + */ + + void ConstructL(RPositionServer &aPositionServer , + TPositionFieldIdList aList , + TInt aRequestType, + TPositionModuleId aModuleId); /** * Default constructor */ @@ -165,6 +170,10 @@ TInt iRequestStatus; + /** + * Pointer to CLocationService used in RunL() + */ + CLocationService* iLocationService; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/locationservice/inc/locationservice.h --- a/serviceproviders/sapi_location/locationservice/inc/locationservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/locationservice/inc/locationservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -28,16 +28,6 @@ _LIT(KIdentity,"Location SAPI"); -/** - * Key for locating active objects associated with async request in registration table - * - * @ 0 for Getlocation async Active object - * @ 1 for Trace async active object - */ - -const TInt KARRAY_INDEX_GETLOCATION = 0 ; -const TInt KARRAY_INDEX_TRACE = 1 ; - /** @@ -46,6 +36,8 @@ _LIT8(KLongitudeKey,"Longitude") ; _LIT8(KLatitudeKey , "Latitude") ; _LIT8(KAltitudeKey , "Altitude") ; +_LIT8(KHorAccuracy,"HorizontalAccuracy"); +_LIT8(KVerAccuracy,"VerticalAccuracy"); _LIT(KUnknown,"Unknown"); @@ -63,6 +55,8 @@ //MaxAge const TInt KSMaxAge = 0; +const TInt KGetLocationReq = 0 ; +const TInt KTraceReq = 1 ; /** * Enums required for mathoperations @@ -138,6 +132,23 @@ */ public : virtual TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) = 0 ; + /* + * To be implemented by every class that derives from this. This function should return + * the Async Request type for which this callback is used. + */ + + virtual TUint GetRequestType(void) = 0; + + /* + * To be implemented by every class that derives from this. This returns the + * TransactionId associated with the Async request for which this Callback + * object is used. + */ + + virtual TInt32 GetTransactionId(void) = 0; + + + virtual ~MLocationCallBack(){} }; @@ -176,9 +187,11 @@ * * @param aPosinfobase input TPositionInfoBase object which will hold location details * @param aUpdateOpts updateoptions for synchronous calls + * @param aEnableHighAcc - Tells whether to use greater accuracy modules to obtain updates */ - IMPORT_C TInt GetLocationL( TPositionInfoBase* aPos , - const TPositionUpdateOptions* aUpdateOpts= NULL ) ; + IMPORT_C void GetLocationL( TPositionInfoBase* aPos , + const TPositionUpdateOptions* aUpdateOpts= NULL, + TBool aEnableHighAcc = false ) ; /** @@ -188,12 +201,14 @@ * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. * @param aFieldIdList specifies field of HPositionGenericInfo that user intend to retrieve. * @param aUpdateoptions update options for asynchronous requests. + * @param aEnableHighAcc - Tells whether to use greater accuracy modules to obtain updates * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions */ - IMPORT_C TInt GetLocationL( MLocationCallBack* aCallBackObj , + IMPORT_C void GetLocationL( MLocationCallBack* aCallBackObj , TInt aLocationInfoCategory = 0, TPositionFieldIdList aFieldIdList = NULL , - const TPositionUpdateOptions* aUpdateopts = NULL + const TPositionUpdateOptions* aUpdateopts = NULL, + TBool aEnableHighAcc = false ); /** @@ -224,14 +239,15 @@ * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. * @param aFiledList List of position fields that should be retrived * @param aUpdateOptions update options for trace - * + * @param aEnableHighAcc Tells whether to use greater accuracy modules to obtain updates * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions */ - IMPORT_C TInt TraceL(MLocationCallBack* aCallBackObj , + IMPORT_C void TraceL(MLocationCallBack* aCallBackObj , TInt aLocationInfoCategory = 0, TPositionFieldIdList aFiledList = NULL , - const TPositionUpdateOptions* aUpateOptions= NULL ); + const TPositionUpdateOptions* aUpateOptions= NULL, + TBool aEnableHighAcc = false); /** @@ -245,12 +261,24 @@ IMPORT_C TInt CancelOnGoingService( TInt aCancelparam ) ; /** + * Method to cancel pending async request + * + * aTransId Transaction Id that was returned for an Async request + */ + IMPORT_C TInt CancelService( TInt aTransId); + + /** * Method to fetch last known location from location server */ - TInt GetLastKnownLoc( TPosition& aResultPos ) ; + IMPORT_C TInt GetLastKnownLoc( TPosition& aResultPos ) ; - + /** + * Method to obtain the High Accuracy module out of the + * currently available modules on the phone + */ + + void GetHighAccuracyModuleL(TPositionModuleId* aModId); @@ -265,10 +293,6 @@ */ CLocationService() ; - /** - * Method to initalise class memebers - */ - void DoInitialiseL() ; private : @@ -289,7 +313,6 @@ */ RPointerArray iRegTable; - TInt iIndex; /** diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/locationservice/src/locationcoreimp.cpp --- a/serviceproviders/sapi_location/locationservice/src/locationcoreimp.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/locationservice/src/locationcoreimp.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -22,14 +22,19 @@ #include "locationservice.h" +CGetLoc::CGetLoc() : +CActive(CActive::EPriorityStandard) + { - + } -//Constructor +CGetLoc::~CGetLoc() -CGetLoc :: CGetLoc():CActive( CActive::EPriorityStandard ) { - + iPositioner.Close() ; + delete iGenericPosInfo; + iLocationService = NULL; + } /** @@ -38,15 +43,48 @@ * with subsessions for communicating with location server */ -void CGetLoc::ConstructL() +void CGetLoc::ConstructL(RPositionServer& aPositionServer , + TPositionFieldIdList aList , + TInt aRequestType, + TPositionModuleId aModuleId) { // Initialise the position request sequence - + DoInitialiseL(); - - } + if( aModuleId.iUid ) + { + //Open a new subsession with position server + User :: LeaveIfError((this->iPositioner).Open(aPositionServer,aModuleId)); + } + + else + { + //Open a new subsession with position server using default module + User :: LeaveIfError((this->iPositioner).Open(aPositionServer)) ; + } + + CleanupClosePushL(iPositioner); + //Set the identity of this particular requestor + User::LeaveIfError( (this->iPositioner).SetRequestor( + CRequestor::ERequestorService, + CRequestor::EFormatApplication, + KIdentity ) ); + + this->iPosInfoBase = &(this->iPositionInfo); + this->iRequestType = aRequestType; + this->iGenericPosInfo = HPositionGenericInfo :: NewL(); + CleanupStack :: PushL(this->iGenericPosInfo); + + if(aList) + { + User :: LeaveIfError((this->iGenericPosInfo)->SetRequestedFields(aList)); + } + + CleanupStack ::Pop(this->iGenericPosInfo ); + CleanupStack::Pop(&iPositioner); + } /** * Function name: NewL , * Constructs a new core implementation object which will later @@ -58,65 +96,36 @@ -EXPORT_C CGetLoc* CGetLoc::NewL( RPositionServer &aPositionServer , - TPositionFieldIdList aList , - TInt aRequestType, - TInt /*aLocationInfoCategory*/ ) - { - //Check for the presence of ActiveScheduler +EXPORT_C CGetLoc* CGetLoc::NewL( RPositionServer& aPositionServer , + TPositionFieldIdList aList , + TInt aRequestType, + TInt /*aLocationInfoCategory*/, + TPositionModuleId aModuleId) + { + //Check for the presence of ActiveScheduler //Create the object - CActiveScheduler *current = CActiveScheduler::Current() ; + + CActiveScheduler* current = CActiveScheduler::Current(); if(!current) { User::Leave(KErrNotFound); //Leave if consumer is not event driven } - CGetLoc* self = new( ELeave ) CGetLoc(); CleanupStack::PushL(self); - TInt error = (self->iPositioner).Open(aPositionServer) ; //Open a new subsession with position server - - if(error) - { - User :: Leave( error) ; - } - - //Set the identity of this particular requestor - User::LeaveIfError( (self->iPositioner).SetRequestor( CRequestor::ERequestorService, - CRequestor::EFormatApplication, - KIdentity ) ); - - + self->ConstructL(aPositionServer , + aList , + aRequestType, + aModuleId); - self->iPosInfoBase = &(self->iPositionInfo) ; - self->iRequestType = aRequestType ; - self->iGenericPosInfo = HPositionGenericInfo :: NewL() ; - - if(aList) - { - error = (self->iGenericPosInfo)->SetRequestedFields(aList) ; - } - - User :: LeaveIfError(error) ; - CleanupStack :: PushL(self->iGenericPosInfo) ; - - self->ConstructL(); - CleanupStack ::Pop(self->iGenericPosInfo ); - CleanupStack::Pop( self ); + CleanupStack::Pop(self); //Return pointer to the created object return self; - } - -CGetLoc ::~CGetLoc() + } - { - iPositioner.Close() ; - delete iGenericPosInfo ; - - } TInt CGetLoc::DoInitialiseL() { @@ -130,13 +139,16 @@ /** - * CGetLoc :: GetLocation accepts update options from the consumers - * returns the status of job submitted + * CGetLoc :: GetLocationUpdates accepts update options from the consumers and + * submits an aynchronous request to the location server + * Returns the status of job submitted */ - TInt CGetLoc :: GetLocation( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions ) +TInt CGetLoc::GetLocationUpdates(CLocationService* aLocationService,MLocationCallBack* aCallBackObj, + const TPositionUpdateOptions* aUpdateOptions) { + //Pointer to CLocationService used in RunL + iLocationService = aLocationService; //Register the call back address iCallBack = aCallBackObj ; @@ -193,60 +205,6 @@ -/** - * Function Name :GetLocationUpdates - * Notifies the user whenever his position changes - * Returns status of the submitted job - */ - - TInt CGetLoc:: GetLocationUpdates( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions ) - { - - //Register the call back address - iCallBack = aCallBackObj ; - - if(aUpdateOptions) - { - TInt error = iPositioner.SetUpdateOptions(*aUpdateOptions) ; - - if(error) //If update options failed then no return error to caller - { - return error ; - } - } - else //set the default values - { - TPositionUpdateOptions updateopts ; - - // Set update interval to one second to receive one position data per second - updateopts.SetUpdateInterval(TTimeIntervalMicroSeconds(KSUpdateInterval)); - - // If position server could not get position - // In two minutes it will terminate the position request - updateopts.SetUpdateTimeOut(TTimeIntervalMicroSeconds(KSUpdateTimeOut)); - - // Positions which have time stamp below KMaxAge can be reused - updateopts.SetMaxUpdateAge(TTimeIntervalMicroSeconds(KSMaxAge)); - - // Enables location framework to send partial position data - updateopts.SetAcceptPartialUpdates(FALSE); - - - iPositioner.SetUpdateOptions(updateopts) ; - } - - - if(!(this->IsAdded())) //Add to the active list if not added - { - CActiveScheduler :: Add(this) ; - } - - - iPositioner.NotifyPositionUpdate( *iGenericPosInfo, iStatus ); - SetActive() ; - return KErrNone ; - } /** @@ -284,10 +242,27 @@ break ; } + case KErrTimedOut: + { + iCallBack->HandleNotifyL(NULL , iStatus.Int()) ; + //Re-issue the request even though there's an error + if (iRequestType == KTraceRequest) + { + if (this->IsAdded() && !this->IsActive()) + { + if (!this->IsStatusComplete()) + { + iPositioner.NotifyPositionUpdate( *iGenericPosInfo, + iStatus); + SetActive(); + } + } + } + break; + } case KErrArgument: case KPositionQualityLoss: //Need to check this returnig s60 error code from here - case KErrTimedOut : case KErrNotFound : //Service provider not available, or gone down in between { @@ -303,7 +278,15 @@ } } //End of Switch + if(iRequestType == KGetLocationRequest) + { + //Delete the Active Object associated with this request since it is completed + if(iLocationService) + { + iLocationService->CancelService(iCallBack->GetTransactionId()); + } + } } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/locationservice/src/locationservice.cpp --- a/serviceproviders/sapi_location/locationservice/src/locationservice.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/locationservice/src/locationservice.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -21,11 +21,6 @@ #include "locationcoreimp.h" #include "locationservice.h" -/** - * Maximum number of active objects that can be created : at present only each corresponding - * to location-asynch and trace - */ -const TInt KMAXAO = 2; @@ -60,7 +55,6 @@ iRegTable[iter]->Deque() ; } delete iRegTable[iter]; - iRegTable[iter] = NULL ; } } @@ -88,110 +82,154 @@ /** * CLocationService::ConstructL * Symbian 2nd phase constructor can leave. - */ - -void CLocationService::ConstructL() - { - - DoInitialiseL(); - } - - - -/** - * CLocationService::DoInitialiseL * Initialises position server and positioner and * begins the position request sequence. */ -EXPORT_C void CLocationService :: DoInitialiseL() +void CLocationService::ConstructL() { - TInt error = iPosServer.Connect( ); - // The connection failed - - User :: LeaveIfError(error) ; + User :: LeaveIfError(iPosServer.Connect()); + CleanupClosePushL(iPosServer); - // Open subsession to the position server - error = iPositioner.Open(iPosServer); - - // The opening of a subsession failed - if ( KErrNone != error ) - { - iPosServer.Close(); - User :: Leave( error ); - } - + //Get the module id of the default module available + User :: LeaveIfError(iPosServer.GetDefaultModuleId(iModuleId)); - //setting identity for this requestor - User::LeaveIfError( iPositioner.SetRequestor( CRequestor::ERequestorService, - CRequestor::EFormatApplication, - KIdentity ) ); - - //Initialise index which means there is no - //active object created yet - iIndex = 0 ; - //Initialising array pointer to NULL - - for ( TInt count = 0;count < KMAXAO;count++) - { - iRegTable.Insert(NULL,count); - } - - - //Getthe module id used by location server for sapi location calls. - error = iPosServer.GetDefaultModuleId(iModuleId); - - User :: LeaveIfError(error) ; - + CleanupStack::Pop(&iPosServer); } +/** + * CLocationService::GetHighAccuracyModule + * This function returns the module id of highest accuracy + * module that is available on the phone currently. + */ +void CLocationService::GetHighAccuracyModuleL(TPositionModuleId* aModId) + { + TPositionModuleId moduleId; + TPositionModuleInfo modInfo; + TUint numOfModules = 0; + + //Flags used for indicating if a particular module is found + TInt termInternalFlag = 0; + TInt termFlag = 0 ,assisFlag = 0 ,networkFlag = 0,unknownFlag = 0; + TInt err; + + User::LeaveIfError(iPosServer.GetNumModules(numOfModules)); + + + for( TInt i=0;i< numOfModules;i++ ) + { + iPosServer.GetModuleInfoByIndex(i,modInfo); + + if( modInfo.TechnologyType() == modInfo.ETechnologyAssisted && + modInfo.IsAvailable()) + { + + assisFlag = 1; + moduleId = modInfo.ModuleId(); + break; + } + + if( modInfo.TechnologyType() == modInfo.ETechnologyTerminal && + !assisFlag && !termInternalFlag && modInfo.IsAvailable() ) + { + + termFlag = 1; + moduleId = modInfo.ModuleId(); + + //Internal Module takes higher priority than External module + if(modInfo.DeviceLocation() == modInfo.EDeviceInternal) + { + termInternalFlag = 1; + } + + } + + if(modInfo.TechnologyType() == modInfo.ETechnologyNetwork && + !assisFlag && !termFlag && modInfo.IsAvailable()) + { + + networkFlag = 1; + moduleId = modInfo.ModuleId(); + + } + + if( modInfo.TechnologyType() == modInfo.ETechnologyUnknown && + !assisFlag && !termFlag && + !networkFlag && modInfo.IsAvailable() ) + { + + unknownFlag = 1; + moduleId = modInfo.ModuleId(); + } + } + *aModId = moduleId; + } /** * CLocationService :: GetLocationL with update options, this function gets users current location * returns 0 on success and Symbian specific error codes on failure */ -EXPORT_C TInt CLocationService :: GetLocationL( TPositionInfoBase* aInfoBase , const TPositionUpdateOptions* aUpdateOpts ) +EXPORT_C void CLocationService :: GetLocationL( TPositionInfoBase* aInfoBase , + const TPositionUpdateOptions* aUpdateOpts,TBool aEnableHighAcc ) { - - TRequestStatus status ; - - if(aUpdateOpts) + // Open subsession to the position server + TPositionModuleId ModuleId; + TInt error; + if(aEnableHighAcc) { - TInt error; - error = iPositioner.SetUpdateOptions(*aUpdateOpts); - if( error) - { - return error ; - } + GetHighAccuracyModuleL(&ModuleId); + + User::LeaveIfError(iPositioner.Open(iPosServer,ModuleId)); } else { - TPositionUpdateOptions updateopts ; - - // Set update interval to one second to receive one position data per second - updateopts.SetUpdateInterval(TTimeIntervalMicroSeconds(KSUpdateInterval)); + User::LeaveIfError(iPositioner.Open(iPosServer)); + } + + + CleanupClosePushL(iPositioner); + + //setting identity for this requestor + User::LeaveIfError( iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + KIdentity ) ); + + TRequestStatus status; + + if(aUpdateOpts) + { + User::LeaveIfError(iPositioner.SetUpdateOptions(*aUpdateOpts)); + } - // If position server could not get position - // In two minutes it will terminate the position request - updateopts.SetUpdateTimeOut(TTimeIntervalMicroSeconds(KSUpdateTimeOut)); + else + { + TPositionUpdateOptions updateopts ; + + // Set update interval to one second to receive one position data per second + updateopts.SetUpdateInterval(TTimeIntervalMicroSeconds(KSUpdateInterval)); - // Positions which have time stamp below KMaxAge can be reused - updateopts.SetMaxUpdateAge(TTimeIntervalMicroSeconds(KSMaxAge)); + // If position server could not get position + // In two minutes it will terminate the position request + updateopts.SetUpdateTimeOut(TTimeIntervalMicroSeconds(KSUpdateTimeOut)); - // Enables location framework to send partial position data - updateopts.SetAcceptPartialUpdates(FALSE); + // Positions which have time stamp below KMaxAge can be reused + updateopts.SetMaxUpdateAge(TTimeIntervalMicroSeconds(KSMaxAge)); - + // Enables location framework to send partial position data + updateopts.SetAcceptPartialUpdates(FALSE); + + iPositioner.SetUpdateOptions(updateopts) ; } iPositioner.NotifyPositionUpdate( *aInfoBase, status ); User :: WaitForRequest(status) ; - - return status.Int() ; + CleanupStack::PopAndDestroy(&iPositioner); + + User::LeaveIfError(status.Int()); } /** @@ -212,46 +250,44 @@ * This function gets users current location * returns status of job submitted */ -EXPORT_C TInt CLocationService :: GetLocationL( MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory, - TPositionFieldIdList aFieldList , - const TPositionUpdateOptions* aUpateOptions - ) - { - - if(iRegTable[KARRAY_INDEX_GETLOCATION]) +EXPORT_C void CLocationService :: GetLocationL( MLocationCallBack* aCallBackObj , + TInt aLocationInfoCategory, + TPositionFieldIdList aFieldList , + const TPositionUpdateOptions* aUpateOptions, + TBool aEnableHighAcc +) + { + TPositionModuleId ModuleId; + if(aEnableHighAcc) { - if(iRegTable[KARRAY_INDEX_GETLOCATION]->IsActive()) - { - return KErrInUse ; //Return Error is Already registred - } - - delete iRegTable[KARRAY_INDEX_GETLOCATION] ; - iRegTable[KARRAY_INDEX_GETLOCATION] = NULL ; - + GetHighAccuracyModuleL(&ModuleId); + + } + else + { + //Indicates that when opening the subsession ,moudleId need not be specified + ModuleId.iUid = 0; } - CGetLoc *activeGetLoc = CGetLoc :: NewL(iPosServer , - aFieldList , - KGetLocationRequest, - aLocationInfoCategory ) ; - //after creation of each active object increment counter by 1 - - TInt err = activeGetLoc->GetLocation(aCallBackObj , aUpateOptions) ; - - if ( KErrNone == err ) - { + TInt err = KErrGeneral; + + CGetLoc* activeGetLoc = CGetLoc :: NewL(iPosServer , + aFieldList , + KGetLocationRequest, + aLocationInfoCategory, + ModuleId) ; + + err = activeGetLoc->GetLocationUpdates(this,aCallBackObj,aUpateOptions); - iIndex = KARRAY_INDEX_GETLOCATION; //for getlocation we are storing the pointer in 0th slot - iRegTable[KARRAY_INDEX_GETLOCATION] = activeGetLoc ; + if ( KErrNone == err ) + { + iRegTable.Append(activeGetLoc); } - - else + else { - delete activeGetLoc ; //Clean up - } - - return err; + delete activeGetLoc; //Clean up + User::Leave(err); + } } @@ -262,42 +298,46 @@ * Returns 0 on success and symbian specific error codes on failures */ -EXPORT_C TInt CLocationService :: TraceL( MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory, - TPositionFieldIdList aFiledList , - const TPositionUpdateOptions* aUpateOptions ) +EXPORT_C void CLocationService :: TraceL( MLocationCallBack* aCallBackObj , + TInt aLocationInfoCategory, + TPositionFieldIdList aFiledList , + const TPositionUpdateOptions* aUpateOptions, + TBool aEnableHighAcc ) { - - if(iRegTable[KARRAY_INDEX_TRACE]) //Return Error to user is the reg table slot is not free + TPositionModuleId ModuleId; + if(aEnableHighAcc) + { + GetHighAccuracyModuleL(&ModuleId); + if(ModuleId.iUid == NULL) + { + User::Leave(KErrGeneral); + } + } + else { - if(iRegTable[KARRAY_INDEX_TRACE]->IsAdded()) - { - return KErrInUse ; - } - //Reuse the existing inactive object - delete iRegTable[KARRAY_INDEX_TRACE] ; //Activate this asynchronous job - iRegTable[KARRAY_INDEX_TRACE] = NULL ; + //Indicates that when opening the subsession ,moudleId need not be specified + ModuleId.iUid = 0; + } + + CGetLoc* activeTrace = CGetLoc :: NewL(iPosServer , + aFiledList , + KTraceRequest, + aLocationInfoCategory, + ModuleId) ; + TInt ret = activeTrace->GetLocationUpdates(this,aCallBackObj , aUpateOptions); + + if (ret == KErrNone) + { + iRegTable.Append(activeTrace); + } + else + { + //Cleanup the allocated object + delete activeTrace; + User::Leave(ret); } - CGetLoc *activeTrace = CGetLoc :: NewL(iPosServer , - aFiledList , - KTraceRequest, - aLocationInfoCategory) ; - - TInt ret = activeTrace->GetLocationUpdates(aCallBackObj , aUpateOptions) ; - - if (ret == KErrNone) - { - iIndex = KARRAY_INDEX_TRACE; - iRegTable[KARRAY_INDEX_TRACE] = activeTrace ; - } - else - { //Cleanup the allocated object - delete activeTrace ; - } - - return ret; } /** @@ -339,8 +379,29 @@ * Synchronous function which returns users last known position */ -TInt CLocationService :: GetLastKnownLoc( TPosition& aResultPos ) +EXPORT_C TInt CLocationService :: GetLastKnownLoc( TPosition& aResultPos ) { + TInt error = iPositioner.Open(iPosServer); + + + // The opening of a subsession failed + if ( KErrNone != error ) + { + iPosServer.Close(); + return error ; + } + + //setting identity for this requestor + error = iPositioner.SetRequestor( CRequestor::ERequestorService, + CRequestor::EFormatApplication, + KIdentity ) ; + + if ( KErrNone != error ) + { + iPositioner.Close(); + return error ; + } + TRequestStatus Status = KRequestPending ; TPositionInfo posinfo ; TPositionInfoBase *posinfoBase = &posinfo ; @@ -348,7 +409,8 @@ iPositioner.GetLastKnownPosition(*posinfoBase,Status); User::WaitForRequest(Status); posinfo.GetPosition(aResultPos) ; - + + iPositioner.Close(); return Status.Int() ; } @@ -363,24 +425,79 @@ { if ( (aCancelparam == ECancelGetLocation ) || (aCancelparam == ECancelTrace)) { - CGetLoc* ptr = iRegTable[aCancelparam]; - if(iRegTable[aCancelparam]) + TInt i; + for( i = 0; i< iRegTable.Count(); i++) { - if(iRegTable[aCancelparam]->IsAdded()) + if(iRegTable[i] ) { - iRegTable[aCancelparam]->Deque() ; - } - if( ( aCancelparam == ECancelTrace ) ) - iRegTable[aCancelparam]->SetStatusComplete(); - delete iRegTable[aCancelparam] ; - iRegTable[aCancelparam] = NULL ; - return KErrNone; - } - return KErrNotFound ; + + if((((iRegTable[i]->GetCallBackobj())->GetRequestType()) == + KGetLocationReq) && (aCancelparam == ECancelGetLocation )) + { + if(iRegTable[i]->IsAdded()) + { + iRegTable[i]->Deque(); + } + + + delete iRegTable[i]; + iRegTable[i] = NULL; + return KErrNone; + } + else if ((((iRegTable[i]->GetCallBackobj())->GetRequestType()) == + KTraceReq) && (aCancelparam == ECancelTrace )) + { + if(iRegTable[i]->IsAdded()) + { + iRegTable[i]->Deque(); + } + + iRegTable[i]->SetStatusComplete(); + + delete iRegTable[i]; + iRegTable[i] = NULL; + return KErrNone; + } + } + } + return KErrNotFound; } return KErrArgument; - } +/** + * CancelService : Cancels Requested asynchronous requests, + * Input : TransactionId returned by the Async request, + * Returns success(KErrNone) if service canceled or else error if + * input parameter is invalid + */ +EXPORT_C TInt CLocationService::CancelService( TInt aTransId) + { + TInt i; + for( i = 0; i< iRegTable.Count(); i++) + { + if(iRegTable[i]) + { + if(aTransId == + (iRegTable[i]->GetCallBackobj())->GetTransactionId()) + { + if(iRegTable[i]->IsAdded()) + { + iRegTable[i]->Deque(); + } + if(((iRegTable[i]->GetCallBackobj())->GetRequestType()) == + KTraceReq) + { + iRegTable[i]->SetStatusComplete(); + } + delete iRegTable[i]; + iRegTable[i] = NULL; + return KErrNone; + } + } + } + + return KErrNotFound; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/src/locationcallBack.cpp --- a/serviceproviders/sapi_location/src/locationcallBack.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/src/locationcallBack.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -28,13 +28,13 @@ * Default constructor */ -LocationInterfaceCB ::LocationInterfaceCB() - { - iCallBack = NULL ; - iOutParmList = NULL ; - iInParmList = NULL ; - iTransactionId = 0 ; - } +LocationInterfaceCB ::LocationInterfaceCB():iCallBack(NULL), +iOutParmList(NULL), +iInParmList(NULL), +iTransactionId(0) + { + + } /** * OverLoaded constructor which accepts the callback adderss @@ -49,14 +49,6 @@ { iModuleInfo = aPositionModuleInfo ; - //Store the outparam and in param list - - iOutParmList = CLiwGenericParamList :: NewL(); //(*aOutParmList) ; - - - //Currently we dont use inputparam list, but when need it has to be - //initalised as done above for iOutParamList - iInParmList = iOutParmList ; //Extract the location info category from inputparamlist TInt index = 0; const TLiwGenericParam *smapparam = aInParmList->FindFirst(index , KLocationInfoCategory) ; @@ -78,6 +70,15 @@ } /** + * Default destructor + */ +LocationInterfaceCB :: ~LocationInterfaceCB() + { + + delete iOutParmList; + + } +/** * overloaded NewL function for creating local call back objects * as required by locationinterface.cpp */ @@ -89,7 +90,17 @@ { LocationInterfaceCB *self = new(ELeave) LocationInterfaceCB(aCallBack , aInParmList , aPositionModuleInfo, aTransactionid) ; + CleanupStack::PushL(self); + //Store the outparam and in param list + + self->iOutParmList = CLiwGenericParamList::NewL(); + + //Currently we dont use inputparam list, but when need it has to be + //initalised as done above for iOutParamList + self->iInParmList = self->iOutParmList; + + CleanupStack::Pop(self); return self ; } @@ -110,7 +121,6 @@ { iCallBack->HandleNotifyL(iTransactionId , KLiwEventError , *iOutParmList , *iInParmList) ; - iOutParmList = NULL ; //delete this ; return KErrGeneral ; } @@ -121,7 +131,6 @@ if(error != KErrNone) { iCallBack->HandleNotifyL(iTransactionId , KLiwEventError , *iOutParmList , *iInParmList) ; - iOutParmList = NULL ; //delete this ; return KErrGeneral ; } @@ -167,10 +176,23 @@ result->InsertL(KLatitudeKey , TLiwVariant((TReal)Val)) ; //Inserting latitude into map Val = pos.Altitude() ; + if (!(Math::IsNaN(Val))) + { + result->InsertL(KAltitudeKey , TLiwVariant((TReal)Val)) ; //Inserting altitude into map + } + //TLiwVariant resVar(result) ; + TReal32 Val1; + Val1 = pos.HorizontalAccuracy(); + if (!(Math::IsNaN(Val1))) + { + result->InsertL(KHorAccuracy, TLiwVariant((TReal)Val1)) ; + } - result->InsertL(KAltitudeKey , TLiwVariant((TReal)Val)) ; //Inserting altitude into map - //TLiwVariant resVar(result) ; - + Val1 = pos.VerticalAccuracy(); + if (!(Math::IsNaN(Val1))) + { + result->InsertL(KVerAccuracy, TLiwVariant((TReal)Val1)) ; + } TPositionModuleInfo :: TCapabilities currCapability = iModuleInfo->Capabilities() ; @@ -310,13 +332,5 @@ } -/** - * Default destructor - */ - - LocationInterfaceCB :: ~LocationInterfaceCB() - { - - delete iOutParmList; - - } + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/src/locationinterface.cpp --- a/serviceproviders/sapi_location/src/locationinterface.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/src/locationinterface.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -28,11 +28,6 @@ #include "locationerrormessage.hrh" using namespace LIW; -/** - * KMAXACTIVEOBJ identifies maximum number of entries in callback registration table - * presently it stores only two entries . - */ -const TInt KMAXACTIVEOBJ = 2; //Error code for bad time @@ -50,7 +45,6 @@ delete iLocationService ; - iLocationService = NULL ; for(TInt iter = 0 ; iter < iHandleCB.Count() ; ++iter) { @@ -66,22 +60,42 @@ * Default constructor */ - CLocationInterface :: CLocationInterface() +CLocationInterface::CLocationInterface() + { + //No Implementation Required Here + } +void CLocationInterface::ConstructL() { - iGenericPosInfo = HPositionGenericInfo :: NewL() ; - - if(!iGenericPosInfo) - { - User ::Leave(KErrNoMemory) ; - } - - - for ( TInt count = 0;count < KMAXACTIVEOBJ ; count++) - { - iHandleCB.Insert(NULL,count); - } - - + iGenericPosInfo = HPositionGenericInfo::NewL() ; + + if ( !iGenericPosInfo ) + { + User::Leave( KErrNoMemory ) ; + } + + iLocationService = CLocationService::NewL() ; + User::LeaveIfError( iLocationService->GetModuleInfo( iModuleInfo ) ); + User::LeaveIfError( this->SetSupportedFields() ); + } + + +/** + * This function is a static method to create iLocatinInterface object + * return pointer to constructed object else paincs with symbian painc + * code + */ + +CLocationInterface* CLocationInterface::NewL() + { + CLocationInterface* self = new(ELeave)CLocationInterface(); + + CleanupStack::PushL( self ) ; + + self->ConstructL(); + + CleanupStack::Pop( self ) ; + return self; + } TInt CLocationInterface::ConvertToSapiError(TInt aSymbianErr) { @@ -134,7 +148,11 @@ sapiErr = SErrMissingArgument; break; } - } + default: + { + sapiErr = SErrGeneralError; + } + } return sapiErr; @@ -156,8 +174,10 @@ aOutParamList.Reset() ; - - + /* + * To indicate position based parsing for all the parameters + */ + TBool posBasedFlag = EFalse; if( aCmdOptions & KLiwOptCancel ) // for cancel asynchronous request { @@ -184,8 +204,24 @@ } TInt32 transid = (transidparam->Value()).AsTInt32() ; - MLiwNotifyCallback* callBack = RequestCancel(transid) ; - + //Get Callback object curresponding to this transaction Id + MLiwNotifyCallback* callBack = NULL; + TInt ncalls = iHandleCB.Count() ; + + for (TInt iter = 0; iter < ncalls; ++iter) + { + + if (iHandleCB[iter]) + { + if (iHandleCB[iter]->GetTransactionId() == transid) + { + //Get the callback object associated with this Transaction Id + callBack = iHandleCB[iter]->GetCallBackobj(); + + } + } + + } if (!callBack) { aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, @@ -193,19 +229,30 @@ User::Leave(KErrNotFound); } - + //Cancel the exisiting request + User::LeaveIfError(iLocationService->CancelService(transid)); //Send notification about the cancelled state to consumer callBack->HandleNotifyL(transid , KLiwEventCanceled , aOutParamList, aInParamList) ; + } + //LastKnownLocation Request is made by consumer + else if (aCmdName == KCmdLastLocation) + { + //Extract Update options from input List + User::LeaveIfError(iLocationService->GetLastKnownLoc(iPosition)) ; + TUint category1 = EBasicInfo; + + iGenericPosInfo->SetPosition(iPosition); + GetLocationInfo(aOutParamList, category1) ; } //GetLocation request is made by consumer - else if(aCmdName == KCmdGetLocation) + else if( !( aCmdName.CompareF( KCmdGetLocation ) ) ) { TInt ret =KErrNone ; //Extract category of Location Information user is interested in @@ -239,6 +286,8 @@ User::Leave( KErrArgument ); //Leave with error code } + //indicates that position based parsing has been done + posBasedFlag = ETrue; posInfoCategory.Set( variant.AsDes() ); //Set infoFlag to indicate user has supplied category of location information @@ -267,11 +316,6 @@ //if callback is given for this command then it will be a async request if( aCallback && ( KLiwOptASyncronous & aCmdOptions ) ) { - LocationInterfaceCB *callback = LocationInterfaceCB :: NewL (aCallback , &aInParamList , - &iModuleInfo , transid) ; - CleanupStack :: PushL(callback) ; - - callback->SetRequestType(KGetLocationCB) ; //Extract Update options from input List @@ -284,7 +328,7 @@ if ( !smapparam ) { TInt count = aInParamList.Count(); - if (count == 2) + if ( count >= 2 && posBasedFlag ) { smapparam = &aInParamList[Index1]; if (smapparam) @@ -294,8 +338,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KGetLocationWrongupdateMap ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); } TInt error = SetUpdateOption(updateOptionVal,updateOptionMap); @@ -303,8 +345,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KGetLocationNegativeTime ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); } @@ -323,8 +363,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KGetLocationWrongupdateMap ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); } @@ -333,8 +371,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KGetLocationNegativeTime ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); @@ -345,8 +381,6 @@ aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KGetLocationBadUpdateOptions ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); @@ -366,28 +400,49 @@ //this indicates a wrong supplied location info category by the user aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, TLiwVariant(KGetLocationCategoryInfo))); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave(KErrArgument); } - //Extraction of update options and information complete so now send the request - //To core dll + //Extract EnableHighAccuracy param + index = 0; + const TLiwGenericParam* highaccparam = + aInParamList.FindFirst(index , KEnableHighAccuracy) ; + TBool enableHighAcc = false; + if ( KErrNotFound == index ) + { + highaccparam = 0; + TInt count = aInParamList.Count(); + if ( count >= 3 && posBasedFlag ) + { + //Possiblity of Position based parsing + highaccparam = &aInParamList[Index2]; + } + } - ret = iLocationService->GetLocationL(callback ,category,iFieldList,updateoptions) ; - - //aOutParamList.AppendL(TLiwGenericParam(KErrorCode , TLiwVariant((TInt32)ret))) ; - - if(KErrNone != ret) + if( highaccparam ) { - CleanupStack :: Pop(callback) ; - delete callback ; - User::Leave(ret); - + if((highaccparam->Value().TypeId()) == EVariantTypeTBool) + enableHighAcc = highaccparam->Value().AsTBool(); + + else + { + aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, + TLiwVariant(KGetLocationBadEnableHighAcc) ) ); + + User::Leave(KErrArgument); + } } - + LocationInterfaceCB* callback = + LocationInterfaceCB::NewL(aCallback, + &aInParamList, &iModuleInfo, transid) ; + + CleanupStack :: PushL(callback) ; + callback->SetRequestType(KGetLocationCB) ; + + iLocationService->GetLocationL(callback ,category, + iFieldList,updateoptions,enableHighAcc) ; //Store the allocatioed address - iHandleCB[KGetLocationCB] = callback ; + iHandleCB.Append(callback); //Append Transcationid to out list aOutParamList.AppendL(TLiwGenericParam(KTransactionId, TLiwVariant(transid))); CleanupStack :: Pop(callback) ; @@ -410,7 +465,7 @@ if ( !smapparam ) { TInt count = aInParamList.Count(); - if (count == 2) + if (count >= 2 && posBasedFlag) { smapparam = &aInParamList[Index1]; if (smapparam) @@ -495,15 +550,39 @@ TLiwVariant(KGetLocationCategoryInfo))); User::Leave(KErrArgument); } + //Extract Enable High accuracy param + index = 0; + const TLiwGenericParam* highaccparam = + aInParamList.FindFirst(index , + KEnableHighAccuracy) ; + TBool enableHighAcc = false; - ret = iLocationService->GetLocationL(iGenericPosInfo,updateOptions) ; - //aOutParamList.AppendL(TLiwGenericParam (KErrorCode , TLiwVariant((TInt32)ret))) ; - - if(KErrNone != ret) + if ( KErrNotFound == index ) + { + highaccparam = 0; + TInt count = aInParamList.Count(); + if (count >= 3 && posBasedFlag) + { + //Position based parsing to be done + highaccparam = &aInParamList[Index2]; + } + } + + if( highaccparam ) { - User::Leave(ret); - + if((highaccparam->Value().TypeId()) == EVariantTypeTBool) + enableHighAcc = highaccparam->Value().AsTBool(); + + else + { + aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, + TLiwVariant(KGetLocationBadEnableHighAcc) ) ); + User::Leave(KErrArgument); + } } + + iLocationService->GetLocationL(iGenericPosInfo, + updateOptions,enableHighAcc) ; GetLocationInfo(aOutParamList,category) ; @@ -514,7 +593,7 @@ } //End of KCmdGetLocation - else if( ( aCmdName == KCmdTraceLocation ) && ( aCallback ) && ( KLiwOptASyncronous & aCmdOptions ) ) //Trace request is made by consumer + else if( ( !(aCmdName.CompareF( KCmdTraceLocation )) ) && ( aCallback ) && ( KLiwOptASyncronous & aCmdOptions ) ) //Trace request is made by consumer { TInt ret = KErrNone ; @@ -546,6 +625,7 @@ posInfoCategory.Set( variant.AsDes() ); + posBasedFlag = ETrue; } } @@ -568,12 +648,6 @@ } - LocationInterfaceCB *callback = LocationInterfaceCB :: NewL (aCallback, - &aOutParamList, - &iModuleInfo, - transid ) ; - CleanupStack :: PushL(callback) ; - callback->SetRequestType(KTraceCB) ; @@ -588,7 +662,7 @@ if ( !smapparam ) { TInt count = aInParamList.Count(); - if (count == 2) + if (count >= 2 && posBasedFlag) { smapparam = &aInParamList[Index1]; if (smapparam) @@ -598,8 +672,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KTraceWrongupdateMap ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); } @@ -609,8 +681,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KTraceNegativeTime ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); } @@ -619,8 +689,6 @@ aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KTraceBadUpdateOptions ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); @@ -643,8 +711,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KGetLocationWrongupdateMap ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); } @@ -654,8 +720,6 @@ { aOutParamList.AppendL( TLiwGenericParam( KErrorMessage, TLiwVariant( KTraceNegativeTime ) ) ); - CleanupStack :: Pop( callback ) ; - delete callback; User::Leave( KErrArgument ); } @@ -684,31 +748,56 @@ aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, TLiwVariant(KTraceCategoryInfo))); - CleanupStack::Pop(callback); - delete callback; User::Leave(KErrArgument); } - - ret = iLocationService->TraceL(callback , catergory , iFieldList , updateOption ) ; - //TLiwGenericParam errorParm(KErrorCode , TLiwVariant((TInt32)ret)) ; - //aOutParamList.AppendL(errorParm) ; - - if(KErrNone != ret) + //Extract Enable High accuracy param + index = 0; + const TLiwGenericParam* highaccparam = aInParamList.FindFirst(index , + KEnableHighAccuracy) ; + TBool enableHighAcc = false; + if ( KErrNotFound == index ) { - CleanupStack :: Pop(callback) ; - delete callback ; - User::Leave(ret); + highaccparam = 0; + TInt count = aInParamList.Count(); + if (count >= 3 && posBasedFlag) + { + //Possibility of Position based parsing + highaccparam = &aInParamList[Index2]; + } } - - iHandleCB[KTraceCB] = callback ; - aOutParamList.AppendL(TLiwGenericParam (KTransactionId , TLiwVariant(transid))) ; //Append Transcationid to out list + if( highaccparam ) + { + if((highaccparam->Value().TypeId()) == EVariantTypeTBool) + enableHighAcc = highaccparam->Value().AsTBool(); + + else + { + aOutParamList.AppendL(TLiwGenericParam(KErrorMessage, + TLiwVariant(KGetLocationBadEnableHighAcc) ) ); + + User::Leave(KErrArgument); + } + } + + LocationInterfaceCB* callback = + LocationInterfaceCB::NewL(aCallback, + &aOutParamList, &iModuleInfo, transid) ; + CleanupStack :: PushL(callback) ; + callback->SetRequestType(KTraceCB) ; + + + iLocationService->TraceL( callback, catergory,iFieldList, + updateOption,enableHighAcc ); + iHandleCB.Append(callback); + aOutParamList.AppendL(TLiwGenericParam(KTransactionId, + TLiwVariant(transid))) ; //Append Transcationid to out list CleanupStack :: Pop(callback) ; } //End of KCmdTraceLocation - else if(aCmdName == KCmdCancelRequest) //Cancel request is made by consumer + else if(!( aCmdName.CompareF( KCmdCancelRequest ) ) ) //Cancel request is made by consumer { TInt index = 0 ; @@ -753,15 +842,25 @@ ret = iLocationService->CancelOnGoingService(ECancelTrace) ; - if(KErrNone == ret) ; + if (KErrNone == ret) { - delete iHandleCB[KTraceCB] ; - iHandleCB[KTraceCB] = NULL ; //Mark the slot as free + TInt ncal = iHandleCB.Count() ; + + for (TInt iter = 0; iter < ncal; ++iter) + { + if (iHandleCB[iter]) + { + if(iHandleCB[iter]->GetRequestType() == KTraceCB) + { + delete iHandleCB[iter]; + iHandleCB[iter] = NULL; + break; + } + } + } + } - - } - else if(requesttype == KRequestGetLoc ) { @@ -769,8 +868,22 @@ if(!ret) { - delete iHandleCB[KGetLocationCB] ; - iHandleCB[KGetLocationCB] = NULL ; //Mark the slot as free + TInt ncal1 = iHandleCB.Count() ; + + for (TInt iter = 0; iter < ncal1; ++iter) + { + + if (iHandleCB[iter]) + { + + if(iHandleCB[iter]->GetRequestType() == KGetLocationCB) + { + delete iHandleCB[iter]; + iHandleCB[iter] = NULL; + break; + } + } + } } } @@ -788,7 +901,7 @@ } //End of KCmdCancelRequest - else if(aCmdName == KRequestCalculate) + else if(( !aCmdName.CompareF(KRequestCalculate) ) ) { TInt index = 0 ; //Flag set to 0 indicate no position based parsing need to be done @@ -1249,10 +1362,23 @@ TReal32 altitude = pos.Altitude() ; - + if (!(Math::IsNaN(altitude))) + { Result->InsertL(KAltitudeKey , TLiwVariant((TReal)altitude)) ; + } - + TReal32 Val1; + Val1 = pos.HorizontalAccuracy(); + if (!(Math::IsNaN(Val1))) + { + Result->InsertL(KHorAccuracy, TLiwVariant((TReal)Val1)) ; + } + + Val1 = pos.VerticalAccuracy(); + if (!(Math::IsNaN(Val1))) + { + Result->InsertL(KVerAccuracy, TLiwVariant((TReal)Val1)) ; + } TLiwVariant MapVariant(Result) ; @@ -1393,71 +1519,7 @@ } -/** - * Function CLocationInterface :: RequestCancel is used to cancel the pending async request if - * returns the cancell status success if transaction id is valid else KErrGeneral error. - */ -MLiwNotifyCallback* CLocationInterface :: RequestCancel(TInt32 aTranactionId/*,MLiwNotifyCallback** aCallBack*/) - { - TInt ncalls = iHandleCB.Count() ; - - for(TInt iter = 0 ; iter < ncalls ; ++iter ) - { - - if( iHandleCB[iter] ) - { - if(iHandleCB[iter]->GetTransactionId() == aTranactionId) - { - TInt requestType = iHandleCB[iter]->GetRequestType() ; - TInt cancelType = ECancelGetLocation ; - - - if(requestType == KTraceCB) - { - cancelType = ECancelTrace ; - } - iLocationService->CancelOnGoingService(cancelType ) ; - - MLiwNotifyCallback* callobj = iHandleCB[iter]->GetCallBackobj(); - - return( callobj ) ; - } - } - - } - - //No TransactionId Match found, return Error - return NULL ; - } - - /** - * This function is a static method to create iLocatinInterface object - * return pointer to constructed object else paincs with symbian painc - * code - */ - - CLocationInterface * CLocationInterface :: NewL() - { - CLocationInterface *self = new(ELeave)CLocationInterface() ; - - - - - CleanupStack :: PushL(self) ; - self->iLocationService = CLocationService :: NewL() ; - TInt error = (self->iLocationService)->GetModuleInfo(self->iModuleInfo) ; - - - User :: LeaveIfError(error) ; - - error = (self->SetSupportedFields()) ; - - User :: LeaveIfError(error) ; - CleanupStack :: Pop(self) ; - return self ; - - } /** * Function : ExecuteCmdL , called directly by consumer, parses the input parameters and @@ -1484,36 +1546,6 @@ - /** - * Function: ConvertPosToGenricList puts the latitude, longitude and altitude information - * into generic parmater list - * This is an internal utility function - */ - - void CLocationInterface :: ConvertPosToGenricListL( TPosition& aPos , CLiwGenericParamList& aOutList ) - { - CLiwDefaultMap *Result = CLiwDefaultMap::NewL() ; - TReal64 Val = aPos.Longitude() ; - - Result->InsertL(KLongitudeKey , TLiwVariant((TReal)Val)) ; //Inserting latitude - - Val = aPos.Latitude() ; - Result->InsertL(KLatitudeKey , TLiwVariant((TReal)Val)) ; //Inserting latitude - - TReal32 altitude = aPos.Altitude() ; - - - Result->InsertL(KAltitudeKey , TLiwVariant((TReal)altitude)) ; //Inserting altitude - - //Now Push this map into outparm list - TLiwVariant MapVariant(Result) ; - - TLiwGenericParam outParm(KLocationMap , TLiwVariant(MapVariant)) ; - // outParm.SetSemanticId(EGenericParamLocation) ; - aOutList.AppendL(outParm) ; - Result->DecRef(); - - } /** * Internal function which is used to extract the coordinates from CLiwMap passed by consumer diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/conf/tlocationprovidertest.cfg --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/conf/tlocationprovidertest.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/conf/tlocationprovidertest.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -223,4 +223,186 @@ create tlocationprovidertest foobar foobar CancelTwice delete foobar -[Endtest] \ No newline at end of file +[Endtest] +[Test] +title GetLastLocation +create tlocationprovidertest foobar +foobar GetLastLocation +delete foobar +[Endtest] + +[Test] +title GetLocationMultiple +create tlocationprovidertest foobar +foobar GetLocationMultiple +delete foobar +[Endtest] + + +[Test] +title TraceMultiple +create tlocationprovidertest foobar +foobar TraceMultiple +delete foobar +[Endtest] + + +[Test] +title TraceTimeOut +create tlocationprovidertest foobar +foobar TraceTimeOut +delete foobar +[Endtest] + + +[Test] +title TraceMultipleWrongCancel +create tlocationprovidertest foobar +foobar TraceMultipleWrongCancel +delete foobar +[Endtest] + + +[Test] +title EnableAccTrueGetLoc +create tlocationprovidertest foobar +foobar EnableAccTrueGetLoc +delete foobar +[Endtest] + + +[Test] +title EnableAccFalseGetLoc +create tlocationprovidertest foobar +foobar EnableAccFalseGetLoc +delete foobar +[Endtest] + +[Test] +title EnableAccTrueTrace +create tlocationprovidertest foobar +foobar EnableAccTrueTrace +delete foobar +[Endtest] + +[Test] +title EnableAccFalseTrace +create tlocationprovidertest foobar +foobar EnableAccFalseTrace +delete foobar +[Endtest] + + +[Test] +title EnableAccPosBasedGetloc +create tlocationprovidertest foobar +foobar EnableAccPosBasedGetloc +delete foobar +[Endtest] + + +[Test] +title EnableAccPosBasedWrongTypeGetloc +create tlocationprovidertest foobar +foobar EnableAccPosBasedWrongTypeGetloc +delete foobar +[Endtest] + + +[Test] +title EnableAccPosBasedTrace +create tlocationprovidertest foobar +foobar EnableAccPosBasedTrace +delete foobar +[Endtest] + + +[Test] +title EnableAccPosBasedWrongTypeTrace +create tlocationprovidertest foobar +foobar EnableAccPosBasedWrongTypeTrace +delete foobar +[Endtest] + + +[Test] +title CancelWithoutTransId +create tlocationprovidertest foobar +foobar CancelWithoutTransId +delete foobar +[Endtest] + +[Test] +title CancelTransIdPosBased +create tlocationprovidertest foobar +foobar CancelTransIdPosBased +delete foobar +[Endtest] + + +[Test] +title GetLocationAsyncPosBasedUpdate +create tlocationprovidertest foobar +foobar GetLocationAsyncPosBasedUpdate +delete foobar +[Endtest] + + +[Test] +title GetLocationPosBasedWrongVal +create tlocationprovidertest foobar +foobar GetLocationPosBasedWrongVal +delete foobar +[Endtest] + + +[Test] +title GetLocationAsyncWrongUpdate +create tlocationprovidertest foobar +foobar GetLocationAsyncWrongUpdate +delete foobar +[Endtest] + + +[Test] +title GetLocPosBasedWrongVal +create tlocationprovidertest foobar +foobar GetLocPosBasedWrongVal +delete foobar +[Endtest] + +[Test] +title TracePosBasedWrongVal +create tlocationprovidertest foobar +foobar TracePosBasedWrongVal +delete foobar +[Endtest] + +[Test] +title FindDistancePositionBased +create tlocationprovidertest foobar +foobar FindDistancePositionBased +delete foobar +[Endtest] + +[Test] +title TracePosBasedUpdateWrongVal +create tlocationprovidertest foobar +foobar TracePosBasedUpdateWrongVal +delete foobar +[Endtest] + +[Test] +title TracePosBasedUpdateOpts +create tlocationprovidertest foobar +foobar TracePosBasedUpdateOpts +delete foobar +[Endtest] + + +[Test] +title MoveCoordinatePosBased +create tlocationprovidertest foobar +foobar MoveCoordinatePosBased +delete foobar +[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/eabi/tcompluginu.def --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/eabi/tcompluginu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/eabi/tcompluginu.def Thu Aug 27 07:43:07 2009 +0300 @@ -14,4 +14,10 @@ _ZTI18ConcurrentTraceLoc @ 13 NONAME ; ## _ZTV16ConcurrentGetLoc @ 14 NONAME ; ## _ZTV18ConcurrentTraceLoc @ 15 NONAME ; ## + _ZTI10TOTraceLoc @ 16 NONAME ; ## + _ZTI11ASyncLocCBF @ 17 NONAME ; ## + _ZTI18EnableHighAccClass @ 18 NONAME ; ## + _ZTV10TOTraceLoc @ 19 NONAME ; ## + _ZTV11ASyncLocCBF @ 20 NONAME ; ## + _ZTV18EnableHighAccClass @ 21 NONAME ; ## diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/group/tlocationprovidertest.mmp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/group/tlocationprovidertest.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/group/tlocationprovidertest.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -48,6 +48,7 @@ SOURCE ttracelocwrongcancel.cpp SOURCE tgetlocationcancel.cpp SOURCE ttracelocationcancel.cpp +SOURCE TraceTO.cpp tenableHighAcc.cpp //RESOURCE resource_file //RESOURCE resource_file2 @@ -63,7 +64,7 @@ LIBRARY efsrv.lib LIBRARY lbs.lib - +EPOCALLOWDLLDATA LANG SC /* diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/inc/tcomplugin.h --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/inc/tcomplugin.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/inc/tcomplugin.h Thu Aug 27 07:43:07 2009 +0300 @@ -243,6 +243,34 @@ virtual TInt TestWrongInterfaceName(CStifItemParser& /*aItem*/) ; virtual TInt TestAllApi(CStifItemParser& /*aItem*/) ; virtual TInt CancelTwice(CStifItemParser& /*aItem*/) ; + virtual TInt GetLastLocation(CStifItemParser& /*aItem*/) ; + virtual TInt GetLocationMultiple(CStifItemParser& /*aItem*/) ; + virtual TInt TraceMultiple(CStifItemParser& /*aItem*/) ; + virtual TInt TraceTimeOut(CStifItemParser& /*aItem*/) ; + virtual TInt TraceMultipleWrongCancel(CStifItemParser& /*aItem*/); + virtual TInt EnableAccTrueGetLoc(CStifItemParser& /*aItem*/); + virtual TInt EnableAccFalseGetLoc(CStifItemParser& /*aItem*/); + virtual TInt EnableAccTrueTrace(CStifItemParser& /*aItem*/); + virtual TInt EnableAccFalseTrace(CStifItemParser& /*aItem*/); + + virtual TInt EnableAccPosBasedGetloc(CStifItemParser& /*aItem*/); + virtual TInt EnableAccPosBasedWrongTypeGetloc(CStifItemParser& /*aItem*/); + virtual TInt EnableAccPosBasedTrace(CStifItemParser& /*aItem*/); + virtual TInt EnableAccPosBasedWrongTypeTrace(CStifItemParser& /*aItem*/); + + virtual TInt GetLocationPosBasedWrongVal(CStifItemParser& /*aItem*/); + virtual TInt CancelTransIdPosBased(CStifItemParser& /*aItem*/); + virtual TInt CancelWithoutTransId(CStifItemParser& /*aItem*/); + virtual TInt GetLocationAsyncPosBasedUpdate(CStifItemParser& /*aItem*/); + virtual TInt GetLocationAsyncWrongUpdate(CStifItemParser& /*aItem*/); + virtual TInt GetLocPosBasedWrongVal(CStifItemParser& /*aItem*/); + virtual TInt GetLocPosBasedWrongVal1(CStifItemParser& /*aItem*/); + virtual TInt TracePosBasedWrongVal( CStifItemParser& /*aItem*/ ); + virtual TInt TracePosBasedUpdateOpts(CStifItemParser& /*aItem*/); + virtual TInt TracePosBasedUpdateWrongVal(CStifItemParser& /*aItem*/); + virtual TInt FindDistancePositionBased(CStifItemParser& /*aItem*/); + virtual TInt MoveCoordinatePosBased(CStifItemParser& /*aItem*/); + virtual TInt FindBearingPosBased(CStifItemParser& /*aItem*/); public: // Data // ?one_line_short_description_of_data //?data_declaration; @@ -281,6 +309,17 @@ TInt GetLocCancel(TAny */*Arg*/); TInt TraceLocCancel(TAny */*Arg*/); + TInt TraceTO(TAny */*Arg*/); + TInt TraceTOL(TAny */*Arg*/); + TInt EnableHighAcc(TAny *aFlag); + TInt EnableHighAccL(TInt aCallType,TBool enableAcc); + TInt EnableHighAcc_PosBased(TAny *aFlag); + TInt EnableHighAcc_PosBasedL(TInt aCallType,TBool enableAcc); + + TInt GetLocAsynchPosBased(TAny * /*Arg*/); + TInt GetLocAsynchPosBasedL(); + TInt GetLocAsynchWrongVal(TAny * /*Arg*/); + TInt GetLocAsynchWrongValL(); #endif // TCOMPLUGIN_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/TraceTO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/TraceTO.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,232 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +/* + * Stray signal test function + */ + +#include +#include +#include +#include +#include +#include + + + #include "tcomplugin.h" + + + +class TOTraceLoc : public MLiwNotifyCallback +{ + + MLiwInterface *iLocationInterface ; + CLiwGenericParamList *iInputList ; + TInt cnt; + public : + TInt iRetStatus ; + + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList) ; + + TOTraceLoc() : iRetStatus(KErrGeneral),cnt(0) //Default constructor + { + ; + } + TOTraceLoc(TInt aCmd , MLiwInterface *aInterface , CLiwGenericParamList *aInputList) ; +}; + + +TOTraceLoc :: TOTraceLoc(TInt aCmd ,MLiwInterface *aInterface , CLiwGenericParamList *aInputList) +{ + cnt = 0; + iLocationInterface = aInterface ; + iInputList = aInputList ; + +} + +TInt TOTraceLoc :: HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList) +{ + +//DeRefrence Allocated Map first + cnt++; + TInt trid = aCmdId; + + if(cnt == 4) + { + + CActiveScheduler::Stop(); + } + return 0 ; +} + + +TInt TraceTOL() +{ +__UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; + + if(!Scheduler) + { + Scheduler = new CActiveScheduler ; + } + + + CActiveScheduler :: Install(Scheduler) ; + + + + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; +/* + if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create log file\n") ; + + return KErrGeneral ; + } + + } + */ + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + // LogFile.Write(data) ; + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KTraceLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + TOTraceLoc* callBack = new(ELeave) TOTraceLoc; + + //Appending update options + CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); + + TInt32 updateInterval = 2; + + updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); + + TInt32 updateTimeOut = 3; + updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); + + TInt32 updateMaxAge = 1; + updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); + + TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); + inputlist->AppendL(updateOption) ; + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + CActiveScheduler::Start(); + pos = 0 ; + + //const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + delete updateoptionMap; + delete callBack; + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + +} + + +TInt TraceTO(TAny */*Arg*/) +{ + + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt Val ; + //Install a new active scheduler to this thread + TRAPD(err ,( Val = TraceTOL()) ); + delete cleanup ; + + if(err) + { + return err ; + } + return Val ; +} + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tcompluginblocks.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tcompluginblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tcompluginblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -89,8 +89,31 @@ ENTRY("TestWrongInterfaceName" , CTestProvider :: TestWrongInterfaceName), ENTRY("TestAllApi" , CTestProvider :: TestAllApi), ENTRY("CancelTwice" , CTestProvider :: CancelTwice), - - + ENTRY("GetLastLocation" , CTestProvider :: GetLastLocation), + ENTRY("GetLocationMultiple" , CTestProvider :: GetLocationMultiple), + ENTRY("TraceMultiple" , CTestProvider :: TraceMultiple), + ENTRY("TraceTimeOut" , CTestProvider :: TraceTimeOut), + ENTRY("TraceMultipleWrongCancel", CTestProvider::TraceMultipleWrongCancel), + ENTRY("EnableAccTrueGetLoc", CTestProvider::EnableAccTrueGetLoc), + ENTRY("EnableAccFalseGetLoc", CTestProvider::EnableAccFalseGetLoc), + ENTRY("EnableAccTrueTrace", CTestProvider::EnableAccTrueTrace), + ENTRY("EnableAccFalseTrace", CTestProvider::EnableAccFalseTrace), + ENTRY("EnableAccPosBasedGetloc", CTestProvider::EnableAccPosBasedGetloc), + ENTRY("EnableAccPosBasedWrongTypeGetloc", CTestProvider::EnableAccPosBasedWrongTypeGetloc), + ENTRY("EnableAccPosBasedTrace", CTestProvider::EnableAccPosBasedTrace), + ENTRY("EnableAccPosBasedWrongTypeTrace", CTestProvider::EnableAccPosBasedWrongTypeTrace), + + ENTRY("CancelWithoutTransId" , CTestProvider ::CancelWithoutTransId), + ENTRY("CancelTransIdPosBased", CTestProvider::CancelTransIdPosBased), + ENTRY("GetLocationAsyncPosBasedUpdate" , CTestProvider ::GetLocationAsyncPosBasedUpdate), + ENTRY("GetLocationPosBasedWrongVal", CTestProvider::GetLocationPosBasedWrongVal), + ENTRY("GetLocationAsyncWrongUpdate" ,CTestProvider::GetLocationAsyncWrongUpdate), + ENTRY("GetLocPosBasedWrongVal" , CTestProvider ::GetLocPosBasedWrongVal), + ENTRY("TracePosBasedWrongVal" , CTestProvider ::TracePosBasedWrongVal), + ENTRY("TracePosBasedUpdateOpts" , CTestProvider ::TracePosBasedUpdateOpts), + ENTRY("TracePosBasedUpdateWrongVal" , CTestProvider ::TracePosBasedUpdateWrongVal), + ENTRY("FindDistancePositionBased" ,CTestProvider ::FindDistancePositionBased), + ENTRY("MoveCoordinatePosBased",CTestProvider::MoveCoordinatePosBased) }; const TInt count = sizeof( KFunctions ) / @@ -103,7 +126,7 @@ class ASyncLocCBF : public MLiwNotifyCallback { - + TInt cnt; public : TInt iRetStatus ; @@ -115,7 +138,7 @@ ASyncLocCBF() : iRetStatus(KErrGeneral) //Default constructor { - ; + cnt = 0; } }; @@ -125,6 +148,7 @@ CLiwGenericParamList& aEventParamList, const CLiwGenericParamList& aInParamList) { + cnt++; return 0; } @@ -276,291 +300,291 @@ } TInt CTestProvider :: TestAllApi( CStifItemParser& /*aItem*/ ) - { - __UHEAP_MARK ; - TInt start = User::CountAllocCells(); - RFile LogFile ; - RFs LogSession ; - TBuf8<50> data ; - TRealFormat format ; - - - if(LogSession.Connect() != KErrNone) - { - _LIT(KLog , "Failed to connect to file server") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - - - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) - { - _LIT(KLog , "Failed to create notifications log file") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - } - - _LIT(KLog , "In CTGetLocation") ; - iLog->Log(KLog) ; - - + { + __UHEAP_MARK ; + TInt start = User::CountAllocCells(); + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - _LIT(KLog , "Interface not found"); - iLog->Log(KLog) ; - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; - + outputlist->Reset() ; inputlist->Reset() ; _LIT(KClass,"GenericLocationInfo"); inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant(KClass ) ) ); //inputlist->AppendL(TLiwGenericParam(NULL)); CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); - - _LIT8(KInterval,"UpdateInterval"); - _LIT8(KTimeout,"UpdateTimeOut"); - _LIT8(KAge,"UpdateMaxAge"); - _LIT8(KPartial,"PartialUpdates"); - const TInt KTime = 1000000; - + + _LIT8(KInterval,"UpdateInterval"); + _LIT8(KTimeout,"UpdateTimeOut"); + _LIT8(KAge,"UpdateMaxAge"); + _LIT8(KPartial,"PartialUpdates"); + const TInt KTime = 1000000; + updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); - + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); updatemap->DecRef(); - - - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - _LIT(Klog, "Success/Failure state not known") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - if((ErrorParm->Value()).AsTInt32() ) - { - _LIT(KLog , "ExecutecmdL failed "); - iLog->Log(KLog) ; - return (ErrorParm->Value()).AsTInt32() ; - } - - - - TInt index = 0 ; - - const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); - - - if(!GenericParam) - { - _LIT(Klog, "Out Param not found") ; - iLog->Log(Klog) ; - return KErrGeneral ; //Param Error - } - - TLiwVariant Variant ; - - Variant = GenericParam->Value() ; - const CLiwMap *LocMap = Variant.AsMap() ; - - TLiwVariant PosVariant ; - - LocMap->FindL(KLongitudeKey , PosVariant) ; - TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude - data.Num(LongData , format) ; - LogFile.Write(_L8("\n")) ; - LogFile.Write(_L8("Logitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude - - TReal64 LatData = (TReal64)PosVariant.AsTReal() ; - data.Num(LatData , format) ; - LogFile.Write(_L8(" Latitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude - TReal32 AltData = PosVariant.AsTReal() ; - data.Num(AltData , format) ; - - LogFile.Write(_L8(" Altitude = ")) ; - LogFile.Write(data) ; - - - - //Test Calculate - //TBuf8<20>CmdBufSet(KRequestCalculate) ; - outputlist->Reset() ; - inputlist->Reset() ; - - //CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestDistance)) ; - inputlist->AppendL(requesttype) ; - - - - //Inserting first input param - CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); - TReal64 slongitude = 71.03; - SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); - TReal64 slatitude = 42.37; - SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); - - TReal64 saltitude = 1; - SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); - - - TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); - inputlist->AppendL(scoordinate) ; - SourceCoordinate->DecRef() ; - - - - //Inserting 2nd input param - CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); - TReal64 dlongitude = 83.02; - DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); - TReal64 dlatitude = 42.42; - DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); - - TReal64 daltitude = 1; - DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(daltitude)); - - - TLiwGenericParam dcoordinate(KDistanceParmDestination,TLiwVariant(DestCoordinate)); - inputlist->AppendL(dcoordinate) ; - DestCoordinate->DecRef() ; - - //CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - TBuf8<20>CmdBufSet(KRequestCalculate) ; - - locinterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist); - - - pos = 0; - const TLiwGenericParam* param = outputlist->FindFirst(pos, KErrorCode); - - if((param->Value()).AsTInt32() ) - { - _LIT(KLog , "Calculate failed "); - iLog->Log(KLog) ; - return (ErrorParm->Value()).AsTInt32() ; - } - - pos = 0; - const TLiwGenericParam* paramb = outputlist->FindFirst(pos, KErrorCode); - - if((paramb->Value()).AsTInt32() ) - { - _LIT(KLog , "Calculate failed "); - iLog->Log(KLog) ; - return (paramb->Value()).AsTInt32() ; - } - pos = 0; - const TLiwGenericParam* resultparam = outputlist->FindFirst(pos, KMathOpResult); - TLiwVariant resultvariant = resultparam->Value(); - TReal64 distance = resultvariant.AsTReal(); - - //Test Calculate done - - LogFile.Close() ; - LogSession.Close() ; - - - locinterface->Close() ; - outputlist->Reset() ; + + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() ) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + return (ErrorParm->Value()).AsTInt32() ; + } + + + + TInt index = 0 ; + + const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); + + + if(!GenericParam) + { + _LIT(Klog, "Out Param not found") ; + iLog->Log(Klog) ; + return KErrGeneral ; //Param Error + } + + TLiwVariant Variant ; + + Variant = GenericParam->Value() ; + const CLiwMap *LocMap = Variant.AsMap() ; + + TLiwVariant PosVariant ; + + LocMap->FindL(KLongitudeKey , PosVariant) ; + TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude + data.Num(LongData , format) ; + LogFile.Write(_L8("\n")) ; + LogFile.Write(_L8("Logitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude + + TReal64 LatData = (TReal64)PosVariant.AsTReal() ; + data.Num(LatData , format) ; + LogFile.Write(_L8(" Latitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude + TReal32 AltData = PosVariant.AsTReal() ; + data.Num(AltData , format) ; + + LogFile.Write(_L8(" Altitude = ")) ; + LogFile.Write(data) ; + + + + //Test Calculate + //TBuf8<20>CmdBufSet(KRequestCalculate) ; + outputlist->Reset() ; inputlist->Reset() ; - - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - TInt end = User::CountAllocCells(); - -__UHEAP_MARKEND ; - return KErrNone ; - - - - - } + + //CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestDistance)) ; + inputlist->AppendL(requesttype) ; + + + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 71.03; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 42.37; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); + + + TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); + inputlist->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + //Inserting 2nd input param + CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); + TReal64 dlongitude = 83.02; + DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); + TReal64 dlatitude = 42.42; + DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); + + TReal64 daltitude = 1; + DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(daltitude)); + + + TLiwGenericParam dcoordinate(KDistanceParmDestination,TLiwVariant(DestCoordinate)); + inputlist->AppendL(dcoordinate) ; + DestCoordinate->DecRef() ; + + //CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + TBuf8<20>CmdBufSet(KRequestCalculate) ; + + locinterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist); + + + pos = 0; + const TLiwGenericParam* param = outputlist->FindFirst(pos, KErrorCode); + + if((param->Value()).AsTInt32() ) + { + _LIT(KLog , "Calculate failed "); + iLog->Log(KLog) ; + return (ErrorParm->Value()).AsTInt32() ; + } + + pos = 0; + const TLiwGenericParam* paramb = outputlist->FindFirst(pos, KErrorCode); + + if((paramb->Value()).AsTInt32() ) + { + _LIT(KLog , "Calculate failed "); + iLog->Log(KLog) ; + return (paramb->Value()).AsTInt32() ; + } + pos = 0; + const TLiwGenericParam* resultparam = outputlist->FindFirst(pos, KMathOpResult); + TLiwVariant resultvariant = resultparam->Value(); + TReal64 distance = resultvariant.AsTReal(); + + //Test Calculate done + + LogFile.Close() ; + LogSession.Close() ; + + + locinterface->Close() ; + outputlist->Reset() ; + inputlist->Reset() ; + + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + TInt end = User::CountAllocCells(); + + __UHEAP_MARKEND ; + return KErrNone ; + + + + + } TInt CTestProvider :: TestWrongInterfaceName( CStifItemParser& /*aItem*/ ) - { - __UHEAP_MARK; - - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + { + __UHEAP_MARK; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); @@ -580,8 +604,8 @@ ServiceHandler->AttachL(a) ; ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - + + TInt pos = 0; @@ -594,16 +618,17 @@ TInt error = (errorprm->Value()).AsTInt32(); delete ServiceHandler; a.ResetAndDestroy() ; - a.Close() ; - - return KErrNone; - __UHEAP_MARKEND; - } + a.Close() ; + __UHEAP_MARKEND; + + return KErrNone; + } + TInt CTestProvider :: TraceNegativeUpdateoption( CStifItemParser& /*aItem*/ ) - { - __UHEAP_MARK; - ASyncLocCBF callback; - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + { + __UHEAP_MARK; + ASyncLocCBF callback; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); @@ -623,8 +648,8 @@ ServiceHandler->AttachL(a) ; ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - + + TInt pos = 0; @@ -645,75 +670,75 @@ } MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - TBuf8<20>CmdBuf(KCmdGetLocation) ; - - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - //Append LocationInformation Category - TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; - InputList->AppendL(informationCategory) ; - - //Appending update options - CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); - - TInt32 updateInterval = 30000; - + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + //Append LocationInformation Category + TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; + InputList->AppendL(informationCategory) ; + + //Appending update options + CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); + + TInt32 updateInterval = 30000; + updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); - - TInt32 updateTimeOut = -10000; - updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); - - TInt32 updateMaxAge = 2000; - updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); - - TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); - InputList->AppendL(updateOption) ; - updateoptionMap->DecRef(); - - CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList,KLiwOptASyncronous,&callback); - - - - - pos = 0; - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - - return KErrGeneral ; - } - TInt error = (ErrorParm->Value()).AsTInt32(); - if( SErrBadArgumentType == error ) - { - error = KErrNone; - - - } - locinterface->Close() ; - outputlist->Reset() ; + + TInt32 updateTimeOut = -10000; + updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); + + TInt32 updateMaxAge = 2000; + updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); + + TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); + InputList->AppendL(updateOption) ; + updateoptionMap->DecRef(); + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList,KLiwOptASyncronous,&callback); + + + + + pos = 0; + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + + return KErrGeneral ; + } + TInt error = (ErrorParm->Value()).AsTInt32(); + if( SErrBadArgumentType == error ) + { + error = KErrNone; + + + } + locinterface->Close() ; + outputlist->Reset() ; inputlist->Reset() ; - delete ServiceHandler ; - delete OutParmList; - delete InputList; - a.ResetAndDestroy() ; - a.Close() ; - __UHEAP_MARKEND ; - return error; - - - - - } + delete ServiceHandler ; + delete OutParmList; + delete InputList; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return error; + + + + + } TInt CTestProvider :: GetLocNegativeUpdateoption( CStifItemParser& /*aItem*/ ) - { - __UHEAP_MARK; - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + { + __UHEAP_MARK; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); @@ -733,8 +758,8 @@ ServiceHandler->AttachL(a) ; ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - + + TInt pos = 0; @@ -755,2311 +780,2319 @@ } MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - TBuf8<20>CmdBuf(KCmdGetLocation) ; - - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - //Append LocationInformation Category - TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; - InputList->AppendL(informationCategory) ; - - //Appending update options - CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); - - TInt32 updateInterval = 30000; - + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + //Append LocationInformation Category + TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; + InputList->AppendL(informationCategory) ; + + //Appending update options + CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); + + TInt32 updateInterval = 30000; + updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); - - TInt32 updateTimeOut = -10000; - updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); - - TInt32 updateMaxAge = 2000; - updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); - - TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); - InputList->AppendL(updateOption) ; - updateoptionMap->DecRef(); - - CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - - - locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); - - - pos = 0; - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - - return KErrGeneral ; - } - TInt error = (ErrorParm->Value()).AsTInt32(); - if( SErrBadArgumentType == error ) - { - error = KErrNone; - - - } - locinterface->Close() ; - delete ServiceHandler ; - delete OutParmList; - delete InputList; - a.ResetAndDestroy() ; - a.Close() ; - __UHEAP_MARKEND ; - return error; - - - - - } + + TInt32 updateTimeOut = -10000; + updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); + + TInt32 updateMaxAge = 2000; + updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); + + TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); + InputList->AppendL(updateOption) ; + updateoptionMap->DecRef(); + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); + + + pos = 0; + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + + return KErrGeneral ; + } + TInt error = (ErrorParm->Value()).AsTInt32(); + if( SErrBadArgumentType == error ) + { + error = KErrNone; + + + } + locinterface->Close() ; + delete ServiceHandler ; + delete OutParmList; + delete InputList; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return error; + + + + + } TInt CTestProvider :: GetLocationWrongInfoClass( CStifItemParser& /*aItem*/ ) - { - __UHEAP_MARK ; - - + { + __UHEAP_MARK ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; - + outputlist->Reset() ; inputlist->Reset() ; _LIT8(KClass,"LocationInformationClass"); _LIT(KClassArg,"Invalid"); inputlist->AppendL(TLiwGenericParam(KClass,TLiwVariant(KClassArg))); - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - - return KErrGeneral ; - } - TInt error = (ErrorParm->Value()).AsTInt32(); - if( SErrBadArgumentType == error ) - { - error = KErrNone; - - - } - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - __UHEAP_MARKEND ; - return error; - - } + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + + return KErrGeneral ; + } + TInt error = (ErrorParm->Value()).AsTInt32(); + if( SErrBadArgumentType == error ) + { + error = KErrNone; + + + } + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return error; + + } TInt CTestProvider :: TraceWrongInfoClass( CStifItemParser& /*aItem*/ ) - { - __UHEAP_MARK ; - TInt start = User::CountAllocCells(); - ASyncLocCBF callback; - - + { + __UHEAP_MARK ; + TInt start = User::CountAllocCells(); + ASyncLocCBF callback; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + ServiceHandler->AttachL(a) ; + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + TInt pos = 0; + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + pos = 0 ; - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + TBuf8<20>CmdBuf(KCmdTraceLocation) ; - + outputlist->Reset() ; inputlist->Reset() ; _LIT8(KClass,"LocationInformationClass"); _LIT(KClassArg,"Invalid"); inputlist->AppendL(TLiwGenericParam(KClass,TLiwVariant(KClassArg))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + if(!ErrorParm) + { + + return KErrGeneral ; + } + TInt error = (ErrorParm->Value()).AsTInt32(); + if( SErrBadArgumentType == error ) + { + error = KErrNone; + } + locinterface->Close() ; + outputlist->Reset() ; + inputlist->Reset() ; - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - - return KErrGeneral ; - } - TInt error = (ErrorParm->Value()).AsTInt32(); - if( SErrBadArgumentType == error ) - { - error = KErrNone; - - - } - locinterface->Close() ; - outputlist->Reset() ; - inputlist->Reset() ; + //delete inputlist; + //delete outputlist; + delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - TInt end = User::CountAllocCells(); - __UHEAP_MARKEND ; - return error; - - } + a.ResetAndDestroy() ; + a.Close() ; + TInt end = User::CountAllocCells(); + __UHEAP_MARKEND ; + return error; + + } TInt CTestProvider :: getlocationPostionbasedpdateoption( CStifItemParser& /*aItem*/ ) -{ -__UHEAP_MARK ; - RFile LogFile ; - RFs LogSession ; - TBuf8<50> data ; - TRealFormat format ; - - - if(LogSession.Connect() != KErrNone) - { - _LIT(KLog , "Failed to connect to file server") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - - - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) - { - _LIT(KLog , "Failed to create notifications log file") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - } - - _LIT(KLog , "In CTGetLocation") ; - iLog->Log(KLog) ; - - + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - _LIT(KLog , "Interface not found"); - iLog->Log(KLog) ; - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; - + outputlist->Reset() ; inputlist->Reset() ; _LIT(KClass,"GenericLocationInfo"); inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( ) ) ); //inputlist->AppendL(TLiwGenericParam(NULL)); CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); - - _LIT8(KInterval,"UpdateInterval"); - _LIT8(KTimeout,"UpdateTimeOut"); - _LIT8(KAge,"UpdateMaxAge"); - _LIT8(KPartial,"PartialUpdates"); - const TInt KTime = 1000000; - + + _LIT8(KInterval,"UpdateInterval"); + _LIT8(KTimeout,"UpdateTimeOut"); + _LIT8(KAge,"UpdateMaxAge"); + _LIT8(KPartial,"PartialUpdates"); + const TInt KTime = 1000000; + updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); - + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); updatemap->DecRef(); - - - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - _LIT(Klog, "Success/Failure state not known") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - if((ErrorParm->Value()).AsTInt32() ) - { - _LIT(KLog , "ExecutecmdL failed "); - iLog->Log(KLog) ; - //return (ErrorParm->Value()).AsTInt32() ; - } - - - - TInt index = 0 ; - - const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); - - - if(!GenericParam) - { - _LIT(Klog, "Out Param not found") ; - iLog->Log(Klog) ; - return KErrGeneral ; //Param Error - } - - TLiwVariant Variant ; - - Variant = GenericParam->Value() ; - const CLiwMap *LocMap = Variant.AsMap() ; - - TLiwVariant PosVariant ; - - LocMap->FindL(KLongitudeKey , PosVariant) ; - TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude - data.Num(LongData , format) ; - LogFile.Write(_L8("\n")) ; - LogFile.Write(_L8("Logitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude - - TReal64 LatData = (TReal64)PosVariant.AsTReal() ; - data.Num(LatData , format) ; - LogFile.Write(_L8(" Latitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude - TReal32 AltData = PosVariant.AsTReal() ; - data.Num(AltData , format) ; - - LogFile.Write(_L8(" Altitude = ")) ; - LogFile.Write(data) ; - - LogFile.Close() ; - LogSession.Close() ; - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - -__UHEAP_MARKEND ; - return KErrNone ; - - - -} + + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() ) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + //return (ErrorParm->Value()).AsTInt32() ; + } + + + + TInt index = 0 ; + + const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); + + + if(!GenericParam) + { + _LIT(Klog, "Out Param not found") ; + iLog->Log(Klog) ; + return KErrGeneral ; //Param Error + } + + TLiwVariant Variant ; + + Variant = GenericParam->Value() ; + const CLiwMap *LocMap = Variant.AsMap() ; + + TLiwVariant PosVariant ; + + LocMap->FindL(KLongitudeKey , PosVariant) ; + TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude + data.Num(LongData , format) ; + LogFile.Write(_L8("\n")) ; + LogFile.Write(_L8("Logitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude + + TReal64 LatData = (TReal64)PosVariant.AsTReal() ; + data.Num(LatData , format) ; + LogFile.Write(_L8(" Latitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude + TReal32 AltData = PosVariant.AsTReal() ; + data.Num(AltData , format) ; + + LogFile.Write(_L8(" Altitude = ")) ; + LogFile.Write(data) ; + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + + } TInt CTestProvider :: getlocationPostionbasedwithupdateoption( CStifItemParser& /*aItem*/ ) -{ -__UHEAP_MARK ; - RFile LogFile ; - RFs LogSession ; - TBuf8<50> data ; - TRealFormat format ; - - - if(LogSession.Connect() != KErrNone) - { - _LIT(KLog , "Failed to connect to file server") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - - - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) - { - _LIT(KLog , "Failed to create notifications log file") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - } - - _LIT(KLog , "In CTGetLocation") ; - iLog->Log(KLog) ; - - + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - _LIT(KLog , "Interface not found"); - iLog->Log(KLog) ; - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; - + outputlist->Reset() ; inputlist->Reset() ; _LIT(KClass,"GenericLocationInfo"); inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); - - _LIT8(KInterval,"UpdateInterval"); - _LIT8(KTimeout,"UpdateTimeOut"); - _LIT8(KAge,"UpdateMaxAge"); - _LIT8(KPartial,"PartialUpdates"); - const TInt KTime = 1000000; - + + _LIT8(KInterval,"UpdateInterval"); + _LIT8(KTimeout,"UpdateTimeOut"); + _LIT8(KAge,"UpdateMaxAge"); + _LIT8(KPartial,"PartialUpdates"); + const TInt KTime = 1000000; + updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); - + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); updatemap->DecRef(); - - - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - _LIT(Klog, "Success/Failure state not known") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - if((ErrorParm->Value()).AsTInt32() ) - { - _LIT(KLog , "ExecutecmdL failed "); - iLog->Log(KLog) ; - return (ErrorParm->Value()).AsTInt32() ; - } - - - - TInt index = 0 ; - - const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); - - - if(!GenericParam) - { - _LIT(Klog, "Out Param not found") ; - iLog->Log(Klog) ; - return KErrGeneral ; //Param Error - } - - TLiwVariant Variant ; - - Variant = GenericParam->Value() ; - const CLiwMap *LocMap = Variant.AsMap() ; - - TLiwVariant PosVariant ; - - LocMap->FindL(KLongitudeKey , PosVariant) ; - TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude - data.Num(LongData , format) ; - LogFile.Write(_L8("\n")) ; - LogFile.Write(_L8("Logitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude - - TReal64 LatData = (TReal64)PosVariant.AsTReal() ; - data.Num(LatData , format) ; - LogFile.Write(_L8(" Latitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude - TReal32 AltData = PosVariant.AsTReal() ; - data.Num(AltData , format) ; - - LogFile.Write(_L8(" Altitude = ")) ; - LogFile.Write(data) ; - - - TLiwVariant Speed ; - - index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; - - if(index ) - { - - TReal speed = Speed.AsTReal() ; - - data.Num(speed , format) ; - - LogFile.Write(_L8("Speed = ")) ; - LogFile.Write(data) ; - - } - - - TLiwVariant SpeedError ; - index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; - - - if(index ) - { - - TReal speed = SpeedError.AsTReal() ; - - data.Num(speed , format) ; - - LogFile.Write(_L8("Speed = ")) ; - LogFile.Write(data) ; - - } - - index = 0 ; - - TLiwVariant SatInfo ; - - index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; - - if(index ) - { - - TInt satnumView = SatInfo.AsTInt32() ; - data.Num(satnumView , format); - - LogFile.Write(_L8("Satellite information")) ; - - LogFile.Write(_L8("Number of visible satellites ")) ; - LogFile.Write(data) ; - } - - index = 0 ; - - TLiwVariant SatInfoview ; - - index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; - if(index ) - { - - - TInt satnumViewUsed = SatInfoview.AsTInt32() ; - data.Num(satnumViewUsed , format); - - LogFile.Write(_L8("\nSatellite information")) ; - - LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; - LogFile.Write(data) ; - } - - index = 0 ; - - TInt Headinginfo = 0 ; - - TLiwVariant Heading ; - Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; - - if(Headinginfo) - { - - - TReal heading = Heading.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nHeading")) ; - LogFile.Write(data) ; - } - - - if(Headinginfo) - { - TLiwVariant HeadingError ; - index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; - - if(index) - { - - - TReal heading = HeadingError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nHeading Error")) ; - LogFile.Write(data) ; - - } - - TLiwVariant MagneticHeading ; - index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; - - if(index) - { - - - TReal heading = MagneticHeading.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\n MagneticHeading ")) ; - LogFile.Write(data) ; - - } - - - TLiwVariant MagneticHeadingError ; - index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; - - if(index) - { - - - TReal heading = MagneticHeadingError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticHeading Error")) ; - LogFile.Write(data) ; - - } - - - } //End of Heading - - - - TLiwVariant TrueCourse ; - index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; - - if( index) - { - - - TReal heading = TrueCourse.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\nDirection ")) ; - - LogFile.Write(_L8("\n TrueCourse Error")) ; - LogFile.Write(data) ; - - - - TLiwVariant TrueCourseError ; - index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; - - if( index) - { - - - TReal heading = TrueCourseError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticHeading Error")) ; - LogFile.Write(data) ; - - } - - - } - - - TLiwVariant MagneticCourse ; - index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; - - - if(index) - { - - TReal heading = MagneticCourse.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticCourse ")) ; - LogFile.Write(data) ; - - - - TLiwVariant MagneticCourseError ; - index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; - - if( index) - { - - - TReal heading = MagneticCourseError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\n MagneticCourseError Error")) ; - LogFile.Write(data) ; - - } - - - } - - - - TLiwVariant NmeaNum ; - index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; - - - if(index) - { - - TInt32 NMEASentence = NmeaNum.AsTInt32() ; - data.Num(NMEASentence , format); - - LogFile.Write(_L8("\nNMEA Information")) ; - - LogFile.Write(_L8("\n number of NMEA Sentences ")) ; - LogFile.Write(data) ; - - index = 0 ; - - const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; - - if(-1 != index) - { - Variant = MagneticCourseError->Value() ; - - - } - - - } - - - LogFile.Close() ; - LogSession.Close() ; - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - -__UHEAP_MARKEND ; - return KErrNone ; - - - -} + + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() ) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + return (ErrorParm->Value()).AsTInt32() ; + } + + + + TInt index = 0 ; + + const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); + + + if(!GenericParam) + { + _LIT(Klog, "Out Param not found") ; + iLog->Log(Klog) ; + return KErrGeneral ; //Param Error + } + + TLiwVariant Variant ; + + Variant = GenericParam->Value() ; + const CLiwMap *LocMap = Variant.AsMap() ; + + TLiwVariant PosVariant ; + + LocMap->FindL(KLongitudeKey , PosVariant) ; + TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude + data.Num(LongData , format) ; + LogFile.Write(_L8("\n")) ; + LogFile.Write(_L8("Logitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude + + TReal64 LatData = (TReal64)PosVariant.AsTReal() ; + data.Num(LatData , format) ; + LogFile.Write(_L8(" Latitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude + TReal32 AltData = PosVariant.AsTReal() ; + data.Num(AltData , format) ; + + LogFile.Write(_L8(" Altitude = ")) ; + LogFile.Write(data) ; + + + TLiwVariant Speed ; + + index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; + + if(index ) + { + + TReal speed = Speed.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + + + TLiwVariant SpeedError ; + index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; + + + if(index ) + { + + TReal speed = SpeedError.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + + index = 0 ; + + TLiwVariant SatInfo ; + + index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; + + if(index ) + { + + TInt satnumView = SatInfo.AsTInt32() ; + data.Num(satnumView , format); + + LogFile.Write(_L8("Satellite information")) ; + + LogFile.Write(_L8("Number of visible satellites ")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TLiwVariant SatInfoview ; + + index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; + if(index ) + { + + + TInt satnumViewUsed = SatInfoview.AsTInt32() ; + data.Num(satnumViewUsed , format); + + LogFile.Write(_L8("\nSatellite information")) ; + + LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TInt Headinginfo = 0 ; + + TLiwVariant Heading ; + Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; + + if(Headinginfo) + { + + + TReal heading = Heading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading")) ; + LogFile.Write(data) ; + } + + + if(Headinginfo) + { + TLiwVariant HeadingError ; + index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; + + if(index) + { + + + TReal heading = HeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading Error")) ; + LogFile.Write(data) ; + + } + + TLiwVariant MagneticHeading ; + index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; + + if(index) + { + + + TReal heading = MagneticHeading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticHeading ")) ; + LogFile.Write(data) ; + + } + + + TLiwVariant MagneticHeadingError ; + index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; + + if(index) + { + + + TReal heading = MagneticHeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } //End of Heading + + + + TLiwVariant TrueCourse ; + index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; + + if( index) + { + + + TReal heading = TrueCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\nDirection ")) ; + + LogFile.Write(_L8("\n TrueCourse Error")) ; + LogFile.Write(data) ; + + + + TLiwVariant TrueCourseError ; + index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; + + if( index) + { + + + TReal heading = TrueCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } + + + TLiwVariant MagneticCourse ; + index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; + + + if(index) + { + + TReal heading = MagneticCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticCourse ")) ; + LogFile.Write(data) ; + + + + TLiwVariant MagneticCourseError ; + index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; + + if( index) + { + + + TReal heading = MagneticCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticCourseError Error")) ; + LogFile.Write(data) ; + + } + + + } + + + + TLiwVariant NmeaNum ; + index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; + + + if(index) + { + + TInt32 NMEASentence = NmeaNum.AsTInt32() ; + data.Num(NMEASentence , format); + + LogFile.Write(_L8("\nNMEA Information")) ; + + LogFile.Write(_L8("\n number of NMEA Sentences ")) ; + LogFile.Write(data) ; + + index = 0 ; + + const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; + + if(-1 != index) + { + Variant = MagneticCourseError->Value() ; + + + } + + + } + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + + } TInt CTestProvider :: getlocationPostionbased( CStifItemParser& /*aItem*/ ) -{ -__UHEAP_MARK ; - RFile LogFile ; - RFs LogSession ; - TBuf8<50> data ; - TRealFormat format ; - - - if(LogSession.Connect() != KErrNone) - { - _LIT(KLog , "Failed to connect to file server") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - - - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) - { - _LIT(KLog , "Failed to create notifications log file") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - } - - _LIT(KLog , "In CTGetLocation") ; - iLog->Log(KLog) ; - - + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - _LIT(KLog , "Interface not found"); - iLog->Log(KLog) ; - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; - + outputlist->Reset() ; inputlist->Reset() ; _LIT(KClass,"GenericLocationInfo"); inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - _LIT(Klog, "Success/Failure state not known") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - if((ErrorParm->Value()).AsTInt32() ) - { - _LIT(KLog , "ExecutecmdL failed "); - iLog->Log(KLog) ; - return (ErrorParm->Value()).AsTInt32() ; - } - - - - TInt index = 0 ; - - const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); - - - if(!GenericParam) - { - _LIT(Klog, "Out Param not found") ; - iLog->Log(Klog) ; - return KErrGeneral ; //Param Error - } - - TLiwVariant Variant ; - - Variant = GenericParam->Value() ; - const CLiwMap *LocMap = Variant.AsMap() ; - - TLiwVariant PosVariant ; - - LocMap->FindL(KLongitudeKey , PosVariant) ; - TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude - data.Num(LongData , format) ; - LogFile.Write(_L8("\n")) ; - LogFile.Write(_L8("Logitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude - - TReal64 LatData = (TReal64)PosVariant.AsTReal() ; - data.Num(LatData , format) ; - LogFile.Write(_L8(" Latitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude - TReal32 AltData = PosVariant.AsTReal() ; - data.Num(AltData , format) ; - - LogFile.Write(_L8(" Altitude = ")) ; - LogFile.Write(data) ; - - - TLiwVariant Speed ; - - index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; - - if(index ) - { - - TReal speed = Speed.AsTReal() ; - - data.Num(speed , format) ; - - LogFile.Write(_L8("Speed = ")) ; - LogFile.Write(data) ; - - } - - - TLiwVariant SpeedError ; - index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; - - - if(index ) - { - - TReal speed = SpeedError.AsTReal() ; - - data.Num(speed , format) ; - - LogFile.Write(_L8("Speed = ")) ; - LogFile.Write(data) ; - - } - - index = 0 ; - - TLiwVariant SatInfo ; - - index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; - - if(index ) - { - - TInt satnumView = SatInfo.AsTInt32() ; - data.Num(satnumView , format); - - LogFile.Write(_L8("Satellite information")) ; - - LogFile.Write(_L8("Number of visible satellites ")) ; - LogFile.Write(data) ; - } - - index = 0 ; - - TLiwVariant SatInfoview ; - - index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; - if(index ) - { - - - TInt satnumViewUsed = SatInfoview.AsTInt32() ; - data.Num(satnumViewUsed , format); - - LogFile.Write(_L8("\nSatellite information")) ; - - LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; - LogFile.Write(data) ; - } - - index = 0 ; - - TInt Headinginfo = 0 ; - - TLiwVariant Heading ; - Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; - - if(Headinginfo) - { - - - TReal heading = Heading.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nHeading")) ; - LogFile.Write(data) ; - } - - - if(Headinginfo) - { - TLiwVariant HeadingError ; - index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; - - if(index) - { - - - TReal heading = HeadingError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nHeading Error")) ; - LogFile.Write(data) ; - - } - - TLiwVariant MagneticHeading ; - index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; - - if(index) - { - - - TReal heading = MagneticHeading.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\n MagneticHeading ")) ; - LogFile.Write(data) ; - - } - - - TLiwVariant MagneticHeadingError ; - index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; - - if(index) - { - - - TReal heading = MagneticHeadingError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticHeading Error")) ; - LogFile.Write(data) ; - - } - - - } //End of Heading - - - - TLiwVariant TrueCourse ; - index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; - - if( index) - { - - - TReal heading = TrueCourse.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\nDirection ")) ; - - LogFile.Write(_L8("\n TrueCourse Error")) ; - LogFile.Write(data) ; - - - - TLiwVariant TrueCourseError ; - index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; - - if( index) - { - - - TReal heading = TrueCourseError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticHeading Error")) ; - LogFile.Write(data) ; - - } - - - } - - - TLiwVariant MagneticCourse ; - index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; - - - if(index) - { - - TReal heading = MagneticCourse.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticCourse ")) ; - LogFile.Write(data) ; - - - - TLiwVariant MagneticCourseError ; - index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; - - if( index) - { - - - TReal heading = MagneticCourseError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\n MagneticCourseError Error")) ; - LogFile.Write(data) ; - - } - - - } - - - - TLiwVariant NmeaNum ; - index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; - - - if(index) - { - - TInt32 NMEASentence = NmeaNum.AsTInt32() ; - data.Num(NMEASentence , format); - - LogFile.Write(_L8("\nNMEA Information")) ; - - LogFile.Write(_L8("\n number of NMEA Sentences ")) ; - LogFile.Write(data) ; - - index = 0 ; - - const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; - - if(-1 != index) - { - Variant = MagneticCourseError->Value() ; - - - } - - - } - - - LogFile.Close() ; - LogSession.Close() ; - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - -__UHEAP_MARKEND ; - return KErrNone ; - - - -} + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() ) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + return (ErrorParm->Value()).AsTInt32() ; + } + + + + TInt index = 0 ; + + const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); + + + if(!GenericParam) + { + _LIT(Klog, "Out Param not found") ; + iLog->Log(Klog) ; + return KErrGeneral ; //Param Error + } + + TLiwVariant Variant ; + + Variant = GenericParam->Value() ; + const CLiwMap *LocMap = Variant.AsMap() ; + + TLiwVariant PosVariant ; + + LocMap->FindL(KLongitudeKey , PosVariant) ; + TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude + data.Num(LongData , format) ; + LogFile.Write(_L8("\n")) ; + LogFile.Write(_L8("Logitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude + + TReal64 LatData = (TReal64)PosVariant.AsTReal() ; + data.Num(LatData , format) ; + LogFile.Write(_L8(" Latitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude + TReal32 AltData = PosVariant.AsTReal() ; + data.Num(AltData , format) ; + + LogFile.Write(_L8(" Altitude = ")) ; + LogFile.Write(data) ; + + + TLiwVariant Speed ; + + index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; + + if(index ) + { + + TReal speed = Speed.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + + + TLiwVariant SpeedError ; + index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; + + + if(index ) + { + + TReal speed = SpeedError.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + + index = 0 ; + + TLiwVariant SatInfo ; + + index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; + + if(index ) + { + + TInt satnumView = SatInfo.AsTInt32() ; + data.Num(satnumView , format); + + LogFile.Write(_L8("Satellite information")) ; + + LogFile.Write(_L8("Number of visible satellites ")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TLiwVariant SatInfoview ; + + index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; + if(index ) + { + + + TInt satnumViewUsed = SatInfoview.AsTInt32() ; + data.Num(satnumViewUsed , format); + + LogFile.Write(_L8("\nSatellite information")) ; + + LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TInt Headinginfo = 0 ; + + TLiwVariant Heading ; + Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; + + if(Headinginfo) + { + + + TReal heading = Heading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading")) ; + LogFile.Write(data) ; + } + + + if(Headinginfo) + { + TLiwVariant HeadingError ; + index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; + + if(index) + { + + + TReal heading = HeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading Error")) ; + LogFile.Write(data) ; + + } + + TLiwVariant MagneticHeading ; + index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; + + if(index) + { + + + TReal heading = MagneticHeading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticHeading ")) ; + LogFile.Write(data) ; + + } + + + TLiwVariant MagneticHeadingError ; + index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; + + if(index) + { + + + TReal heading = MagneticHeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } //End of Heading + + + + TLiwVariant TrueCourse ; + index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; + + if( index) + { + + + TReal heading = TrueCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\nDirection ")) ; + + LogFile.Write(_L8("\n TrueCourse Error")) ; + LogFile.Write(data) ; + + + + TLiwVariant TrueCourseError ; + index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; + + if( index) + { + + + TReal heading = TrueCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } + + + TLiwVariant MagneticCourse ; + index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; + + + if(index) + { + + TReal heading = MagneticCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticCourse ")) ; + LogFile.Write(data) ; + + + + TLiwVariant MagneticCourseError ; + index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; + + if( index) + { + + + TReal heading = MagneticCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticCourseError Error")) ; + LogFile.Write(data) ; + + } + + + } + + + + TLiwVariant NmeaNum ; + index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; + + + if(index) + { + + TInt32 NMEASentence = NmeaNum.AsTInt32() ; + data.Num(NMEASentence , format); + + LogFile.Write(_L8("\nNMEA Information")) ; + + LogFile.Write(_L8("\n number of NMEA Sentences ")) ; + LogFile.Write(data) ; + + index = 0 ; + + const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; + + if(-1 != index) + { + Variant = MagneticCourseError->Value() ; + + + } + + + } + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + + } TInt CTestProvider :: CancelWithInvalidTransId(CStifItemParser& /*aItem*/) - { - __UHEAP_MARK ; - RFile LogFile ; - RFs LogSession ; - TBuf8<50> data ; - TRealFormat format ; - - - if(LogSession.Connect() != KErrNone) - { - _LIT(KLog , "Failed to connect to file server") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - - _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; - - if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) - { - if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) - { - _LIT(KLog , "Failed to create log file\n") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - } - - _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; - data.Copy(KLog); - LogFile.Write(data) ; - - User::After(5000000); - - - - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - - // Input and output parameter list - CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); - CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - - TBuf8<20>CmdBuf(KCmdGetLocation) ; - - outputlist->Reset() ; - inputlist->Reset() ; - ASyncLocCBF* callBack ; - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; - data.Copy(Klog); - LogFile.Write(data) ; - - //LogFile.Write(Klog) ; - return KErrGeneral ; - } - - TInt reqerror = (ErrorParm->Value()).AsTInt32(); - _LIT(Klog , "ERRor code from getlocationasynch ") ; - data.Copy(Klog); - LogFile.Write(data) ; - - //LogFile.Write(Klog) ; - - TReal64 errordata = reqerror ; - data.Num(errordata , format) ; - - - LogFile.Write(data) ; - - - pos = 0; - - _LIT8(KTransactionId, "TransactionID"); - const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; - if(!transid) - { - _LIT(KTran,"Missing Transaction ID\n"); - data.Copy(KTran); - LogFile.Write(data) ; - //LogFile.Write(KTran); - return KErrGeneral; - } - TInt trid = (transid->Value()).AsTInt32(); - outputlist->Reset() ; - inputlist->Reset() ; - - - inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid-2))); - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); - - ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; - data.Copy(Klog); - LogFile.Write(data) ; - //LogFile.Write(Klog); - return KErrGeneral ; - } - - reqerror = (ErrorParm->Value()).AsTInt32(); - - _LIT(Klog1 , "\nERRor code from cancel ") ; - - data.Copy(Klog1); - LogFile.Write(data) ; - //LogFile.Write(Klog1) ; - - errordata = reqerror ; - data.Num(errordata , format) ; - - - LogFile.Write(data) ; - if( SErrNotFound == reqerror ) - { - reqerror = 0; - } - - - - - - - LogFile.Close() ; - LogSession.Close() ; - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - - __UHEAP_MARKEND ; - return reqerror ; - - - - } - - -TInt CTestProvider :: GetLocationSynchWrongUpdateMapType(CStifItemParser& /*aItem*/) -{ -__UHEAP_MARK ; - - + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; + + if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create log file\n") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + LogFile.Write(data) ; + + User::After(5000000); + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; - + + outputlist->Reset() ; + inputlist->Reset() ; + ASyncLocCBF* callBack ; + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + _LIT(Klog , "ERRor code from getlocationasynch ") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + _LIT8(KTransactionId, "TransactionID"); + const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; + if(!transid) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt trid = (transid->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + + + inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid-2))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; + data.Copy(Klog); + LogFile.Write(data) ; + //LogFile.Write(Klog); + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + + _LIT(Klog1 , "\nERRor code from cancel ") ; + + data.Copy(Klog1); + LogFile.Write(data) ; + //LogFile.Write(Klog1) ; + + errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + if( SErrNotFound == reqerror ) + { + reqerror = 0; + } + + + + + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return reqerror ; + + + + } + + +TInt CTestProvider :: GetLocationSynchWrongUpdateMapType(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + outputlist->Reset() ; inputlist->Reset() ; _LIT8(KLocCategory,"LocationInformationClass"); _LIT16(KBasic,"BasicLocationInformation"); inputlist->AppendL(TLiwGenericParam(KLocCategory,TLiwVariant(KBasic))); - - - + + + _LIT8(KUpdate,"Updateoptions"); inputlist->AppendL(TLiwGenericParam(KUpdate,TLiwVariant(30))); - - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - - if(!ErrorParm) - { - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - return KErrGeneral ; - } - - TInt err = (ErrorParm->Value()).AsTInt32(); - - if( SErrBadArgumentType == err ) - { - _LIT8(KErrorMessage,"ErrorMessage"); - _LIT(KNone,"Error"); - - TPtrC errorstring(KNone); - pos = 0; - const TLiwGenericParam *ErrorParmstring = outputlist->FindFirst(pos ,KErrorMessage ) ; - TLiwVariant variant = ErrorParmstring->Value(); - errorstring.Set( variant.AsDes() ); - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - __UHEAP_MARKEND ; - return KErrNone; - } - - - - - - - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - -__UHEAP_MARKEND ; - return err ; - - - -} - + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + + if(!ErrorParm) + { + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + return KErrGeneral ; + } + + TInt err = (ErrorParm->Value()).AsTInt32(); + + if( SErrBadArgumentType == err ) + { + _LIT8(KErrorMessage,"ErrorMessage"); + _LIT(KNone,"Error"); + + TPtrC errorstring(KNone); + pos = 0; + const TLiwGenericParam *ErrorParmstring = outputlist->FindFirst(pos ,KErrorMessage ) ; + TLiwVariant variant = ErrorParmstring->Value(); + errorstring.Set( variant.AsDes() ); + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return KErrNone; + } + + + + + + + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return err ; + + + + } + TInt CTestProvider :: CTestGetLocation() -{ -__UHEAP_MARK ; - RFile LogFile ; - RFs LogSession ; - TBuf8<50> data ; - TRealFormat format ; - - - if(LogSession.Connect() != KErrNone) - { - _LIT(KLog , "Failed to connect to file server") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - - - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) - { - _LIT(KLog , "Failed to create notifications log file") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - - } - - _LIT(KLog , "In CTGetLocation") ; - iLog->Log(KLog) ; - - + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - - - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - pos = 0 ; - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); - - if(!genericparm) - { - _LIT(KLog , "Interface not found"); - iLog->Log(KLog) ; - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; - + outputlist->Reset() ; inputlist->Reset() ; - - locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); - - pos = 0 ; - - const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; - - if(!ErrorParm) - { - _LIT(Klog, "Success/Failure state not known") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - if((ErrorParm->Value()).AsTInt32() ) - { - _LIT(KLog , "ExecutecmdL failed "); - iLog->Log(KLog) ; - return (ErrorParm->Value()).AsTInt32() ; - } - - - - TInt index = 0 ; - - const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); - - - if(!GenericParam) - { - _LIT(Klog, "Out Param not found") ; - iLog->Log(Klog) ; - return KErrGeneral ; //Param Error - } - - TLiwVariant Variant ; - - Variant = GenericParam->Value() ; - const CLiwMap *LocMap = Variant.AsMap() ; - - TLiwVariant PosVariant ; - - LocMap->FindL(KLongitudeKey , PosVariant) ; - TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude - data.Num(LongData , format) ; - LogFile.Write(_L8("\n")) ; - LogFile.Write(_L8("Logitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude - - TReal64 LatData = (TReal64)PosVariant.AsTReal() ; - data.Num(LatData , format) ; - LogFile.Write(_L8(" Latitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude - TReal32 AltData = PosVariant.AsTReal() ; - data.Num(AltData , format) ; - - LogFile.Write(_L8(" Altitude = ")) ; - LogFile.Write(data) ; - - - TLiwVariant Speed ; - - index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; - - if(index ) - { - - TReal speed = Speed.AsTReal() ; - - data.Num(speed , format) ; - - LogFile.Write(_L8("Speed = ")) ; - LogFile.Write(data) ; - - } - - - TLiwVariant SpeedError ; - index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; - - - if(index ) - { - - TReal speed = SpeedError.AsTReal() ; - - data.Num(speed , format) ; - - LogFile.Write(_L8("Speed = ")) ; - LogFile.Write(data) ; - - } - - index = 0 ; - - TLiwVariant SatInfo ; - - index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; - - if(index ) - { - - TInt satnumView = SatInfo.AsTInt32() ; - data.Num(satnumView , format); - - LogFile.Write(_L8("Satellite information")) ; - - LogFile.Write(_L8("Number of visible satellites ")) ; - LogFile.Write(data) ; - } - - index = 0 ; - - TLiwVariant SatInfoview ; - - index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; - if(index ) - { - - - TInt satnumViewUsed = SatInfoview.AsTInt32() ; - data.Num(satnumViewUsed , format); - - LogFile.Write(_L8("\nSatellite information")) ; - - LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; - LogFile.Write(data) ; - } - - index = 0 ; - - TInt Headinginfo = 0 ; - - TLiwVariant Heading ; - Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; - - if(Headinginfo) - { - - - TReal heading = Heading.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nHeading")) ; - LogFile.Write(data) ; - } - - - if(Headinginfo) - { - TLiwVariant HeadingError ; - index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; - - if(index) - { - - - TReal heading = HeadingError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nHeading Error")) ; - LogFile.Write(data) ; - - } - - TLiwVariant MagneticHeading ; - index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; - - if(index) - { - - - TReal heading = MagneticHeading.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\n MagneticHeading ")) ; - LogFile.Write(data) ; - - } - - - TLiwVariant MagneticHeadingError ; - index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; - - if(index) - { - - - TReal heading = MagneticHeadingError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticHeading Error")) ; - LogFile.Write(data) ; - - } - - - } //End of Heading - - - - TLiwVariant TrueCourse ; - index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; - - if( index) - { - - - TReal heading = TrueCourse.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\nDirection ")) ; - - LogFile.Write(_L8("\n TrueCourse Error")) ; - LogFile.Write(data) ; - - - - TLiwVariant TrueCourseError ; - index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; - - if( index) - { - - - TReal heading = TrueCourseError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticHeading Error")) ; - LogFile.Write(data) ; - - } - - - } - - - TLiwVariant MagneticCourse ; - index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; - - - if(index) - { - - TReal heading = MagneticCourse.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\nMagneticCourse ")) ; - LogFile.Write(data) ; - - - - TLiwVariant MagneticCourseError ; - index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; - - if( index) - { - - - TReal heading = MagneticCourseError.AsTReal() ; - data.Num(heading , format); - - LogFile.Write(_L8("\ncompass information")) ; - - LogFile.Write(_L8("\n MagneticCourseError Error")) ; - LogFile.Write(data) ; - - } - - - } - - - - TLiwVariant NmeaNum ; - index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; - - - if(index) - { - - TInt32 NMEASentence = NmeaNum.AsTInt32() ; - data.Num(NMEASentence , format); - - LogFile.Write(_L8("\nNMEA Information")) ; - - LogFile.Write(_L8("\n number of NMEA Sentences ")) ; - LogFile.Write(data) ; - - index = 0 ; - - const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; - - if(-1 != index) - { - Variant = MagneticCourseError->Value() ; - - - } - - - } - - - LogFile.Close() ; - LogSession.Close() ; - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - -__UHEAP_MARKEND ; - return KErrNone ; - - - -} + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() ) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + return (ErrorParm->Value()).AsTInt32() ; + } + + + + TInt index = 0 ; + + const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); + + + if(!GenericParam) + { + _LIT(Klog, "Out Param not found") ; + iLog->Log(Klog) ; + return KErrGeneral ; //Param Error + } + + TLiwVariant Variant ; + + Variant = GenericParam->Value() ; + const CLiwMap *LocMap = Variant.AsMap() ; + + TLiwVariant PosVariant ; + + LocMap->FindL(KLongitudeKey , PosVariant) ; + TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude + data.Num(LongData , format) ; + LogFile.Write(_L8("\n")) ; + LogFile.Write(_L8("Logitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude + + TReal64 LatData = (TReal64)PosVariant.AsTReal() ; + data.Num(LatData , format) ; + LogFile.Write(_L8(" Latitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude + TReal32 AltData = PosVariant.AsTReal() ; + data.Num(AltData , format) ; + + LogFile.Write(_L8(" Altitude = ")) ; + LogFile.Write(data) ; + + TLiwVariant Accuracy; + index = LocMap->FindL(_L8("HorizontalAccuracy"),Accuracy); + + if(index) + { + TReal32 AccuracyVal = Accuracy.AsTReal(); + data.Num(AccuracyVal , format) ; + + LogFile.Write(_L8("Horizontal Acc = ")) ; + LogFile.Write(data) ; + } + + Accuracy.Reset(); + index = LocMap->FindL(_L8("VerticalAccuracy"),Accuracy); + + if(index) + { + TReal32 AccuracyVal = Accuracy.AsTReal(); + data.Num(AccuracyVal , format) ; + + LogFile.Write(_L8("Vertical Acc = ")) ; + LogFile.Write(data) ; + } + TLiwVariant Speed ; + + index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; + + if(index ) + { + + TReal speed = Speed.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + + + TLiwVariant SpeedError ; + index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; + + + if(index ) + { + + TReal speed = SpeedError.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + + index = 0 ; + + TLiwVariant SatInfo ; + + index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; + + if(index ) + { + + TInt satnumView = SatInfo.AsTInt32() ; + data.Num(satnumView , format); + + LogFile.Write(_L8("Satellite information")) ; + + LogFile.Write(_L8("Number of visible satellites ")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TLiwVariant SatInfoview ; + + index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; + if(index ) + { + + + TInt satnumViewUsed = SatInfoview.AsTInt32() ; + data.Num(satnumViewUsed , format); + + LogFile.Write(_L8("\nSatellite information")) ; + + LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TInt Headinginfo = 0 ; + + TLiwVariant Heading ; + Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; + + if(Headinginfo) + { + + + TReal heading = Heading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading")) ; + LogFile.Write(data) ; + } + + + if(Headinginfo) + { + TLiwVariant HeadingError ; + index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; + + if(index) + { + + + TReal heading = HeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading Error")) ; + LogFile.Write(data) ; + + } + + TLiwVariant MagneticHeading ; + index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; + + if(index) + { + + + TReal heading = MagneticHeading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticHeading ")) ; + LogFile.Write(data) ; + + } + + + TLiwVariant MagneticHeadingError ; + index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; + + if(index) + { + + + TReal heading = MagneticHeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } //End of Heading + + + + TLiwVariant TrueCourse ; + index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; + + if( index) + { + + + TReal heading = TrueCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\nDirection ")) ; + + LogFile.Write(_L8("\n TrueCourse Error")) ; + LogFile.Write(data) ; + + + + TLiwVariant TrueCourseError ; + index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; + + if( index) + { + + + TReal heading = TrueCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } + + + TLiwVariant MagneticCourse ; + index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; + + + if(index) + { + + TReal heading = MagneticCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticCourse ")) ; + LogFile.Write(data) ; + + + + TLiwVariant MagneticCourseError ; + index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; + + if( index) + { + + + TReal heading = MagneticCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticCourseError Error")) ; + LogFile.Write(data) ; + + } + + + } + + + + TLiwVariant NmeaNum ; + index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; + + + if(index) + { + + TInt32 NMEASentence = NmeaNum.AsTInt32() ; + data.Num(NMEASentence , format); + + LogFile.Write(_L8("\nNMEA Information")) ; + + LogFile.Write(_L8("\n number of NMEA Sentences ")) ; + LogFile.Write(data) ; + + index = 0 ; + + const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; + + if(-1 != index) + { + Variant = MagneticCourseError->Value() ; + + + } + + + } + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + + } TInt CTestProvider :: GetLocation(CStifItemParser & /*aItem */) -{ - __UHEAP_MARK ; - TInt ret = CTestGetLocation() ; - __UHEAP_MARKEND ; - return ret ; - -} + { + __UHEAP_MARK ; + TInt ret = CTestGetLocation() ; + __UHEAP_MARKEND ; + return ret ; + + } TInt CTestProvider :: LocationUpdates(CStifItemParser& /*aItem*/) - { - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L(" LocationUpdates Thread") , GetLocUpdates ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL); - + KMinHeapSize , 0x5000 ,(TAny *) NULL); + if(!ret) - { - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - return ret; - } + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + return ret; + } #if 0 TInt CTestProvider :: LastKnownLoc(CStifItemParser& /*aItem*/) - { - return KErrNone ; - } + { + return KErrNone ; + } #endif - + TInt CTestProvider ::GetLocationAsynch(CStifItemParser& /*aItem*/) - { - - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + { + + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + FunctionThread.Create(_L("GetLocationAsynch Thread") , FindLocationAsynch ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL); - + KMinHeapSize , 0x5000 ,(TAny *) NULL); + FunctionThread.Logon(Status) ; FunctionThread.Resume() ; - + User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - return Status.Int() ; - - - } - - + FunctionThread.Close(); + + return Status.Int() ; + + + } + + TInt CTestProvider ::ServiceNotAvailable(CStifItemParser& /*aItem*/) -{ - - - - _LIT8(KService, "Service.Location"); + { + + __UHEAP_MARK ; + + _LIT8(KService, "Service.Location"); _LIT8(KIDataSource,"ILocation"); - - return KErrNone ; //Manual test case + + return KErrNone ; //Manual test case CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KService, KIDataSource); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - _LIT(Klog , "Success/Failure error code missing from outputlist") ; - iLog->Log(Klog) ; - return KErrGeneral ; - } - - - _LIT8(KDataSource, "ILocation"); - - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); - - if(!genericparm) - { - _LIT(KLog , "Interface not found"); - iLog->Log(KLog) ; - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - TInt result = KErrGeneral ; - TInt error ; - TInt index = 0; - - - // CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - TBuf8<20>CmdBuf(KCmdGetLocation) ; - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - locinterface->ExecuteCmdL(CmdBuf , *InputList , *InputList ); - const TLiwGenericParam *GenericParam = InputList->FindFirst(index , KErrorCode ) ; - - if(GenericParam) - { - TLiwVariant ErrorVariant = GenericParam->Value() ; - - error = ErrorVariant.AsTInt32(); - } - - if((error == KErrNotFound ) || (error == KPositionQualityLoss)) - { - _LIT(KLog , "positioning technology not available") ; - iLog->Log(KLog) ; - result = KErrNone ; - } - - - locinterface->Close() ; - delete InputList ; - delete ServiceHandler ; - - a.ResetAndDestroy() ; - // delete OutParmList ; - - return result ; - -} - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KService, KIDataSource); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + TInt result = KErrGeneral ; + TInt error ; + TInt index = 0; + + + // CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + TBuf8<20>CmdBuf(KCmdGetLocation) ; + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *InputList ); + const TLiwGenericParam *GenericParam = InputList->FindFirst(index , KErrorCode ) ; + + if(GenericParam) + { + TLiwVariant ErrorVariant = GenericParam->Value() ; + + error = ErrorVariant.AsTInt32(); + } + + if((error == KErrNotFound ) || (error == KPositionQualityLoss)) + { + _LIT(KLog , "positioning technology not available") ; + iLog->Log(KLog) ; + result = KErrNone ; + } + + + locinterface->Close() ; + delete InputList ; + delete ServiceHandler ; + + a.ResetAndDestroy() ; + // delete OutParmList ; + __UHEAP_MARKEND ; + return result ; + + } + /* * This is a manual test case were the service was available when the * request was made and then Lost the service (Contact to location servier lost */ - - + + TInt CTestProvider :: ServiceFailed(CStifItemParser& /*aItem*/) -{ - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - _LIT(KLog , "In service failed test ") ; - iLog->Log(KTLocTest) ; - - return KErrNone ; //Manual test case - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "In service failed test ") ; + iLog->Log(KTLocTest) ; + + return KErrNone ; //Manual test case + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L("ServiceFailed Thread") , ServiceFailedTest ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL);; - - if(!ret) - { - - _LIT(Klog , "Created the thread ") ; - iLog->Log(Klog) ; - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - - - if((ret == KErrNotFound ) || (ret == KPositionQualityLoss)) - { - _LIT(KLog , "Service provider crashed or went dowm") ; - iLog->Log(KLog) ; - } - - - return ret; -} + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "Created the thread ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + + + if((ret == KErrNotFound ) || (ret == KPositionQualityLoss)) + { + _LIT(KLog , "Service provider crashed or went dowm") ; + iLog->Log(KLog) ; + } + + + return ret; + } @@ -3068,136 +3101,136 @@ */ TInt CTestProvider :: StraySignal(CStifItemParser& /*aItem*/) -{ - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - _LIT(KLog , "StraySignalTest ") ; - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "StraySignalTest ") ; + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L("stray signal") , StrayTest ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL);; - - if(!ret) - { - - _LIT(Klog , "Created the thread ") ; - iLog->Log(Klog) ; - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - - return ret; -} + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "Created the thread ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + + return ret; + } TInt CTestProvider :: StraySignalGetLoc(CStifItemParser& /*aItem*/) -{ - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - _LIT(KLog , "StraySignalTestGetLoc ") ; - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "StraySignalTestGetLoc ") ; + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L("stray signal GetLocation") , StrayTestGetLoc ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL);; - - if(!ret) - { - - _LIT(Klog , "Created the thread ") ; - iLog->Log(Klog) ; - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - - - return ret; -} + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "Created the thread ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + + + return ret; + } TInt CTestProvider :: ConcurrentCallsGetLoc (CStifItemParser& /*aItem*/) -{ -_LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , ConcurrentGetLocationCalls ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL); - + KMinHeapSize , 0x5000 ,(TAny *) NULL); + if(ret == KErrNone) - { - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - - - ret = Status.Int() ; - } - FunctionThread.Close(); - - if(ret == SErrServiceInUse) - return KErrNone ; - - return KErrGeneral; -} + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + return KErrGeneral ; + + return KErrNone; + } TInt CTestProvider :: ConcurrentCallsTrace (CStifItemParser& /*aItem*/) -{ -_LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , TraceConcurrent ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL); - + KMinHeapSize , 0x5000 ,(TAny *) NULL); + if(ret == KErrNone) - { - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - - - ret = Status.Int() ; - } - FunctionThread.Close(); - - if(ret == SErrServiceInUse) - { - _LIT(KLog , "Return Type is valid"); - iLog->Log(KLog); - } - - else - { - _LIT(KLog , "Return type is not valid\n") ; - iLog->Log(KLog) ; - } - return KErrNone ; - - return KErrGeneral; -} + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + return KErrGeneral; + } /** @@ -3205,101 +3238,101 @@ */ TInt CTestProvider :: EmptyCancelTraceTest(CStifItemParser& /*aItem*/) { - __UHEAP_MARK ; - _LIT(KLog , "CancellTest") ; - - - iLog->Log(KLog) ; - - - - - + __UHEAP_MARK ; + _LIT(KLog , "CancellTest") ; + + + iLog->Log(KLog) ; + + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - return KErrGeneral ; - } - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + pos = 0 ; - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - _LIT8(KCancell , "CancelNotification") ; - _LIT8( KType ,"CancelRequestType") ; - _LIT8( KTraceCancel ,"TraceCancel") ; - inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; - - locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; - - pos = 0 ; - const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; - - if(!errprm) - { + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + _LIT8(KCancell , "CancelNotification") ; + _LIT8( KType ,"CancelRequestType") ; + _LIT8( KTraceCancel ,"TraceCancel") ; + inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; + + locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; + + pos = 0 ; + const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; + + if(!errprm) + { _LIT(Kerr, "Success/Failure code missing from outputlist") ; iLog->Log(Kerr) ; - } - - - TInt ret = KErrGeneral ; //Return Code - TLiwVariant var = errprm->Value() ; - - if(var.AsTInt32() == SErrBadArgumentType ) - { - ret= KErrNone ; + } + + + TInt ret = KErrGeneral ; //Return Code + TLiwVariant var = errprm->Value() ; + + if(var.AsTInt32() == SErrBadArgumentType ) + { + ret= KErrNone ; } else { - _LIT(KDebugMsg , "Return and expected values are different") ; + _LIT(KDebugMsg , "Return and expected values are different") ; iLog->Log(KDebugMsg) ; } - - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - -__UHEAP_MARKEND ; - - - - + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + + + + return ret ; - + } /** @@ -3307,92 +3340,92 @@ */ TInt CTestProvider :: EmptyCancelGetLocTest(CStifItemParser& /*aItem*/) { - _LIT(KLog , "CancellTest") ; - iLog->Log(KLog) ; - - __UHEAP_MARK ; - + _LIT(KLog , "CancellTest") ; + iLog->Log(KLog) ; + + __UHEAP_MARK ; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - return KErrGeneral ; - } - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + pos = 0 ; - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - - - _LIT8(KCancell , "CancelNotification") ; - _LIT8( KType ,"CancelRequestType") ; - _LIT8( KGetLocCancel ,"GetLocCancel") ; - inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KGetLocCancel))) ; - - locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; - - pos = 0 ; - const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; - - if(!errprm) - { + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + + _LIT8(KCancell , "CancelNotification") ; + _LIT8( KType ,"CancelRequestType") ; + _LIT8( KGetLocCancel ,"GetLocCancel") ; + inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KGetLocCancel))) ; + + locinterface->ExecuteCmdL(KCancell , *inputlist , *outputlist) ; + + pos = 0 ; + const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; + + if(!errprm) + { _LIT(Kerr, "Success/Failure code missing from outputlist") ; iLog->Log(Kerr) ; - } - - - TInt ret = KErrGeneral ; - - if((errprm->Value()).AsTInt32() == SErrBadArgumentType) - { + } + + + TInt ret = KErrGeneral ; + + if((errprm->Value()).AsTInt32() == SErrBadArgumentType) + { ret = KErrNone ; - } - - locinterface->Close() ; - - //delete inlist ; - //Sdelete outlist ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - __UHEAP_MARKEND ; - - return ret ; - + } + + locinterface->Close() ; + + //delete inlist ; + //Sdelete outlist ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + + return ret ; + } /** @@ -3400,46 +3433,46 @@ */ TInt CTestProvider :: CancelWrongNotification1(CStifItemParser& /*aItem*/) { - - - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - _LIT(KLog , "StraySignalTest ") ; - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + + + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "StraySignalTest ") ; + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L("Wrong Notification GetLoc cancel") , GetLocWrongCancel ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL);; - - if(!ret) - { - - _LIT(Klog , "Created the thread ") ; - iLog->Log(Klog) ; - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - else - { - return ret ; - } - - if(ret == SErrBadArgumentType) - { - ret = KErrNone ; - } - /*else + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "Created the thread ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + else + { + return ret ; + } + + if(ret == SErrBadArgumentType) + { + ret = KErrNone ; + } + /*else { ret = KErrGeneral ; } */ - return ret; + return ret; } @@ -3450,43 +3483,43 @@ */ TInt CTestProvider :: CancelWrongNotification2(CStifItemParser& /*aItem*/) { - - - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - _LIT(KLog , "CancelWrongNotification2 ") ; - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + + + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "CancelWrongNotification2 ") ; + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L("Wrong Notification Trace cancel") , TraceLocWrongCancel ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL);; - - if(!ret) - { - - _LIT(Klog , "Created the thread ") ; - iLog->Log(Klog) ; - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - else - { - return ret ; - } - - if(ret == SErrBadArgumentType) - { - ret = KErrNone ; - } - - return ret; + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "Created the thread ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + else + { + return ret ; + } + + if(ret == SErrBadArgumentType) + { + ret = KErrNone ; + } + + return ret; } @@ -3495,93 +3528,94 @@ */ TInt CTestProvider :: GetLocationCancel(CStifItemParser& /*aItem*/) { - - - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - _LIT(KLog , "Getlocationcancel ") ; - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + + + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "Getlocationcancel ") ; + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L("Getlocationcancel ") , GetLocCancel ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL);; - - if(!ret) - { - - _LIT(Klog , "Created the thread ") ; - iLog->Log(Klog) ; - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - else - { - return ret ; - } - - - return ret; + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "Created the thread ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + else + { + return ret ; + } + + + return ret; } - + /** * GetLocation Timeout */ TInt CTestProvider :: GetLocationTimedOut(CStifItemParser& /*aItem*/) { + __UHEAP_MARK ; _LIT(KTLocTest ,"TLocTest"); iLog->Log(KTLocTest) ; _LIT(KLog , "GetLocationTimedOut ") ; iLog->Log(KTLocTest) ; - - return KErrNone ; //This is a manul test case + + return KErrNone ; //This is a manul test case CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - + // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - return KErrGeneral ; - } - + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + pos = 0 ; - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); - - if(!genericparm) - { - - return KErrGeneral ; - } - + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); inputlist->Reset(); outputlist->Reset(); @@ -3599,32 +3633,32 @@ locinterface->ExecuteCmdL(CmdBufSet , *inputlist , *outputlist); UpdateOptsMap->DecRef() ; - + pos = 0 ; - + const TLiwGenericParam *errcode = outputlist->FindFirst(pos , KErrCode) ; - + if(pos == KErrNotFound) { - _LIT(KLog , "Success/Error Code is missing ") ; - iLog->Log(KLog) ; - return KErrGeneral ; - } - + _LIT(KLog , "Success/Error Code is missing ") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + pos = (errcode->Value()).AsTInt32() ; - + delete ServiceHandler ; delete crit ; locinterface->Close() ; - + __UHEAP_MARKEND ; if(pos == KErrTimedOut) { - return KErrNone ; - } - - _LIT(Kerr , "Time out value not set correctly") ; + return KErrNone ; + } + + _LIT(Kerr , "Time out value not set correctly") ; return KErrNone ; - + } /** @@ -3632,49 +3666,49 @@ */ TInt CTestProvider :: TraceLocationCancel(CStifItemParser& /*aItem*/) { - - - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - _LIT(KLog , "Getlocationcancel ") ; - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - + + + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "Getlocationcancel ") ; + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + TInt ret = FunctionThread.Create(_L("Getlocationcancel ") , TraceLocCancel ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL);; - - if(!ret) - { - - _LIT(Klog , "Created the thread ") ; - iLog->Log(Klog) ; - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - FunctionThread.Close(); - - ret = Status.Int() ; - } - else - { - return ret ; - } - - - return ret; + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "Created the thread ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + else + { + return ret ; + } + + + return ret; } /** *Math Operation Find distance : Position based parameter */ - TInt CTestProvider :: FindDistanceAgain(CStifItemParser& /*aItem*/) - { - __UHEAP_MARK; - TInt start = User::CountAllocCells(); - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); +TInt CTestProvider :: FindDistanceAgain(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK; + TInt start = User::CountAllocCells(); + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); // Input and output parameter list CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); @@ -3712,56 +3746,56 @@ } MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - - + + + TBuf8<20>CmdBuf(KRequestCalculate) ; - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestBearingTo)) ; - InputList->AppendL(requesttype) ; - - //Inserting first input param - CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); - TReal64 slongitude = 22; - SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); - TReal64 slatitude = 88; - SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); - TReal64 saltitude = 1; - SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); - - TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); - InputList->AppendL(scoordinate) ; - SourceCoordinate->DecRef() ; - - - - //Inserting 2nd input param - CLiwDefaultMap* DestCoordinate = CLiwDefaultMap::NewL(); - TReal64 dlongitude = 13; + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestBearingTo)) ; + InputList->AppendL(requesttype) ; + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 22; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 88; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); + + TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); + InputList->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + //Inserting 2nd input param + CLiwDefaultMap* DestCoordinate = CLiwDefaultMap::NewL(); + TReal64 dlongitude = 13; DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); - TReal64 dlatitude = 77; - - - DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); - TReal64 daltitude = 1; - DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); - - TLiwGenericParam dcoordinate(KNullDesC8,TLiwVariant(DestCoordinate)); - InputList->AppendL(dcoordinate) ; - DestCoordinate->DecRef() ; - - - CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - CmdBuf = KRequestCalculate ; + TReal64 dlatitude = 77; + + + DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); + TReal64 daltitude = 1; + DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); + + TLiwGenericParam dcoordinate(KNullDesC8,TLiwVariant(DestCoordinate)); + InputList->AppendL(dcoordinate) ; + DestCoordinate->DecRef() ; + + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + CmdBuf = KRequestCalculate ; locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); - pos = 0; + pos = 0; const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); pos = 0; @@ -3802,490 +3836,30 @@ locinterface->Close() ; OutParmList->Reset(); InputList->Reset(); - delete OutParmList ; - delete InputList ; + delete OutParmList ; + delete InputList ; delete ServiceHandler ; a.ResetAndDestroy() ; - + TInt end = User::CountAllocCells(); - __UHEAP_MARKEND ; - + __UHEAP_MARKEND ; + return KErrNone ; - - - - - } + + + + + } /** * Math operation BearingTo Test */ - - TInt CTestProvider ::BearingToTest(CStifItemParser& /*aItem*/) - { - __UHEAP_MARK ; - - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - - // Input and output parameter list - CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); - CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - return KErrGeneral ; - } - - pos = 0 ; - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - TBuf8<20>CmdBuf(KRequestCalculate) ; - - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestBearingTo)) ; - InputList->AppendL(requesttype) ; - - //Inserting first input param - CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); - TReal64 slongitude = 22; - SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); - TReal64 slatitude = 88; - SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); - TReal64 saltitude = 1; - SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); - - TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); - InputList->AppendL(scoordinate) ; - SourceCoordinate->DecRef() ; - - - - //Inserting 2nd input param - CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); - TReal64 dlongitude = 13; - DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); - TReal64 dlatitude = 77; - DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); - TReal64 daltitude = 1; - DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); - - TLiwGenericParam dcoordinate(KDistanceParmDestination,TLiwVariant(DestCoordinate)); - InputList->AppendL(dcoordinate) ; - DestCoordinate->DecRef() ; - - - CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - CmdBuf = KRequestCalculate ; - - locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); - - - pos = 0; - const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); - - pos = 0; - const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); - TLiwVariant resultvariant = resultparam->Value(); - TReal32 bearingTo = resultvariant.AsTReal(); - - - - - //Logging result into a file - RFile LogFile ; - RFs LogSession ; - TBuf8<50> Buffer(_L8("BearingTo = ")) ; - LogSession.Connect() ; - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; - } - - TInt End = 0 ; - - LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing - - TBuf8<50> num ; - TRealFormat format ; - - num.Num(bearingTo , format) ; - - - LogFile.Write(_L8("BearingTo= ")); - LogFile.Write(num) ; - LogFile.Write(_L8("\n")) ; - LogFile.Close() ; - LogSession.Close() ; - - delete OutParmList ; - dcoordinate.Reset() ; - scoordinate.Reset() ; - delete InputList ; - locinterface->Close() ; - inputlist->Reset() ; - outputlist->Reset() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - a.Close() ; - __UHEAP_MARKEND ; - return KErrNone ; - - - } - - TInt CTestProvider ::FindDistance(CStifItemParser& /*aItem*/) + +TInt CTestProvider ::BearingToTest(CStifItemParser& /*aItem*/) { - __UHEAP_MARK ; - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - - // Input and output parameter list - CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); - CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - return KErrGeneral ; - } - - pos = 0 ; - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - //First set the identity information - - ; - TBuf8<20>CmdBufSet(KRequestCalculate) ; - outputlist->Reset() ; - inputlist->Reset() ; - - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestDistance)) ; - InputList->AppendL(requesttype) ; - - - - //Inserting first input param - CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); - TReal64 slongitude = 71.03; - SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); - TReal64 slatitude = 42.37; - SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); - TReal64 saltitude = 1; - SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); - - TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); - InputList->AppendL(scoordinate) ; - SourceCoordinate->DecRef() ; - - - - //Inserting 2nd input param - CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); - TReal64 dlongitude = 83.02; - DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); - TReal64 dlatitude = 42.42; - DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); - TReal64 daltitude = 1; - DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); - - TLiwGenericParam dcoordinate(KDistanceParmDestination,TLiwVariant(DestCoordinate)); - InputList->AppendL(dcoordinate) ; - DestCoordinate->DecRef() ; - - CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - CmdBufSet = KRequestCalculate ; - - locinterface->ExecuteCmdL(CmdBufSet , *InputList , *OutParmList); - - - pos = 0; - const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); - - - pos = 0; - const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); - TLiwVariant resultvariant = resultparam->Value(); - TReal64 distance = resultvariant.AsTReal(); - - - - - //Logging result into a file - RFile LogFile ; - RFs LogSession ; - TBuf8<50> Buffer(_L8("Distance = ")) ; - LogSession.Connect() ; - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; - - } - - TInt End = 0 ; - - LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing - - TBuf8<50> num ; - TRealFormat format ; - //TReal64 Val = aPosition.Latitude() ; - num.Num(distance , format) ; - - //Logging Latitude - LogFile.Write(_L8("distance = ")); - LogFile.Write(num) ; - LogFile.Write(_L8("\n")) ; - LogFile.Close() ; - LogSession.Close() ; - - delete InputList ; - delete OutParmList ; - locinterface->Close() ; - delete ServiceHandler ; - a.ResetAndDestroy() ; - - __UHEAP_MARKEND ; - return KErrNone ; - - - - - } - -TInt CTestProvider ::GetLocationUpdateOpts(CStifItemParser& /*aItem*/) - { - - __UHEAP_MARK; - RFile LogFile ; - RFs LogSession ; - TBuf8<50> data ; - TRealFormat format ; - LogSession.Connect() ; - _LIT8(KLog , "GetLocationUpdateOPts") ; - iLog->Log(KLog) ; - - - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; - } - - CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); - - // Input and output parameter list - CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); - CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); - - - - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); - - - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - ServiceHandler->AttachL(a) ; - ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); - - - - - TInt pos = 0; - - const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; - - if(!errorprm) - { - return KErrGeneral ; - } - - pos = 0 ; - const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); - - if(!genericparm) - { - - return KErrGeneral ; - } - - MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - - TBuf8<20>CmdBuf(KCmdGetLocation) ; - - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - //Append LocationInformation Category - TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; - InputList->AppendL(informationCategory) ; - - //Appending update options - CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); - - TInt32 updateInterval = 30000; - - updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); - - TInt32 updateTimeOut = 10000; - updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); - - TInt32 updateMaxAge = 2000; - updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); - - TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); - InputList->AppendL(updateOption) ; - - CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - - - locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); - - - pos = 0; - const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); - - - pos = 0; - const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KLocationMap); - TLiwVariant resultvariant = resultparam->Value(); - - const CLiwMap *LocMap = resultvariant.AsMap() ; - - TLiwVariant PosVariant ; - - LocMap->FindL(KLongitudeKey , PosVariant) ; - - - TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude - data.Num(LongData , format) ; - LogFile.Write(_L8("\n")) ; - LogFile.Write(_L8("Logitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude - - TReal64 LatData = (TReal64)PosVariant.AsTReal() ; - data.Num(LatData , format) ; - LogFile.Write(_L8(" Latitude = ")) ; - LogFile.Write(data) ; - - LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude - TReal32 AltData = PosVariant.AsTReal() ; - data.Num(AltData , format) ; - - LogFile.Write(_L8(" Altitude = ")) ; - LogFile.Write(data) ; - LogFile.Close() ; - locinterface->Close() ; - LogSession.Close() ; - - delete ServiceHandler ; - InputList->Reset(); - OutParmList->Reset(); - delete InputList ; - delete OutParmList ; - __UHEAP_MARKEND; - return KErrNone ; - - } - - - -void FillCoordinatesL ( TCoordinate &aCoordinate , const CLiwMap *aMap ) - { - TLiwVariant longitudevar ; - TLiwVariant latitudevar ; - TLiwVariant altitudevar ; - - aMap->FindL(KLongitudeKey , longitudevar) ; - aMap->FindL(KLatitudeKey , latitudevar) ; - aMap->FindL(KAltitudeKey , altitudevar ) ; - - TReal64 latitude = (TReal64)latitudevar.AsTReal() ; - TReal64 longitude = (TReal64)longitudevar.AsTReal() ; - TReal32 altitude = (TReal32)altitudevar.AsTReal() ; - - aCoordinate.SetCoordinate( latitude , longitude , altitude) ; - - - } - -/** - * Math Function test Move coordinates - */ - - TInt CTestProvider :: MoveCoordinates(CStifItemParser& /*aItem*/) - { - - __UHEAP_MARK ; + __UHEAP_MARK ; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); // Input and output parameter list @@ -4328,129 +3902,3650 @@ } MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); - + TBuf8<20>CmdBuf(KRequestCalculate) ; + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestBearingTo)) ; + InputList->AppendL(requesttype) ; + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 22; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 88; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); + + TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); + InputList->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + //Inserting 2nd input param + CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); + TReal64 dlongitude = 13; + DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); + TReal64 dlatitude = 77; + DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); + TReal64 daltitude = 1; + DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); + + TLiwGenericParam dcoordinate(KDistanceParmDestination,TLiwVariant(DestCoordinate)); + InputList->AppendL(dcoordinate) ; + DestCoordinate->DecRef() ; + + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + CmdBuf = KRequestCalculate ; + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); + + + pos = 0; + const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); + + pos = 0; + const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); + TLiwVariant resultvariant = resultparam->Value(); + TReal32 bearingTo = resultvariant.AsTReal(); + + + + + //Logging result into a file + RFile LogFile ; + RFs LogSession ; + TBuf8<50> Buffer(_L8("BearingTo = ")) ; + LogSession.Connect() ; + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; + } + + TInt End = 0 ; + + LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing + + TBuf8<50> num ; + TRealFormat format ; + + num.Num(bearingTo , format) ; + + + LogFile.Write(_L8("BearingTo= ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + LogFile.Close() ; + LogSession.Close() ; + + delete OutParmList ; + dcoordinate.Reset() ; + scoordinate.Reset() ; + delete InputList ; + locinterface->Close() ; + inputlist->Reset() ; + outputlist->Reset() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return KErrNone ; + + + } + +TInt CTestProvider ::FindDistance(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + + pos = 0 ; + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + //First set the identity information + + ; + TBuf8<20>CmdBufSet(KRequestCalculate) ; + outputlist->Reset() ; + inputlist->Reset() ; + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestDistance)) ; + InputList->AppendL(requesttype) ; + + + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 71.03; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 42.37; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); + + TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); + InputList->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + //Inserting 2nd input param + CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); + TReal64 dlongitude = 83.02; + DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); + TReal64 dlatitude = 42.42; + DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); + TReal64 daltitude = 1; + DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); + + TLiwGenericParam dcoordinate(KDistanceParmDestination,TLiwVariant(DestCoordinate)); + InputList->AppendL(dcoordinate) ; + DestCoordinate->DecRef() ; + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + CmdBufSet = KRequestCalculate ; + + locinterface->ExecuteCmdL(CmdBufSet , *InputList , *OutParmList); + + + pos = 0; + const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); + + + pos = 0; + const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); + TLiwVariant resultvariant = resultparam->Value(); + TReal64 distance = resultvariant.AsTReal(); + + + + + //Logging result into a file + RFile LogFile ; + RFs LogSession ; + TBuf8<50> Buffer(_L8("Distance = ")) ; + LogSession.Connect() ; + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; + + } + + TInt End = 0 ; + + LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing + + TBuf8<50> num ; + TRealFormat format ; + //TReal64 Val = aPosition.Latitude() ; + num.Num(distance , format) ; + + //Logging Latitude + LogFile.Write(_L8("distance = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + LogFile.Close() ; + LogSession.Close() ; + + delete InputList ; + delete OutParmList ; + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + + + } + +TInt CTestProvider ::GetLocationUpdateOpts(CStifItemParser& /*aItem*/) + { + + __UHEAP_MARK; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + LogSession.Connect() ; + _LIT8(KLog , "GetLocationUpdateOPts") ; + iLog->Log(KLog) ; + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; + } + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + + pos = 0 ; + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + //Append LocationInformation Category + TLiwGenericParam informationCategory(KLocationInfoCategory , TLiwVariant(KLocationBasicinfo)) ; + InputList->AppendL(informationCategory) ; + + //Appending update options + CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); + + TInt32 updateInterval = 30000; + + updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); + + TInt32 updateTimeOut = 10000; + updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); + + TInt32 updateMaxAge = 2000; + updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); + + TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); + InputList->AppendL(updateOption) ; + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); + + + pos = 0; + const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); + + + pos = 0; + const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KLocationMap); + TLiwVariant resultvariant = resultparam->Value(); + + const CLiwMap *LocMap = resultvariant.AsMap() ; + + TLiwVariant PosVariant ; + + LocMap->FindL(KLongitudeKey , PosVariant) ; + + + TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude + data.Num(LongData , format) ; + LogFile.Write(_L8("\n")) ; + LogFile.Write(_L8("Logitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude + + TReal64 LatData = (TReal64)PosVariant.AsTReal() ; + data.Num(LatData , format) ; + LogFile.Write(_L8(" Latitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude + TReal32 AltData = PosVariant.AsTReal() ; + data.Num(AltData , format) ; + + LogFile.Write(_L8(" Altitude = ")) ; + LogFile.Write(data) ; + LogFile.Close() ; + locinterface->Close() ; + LogSession.Close() ; + + delete ServiceHandler ; + InputList->Reset(); + OutParmList->Reset(); + delete InputList ; + delete OutParmList ; + __UHEAP_MARKEND; + return KErrNone ; + + } + + + +void FillCoordinatesL ( TCoordinate &aCoordinate , const CLiwMap *aMap ) + { + __UHEAP_MARK ; + TLiwVariant longitudevar ; + TLiwVariant latitudevar ; + TLiwVariant altitudevar ; + + aMap->FindL(KLongitudeKey , longitudevar) ; + aMap->FindL(KLatitudeKey , latitudevar) ; + aMap->FindL(KAltitudeKey , altitudevar ) ; + + TReal64 latitude = (TReal64)latitudevar.AsTReal() ; + TReal64 longitude = (TReal64)longitudevar.AsTReal() ; + TReal32 altitude = (TReal32)altitudevar.AsTReal() ; + + aCoordinate.SetCoordinate( latitude , longitude , altitude) ; + + __UHEAP_MARKEND ; + } + +/** + * Math Function test Move coordinates + */ + +TInt CTestProvider :: MoveCoordinates(CStifItemParser& /*aItem*/) + { + + __UHEAP_MARK ; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + + pos = 0 ; + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + TBuf8<20>CmdBuf(KRequestCalculate) ; outputlist->Reset() ; inputlist->Reset() ; - CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; - - TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestMove)) ; - InputList->AppendL(requesttype) ; - - - //Inserting first input param - CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); - TReal64 slongitude = 22; - SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); - TReal64 slatitude = 88; - SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); - - TReal64 saltitude = 1; - SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); - - - - TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); - InputList->AppendL(scoordinate) ; - SourceCoordinate->DecRef() ; - - - - TReal32 distanceToMove = 345; - TReal32 bearingToMove = 45; - - - //Inserting distance by which coordinate should be moved - TLiwVariant distanceVal((TReal)distanceToMove); - TLiwGenericParam distanceParam(KDistanceMove,distanceVal); - InputList->AppendL(distanceParam); - - //Inserting bearing by which coordinate should be moved - TLiwVariant bearingVal((TReal)bearingToMove); - TLiwGenericParam bearingParam(KBearingMove,bearingVal); - InputList->AppendL(bearingParam); - - - - - - CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; - - - - - locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); - - - - - - TInt mathindex = 0; - - // calculation - const TLiwGenericParam *smapparam = OutParmList->FindFirst(mathindex , KLocationMap) ; - TLiwVariant mapVariant= smapparam->Value() ; - const CLiwMap *map = mapVariant.AsMap() ; - TCoordinate source ; - - FillCoordinatesL(source , map) ; - - TReal64 longitudeInputVal = source.Longitude(); - TReal64 latitudeInputVal = source.Latitude(); - TReal64 altitudeInputVal = source.Altitude(); - - - //Logging result into a file - RFile LogFile ; - RFs LogSession ; - TBuf8<50> Buffer(_L8("Longitude = ")) ; - LogSession.Connect() ; - - if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) - { - LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; - - } - - TInt End = 0 ; - - LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing - - TBuf8<50> num ; - TRealFormat format ; - - num.Num(longitudeInputVal, format) ; - - //Logging - LogFile.Write(_L8("Longitude = ")); - LogFile.Write(num) ; - LogFile.Write(_L8("\n")) ; - //LogFile.Seek(ESeekEnd , End) ; - num.Num(latitudeInputVal, format) ; - LogFile.Write(_L8("Latitude = ")); - LogFile.Write(num) ; - LogFile.Write(_L8("\n")) ; - num.Num(altitudeInputVal, format) ; - LogFile.Write(_L8("altitude = ")); - LogFile.Write(num) ; - LogFile.Write(_L8("\n")) ; - LogFile.Close() ; - LogSession.Close() ; - - delete OutParmList ; - delete InputList ; - locinterface->Close() ; + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KMathRequest , TLiwVariant(KRequestMove)) ; + InputList->AppendL(requesttype) ; + + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 22; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 88; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); + + + + TLiwGenericParam scoordinate(KDistanceParmSource,TLiwVariant(SourceCoordinate)); + InputList->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + TReal32 distanceToMove = 345; + TReal32 bearingToMove = 45; + + + //Inserting distance by which coordinate should be moved + TLiwVariant distanceVal((TReal)distanceToMove); + TLiwGenericParam distanceParam(KDistanceMove,distanceVal); + InputList->AppendL(distanceParam); + + //Inserting bearing by which coordinate should be moved + TLiwVariant bearingVal((TReal)bearingToMove); + TLiwGenericParam bearingParam(KBearingMove,bearingVal); + InputList->AppendL(bearingParam); + + + + + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); + + + + + + TInt mathindex = 0; + + // calculation + const TLiwGenericParam *smapparam = OutParmList->FindFirst(mathindex , KLocationMap) ; + TLiwVariant mapVariant= smapparam->Value() ; + const CLiwMap *map = mapVariant.AsMap() ; + TCoordinate source ; + + FillCoordinatesL(source , map) ; + + TReal64 longitudeInputVal = source.Longitude(); + TReal64 latitudeInputVal = source.Latitude(); + TReal64 altitudeInputVal = source.Altitude(); + + + //Logging result into a file + RFile LogFile ; + RFs LogSession ; + TBuf8<50> Buffer(_L8("Longitude = ")) ; + LogSession.Connect() ; + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; + + } + + TInt End = 0 ; + + LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing + + TBuf8<50> num ; + TRealFormat format ; + + num.Num(longitudeInputVal, format) ; + + //Logging + LogFile.Write(_L8("Longitude = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + //LogFile.Seek(ESeekEnd , End) ; + num.Num(latitudeInputVal, format) ; + LogFile.Write(_L8("Latitude = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + num.Num(altitudeInputVal, format) ; + LogFile.Write(_L8("altitude = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + LogFile.Close() ; + LogSession.Close() ; + + delete OutParmList ; + delete InputList ; + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return KErrNone ; + } + + + + + + +TInt CTestProvider :: GetLastLocation(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + //TBuf8<20>CmdBuf(KCmdGetLocation) ; + TBuf8<20>CmdBuf(_L8("GetLastPosition")); + outputlist->Reset() ; + inputlist->Reset() ; + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() ) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + return (ErrorParm->Value()).AsTInt32() ; + } + + + + TInt index = 0 ; + + const TLiwGenericParam *GenericParam = outputlist->FindFirst(index , KLocationMap); + + + if(!GenericParam) + { + _LIT(Klog, "Out Param not found") ; + iLog->Log(Klog) ; + return KErrGeneral ; //Param Error + } + + TLiwVariant Variant ; + + Variant = GenericParam->Value() ; + const CLiwMap *LocMap = Variant.AsMap() ; + + TLiwVariant PosVariant ; + + LocMap->FindL(KLongitudeKey , PosVariant) ; + TReal64 LongData = (TReal64)PosVariant.AsTReal() ; //Longitude + data.Num(LongData , format) ; + LogFile.Write(_L8("\n")) ; + LogFile.Write(_L8("Logitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KLatitudeKey ,PosVariant) ; //Latitude + + TReal64 LatData = (TReal64)PosVariant.AsTReal() ; + data.Num(LatData , format) ; + LogFile.Write(_L8(" Latitude = ")) ; + LogFile.Write(data) ; + + LocMap->FindL(KAltitudeKey , PosVariant) ; //Altitude + TReal32 AltData = PosVariant.AsTReal() ; + data.Num(AltData , format) ; + + LogFile.Write(_L8(" Altitude = ")) ; + LogFile.Write(data) ; + + + TLiwVariant Speed ; + + index = LocMap->FindL(_L8("HorizontalSpeed") , Speed ) ; + + if(index ) + { + + TReal speed = Speed.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + TLiwVariant Accuracy; + index = LocMap->FindL(_L8("HorizontalAccuracy"),Accuracy); + + if(index) + { + TReal32 AccuracyVal = Accuracy.AsTReal(); + data.Num(AccuracyVal , format) ; + + LogFile.Write(_L8("Horizontal Acc = ")) ; + LogFile.Write(data) ; + } + + Accuracy.Reset(); + index = LocMap->FindL(_L8("VerticalAccuracy"),Accuracy); + + if(index) + { + TReal32 AccuracyVal = Accuracy.AsTReal(); + data.Num(AccuracyVal , format) ; + + LogFile.Write(_L8("Vertical Acc = ")) ; + LogFile.Write(data) ; + } + + TLiwVariant SpeedError ; + index = LocMap->FindL( _L8("HorizontalSpeedError") , SpeedError) ; + + + if(index ) + { + + TReal speed = SpeedError.AsTReal() ; + + data.Num(speed , format) ; + + LogFile.Write(_L8("Speed = ")) ; + LogFile.Write(data) ; + + } + + index = 0 ; + + TLiwVariant SatInfo ; + + index = LocMap->FindL(_L8("SatelliteNumView") , SatInfo) ; + + if(index ) + { + + TInt satnumView = SatInfo.AsTInt32() ; + data.Num(satnumView , format); + + LogFile.Write(_L8("Satellite information")) ; + + LogFile.Write(_L8("Number of visible satellites ")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TLiwVariant SatInfoview ; + + index = LocMap->FindL( _L8("SatelliteNumViewUsed") , SatInfoview) ; + if(index ) + { + + + TInt satnumViewUsed = SatInfoview.AsTInt32() ; + data.Num(satnumViewUsed , format); + + LogFile.Write(_L8("\nSatellite information")) ; + + LogFile.Write(_L8("\nSatelliteNumViewUsed")) ; + LogFile.Write(data) ; + } + + index = 0 ; + + TInt Headinginfo = 0 ; + + TLiwVariant Heading ; + Headinginfo = LocMap->FindL(_L8("Heading") ,Heading) ; + + if(Headinginfo) + { + + + TReal heading = Heading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading")) ; + LogFile.Write(data) ; + } + + + if(Headinginfo) + { + TLiwVariant HeadingError ; + index = LocMap->FindL( _L8("HeadingError") , HeadingError ) ; + + if(index) + { + + + TReal heading = HeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nHeading Error")) ; + LogFile.Write(data) ; + + } + + TLiwVariant MagneticHeading ; + index = LocMap->FindL( _L8("MagneticHeading") , MagneticHeading) ; + + if(index) + { + + + TReal heading = MagneticHeading.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticHeading ")) ; + LogFile.Write(data) ; + + } + + + TLiwVariant MagneticHeadingError ; + index = LocMap->FindL(_L8("MagneticHeadingError") ,MagneticHeadingError) ; + + if(index) + { + + + TReal heading = MagneticHeadingError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } //End of Heading + + + + TLiwVariant TrueCourse ; + index = LocMap->FindL( _L8("TrueCourse") , TrueCourse ) ; + + if( index) + { + + + TReal heading = TrueCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\nDirection ")) ; + + LogFile.Write(_L8("\n TrueCourse Error")) ; + LogFile.Write(data) ; + + + + TLiwVariant TrueCourseError ; + index = LocMap->FindL( _L8("TrueCourseError") , TrueCourseError ) ; + + if( index) + { + + + TReal heading = TrueCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticHeading Error")) ; + LogFile.Write(data) ; + + } + + + } + + + TLiwVariant MagneticCourse ; + index = LocMap->FindL(_L8("MagneticCourse") , MagneticCourse ) ; + + + if(index) + { + + TReal heading = MagneticCourse.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\nMagneticCourse ")) ; + LogFile.Write(data) ; + + + + TLiwVariant MagneticCourseError ; + index = LocMap->FindL(_L8("MagneticCourseError") ,MagneticCourseError ) ; + + if( index) + { + + + TReal heading = MagneticCourseError.AsTReal() ; + data.Num(heading , format); + + LogFile.Write(_L8("\ncompass information")) ; + + LogFile.Write(_L8("\n MagneticCourseError Error")) ; + LogFile.Write(data) ; + + } + + + } + + + + TLiwVariant NmeaNum ; + index = LocMap->FindL(_L8("NMEASentence") , NmeaNum ) ; + + + if(index) + { + + TInt32 NMEASentence = NmeaNum.AsTInt32() ; + data.Num(NMEASentence , format); + + LogFile.Write(_L8("\nNMEA Information")) ; + + LogFile.Write(_L8("\n number of NMEA Sentences ")) ; + LogFile.Write(data) ; + + index = 0 ; + + const TLiwGenericParam *MagneticCourseError = outputlist->FindFirst(index , _L8("NMEASentenceStart") ) ; + + if(-1 != index) + { + Variant = MagneticCourseError->Value() ; + + + } + + + } + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; delete ServiceHandler ; a.ResetAndDestroy() ; a.Close() ; - __UHEAP_MARKEND ; - return KErrNone ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + + } + + +TInt CTestProvider ::GetLocationMultiple(CStifItemParser& /*aItem*/) + { + + + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; + + if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create log file\n") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + LogFile.Write(data) ; + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; + //Make the first call + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + _LIT(Klog , "ERRor code from getlocationasynch ") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + _LIT8(KTransactionId, "TransactionID"); + const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; + + + if(!transid) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt32 trid = (transid->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + //Make second call + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + pos = 0 ; + + const TLiwGenericParam *ErrorParm1 = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm1) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror1 = (ErrorParm1->Value()).AsTInt32(); + _LIT(Klog1 , "ERRor code from getlocationasynch ") ; + data.Copy(Klog1); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata1 = reqerror1 ; + data.Num(errordata1 , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + + const TLiwGenericParam *transid1 = outputlist->FindFirst(pos ,KTransactionId ) ; + + + if(!transid1) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt32 trid1 = (transid1->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + + ///////////////Cancel first call + + inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; + data.Copy(Klog); + LogFile.Write(data) ; + //LogFile.Write(Klog); + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + + _LIT(Klog2 , "\nERRor code from cancel ") ; + + data.Copy(Klog2); + LogFile.Write(data) ; + //LogFile.Write(Klog1) ; + + errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + if( KErrNone != reqerror ) + { + User::Leave(reqerror); + } + //Cancel the second call + inputlist->Reset(); + inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid1))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; + data.Copy(Klog); + LogFile.Write(data) ; + //LogFile.Write(Klog); + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + + _LIT(Klog3 , "\nERRor code from cancel ") ; + + data.Copy(Klog3); + LogFile.Write(data) ; + //LogFile.Write(Klog1) ; + + errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + if( KErrNone != reqerror ) + { + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete callBack; + delete crit; + //a.ResetAndDestroy() ; + a.Close() ; + delete ServiceHandler ; + + __UHEAP_MARKEND ; + return reqerror ; + } + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete callBack; + delete crit; + //a.ResetAndDestroy() ; + a.Close() ; + delete ServiceHandler ; + + __UHEAP_MARKEND ; + return reqerror ; + + + + + + } + + + +TInt CTestProvider ::TraceMultiple(CStifItemParser& /*aItem*/) + { + + + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; + + if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create log file\n") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + LogFile.Write(data) ; + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KTraceLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; + //Make the first call + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + _LIT(Klog , "ERRor code from getlocationasynch ") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + _LIT8(KTransactionId, "TransactionID"); + const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; + + + if(!transid) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt32 trid = (transid->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + //Make second call + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + pos = 0 ; + + const TLiwGenericParam *ErrorParm1 = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm1) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror1 = (ErrorParm1->Value()).AsTInt32(); + _LIT(Klog1 , "ERRor code from getlocationasynch ") ; + data.Copy(Klog1); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata1 = reqerror1 ; + data.Num(errordata1 , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + + const TLiwGenericParam *transid1 = outputlist->FindFirst(pos ,KTransactionId ) ; + + + if(!transid1) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt32 trid1 = (transid1->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + + ///////////////Cancel first call + + inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; + data.Copy(Klog); + LogFile.Write(data) ; + //LogFile.Write(Klog); + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + + _LIT(Klog2 , "\nERRor code from cancel ") ; + + data.Copy(Klog2); + LogFile.Write(data) ; + //LogFile.Write(Klog1) ; + + errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + if( KErrNone != reqerror ) + { + User::Leave(reqerror); + } + //Cancel the second call + inputlist->Reset(); + inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid1))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; + data.Copy(Klog); + LogFile.Write(data) ; + //LogFile.Write(Klog); + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + + _LIT(Klog3 , "\nERRor code from cancel ") ; + + data.Copy(Klog3); + LogFile.Write(data) ; + //LogFile.Write(Klog1) ; + + errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + if( KErrNone != reqerror ) + { + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete callBack; + delete crit; + //a.ResetAndDestroy() ; + a.Close() ; + delete ServiceHandler ; + + __UHEAP_MARKEND ; + return reqerror ; + } + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete callBack; + delete crit; + //a.ResetAndDestroy() ; + a.Close() ; + delete ServiceHandler ; + + __UHEAP_MARKEND ; + return reqerror ; + + + + + + } + + + + +TInt CTestProvider ::TraceTimeOut(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"TraceTimeOut"); + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" Timeouttrace Thread") , TraceTO ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) NULL); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + } + +TInt CTestProvider ::TraceMultipleWrongCancel(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; + + if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create log file\n") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + LogFile.Write(data) ; + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KTraceLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; + //Make the first call + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + _LIT(Klog , "ERRor code from getlocationasynch ") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + _LIT8(KTransactionId, "TransactionID"); + const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; + + + if(!transid) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt32 trid = (transid->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + //Make second call + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + pos = 0 ; + + const TLiwGenericParam *ErrorParm1 = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm1) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror1 = (ErrorParm1->Value()).AsTInt32(); + _LIT(Klog1 , "ERRor code from getlocationasynch ") ; + data.Copy(Klog1); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata1 = reqerror1 ; + data.Num(errordata1 , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + + const TLiwGenericParam *transid1 = outputlist->FindFirst(pos ,KTransactionId ) ; + + + if(!transid1) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt32 trid1 = (transid1->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + + ///////////////Cancel first call by using CancelNotification + _LIT8(KCancel , "CancelNotification") ; + _LIT8( KType ,"CancelRequestType") ; + _LIT( KTraceCancel ,"TraceCancel") ; + inputlist->AppendL(TLiwGenericParam (KType , TLiwVariant (KTraceCancel))) ; + + locinterface->ExecuteCmdL(KCancel , *inputlist , *outputlist) ; + + pos = 0 ; + const TLiwGenericParam *errprm = outputlist->FindFirst(pos , KErrCode) ; + + if(!errprm) + { + _LIT(Kerr, "Success/Failure code missing from outputlist") ; + iLog->Log(Kerr) ; + } + + + + TLiwVariant var = errprm->Value() ; + + + + + //Cancel the second call the usual way + inputlist->Reset(); + inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid1))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; + data.Copy(Klog); + LogFile.Write(data) ; + //LogFile.Write(Klog); + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + + _LIT(Klog3 , "\nERRor code from cancel ") ; + + data.Copy(Klog3); + LogFile.Write(data) ; + //LogFile.Write(Klog1) ; + + errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + if( KErrNone != reqerror || var.AsTInt32() != KErrNone) + { + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete callBack; + delete crit; + //a.ResetAndDestroy() ; + a.Close() ; + delete ServiceHandler ; + + __UHEAP_MARKEND ; + return KErrGeneral ; + } + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete callBack; + delete crit; + //a.ResetAndDestroy() ; + a.Close() ; + delete ServiceHandler ; + + __UHEAP_MARKEND ; + return reqerror ; + + + + } + + +TInt CTestProvider ::EnableAccTrueGetLoc(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 1; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + + return ret ; + + } + +TInt CTestProvider ::EnableAccFalseGetLoc(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 2; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + } + + + +TInt CTestProvider ::EnableAccTrueTrace(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 3; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + } + +TInt CTestProvider ::EnableAccFalseTrace(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 4; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + } + + +TInt CTestProvider ::EnableAccPosBasedGetloc(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 1; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + } + + +TInt CTestProvider ::EnableAccPosBasedWrongTypeGetloc(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 2; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + } + + +TInt CTestProvider ::EnableAccPosBasedTrace(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 3; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + + } + + + +TInt CTestProvider ::EnableAccPosBasedWrongTypeTrace(CStifItemParser& /*aItem*/) + { + //return KErrGeneral; + _LIT(KTLocTest ,"EnableAccTrueGetLoc"); + iLog->Log(KTLocTest) ; + TInt flag = 4; + TInt *flagAddr = &flag; + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" EnableAccTrueGetLoc Thread") , EnableHighAcc_PosBased ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) flagAddr); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + if(ret == SErrServiceInUse) + { + _LIT(KLog , "Return Type is valid"); + iLog->Log(KLog); + } + + else + { + _LIT(KLog , "Return type is not valid\n") ; + iLog->Log(KLog) ; + } + return KErrNone ; + } - - - - - - +TInt CTestProvider::GetLocationPosBasedWrongVal(CStifItemParser& /*aItem*/) + { + + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + //_LIT(KClass,"GenericLocationInfo");//Invalid KClass value + TInt KClass = 12; + inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() != SErrBadArgumentType ) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + return (ErrorParm->Value()).AsTInt32() ; + } + + + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + + + } + + +TInt CTestProvider :: CancelTransIdPosBased(CStifItemParser& /*aItem*/) + { + + __UHEAP_MARK ; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + ASyncLocCBF* callBack = new(ELeave) ASyncLocCBF; + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + + pos = 0; + + _LIT8(KTransactionId, "TransactionID"); + const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; + if(!transid) + { + return KErrGeneral; + } + TInt32 trid = (transid->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + + + //inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid))); + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(trid))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + TInt retr = KErrGeneral; + if( 0 == reqerror ) + { + retr = 0; + } + + locinterface->Close() ; + inputlist->Reset(); + outputlist->Reset(); + delete callBack; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return reqerror ; + + + } + +TInt CTestProvider ::CancelWithoutTransId(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; + + if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create log file\n") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + LogFile.Write(data) ; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + ASyncLocCBF* callBack ; + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist\n") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + _LIT(Klog , "ERRor code from getlocationasynch ") ; + data.Copy(Klog); + LogFile.Write(data) ; + + //LogFile.Write(Klog) ; + + TReal64 errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + + pos = 0; + + _LIT8(KTransactionId, "TransactionID"); + const TLiwGenericParam *transid = outputlist->FindFirst(pos ,KTransactionId ) ; + if(!transid) + { + _LIT(KTran,"Missing Transaction ID\n"); + data.Copy(KTran); + LogFile.Write(data) ; + //LogFile.Write(KTran); + return KErrGeneral; + } + TInt trid = (transid->Value()).AsTInt32(); + outputlist->Reset() ; + inputlist->Reset() ; + + + //No trans Id is passed + //inputlist->AppendL(TLiwGenericParam(KTransactionId,TLiwVariant(trid-2))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptCancel); + + ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist in cancel\n ") ; + data.Copy(Klog); + LogFile.Write(data) ; + //LogFile.Write(Klog); + return KErrGeneral ; + } + + reqerror = (ErrorParm->Value()).AsTInt32(); + + _LIT(Klog1 , "\nERRor code from cancel ") ; + + data.Copy(Klog1); + LogFile.Write(data) ; + //LogFile.Write(Klog1) ; + + errordata = reqerror ; + data.Num(errordata , format) ; + + + LogFile.Write(data) ; + + + TInt retr = KErrGeneral; + if( 1002 == reqerror ) + { + retr = 0; + } + + + + + + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return retr ; + + } + +TInt CTestProvider :: GetLocationAsyncPosBasedUpdate(CStifItemParser& /*aItem*/) + { + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + FunctionThread.Create(_L("GetLocationAsynchThread2") , GetLocAsynchPosBased ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) NULL); + + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + return Status.Int() ; + + } + +TInt CTestProvider :: GetLocationAsyncWrongUpdate(CStifItemParser& /*aItem*/) + { + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + FunctionThread.Create(_L("GetLocationAsynchThread2") , GetLocAsynchWrongVal ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) NULL); + // FunctionThread.Create(_L("GetLocationAsynchThread1") , GetLocAsynchWrongVal ,KDefaultStackSize , + // NULL , NULL,(TAny *) NULL); + + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + return Status.Int() ; + + } + +TInt CTestProvider::GetLocPosBasedWrongVal(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + + + if(LogSession.Connect() != KErrNone) + { + _LIT(KLog , "Failed to connect to file server") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + + + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create notifications log file") ; + iLog->Log(KLog) ; + return KErrGeneral ; + } + + } + + _LIT(KLog , "In CTGetLocation") ; + iLog->Log(KLog) ; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + + + + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + _LIT(Klog , "Success/Failure error code missing from outputlist") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + _LIT(KLog , "Interface not found"); + iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + _LIT(KClass,"GenericLocationInfo"); + inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); + + TInt updatemap =12 ; + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() != 1002) + { + _LIT(KLog , "ExecutecmdL failed "); + iLog->Log(KLog) ; + return KErrGeneral; + } + + LogFile.Close() ; + LogSession.Close() ; + + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + + } + + +TInt CTestProvider::GetLocPosBasedWrongVal1(CStifItemParser& /*aItem*/) + { + //currently not needed + + } + + +TInt CTestProvider :: TracePosBasedWrongVal( CStifItemParser& /*aItem*/ ) + { + __UHEAP_MARK ; + TInt start = User::CountAllocCells(); + ASyncLocCBF callback; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdTraceLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + _LIT8(KClass,"LocationInformationClass"); + //_LIT(KClassArg,"Invalid"); + TInt KClassArg = 12; + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(KClassArg))); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + + return KErrGeneral ; + } + TInt error = (ErrorParm->Value()).AsTInt32(); + TInt retr = KErrGeneral; + if( SErrBadArgumentType == error ) + { + retr = KErrNone; + + + } + locinterface->Close() ; + outputlist->Reset() ; + inputlist->Reset() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + TInt end = User::CountAllocCells(); + __UHEAP_MARKEND ; + return retr; + + } + +TInt CTestProvider::TracePosBasedUpdateOpts(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + TInt start = User::CountAllocCells(); + ASyncLocCBF callback; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdTraceLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + _LIT8(KClass,"LocationInformationClass"); + _LIT(KClassArg,"Invalid"); + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(KClassArg))); + + CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); + + _LIT8(KInterval,"UpdateInterval"); + _LIT8(KTimeout,"UpdateTimeOut"); + _LIT8(KAge,"UpdateMaxAge"); + _LIT8(KPartial,"PartialUpdates"); + const TInt KTime = -1000000; // bad time + + updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); + updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); + updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); + updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); + updatemap->DecRef(); + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + + return KErrGeneral ; + } + TInt error = (ErrorParm->Value()).AsTInt32(); + TInt retr = KErrGeneral; + if( SErrBadArgumentType == error ) + { + retr = KErrNone; + + + } + locinterface->Close() ; + outputlist->Reset() ; + inputlist->Reset() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + TInt end = User::CountAllocCells(); + __UHEAP_MARKEND ; + return retr; + + } + +TInt CTestProvider::TracePosBasedUpdateWrongVal(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + TInt start = User::CountAllocCells(); + ASyncLocCBF callback; + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + + + TBuf8<20>CmdBuf(KCmdTraceLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + _LIT8(KClass,"LocationInformationClass"); + _LIT(KClassArg,"Invalid"); + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(KClassArg))); + + TInt updatemap = 12; + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous,&callback); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + + return KErrGeneral ; + } + TInt error = (ErrorParm->Value()).AsTInt32(); + TInt retr = KErrGeneral; + if( SErrBadArgumentType == error ) + { + retr = KErrNone; + + + } + locinterface->Close() ; + outputlist->Reset() ; + inputlist->Reset() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + TInt end = User::CountAllocCells(); + __UHEAP_MARKEND ; + return retr; + + } + + +TInt CTestProvider ::FindDistancePositionBased(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + + pos = 0 ; + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + //First set the identity information + + TBuf8<20>CmdBufSet(KRequestCalculate) ; + outputlist->Reset() ; + inputlist->Reset() ; + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestDistance)) ; + InputList->AppendL(requesttype) ; + + + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 71.03; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 42.37; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); + + TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); + InputList->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + //Inserting 2nd input param + CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); + TReal64 dlongitude = 83.02; + DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); + TReal64 dlatitude = 42.42; + DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); + TReal64 daltitude = 1; + DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); + + TLiwGenericParam dcoordinate(KNullDesC8,TLiwVariant(DestCoordinate)); + InputList->AppendL(dcoordinate) ; + DestCoordinate->DecRef() ; + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + CmdBufSet = KRequestCalculate ; + + locinterface->ExecuteCmdL(CmdBufSet , *InputList , *OutParmList); + + + pos = 0; + const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); + + + pos = 0; + const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); + TLiwVariant resultvariant = resultparam->Value(); + TReal64 distance = resultvariant.AsTReal(); + + + + + //Logging result into a file + RFile LogFile ; + RFs LogSession ; + TBuf8<50> Buffer(_L8("Distance = ")) ; + LogSession.Connect() ; + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; + + } + + TInt End = 0 ; + + LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing + + TBuf8<50> num ; + TRealFormat format ; + //TReal64 Val = aPosition.Latitude() ; + num.Num(distance , format) ; + + //Logging Latitude + LogFile.Write(_L8("distance = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + LogFile.Close() ; + LogSession.Close() ; + + delete InputList ; + delete OutParmList ; + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + + __UHEAP_MARKEND ; + return KErrNone ; + + } + + +TInt CTestProvider::MoveCoordinatePosBased(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + + pos = 0 ; + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + TBuf8<20>CmdBuf(KRequestCalculate) ; + outputlist->Reset() ; + inputlist->Reset() ; + + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestMove)) ; + InputList->AppendL(requesttype) ; + + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 22; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 88; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(saltitude)); + + + + TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); + InputList->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + TReal32 distanceToMove = 345; + TReal32 bearingToMove = 45; + + + //Inserting distance by which coordinate should be moved + TLiwVariant distanceVal((TReal)distanceToMove); + TLiwGenericParam distanceParam(KNullDesC8,distanceVal); + InputList->AppendL(distanceParam); + + //Inserting bearing by which coordinate should be moved + TLiwVariant bearingVal((TReal)bearingToMove); + TLiwGenericParam bearingParam(KNullDesC8,bearingVal); + InputList->AppendL(bearingParam); + + + + + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); + + + + + + TInt mathindex = 0; + + // calculation + const TLiwGenericParam *smapparam = OutParmList->FindFirst(mathindex , KLocationMap) ; + TLiwVariant mapVariant= smapparam->Value() ; + const CLiwMap *map = mapVariant.AsMap() ; + TCoordinate source ; + + FillCoordinatesL(source , map) ; + + TReal64 longitudeInputVal = source.Longitude(); + TReal64 latitudeInputVal = source.Latitude(); + TReal64 altitudeInputVal = source.Altitude(); + + + //Logging result into a file + RFile LogFile ; + RFs LogSession ; + TBuf8<50> Buffer(_L8("Longitude = ")) ; + LogSession.Connect() ; + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; + + } + + TInt End = 0 ; + + LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing + + TBuf8<50> num ; + TRealFormat format ; + + num.Num(longitudeInputVal, format) ; + + //Logging + LogFile.Write(_L8("Longitude = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + //LogFile.Seek(ESeekEnd , End) ; + num.Num(latitudeInputVal, format) ; + LogFile.Write(_L8("Latitude = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + num.Num(altitudeInputVal, format) ; + LogFile.Write(_L8("altitude = ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + LogFile.Close() ; + LogSession.Close() ; + + delete OutParmList ; + delete InputList ; + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return KErrNone ; + } + +TInt CTestProvider::FindBearingPosBased(CStifItemParser& /*aItem*/) + { + __UHEAP_MARK ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + return KErrGeneral ; + } + + pos = 0 ; + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KDataSource ); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + TBuf8<20>CmdBuf(KRequestCalculate) ; + + CLiwGenericParamList *InputList = CLiwGenericParamList :: NewL() ; + + TLiwGenericParam requesttype(KNullDesC8 , TLiwVariant(KRequestBearingTo)) ; + InputList->AppendL(requesttype) ; + + //Inserting first input param + CLiwMap* SourceCoordinate = CLiwDefaultMap::NewL(); + TReal64 slongitude = 22; + SourceCoordinate->InsertL(KLongitudeKey,TLiwVariant(slongitude)); + TReal64 slatitude = 88; + SourceCoordinate->InsertL(KLatitudeKey,TLiwVariant(slatitude)); + TReal64 saltitude = 1; + SourceCoordinate->InsertL(KAltitudeKey,TLiwVariant(slatitude)); + + TLiwGenericParam scoordinate(KNullDesC8,TLiwVariant(SourceCoordinate)); + InputList->AppendL(scoordinate) ; + SourceCoordinate->DecRef() ; + + + + //Inserting 2nd input param + CLiwMap* DestCoordinate = CLiwDefaultMap::NewL(); + TReal64 dlongitude = 13; + DestCoordinate->InsertL(KLongitudeKey,TLiwVariant(dlongitude)); + TReal64 dlatitude = 77; + DestCoordinate->InsertL(KLatitudeKey,TLiwVariant(dlatitude)); + TReal64 daltitude = 1; + DestCoordinate->InsertL(KAltitudeKey,TLiwVariant(dlatitude)); + + TLiwGenericParam dcoordinate(KNullDesC8,TLiwVariant(DestCoordinate)); + InputList->AppendL(dcoordinate) ; + DestCoordinate->DecRef() ; + + + CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + CmdBuf = KRequestCalculate ; + + locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList); + + + pos = 0; + const TLiwGenericParam* param = OutParmList->FindFirst(pos, KErrorCode); + + pos = 0; + const TLiwGenericParam* resultparam = OutParmList->FindFirst(pos, KMathOpResult); + TLiwVariant resultvariant = resultparam->Value(); + TReal32 bearingTo = resultvariant.AsTReal(); + + + + + //Logging result into a file + RFile LogFile ; + RFs LogSession ; + TBuf8<50> Buffer(_L8("BearingTo = ")) ; + LogSession.Connect() ; + + if(LogFile.Open(LogSession ,LogFileName , EFileWrite | EFileShareAny ) == KErrNotFound) + { + LogFile.Create(LogSession ,LogFileName , EFileWrite | EFileShareAny ) ; + } + + TInt End = 0 ; + + LogFile.Seek(ESeekEnd , End) ; //Seek to end of the file before writing + + TBuf8<50> num ; + TRealFormat format ; + + num.Num(bearingTo , format) ; + + + LogFile.Write(_L8("BearingTo= ")); + LogFile.Write(num) ; + LogFile.Write(_L8("\n")) ; + LogFile.Close() ; + LogSession.Close() ; + + delete OutParmList ; + dcoordinate.Reset() ; + scoordinate.Reset() ; + delete InputList ; + locinterface->Close() ; + inputlist->Reset() ; + outputlist->Reset() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + __UHEAP_MARKEND ; + return KErrNone ; + + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tconcurrentgetlocation.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tconcurrentgetlocation.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tconcurrentgetlocation.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -77,7 +77,7 @@ TInt ConcurrentGetLocCallsL() { - + __UHEAP_MARK ; CActiveScheduler *Scheduler = new CActiveScheduler ; @@ -158,12 +158,13 @@ TLiwVariant ErrVariant = errparam->Value() ; TInt ret = ErrVariant.AsTInt32() ; - + a.ResetAndDestroy() ; locinterface->Close() ; delete ServiceHandler ; delete InputList ; delete OutParmList ; delete Scheduler ; + __UHEAP_MARKEND ; return ret ; // Controll never reaches here } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tenableHighAcc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tenableHighAcc.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,502 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +/* + * Enable High Accuracy params + */ + +#include +#include +#include +#include +#include +#include + + +#include "tcomplugin.h" +TInt cbErr; +TInt EnableHighAccL(TInt aCallType,TBool aEnableAcc); + +class EnableHighAccClass : public MLiwNotifyCallback + { + + MLiwInterface *iLocationInterface ; + CLiwGenericParamList *iInputList ; + TInt cnt; +public : + TInt iRetStatus ; + + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList) ; + + EnableHighAccClass() : iRetStatus(KErrGeneral),cnt(0) //Default constructor + { + ; + } + EnableHighAccClass(TInt aCmd , MLiwInterface *aInterface , CLiwGenericParamList *aInputList) ; + }; + + +EnableHighAccClass :: EnableHighAccClass(TInt aCmd ,MLiwInterface *aInterface , CLiwGenericParamList *aInputList) + { + cnt = 0; + iLocationInterface = aInterface ; + iInputList = aInputList ; + + } + +TInt EnableHighAccClass :: HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList) + { + + //DeRefrence Allocated Map first + cnt++; + TInt index = 0; + const TLiwGenericParam *GenericParam = aEventParamList.FindFirst(index , KErrorCode) ; + + if(!GenericParam) + { + cbErr = KErrGeneral ; + } + + if((GenericParam->Value()).AsTInt32() != KErrNone) + { + cbErr = (GenericParam->Value()).AsTInt32() ; + } + + CActiveScheduler::Stop(); + + return 0 ; + } + + +TInt EnableHighAccL(TInt aCallType,TBool aEnableAcc) + { + __UHEAP_MARK ; + cbErr = KErrNone; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; + + if(!Scheduler) + { + Scheduler = new CActiveScheduler ; + } + + + CActiveScheduler :: Install(Scheduler) ; + + + + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; + /* + if(LogFile.Open(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) == KErrNotFound) + { + if(LogFile.Create(LogSession ,LogFileNameCancel , EFileWrite | EFileShareAny ) != KErrNone) + { + _LIT(KLog , "Failed to create log file\n") ; + + return KErrGeneral ; + } + + } + */ + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + // LogFile.Write(data) ; + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + outputlist->Reset() ; + inputlist->Reset() ; + EnableHighAccClass* callBack = new(ELeave) EnableHighAccClass; + + TBuf8<20>CmdBuf(KTraceLocation) ; + + if(aCallType == 1) + { + TBuf8<20>CmdBuf1(KCmdGetLocation); + CmdBuf = CmdBuf1; + } + + + + + //Appending update options + /* CLiwMap* updateoptionMap = CLiwDefaultMap::NewL(); + + TInt32 updateInterval = 2; + + updateoptionMap->InsertL(KUpdateOptionInterval,TLiwVariant(updateInterval)); + + TInt32 updateTimeOut = 3; + updateoptionMap->InsertL(KUpdateOptionTimeOut,TLiwVariant(updateTimeOut)); + + TInt32 updateMaxAge = 1; + updateoptionMap->InsertL(KUpdateOptionMaxAge,TLiwVariant(updateMaxAge)); + + TLiwGenericParam updateOption(KUpdateOptionMap,TLiwVariant(updateoptionMap)); + inputlist->AppendL(updateOption) ; + */ + _LIT8(KEnableHighAccuracy,"EnableHighAccuracy"); + + TLiwGenericParam EnableHighAcc(KEnableHighAccuracy,TLiwVariant(aEnableAcc)); + + inputlist->AppendL(EnableHighAcc); + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + + if(reqerror == KErrNone ) + CActiveScheduler::Start(); + + + + //const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + //delete updateoptionMap; + delete callBack; + locinterface->Close() ; + delete ServiceHandler ; + a.ResetAndDestroy() ; + a.Close() ; + delete Scheduler; + + + __UHEAP_MARKEND ; + return reqerror | cbErr ; + + + + } + + +TInt EnableHighAcc(TAny *aFlag) + { + + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt Val = KErrGeneral; + TInt *flag = static_cast(aFlag); + TInt err = 0; + //Install a new active scheduler to this thread + + if(*flag == 1) + { + //GetLocation, EnablehighAcc is true + TRAP(err ,( Val = EnableHighAccL(1,true)) ); + } + + else if(*flag == 2) + { + //GetLocation, EnablehighAcc is false + TRAP(err ,( Val = EnableHighAccL(1,false)) ); + } + + else if(*flag == 3) + { + //Trace, EnablehighAcc is true + TRAP(err ,( Val = EnableHighAccL(2,true)) ); + } + + else if(*flag == 4) + { + //Trace, EnablehighAcc is false + TRAP(err ,( Val = EnableHighAccL(2,false)) ); + } + + delete cleanup ; + + + return Val | err; + } + + + +TInt EnableHighAcc_PosBased(TAny *aFlag) + { + + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt Val ; + TInt *flag = static_cast(aFlag); + TInt err; + //Install a new active scheduler to this thread + + if(*flag == 1) + { + //GetLocation, Correct value for EnableAcc PosBased + TRAP(err ,( Val = EnableHighAcc_PosBasedL(1,true)) ); + } + + else if(*flag == 2) + { + //GetLocation, Wrong Type for enableAcc + TRAP(err ,( Val = EnableHighAcc_PosBasedL(1,false)) ); + } + + else if(*flag == 3) + { + //Trace , Correct type + TRAP(err ,( Val = EnableHighAcc_PosBasedL(2,true)) ); + } + + else if(*flag == 4) + { + //Trace, Wrong type + TRAP(err ,( Val = EnableHighAcc_PosBasedL(2,false)) ); + } + + delete cleanup ; + + return Val | err; + } + + +TInt EnableHighAcc_PosBasedL(TInt aCallType,TBool aEnableAcc) + { + __UHEAP_MARK ; + RFile LogFile ; + RFs LogSession ; + TBuf8<50> data ; + TRealFormat format ; + cbErr = KErrNone; + CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; + + if(!Scheduler) + { + Scheduler = new CActiveScheduler ; + } + + + CActiveScheduler :: Install(Scheduler) ; + + + + + + _LIT(LogFileNameCancel , "C:\\cancelinvalid.txt") ; + + _LIT(KLog , "In CancelWithInvalidTransactionID\n") ; + data.Copy(KLog); + // LogFile.Write(data) ; + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = CLiwGenericParamList::NewL(); + CLiwGenericParamList* outputlist = CLiwGenericParamList::NewL(); + + + + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource , KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + + + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KLocationInterface); + + if(!genericparm) + { + + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + + outputlist->Reset() ; + inputlist->Reset() ; + EnableHighAccClass* callBack = new(ELeave) EnableHighAccClass; + + TBuf8<20>CmdBuf(KTraceLocation) ; + + if(aCallType == 1) + { + TBuf8<20>CmdBuf1(KCmdGetLocation); + CmdBuf = CmdBuf1; + } + + + + + _LIT(KClass,"GenericLocationInfo"); + inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); + CLiwMap* updatemap = CLiwDefaultMap::NewL(); + updatemap->PushL(); + _LIT8(KInterval,"UpdateInterval"); + _LIT8(KTimeout,"UpdateTimeOut"); + _LIT8(KAge,"UpdateMaxAge"); + _LIT8(KPartial,"PartialUpdates"); + const TInt KTime = 1000000; + + updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); + updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); + updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); + updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); + updatemap->DecRef(); + + if(aEnableAcc){ + TLiwGenericParam EnableHighAcc(KNullDesC8,TLiwVariant(aEnableAcc)); + inputlist->AppendL(EnableHighAcc); + } + else + { + TPtrC aEnableAcc1(_L("hi")); + TLiwGenericParam EnableHighAcc(KNullDesC8,TLiwVariant(aEnableAcc1)); + inputlist->AppendL(EnableHighAcc); + } + + + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist,KLiwOptASyncronous, callBack); + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + return KErrGeneral ; + } + + TInt reqerror = (ErrorParm->Value()).AsTInt32(); + + if(reqerror == KErrNone) + CActiveScheduler::Start(); + + if(reqerror == SErrBadArgumentType && !aEnableAcc) + reqerror = KErrNone; + + pos = 0 ; + CleanupStack::PopAndDestroy(updatemap); + inputlist->Reset(); + outputlist->Reset(); + delete outputlist; + + delete inputlist; + + delete callBack; + locinterface->Close() ; + + a.ResetAndDestroy() ; + a.Close() ; + delete Scheduler; + delete ServiceHandler ; + __UHEAP_MARKEND ; + + return reqerror | cbErr; + + + + } + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocationasync.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocationasync.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocationasync.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -55,6 +55,7 @@ const CLiwGenericParamList& aInParamList) { + __UHEAP_MARK ; TBuf8<50> data ; TRealFormat format ; @@ -128,7 +129,29 @@ LogFile.Write(_L8(" Altitude = ")) ; LogFile.Write(data) ; // LocMap->DecRef() ; + TLiwVariant Accuracy; + index = LocMap->FindL(_L8("HorizontalAccuracy"),Accuracy); + if(index) + { + TReal32 AccuracyVal = Accuracy.AsTReal(); + data.Num(AccuracyVal , format) ; + + LogFile.Write(_L8("Horizontal Acc = ")) ; + LogFile.Write(data) ; + } + + Accuracy.Reset(); + index = LocMap->FindL(_L8("VerticalAccuracy"),Accuracy); + + if(index) + { + TReal32 AccuracyVal = Accuracy.AsTReal(); + data.Num(AccuracyVal , format) ; + + LogFile.Write(_L8("Vertical Acc = ")) ; + LogFile.Write(data) ; + } const TLiwGenericParam *Speed = aEventParamList.FindFirst(index , _L8("HorizontalSpeed")) ; if(index != -1) @@ -382,7 +405,7 @@ iRetStatus = KErrNone ; CActiveScheduler *Current = CActiveScheduler :: Current() ; Current->Stop() ; - + __UHEAP_MARKEND ; return KErrNone ; } @@ -480,6 +503,10 @@ locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist ,KLiwOptASyncronous , &MyUpdates); CActiveScheduler :: Start() ; + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist ,KLiwOptASyncronous , &MyUpdates); + + + CActiveScheduler :: Start() ; delete Scheduler ; locinterface->Close(); @@ -513,4 +540,285 @@ return err ; } return ret ; -} \ No newline at end of file +} +TInt GetLocAsynchPosBased(TAny * /*Arg*/) + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + + TInt ret = 0 ; + TRAPD(err , (ret = GetLocAsynchPosBasedL()) ); + delete cleanup ; + // __UHEAP_MARKEND; + + if(err) + { + return err ; + } + return ret ; + } + +TInt GetLocAsynchPosBasedL() + { + __UHEAP_MARK; + + + TInt start = User::CountAllocCells(); + ASyncLocCB MyUpdates ; + + _LIT8(KService, "Service.Location"); + _LIT8(KIDataSource,"ILocation"); + + + + CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; + + if(!Scheduler) + { + Scheduler = new CActiveScheduler ; + } + + + CActiveScheduler :: Install(Scheduler) ; + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + //CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + //_LIT(Klog , "Success/Failure error code missing from outputlist") ; + //iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KIDataSource ); + + if(!genericparm) + { + //_LIT(KLog , "Interface not found"); + //iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + // CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + _LIT(KClass,"GenericLocationInfo"); + inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); + CLiwDefaultMap* updatemap = CLiwDefaultMap::NewL(); + + _LIT8(KInterval,"UpdateInterval"); + _LIT8(KTimeout,"UpdateTimeOut"); + _LIT8(KAge,"UpdateMaxAge"); + _LIT8(KPartial,"PartialUpdates"); + const TInt KTime = 1000000; + + updatemap->InsertL(KInterval , TLiwVariant(TInt32(2*KTime))); + updatemap->InsertL(KTimeout , TLiwVariant(TInt32(30*KTime))); + updatemap->InsertL(KAge , TLiwVariant(TInt32(0))); + updatemap->InsertL(KPartial , TLiwVariant(TBool(FALSE))); + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); + updatemap->DecRef(); + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist ,KLiwOptASyncronous , &MyUpdates); + + CActiveScheduler :: Start() ; + delete Scheduler ; + + locinterface->Close(); + delete ServiceHandler; + a.ResetAndDestroy(); + a.Close(); + //delete inputlist ; + //delete outputlist ; + + //delete ServiceHandler; + TInt end = User::CountAllocCells(); + + __UHEAP_MARKEND; + return MyUpdates.iRetStatus ; + } + + + +TInt GetLocAsynchWrongVal(TAny * /*Arg*/) + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + + TInt ret = 0 ; + TRAPD(err , (ret = GetLocAsynchWrongValL()) ); + delete cleanup ; + // __UHEAP_MARKEND; + + if(err) + { + return err ; + } + + return ret = 0 ; + } + +TInt GetLocAsynchWrongValL() + { + + __UHEAP_MARK; + //TInt start = User::CountAllocCells(); + + ASyncLocCB MyUpdates ; + TInt errRet; + _LIT8(KService, "Service.Location"); + _LIT8(KIDataSource,"ILocation"); + + + CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; + + if(!Scheduler) + { + Scheduler = new CActiveScheduler ; + } + + + CActiveScheduler :: Install(Scheduler) ; + + + + + CLiwServiceHandler* ServiceHandler = CLiwServiceHandler::NewL(); + + // Input and output parameter list + CLiwGenericParamList* inputlist = &(ServiceHandler->InParamListL()); + CLiwGenericParamList* outputlist = &(ServiceHandler->OutParamListL()); + + + + + //CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KContents, KService); + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KDataSource, KService); + + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + ServiceHandler->AttachL(a) ; + + + ServiceHandler->ExecuteServiceCmdL(*crit, *inputlist, *outputlist); + + TInt pos = 0; + + const TLiwGenericParam *errorprm = outputlist->FindFirst(pos , KErrorCode) ; + + if(!errorprm) + { + //_LIT(Klog , "Success/Failure error code missing from outputlist") ; + //iLog->Log(Klog) ; + return KErrGeneral ; + } + + + _LIT8(KDataSource, "ILocation"); + + pos = 0 ; + + const TLiwGenericParam *genericparm = outputlist->FindFirst(pos,KIDataSource ); + + if(!genericparm) + { + //_LIT(KLog , "Interface not found"); + //iLog->Log(KLog) ; + return KErrGeneral ; + } + + MLiwInterface* locinterface = (genericparm->Value()).AsInterface(); + // CLiwGenericParamList *OutParmList = CLiwGenericParamList :: NewL() ; + + + TBuf8<20>CmdBuf(KCmdGetLocation) ; + + outputlist->Reset() ; + inputlist->Reset() ; + _LIT(KClass,"GenericLocationInfo"); + inputlist->AppendL( TLiwGenericParam( KNullDesC8,TLiwVariant( KClass ) ) ); + + TInt updatemap = 12; + + inputlist->AppendL(TLiwGenericParam(KNullDesC8,TLiwVariant(updatemap))); + + + + locinterface->ExecuteCmdL(CmdBuf , *inputlist , *outputlist ,KLiwOptASyncronous , &MyUpdates); + + + pos = 0 ; + + const TLiwGenericParam *ErrorParm = outputlist->FindFirst(pos ,KErrorCode ) ; + + if(!ErrorParm) + { + _LIT(Klog, "Success/Failure state not known") ; + //iLog->Log(Klog) ; + return KErrGeneral ; + } + + if((ErrorParm->Value()).AsTInt32() != SErrBadArgumentType ) + { + _LIT(KLog , "ExecutecmdL failed "); + //iLog->Log(KLog) ; + errRet = KErrGeneral; + } + + + + delete Scheduler ; + + locinterface->Close(); + delete ServiceHandler; + a.ResetAndDestroy(); + a.Close(); + + + //delete inputlist ; + //delete outputlist ; + + //delete ServiceHandler; + //TInt end = User::CountAllocCells(); + __UHEAP_MARKEND; + return errRet; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocationcancel.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocationcancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocationcancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -54,6 +54,7 @@ TInt GetLocCancelL() { + __UHEAP_MARK ; GetLoctionCancel MyUpdates ; CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; @@ -134,11 +135,12 @@ TInt ret = (errprm->Value()).AsTInt32() ; delete Scheduler ; - + a.ResetAndDestroy(); locinterface->Close(); delete InputList ; delete OutParmList ; - + delete ServiceHandler; + __UHEAP_MARKEND ; return ret ; } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocstraytest.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocstraytest.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocstraytest.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -114,7 +114,7 @@ TInt StrayTestGetLocL() { - + __UHEAP_MARK ; CActiveScheduler *Scheduler = new CActiveScheduler ; CActiveScheduler :: Install(Scheduler) ; @@ -182,12 +182,13 @@ CActiveScheduler :: Start() ; - + a.ResetAndDestroy() ; locinterface->Close() ; delete ServiceHandler ; delete InputList ; delete OutParmList ; delete Scheduler ; + __UHEAP_MARKEND ; return 0 ; // Controll never reaches here } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocwrongcancel.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocwrongcancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tgetlocwrongcancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -53,6 +53,7 @@ TInt GetLocWrongCancelL() { + __UHEAP_MARK ; WrongNotificationGetLoc MyUpdates ; CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; @@ -128,13 +129,14 @@ const TLiwGenericParam *errprm = OutParmList->FindFirst(pos , KErrCode) ; TInt ret = (errprm->Value()).AsTInt32() ; - + a.ResetAndDestroy() ; delete Scheduler ; locinterface->Close(); delete InputList ; delete OutParmList ; - + delete ServiceHandler; + __UHEAP_MARKEND ; if ( SErrNotFound == ret ) { return KErrNone; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tservicefailedtest.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tservicefailedtest.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tservicefailedtest.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -81,7 +81,7 @@ TInt ServiceFailedFunctionL() { - + __UHEAP_MARK ; CallBack MyUpdates ; _LIT8(KService, "Service.Location"); @@ -167,6 +167,7 @@ locinterface->Close(); delete InputList ; delete OutParmList ; + __UHEAP_MARKEND ; return MyUpdates.iRetStatus ; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tstraysignaltest.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tstraysignaltest.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/tstraysignaltest.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -168,7 +168,7 @@ TInt StrayTestL() { - + __UHEAP_MARK ; _LIT(KTraceFile , "C:\\Trace.txt") ; RFile TraceFile ; @@ -273,6 +273,7 @@ delete Scheduler ; TraceFile.Write(_L8("Scheduler deleted\n")) ; + __UHEAP_MARKEND ; return 0 ; // Controll never reaches here } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttrace.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttrace.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttrace.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -243,10 +243,14 @@ locinterface->Close(); - delete ServiceHandler ; + delete InputList ; delete OutParmList ; delete Scheduler ; + delete crit; + a.Reset(); + a.Close(); + delete ServiceHandler ; __UHEAP_MARKEND; return 0 ; } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttraceconcurrentcalls.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttraceconcurrentcalls.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttraceconcurrentcalls.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -37,7 +37,7 @@ MLiwInterface *iLocationInterface ; CLiwGenericParamList *iInputList ; - + TInt cnt; public : TInt iRetStatus ; @@ -47,7 +47,7 @@ CLiwGenericParamList& aEventParamList, const CLiwGenericParamList& aInParamList) ; - ConcurrentTraceLoc() : iRetStatus(KErrGeneral) //Default constructor + ConcurrentTraceLoc() : iRetStatus(KErrGeneral),cnt(0) //Default constructor { ; } @@ -57,7 +57,7 @@ ConcurrentTraceLoc :: ConcurrentTraceLoc(TInt aCmd ,MLiwInterface *aInterface , CLiwGenericParamList *aInputList) { - + cnt = 0; iLocationInterface = aInterface ; iInputList = aInputList ; @@ -71,13 +71,30 @@ { //DeRefrence Allocated Map first - return 0 ; -} + cnt++; + TInt trid = aCmdId; + + if(cnt == 2) + { + + CActiveScheduler::Stop(); + } + return 0 ; + } TInt TraceConcurrentCallsL() { - + __UHEAP_MARK ; + CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; + + if(!Scheduler) + { + Scheduler = new CActiveScheduler ; + } + + + CActiveScheduler :: Install(Scheduler) ; _LIT(KTraceFile , "C:\\Trace.txt") ; RFile TraceFile ; @@ -93,10 +110,6 @@ } } - CActiveScheduler *Scheduler = new CActiveScheduler ; - - CActiveScheduler :: Install(Scheduler) ; - @@ -166,7 +179,7 @@ locinterface->ExecuteCmdL(CmdBuf , *InputList , *OutParmList ,KLiwOptASyncronous , &GetLoc); pos = 0 ; - + CActiveScheduler :: Start() ; const TLiwGenericParam *errparam = OutParmList->FindFirst(pos , KErrorCode) ; if(!errparam) @@ -177,13 +190,14 @@ TLiwVariant ErrVariant = errparam->Value() ; TInt ret = ErrVariant.AsTInt32() ; - + a.ResetAndDestroy() ; locinterface->Close() ; delete ServiceHandler ; delete InputList ; delete OutParmList ; delete Scheduler ; TraceFile.Write(_L8("Gracefully returned \n")) ; + __UHEAP_MARKEND ; return ret ; } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttracelocationcancel.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttracelocationcancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttracelocationcancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -53,6 +53,7 @@ TInt TraceLocCancelL() { + __UHEAP_MARK ; TraceLoctionCancel MyUpdates ; CActiveScheduler *Scheduler = CActiveScheduler :: Current() ; @@ -133,11 +134,12 @@ TInt ret = (errprm->Value()).AsTInt32() ; delete Scheduler ; - + a.ResetAndDestroy(); locinterface->Close(); delete InputList ; delete OutParmList ; - + delete ServiceHandler; + __UHEAP_MARKEND ; return ret ; } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttracelocwrongcancel.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttracelocwrongcancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocationprovidertest/src/ttracelocwrongcancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -53,6 +53,7 @@ TInt TraceLocWrongCancelL() { + __UHEAP_MARK ; WrongNotificationTraceLoc MyUpdates ; @@ -134,16 +135,19 @@ TInt ret = (errprm->Value()).AsTInt32() ; - delete Scheduler ; + locinterface->Close(); + delete Scheduler ; - locinterface->Close(); + a.ResetAndDestroy(); + delete InputList ; delete OutParmList ; - + delete ServiceHandler; if ( SErrNotFound == ret ) { return KErrNone; } + __UHEAP_MARKEND ; return ret ; } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocmanualtest/inc/locationcoreimp.h --- a/serviceproviders/sapi_location/tsrc/dev/tlocmanualtest/inc/locationcoreimp.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI core implementation. -* -*/ - - - -#ifndef C_LOCATIONCOREIMP_H -#define C_LOCATIONCOREIMP_H - -#include -#include -#include "locationservice.h" - - -/** - * Consts to identify the type of location request (trace, getlocation - */ - -const TInt KTraceRequest = 1 ; -const TInt KGetLocationRequest = 2 ; - - - - - -/** - * This class implements Location SAPI core logic.It has methods - * for retreving information location asynchronusly . - */ - -class CGetLoc : public CActive - { - public: - - - - /** - * Creates a new instance of a @ref CGetLoc - * - * @param aPositionServer subsession to location server - * @param aRequestorInfoStack requestor indenty - * @param aList List of position fields that should be retrived - * @param aLocationInfoCategory information type required(Basic, Generic) - * - */ - - IMPORT_C static CGetLoc* NewL( RPositionServer &aPositionServer , - TPositionFieldIdList aList , - TInt aRequestType, - TInt aLocationInfoCategory ) ; - - /** - * Destructor. - */ - virtual ~CGetLoc() ; - - - - /** - * Gets users current location Asynchronously calls the users callback - * function when updates are recived from location server - * - * @param aCallBackObj callback object for updates notification - * @param aUpdatesOptions update options for asynchronous calls - * - */ - TInt GetLocation( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions =NULL ); - - /** - * Traces users location change - * Any location change is informed to user via callback function - * - * @param aCallBackObj callback handle for async trace call - * @param aUpdateOptions updateoptions for trace call - * - * @see TPositionUpdateOptions in LbsCommon.h for details - */ - TInt GetLocationUpdates( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions = NULL ); - - void SetStatusComplete() - { - iRequestStatus = 1; - } - TBool IsStatusComplete() - { - if(iRequestStatus == 0) - return false; - else - return true; - } - - - - - protected: - - /** - * From CActive - */ - void DoCancel(); - void RunL(); - - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - - void ConstructL(); - /** - * Default constructor - */ - - CGetLoc(); - TInt DoInitialiseL(); - - private: - - - - - /** - * Class Member which holds location server subsession - */ - RPositioner iPositioner; - - /** - * Basic info - */ - TPositionInfo iPositionInfo; - - - /** - * Basic info base - */ - TPositionInfoBase* iPosInfoBase; - /** - * Generic info - */ - HPositionGenericInfo *iGenericPosInfo ; - /** - * callback object - */ - MLocationCallBack *iCallBack ; - - /** - * Request type (Getlocation or Trace) - */ - TInt iRequestType ; - - TInt iRequestStatus; - - - }; - - - -#endif //C_LOCATIONCOREIMP_H - - \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocmanualtest/inc/locationservice.h --- a/serviceproviders/sapi_location/tsrc/dev/tlocmanualtest/inc/locationservice.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI service implementation. -* -*/ - - -#ifndef LOCATIONSERVICE_H -#define LOCATIONSERVICE_H - -#include -class CGetLoc; -/** - * Identity for location SAPI lib - * This will be appended to requestor identity information stack received from the - * client and will be passed onto location server - */ - -_LIT(KIdentity,"Location SAPI"); - -/** - * Key for locating active objects associated with async request in registration table - * - * @ 0 for Getlocation async Active object - * @ 1 for Trace async active object - */ - -const TInt KARRAY_INDEX_GETLOCATION = 0 ; -const TInt KARRAY_INDEX_TRACE = 1 ; - - - -/** - * Key for locating location information in CLiwGenericParamList - */ -_LIT8(KLongitudeKey,"Longitude") ; -_LIT8(KLatitudeKey , "Latitude") ; -_LIT8(KAltitudeKey , "Altitude") ; - -_LIT(KUnknown,"Unknown"); - -/** - * Default Update options - */ -//Second -const TInt KSSecond = 1000000; - -//Update interval -const TInt KSUpdateInterval = KSSecond; - -//Update time out -const TInt KSUpdateTimeOut = 15*KSSecond; - -//MaxAge -const TInt KSMaxAge = 0; - -/** - * Enums required for mathoperations - */ -enum TMathOperationChoice - { - EDistance = 0, - EBearingTo = 1, - EMove = 2 - }; - -/** - * Notification Type to be cancelled - */ -enum TCancelParam - { - ECancelGetLocation = 0, - ECancelTrace = 1 - }; -/** - * Enumeration used to identify category of location information user intends to - * retrieve - * Example: specifying EBasic user will get only longitude,latitude and altitude - */ - enum TLocationInfoType - { - EBasicInfo = 0, - EGenericInfo = 1 - }; - -/** - * used by the caller of math operation to send input parameters - * after computation MathOperation wil fill in result field of this - * struct. - */ -struct _INPPARM - { - //specifies option for mathoperation - TInt servicechoice; - //result of the computation - TReal32 result ; - //Source Coordinate for math operation - TCoordinate source; - //Destination Coordinate for math operation - TCoordinate destination ; - //In case of find bearingto following two should be supplied by the consumer - TReal32 bearing; - TReal32 distance; - - }; - -typedef struct _INPPARM inpparam; - - - -/** - * Location callback interface, its pure interface class, application need to - * Write there own callback derriving from this class. - * @Depenedency lbs.lib - */ - - class MLocationCallBack - { - /** - * Handles notifications caused by an asynchronous GetLocationL, - * or by trace. - * - * @param aOutPos updated position got from location server - * @return Success/Error code for the callback. - * - * @see HPositionGenericInfo in LbsPositionInfo.h for details - * - */ - public : - virtual TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) = 0 ; - }; - - -/** - * CLocationService class : This is a wrapper class for the Functionalities - * offered by Location Retreival APIs. - * In case of An Asynchronus request it has method which Instantiates and delegate - * the job to another class which also opens new sub-session with - * Location server. - */ - - -class CLocationService : public CBase - { - public : - /** - * Creates a new instance of a @ref CLocationService - * @return The newly created CLocationService object - */ - IMPORT_C static CLocationService *NewL() ; - - - /* - * @Destructor - */ - virtual ~CLocationService() ; - - /** - * Methods on the Core Location implementation - */ - - - - /** - * Synchronous get location with update options returns current location of the user - * - * @param aPosinfobase input TPositionInfoBase object which will hold location details - * @param aUpdateOpts updateoptions for synchronous calls - */ - IMPORT_C TInt GetLocationL( TPositionInfoBase* aPos , - const TPositionUpdateOptions* aUpdateOpts= NULL ) ; - - - /** - * Gets the current location of user asynchronosly calls the users callback handle on reciving - * location updates - * @param aCallBack callback object after reciving the position updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFieldIdList specifies field of HPositionGenericInfo that user intend to retrieve. - * @param aUpdateoptions update options for asynchronous requests. - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - IMPORT_C TInt GetLocationL( MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFieldIdList = NULL , - const TPositionUpdateOptions* aUpdateopts = NULL - ); - - /** - * Gets module information of the Positioning module specified my aModuleId - * - * @param TPositionModuleId param to store the obtained module information - * - * @see lsbcommon.h for details of TPositionModuleInfoBase - */ - IMPORT_C TInt GetModuleInfo( TPositionModuleInfoBase& aModuleInfo ) const ; - - /** - * Performs mathoperations (move,distance,bearingto) by parsing contents of input param - * - * @param aInput input paramater for math opertaions - * - * @see inparam in this file for detailed math operation list - */ - - - IMPORT_C TInt MathOperation( inpparam& aInput ); - - /** - * Trace function traces users location changes any change in users current location is notificed - * to user via call back function - * - * @param aCallBackObj callback object after reciving location updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFiledList List of position fields that should be retrived - * @param aUpdateOptions update options for trace - * - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - - IMPORT_C TInt TraceL(MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFiledList = NULL , - const TPositionUpdateOptions* aUpateOptions= NULL ); - - - /** - * Method to cancell pending async request - * - * aCancelparam cancellation type (trace,getlocation) - * - * @see TCancelParam for cancellation options - */ - - IMPORT_C TInt CancelOnGoingService( TInt aCancelparam ) ; - - /** - * Method to fetch last known location from location server - */ - - TInt GetLastKnownLoc( TPosition& aResultPos ) ; - - - - - - protected: - /** - * internal method to construct class members - */ - void ConstructL() ; - - /** - * Default constructor - */ - CLocationService() ; - - /** - * Method to initalise class memebers - */ - void DoInitialiseL() ; - - private : - - /** - * Subsession used to fetch location information - */ - - RPositioner iPositioner; - - /** - * Session used for getting location information - */ - - RPositionServer iPosServer; - - /** - * Registration table for callbacks - */ - - RPointerArray iRegTable; - TInt iIndex; - - - /** - * Module indtifier used by location server for getting location information - */ - TPositionModuleId iModuleId ; - - }; - - -#endif // LOCATIONSERVICE_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocmanualtest/src/tlocmanualtestblocks.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocmanualtest/src/tlocmanualtestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocmanualtest/src/tlocmanualtestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -84,6 +84,7 @@ TInt CTLocManualTest ::GetLocationTimedOut(CStifItemParser& /*aItem*/) { + __UHEAP_MARK ; // Print to UI _LIT( KTLocManualTest, "TLocTest" ); _LIT( KGetLocationTimeout , "Time out test" ); @@ -96,7 +97,7 @@ TPositionInfo position; TPositionUpdateOptions Updateopts ; - Updateopts.SetUpdateTimeOut(TTimeIntervalMicroSeconds(KUpdatetimeOut)); + Updateopts.SetUpdateTimeOut(TTimeIntervalMicroSeconds(100000)); CLocationService *CoreObj = CLocationService :: NewL(); @@ -108,11 +109,12 @@ infostack.Append(identityInfo); CoreObj->SetRequestorIdentityL(infostack);*/ - TInt Result =CoreObj->GetLocationL(&position , &Updateopts) ; + TRAPD( Result ,CoreObj->GetLocationL(&position , &Updateopts) ); delete CoreObj ; + __UHEAP_MARKEND ; if(Result == KErrTimedOut) { return KErrNone ; @@ -130,6 +132,7 @@ TInt CTLocManualTest ::ServiceNotAvailable(CStifItemParser& /*aItem*/) { + __UHEAP_MARK ; CLocationService *CoreObj ; TInt result = 0 ; TPositionInfo pos ; @@ -145,11 +148,11 @@ KRequestor) ; infostack.Append(identityInfo); CoreObj->SetRequestorIdentityL(infostack);*/ - result = CoreObj->GetLocationL(&pos) ; //Synchronous getlocation test + TRAP(result , CoreObj->GetLocationL(&pos)) ; //Synchronous getlocation test } delete CoreObj ; - + __UHEAP_MARKEND ; if((result == KErrNotFound ) || (result == KPositionQualityLoss)) { _LIT(KLog , "positioning technology not available") ; @@ -165,13 +168,32 @@ { TInt iCount ; TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; public : TInt HandleNotifyL(HPositionGenericInfo *posinfo , TInt aError) ; - LocUpdateCallBack() :iCount(0) , iRetStatus(KErrGeneral) //Default constructor - { - ; - } + LocUpdateCallBack(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral) //Default constructor + { + iRequestType = req; + + iTransactionId = transId;; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; @@ -248,7 +270,7 @@ TInt ServiceFailedFunctionL() { - + __UHEAP_MARK ; CActiveScheduler *Scheduler = new CActiveScheduler ; CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; @@ -260,10 +282,13 @@ infostack.Append(identityInfo); CoreObj->SetRequestorIdentityL(infostack);*/ - LocUpdateCallBack MyUpdates ; + LocUpdateCallBack MyUpdates(12,1) ; CoreObj->TraceL(&MyUpdates,EBasicInfo) ; CActiveScheduler :: Start() ; + delete Scheduler; + delete CoreObj; + __UHEAP_MARKEND ; return 0 ; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/conf/tlocservicetest.cfg --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/conf/tlocservicetest.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/conf/tlocservicetest.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -109,4 +109,10 @@ create tlocservicetest foobar foobar EmptyCancelTrace delete foobar -[Endtest] \ No newline at end of file +[Endtest] +[Test] +title TraceTimeOut Test +create tlocservicetest foobar +foobar TraceTimeOut +delete foobar +[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/eabi/tloctestu.def --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/eabi/tloctestu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/eabi/tloctestu.def Thu Aug 27 07:43:07 2009 +0300 @@ -10,4 +10,6 @@ _ZTV17LocUpdateCallBack @ 9 NONAME ; ## _ZTV23CancelLocUpdateCallBack @ 10 NONAME ; ## _ZTV7ASyncCB @ 11 NONAME ; ## + _ZTI19LocUpdateCallBackTO @ 12 NONAME ; ## + _ZTV19LocUpdateCallBackTO @ 13 NONAME ; ## diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/inc/locationcoreimp.h --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/inc/locationcoreimp.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI core implementation. -* -*/ - - - -#ifndef C_LOCATIONCOREIMP_H -#define C_LOCATIONCOREIMP_H - -#include -#include -#include "locationservice.h" - - -/** - * Consts to identify the type of location request (trace, getlocation - */ - -const TInt KTraceRequest = 1 ; -const TInt KGetLocationRequest = 2 ; - - - - - -/** - * This class implements Location SAPI core logic.It has methods - * for retreving information location asynchronusly . - */ - -class CGetLoc : public CActive - { - public: - - - - /** - * Creates a new instance of a @ref CGetLoc - * - * @param aPositionServer subsession to location server - * @param aRequestorInfoStack requestor indenty - * @param aList List of position fields that should be retrived - * @param aLocationInfoCategory information type required(Basic, Generic) - * - */ - - IMPORT_C static CGetLoc* NewL( RPositionServer &aPositionServer , - TPositionFieldIdList aList , - TInt aRequestType, - TInt aLocationInfoCategory ) ; - - /** - * Destructor. - */ - virtual ~CGetLoc() ; - - - - /** - * Gets users current location Asynchronously calls the users callback - * function when updates are recived from location server - * - * @param aCallBackObj callback object for updates notification - * @param aUpdatesOptions update options for asynchronous calls - * - */ - TInt GetLocation( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions =NULL ); - - /** - * Traces users location change - * Any location change is informed to user via callback function - * - * @param aCallBackObj callback handle for async trace call - * @param aUpdateOptions updateoptions for trace call - * - * @see TPositionUpdateOptions in LbsCommon.h for details - */ - TInt GetLocationUpdates( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions = NULL ); - - void SetStatusComplete() - { - iRequestStatus = 1; - } - TBool IsStatusComplete() - { - if(iRequestStatus == 0) - return false; - else - return true; - } - - - - - protected: - - /** - * From CActive - */ - void DoCancel(); - void RunL(); - - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - - void ConstructL(); - /** - * Default constructor - */ - - CGetLoc(); - TInt DoInitialiseL(); - - private: - - - - - /** - * Class Member which holds location server subsession - */ - RPositioner iPositioner; - - /** - * Basic info - */ - TPositionInfo iPositionInfo; - - - /** - * Basic info base - */ - TPositionInfoBase* iPosInfoBase; - /** - * Generic info - */ - HPositionGenericInfo *iGenericPosInfo ; - /** - * callback object - */ - MLocationCallBack *iCallBack ; - - /** - * Request type (Getlocation or Trace) - */ - TInt iRequestType ; - - TInt iRequestStatus; - - - }; - - - -#endif //C_LOCATIONCOREIMP_H - - \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/inc/locationservice.h --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/inc/locationservice.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI service implementation. -* -*/ - - -#ifndef LOCATIONSERVICE_H -#define LOCATIONSERVICE_H - -#include -class CGetLoc; -/** - * Identity for location SAPI lib - * This will be appended to requestor identity information stack received from the - * client and will be passed onto location server - */ - -_LIT(KIdentity,"Location SAPI"); - -/** - * Key for locating active objects associated with async request in registration table - * - * @ 0 for Getlocation async Active object - * @ 1 for Trace async active object - */ - -const TInt KARRAY_INDEX_GETLOCATION = 0 ; -const TInt KARRAY_INDEX_TRACE = 1 ; - - - -/** - * Key for locating location information in CLiwGenericParamList - */ -_LIT8(KLongitudeKey,"Longitude") ; -_LIT8(KLatitudeKey , "Latitude") ; -_LIT8(KAltitudeKey , "Altitude") ; - -_LIT(KUnknown,"Unknown"); - -/** - * Default Update options - */ -//Second -const TInt KSSecond = 1000000; - -//Update interval -const TInt KSUpdateInterval = KSSecond; - -//Update time out -const TInt KSUpdateTimeOut = 15*KSSecond; - -//MaxAge -const TInt KSMaxAge = 0; - -/** - * Enums required for mathoperations - */ -enum TMathOperationChoice - { - EDistance = 0, - EBearingTo = 1, - EMove = 2 - }; - -/** - * Notification Type to be cancelled - */ -enum TCancelParam - { - ECancelGetLocation = 0, - ECancelTrace = 1 - }; -/** - * Enumeration used to identify category of location information user intends to - * retrieve - * Example: specifying EBasic user will get only longitude,latitude and altitude - */ - enum TLocationInfoType - { - EBasicInfo = 0, - EGenericInfo = 1 - }; - -/** - * used by the caller of math operation to send input parameters - * after computation MathOperation wil fill in result field of this - * struct. - */ -struct _INPPARM - { - //specifies option for mathoperation - TInt servicechoice; - //result of the computation - TReal32 result ; - //Source Coordinate for math operation - TCoordinate source; - //Destination Coordinate for math operation - TCoordinate destination ; - //In case of find bearingto following two should be supplied by the consumer - TReal32 bearing; - TReal32 distance; - - }; - -typedef struct _INPPARM inpparam; - - - -/** - * Location callback interface, its pure interface class, application need to - * Write there own callback derriving from this class. - * @Depenedency lbs.lib - */ - - class MLocationCallBack - { - /** - * Handles notifications caused by an asynchronous GetLocationL, - * or by trace. - * - * @param aOutPos updated position got from location server - * @return Success/Error code for the callback. - * - * @see HPositionGenericInfo in LbsPositionInfo.h for details - * - */ - public : - virtual TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) = 0 ; - }; - - -/** - * CLocationService class : This is a wrapper class for the Functionalities - * offered by Location Retreival APIs. - * In case of An Asynchronus request it has method which Instantiates and delegate - * the job to another class which also opens new sub-session with - * Location server. - */ - - -class CLocationService : public CBase - { - public : - /** - * Creates a new instance of a @ref CLocationService - * @return The newly created CLocationService object - */ - IMPORT_C static CLocationService *NewL() ; - - - /* - * @Destructor - */ - virtual ~CLocationService() ; - - /** - * Methods on the Core Location implementation - */ - - - - /** - * Synchronous get location with update options returns current location of the user - * - * @param aPosinfobase input TPositionInfoBase object which will hold location details - * @param aUpdateOpts updateoptions for synchronous calls - */ - IMPORT_C TInt GetLocationL( TPositionInfoBase* aPos , - const TPositionUpdateOptions* aUpdateOpts= NULL ) ; - - - /** - * Gets the current location of user asynchronosly calls the users callback handle on reciving - * location updates - * @param aCallBack callback object after reciving the position updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFieldIdList specifies field of HPositionGenericInfo that user intend to retrieve. - * @param aUpdateoptions update options for asynchronous requests. - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - IMPORT_C TInt GetLocationL( MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFieldIdList = NULL , - const TPositionUpdateOptions* aUpdateopts = NULL - ); - - /** - * Gets module information of the Positioning module specified my aModuleId - * - * @param TPositionModuleId param to store the obtained module information - * - * @see lsbcommon.h for details of TPositionModuleInfoBase - */ - IMPORT_C TInt GetModuleInfo( TPositionModuleInfoBase& aModuleInfo ) const ; - - /** - * Performs mathoperations (move,distance,bearingto) by parsing contents of input param - * - * @param aInput input paramater for math opertaions - * - * @see inparam in this file for detailed math operation list - */ - - - IMPORT_C TInt MathOperation( inpparam& aInput ); - - /** - * Trace function traces users location changes any change in users current location is notificed - * to user via call back function - * - * @param aCallBackObj callback object after reciving location updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFiledList List of position fields that should be retrived - * @param aUpdateOptions update options for trace - * - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - - IMPORT_C TInt TraceL(MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFiledList = NULL , - const TPositionUpdateOptions* aUpateOptions= NULL ); - - - /** - * Method to cancell pending async request - * - * aCancelparam cancellation type (trace,getlocation) - * - * @see TCancelParam for cancellation options - */ - - IMPORT_C TInt CancelOnGoingService( TInt aCancelparam ) ; - - /** - * Method to fetch last known location from location server - */ - - TInt GetLastKnownLoc( TPosition& aResultPos ) ; - - - - - - protected: - /** - * internal method to construct class members - */ - void ConstructL() ; - - /** - * Default constructor - */ - CLocationService() ; - - /** - * Method to initalise class memebers - */ - void DoInitialiseL() ; - - private : - - /** - * Subsession used to fetch location information - */ - - RPositioner iPositioner; - - /** - * Session used for getting location information - */ - - RPositionServer iPosServer; - - /** - * Registration table for callbacks - */ - - RPointerArray iRegTable; - TInt iIndex; - - - /** - * Module indtifier used by location server for getting location information - */ - TPositionModuleId iModuleId ; - - }; - - -#endif // LOCATIONSERVICE_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/inc/tloctest.h --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/inc/tloctest.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/inc/tloctest.h Thu Aug 27 07:43:07 2009 +0300 @@ -161,6 +161,7 @@ virtual TInt ConcurrentCallsTrace(CStifItemParser& aItem); virtual TInt EmptyCancelTrace(CStifItemParser& aItem); virtual TInt EmptyCancelLocAsynch(CStifItemParser& aItem); + virtual TInt TraceTimeOut(CStifItemParser& aItem); public: // Data //?data_declaration; @@ -193,6 +194,8 @@ TInt StrayTest(TAny *aArg) ; TInt StrayTestGetLoc(TAny *aArg) ; TInt ConcurrentGetLocationCalls(TAny *aArg) ; + TInt TraceTimeOutFunc(TAny *aArg) ; + TInt ConcurrentTraceCalls(TAny */*Arg*/); #endif // TLOCTEST_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/loccancel.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/loccancel.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/loccancel.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: contains test case implementation for CancelOngoingService location-SAPI -* V ersion : %version: 4 % << Don't touch! Updated by Synergy at check-out. +* V ersion : %version: 5 % << Don't touch! Updated by Synergy at check-out. * */ @@ -23,6 +23,8 @@ #include class CGetLoc ; //Forward declaration +#define GETLOCATION 0 +#define TRACE 1 _LIT(LogFileName , "C:\\Notificationscan.txt") ; _LIT(KRequestor,"testapp"); @@ -51,14 +53,30 @@ TInt iRetStatus ; TInt iServiceId; CLocationService* iServicePtr; + TInt iTransactionId; + TInt iRequestType; public : TInt HandleNotifyL(HPositionGenericInfo *aInfo , TInt aError) ; - CancelLocUpdateCallBack(CLocationService *CoreObj) :iCount(0) , iRetStatus(KErrGeneral),iServicePtr(CoreObj) //Default constructor - { - ; - } - + CancelLocUpdateCallBack(TInt trans,TInt req,CLocationService *CoreObj) :iCount(0) , iRetStatus(KErrGeneral),iServicePtr(CoreObj) //Default constructor + { + iTransactionId = trans; + iRequestType = req; + } + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; @@ -136,20 +154,22 @@ { - + __UHEAP_MARK ; CActiveScheduler *Scheduler = new CActiveScheduler ; CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; - CancelLocUpdateCallBack MyUpdates(CoreObj) ; + CancelLocUpdateCallBack MyUpdates(10,TRACE,CoreObj) ; CoreObj->TraceL((&MyUpdates),EBasicInfo) ; CoreObj->CancelOnGoingService(ECancelTrace); - - + delete CoreObj; + delete Scheduler; + + __UHEAP_MARKEND ; return 0 ; } TInt CancelLocUpdatesA(TAny */*Arg*/) @@ -192,20 +212,21 @@ { - + __UHEAP_MARK ; CActiveScheduler *Scheduler = new CActiveScheduler ; CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; - CancelLocUpdateCallBack MyUpdates(CoreObj) ; + CancelLocUpdateCallBack MyUpdates(11,TRACE,CoreObj) ; CoreObj->TraceL((&MyUpdates),EBasicInfo) ; CActiveScheduler :: Start() ; - - + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; return 0 ; @@ -248,19 +269,21 @@ { - + __UHEAP_MARK ; CActiveScheduler *Scheduler = new CActiveScheduler ; CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; - CancelLocUpdateCallBack MyUpdates(CoreObj) ; + CancelLocUpdateCallBack MyUpdates(12,GETLOCATION,CoreObj) ; CoreObj->GetLocationL((&MyUpdates),EBasicInfo) ; CoreObj->CancelOnGoingService(ECancelGetLocation); - - + delete CoreObj; + delete Scheduler; + + __UHEAP_MARKEND ; return 0 ; } TInt CancelLocAsynch(TAny */*Arg*/) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tfunctionthread.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tfunctionthread.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tfunctionthread.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -20,7 +20,12 @@ #include "locationservice.h" #include #include +#include +TInt TraceTimeOutFuncL(); +TInt reqErr;//To share the error value from callback +#define TRACE 1 +#define GETLOCATION 0 _LIT(LogFileName , "C:\\Notifications.txt") ; _LIT(KRequestor,"testapp"); @@ -34,14 +39,35 @@ { TInt iCount ; TInt iRetStatus ; - public : - TInt HandleNotifyL(HPositionGenericInfo *posinfo , TInt aError) ; - - LocUpdateCallBack() :iCount(0) , iRetStatus(KErrGeneral) //Default constructor - { - ; - } - }; + TInt iRequestType; + TInt iTransactionId; + + +public : + TInt HandleNotifyL(HPositionGenericInfo *posinfo , TInt aError) ; + + + LocUpdateCallBack(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral) //Default constructor + { + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; @@ -51,10 +77,12 @@ if(aError != KErrNone) { iRetStatus = aError ; - CActiveScheduler :: Stop() ; - return KErrNone ; - } -if(iCount > 2) + reqErr = KErrGeneral; + CActiveScheduler :: Stop() ; + return KErrGeneral ; + } + iCount++ ; + if(iCount > 1) { iRetStatus = aError ; CActiveScheduler *Current = CActiveScheduler :: Current() ; @@ -118,28 +146,23 @@ TInt GetLocFunctionL() { - - - - LocUpdateCallBack MyUpdates ; + __UHEAP_MARK ; + reqErr= KErrNone; + + LocUpdateCallBack MyUpdates(9,TRACE) ; CActiveScheduler *Scheduler = new CActiveScheduler ; - + CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; - - //not needed any more - /*RRequestorStack infostack; - - const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, - KRequestor) ; - infostack.Append(identityInfo); - CoreObj->SetRequestorIdentityL(infostack);*/ + - // GelocUpdateCallBack MyUpdates(&CmdId , (CLocationService *)NULL) ; CoreObj->TraceL(&MyUpdates,EBasicInfo) ; - + CActiveScheduler :: Start() ; - return 0 ; // Controll never reaches here + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; + return reqErr; } TInt GetLocUpdates(TAny */*Arg*/) @@ -161,13 +184,31 @@ { TInt iCount ; TInt iRetStatus ; - public : - TInt HandleNotifyL(HPositionGenericInfo* aPosInfo, TInt aError) ; - - AsyncGetLoc() :iCount(0) , iRetStatus(KErrGeneral) //Default constructor - { - ; - } + TInt iRequestType; + TInt iTransactionId; + public : + TInt HandleNotifyL(HPositionGenericInfo* aPosInfo, TInt aError) ; + + AsyncGetLoc(TInt aTransId,TInt aReqType) :iCount(0) , iRetStatus(KErrGeneral) //Default constructor + { + iTransactionId = aTransId; + iRequestType = aReqType; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; @@ -182,6 +223,7 @@ if(aError != KErrNone) { iRetStatus = aError ; + reqErr = aError; CActiveScheduler :: Stop() ; return KErrNone ; } @@ -240,23 +282,28 @@ TInt GetLocAsynchFunctionL() { - CActiveScheduler *Scheduler = new CActiveScheduler ; - + __UHEAP_MARK ; + reqErr = KErrNone; + CActiveScheduler *Scheduler = new CActiveScheduler ; + CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; - - AsyncGetLoc MyUpdates ; + + AsyncGetLoc MyUpdates(10,GETLOCATION) ; //not needed any more /*RRequestorStack infostack; - + const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, KRequestor) ; infostack.Append(identityInfo); CoreObj->SetRequestorIdentityL(infostack);*/ CoreObj->GetLocationL(&MyUpdates,EBasicInfo) ; - + CActiveScheduler :: Start() ; - return 0 ; //Controll never reaches here + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; + return reqErr ; } @@ -280,24 +327,20 @@ TInt ServiceFailedFunctionL() { - - CActiveScheduler *Scheduler = new CActiveScheduler ; - CActiveScheduler :: Install(Scheduler) ; - CLocationService *CoreObj = CLocationService ::NewL() ; - - //not needed any more - /*RRequestorStack infostack; - - const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, - KRequestor) ; - infostack.Append(identityInfo); - CoreObj->SetRequestorIdentityL(infostack);*/ - - LocUpdateCallBack MyUpdates ; - - CoreObj->TraceL(&MyUpdates,EBasicInfo) ; - CActiveScheduler :: Start() ; - return 0 ; + reqErr = KErrNone; + __UHEAP_MARK ; + CActiveScheduler *Scheduler = new CActiveScheduler ; + CActiveScheduler :: Install(Scheduler) ; + CLocationService *CoreObj = CLocationService ::NewL() ; + + LocUpdateCallBack MyUpdates(11,TRACE) ; + + CoreObj->TraceL(&MyUpdates,EBasicInfo) ; + CActiveScheduler :: Start() ; + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; + return reqErr ; @@ -307,10 +350,12 @@ TInt ServiceFailedTest(TAny */*Arg*/) { - CTrapCleanup* cleanup = CTrapCleanup::New(); - TRAPD(err , ServiceFailedFunctionL()) ; - delete cleanup ; - return 0 ; + TInt errRet; + CTrapCleanup* cleanup = CTrapCleanup::New(); + TRAPD(err , errRet = ServiceFailedFunctionL()) ; + delete cleanup ; + + return errRet ; } @@ -318,27 +363,26 @@ TInt ConcurrentGetLocCallsL() { - LocUpdateCallBack MyUpdates ; + __UHEAP_MARK ; + reqErr = KErrNone; + LocUpdateCallBack MyUpdates(10,GETLOCATION) ; CActiveScheduler *Scheduler = new CActiveScheduler ; - + CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; - - //not needed any more - /*RRequestorStack infostack; - - const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, - KRequestor) ; - infostack.Append(identityInfo); - CoreObj->SetRequestorIdentityL(infostack);*/ - - - CoreObj->GetLocationL(&MyUpdates,EBasicInfo) ; - - TInt error = CoreObj->GetLocationL(&MyUpdates,EBasicInfo) ; - - - return error ; + + + + CoreObj->GetLocationL(&MyUpdates,EBasicInfo) ; + + TRAPD(error, CoreObj->GetLocationL(&MyUpdates,EBasicInfo) ); + + CActiveScheduler :: Start() ; + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; + + return error | reqErr ; @@ -364,59 +408,37 @@ -TInt CTLocTest:: ConcurrentCallsGetLoc(CStifItemParser& /*aItem*/) - { - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - - TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , ConcurrentGetLocationCalls ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL); - - if(ret == KErrNone) - { - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - - ret = Status.Int() ; - } - FunctionThread.Close(); - - if(ret == KErrInUse) - return KErrNone ; - - return KErrGeneral; - } TInt ConcurrentTraceCallsL() { - LocUpdateCallBack MyUpdates ; + __UHEAP_MARK ; + reqErr = KErrNone; + LocUpdateCallBack MyUpdates(12,TRACE) ; CActiveScheduler *Scheduler = new CActiveScheduler ; - + CActiveScheduler :: Install(Scheduler) ; CLocationService *CoreObj = CLocationService ::NewL() ; - + //not needed any more /*RRequestorStack infostack; - + const CRequestor* identityInfo = CRequestor::NewL(CRequestor::ERequestorService,CRequestor::EFormatApplication, KRequestor) ; infostack.Append(identityInfo); CoreObj->SetRequestorIdentityL(infostack);*/ - - - CoreObj->TraceL(&MyUpdates,EBasicInfo) ;(&MyUpdates,EBasicInfo) ; - - TInt error = CoreObj->TraceL(&MyUpdates,EBasicInfo) ; - - - return error ; + + + CoreObj->TraceL(&MyUpdates,EBasicInfo) ; + + TRAPD(error,CoreObj->TraceL(&MyUpdates,EBasicInfo)) ; + + CActiveScheduler :: Start() ; + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; + return error | reqErr ; @@ -441,32 +463,104 @@ } -TInt CTLocTest:: ConcurrentCallsTrace(CStifItemParser& /*aItem*/) - { - _LIT(KTLocTest ,"TLocTest"); - iLog->Log(KTLocTest) ; - - TRequestStatus Status = KRequestPending ; - RThread FunctionThread ; - - TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , ConcurrentTraceCalls ,KDefaultStackSize , - KMinHeapSize , 0x5000 ,(TAny *) NULL); - - if(ret == KErrNone) - { - FunctionThread.Logon(Status) ; - FunctionThread.Resume() ; - - User :: WaitForRequest (Status) ; - + +TInt TraceTimeOutFunc(TAny */*Arg*/) + { + + CTrapCleanup* cleanup = CTrapCleanup::New(); + TInt Val ; + //Install a new active scheduler to this thread + TRAPD(err ,( Val = TraceTimeOutFuncL()) ); + delete cleanup ; + + if(err) + { + return err ; + } + return Val ; + } + + +class LocUpdateCallBackTO : public MLocationCallBack + { + TInt iCount ; + TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; + public : + TInt HandleNotifyL(HPositionGenericInfo *posinfo , TInt aError) ; + + LocUpdateCallBackTO(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral) //Default constructor + { + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + + + }; - ret = Status.Int() ; - } - FunctionThread.Close(); - - if(ret == KErrInUse) - return KErrNone ; - - return KErrGeneral; - } + + +TInt LocUpdateCallBackTO :: HandleNotifyL(HPositionGenericInfo *posinfo , TInt aError) + { + iCount++; + if(aError != KErrTimedOut) + { + iRetStatus = aError ; + CActiveScheduler *Current = CActiveScheduler :: Current() ; + reqErr = KErrGeneral; + Current->Stop() ; + + return KErrGeneral ; + } + + else if(iCount > 2) + { + iRetStatus = aError ; + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + + } + return KErrNone ; + } + +TInt TraceTimeOutFuncL() + { + __UHEAP_MARK ; + reqErr = KErrNone; + LocUpdateCallBackTO MyUpdates(14,TRACE) ; + CActiveScheduler *Scheduler = new CActiveScheduler ; + + CActiveScheduler :: Install(Scheduler) ; + CLocationService *CoreObj = CLocationService ::NewL() ; + + + + TPositionUpdateOptions updateopts ; + updateopts.SetUpdateTimeOut(3); + TPositionFieldId FieldList[10] ; + CoreObj->TraceL(&MyUpdates,EBasicInfo,FieldList,&updateopts) ; + + + CActiveScheduler :: Start() ; + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; + return reqErr; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tloctestblocks.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tloctestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tloctestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -77,7 +77,8 @@ ENTRY("ConcurrentCallsGetLoc" , CTLocTest:: ConcurrentCallsGetLoc), ENTRY("ConcurrentCallsTrace" , CTLocTest:: ConcurrentCallsTrace), ENTRY("EmptyCancelTrace" , CTLocTest:: EmptyCancelTrace), - ENTRY("EmptyCancelLocAsynch" , CTLocTest:: EmptyCancelLocAsynch) + ENTRY("EmptyCancelLocAsynch" , CTLocTest:: EmptyCancelLocAsynch), + ENTRY("TraceTimeOut" , CTLocTest:: TraceTimeOut) }; @@ -99,6 +100,7 @@ { // Print to UI + __UHEAP_MARK ; _LIT( KTLocTest, "TLocTest" ); _LIT( KExample, "GetLocation" ); iLog->Log(KTLocTest) ; @@ -122,7 +124,7 @@ - TInt Result =CoreObj->GetLocationL(&position) ; + TRAPD(Result,CoreObj->GetLocationL(&position)) ; TPosition pos ; position.GetPosition(pos) ; @@ -131,7 +133,7 @@ TReal32 aAltitude = pos.Altitude() ; delete CoreObj ; - + __UHEAP_MARKEND ; return Result ; } @@ -171,11 +173,12 @@ { _LIT(KTLocTest , "TLocTest") ; iLog->Log(KTLocTest) ; -// CLocationService *CoreObj = CLocationService :: NewL(); -// TPosition LastKnownPos ; - -// CoreObj->GetLastKnownLoc(LastKnownPos) ; - return KErrNone ; + CLocationService *CoreObj = CLocationService :: NewL(); + TPosition LastKnownPos ; + + TInt err = CoreObj->GetLastKnownLoc(LastKnownPos) ; + delete CoreObj; + return err; } @@ -210,6 +213,7 @@ TInt CTLocTest :: FindDistance(CStifItemParser& /*aItem*/) { + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService :: NewL(); @@ -413,6 +417,7 @@ delete CoreObj; + __UHEAP_MARKEND ; return KErrNone ; } @@ -420,6 +425,7 @@ */ TInt CTLocTest :: FindBearingTo(CStifItemParser& /*aItem*/) { + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService :: NewL(); @@ -621,6 +627,7 @@ delete CoreObj; + __UHEAP_MARKEND ; return KErrNone ; } @@ -631,6 +638,7 @@ */ TInt CTLocTest :: MoveCoordinates(CStifItemParser& /*aItem*/) { + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService :: NewL(); @@ -705,6 +713,7 @@ LogFile.Close() ; LogSession.Close() ; delete CoreObj; + __UHEAP_MARKEND ; return KErrNone ; } /* @@ -786,7 +795,7 @@ iLog->Log(KTLocTest) ; _LIT(KLog , "EmptyCanceltest ") ; iLog->Log(KTLocTest) ;*/ - + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService ::NewL() ; //not needed any more /*RRequestorStack infostack; @@ -799,10 +808,12 @@ if( error==KErrNotFound ) { delete CoreObj; + __UHEAP_MARKEND ; return KErrNone; } delete CoreObj; + __UHEAP_MARKEND ; } TInt CTLocTest :: EmptyCancelLocAsynch(CStifItemParser& /*aItem*/) @@ -832,3 +843,89 @@ } +TInt CTLocTest :: TraceTimeOut(CStifItemParser& /*aItem*/) + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + _LIT(KLog , "TraceTimeOut ") ; + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L("TraceTimeOut Test") , TraceTimeOutFunc ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) NULL);; + + if(!ret) + { + + _LIT(Klog , "thread created ") ; + iLog->Log(Klog) ; + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + ret = Status.Int() ; + } + + + return ret; + } + + +TInt CTLocTest:: ConcurrentCallsGetLoc(CStifItemParser& /*aItem*/) + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , ConcurrentGetLocationCalls ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) NULL); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + + return ret; + } + + +TInt CTLocTest:: ConcurrentCallsTrace(CStifItemParser& /*aItem*/) + { + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + TInt ret = FunctionThread.Create(_L(" ConcurrentCallsGetLoc Thread") , ConcurrentTraceCalls ,KDefaultStackSize , + KMinHeapSize , 0x5000 ,(TAny *) NULL); + + if(ret == KErrNone) + { + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + + + ret = Status.Int() ; + } + FunctionThread.Close(); + + + return ret; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tstraygetlocationtest.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tstraygetlocationtest.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tstraygetlocationtest.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -30,7 +30,7 @@ TInt iCmd ; TInt iRetStatus ; TInt iCount ; - + TInt iTransactionId; CLocationService *iService ; @@ -43,14 +43,35 @@ { ; } - ASyncLocCB(TInt aCmd , CLocationService *aService) ; + ASyncLocCB(TInt aCmd , CLocationService *aService,TInt aTransId) ; + + inline TUint GetRequestType(void) + { + return iCmd ; + } + + + MLocationCallBack* GetCallBackobj() + { + return this; + } + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; -ASyncLocCB :: ASyncLocCB(TInt aCmd ,CLocationService *aService):iCount(0) +ASyncLocCB :: ASyncLocCB(TInt aCmd ,CLocationService *aService,TInt aTransId):iCount(0) { iCmd = aCmd ; iService = aService ; + iTransactionId = aTransId; } @@ -58,35 +79,39 @@ { if(iCmd == GETLOCATION) { - iService->CancelOnGoingService(ECancelGetLocation) ; + //Do nothing } - if(iCount > 5) - { - CActiveScheduler *current = CActiveScheduler :: Current() ; - current->Stop() ; - } - iCount++ ; - iRetStatus = KErrNone ; - return iRetStatus ; + if(iCount > 2) + { + CActiveScheduler *current = CActiveScheduler :: Current() ; + current->Stop() ; + } + iCount++ ; + iRetStatus = KErrNone ; + return iRetStatus ; } TInt StrayTestGetLocL() { - - CActiveScheduler *Scheduler = new CActiveScheduler ; + __UHEAP_MARK ; + CActiveScheduler *Scheduler = new CActiveScheduler ; + + CActiveScheduler :: Install(Scheduler) ; + CLocationService *CoreObj = CLocationService ::NewL() ; + ASyncLocCB Updates(TRACE , CoreObj,1000) ; + + ASyncLocCB GetLoc(GETLOCATION , CoreObj,2000) ; - CActiveScheduler :: Install(Scheduler) ; - CLocationService *CoreObj = CLocationService ::NewL() ; - ASyncLocCB Updates(TRACE , CoreObj) ; - ASyncLocCB GetLoc(GETLOCATION , CoreObj) ; + // GelocUpdateCallBack MyUpdates(&CmdId , (CLocationService *)NULL) ; + CoreObj->TraceL(&Updates,EBasicInfo) ; + CoreObj->GetLocationL(&GetLoc,EBasicInfo) ; - // GelocUpdateCallBack MyUpdates(&CmdId , (CLocationService *)NULL) ; - CoreObj->TraceL(&Updates,EBasicInfo) ; - CoreObj->GetLocationL(&GetLoc,EBasicInfo) ; - - CActiveScheduler :: Start() ; + CActiveScheduler :: Start() ; + delete CoreObj; + delete Scheduler; + __UHEAP_MARKEND ; return 0 ; // Controll never reaches here } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tstraysignaltest.cpp --- a/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tstraysignaltest.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/dev/tlocservicetest/src/tstraysignaltest.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -21,10 +21,10 @@ #include "locationservice.h" - #define TRACE 0 - #define GETLOCATION 1 - - +#define TRACE 1 +#define GETLOCATION 0 + +TInt reqErr1;//To share the error value from callback _LIT(KRequestor,"testapp"); class ASyncCB : public MLocationCallBack @@ -32,78 +32,101 @@ TInt iCmd ; TInt iRetStatus ; TInt iCount ; - - CLocationService *iService ; + TInt iRequestType; + TInt iTransactionId; + + CLocationService *iService ; + + +public : - public : - - - TInt HandleNotifyL(HPositionGenericInfo* aPosInfo , TInt aError) ; + TInt HandleNotifyL(HPositionGenericInfo* aPosInfo , TInt aError) ; + + ASyncCB() :iCmd(0) , iRetStatus(KErrGeneral) , iCount(0) //Default constructor + { + } + ASyncCB(TInt transId,TInt aCmd , CLocationService *aService) ; - ASyncCB() :iCmd(0) , iRetStatus(KErrGeneral) , iCount(0) //Default constructor - { - ; - } - ASyncCB(TInt aCmd , CLocationService *aService) ; -}; + inline TUint GetRequestType(void) + { + return iRequestType ; + } + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; -ASyncCB :: ASyncCB(TInt aCmd ,CLocationService *aService):iCount(0) -{ - iCmd = aCmd ; - iService = aService ; - -} +ASyncCB :: ASyncCB(TInt transId,TInt aCmd ,CLocationService *aService):iCount(0) + { + iCmd = aCmd ; + iService = aService ; + + iTransactionId = transId; + iRequestType = aCmd; + } TInt ASyncCB :: HandleNotifyL (HPositionGenericInfo* aPosInfo , TInt Error ) -{ - if(iCmd == TRACE) - { - iService->CancelOnGoingService(ECancelTrace) ; - } - else if(iCmd == GETLOCATION) - { - iService->GetLocationL(this,EBasicInfo) ; - iCount++ ; - } - - if(iCount > 3) - { - CActiveScheduler *current = CActiveScheduler :: Current() ; - current->Stop() ; - } - iRetStatus = KErrNone ; - return iRetStatus ; -} + { + if(iCmd == TRACE) + { + if(iService->CancelService(this->GetTransactionId())) + reqErr1 = KErrGeneral; + } + else if(iCmd == GETLOCATION) + { + iCount++; + TRAPD(err,iService->GetLocationL(this,EBasicInfo)); + if(err) + reqErr1 = KErrGeneral; + } + + if(iCount > 2) + { + CActiveScheduler *current = CActiveScheduler :: Current() ; + current->Stop() ; + } + iRetStatus = KErrNone ; + return iRetStatus ; + } TInt StrayTestL() -{ - - CActiveScheduler *Scheduler = new CActiveScheduler ; + { + __UHEAP_MARK ; + reqErr1 = KErrNone; + CActiveScheduler *Scheduler = new CActiveScheduler ; + + CActiveScheduler :: Install(Scheduler) ; + CLocationService *CoreObj = CLocationService ::NewL() ; + ASyncCB Updates(12,TRACE , CoreObj) ; + ASyncCB GetLoc(13,GETLOCATION , CoreObj) ; - CActiveScheduler :: Install(Scheduler) ; - CLocationService *CoreObj = CLocationService ::NewL() ; - ASyncCB Updates(TRACE , CoreObj) ; - ASyncCB GetLoc(GETLOCATION , CoreObj) ; + // GelocUpdateCallBack MyUpdates(&CmdId , (CLocationService *)NULL) ; + CoreObj->TraceL(&Updates,EBasicInfo) ; + CoreObj->GetLocationL(&GetLoc,EBasicInfo) ; - // GelocUpdateCallBack MyUpdates(&CmdId , (CLocationService *)NULL) ; - CoreObj->TraceL(&Updates,EBasicInfo) ; - CoreObj->GetLocationL(&GetLoc,EBasicInfo) ; - - CActiveScheduler :: Start() ; - return 0 ; // Controll never reaches here -} + CActiveScheduler :: Start() ; + delete Scheduler; + delete CoreObj; + __UHEAP_MARKEND ; + return reqErr1 ; + } TInt StrayTest(TAny */*Arg*/) -{ - CTrapCleanup* cleanup = CTrapCleanup::New(); - //Install a new active scheduler to this thread - TRAPD(err , StrayTestL()) ; - delete cleanup ; - return 0 ; -} + { + TInt errval; + CTrapCleanup* cleanup = CTrapCleanup::New(); + //Install a new active scheduler to this thread + TRAPD(err , errval = StrayTestL()) ; + delete cleanup ; + return errval | err ; + } - \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/testing/tsapiloctest/inc/locationcoreimp.h --- a/serviceproviders/sapi_location/tsrc/testing/tsapiloctest/inc/locationcoreimp.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI core implementation. -* -*/ - - - -#ifndef C_LOCATIONCOREIMP_H -#define C_LOCATIONCOREIMP_H - -#include -#include -#include "locationservice.h" - - -/** - * Consts to identify the type of location request (trace, getlocation - */ - -const TInt KTraceRequest = 1 ; -const TInt KGetLocationRequest = 2 ; - - - - - -/** - * This class implements Location SAPI core logic.It has methods - * for retreving information location asynchronusly . - */ - -class CGetLoc : public CActive - { - public: - - - - /** - * Creates a new instance of a @ref CGetLoc - * - * @param aPositionServer subsession to location server - * @param aRequestorInfoStack requestor indenty - * @param aList List of position fields that should be retrived - * @param aLocationInfoCategory information type required(Basic, Generic) - * - */ - - IMPORT_C static CGetLoc* NewL( RPositionServer &aPositionServer , - TPositionFieldIdList aList , - TInt aRequestType, - TInt aLocationInfoCategory ) ; - - /** - * Destructor. - */ - virtual ~CGetLoc() ; - - - - /** - * Gets users current location Asynchronously calls the users callback - * function when updates are recived from location server - * - * @param aCallBackObj callback object for updates notification - * @param aUpdatesOptions update options for asynchronous calls - * - */ - TInt GetLocation( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions =NULL ); - - /** - * Traces users location change - * Any location change is informed to user via callback function - * - * @param aCallBackObj callback handle for async trace call - * @param aUpdateOptions updateoptions for trace call - * - * @see TPositionUpdateOptions in LbsCommon.h for details - */ - TInt GetLocationUpdates( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions = NULL ); - - void SetStatusComplete() - { - iRequestStatus = 1; - } - TBool IsStatusComplete() - { - if(iRequestStatus == 0) - return false; - else - return true; - } - - - - - protected: - - /** - * From CActive - */ - void DoCancel(); - void RunL(); - - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - - void ConstructL(); - /** - * Default constructor - */ - - CGetLoc(); - TInt DoInitialiseL(); - - private: - - - - - /** - * Class Member which holds location server subsession - */ - RPositioner iPositioner; - - /** - * Basic info - */ - TPositionInfo iPositionInfo; - - - /** - * Basic info base - */ - TPositionInfoBase* iPosInfoBase; - /** - * Generic info - */ - HPositionGenericInfo *iGenericPosInfo ; - /** - * callback object - */ - MLocationCallBack *iCallBack ; - - /** - * Request type (Getlocation or Trace) - */ - TInt iRequestType ; - - TInt iRequestStatus; - - - }; - - - -#endif //C_LOCATIONCOREIMP_H - - \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/testing/tsapiloctest/inc/locationservice.h --- a/serviceproviders/sapi_location/tsrc/testing/tsapiloctest/inc/locationservice.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI service implementation. -* -*/ - - -#ifndef LOCATIONSERVICE_H -#define LOCATIONSERVICE_H - -#include -class CGetLoc; -/** - * Identity for location SAPI lib - * This will be appended to requestor identity information stack received from the - * client and will be passed onto location server - */ - -_LIT(KIdentity,"Location SAPI"); - -/** - * Key for locating active objects associated with async request in registration table - * - * @ 0 for Getlocation async Active object - * @ 1 for Trace async active object - */ - -const TInt KARRAY_INDEX_GETLOCATION = 0 ; -const TInt KARRAY_INDEX_TRACE = 1 ; - - - -/** - * Key for locating location information in CLiwGenericParamList - */ -_LIT8(KLongitudeKey,"Longitude") ; -_LIT8(KLatitudeKey , "Latitude") ; -_LIT8(KAltitudeKey , "Altitude") ; - -_LIT(KUnknown,"Unknown"); - -/** - * Default Update options - */ -//Second -const TInt KSSecond = 1000000; - -//Update interval -const TInt KSUpdateInterval = KSSecond; - -//Update time out -const TInt KSUpdateTimeOut = 15*KSSecond; - -//MaxAge -const TInt KSMaxAge = 0; - -/** - * Enums required for mathoperations - */ -enum TMathOperationChoice - { - EDistance = 0, - EBearingTo = 1, - EMove = 2 - }; - -/** - * Notification Type to be cancelled - */ -enum TCancelParam - { - ECancelGetLocation = 0, - ECancelTrace = 1 - }; -/** - * Enumeration used to identify category of location information user intends to - * retrieve - * Example: specifying EBasic user will get only longitude,latitude and altitude - */ - enum TLocationInfoType - { - EBasicInfo = 0, - EGenericInfo = 1 - }; - -/** - * used by the caller of math operation to send input parameters - * after computation MathOperation wil fill in result field of this - * struct. - */ -struct _INPPARM - { - //specifies option for mathoperation - TInt servicechoice; - //result of the computation - TReal32 result ; - //Source Coordinate for math operation - TCoordinate source; - //Destination Coordinate for math operation - TCoordinate destination ; - //In case of find bearingto following two should be supplied by the consumer - TReal32 bearing; - TReal32 distance; - - }; - -typedef struct _INPPARM inpparam; - - - -/** - * Location callback interface, its pure interface class, application need to - * Write there own callback derriving from this class. - * @Depenedency lbs.lib - */ - - class MLocationCallBack - { - /** - * Handles notifications caused by an asynchronous GetLocationL, - * or by trace. - * - * @param aOutPos updated position got from location server - * @return Success/Error code for the callback. - * - * @see HPositionGenericInfo in LbsPositionInfo.h for details - * - */ - public : - virtual TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) = 0 ; - }; - - -/** - * CLocationService class : This is a wrapper class for the Functionalities - * offered by Location Retreival APIs. - * In case of An Asynchronus request it has method which Instantiates and delegate - * the job to another class which also opens new sub-session with - * Location server. - */ - - -class CLocationService : public CBase - { - public : - /** - * Creates a new instance of a @ref CLocationService - * @return The newly created CLocationService object - */ - IMPORT_C static CLocationService *NewL() ; - - - /* - * @Destructor - */ - virtual ~CLocationService() ; - - /** - * Methods on the Core Location implementation - */ - - - - /** - * Synchronous get location with update options returns current location of the user - * - * @param aPosinfobase input TPositionInfoBase object which will hold location details - * @param aUpdateOpts updateoptions for synchronous calls - */ - IMPORT_C TInt GetLocationL( TPositionInfoBase* aPos , - const TPositionUpdateOptions* aUpdateOpts= NULL ) ; - - - /** - * Gets the current location of user asynchronosly calls the users callback handle on reciving - * location updates - * @param aCallBack callback object after reciving the position updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFieldIdList specifies field of HPositionGenericInfo that user intend to retrieve. - * @param aUpdateoptions update options for asynchronous requests. - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - IMPORT_C TInt GetLocationL( MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFieldIdList = NULL , - const TPositionUpdateOptions* aUpdateopts = NULL - ); - - /** - * Gets module information of the Positioning module specified my aModuleId - * - * @param TPositionModuleId param to store the obtained module information - * - * @see lsbcommon.h for details of TPositionModuleInfoBase - */ - IMPORT_C TInt GetModuleInfo( TPositionModuleInfoBase& aModuleInfo ) const ; - - /** - * Performs mathoperations (move,distance,bearingto) by parsing contents of input param - * - * @param aInput input paramater for math opertaions - * - * @see inparam in this file for detailed math operation list - */ - - - IMPORT_C TInt MathOperation( inpparam& aInput ); - - /** - * Trace function traces users location changes any change in users current location is notificed - * to user via call back function - * - * @param aCallBackObj callback object after reciving location updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFiledList List of position fields that should be retrived - * @param aUpdateOptions update options for trace - * - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - - IMPORT_C TInt TraceL(MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFiledList = NULL , - const TPositionUpdateOptions* aUpateOptions= NULL ); - - - /** - * Method to cancell pending async request - * - * aCancelparam cancellation type (trace,getlocation) - * - * @see TCancelParam for cancellation options - */ - - IMPORT_C TInt CancelOnGoingService( TInt aCancelparam ) ; - - /** - * Method to fetch last known location from location server - */ - - TInt GetLastKnownLoc( TPosition& aResultPos ) ; - - - - - - protected: - /** - * internal method to construct class members - */ - void ConstructL() ; - - /** - * Default constructor - */ - CLocationService() ; - - /** - * Method to initalise class memebers - */ - void DoInitialiseL() ; - - private : - - /** - * Subsession used to fetch location information - */ - - RPositioner iPositioner; - - /** - * Session used for getting location information - */ - - RPositionServer iPosServer; - - /** - * Registration table for callbacks - */ - - RPointerArray iRegTable; - TInt iIndex; - - - /** - * Module indtifier used by location server for getting location information - */ - TPositionModuleId iModuleId ; - - }; - - -#endif // LOCATIONSERVICE_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/testing/tsapiloctest/inc/sapiloctest.h --- a/serviceproviders/sapi_location/tsrc/testing/tsapiloctest/inc/sapiloctest.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/testing/tsapiloctest/inc/sapiloctest.h Thu Aug 27 07:43:07 2009 +0300 @@ -258,7 +258,7 @@ }; - +TInt TraceLPosition6T(TAny */*Arg*/); TInt threadFunc1(TAny */*Arg*/); TInt threadFuncTO(TAny */*Arg*/); TInt threadFunc2(TAny */*Arg*/); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/testing/tsapiloctest/src/sapiloctestblocks.cpp --- a/serviceproviders/sapi_location/tsrc/testing/tsapiloctest/src/sapiloctestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/testing/tsapiloctest/src/sapiloctestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -34,6 +34,8 @@ RFile LogFile ; RFs LogSession ; +#define GETLOCATION 0 +#define TRACE 1 void OpenFile() { LogSession.Connect() ; @@ -401,7 +403,7 @@ CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - TRAPD( error,aRet = CoreObj->GetLocationL(&currPos) ); + TRAP(aRet , CoreObj->GetLocationL(&currPos) ); if( KErrNone == aRet ) { @@ -469,138 +471,158 @@ aRequestorStack.Insert(identityInfo,0); CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - User::After(120000000) ; - aRet1 = CoreObj->GetLocationL(&currPos1) ; - - + //User::After(120000000) ; + TRAP(aRet1,CoreObj->GetLocationL(&currPos1) ); + + if (KErrNone == aRet1) - { - aRet2 = CoreObj->GetLocationL(&currPos2) ; - - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - - currPos1.GetPosition(currPosition1); - currPos2.GetPosition(currPosition2); - aFlag1 = ValidatePosition(currPosition1); - aFlag2 = ValidatePosition(currPosition2); - - if((KErrNone == aFlag1) && (KErrNone == aFlag2)) - { - OpenFile(); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - } + { + TRAPD(aRet2,CoreObj->GetLocationL(&currPos2)) ; + + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + + currPos1.GetPosition(currPosition1); + currPos2.GetPosition(currPosition2); + aFlag1 = ValidatePosition(currPosition1); + aFlag2 = ValidatePosition(currPosition2); + + if((KErrNone == aFlag1) && (KErrNone == aFlag2)) + { + OpenFile(); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + } else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(getloc error)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - /*aRequestorStack.Close(); + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(getloc error)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - + delete CoreObj; + __UHEAP_MARKEND; - + return returnCode; - + } - - - - + + + + // ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionAsync // ----------------------------------------------------------------------------- // class LocUpdateCallBack : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - LocUpdateCallBack() :iCount(0) , iRetStatus(KErrGeneral){;} - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + LocUpdateCallBack(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + TInt LocUpdateCallBack :: HandleNotifyL(HPositionGenericInfo *currPos , TInt /*aError*/) - { -// User::After(60000000); - TInt aRetVal = KErrNone; - - OpenFile(); - LogFile.Write(_L8("\n\n ")); - CloseFile(); - TPosition outPos ; - currPos->GetPosition(outPos) ; - aRetVal = ValidatePosition(outPos); - + { + // User::After(60000000); + TInt aRetVal = KErrNone; + + OpenFile(); + LogFile.Write(_L8("\n\n ")); + CloseFile(); + TPosition outPos ; + currPos->GetPosition(outPos) ; + aRetVal = ValidatePosition(outPos); + if( KErrNone == aRetVal ) - { - OpenFile(); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - return KErrNone ; - } + Current->Stop() ; + return KErrNone ; + } TInt GetLocFunctionL() - { + { TBuf8<20> retBuf; TRealFormat retFormat; - + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService ::NewL() ; - + if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - LocUpdateCallBack MyUpdates ; - + + LocUpdateCallBack MyUpdates(10,GETLOCATION) ; + CoreObj->GetLocationL(&MyUpdates) ; - - User::After(60000000); + + // User::After(60000000); CActiveScheduler :: Start() ; - + retBuf.Num(returnCode,retFormat) ; OpenFile(); LogFile.Write(_L8("\nreturnCode : ")); @@ -609,11 +631,12 @@ /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::GetPositionAsync( CStifItemParser& /*aItem*/ ) - { + { TRequestStatus status = KRequestPending; TInt aRet = KErrNone; returnCode = KErrNone; @@ -621,132 +644,154 @@ _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetPositionAsync" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - + + __UHEAP_MARK; + TRAPD(err , aRet = GetLocFunctionL()) ; if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; } - - + + // ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionAsyncOpts1 // ----------------------------------------------------------------------------- // class LocUpdateCallBackOpts1 : public MLocationCallBack - { - TInt iCount ; - TInt iRetStatus ; - public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - LocUpdateCallBackOpts1() :iCount(0) , iRetStatus(KErrGeneral) //Default constructor - {;} - }; - + { + TInt iCount ; + TInt iRetStatus ; + TInt iTransactionId; + TInt iRequestType; + public : + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + LocUpdateCallBackOpts1(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral) //Default constructor + { + iTransactionId = transId; + iRequestType = req; + } + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + TInt LocUpdateCallBackOpts1 :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt aError) - { - if(KErrTimedOut == aError) - { - OpenFile(); - LogFile.Write(_L8("\n\n ")); - LogFile.Write(_L8("Passed..\n ")); - CloseFile(); - returnCode = KErrNone; - } - - else - { - OpenFile(); - LogFile.Write(_L8("GetPositionAsyncOpts1 Async failed ")); - CloseFile(); - returnCode = KErrGeneral; - } - - - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - - return KErrNone ; - } + { + if(KErrTimedOut == aError) + { + OpenFile(); + LogFile.Write(_L8("\n\n ")); + LogFile.Write(_L8("Passed..\n ")); + CloseFile(); + returnCode = KErrNone; + } + + else + { + OpenFile(); + LogFile.Write(_L8("GetPositionAsyncOpts1 Async failed ")); + CloseFile(); + returnCode = KErrGeneral; + } + + + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + + return KErrNone ; + } TInt GetLocFunctionOpts1L() - { + { + __UHEAP_MARK ; TInt ret; TPositionUpdateOptions aOptions; TTimeIntervalMicroSeconds aTimeOut = 100; - + CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; - + //not needed any more + /*RRequestorStack aRequestorStack; + const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - LocUpdateCallBackOpts1 MyUpdates ; - + + LocUpdateCallBackOpts1 MyUpdates(11,GETLOCATION) ; + aOptions.SetUpdateTimeOut(aTimeOut); - - ret = CoreObj->GetLocationL(&MyUpdates,0,NULL ,&aOptions) ; - + + TRAP(ret,CoreObj->GetLocationL(&MyUpdates,0,NULL ,&aOptions)) ; + if(KErrNone == ret) - { - CActiveScheduler :: Start() ; - } - + { + CActiveScheduler :: Start() ; + } + else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + //aRequestorStack.Close(); - + delete CoreObj; + + __UHEAP_MARKEND ; return KErrNone;; - } + } TInt CSAPILocTest::GetPositionAsyncOpts1( CStifItemParser& /*aItem*/ ) - { + { TRequestStatus status = KRequestPending; TInt aRet = KErrNone; returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetPositionAsyncOpts1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - + + __UHEAP_MARK; + TInt start = User::CountAllocCells(); TRAPD(err ,aRet = GetLocFunctionOpts1L()) ; if( err || aRet) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + TInt end = User::CountAllocCells(); - + __UHEAP_MARKEND; - - return returnCode; - } + + return returnCode; + } // ----------------------------------------------------------------------------- @@ -755,142 +800,165 @@ // class LocUpdateCallBackOpts2 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - LocUpdateCallBackOpts2() :iCount(0) , iRetStatus(KErrGeneral){;} - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + LocUpdateCallBackOpts2(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + TInt LocUpdateCallBackOpts2 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - User::After(60000000); + { + // User::After(60000000); if(KErrNone == aError) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - // ValidatePosition(currPos1); - TBuf8<50> buf; - TRealFormat format ; - TInt64 aTime1;; - TTime aTimeStamp1; - aTimeStamp1 = currPos1.Time(); - aTime1 = aTimeStamp1.Int64(); - buf.Num(aTime1 , format) ; - if(aTime1) - { - OpenFile(); + { + TPosition currPos1; + currPos->GetPosition(currPos1); + // ValidatePosition(currPos1); + TBuf8<50> buf; + TRealFormat format ; + TInt64 aTime1;; + TTime aTimeStamp1; + aTimeStamp1 = currPos1.Time(); + aTime1 = aTimeStamp1.Int64(); + buf.Num(aTime1 , format) ; + if(aTime1) + { + OpenFile(); LogFile.Write(_L8("Time = ")); - LogFile.Write(buf) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); + LogFile.Write(buf) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); LogFile.Write(_L8("\nFailed(Time value)..")); - CloseFile(); - returnCode = KErrGeneral; - } - - } - - else - { - OpenFile(); + CloseFile(); + returnCode = KErrGeneral; + } + + } + + else + { + OpenFile(); LogFile.Write(_L8("\nFailed(Handlenotifyl error)..")); - CloseFile(); - returnCode = KErrGeneral; - } - - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - return KErrNone ; -} + CloseFile(); + returnCode = KErrGeneral; + } + + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + return KErrNone ; + } TInt GetLocFunctionOpts2L() - { + { + __UHEAP_MARK ; TInt ret; TPositionInfo aPosition1,aPosition2,aPosition3; TPosition aPos1,aPos2,aPos3; TPositionUpdateOptions aOptions; TTime start,end; TTimeIntervalMicroSeconds aTimeOut = 6000000; - TTimeIntervalMicroSeconds aInterval = 60000000; + TTimeIntervalMicroSeconds aInterval = 60000000; TTimeIntervalMicroSeconds aActualInterval; - + CLocationService *CoreObj = CLocationService ::NewL() ; - + if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - LocUpdateCallBackOpts2 MyUpdates ; + + LocUpdateCallBackOpts2 MyUpdates(12,GETLOCATION) ; aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aInterval); - - ret = CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ; - + + TRAP(ret ,CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ); + if( KErrArgument == ret ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed\n")); - CloseFile(); + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed\n")); + CloseFile(); returnCode = KErrNone; - /*aRequestorStack.Close(); - delete identityInfo;*/ - delete CoreObj; - return returnCode; - } - - else - { /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - returnCode = KErrGeneral; - return returnCode; - } - } + delete CoreObj; + __UHEAP_MARKEND ; + return returnCode; + } + + else + { + /*aRequestorStack.Close(); + delete identityInfo;*/ + delete CoreObj; + returnCode = KErrGeneral; + __UHEAP_MARKEND ; + return returnCode; + } + } TInt CSAPILocTest::GetPositionAsyncOpts2( CStifItemParser& /*aItem*/ ) - { + { TRequestStatus status = KRequestPending; - TInt aRet = KErrNone; - returnCode = KErrNone; + TInt aRet = KErrNone; + returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetPositionAsyncOpts2" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err ,aRet = GetLocFunctionOpts2L()) ; if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; - } + } @@ -900,171 +968,196 @@ // class LocUpdateCallBackOpts3 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iTransactionId; + TInt iRequestType; + public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - LocUpdateCallBackOpts3() :iCount(0) , iRetStatus(KErrGeneral){;} + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + LocUpdateCallBackOpts3(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; - - + + TInt LocUpdateCallBackOpts3 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - User::After(60000000); + { + // User::After(60000000); if(KErrNone == aError) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - TBuf8<50> buf; - TRealFormat format ; - TInt64 aTime1;; - TTime aTimeStamp1; - TPosition currPos1; - currPos->GetPosition(currPos1); - aTimeStamp1 = currPos1.Time(); - aTime1 = aTimeStamp1.Int64(); - buf.Num(aTime1 , format) ; - if(aTime1) - { - OpenFile(); - LogFile.Write(_L8("Time = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")); - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\nFailed to write Time value")); - CloseFile(); - returnCode = KErrGeneral; - } - } - - else - { - OpenFile(); + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + TBuf8<50> buf; + TRealFormat format ; + TInt64 aTime1;; + TTime aTimeStamp1; + TPosition currPos1; + currPos->GetPosition(currPos1); + aTimeStamp1 = currPos1.Time(); + aTime1 = aTimeStamp1.Int64(); + buf.Num(aTime1 , format) ; + if(aTime1) + { + OpenFile(); + LogFile.Write(_L8("Time = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")); + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\nFailed to write Time value")); + CloseFile(); + returnCode = KErrGeneral; + } + } + + else + { + OpenFile(); LogFile.Write(_L8("\nFailed..")); - CloseFile(); - returnCode = KErrGeneral; - } - - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - return KErrNone ; -} + CloseFile(); + returnCode = KErrGeneral; + } + + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + return KErrNone ; + } TInt GetLocFunctionOpts3L() - { + { + __UHEAP_MARK ; TInt ret; TPositionInfo aPosition1,aPosition2,aPosition3; TPosition aPos1,aPos2,aPos3; TPositionUpdateOptions aOptions; TTimeIntervalMicroSeconds aTimeOut = 60000000; - TTimeIntervalMicroSeconds aInterval = 6000000; - TBool aAcceptPartialUpdates = ETrue; - + TTimeIntervalMicroSeconds aInterval = 6000000; + TBool aAcceptPartialUpdates = ETrue; + CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - LocUpdateCallBackOpts3 MyUpdates ; - + + LocUpdateCallBackOpts3 MyUpdates(29,GETLOCATION) ; + aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aInterval); aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates); - - ret = CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ; - + + TRAP(ret,CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions)) ; + if( KErrNone == ret) - { - CActiveScheduler :: Start() ; - if( KErrNone == returnCode ) - { - CoreObj->GetLocationL(&aPosition1,&aOptions); - //CoreObj->GetLocationL(&aPosition2,&aOptions); - //CoreObj->GetLocationL(&aPosition3,&aOptions); - - aPosition1.GetPosition(aPos1); - - returnCode = ValidatePosition(aPos1); - - /* if( KErrNone == returnCode) + { + CActiveScheduler :: Start() ; + if( KErrNone == returnCode ) + { + CoreObj->GetLocationL(&aPosition1,&aOptions); + //CoreObj->GetLocationL(&aPosition2,&aOptions); + //CoreObj->GetLocationL(&aPosition3,&aOptions); + + aPosition1.GetPosition(aPos1); + + returnCode = ValidatePosition(aPos1); + + /* if( KErrNone == returnCode) { aPosition2.GetPosition(aPos2); returnCode = ValidatePosition(aPos2); } - + if( KErrNone == returnCode) { aPosition3.GetPosition(aPos3); returnCode = ValidatePosition(aPos3); } - */ - //aRequestorStack.Close(); - - delete CoreObj; - return returnCode; - } - else - { - //aRequestorStack.Close(); - - delete CoreObj; - return returnCode; - } - } - + */ + //aRequestorStack.Close(); + + delete CoreObj; + __UHEAP_MARKEND ; + return returnCode; + } + else + { + //aRequestorStack.Close(); + + delete CoreObj; + __UHEAP_MARKEND ; + return returnCode; + } + } + else - { - /*aRequestorStack.Close(); + { + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - return KErrGeneral; - } - } + delete CoreObj; + __UHEAP_MARKEND ; + return KErrGeneral; + } + } TInt CSAPILocTest::GetPositionAsyncOpts3( CStifItemParser& /*aItem*/ ) -{ - - TRequestStatus status = KRequestPending; - TInt aRet = KErrNone; - returnCode = KErrNone; - + { + + TRequestStatus status = KRequestPending; + TInt aRet = KErrNone; + returnCode = KErrNone; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetPositionAsyncOpts3" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , aRet = GetLocFunctionOpts3L()) ; if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - - return returnCode; -} + + return returnCode; + } // ----------------------------------------------------------------------------- @@ -1073,158 +1166,182 @@ // class LocUpdateCallBackOpts4 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - LocUpdateCallBackOpts4() :iCount(0) , iRetStatus(KErrGeneral){;} + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + LocUpdateCallBackOpts4(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; - - + + TInt LocUpdateCallBackOpts4 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - User::After(120000000); + { + //User::After(120000000); if(KErrNone == aError) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - - TBuf8<50> buf; - TRealFormat format ; - TInt64 aTime1; - TTime aTimeStamp1; - - aTimeStamp1 = currPos1.Time(); - aTime1 = aTimeStamp1.Int64(); - buf.Num(aTime1 , format) ; - - if(aTime1) - { - OpenFile(); - LogFile.Write(_L8("Time = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")); - CloseFile(); - returnCode = KErrNone; - } + { + TPosition currPos1; + currPos->GetPosition(currPos1); + + TBuf8<50> buf; + TRealFormat format ; + TInt64 aTime1; + TTime aTimeStamp1; + + aTimeStamp1 = currPos1.Time(); + aTime1 = aTimeStamp1.Int64(); + buf.Num(aTime1 , format) ; + + if(aTime1) + { + OpenFile(); + LogFile.Write(_L8("Time = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")); + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\nFailed(No TimeStamp).. ")); + CloseFile(); + returnCode = KErrGeneral; + } + } + else - { - OpenFile(); - LogFile.Write(_L8("\nFailed(No TimeStamp).. ")); - CloseFile(); - returnCode = KErrGeneral; - } - } - - else - { - OpenFile(); - LogFile.Write(_L8("\nFailed(HandleNotifyL error)..")); - CloseFile(); - returnCode = KErrGeneral; - } - - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - return returnCode ; -} + { + OpenFile(); + LogFile.Write(_L8("\nFailed(HandleNotifyL error)..")); + CloseFile(); + returnCode = KErrGeneral; + } + + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + return returnCode ; + } TInt GetLocFunctionOpts4L() -{ + { + __UHEAP_MARK ; TInt ret; TPositionInfo aPosition1; TPosition aPos1; TPositionUpdateOptions aOptions; TTimeIntervalMicroSeconds aTimeOut = 10000000; - TTimeIntervalMicroSeconds aInterval = 6000000; - TBool aAcceptPartialUpdates = EFalse; - + TTimeIntervalMicroSeconds aInterval = 6000000; + TBool aAcceptPartialUpdates = EFalse; + CLocationService *CoreObj = CLocationService ::NewL() ; - + if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(Null CoreObj)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(Null CoreObj)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - LocUpdateCallBackOpts4 MyUpdates ; - + + LocUpdateCallBackOpts4 MyUpdates(30,GETLOCATION) ; + aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aInterval); aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates); - - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - ret = CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ; + + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + TRAP(ret , CoreObj->GetLocationL(&MyUpdates,0,NULL,&aOptions) ); if( KErrNone == ret) - { - CActiveScheduler :: Start() ; - if( KErrNone == returnCode ) - { - CoreObj->GetLocationL(&aPosition1,&aOptions); - aPosition1.GetPosition(aPos1); - - // ValidatePosition(aPos1); - - /*aRequestorStack.Close(); + { + CActiveScheduler :: Start() ; + if( KErrNone == returnCode ) + { + CoreObj->GetLocationL(&aPosition1,&aOptions); + aPosition1.GetPosition(aPos1); + + // ValidatePosition(aPos1); + + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - return returnCode; - } - else - { - /*aRequestorStack.Close(); + delete CoreObj; + __UHEAP_MARKEND ; + return returnCode; + } + else + { + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - return returnCode; - } - } - + delete CoreObj; + __UHEAP_MARKEND ; + return returnCode; + } + } + else - { - /*aRequestorStack.Close(); + { + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - return returnCode; - } -} + delete CoreObj; + __UHEAP_MARKEND ; + return returnCode; + } + } TInt CSAPILocTest::GetPositionAsyncOpts4( CStifItemParser& /*aItem*/ ) - { - + { + TInt aRet = KErrNone; returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetPositionAsyncOpts4" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , aRet = GetLocFunctionOpts4L()) ; if( err ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - - return returnCode; - } + + return returnCode; + } // ----------------------------------------------------------------------------- @@ -1233,91 +1350,92 @@ // TInt GetLocFunctionOpts5L() - { + { TInt ret1,ret2; TPositionInfo aPosition1,aPosition2,aPosition3; TPosition aPos1,aPos2,aPos3; TPositionUpdateOptions aOptions; TTimeIntervalMicroSeconds aTimeOut = 10000000; - TTimeIntervalMicroSeconds aInterval = 6000000; - TBool aAcceptPartialUpdates = ETrue; - + TTimeIntervalMicroSeconds aInterval = 6000000; + TBool aAcceptPartialUpdates = ETrue; + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - LocUpdateCallBackOpts4 MyUpdates1 ; - LocUpdateCallBackOpts4 MyUpdates2 ; - + + LocUpdateCallBackOpts4 MyUpdates1(32,GETLOCATION) ; + LocUpdateCallBackOpts4 MyUpdates2(33,GETLOCATION) ; + aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aInterval); aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates); - - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - - ret1 = CoreObj->GetLocationL(&MyUpdates1) ; - - ret2 = CoreObj->GetLocationL(&MyUpdates2) ; - - if( KErrNone == ret1 && KErrInUse == ret2 ) - { - TBuf8<20> retBuf; - TRealFormat retFormat; - - CActiveScheduler :: Start() ; - - OpenFile(); - LogFile.Write(_L8("\nreturnCode : ")); - LogFile.Write(retBuf); - CloseFile(); - } - + + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + + TRAP(ret1 ,CoreObj->GetLocationL(&MyUpdates1) ); + + TRAP(ret2, CoreObj->GetLocationL(&MyUpdates2)) ; + + if( KErrNone == ret1 && KErrNone == ret2 ) + { + TBuf8<20> retBuf; + TRealFormat retFormat; + + CActiveScheduler :: Start() ; + + OpenFile(); + LogFile.Write(_L8("\nreturnCode : ")); + LogFile.Write(retBuf); + CloseFile(); + } + else - { - returnCode = KErrGeneral; - } + { + returnCode = KErrGeneral; + } //aRequestorStack.Close(); - + delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::GetPositionAsyncOpts5( CStifItemParser& /*aItem*/ ) - { - TInt aRet = KErrNone; - returnCode = KErrNone; - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "GetPositionAsyncOpts5" ); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - + { + TInt aRet = KErrNone; + returnCode = KErrNone; + // Print to UI + _LIT( KSAPILocTest, "SAPILocTest" ); + _LIT( KExample, "GetPositionAsyncOpts5" ); + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + TRAPD(err ,aRet = GetLocFunctionOpts5L()) ; if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; - } + } @@ -1326,94 +1444,96 @@ // ----------------------------------------------------------------------------- // TInt GetLocFunctionOpts6L() - { + { + __UHEAP_MARK ; TInt aRet,aRet1; TPosition aPosition1; TPositionUpdateOptions aOptions; TTimeIntervalMicroSeconds aTimeOut = 60000000; - TTimeIntervalMicroSeconds aInterval = 6000000; - TBool aAcceptPartialUpdates = ETrue; - + TTimeIntervalMicroSeconds aInterval = 6000000; + TBool aAcceptPartialUpdates = ETrue; + CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(Null CoreObj)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(Null CoreObj)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - LocUpdateCallBackOpts2 MyUpdates ; - + + LocUpdateCallBackOpts2 MyUpdates(13,GETLOCATION) ; + aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aInterval); aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates); - - aRet = CoreObj->GetLocationL(&MyUpdates) ; - + + TRAP(aRet , CoreObj->GetLocationL(&MyUpdates) ); + if( KErrNone == aRet ) - { - aRet1 = CoreObj->CancelOnGoingService(0); - if( KErrNone == aRet1 ) - { - TBuf8<20> retBuf; - TRealFormat retFormat; - aRet = CoreObj->GetLocationL(&MyUpdates) ; - if( KErrNone == aRet) - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - CActiveScheduler :: Start() ; - retBuf.Num(returnCode,retFormat); - OpenFile(); - LogFile.Write(_L8("\nreturnCode : ")); - LogFile.Write(retBuf); - CloseFile(); - } - else - { - returnCode = KErrGeneral; - } - } + { + aRet1 = CoreObj->CancelOnGoingService(0); + if( KErrNone == aRet1 ) + { + TBuf8<20> retBuf; + TRealFormat retFormat; + TRAP(aRet ,CoreObj->GetLocationL(&MyUpdates)) ; + if( KErrNone == aRet) + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + CActiveScheduler :: Start() ; + retBuf.Num(returnCode,retFormat); + OpenFile(); + LogFile.Write(_L8("\nreturnCode : ")); + LogFile.Write(retBuf); + CloseFile(); + } + else + { + returnCode = KErrGeneral; + } + } else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + //aRequestorStack.Close(); - - delete CoreObj; + + delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::GetPositionAsyncOpts6( CStifItemParser& /*aItem*/ ) - { + { TInt aRet = KErrNone; returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetPositionAsyncOpts6" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , aRet = GetLocFunctionOpts6L()) ; - + __UHEAP_MARKEND; - + return returnCode; - } + } // ----------------------------------------------------------------------------- @@ -1422,111 +1542,133 @@ // class TraceLCallBack : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBack() :iCount(0) , iRetStatus(KErrGeneral){;} + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBack(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; - - - + + + TInt TraceLCallBack :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { -// User::After(60000000); - if(KErrNone == aError && iCount<2) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - // ValidatePosition(currPos1); - iCount++; - } - else - { - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - // returnCode = KErrNone; - } - return returnCode; - } - + { + // User::After(60000000); + if(KErrNone == aError && iCount<2) + { + TPosition currPos1; + currPos->GetPosition(currPos1); + // ValidatePosition(currPos1); + iCount++; + } + else + { + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + // returnCode = KErrNone; + } + return returnCode; + } + TInt TraceLFunctionL() - { + { + __UHEAP_MARK ; TInt ret; TPosition aPosition1; - + CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - TraceLCallBack MyUpdates ; - - ret = CoreObj->TraceL(&MyUpdates) ; + + TraceLCallBack MyUpdates(14,TRACE) ; + + TRAP(ret, CoreObj->TraceL(&MyUpdates) ); if( KErrNone == ret) - { + { TBuf8<20> retBuf; TRealFormat retFormat; - - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); + + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); CActiveScheduler :: Start() ; - - retBuf.Num(returnCode,retFormat); - OpenFile(); - LogFile.Write(_L8("\nreturnCode : ")); - LogFile.Write(retBuf); - CloseFile(); - } + + retBuf.Num(returnCode,retFormat); + OpenFile(); + LogFile.Write(_L8("\nreturnCode : ")); + LogFile.Write(retBuf); + CloseFile(); + } else - { - returnCode = KErrGeneral; - } - - //aRequestorStack.Close(); - + { + returnCode = KErrGeneral; + } + + //aRequestorStack.Close(); + delete CoreObj; - return 0; - } + __UHEAP_MARKEND ; + return 0; + } TInt CSAPILocTest::TraceLPosition( CStifItemParser& /*aItem*/ ) - { + { TInt aRet = KErrNone; returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err ,aRet = TraceLFunctionL() ) ; - + if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - - return returnCode; - } + + return returnCode; + } // ----------------------------------------------------------------------------- @@ -1534,83 +1676,84 @@ // ----------------------------------------------------------------------------- // TInt TraceLFunction1L() - { + { TInt ret1,ret2; TPosition aPosition1; - + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(Null CoreObj)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(Null CoreObj)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - TraceLCallBack MyUpdates ; - - ret1 = CoreObj->TraceL(&MyUpdates) ; - ret2 = CoreObj->TraceL(&MyUpdates) ; - - if( KErrNone == ret1 && KErrInUse == ret2) - { + + TraceLCallBack MyUpdates(15,TRACE) ; + + TRAP(ret1, CoreObj->TraceL(&MyUpdates)) ; + TRAP(ret2 , CoreObj->TraceL(&MyUpdates) ); + + if( KErrNone == ret1 && KErrNone == ret2) + { TBuf8<20> retBuf; TRealFormat retFormat; - - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - + + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + CActiveScheduler :: Start() ; - - retBuf.Num(returnCode,retFormat); - OpenFile(); - LogFile.Write(_L8("\nreturnCode : ")); - LogFile.Write(retBuf); - CloseFile(); - } - + + retBuf.Num(returnCode,retFormat); + OpenFile(); + LogFile.Write(_L8("\nreturnCode : ")); + LogFile.Write(retBuf); + CloseFile(); + } + else - { - returnCode = KErrGeneral; - } + { + returnCode = KErrGeneral; + } //aRequestorStack.Close(); - + delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::TraceLPosition1( CStifItemParser& /*aItem*/ ) - { - TInt aRet = KErrNone; - returnCode = KErrNone; - + { + TInt aRet = KErrNone; + returnCode = KErrNone; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err ,aRet = TraceLFunction1L()) ; - + if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - - return returnCode; - } + + return returnCode; + } // ----------------------------------------------------------------------------- @@ -1619,146 +1762,167 @@ // class TraceLCallBack2 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; CLocationService *CoreObj; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBack2(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) - { - iCount = count; - iRetStatus = status; - CoreObj = LocObj; - } - }; - - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBack2(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) + { + iRequestType = req; + iCount = count; + iTransactionId = transId; + iRetStatus = status; + CoreObj = LocObj; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + + TInt TraceLCallBack2 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { -// User::After(60000000); - TInt aRet1; - if(KErrNone == aError && iCount<2) - { - TBuf8<20> retBuf; + { + // User::After(60000000); + TInt aRet1; + if(iCount<2) + { + TBuf8<20> retBuf; TRealFormat retFormat; retBuf.Num(aError,retFormat); - - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(retBuf); - CloseFile(); - TPosition currPos1; - currPos->GetPosition(currPos1); - // ValidatePosition(currPos1); - iCount++; - - } - - else - { - aRet1 = CoreObj->CancelOnGoingService(1); - TBuf8<20> retBuf; + + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(retBuf); + CloseFile(); + TPosition currPos1; + currPos->GetPosition(currPos1); + // ValidatePosition(currPos1); + iCount++; + + } + + else + { + aRet1 = CoreObj->CancelOnGoingService(1); + TBuf8<20> retBuf; TRealFormat retFormat; retBuf.Num(aRet1,retFormat); - - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(retBuf); - CloseFile(); - if( KErrNone == aRet1 ) - { - returnCode = KErrNone; - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - } - else - { - returnCode = KErrGeneral; - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - } - - } - return KErrNone; - } + + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(retBuf); + CloseFile(); + if( KErrNone == aRet1 ) + { + returnCode = KErrNone; + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + } + else + { + returnCode = KErrGeneral; + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + } + + } + return KErrNone; + } TInt TraceLFunction2L() - { + { + __UHEAP_MARK ; TInt ret; TPosition aPosition1; - + CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; //not needed any more - - /*RRequestorStack aRequestorStack; + + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - TraceLCallBack2 MyUpdates(CoreObj) ; - - ret = CoreObj->TraceL(&MyUpdates) ; - + + TraceLCallBack2 MyUpdates(16,TRACE,CoreObj) ; + + TRAP(ret,CoreObj->TraceL(&MyUpdates) ); + if( KErrNone == ret) - { + { TBuf8<20> retBuf; TRealFormat retFormat; OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); CActiveScheduler :: Start() ; retBuf.Num(returnCode,retFormat); OpenFile(); LogFile.Write(_L8("\nreturnCode : ")); LogFile.Write(retBuf); CloseFile(); - } + } else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + //aRequestorStack.Close(); - - delete CoreObj; + + delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::TraceLPosition2( CStifItemParser& /*aItem*/ ) - { + { TInt aRet = KErrNone; returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition2" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , aRet = TraceLFunction2L()) ; if( err || aRet ) - returnCode = KErrGeneral; - - __UHEAP_MARKEND; - - return returnCode; - } + returnCode = KErrGeneral; + + __UHEAP_MARKEND; + + return returnCode; + } // ----------------------------------------------------------------------------- @@ -1766,219 +1930,242 @@ // ----------------------------------------------------------------------------- // TInt TraceLFunction3L() - { + { + __UHEAP_MARK ; TInt ret1,ret2,ret3; TPosition aPosition1; - + CLocationService *CoreObj = CLocationService ::NewL() ; if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(Null CoreObj)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(Null CoreObj)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; //not needed any more - - /*RRequestorStack aRequestorStack; + + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - TraceLCallBack MyUpdates ; - - ret1 = CoreObj->TraceL(&MyUpdates) ; - - ret2 = CoreObj->TraceL(&MyUpdates) ; - - if( KErrNone == ret1 && KErrInUse == ret2) - { + + TraceLCallBack MyUpdates(31,TRACE) ; + + TRAP(ret1 , CoreObj->TraceL(&MyUpdates) ); + + // ret2 = CoreObj->TraceL(&MyUpdates) ; + + if( KErrNone == ret1 ) + { ret3 = CoreObj->CancelOnGoingService(1); - + if( KErrNone == ret3 ) { - TBuf8<20> retBuf; - TRealFormat retFormat; - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - ret1 = CoreObj->TraceL(&MyUpdates) ; - if(KErrNone == ret1) - CActiveScheduler :: Start() ; - retBuf.Num(returnCode,retFormat); - OpenFile(); - LogFile.Write(_L8("\nreturnCode : ")); - LogFile.Write(retBuf); - CloseFile(); - } + TBuf8<20> retBuf; + TRealFormat retFormat; + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + TRAP(ret1 , CoreObj->TraceL(&MyUpdates) ); + if(KErrNone == ret1) + CActiveScheduler :: Start() ; + retBuf.Num(returnCode,retFormat); + OpenFile(); + LogFile.Write(_L8("\nreturnCode : ")); + LogFile.Write(retBuf); + CloseFile(); + } else - { - returnCode = KErrGeneral; - } - } - + { + returnCode = KErrGeneral; + } + } + else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + //aRequestorStack.Close(); - + delete CoreObj; - return KErrNone; - } + __UHEAP_MARKEND ; + return KErrNone; + } TInt CSAPILocTest::TraceLPosition3( CStifItemParser& /*aItem*/ ) - { + { TInt aRet = KErrNone; returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition3" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , aRet = TraceLFunction3L()) ; if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; - } + } // ----------------------------------------------------------------------------- // CSAPILocTest::TraceLPosition4 // ----------------------------------------------------------------------------- // class TraceLCallBack4 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; TInt iCallIdentity; + TInt iRequestType; + TInt iTransactionId; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBack4(TInt identity, TInt count = 0 , TInt status = KErrGeneral) - { - iCallIdentity = identity; - iCount = count; - iRetStatus = status; - } + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBack4(TInt transId,TInt req,TInt identity, TInt count = 0 , TInt status = KErrGeneral) + { + iTransactionId = transId; + iRequestType = req; + iCallIdentity = identity; + iCount = count; + iRetStatus = status; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; - - + + TInt TraceLCallBack4 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - if(iCallIdentity == 1 && KErrNone == aError ) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - // ValidatePosition(currPos1); - // returnCode = KErrNone ; - } - else if(KErrNone == aError && iCount<2) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - // ValidatePosition(currPos1); - iCount++; - } - - else if(iCount>=2) - { - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - returnCode = KErrNone; - } - else - { - returnCode = KErrGeneral; - } - - return returnCode; - } - + { + if(iCallIdentity == 1 && KErrNone == aError ) + { + TPosition currPos1; + currPos->GetPosition(currPos1); + // ValidatePosition(currPos1); + // returnCode = KErrNone ; + } + else if(KErrNone == aError && iCount<2) + { + TPosition currPos1; + currPos->GetPosition(currPos1); + // ValidatePosition(currPos1); + iCount++; + } + + else if(iCount>=2) + { + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + returnCode = KErrNone; + } + else + { + returnCode = KErrGeneral; + } + + return returnCode; + } + TInt TraceLFunction4L() - { + { + __UHEAP_MARK ; TInt ret1,ret2; TPosition aPosition1; - + CLocationService *CoreObj = CLocationService ::NewL() ; - - TraceLCallBack4 MyUpdates1(1) ; - - TraceLCallBack4 MyUpdates2(2) ; - + + TraceLCallBack4 MyUpdates1(17,GETLOCATION,1) ; + + TraceLCallBack4 MyUpdates2(18,TRACE,2) ; + _LIT(Kidentity ,"Coreclass Testing" ) ; //not needed any more - - /*RRequestorStack aRequestorStack; + + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - ret1 = CoreObj->GetLocationL(&MyUpdates1) ; - - ret2 = CoreObj->TraceL(&MyUpdates2) ; - - + + TRAP(ret1 , CoreObj->GetLocationL(&MyUpdates1) ); + + TRAP(ret2 , CoreObj->TraceL(&MyUpdates2) ); + + if( KErrNone == ret1 && KErrNone == ret2) - { - TBuf8<50> buf ; - TRealFormat format ; - - OpenFile(); - LogFile.Write(_L8("\n\n")); - CActiveScheduler :: Start() ; - - //Logging returnCode - buf.Num(returnCode , format) ; - LogFile.Write(_L8("returnCode = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } + { + TBuf8<50> buf ; + TRealFormat format ; + + OpenFile(); + LogFile.Write(_L8("\n\n")); + CActiveScheduler :: Start() ; + + //Logging returnCode + buf.Num(returnCode , format) ; + LogFile.Write(_L8("returnCode = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } else - { - returnCode = KErrGeneral; - } + { + returnCode = KErrGeneral; + } //aRequestorStack.Close(); - - delete CoreObj; + + delete CoreObj; + __UHEAP_MARKEND ; return KErrNone; - - } + + } TInt CSAPILocTest::TraceLPosition4( CStifItemParser& /*aItem*/ ) - { + { TInt aRet = KErrNone; returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition4" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err ,aRet = TraceLFunction4L()) ; if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - - return returnCode; - } + + return returnCode; + } // ----------------------------------------------------------------------------- @@ -1987,172 +2174,214 @@ // class CTraceLCallBack5 : public CBase , public MLocationCallBack - { - TInt iCount ; - TInt iRetStatus ; - CLocationService *CoreObj; - CTraceLCallBack5* iSelf; - public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - CTraceLCallBack5(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) - { - iCount = count; - iRetStatus = status; - CoreObj = LocObj; - } - - virtual ~CTraceLCallBack5(); - static CTraceLCallBack5* NewL(CLocationService*) ; - }; - - CTraceLCallBack5* CTraceLCallBack5 :: NewL(CLocationService* obj) - { - CTraceLCallBack5* temp = new(ELeave) CTraceLCallBack5(obj); - temp->iSelf = temp; - return temp; - } - - CTraceLCallBack5 :: ~CTraceLCallBack5() - { - delete (this->CoreObj); - } - -TInt CTraceLCallBack5 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - User::After(30000000); - TInt aRet1; - if(KErrNone == aError && iCount<2) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - ValidatePosition(currPos1); - iCount++; - } - - else - { - aRet1 = CoreObj->CancelOnGoingService(1); - if( KErrNone == aRet1 ) - { - returnCode = KErrNone; - delete this; - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - } - else - { - returnCode = KErrGeneral; - delete this; - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - } - } - - return KErrNone; - } - -class LocUpdateCallBack5 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + CLocationService *CoreObj; + CTraceLCallBack5* iSelf; + TInt iRequestType; + TInt iTransactionId; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - LocUpdateCallBack5() :iCount(0) , iRetStatus(KErrGeneral){;} - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + CTraceLCallBack5(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) + { + iTransactionId = transId; + iRequestType = req; + iCount = count; + iRetStatus = status; + CoreObj = LocObj; + } + + virtual ~CTraceLCallBack5(); + static CTraceLCallBack5* NewL(TInt aTransId,TInt req,CLocationService*) ; + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + +CTraceLCallBack5* CTraceLCallBack5 :: NewL(TInt aTransId,TInt req,CLocationService* obj) + { + CTraceLCallBack5* temp = new(ELeave) CTraceLCallBack5(aTransId,req,obj); + temp->iSelf = temp; + return temp; + } + +CTraceLCallBack5 :: ~CTraceLCallBack5() + { + delete (this->CoreObj); + this->CoreObj = NULL; + } + +TInt CTraceLCallBack5 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) + { + // User::After(30000000); + TInt aRet1; + if(KErrNone == aError && iCount<2) + { + TPosition currPos1; + currPos->GetPosition(currPos1); + ValidatePosition(currPos1); + iCount++; + } + + else + { + aRet1 = CoreObj->CancelOnGoingService(1); + if( KErrNone == aRet1 ) + { + returnCode = KErrNone; + delete this; + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + } + else + { + returnCode = KErrGeneral; + delete this; + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + } + } + + return KErrNone; + } + +class LocUpdateCallBack5 : public MLocationCallBack + { + TInt iCount ; + TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; + public : + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + LocUpdateCallBack5(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + TInt LocUpdateCallBack5 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/) - { - - TInt aRet; - TPosition currPos1; - currPos->GetPosition(currPos1); - aRet = ValidatePosition(currPos1); - - if ( KErrNone == aRet ) - { - TPosition aPosition2; - CLocationService *CoreObj1 = CLocationService ::NewL() ; - - _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + { + + TInt aRet; + TPosition currPos1; + currPos->GetPosition(currPos1); + aRet = ValidatePosition(currPos1); + + if ( KErrNone == aRet ) + { + TPosition aPosition2; + CLocationService *CoreObj1 = CLocationService ::NewL() ; + + _LIT(Kidentity ,"Coreclass Testing" ) ; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/ - - CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(CoreObj1); - - CoreObj1->TraceL(MyUpdates2) ; - - //aRequestorStack.Close(); - - } - return KErrNone ; - } + + CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(18,TRACE,CoreObj1); + + CoreObj1->TraceL(MyUpdates2) ; + + //aRequestorStack.Close(); + + } + return KErrNone ; + } TInt TraceLFunction5L() - { + { + __UHEAP_MARK ; TInt ret1; TPosition aPosition1; CLocationService *CoreObj = CLocationService ::NewL() ; - LocUpdateCallBack5 MyUpdates1 ; - + LocUpdateCallBack5 MyUpdates1(28,GETLOCATION) ; + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - ret1 = CoreObj->GetLocationL(&MyUpdates1) ; - + + TRAP(ret1 ,CoreObj->GetLocationL(&MyUpdates1) ); + if( KErrNone == ret1) - { - TBuf8<20> retBuf; - TRealFormat retFormat; - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - CActiveScheduler :: Start() ; - retBuf.Num(returnCode,retFormat); - OpenFile(); - LogFile.Write(_L8("\nreturn code : ")); - LogFile.Write(retBuf); - CloseFile(); - } + { + TBuf8<20> retBuf; + TRealFormat retFormat; + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + CActiveScheduler :: Start() ; + retBuf.Num(returnCode,retFormat); + OpenFile(); + LogFile.Write(_L8("\nreturn code : ")); + LogFile.Write(retBuf); + CloseFile(); + } else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + //aRequestorStack.Close(); - - delete CoreObj; + + delete CoreObj; + __UHEAP_MARKEND ; return KErrNone; - } + } TInt CSAPILocTest::TraceLPosition5( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition5" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , TraceLFunction5L()) ; if(err) - returnCode = KErrGeneral; - - __UHEAP_MARKEND; - - return returnCode; - } + returnCode = KErrGeneral; + + __UHEAP_MARKEND; + + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::TraceLPosition6 @@ -2160,594 +2389,757 @@ // class CLocUpdateCallBack6 : public CBase , public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; CLocUpdateCallBack6* iSelf; CLocationService *CoreObj; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - CLocUpdateCallBack6(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) - { - iCount = count; - iRetStatus = status; - CoreObj = LocObj; - } - static CLocUpdateCallBack6* NewL(CLocationService* obj); - virtual ~CLocUpdateCallBack6(); - }; - - CLocUpdateCallBack6* CLocUpdateCallBack6 :: NewL(CLocationService* obj) - { - CLocUpdateCallBack6* temp = new(ELeave) CLocUpdateCallBack6(obj); - temp->iSelf = temp; - return temp; - } - - CLocUpdateCallBack6 :: ~CLocUpdateCallBack6() - { - delete (this->CoreObj); - } + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + CLocUpdateCallBack6(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) + { + iCount = count; + iRetStatus = status; + CoreObj = LocObj; + iTransactionId =transId; + iRequestType = req; + } + static CLocUpdateCallBack6* NewL(TInt transid,TInt req,CLocationService* obj); + virtual ~CLocUpdateCallBack6(); + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + + }; + +CLocUpdateCallBack6* CLocUpdateCallBack6 :: NewL(TInt transid,TInt req,CLocationService* obj) + { + CLocUpdateCallBack6* temp = new(ELeave) CLocUpdateCallBack6(transid,req,obj); + temp->iSelf = temp; + return temp; + } + +CLocUpdateCallBack6 :: ~CLocUpdateCallBack6() + { + delete (this->CoreObj); + } TInt CLocUpdateCallBack6 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/) - { - TInt aRet; - TPosition currPos1; - - currPos->GetPosition(currPos1); - - aRet = ValidatePosition(currPos1); - + { + TInt aRet; + TPosition currPos1; + currPos->GetPosition(currPos1); + + aRet = ValidatePosition(currPos1); + if( KErrNone == aRet ) - { - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; + { + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; returnCode = KErrNone; delete this; } else - { - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - returnCode = KErrGeneral; - delete this; - } + { + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + returnCode = KErrGeneral; + delete this; + } + OpenFile(); + LogFile.Write(_L8("CLocUpdateCallBack6 :: Before retrunin to runl")); + LogFile.Write(_L8("\n")) ; + CloseFile(); return KErrNone ; - } - + } + class TraceLCallBack6 : public MLocationCallBack - { - TInt iCount ; + { + TInt iCount ; TInt iRetStatus ; CLocationService *CoreObj; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBack6(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) - { - iCount = count; - iRetStatus = status; - CoreObj = LocObj; - } - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBack6(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) + { + iTransactionId = transId; + iRequestType = req; + iCount = count; + iRetStatus = status; + CoreObj = LocObj; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + + + + }; + + TInt TraceLCallBack6 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - TInt aRet1; - if(KErrNone == aError && iCount<1) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - ValidatePosition(currPos1); - iCount++; - } - - else - { - aRet1 = CoreObj->CancelOnGoingService(1); - - if( KErrNone == aRet1 ) - { - TPosition aPosition2; - CLocationService *CoreObj1 = CLocationService ::NewL() ; - - _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + { + TInt aRet1; + if(KErrNone == aError && iCount<1) + { + TPosition currPos1; + currPos->GetPosition(currPos1); + ValidatePosition(currPos1); + iCount++; + } + + else + { + aRet1 = CoreObj->CancelOnGoingService(1); + + if( KErrNone == aRet1 ) + { + TPosition aPosition2; + CLocationService *CoreObj1 = CLocationService ::NewL() ; + + _LIT(Kidentity ,"Coreclass Testing" ) ; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/ - - CLocUpdateCallBack6 *MyUpdates1 = CLocUpdateCallBack6 :: NewL(CoreObj1); - - CoreObj1->GetLocationL(MyUpdates1) ; - - //aRequestorStack.Close(); - - - returnCode = KErrNone; - } - else - { - returnCode = KErrGeneral; - } - } - return KErrNone; - } - - + + CLocUpdateCallBack6 *MyUpdates1 = CLocUpdateCallBack6 :: NewL(26,GETLOCATION,CoreObj1); + + CoreObj1->GetLocationL(MyUpdates1) ; + + //aRequestorStack.Close(); + + + returnCode = KErrNone; + } + else + { + returnCode = KErrGeneral; + } + } + return KErrNone; + } + + TInt TraceLFunction6L() - { + { + __UHEAP_MARK; + + CActiveScheduler *Scheduler = new CActiveScheduler ; + + CActiveScheduler :: Install(Scheduler) ; TInt ret1; TPosition aPosition1; CLocationService *CoreObj = CLocationService ::NewL() ; - TraceLCallBack6 MyUpdates2(CoreObj) ; - + TraceLCallBack6 MyUpdates2(36,TRACE,CoreObj) ; + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - ret1 = CoreObj->TraceL(&MyUpdates2) ; - + TPositionUpdateOptions updateOpts; + updateOpts.SetUpdateInterval(5000000); + + TRAP(ret1 , CoreObj->TraceL(&MyUpdates2,0,NULL,&updateOpts) ); + if( KErrNone == ret1) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - CActiveScheduler :: Start() ; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + CActiveScheduler :: Start() ; + } else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + //aRequestorStack.Close(); - + delete CoreObj; - return KErrNone; - } + delete Scheduler ; + __UHEAP_MARKEND; + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + return KErrNone; + } TInt CSAPILocTest::TraceLPosition6( CStifItemParser& /*aItem*/ ) - { + { + + _LIT(KTLocTest ,"TLocTest"); + iLog->Log(KTLocTest) ; + + TRequestStatus Status = KRequestPending ; + RThread FunctionThread ; + + FunctionThread.Create(_L("GetLocationAsynch Thread") , TraceLPosition6T ,KDefaultStackSize , + KMinHeapSize , KDefaultStackSize ,(TAny *) NULL); + + FunctionThread.Logon(Status) ; + FunctionThread.Resume() ; + + User :: WaitForRequest (Status) ; + FunctionThread.Close(); + + return Status.Int() ; + } + +TInt TraceLPosition6T( TAny */*Arg*/) + { returnCode = KErrNone; - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "TraceLPosition6" ); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - TRAPD(err , TraceLFunction6L()) ; - if(err) - returnCode = KErrGeneral; - - __UHEAP_MARKEND; - - return returnCode; - } - - + + TInt err = KErrNone; + + CTrapCleanup* cleanup = CTrapCleanup::New(); + TRAP(err , TraceLFunction6L()) ; + if(err) + { + + returnCode = KErrGeneral; + } + //TInt alloc1 = User::CountAllocCells(); + + + delete cleanup ; + return returnCode; + } + + // ----------------------------------------------------------------------------- // CSAPILocTest::TraceLPosition7 // ----------------------------------------------------------------------------- // - + class TraceLCallBack7 : public MLocationCallBack - { - TInt iCount ; + { + TInt iCount ; TInt iRetStatus ; CLocationService *CoreObj; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBack7(CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) - { - iCount = count; - iRetStatus = status; - CoreObj = LocObj; - } - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBack7(TInt transId,TInt req,CLocationService* LocObj,TInt count = 0,TInt status = KErrGeneral) + { + iTransactionId= transId; + iRequestType = req; + iCount = count; + iRetStatus = status; + CoreObj = LocObj; + } + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + TInt TraceLCallBack7 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - User::After(30000000); - TInt aRet1; - if(KErrNone == aError && iCount<2) - { - TPosition currPos1; - currPos->GetPosition(currPos1); - // ValidatePosition(currPos1); - iCount++; - } - - else - { - aRet1 = CoreObj->CancelOnGoingService(1); - if( KErrNone == aRet1 ) - { - TPosition aPosition2; - CLocationService *CoreObj1 = CLocationService ::NewL() ; - - _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + { + //User::After(30000000); + TInt aRet1; + if(KErrNone == aError && iCount<2) + { + TPosition currPos1; + currPos->GetPosition(currPos1); + // ValidatePosition(currPos1); + iCount++; + } + + else + { + aRet1 = CoreObj->CancelOnGoingService(1); + if( KErrNone == aRet1 ) + { + TPosition aPosition2; + CLocationService *CoreObj1 = CLocationService ::NewL() ; + + _LIT(Kidentity ,"Coreclass Testing" ) ; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/ - - CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(CoreObj1); - - CoreObj1->TraceL(MyUpdates2) ; - - User::After(30000000) ; - //aRequestorStack.Close(); - - - returnCode = KErrNone; - } - else - { - returnCode = KErrGeneral; - } - } - return KErrNone; - } - - + + CTraceLCallBack5 *MyUpdates2 = CTraceLCallBack5::NewL(19,TRACE,CoreObj1); + + CoreObj1->TraceL(MyUpdates2) ; + + // User::After(30000000) ; + //aRequestorStack.Close(); + + + returnCode = KErrNone; + } + else + { + returnCode = KErrGeneral; + } + } + return KErrNone; + } + + TInt TraceLFunction7L() - { + { + __UHEAP_MARK ; TInt ret1; TPosition aPosition1; CLocationService *CoreObj = CLocationService ::NewL() ; - + _LIT(Kidentity ,"Coreclass Testing" ) ; //not needed any more - - /*RRequestorStack aRequestorStack; + + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - TraceLCallBack7 MyUpdates1(CoreObj) ; - - ret1 = CoreObj->TraceL(&MyUpdates1) ; - + + TraceLCallBack7 MyUpdates1(20,TRACE,CoreObj) ; + + TRAP(ret1 , CoreObj->TraceL(&MyUpdates1) ); + if( KErrNone == ret1) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - CActiveScheduler :: Start() ; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + CActiveScheduler :: Start() ; + } else - { - returnCode = KErrGeneral; - } - - //aRequestorStack.Close(); - - delete CoreObj; - return KErrNone; - } + { + returnCode = KErrGeneral; + } + + //aRequestorStack.Close(); + + delete CoreObj; + __UHEAP_MARKEND ; + return KErrNone; + } TInt CSAPILocTest::TraceLPosition7( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition7" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - TRAPD(err , TraceLFunction7L()) ; - if(err) - returnCode = KErrGeneral; - - __UHEAP_MARKEND; - - return returnCode; - } + + __UHEAP_MARK; + + TRAPD(err , TraceLFunction7L()) ; + if(err) + returnCode = KErrGeneral; + + __UHEAP_MARKEND; + + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::TraceLPosition8 // ----------------------------------------------------------------------------- // - + class LocUpdateCallBack8 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iRequestType; + TInt iTransactionId; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - LocUpdateCallBack8() :iCount(0) , iRetStatus(KErrGeneral){;} - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + LocUpdateCallBack8(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + TInt LocUpdateCallBack8 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt /*aError*/) - { - - TInt aRet; - TPosition currPos1; - currPos->GetPosition(currPos1); - aRet = ValidatePosition(currPos1); - if ( KErrNone == aRet) - { - TPosition aPosition2; - CLocationService *CoreObj1 = CLocationService ::NewL() ; - - _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + { + + TInt aRet; + TPosition currPos1; + currPos->GetPosition(currPos1); + aRet = ValidatePosition(currPos1); + if ( KErrNone == aRet) + { + TPosition aPosition2; + CLocationService *CoreObj1 = CLocationService ::NewL() ; + + _LIT(Kidentity ,"Coreclass Testing" ) ; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; - + aRequestorStack.Insert(identityInfo,0); - + CoreObj1->SetRequestorIdentityL(aRequestorStack) ;*/ - - CLocUpdateCallBack6 *MyUpdates2 = CLocUpdateCallBack6 :: NewL(CoreObj1); - - CoreObj1->GetLocationL(MyUpdates2) ; - - /*aRequestorStack.Close(); + + CLocUpdateCallBack6 *MyUpdates2 = CLocUpdateCallBack6 :: NewL(27,GETLOCATION,CoreObj1); + + CoreObj1->GetLocationL(MyUpdates2) ; + + /*aRequestorStack.Close(); delete identityInfo;*/ - } - return KErrNone ; - } + } + return KErrNone ; + } TInt TraceLFunction8L() - { + { + __UHEAP_MARK ; TInt ret1; TPosition aPosition1; CLocationService *CoreObj = CLocationService ::NewL() ; - LocUpdateCallBack8 MyUpdates1 ; - + LocUpdateCallBack8 MyUpdates1(21,GETLOCATION) ; + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - ret1 = CoreObj->GetLocationL(&MyUpdates1) ; - + TPositionUpdateOptions updateOpts; + updateOpts.SetUpdateInterval(5000000); + + TRAP(ret1 , CoreObj->GetLocationL(&MyUpdates1,0,NULL,&updateOpts) ); + if( KErrNone == ret1) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - CActiveScheduler :: Start() ; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + CActiveScheduler :: Start() ; + } else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; - + __UHEAP_MARKEND ; return KErrNone; - } + } TInt CSAPILocTest::TraceLPosition8( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPosition8" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - + + __UHEAP_MARK; - + TRAPD(err , TraceLFunction8L()) ; if(err) - returnCode = KErrGeneral; - - __UHEAP_MARKEND; - - return returnCode; - } - - + returnCode = KErrGeneral; + + __UHEAP_MARKEND; + + return returnCode; + } + + // ----------------------------------------------------------------------------- // CSAPILocTest::TraceLPositionOpts // ----------------------------------------------------------------------------- // class TraceLCallBackTO : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBackTO() :iCount(0) , iRetStatus(KErrGeneral){;} + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBackTO(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } }; - + TInt TraceLCallBackTO :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt aError) - { - if(KErrTimedOut == aError) - { - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - OpenFile(); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - return KErrNone ; - } + { + if(KErrTimedOut == aError) + { + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + OpenFile(); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + return KErrNone ; + } else - { - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - OpenFile(); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - return KErrNone; - } - } + { + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + OpenFile(); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + return KErrNone; + } + } TInt TraceLFunctionOptsL() - { + { + __UHEAP_MARK ; TInt ret1; TPosition aPosition1; TPositionUpdateOptions aOptions; TTimeIntervalMicroSeconds aTimeOut = 10; CLocationService *CoreObj = CLocationService ::NewL() ; - + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + aOptions.SetUpdateTimeOut(aTimeOut); - - TraceLCallBackTO MyUpdates; - - ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ; - + + TraceLCallBackTO MyUpdates(22,TRACE); + + TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ); + if( KErrNone == ret1) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - CActiveScheduler::Start(); - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + CActiveScheduler::Start(); + } + else - { - returnCode = KErrGeneral; - } + { + returnCode = KErrGeneral; + } /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::TraceLPositionOpts( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPositionOpts" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - + + __UHEAP_MARK; + TRAPD(err , TraceLFunctionOptsL()) ; if(err) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; - } + } // ----------------------------------------------------------------------------- // CSAPILocTest::TraceLPositionOpts1 // ----------------------------------------------------------------------------- // class TraceLCallBackOpts1 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; CLocationService *CoreObj; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBackOpts1(TInt count = 0,TInt status = KErrGeneral) - { - iCount = count; - iRetStatus = status; - } - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBackOpts1(TInt transId,TInt req,TInt count = 0,TInt status = KErrGeneral) + { + iRequestType = req; + iTransactionId = transId; + iCount = count; + iRetStatus = status; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + TInt TraceLCallBackOpts1 :: HandleNotifyL(HPositionGenericInfo* /*currPos*/ , TInt /*aError*/){return 0;} TInt TraceLFunctionOpts1L() - { + { TInt ret1; TPosition aPosition1; TPositionUpdateOptions aOptions; TTimeIntervalMicroSeconds aTimeOut = 10000000; TTimeIntervalMicroSeconds aTimeInterval = 30000000; - + CLocationService *CoreObj = CLocationService ::NewL() ; - + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aTimeInterval); - - TraceLCallBackOpts1 MyUpdates; - - ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ; - + + TraceLCallBackOpts1 MyUpdates(23,TRACE); + + TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ); + if( KErrArgument == ret1) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed\n")); - CloseFile(); - returnCode = KErrNone; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed\n")); + CloseFile(); + returnCode = KErrNone; + } + else - { - returnCode = KErrGeneral; - } - - /*aRequestorStack.Close(); + { + returnCode = KErrGeneral; + } + + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; return 0; - } + } TInt CSAPILocTest::TraceLPositionOpts1( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPositionOpts1" ); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + TRAPD(err , TraceLFunctionOpts1L()) ; if(err) - returnCode = KErrGeneral; - - __UHEAP_MARKEND; - + returnCode = KErrGeneral; + + __UHEAP_MARKEND; + return returnCode; - } + } // ----------------------------------------------------------------------------- @@ -2755,7 +3147,8 @@ // ----------------------------------------------------------------------------- // TInt TraceLFunctionOpts2L() - { + { + __UHEAP_MARK ; TInt ret1; TPosition aPosition1; TPositionUpdateOptions aOptions; @@ -2763,121 +3156,143 @@ TTimeIntervalMicroSeconds aTimeInterval = 30000000; TTimeIntervalMicroSeconds aInterval; TTime start,end; - + CLocationService *CoreObj = CLocationService ::NewL() ; //not needed any more /*_LIT(Kidentity ,"Coreclass Testing" ) ; RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aTimeInterval); - - TraceLCallBack MyUpdates; - - ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ; - + + TraceLCallBack MyUpdates(34,TRACE); + + TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ); + if( KErrNone == ret1) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - start.HomeTime(); - CActiveScheduler::Start(); - end.HomeTime(); - aInterval = end.MicroSecondsFrom(start); -// if(aInterval<150000000) -// returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + CloseFile(); + start.HomeTime(); + CActiveScheduler::Start(); + end.HomeTime(); + aInterval = end.MicroSecondsFrom(start); + // if(aInterval<150000000) + // returnCode = KErrGeneral; + } + else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::TraceLPositionOpts2( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPositionOpts2" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , TraceLFunctionOpts2L()) ; if(err) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; - } + } // ----------------------------------------------------------------------------- // CSAPILocTest::TraceLPositionOpts3 // ----------------------------------------------------------------------------- // class TraceLCallBackOpts3 : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - TraceLCallBackOpts3() :iCount(0) , iRetStatus(KErrGeneral){;} - }; - - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + TraceLCallBackOpts3(TInt transId,TInt req) :iCount(0) , iRetStatus(KErrGeneral){+ + iTransactionId = transId; + iRequestType = req; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + + TInt TraceLCallBackOpts3 :: HandleNotifyL(HPositionGenericInfo* currPos , TInt aError) - { - TTime timeStamp; - TInt64 timeInt; - TBuf8<50> buf ; - TRealFormat format ; - if(KErrNone == aError && iCount<2) - { - User::After(60000000); - TPosition currPos1; - currPos->GetPosition(currPos1); - timeStamp = currPos1.Time(); + { + TTime timeStamp; + TInt64 timeInt; + TBuf8<50> buf ; + TRealFormat format ; + if(KErrNone == aError && iCount<2) + { + //User::After(60000000); + TPosition currPos1; + currPos->GetPosition(currPos1); + timeStamp = currPos1.Time(); timeInt = timeStamp.Int64(); if(timeInt) - { + { OpenFile(); - buf.Num(timeInt , format) ; - LogFile.Write(_L8("\nTimestamp = ")); - LogFile.Write(buf) ; - CloseFile(); - returnCode = KErrNone; - } + buf.Num(timeInt , format) ; + LogFile.Write(_L8("\nTimestamp = ")); + LogFile.Write(buf) ; + CloseFile(); + returnCode = KErrNone; + } else - { - returnCode = KErrGeneral; - return 0; - } - iCount++; - } - - else - { - CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - } - return 0; - } + { + returnCode = KErrGeneral; + return 0; + } + iCount++; + } + + else + { + CActiveScheduler *Current = CActiveScheduler :: Current() ; + Current->Stop() ; + } + return 0; + } TInt TraceLFunctionOpts3L() - { + { + __UHEAP_MARK ; TInt ret1; TPosition aPosition1; TPositionUpdateOptions aOptions; @@ -2885,479 +3300,484 @@ TTimeIntervalMicroSeconds aTimeInterval = 5000000; TTimeIntervalMicroSeconds aInterval; TTime start,end; - TBool aAcceptPartialUpdates = ETrue; - + TBool aAcceptPartialUpdates = ETrue; + CLocationService *CoreObj = CLocationService ::NewL() ; - + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + aOptions.SetUpdateTimeOut(aTimeOut); aOptions.SetUpdateInterval(aTimeInterval); aOptions.SetAcceptPartialUpdates(aAcceptPartialUpdates); - - TraceLCallBackOpts3 MyUpdates; - - ret1 = CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ; - + + TraceLCallBackOpts3 MyUpdates(24,TRACE); + + TRAP(ret1 , CoreObj->TraceL(&MyUpdates,0,NULL,&aOptions) ); + if( KErrNone == ret1) - { + { TBuf8<20> retBuf; TRealFormat retFormat; OpenFile(); - LogFile.Write(_L8("\n\n")); - CloseFile(); - - start.HomeTime(); - CActiveScheduler::Start(); - end.HomeTime(); - aInterval = end.MicroSecondsFrom(start); - // if(aInterval<150000000) - // returnCode = KErrGeneral; + LogFile.Write(_L8("\n\n")); + CloseFile(); + + start.HomeTime(); + CActiveScheduler::Start(); + end.HomeTime(); + aInterval = end.MicroSecondsFrom(start); + // if(aInterval<150000000) + // returnCode = KErrGeneral; retBuf.Num(returnCode,retFormat); OpenFile(); LogFile.Write(_L8("\nreturnCode : ")); LogFile.Write(retBuf); CloseFile(); - } - + } + else - { - returnCode = KErrGeneral; - } + { + returnCode = KErrGeneral; + } /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::TraceLPositionOpts3( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "TraceLPositionOpts3" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - TRAPD(err , TraceLFunctionOpts3L()) ; - - if(err) - returnCode = KErrGeneral; - - __UHEAP_MARKEND; - - return returnCode; - } + + __UHEAP_MARK; + + TRAPD(err , TraceLFunctionOpts3L()) ; + + if(err) + returnCode = KErrGeneral; + + __UHEAP_MARKEND; + + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::CancelService1 // ----------------------------------------------------------------------------- // TInt CancelFunction1L() - { + { + __UHEAP_MARK ; TInt ret1,ret2; CLocationService *CoreObj = CLocationService ::NewL() ; - + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + ret1 = CoreObj->CancelOnGoingService(0) ; - + ret2 = CoreObj->CancelOnGoingService(1) ; - + if( KErrNotFound == ret1 && KErrNotFound == ret2 ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::CancelService1( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "CancelService1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + TRAPD(err , CancelFunction1L()) ; if(err) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; - } + } // ----------------------------------------------------------------------------- // CSAPILocTest::CancelService2 // ----------------------------------------------------------------------------- // TInt CancelFunction2L() - { + { + __UHEAP_MARK ; TInt ret1,ret2; CLocationService *CoreObj = CLocationService ::NewL() ; - + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + ret1 = CoreObj->CancelOnGoingService(4) ; - + ret2 = CoreObj->CancelOnGoingService(6) ; - + if( KErrArgument == ret1 && KErrArgument == ret2 ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + else - { - returnCode = KErrGeneral; - } - + { + returnCode = KErrGeneral; + } + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::CancelService2( CStifItemParser& /*aItem*/ ) - { + { returnCode = KErrNone; - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "CancelService2" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); __UHEAP_MARK; - + TRAPD(err , CancelFunction2L()) ; if(err) - returnCode = KErrGeneral; + returnCode = KErrGeneral; __UHEAP_MARKEND; - - return returnCode; - } + + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::GetTime // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetTime( CStifItemParser& /*aItem*/ ) - { - TInt ret; - TPositionInfo currPos; - TPosition currPos1; - TTime currPosTime; - TDateTime currPosDateTime; - TBuf8<50> buf ; - TRealFormat format ; - returnCode = KErrNone; - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "GetTime" ); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - CLocationService *CoreObj = CLocationService :: NewL(); - - if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + TInt ret; + TPositionInfo currPos; + TPosition currPos1; + TTime currPosTime; + TDateTime currPosDateTime; + TBuf8<50> buf ; + TRealFormat format ; + returnCode = KErrNone; + // Print to UI + _LIT( KSAPILocTest, "SAPILocTest" ); + _LIT( KExample, "GetTime" ); + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + + CLocationService *CoreObj = CLocationService :: NewL(); + + if( NULL == CoreObj) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - ret = CoreObj->GetLocationL(&currPos); - - if(KErrNone == ret) - { - currPos.GetPosition(currPos1); - currPosTime = currPos1.Time(); - currPosDateTime = currPosTime.DateTime(); - - TInt aDay = currPosDateTime.Day(); - TInt aHour = currPosDateTime.Hour(); - TInt aMicroSecond = currPosDateTime.MicroSecond(); - TInt aMinute = currPosDateTime.Minute(); - TInt aMonth = currPosDateTime.Month(); - TInt aSecond = currPosDateTime.Second(); - TInt aYear = currPosDateTime.Year(); - TReal32 aVerAcc = currPos1.VerticalAccuracy(); - TReal32 aHorAcc = currPos1.HorizontalAccuracy(); - - OpenFile(); - - LogFile.Write(_L8("\n \n")); - buf.Num(aHorAcc,format); - LogFile.Write(_L8("Horizontal Acc = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - - buf.Num(aVerAcc,format); - LogFile.Write(_L8("Vertical Acc = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - - buf.Num(aDay , format) ; - LogFile.Write(_L8("Time = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("-")) ; - - buf.Num(aMonth , format) ; - LogFile.Write(buf) ; - LogFile.Write(_L8("-")) ; - - buf.Num(aYear , format) ; - LogFile.Write(buf) ; - LogFile.Write(_L8(" ")) ; - - buf.Num(aHour , format) ; - LogFile.Write(buf) ; - LogFile.Write(_L8(":")) ; - - buf.Num(aMinute , format) ; - LogFile.Write(buf) ; - LogFile.Write(_L8(":")) ; - - buf.Num(aSecond , format) ; - LogFile.Write(buf) ; - LogFile.Write(_L8(":")) ; - - buf.Num(aMicroSecond , format) ; - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - - ValidatePosition(currPos1); - } - else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - /*aRequestorStack.Close(); + + TRAP(ret , CoreObj->GetLocationL(&currPos)); + + if(KErrNone == ret) + { + currPos.GetPosition(currPos1); + currPosTime = currPos1.Time(); + currPosDateTime = currPosTime.DateTime(); + + TInt aDay = currPosDateTime.Day(); + TInt aHour = currPosDateTime.Hour(); + TInt aMicroSecond = currPosDateTime.MicroSecond(); + TInt aMinute = currPosDateTime.Minute(); + TInt aMonth = currPosDateTime.Month(); + TInt aSecond = currPosDateTime.Second(); + TInt aYear = currPosDateTime.Year(); + TReal32 aVerAcc = currPos1.VerticalAccuracy(); + TReal32 aHorAcc = currPos1.HorizontalAccuracy(); + + OpenFile(); + + LogFile.Write(_L8("\n \n")); + buf.Num(aHorAcc,format); + LogFile.Write(_L8("Horizontal Acc = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + + buf.Num(aVerAcc,format); + LogFile.Write(_L8("Vertical Acc = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + + buf.Num(aDay , format) ; + LogFile.Write(_L8("Time = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("-")) ; + + buf.Num(aMonth , format) ; + LogFile.Write(buf) ; + LogFile.Write(_L8("-")) ; + + buf.Num(aYear , format) ; + LogFile.Write(buf) ; + LogFile.Write(_L8(" ")) ; + + buf.Num(aHour , format) ; + LogFile.Write(buf) ; + LogFile.Write(_L8(":")) ; + + buf.Num(aMinute , format) ; + LogFile.Write(buf) ; + LogFile.Write(_L8(":")) ; + + buf.Num(aSecond , format) ; + LogFile.Write(buf) ; + LogFile.Write(_L8(":")) ; + + buf.Num(aMicroSecond , format) ; + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + + ValidatePosition(currPos1); + } + else + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - - __UHEAP_MARKEND; - - return returnCode; - } - - - + delete CoreObj; + + __UHEAP_MARKEND; + + return returnCode; + } + + + // ----------------------------------------------------------------------------- // CSAPILocTest::GetSpeed // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetSpeed( CStifItemParser& /*aItem*/ ) { - TInt ret; - TPositionInfo currPos; - TPosition currPos1,fromPos; - TTime currPosTime; - TTime fromPosTime; - TDateTime currPosDateTime; - TReal64 aLatitude1 = 8; - TReal64 aLongitude1 = 70; - TReal32 aAltitude1 = 700; - TReal32 aSpeed; - fromPosTime = 63342890700000000; - - fromPos.SetCoordinate(aLatitude1,aLongitude1,aAltitude1); - fromPos.SetTime(fromPosTime); - - returnCode =KErrNone; - + TInt ret; + TPositionInfo currPos; + TPosition currPos1,fromPos; + TTime currPosTime; + TTime fromPosTime; + TDateTime currPosDateTime; + TReal64 aLatitude1 = 8; + TReal64 aLongitude1 = 70; + TReal32 aAltitude1 = 700; + TReal32 aSpeed; + fromPosTime = 63342890700000000; + + fromPos.SetCoordinate(aLatitude1,aLongitude1,aAltitude1); + fromPos.SetTime(fromPosTime); + + returnCode =KErrNone; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetSpeed" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(CoreObj creation)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(CoreObj creation)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } //not needed any more /*_LIT(Kidentity ,"Coreclass Testing" ) ; RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - User::After(120000000); - ret = CoreObj->GetLocationL(&currPos); - + + // User::After(120000000); + TRAP(ret , CoreObj->GetLocationL(&currPos)); + if(KErrNone == ret) - { - currPos.GetPosition(currPos1); - currPos1.Speed(fromPos,aSpeed); - - OpenFile(); - TBuf8<50> buf ; - TRealFormat format ; - LogFile.Write(_L8("\n \n")); - buf.Num(aSpeed , format) ; - LogFile.Write(_L8("Speed = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - ValidatePosition(currPos1); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(getloc error)..\n")); - - TBuf8<50> buf ; - TRealFormat format ; - LogFile.Write(_L8("\n \n")); - buf.Num(ret , format) ; - LogFile.Write(buf); - CloseFile(); - returnCode = KErrGeneral; - - } - + { + currPos.GetPosition(currPos1); + currPos1.Speed(fromPos,aSpeed); + + OpenFile(); + TBuf8<50> buf ; + TRealFormat format ; + LogFile.Write(_L8("\n \n")); + buf.Num(aSpeed , format) ; + LogFile.Write(_L8("Speed = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + ValidatePosition(currPos1); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(getloc error)..\n")); + + TBuf8<50> buf ; + TRealFormat format ; + LogFile.Write(_L8("\n \n")); + buf.Num(ret , format) ; + LogFile.Write(buf); + CloseFile(); + returnCode = KErrGeneral; + + } + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; + delete CoreObj; __UHEAP_MARKEND; - + return returnCode; } - - + + // ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionOpts // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetPositionOpts( CStifItemParser& /*aItem*/ ) - { - TInt ret; - TPositionInfo currPos; - TPosition currPos1; - TPositionUpdateOptions aOptions; - TTimeIntervalMicroSeconds aTimeOut = 100; - returnCode = KErrNone; - - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "GetPositionOpts" ); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - CLocationService *CoreObj = CLocationService :: NewL(); - - if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - //not needed any more + { + TInt ret; + TPositionInfo currPos; + TPosition currPos1; + TPositionUpdateOptions aOptions; + TTimeIntervalMicroSeconds aTimeOut = 100; + returnCode = KErrNone; + + // Print to UI + _LIT( KSAPILocTest, "SAPILocTest" ); + _LIT( KExample, "GetPositionOpts" ); + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + + CLocationService *CoreObj = CLocationService :: NewL(); + + if( NULL == CoreObj) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + //not needed any more /*_LIT(Kidentity ,"Coreclass Testing" ) ; RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - aOptions.SetUpdateTimeOut(aTimeOut); - - ret = CoreObj->GetLocationL(&currPos,&aOptions); - - if(KErrTimedOut==ret) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - /*aRequestorStack.Close(); + + aOptions.SetUpdateTimeOut(aTimeOut); + + TRAP(ret , CoreObj->GetLocationL(&currPos,&aOptions)); + + if(KErrTimedOut==ret) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; - - __UHEAP_MARKEND; - - return returnCode; - - } - + + __UHEAP_MARKEND; + + return returnCode; + + } + // ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionOpts1 @@ -3370,450 +3790,445 @@ TPositionUpdateOptions options; TTimeIntervalMicroSeconds aTimeOut = 0; returnCode = KErrNone; - + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetPositionOpts1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ; - + options.SetUpdateTimeOut(aTimeOut); - + ret = CoreObj->GetLocationL(&currPos,&options);*/ - + if(KErrTimedOut==ret) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(timed out)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(timed out)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; - __UHEAP_MARKEND; - - return returnCode; - } - - - // ----------------------------------------------------------------------------- + __UHEAP_MARKEND; + + return returnCode; + } + + +// ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionOpts2 // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetPositionOpts2( CStifItemParser& /*aItem*/ ) - { - TInt ret1,ret2; - TPositionInfo currPos1,currPos2; - TPosition cPos1,cPos2; - TPositionUpdateOptions options; -// TTimeIntervalMicroSeconds aTimeOut = 0; -// TTimeIntervalMicroSeconds aInterval = 30000000; - TTimeIntervalMicroSeconds aActualInterval; - TTime start; - TTime end; - TInt64 aActualInt; - returnCode = KErrNone; - - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "GetPostionOpts2" ); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - CLocationService *CoreObj = CLocationService :: NewL(); - - if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + TInt ret1,ret2; + TPositionInfo currPos1,currPos2; + TPosition cPos1,cPos2; + TPositionUpdateOptions options; + // TTimeIntervalMicroSeconds aTimeOut = 0; + // TTimeIntervalMicroSeconds aInterval = 30000000; + TTimeIntervalMicroSeconds aActualInterval; + TTime start; + TTime end; + TInt64 aActualInt; + returnCode = KErrNone; + + // Print to UI + _LIT( KSAPILocTest, "SAPILocTest" ); + _LIT( KExample, "GetPostionOpts2" ); + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + + CLocationService *CoreObj = CLocationService :: NewL(); + + if( NULL == CoreObj) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - // options.SetUpdateTimeOut(aTimeOut); - - // options.SetUpdateInterval(aInterval); - - User::After(120000000); - ret1 = CoreObj->GetLocationL(&currPos1/*,&options*/); - - - + + // options.SetUpdateTimeOut(aTimeOut); + + // options.SetUpdateInterval(aInterval); + + //User::After(120000000); + TRAP(ret1 , CoreObj->GetLocationL(&currPos1/*,&options*/)); + + + if( (KErrNone != ret1)) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(coreobj 1)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(coreobj 1)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } else - { - - start.HomeTime(); - ret2 = CoreObj->GetLocationL(&currPos2/*,&options*/); - end.HomeTime(); - - aActualInterval=end.MicroSecondsFrom(start); - aActualInt = aActualInterval.Int64(); - if(KErrNone == ret2) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format ; - LogFile.Write(_L8("\n\n")); - buf.Num(aActualInt, format) ; - LogFile.Write(_L8("TimeTaken = ")); - LogFile.Write(buf) ; - CloseFile(); - currPos1.GetPosition(cPos1); - currPos2.GetPosition(cPos2); - ValidatePosition(cPos1); - ValidatePosition(cPos2); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(coreObj 2)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - } - + { + + start.HomeTime(); + TRAP(ret2 , CoreObj->GetLocationL(&currPos2/*,&options*/)); + end.HomeTime(); + + aActualInterval=end.MicroSecondsFrom(start); + aActualInt = aActualInterval.Int64(); + if(KErrNone == ret2) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format ; + LogFile.Write(_L8("\n\n")); + buf.Num(aActualInt, format) ; + LogFile.Write(_L8("TimeTaken = ")); + LogFile.Write(buf) ; + CloseFile(); + currPos1.GetPosition(cPos1); + currPos2.GetPosition(cPos2); + ValidatePosition(cPos1); + ValidatePosition(cPos2); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(coreObj 2)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + } + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; __UHEAP_MARKEND; - + return returnCode; - } - - + } + + // ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionOpts3 // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetPositionOpts3( CStifItemParser& /*aItem*/ ) - { - TInt ret1,ret2,ret3; - TPositionInfo currPos1,currPos2,currPos3; - TPosition cPos1,cPos2,cPos3; - TPositionUpdateOptions options; - TTimeIntervalMicroSeconds aTimeOut = 30000000; - TTimeIntervalMicroSeconds aInterval = 120000000; - TTimeIntervalMicroSeconds aActualInterval; - returnCode = KErrNone; - - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "GetPostionOpts3"); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; + { + TInt ret1,ret2,ret3; + TPositionInfo currPos1,currPos2,currPos3; + TPosition cPos1,cPos2,cPos3; + TPositionUpdateOptions options; + TTimeIntervalMicroSeconds aTimeOut = 30000000; + TTimeIntervalMicroSeconds aInterval = 120000000; + TTimeIntervalMicroSeconds aActualInterval; + returnCode = KErrNone; + + // Print to UI + _LIT( KSAPILocTest, "SAPILocTest" ); + _LIT( KExample, "GetPostionOpts3"); + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + + CLocationService *CoreObj = CLocationService :: NewL(); + + if( NULL == CoreObj) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + _LIT(Kidentity ,"Coreclass Testing" ) ; - CLocationService *CoreObj = CLocationService :: NewL(); - - if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; - const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; - aRequestorStack.Insert(identityInfo,0); - - CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + options.SetUpdateTimeOut(aTimeOut); options.SetUpdateInterval(aInterval); - - ret1 = CoreObj->GetLocationL(&currPos1,&options); - ret2 = CoreObj->GetLocationL(&currPos2,&options); - ret3 = CoreObj->GetLocationL(&currPos2,&options); - - - if( KErrArgument == ret1 && KErrArgument == ret2 && KErrArgument == ret3 ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - - else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - /*aRequestorStack.Close(); + + TRAP(ret1 , CoreObj->GetLocationL(&currPos1,&options)); + TRAP(ret2 , CoreObj->GetLocationL(&currPos2,&options)); + TRAP(ret3 , CoreObj->GetLocationL(&currPos2,&options)); + + + if( KErrArgument == ret1 && KErrArgument == ret2 && KErrArgument == ret3 ) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + + else + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - - __UHEAP_MARKEND; - - return returnCode; - } - + delete CoreObj; + + __UHEAP_MARKEND; + + return returnCode; + } + // ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionOpts4 // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetPositionOpts4( CStifItemParser& /*aItem*/ ) - { - TInt ret1,ret2; - TPositionInfo currPos1,currPos2,currPos3; - TPosition cPos1,cPos2,cPos3; - TPositionUpdateOptions options; - TTimeIntervalMicroSeconds aTimeOut = 80000000; - TTimeIntervalMicroSeconds aInterval = 10000000; - TTimeIntervalMicroSeconds aMaxAge = 5000000; - TTimeIntervalMicroSeconds aActualInterval; - TTime start; - TTime end; - TInt64 aActualInt; + { + TInt ret1,ret2; + TPositionInfo currPos1,currPos2,currPos3; + TPosition cPos1,cPos2,cPos3; + TPositionUpdateOptions options; + TTimeIntervalMicroSeconds aTimeOut = 80000000; + TTimeIntervalMicroSeconds aInterval = 10000000; + TTimeIntervalMicroSeconds aMaxAge = 5000000; + TTimeIntervalMicroSeconds aActualInterval; + TTime start; + TTime end; + TInt64 aActualInt; returnCode = KErrNone; - - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "GetPostionOpts4"); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - CLocationService *CoreObj = CLocationService :: NewL(); - - if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + + // Print to UI + _LIT( KSAPILocTest, "SAPILocTest" ); + _LIT( KExample, "GetPostionOpts4"); + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + + CLocationService *CoreObj = CLocationService :: NewL(); + + if( NULL == CoreObj) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + options.SetUpdateTimeOut(aTimeOut); options.SetUpdateInterval(aInterval); options.SetMaxUpdateAge(aMaxAge); - - ret1 = CoreObj->GetLocationL(&currPos1,&options); - + + TRAP(ret1 , CoreObj->GetLocationL(&currPos1,&options)); + start.HomeTime(); - ret2 = CoreObj->GetLocationL(&currPos2,&options); + TRAP(ret2 , CoreObj->GetLocationL(&currPos2,&options)); end.HomeTime(); - + aActualInterval=end.MicroSecondsFrom(start); - - // if( aActualInterval<=10000000 || ret1 || ret2 ) + + // if( aActualInterval<=10000000 || ret1 || ret2 ) if( (KErrNone == ret1) && (KErrNone == ret2 )) - { - aActualInt = aActualInterval.Int64(); - OpenFile(); - TBuf8<50> buf ; - TRealFormat format ; - LogFile.Write(_L8("\n \n")); - buf.Num(aActualInt, format) ; - LogFile.Write(_L8("TimeTaken = ")); - LogFile.Write(buf) ; - CloseFile(); - currPos1.GetPosition(cPos1); - currPos2.GetPosition(cPos2); - // ValidatePosition(cPos1); - // ValidatePosition(cPos2); - returnCode = KErrNone; - - } + { + aActualInt = aActualInterval.Int64(); + OpenFile(); + TBuf8<50> buf ; + TRealFormat format ; + LogFile.Write(_L8("\n \n")); + buf.Num(aActualInt, format) ; + LogFile.Write(_L8("TimeTaken = ")); + LogFile.Write(buf) ; + CloseFile(); + currPos1.GetPosition(cPos1); + currPos2.GetPosition(cPos2); + // ValidatePosition(cPos1); + // ValidatePosition(cPos2); + returnCode = KErrNone; + + } else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(error in ret values)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(error in ret values)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + /*aRequestorStack.Close(); delete identityInfo;*/ delete CoreObj; - + __UHEAP_MARKEND; - - return returnCode; - } - + + return returnCode; + } + // ----------------------------------------------------------------------------- // CSAPILocTest::GetPositionOpts5 // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetPositionOpts5( CStifItemParser& /*aItem*/ ) - { - TInt ret1,ret2; - TInt64 aTime1,aTime2; - TPositionInfo currPos1,currPos2; - TPosition cPos1,cPos2; - TPositionUpdateOptions options; - TTimeIntervalMicroSeconds aTimeOut = 10000000; - TTimeIntervalMicroSeconds aInterval = 2000000; - TTimeIntervalMicroSeconds aActualInterval; - TTime aTimeStamp1,aTimeStamp2; - TBool aAcceptPartialUpdates = ETrue; + { + TInt ret1,ret2; + TInt64 aTime1,aTime2; + TPositionInfo currPos1,currPos2; + TPosition cPos1,cPos2; + TPositionUpdateOptions options; + TTimeIntervalMicroSeconds aTimeOut = 10000000; + TTimeIntervalMicroSeconds aInterval = 2000000; + TTimeIntervalMicroSeconds aActualInterval; + TTime aTimeStamp1,aTimeStamp2; + TBool aAcceptPartialUpdates = ETrue; returnCode = KErrNone; - - // Print to UI - _LIT( KSAPILocTest, "SAPILocTest" ); - _LIT( KExample, "GetPostionOpts5"); - TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - CLocationService *CoreObj = CLocationService :: NewL(); - - if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(Null CoreObj)..\n")); - CloseFile(); - return KErrGeneral; - } - + + // Print to UI + _LIT( KSAPILocTest, "SAPILocTest" ); + _LIT( KExample, "GetPostionOpts5"); + TestModuleIf().Printf( 0, KSAPILocTest, KExample ); + + __UHEAP_MARK; + + CLocationService *CoreObj = CLocationService :: NewL(); + + if( NULL == CoreObj) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(Null CoreObj)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + options.SetUpdateTimeOut(aTimeOut); options.SetUpdateInterval(aInterval); options.SetAcceptPartialUpdates(aAcceptPartialUpdates); - - User::After(120000000); - ret1 = CoreObj->GetLocationL(&currPos1,&options); - + + //User::After(120000000); + TRAP(ret1 , CoreObj->GetLocationL(&currPos1,&options)); + if(KErrNone == ret1) - { - ret2 = CoreObj->GetLocationL(&currPos2,&options); - if(KErrNone == ret2) - { - currPos1.GetPosition(cPos1); - currPos2.GetPosition(cPos2); - aTimeStamp1 = cPos1.Time(); - aTimeStamp2 = cPos2.Time(); - aTime1 = aTimeStamp1.Int64(); - aTime2 = aTimeStamp2.Int64(); - if((aTime1) && (aTime2)) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(no timeStamp)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - } - else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(getLoc2 error)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - } - + { + TRAP(ret2 , CoreObj->GetLocationL(&currPos2,&options)); + if(KErrNone == ret2) + { + currPos1.GetPosition(cPos1); + currPos2.GetPosition(cPos2); + aTimeStamp1 = cPos1.Time(); + aTimeStamp2 = cPos2.Time(); + aTime1 = aTimeStamp1.Int64(); + aTime2 = aTimeStamp2.Int64(); + if((aTime1) && (aTime2)) + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(no timeStamp)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + } + else + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(getLoc2 error)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + } + else - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(getLoc error)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - /*aRequestorStack.Close(); + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(getLoc error)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } - - // ----------------------------------------------------------------------------- + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } + +// ----------------------------------------------------------------------------- // CSAPILocTest::GetLastPosition // ----------------------------------------------------------------------------- // //TInt CSAPILocTest::GetLastPosition( CStifItemParser& /*aItem*/ ) - /* { +/* { TInt ret; TPosition currPos; TTime currPosTime; @@ -3822,19 +4237,19 @@ _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetLastPosition" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + // Print to log file iLog->Log( KExample ); __UHEAP_MARK; CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) { iLog->Log( _L("CLocationService object creation failed") ); return KErrGeneral; } - + ret = CoreObj->GetLastKnownLoc(currPos); if( KErrUnknown==ret ) { @@ -3845,7 +4260,7 @@ __UHEAP_MARKEND; return KErrNone; } - + else { iLog->Log( _L("GetLastLocation returned") ); @@ -3855,12 +4270,12 @@ __UHEAP_MARKEND; return KErrGeneral; } - - + + }*/ - - - // ----------------------------------------------------------------------------- + + +// ----------------------------------------------------------------------------- // CSAPILocTest::GetLastPosition1 // ----------------------------------------------------------------------------- // @@ -3877,20 +4292,20 @@ _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetLastPosition1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + // Print to log file iLog->Log( KExample ); __UHEAP_MARK; CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) { iLog->Log( _L("CLocationService object creation failed") ); __UHEAP_MARKEND; return KErrGeneral; } - + aRet = CoreObj->GetLocationL(aCurrPos); if(aRet) { @@ -3901,7 +4316,7 @@ __UHEAP_MARKEND; return KErrGeneral; } - + aCurrPosTime = aCurrPos.Time(); aRet1 = CoreObj->GetLastKnownLoc(aLastPos); if(!aRet1) @@ -3924,7 +4339,7 @@ aLatitude2 = aLastPos.Latitude(); aLongitude2 = aLastPos.Longitude(); aAltitude2 = aLastPos.Altitude(); - + if( (aLatitude1 != aLatitude2) || (aLongitude1 != aLongitude2) || (aAltitude1 != aAltitude2 )) { iLog->Log( _L("Returned coordinates are wrong") ); @@ -3943,11 +4358,11 @@ __UHEAP_MARKEND; return KErrNone; } - + } } - - + + else { iLog->Log( _L("GetLastKnownLoc failed")); @@ -3957,11 +4372,11 @@ __UHEAP_MARKEND; return KErrNone; } - - + + }*/ - - + + // ----------------------------------------------------------------------------- // CSAPILocTest::GetDistance // ----------------------------------------------------------------------------- @@ -3971,133 +4386,133 @@ TInt aRet; inpparam aInputParam; returnCode = KErrNone; - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + aInputParam.servicechoice = 0; aRet = CoreObj->MathOperation(aInputParam); if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")) ; - CloseFile(); - returnCode = KErrGeneral; - } - - - delete CoreObj; - - __UHEAP_MARKEND; + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")) ; + CloseFile(); + returnCode = KErrGeneral; + } + + + delete CoreObj; + + __UHEAP_MARKEND; return KErrNone; - } - + } + // ----------------------------------------------------------------------------- // CSAPILocTest::GetDistance2 // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetDistance2( CStifItemParser& /*aItem*/ ) { - TInt aRet; - // TPositionInfo currPos[2]; - TPosition currPos1[2]; - inpparam aInputParam; + TInt aRet; + // TPositionInfo currPos[2]; + TPosition currPos1[2]; + inpparam aInputParam; TReal64 aLatitude1 = 10,aLatitude2 = 20; - TReal64 aLongitude1 = 120,aLongitude2 = 140; - TReal32 aAltitude1 = 500,aAltitude2 = 500; - returnCode = KErrNone; - + TReal64 aLongitude1 = 120,aLongitude2 = 140; + TReal32 aAltitude1 = 500,aAltitude2 = 500; + returnCode = KErrNone; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance2" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed(CoreObj Creation)..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + /*for( TInt i=0;i<2;i++) { ret[i] = CoreObj->GetLocationL(&currPos[i]); } if( !ret[0] && !ret[1]) { - - + + currPos[0].GetPosition(currPos1[0]); currPos[1].GetPosition(currPos1[1]); - + aLatitude1 = currPos1[0].Latitude(); aLongitude1 = currPos1[0].Longitude() ; aAltitude1 = currPos1[0].Altitude() ; aLatitude2 = currPos1[1].Latitude(); aLongitude2 = currPos1[1].Longitude() ; aAltitude2 = currPos1[1].Altitude() ; - */ - aInputParam.servicechoice = 10; - aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1); - aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2); - - aRet = CoreObj->MathOperation(aInputParam); - - if(KErrNotSupported == aRet) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed(Wrong error)..\n")); - CloseFile(); - returnCode = KErrGeneral; - } + */ + aInputParam.servicechoice = 10; + aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1); + aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2); + + aRet = CoreObj->MathOperation(aInputParam); + + if(KErrNotSupported == aRet) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed(Wrong error)..\n")); + CloseFile(); + returnCode = KErrGeneral; + } /* } else { @@ -4107,13 +4522,13 @@ CloseFile(); returnCode = KErrGeneral; } - */ - /*aRequestorStack.Close(); + */ + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - - __UHEAP_MARKEND; - return returnCode; + delete CoreObj; + + __UHEAP_MARKEND; + return returnCode; } // ----------------------------------------------------------------------------- // CSAPILocTest::GetDistance3 @@ -4121,108 +4536,108 @@ // TInt CSAPILocTest::GetDistance3( CStifItemParser& /*aItem*/ ) { - TInt ret[2],aRet; - TPositionInfo currPos[2]; - TPosition currPos1[2]; - inpparam aInputParam; + TInt ret[2],aRet; + TPositionInfo currPos[2]; + TPosition currPos1[2]; + inpparam aInputParam; returnCode = KErrNone; TReal64 aLatitude1,aLatitude2; - TReal64 aLongitude1,aLongitude2; - TReal32 aAltitude1,aAltitude2; - // Print to UI + TReal64 aLongitude1,aLongitude2; + TReal32 aAltitude1,aAltitude2; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance3" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; //not needed any more - /*RRequestorStack aRequestorStack; + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - + for( TInt i=0;i<2;i++) - { - ret[i] = CoreObj->GetLocationL(&currPos[i]); - } + { + TRAP(ret[i] , CoreObj->GetLocationL(&currPos[i])); + } if( (KErrNone == ret[0]) && (KErrNone == ret[1] )) - { - currPos[0].GetPosition(currPos1[0]); - currPos[1].GetPosition(currPos1[1]); - aLatitude1 = currPos1[0].Latitude(); - aLongitude1 = currPos1[0].Longitude() ; - aAltitude1 = currPos1[0].Altitude() ; - aLatitude2 = currPos1[1].Latitude(); - aLongitude2 = currPos1[1].Longitude() ; - aAltitude2 = currPos1[1].Altitude() ; - - aInputParam.servicechoice = 0; - aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1); - aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2); - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Distance = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - if( aInputParam.result<0 ) - { - returnCode = KErrGeneral; - } - else - { - returnCode = KErrNone; - } - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed(Math op).. \n")); - CloseFile(); - returnCode = KErrGeneral; - } - } + { + currPos[0].GetPosition(currPos1[0]); + currPos[1].GetPosition(currPos1[1]); + aLatitude1 = currPos1[0].Latitude(); + aLongitude1 = currPos1[0].Longitude() ; + aAltitude1 = currPos1[0].Altitude() ; + aLatitude2 = currPos1[1].Latitude(); + aLongitude2 = currPos1[1].Longitude() ; + aAltitude2 = currPos1[1].Altitude() ; + + aInputParam.servicechoice = 0; + aInputParam.source.SetCoordinate(aLatitude1,aLongitude1,aAltitude1); + aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2,aAltitude2); + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Distance = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + if( aInputParam.result<0 ) + { + returnCode = KErrGeneral; + } + else + { + returnCode = KErrNone; + } + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed(Math op).. \n")); + CloseFile(); + returnCode = KErrGeneral; + } + } else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed(getloc error).. \n")); - CloseFile(); - returnCode = KErrGeneral; - } - - /*aRequestorStack.Close(); + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed(getloc error).. \n")); + CloseFile(); + returnCode = KErrGeneral; + } + + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; - - __UHEAP_MARKEND; - + delete CoreObj; + + __UHEAP_MARKEND; + return returnCode; } - + // ----------------------------------------------------------------------------- // CSAPILocTest::GetDistance4 // ----------------------------------------------------------------------------- @@ -4230,77 +4645,77 @@ TInt CSAPILocTest::GetDistance4( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; - + TCoordinate aCoordinate1(90,180),aCoordinate2(-90,0); -// TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); -// TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); - - // Print to UI + // TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); + // TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); + + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance4" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCoordinate1; - aInputParam.destination = aCoordinate2; + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCoordinate1; + aInputParam.destination = aCoordinate2; // aInputParam.source.SetPosition(aPosition1); // aInputParam.destination.SetPosition(aPosition2); - - aRet = CoreObj->MathOperation(aInputParam); - if(KErrNone == aRet) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Distance = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - - if( aInputParam.result<0 ) - { - returnCode = KErrGeneral; - } - else - { - returnCode = KErrNone; - } - - } - - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; + + aRet = CoreObj->MathOperation(aInputParam); + if(KErrNone == aRet) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Distance = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + + if( aInputParam.result<0 ) + { + returnCode = KErrGeneral; + } + else + { + returnCode = KErrNone; + } + + } + + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; } delete CoreObj; - + __UHEAP_MARKEND; - + return returnCode; - } + } // ----------------------------------------------------------------------------- @@ -4310,76 +4725,76 @@ TInt CSAPILocTest::GetDistance5( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; - + TCoordinate aCoordinate1(0,0),aCoordinate2(0,0); -// TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); -// TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); - - // Print to UI + // TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); + // TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); + + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance5" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - - CLocationService *CoreObj = CLocationService :: NewL(); - + + __UHEAP_MARK; + + CLocationService *CoreObj = CLocationService :: NewL(); + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCoordinate1; - aInputParam.destination = aCoordinate2; + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCoordinate1; + aInputParam.destination = aCoordinate2; // aInputParam.source.SetPosition(aPosition1); // aInputParam.destination.SetPosition(aPosition2); - - aRet = CoreObj->MathOperation(aInputParam); - - if(( KErrNone == aRet ) && (aInputParam.result == 0)) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Distance = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - - if( aInputParam.result<0 ) - { - returnCode = KErrGeneral; - } - else - { - returnCode = KErrNone; - } - } - - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + + aRet = CoreObj->MathOperation(aInputParam); + + if(( KErrNone == aRet ) && (aInputParam.result == 0)) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Distance = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + + if( aInputParam.result<0 ) + { + returnCode = KErrGeneral; + } + else + { + returnCode = KErrNone; + } + } + + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::GetDistance6 @@ -4388,75 +4803,75 @@ TInt CSAPILocTest::GetDistance6( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; TCoordinate aCordinate1(80,190),aCordinate2(-80,-210); -// TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); -// TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); - - // Print to UI + // TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); + // TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); + + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance6" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - // aInputParam.source.SetPosition(aPosition1); - // aInputParam.destination.SetPosition(aPosition2); - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Distance = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - - if( aInputParam.result<0 ) - { - returnCode = KErrGeneral; - } - else - { - returnCode = KErrNone; - } - } - - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + // aInputParam.source.SetPosition(aPosition1); + // aInputParam.destination.SetPosition(aPosition2); + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Distance = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + + if( aInputParam.result<0 ) + { + returnCode = KErrGeneral; + } + else + { + returnCode = KErrNone; + } + } + + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -4466,209 +4881,209 @@ TInt CSAPILocTest::GetDistance7( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; - + TCoordinate aCordinate1(105,190),aCordinate2(-105,-210); -// TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); -// TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); - - // Print to UI + // TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); + // TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); + + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance7" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 0; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; -// aInputParam.source.SetPosition(aPosition1); -// aInputParam.destination.SetPosition(aPosition2); - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Distance = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - - if( aInputParam.result<0 ) - { - returnCode = KErrGeneral; - } - else - { - returnCode = KErrNone; - } - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 0; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + // aInputParam.source.SetPosition(aPosition1); + // aInputParam.destination.SetPosition(aPosition2); + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Distance = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + + if( aInputParam.result<0 ) + { + returnCode = KErrGeneral; + } + else + { + returnCode = KErrNone; + } + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::GetDistance8 // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetDistance8( CStifItemParser& /*aItem*/ ) - { + { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; - + TCoordinate aCordinate1(360,400),aCordinate2(200,480); -// TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); -// TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); - - // Print to UI + // TLocality aLocality1(aCordinate1,5),aLocality2(aCordinate2,5); + // TPosition aPosition1(aLocality1,aCurrentTime),aPosition2(aLocality2,aCurrentTime); + + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance8" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; -// aInputParam.source.SetPosition(aPosition1); -// aInputParam.destination.SetPosition(aPosition2); - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Distance = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - if( aInputParam.result<0 ) - { - returnCode = KErrGeneral; - } - else - { - returnCode = KErrNone; - } - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + // aInputParam.source.SetPosition(aPosition1); + // aInputParam.destination.SetPosition(aPosition2); + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Distance = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + if( aInputParam.result<0 ) + { + returnCode = KErrGeneral; + } + else + { + returnCode = KErrNone; + } + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; - __UHEAP_MARKEND; + __UHEAP_MARKEND; return returnCode; - } + } // ----------------------------------------------------------------------------- // CSAPILocTest::GetDistance9 // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetDistance9( CStifItemParser& /*aItem*/ ) - { + { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(nan,170),aCordinate2(70,170); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance9" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; - __UHEAP_MARKEND; + __UHEAP_MARKEND; return returnCode; - } + } // ----------------------------------------------------------------------------- @@ -4676,60 +5091,60 @@ // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetDistance10( CStifItemParser& /*aItem*/ ) - { + { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(30,nan),aCordinate2(70,170); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance10" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; return returnCode; - } + } // ----------------------------------------------------------------------------- @@ -4737,60 +5152,60 @@ // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetDistance11( CStifItemParser& /*aItem*/ ) - { + { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(30,110),aCordinate2(nan,170); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance11" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; - __UHEAP_MARKEND; + __UHEAP_MARKEND; return returnCode; - } + } // ----------------------------------------------------------------------------- @@ -4798,115 +5213,115 @@ // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetDistance12( CStifItemParser& /*aItem*/ ) - { + { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(30,110),aCordinate2(40,nan); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetDistance12" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 0; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 0; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; - __UHEAP_MARKEND; + __UHEAP_MARKEND; return returnCode; - } + } // ----------------------------------------------------------------------------- // CSAPILocTest::GetBearing // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetBearing( CStifItemParser& /*aItem*/ ) - { + { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; TTime aCurrentTime; returnCode = KErrNone; - - // Print to UI + + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - - aInputParam.servicechoice = 1; - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + + aInputParam.servicechoice = 1; + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; - __UHEAP_MARKEND; + __UHEAP_MARKEND; return returnCode; - } + } // ----------------------------------------------------------------------------- @@ -4914,114 +5329,114 @@ // ----------------------------------------------------------------------------- // TInt CSAPILocTest::GetBearing1( CStifItemParser& /*aItem*/ ) - { + { TInt ret[2],aRet; - TPositionInfo currPos[2]; - TPosition currPos1[2]; - inpparam aInputParam; + TPositionInfo currPos[2]; + TPosition currPos1[2]; + inpparam aInputParam; TReal64 aLatitude1,aLatitude2; - TReal64 aLongitude1,aLongitude2; - TReal32 aAltitude1,aAltitude2; - returnCode = KErrNone; - - // Print to UI + TReal64 aLongitude1,aLongitude2; + TReal32 aAltitude1,aAltitude2; + returnCode = KErrNone; + + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; - //not needed any more - /*RRequestorStack aRequestorStack; + //not needed any more + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); - + CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - /* for( TInt i=0;i<2;i++) + + /* for( TInt i=0;i<2;i++) { ret[i] = CoreObj->GetLocationL(&currPos[i]); } - */ - - ret[0] = CoreObj->GetLocationL(&currPos[0]) ; - - User::After(30000000) ; - - ret[1] = CoreObj->GetLocationL(&currPos[1]) ; - + */ + + TRAP(ret[0] , CoreObj->GetLocationL(&currPos[0]) ); + + //User::After(30000000) ; + + TRAP(ret[1] , CoreObj->GetLocationL(&currPos[1]) ); + if( !ret[0] && !ret[1]) - { - aInputParam.servicechoice = 1; - currPos[0].GetPosition(currPos1[0]); - currPos[1].GetPosition(currPos1[1]); - aLatitude1 = currPos1[0].Latitude(); - aLongitude1 = currPos1[0].Longitude() ; - //aAltitude1 = currPos1[0].Altitude() ; - //aAltitude1 = NaN; - aLatitude2 = currPos1[1].Latitude(); - aLongitude2 = currPos1[1].Longitude() ; - //aAltitude2 = currPos1[1].Altitude() ; - - aInputParam.source.SetCoordinate(aLatitude1,aLongitude1/*,aAltitude1*/); - aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2/*,aAltitude2*/); - - aRet = CoreObj->MathOperation(aInputParam); - - if(KErrNone == aRet) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Bearing = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else if(aRet == KErrPositionIncalculable ) - { - CloseFile(); - returnCode = KErrNone; - - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed @ math op..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - } + { + aInputParam.servicechoice = 1; + currPos[0].GetPosition(currPos1[0]); + currPos[1].GetPosition(currPos1[1]); + aLatitude1 = currPos1[0].Latitude(); + aLongitude1 = currPos1[0].Longitude() ; + //aAltitude1 = currPos1[0].Altitude() ; + //aAltitude1 = NaN; + aLatitude2 = currPos1[1].Latitude(); + aLongitude2 = currPos1[1].Longitude() ; + //aAltitude2 = currPos1[1].Altitude() ; + + aInputParam.source.SetCoordinate(aLatitude1,aLongitude1/*,aAltitude1*/); + aInputParam.destination.SetCoordinate(aLatitude2,aLongitude2/*,aAltitude2*/); + + aRet = CoreObj->MathOperation(aInputParam); + + if(KErrNone == aRet) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Bearing = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else if(aRet == KErrPositionIncalculable ) + { + CloseFile(); + returnCode = KErrNone; + + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed @ math op..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + } else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed * coreob..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed * coreob..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5031,57 +5446,57 @@ TInt CSAPILocTest::GetBearing2( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(90,90),aCordinate2(90,90); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing2" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if(KErrPositionIncalculable == aRet) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if(KErrPositionIncalculable == aRet) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); returnCode = KErrNone; - } + } else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5091,57 +5506,57 @@ TInt CSAPILocTest::GetBearing3( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(0,0),aCordinate2(0,0); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing3" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if(KErrPositionIncalculable == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if(KErrPositionIncalculable == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5151,60 +5566,60 @@ TInt CSAPILocTest::GetBearing4( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(40,90),aCordinate2(30,120); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing4" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Bearing = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Bearing = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5214,57 +5629,57 @@ TInt CSAPILocTest::GetBearing5( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(90,180),aCordinate2(-90,-180); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing5" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if(KErrPositionIncalculable == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")); - CloseFile(); + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if(KErrPositionIncalculable == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")); + CloseFile(); returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5274,61 +5689,61 @@ TInt CSAPILocTest::GetBearing6( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(-120,-180),aCordinate2(160,180); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing6" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Bearing = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Bearing = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5338,61 +5753,61 @@ TInt CSAPILocTest::GetBearing7( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(35,360),aCordinate2(-80,-200); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing7" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Bearing = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Bearing = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5402,62 +5817,62 @@ TInt CSAPILocTest::GetBearing8( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(-30,160),aCordinate2(120,240); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing8" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Bearing = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Bearing = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } + // ----------------------------------------------------------------------------- // CSAPILocTest::GetBearing9 @@ -5466,61 +5881,61 @@ TInt CSAPILocTest::GetBearing9( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(105,190),aCordinate2(-105,-210); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing9" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Bearing = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Bearing = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5530,61 +5945,61 @@ TInt CSAPILocTest::GetBearing10( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; - + TCoordinate aCordinate1(75,190),aCordinate2(-20,-220); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing10" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - buf.Num(aInputParam.result, format) ; - LogFile.Write(_L8("Bearing = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + buf.Num(aInputParam.result, format) ; + LogFile.Write(_L8("Bearing = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5594,56 +6009,56 @@ TInt CSAPILocTest::GetBearing11( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(nan,190),aCordinate2(-20,-220); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing11" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5653,56 +6068,56 @@ TInt CSAPILocTest::GetBearing12( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(40,nan),aCordinate2(-20,-220); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing12" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } @@ -5713,57 +6128,57 @@ TInt CSAPILocTest::GetBearing13( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(40,140),aCordinate2(nan,-220); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing13" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } @@ -5774,56 +6189,56 @@ TInt CSAPILocTest::GetBearing14( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(40,140),aCordinate2(60,nan); - // Print to UI + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "GetBearing14" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 1; - aInputParam.source = aCordinate1; - aInputParam.destination = aCordinate2; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 1; + aInputParam.source = aCordinate1; + aInputParam.destination = aCordinate2; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -5833,57 +6248,57 @@ TInt CSAPILocTest::Move1( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(nan,140); - TReal32 aDist=1000,aBearing=100; - // Print to UI + TReal32 aDist=1000,aBearing=100; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } @@ -5894,57 +6309,57 @@ TInt CSAPILocTest::Move2( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(40,nan); - TReal32 aDist=1000,aBearing=100; - // Print to UI + TReal32 aDist=1000,aBearing=100; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move2" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrArgument == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrArgument == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } @@ -5955,58 +6370,58 @@ TInt CSAPILocTest::Move3( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(90,0); - TReal32 aDist=1000,aBearing=100; - // Print to UI + TReal32 aDist=1000,aBearing=100; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move3" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrPositionIncalculable == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrPositionIncalculable == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } @@ -6018,58 +6433,58 @@ TInt CSAPILocTest::Move4( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(-90,0); - TReal32 aDist=1000,aBearing=100; - // Print to UI + TReal32 aDist=1000,aBearing=100; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move4" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrPositionIncalculable == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrPositionIncalculable == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } @@ -6081,58 +6496,58 @@ TInt CSAPILocTest::Move5( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(0,0); - TReal32 aDist=1000,aBearing=100; - // Print to UI + TReal32 aDist=1000,aBearing=100; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move5" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -6142,68 +6557,68 @@ TInt CSAPILocTest::Move6( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(20,120); - TReal32 aDist=1000,aBearing=100; - // Print to UI + TReal32 aDist=1000,aBearing=100; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move6" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - TReal64 aLatitude = aCordinate1.Latitude(); - buf.Num(aLatitude, format) ; - LogFile.Write(_L8("Latitude = ")); - LogFile.Write(buf) ; - TReal64 aLongitude = aCordinate1.Longitude(); - buf.Num(aLongitude, format) ; - LogFile.Write(_L8("Longitude = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + TReal64 aLatitude = aCordinate1.Latitude(); + buf.Num(aLatitude, format) ; + LogFile.Write(_L8("Latitude = ")); + LogFile.Write(buf) ; + TReal64 aLongitude = aCordinate1.Longitude(); + buf.Num(aLongitude, format) ; + LogFile.Write(_L8("Longitude = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::Move7 @@ -6212,68 +6627,68 @@ TInt CSAPILocTest::Move7( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(-30,-70); - TReal32 aDist=1000,aBearing=100; - // Print to UI + TReal32 aDist=1000,aBearing=100; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move7" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - TReal64 aLatitude = aCordinate1.Latitude(); - buf.Num(aLatitude, format) ; - LogFile.Write(_L8("Latitude = ")); - LogFile.Write(buf) ; - TReal64 aLongitude = aCordinate1.Longitude(); - buf.Num(aLongitude, format) ; - LogFile.Write(_L8("Longitude = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("Passed..\n")) ; - CloseFile(); - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + TReal64 aLatitude = aCordinate1.Latitude(); + buf.Num(aLatitude, format) ; + LogFile.Write(_L8("Latitude = ")); + LogFile.Write(buf) ; + TReal64 aLongitude = aCordinate1.Longitude(); + buf.Num(aLongitude, format) ; + LogFile.Write(_L8("Longitude = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("Passed..\n")) ; + CloseFile(); + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- @@ -6283,77 +6698,77 @@ TInt CSAPILocTest::Move8( CStifItemParser& /*aItem*/ ) { TInt aRet; - inpparam aInputParam; + inpparam aInputParam; returnCode = KErrNone; TRealX nan; nan.SetNaN(); TCoordinate aCordinate1(20,120); - TReal32 aDist=0,aBearing=0; - // Print to UI + TReal32 aDist=0,aBearing=0; + // Print to UI _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Move8" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - - aInputParam.servicechoice = 2; - aInputParam.source = aCordinate1; - aInputParam.bearing = aBearing; - aInputParam.distance = aDist; - - aRet = CoreObj->MathOperation(aInputParam); - - if( KErrNone == aRet ) - { - OpenFile(); - TBuf8<50> buf ; - TRealFormat format; - LogFile.Write(_L8("\n \n")); - TReal64 aLatitude = aCordinate1.Latitude(); - buf.Num(aLatitude, format) ; - LogFile.Write(_L8("Latitude = ")); - LogFile.Write(buf) ; - TReal64 aLongitude = aCordinate1.Longitude(); - buf.Num(aLongitude, format) ; - LogFile.Write(_L8("Longitude = ")); - LogFile.Write(buf) ; - CloseFile(); - if( aLatitude != 20 || aLongitude != 120) - returnCode = KErrGeneral; - else - returnCode = KErrNone; - } - else - { - OpenFile(); - LogFile.Write(_L8("\n \n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - - delete CoreObj; - __UHEAP_MARKEND; - return returnCode; - } + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + + aInputParam.servicechoice = 2; + aInputParam.source = aCordinate1; + aInputParam.bearing = aBearing; + aInputParam.distance = aDist; + + aRet = CoreObj->MathOperation(aInputParam); + + if( KErrNone == aRet ) + { + OpenFile(); + TBuf8<50> buf ; + TRealFormat format; + LogFile.Write(_L8("\n \n")); + TReal64 aLatitude = aCordinate1.Latitude(); + buf.Num(aLatitude, format) ; + LogFile.Write(_L8("Latitude = ")); + LogFile.Write(buf) ; + TReal64 aLongitude = aCordinate1.Longitude(); + buf.Num(aLongitude, format) ; + LogFile.Write(_L8("Longitude = ")); + LogFile.Write(buf) ; + CloseFile(); + if( aLatitude != 20 || aLongitude != 120) + returnCode = KErrGeneral; + else + returnCode = KErrNone; + } + else + { + OpenFile(); + LogFile.Write(_L8("\n \n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } // ----------------------------------------------------------------------------- // CSAPILocTest::Modinfo1 // ----------------------------------------------------------------------------- // //TInt CSAPILocTest::Modinfo1( CStifItemParser& /*aItem*/ ) - /* { +/* { TInt aRet; TPositionModuleInfo currPos; inpparam aInputParam; @@ -6363,11 +6778,11 @@ _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Modinfo1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - + __UHEAP_MARK; - + CLocationService *CoreObj = CLocationService :: NewL(); - + if( NULL == CoreObj) { OpenFile(); @@ -6376,10 +6791,10 @@ CloseFile(); return KErrGeneral; } - + aRet = CoreObj->GetModuleInfo(currPos); TPositionModuleInfo :: TCapabilities currCapability = currPos.Capabilities() ; - + if ( iLocinfoCategory == EGenericInfo ) { if(currCapability & TPositionModuleInfo :: ECapabilitySpeed) //Populate output param with speed info @@ -6491,7 +6906,7 @@ } } - + aRequestorStack.Close(); delete identityInfo; delete CoreObj; @@ -6505,296 +6920,317 @@ // ----------------------------------------------------------------------------- // class Modinfo1CallBack : public MLocationCallBack - { + { TInt iCount ; TInt iRetStatus ; CLocationService *iCoreObj; + TInt iTransactionId; + TInt iRequestType; public : - TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; - Modinfo1CallBack(CLocationService *obj,TInt cnt=0,TInt retStatus=KErrGeneral) - { - iCoreObj = obj; - iCount = cnt; - iRetStatus = retStatus; - } - }; - - + TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) ; + Modinfo1CallBack(TInt transId,TInt req,CLocationService *obj,TInt cnt=0,TInt retStatus=KErrGeneral) + { + iTransactionId = transId; + iRequestType = req; + iCoreObj = obj; + iCount = cnt; + iRetStatus = retStatus; + } + + inline TUint GetRequestType(void) + { + return iRequestType ; + } + + + /** + * GetTransactionId function returns transcation id associated with current async object + * + */ + inline TInt32 GetTransactionId(void) + { + return iTransactionId ; + } + }; + + TInt Modinfo1CallBack :: HandleNotifyL(HPositionGenericInfo *currPos , TInt /*aError*/) - { - TInt aRetVal = KErrNone; - TPositionModuleInfo modInfo; - OpenFile(); - LogFile.Write(_L8("\n\n ")); - CloseFile(); - TPosition outPos ; - currPos->GetPosition(outPos) ; - aRetVal = ValidatePosition(outPos); - + { + TInt aRetVal = KErrNone; + TPositionModuleInfo modInfo; + OpenFile(); + LogFile.Write(_L8("\n\n ")); + CloseFile(); + TPosition outPos ; + currPos->GetPosition(outPos) ; + aRetVal = ValidatePosition(outPos); + if( KErrNone == aRetVal ) - { - aRetVal = iCoreObj->GetModuleInfo(modInfo); - TPositionModuleInfo :: TCapabilities currCapability = modInfo.Capabilities() ; - - // if ( iLocinfoCategory == EGenericInfo ) - // { - //if( (currCapability & TPositionModuleInfo :: ECapabilitySpeed) && returnCode == KErrNone) //Populate output param with speed info - if (currCapability & TPositionModuleInfo :: ECapabilitySpeed) - { - TReal32 speedinfo = 0 ; - - if(!currPos->GetValue(EPositionFieldHorizontalSpeed , speedinfo) ) //Extract speed - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(speedinfo , format) ; - OpenFile(); - LogFile.Write(_L8("HorizontalSpeed = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - else if(!currPos->GetValue(EPositionFieldHorizontalSpeedError , speedinfo)) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(speedinfo , format) ; - OpenFile(); - LogFile.Write(_L8("HorizontalSpeedError = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - /* else + { + aRetVal = iCoreObj->GetModuleInfo(modInfo); + TPositionModuleInfo :: TCapabilities currCapability = modInfo.Capabilities() ; + + // if ( iLocinfoCategory == EGenericInfo ) + // { + //if( (currCapability & TPositionModuleInfo :: ECapabilitySpeed) && returnCode == KErrNone) //Populate output param with speed info + if (currCapability & TPositionModuleInfo :: ECapabilitySpeed) + { + TReal32 speedinfo = 0 ; + + if(!currPos->GetValue(EPositionFieldHorizontalSpeed , speedinfo) ) //Extract speed + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(speedinfo , format) ; + OpenFile(); + LogFile.Write(_L8("HorizontalSpeed = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + else if(!currPos->GetValue(EPositionFieldHorizontalSpeedError , speedinfo)) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(speedinfo , format) ; + OpenFile(); + LogFile.Write(_L8("HorizontalSpeedError = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + /* else { returnCode = KErrGeneral; } - */ - } //End of EcapabilitySpeed - - - // if((currCapability & TPositionModuleInfo :: ECapabilitySatellite) && returnCode == KErrNone ) //Extract satellitinfo if any and append it - if(currCapability & TPositionModuleInfo :: ECapabilitySatellite) - { //as part of out parm list - TInt8 satinfo = 0; - - if(!currPos->GetValue(EPositionFieldSatelliteNumInView , satinfo)) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(satinfo , format) ; - OpenFile(); - LogFile.Write(_L8("SatelliteNumInView = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - /* else + */ + } //End of EcapabilitySpeed + + + // if((currCapability & TPositionModuleInfo :: ECapabilitySatellite) && returnCode == KErrNone ) //Extract satellitinfo if any and append it + if(currCapability & TPositionModuleInfo :: ECapabilitySatellite) + { //as part of out parm list + TInt8 satinfo = 0; + + if(!currPos->GetValue(EPositionFieldSatelliteNumInView , satinfo)) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(satinfo , format) ; + OpenFile(); + LogFile.Write(_L8("SatelliteNumInView = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + /* else { returnCode = KErrGeneral; } - */ - } - - if( (currCapability & TPositionModuleInfo :: ECapabilityDirection) && returnCode == KErrNone) //Extract direction info if any and append it - { // as part of out parm list - TReal32 direcinfo = 0; - - if(!currPos->GetValue(EPositionFieldTrueCourse , direcinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(direcinfo , format) ; - OpenFile(); - LogFile.Write(_L8("TrueCourse = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - else if(!currPos->GetValue(EPositionFieldTrueCourseError , direcinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(direcinfo , format) ; - OpenFile(); - LogFile.Write(_L8("TrueCourseError = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - else if(!currPos->GetValue(EPositionFieldMagneticCourseError , direcinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(direcinfo , format) ; - OpenFile(); - LogFile.Write(_L8("MagneticCourseError = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - else if(!currPos->GetValue(EPositionFieldMagneticCourse , direcinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(direcinfo , format) ; - OpenFile(); - LogFile.Write(_L8("MagneticCourse = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - /*else + */ + } + + if( (currCapability & TPositionModuleInfo :: ECapabilityDirection) && returnCode == KErrNone) //Extract direction info if any and append it + { // as part of out parm list + TReal32 direcinfo = 0; + + if(!currPos->GetValue(EPositionFieldTrueCourse , direcinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(direcinfo , format) ; + OpenFile(); + LogFile.Write(_L8("TrueCourse = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + else if(!currPos->GetValue(EPositionFieldTrueCourseError , direcinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(direcinfo , format) ; + OpenFile(); + LogFile.Write(_L8("TrueCourseError = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + else if(!currPos->GetValue(EPositionFieldMagneticCourseError , direcinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(direcinfo , format) ; + OpenFile(); + LogFile.Write(_L8("MagneticCourseError = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + else if(!currPos->GetValue(EPositionFieldMagneticCourse , direcinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(direcinfo , format) ; + OpenFile(); + LogFile.Write(_L8("MagneticCourse = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + /*else { returnCode = KErrGeneral; } */ - } - - - //if((currCapability & TPositionModuleInfo :: ECapabilityCompass) && returnCode == KErrNone) //Extract compass info if any and append it - if(currCapability & TPositionModuleInfo :: ECapabilityCompass) - { // as part of out parm list - TReal32 compassinfo ; - - if(!currPos->GetValue(EPositionFieldHeading , compassinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(compassinfo , format) ; - OpenFile(); - LogFile.Write(_L8("FieldHeading = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - - else if(!currPos->GetValue(EPositionFieldHeadingError , compassinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(compassinfo , format) ; - OpenFile(); - LogFile.Write(_L8("FieldHeadingError = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - else if(!currPos->GetValue(EPositionFieldMagneticHeading , compassinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(compassinfo , format) ; - OpenFile(); - LogFile.Write(_L8("MagneticHeading = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - else if(!currPos->GetValue(EPositionFieldMagneticHeadingError , compassinfo) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(compassinfo , format) ; - OpenFile(); - LogFile.Write(_L8("MagneticHeadingError = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - /*else + } + + + //if((currCapability & TPositionModuleInfo :: ECapabilityCompass) && returnCode == KErrNone) //Extract compass info if any and append it + if(currCapability & TPositionModuleInfo :: ECapabilityCompass) + { // as part of out parm list + TReal32 compassinfo ; + + if(!currPos->GetValue(EPositionFieldHeading , compassinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(compassinfo , format) ; + OpenFile(); + LogFile.Write(_L8("FieldHeading = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + + else if(!currPos->GetValue(EPositionFieldHeadingError , compassinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(compassinfo , format) ; + OpenFile(); + LogFile.Write(_L8("FieldHeadingError = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + else if(!currPos->GetValue(EPositionFieldMagneticHeading , compassinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(compassinfo , format) ; + OpenFile(); + LogFile.Write(_L8("MagneticHeading = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + else if(!currPos->GetValue(EPositionFieldMagneticHeadingError , compassinfo) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(compassinfo , format) ; + OpenFile(); + LogFile.Write(_L8("MagneticHeadingError = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + /*else { returnCode = KErrGeneral; } - */ - } - - //if( (currCapability & TPositionModuleInfo :: ECapabilityNmea) && returnCode == KErrNone )//Extract Nmea info if any and append it - if(currCapability & TPositionModuleInfo :: ECapabilityNmea) - { //as part of out param list - TUint8 numSentences ; - TBuf8 <20> nmeaSentences ; - if(!currPos->GetValue(EPositionFieldNMEASentences , numSentences) ) - { - TBuf8<50> buf ; - TRealFormat format ; - buf.Num(numSentences , format) ; - OpenFile(); - LogFile.Write(_L8("NMEASentences = ")); - LogFile.Write(buf) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - - else if(!currPos->GetValue(EPositionFieldNMEASentencesStart , nmeaSentences) ) - { - TRealFormat format ; - OpenFile(); - LogFile.Write(_L8("NMEASentencesStart = ")); - LogFile.Write(nmeaSentences) ; - LogFile.Write(_L8("\n")) ; - CloseFile(); - } - /* else + */ + } + + //if( (currCapability & TPositionModuleInfo :: ECapabilityNmea) && returnCode == KErrNone )//Extract Nmea info if any and append it + if(currCapability & TPositionModuleInfo :: ECapabilityNmea) + { //as part of out param list + TUint8 numSentences ; + TBuf8 <20> nmeaSentences ; + if(!currPos->GetValue(EPositionFieldNMEASentences , numSentences) ) + { + TBuf8<50> buf ; + TRealFormat format ; + buf.Num(numSentences , format) ; + OpenFile(); + LogFile.Write(_L8("NMEASentences = ")); + LogFile.Write(buf) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + + else if(!currPos->GetValue(EPositionFieldNMEASentencesStart , nmeaSentences) ) + { + TRealFormat format ; + OpenFile(); + LogFile.Write(_L8("NMEASentencesStart = ")); + LogFile.Write(nmeaSentences) ; + LogFile.Write(_L8("\n")) ; + CloseFile(); + } + /* else { returnCode = KErrGeneral; } - */ - } - - } - else - { - OpenFile(); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - returnCode = KErrGeneral; - } - + */ + } + + } + else + { + OpenFile(); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + returnCode = KErrGeneral; + } + CActiveScheduler *Current = CActiveScheduler :: Current() ; - Current->Stop() ; - return KErrNone ; - } + Current->Stop() ; + return KErrNone ; + } TInt ModinfoFunctionL() - { + { + __UHEAP_MARK ; CLocationService *CoreObj = CLocationService ::NewL() ; - + if( NULL == CoreObj ) - { - OpenFile(); - LogFile.Write(_L8("\n\n")); - LogFile.Write(_L8("Failed..\n")); - CloseFile(); - return KErrGeneral; - } - + { + OpenFile(); + LogFile.Write(_L8("\n\n")); + LogFile.Write(_L8("Failed..\n")); + CloseFile(); + return KErrGeneral; + } + _LIT(Kidentity ,"Coreclass Testing" ) ; //not needed any more - /*RRequestorStack aRequestorStack; + /*RRequestorStack aRequestorStack; const CRequestor* identityInfo = CRequestor::NewL(1 , 1 , Kidentity) ; aRequestorStack.Insert(identityInfo,0); CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - - Modinfo1CallBack MyUpdates(CoreObj) ; + + Modinfo1CallBack MyUpdates(25,GETLOCATION,CoreObj) ; CoreObj->GetLocationL(&MyUpdates) ; CActiveScheduler :: Start() ; - /*aRequestorStack.Close(); + /*aRequestorStack.Close(); delete identityInfo;*/ - delete CoreObj; + delete CoreObj; + __UHEAP_MARKEND ; return 0; - } + } TInt CSAPILocTest::Modinfo1( CStifItemParser& /*aItem*/ ) - { + { TRequestStatus status = KRequestPending; TInt aRet = KErrNone; returnCode = KErrNone; @@ -6802,16 +7238,15 @@ _LIT( KSAPILocTest, "SAPILocTest" ); _LIT( KExample, "Modinfo1" ); TestModuleIf().Printf( 0, KSAPILocTest, KExample ); - - __UHEAP_MARK; - + + __UHEAP_MARK; + TRAPD(err , aRet = ModinfoFunctionL()) ; if( err || aRet ) - returnCode = KErrGeneral; - + returnCode = KErrGeneral; + __UHEAP_MARKEND; - + return returnCode; } - - \ No newline at end of file + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/testing/tsapiloctotest/inc/locationcoreimp.h --- a/serviceproviders/sapi_location/tsrc/testing/tsapiloctotest/inc/locationcoreimp.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,176 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI core implementation. -* -*/ - - - -#ifndef C_LOCATIONCOREIMP_H -#define C_LOCATIONCOREIMP_H - -#include -#include -#include "locationservice.h" - - -/** - * Consts to identify the type of location request (trace, getlocation - */ - -const TInt KTraceRequest = 1 ; -const TInt KGetLocationRequest = 2 ; - - - - - -/** - * This class implements Location SAPI core logic.It has methods - * for retreving information location asynchronusly . - */ - -class CGetLoc : public CActive - { - public: - - - - /** - * Creates a new instance of a @ref CGetLoc - * - * @param aPositionServer subsession to location server - * @param aRequestorInfoStack requestor indenty - * @param aList List of position fields that should be retrived - * @param aLocationInfoCategory information type required(Basic, Generic) - * - */ - - IMPORT_C static CGetLoc* NewL( RPositionServer &aPositionServer , - TPositionFieldIdList aList , - TInt aRequestType, - TInt aLocationInfoCategory ) ; - - /** - * Destructor. - */ - virtual ~CGetLoc() ; - - - - /** - * Gets users current location Asynchronously calls the users callback - * function when updates are recived from location server - * - * @param aCallBackObj callback object for updates notification - * @param aUpdatesOptions update options for asynchronous calls - * - */ - TInt GetLocation( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions =NULL ); - - /** - * Traces users location change - * Any location change is informed to user via callback function - * - * @param aCallBackObj callback handle for async trace call - * @param aUpdateOptions updateoptions for trace call - * - * @see TPositionUpdateOptions in LbsCommon.h for details - */ - TInt GetLocationUpdates( MLocationCallBack* aCallBackObj , - const TPositionUpdateOptions* aUpdateOptions = NULL ); - - void SetStatusComplete() - { - iRequestStatus = 1; - } - TBool IsStatusComplete() - { - if(iRequestStatus == 0) - return false; - else - return true; - } - - - - - protected: - - /** - * From CActive - */ - void DoCancel(); - void RunL(); - - - private: - - /** - * By default Symbian 2nd phase constructor is private. - */ - - void ConstructL(); - /** - * Default constructor - */ - - CGetLoc(); - TInt DoInitialiseL(); - - private: - - - - - /** - * Class Member which holds location server subsession - */ - RPositioner iPositioner; - - /** - * Basic info - */ - TPositionInfo iPositionInfo; - - - /** - * Basic info base - */ - TPositionInfoBase* iPosInfoBase; - /** - * Generic info - */ - HPositionGenericInfo *iGenericPosInfo ; - /** - * callback object - */ - MLocationCallBack *iCallBack ; - - /** - * Request type (Getlocation or Trace) - */ - TInt iRequestType ; - - TInt iRequestStatus; - - - }; - - - -#endif //C_LOCATIONCOREIMP_H - - \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/testing/tsapiloctotest/inc/locationservice.h --- a/serviceproviders/sapi_location/tsrc/testing/tsapiloctotest/inc/locationservice.h Fri Jul 03 15:51:24 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,304 +0,0 @@ -/* -* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of the License "Eclipse Public License v1.0" -* which accompanies 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 location SAPI service implementation. -* -*/ - - -#ifndef LOCATIONSERVICE_H -#define LOCATIONSERVICE_H - -#include -class CGetLoc; -/** - * Identity for location SAPI lib - * This will be appended to requestor identity information stack received from the - * client and will be passed onto location server - */ - -_LIT(KIdentity,"Location SAPI"); - -/** - * Key for locating active objects associated with async request in registration table - * - * @ 0 for Getlocation async Active object - * @ 1 for Trace async active object - */ - -const TInt KARRAY_INDEX_GETLOCATION = 0 ; -const TInt KARRAY_INDEX_TRACE = 1 ; - - - -/** - * Key for locating location information in CLiwGenericParamList - */ -_LIT8(KLongitudeKey,"Longitude") ; -_LIT8(KLatitudeKey , "Latitude") ; -_LIT8(KAltitudeKey , "Altitude") ; - -_LIT(KUnknown,"Unknown"); - -/** - * Default Update options - */ -//Second -const TInt KSSecond = 1000000; - -//Update interval -const TInt KSUpdateInterval = KSSecond; - -//Update time out -const TInt KSUpdateTimeOut = 15*KSSecond; - -//MaxAge -const TInt KSMaxAge = 0; - -/** - * Enums required for mathoperations - */ -enum TMathOperationChoice - { - EDistance = 0, - EBearingTo = 1, - EMove = 2 - }; - -/** - * Notification Type to be cancelled - */ -enum TCancelParam - { - ECancelGetLocation = 0, - ECancelTrace = 1 - }; -/** - * Enumeration used to identify category of location information user intends to - * retrieve - * Example: specifying EBasic user will get only longitude,latitude and altitude - */ - enum TLocationInfoType - { - EBasicInfo = 0, - EGenericInfo = 1 - }; - -/** - * used by the caller of math operation to send input parameters - * after computation MathOperation wil fill in result field of this - * struct. - */ -struct _INPPARM - { - //specifies option for mathoperation - TInt servicechoice; - //result of the computation - TReal32 result ; - //Source Coordinate for math operation - TCoordinate source; - //Destination Coordinate for math operation - TCoordinate destination ; - //In case of find bearingto following two should be supplied by the consumer - TReal32 bearing; - TReal32 distance; - - }; - -typedef struct _INPPARM inpparam; - - - -/** - * Location callback interface, its pure interface class, application need to - * Write there own callback derriving from this class. - * @Depenedency lbs.lib - */ - - class MLocationCallBack - { - /** - * Handles notifications caused by an asynchronous GetLocationL, - * or by trace. - * - * @param aOutPos updated position got from location server - * @return Success/Error code for the callback. - * - * @see HPositionGenericInfo in LbsPositionInfo.h for details - * - */ - public : - virtual TInt HandleNotifyL(HPositionGenericInfo* aOutPos , TInt aError) = 0 ; - }; - - -/** - * CLocationService class : This is a wrapper class for the Functionalities - * offered by Location Retreival APIs. - * In case of An Asynchronus request it has method which Instantiates and delegate - * the job to another class which also opens new sub-session with - * Location server. - */ - - -class CLocationService : public CBase - { - public : - /** - * Creates a new instance of a @ref CLocationService - * @return The newly created CLocationService object - */ - IMPORT_C static CLocationService *NewL() ; - - - /* - * @Destructor - */ - virtual ~CLocationService() ; - - /** - * Methods on the Core Location implementation - */ - - - - /** - * Synchronous get location with update options returns current location of the user - * - * @param aPosinfobase input TPositionInfoBase object which will hold location details - * @param aUpdateOpts updateoptions for synchronous calls - */ - IMPORT_C TInt GetLocationL( TPositionInfoBase* aPos , - const TPositionUpdateOptions* aUpdateOpts= NULL ) ; - - - /** - * Gets the current location of user asynchronosly calls the users callback handle on reciving - * location updates - * @param aCallBack callback object after reciving the position updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFieldIdList specifies field of HPositionGenericInfo that user intend to retrieve. - * @param aUpdateoptions update options for asynchronous requests. - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - IMPORT_C TInt GetLocationL( MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFieldIdList = NULL , - const TPositionUpdateOptions* aUpdateopts = NULL - ); - - /** - * Gets module information of the Positioning module specified my aModuleId - * - * @param TPositionModuleId param to store the obtained module information - * - * @see lsbcommon.h for details of TPositionModuleInfoBase - */ - IMPORT_C TInt GetModuleInfo( TPositionModuleInfoBase& aModuleInfo ) const ; - - /** - * Performs mathoperations (move,distance,bearingto) by parsing contents of input param - * - * @param aInput input paramater for math opertaions - * - * @see inparam in this file for detailed math operation list - */ - - - IMPORT_C TInt MathOperation( inpparam& aInput ); - - /** - * Trace function traces users location changes any change in users current location is notificed - * to user via call back function - * - * @param aCallBackObj callback object after reciving location updates - * @param aLocationInfoCategory specifying one of the enumeration in TLocationInfoType. - * @param aFiledList List of position fields that should be retrived - * @param aUpdateOptions update options for trace - * - * @see Lsbcommon.h for details of TPositionFieldIdList and TPositionUpdateOptions - */ - - IMPORT_C TInt TraceL(MLocationCallBack* aCallBackObj , - TInt aLocationInfoCategory = 0, - TPositionFieldIdList aFiledList = NULL , - const TPositionUpdateOptions* aUpateOptions= NULL ); - - - /** - * Method to cancell pending async request - * - * aCancelparam cancellation type (trace,getlocation) - * - * @see TCancelParam for cancellation options - */ - - IMPORT_C TInt CancelOnGoingService( TInt aCancelparam ) ; - - /** - * Method to fetch last known location from location server - */ - - TInt GetLastKnownLoc( TPosition& aResultPos ) ; - - - - - - protected: - /** - * internal method to construct class members - */ - void ConstructL() ; - - /** - * Default constructor - */ - CLocationService() ; - - /** - * Method to initalise class memebers - */ - void DoInitialiseL() ; - - private : - - /** - * Subsession used to fetch location information - */ - - RPositioner iPositioner; - - /** - * Session used for getting location information - */ - - RPositionServer iPosServer; - - /** - * Registration table for callbacks - */ - - RPointerArray iRegTable; - TInt iIndex; - - - /** - * Module indtifier used by location server for getting location information - */ - TPositionModuleId iModuleId ; - - }; - - -#endif // LOCATIONSERVICE_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_location/tsrc/testing/tsapiloctotest/src/sapiloctotestblocks.cpp --- a/serviceproviders/sapi_location/tsrc/testing/tsapiloctotest/src/sapiloctotestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_location/tsrc/testing/tsapiloctotest/src/sapiloctotestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -157,7 +157,7 @@ aRequestorStack.Insert(identityInfo,0); CoreObj->SetRequestorIdentityL(aRequestorStack) ;*/ - aRet = CoreObj->GetLocationL(&currpos); + TRAP(aRet,CoreObj->GetLocationL(&currpos)); if( KErrTimedOut == aRet ) { diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/inc/mginterface.h --- a/serviceproviders/sapi_mediamanagement/inc/mginterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/inc/mginterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -121,7 +121,7 @@ * @param void * @return void */ - void SendRequestL(const CLiwGenericParamList& aInParamList, TUint aTransactionID ,TBool aPostionBasedSearching ); + void SendRequestL(const CLiwGenericParamList& aInParamList, TUint aTransactionID ,TBool aPostionBasedSearching,MLiwNotifyCallback* aCallBack ); /** * Appends error message @@ -157,7 +157,7 @@ /** * Stores the instance of Service observer Class */ - CMgServiceObserver *iServiceObserver; + // CMgServiceObserver *iServiceObserver; /** * Error Message object diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/bwins/mediamanagementserviceu.def --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/bwins/mediamanagementserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/bwins/mediamanagementserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -4,3 +4,7 @@ ?NewL@CMgService@@SAPAV1@XZ @ 3 NONAME ; class CMgService * CMgService::NewL(void) ?State@CMgService@@QBEABW4TMgState@@XZ @ 4 NONAME ; enum TMgState const & CMgService::State(void) const ?GetThumbnailL@CMgService@@QAEXPAVMThumbnailObserver@@AAVTDesC16@@JHH@Z @ 5 NONAME ; void CMgService::GetThumbnailL(class MThumbnailObserver *, class TDesC16 &, long, int, int) + ?Cancel@CAsynchRequestManager@@QAEHJ@Z @ 6 NONAME ; int CAsynchRequestManager::Cancel(long) + ?NewL@CAsynchRequestManager@@SAPAV1@XZ @ 7 NONAME ; class CAsynchRequestManager * CAsynchRequestManager::NewL(void) + ?CreateMediaResolutionobjL@MediaResolutionFactory@@SAPAVMResolution@@AAVTDesC16@@0@Z @ 8 NONAME ; class MResolution * MediaResolutionFactory::CreateMediaResolutionobjL(class TDesC16 &, class TDesC16 &) + ?GetresolutionL@CImageResolution@@UAEHAAVTSize@@@Z @ 9 NONAME ; int CImageResolution::GetresolutionL(class TSize &) diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/eabi/mediamanagementserviceu.def --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/eabi/mediamanagementserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/eabi/mediamanagementserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -18,5 +18,8 @@ _ZTV16CVideoResolution @ 17 NONAME ; ## _ZTV18CThumbnailObserver @ 18 NONAME ; ## _ZTV20CThumbnailGeneration @ 19 NONAME ; ## - - + _ZTI21CAsynchRequestManager @ 20 NONAME ; ## + _ZTV21CAsynchRequestManager @ 21 NONAME ; ## + _ZN16CImageResolution14GetresolutionLER5TSize @ 22 NONAME + _ZN22MediaResolutionFactory25CreateMediaResolutionobjLER7TDesC16S1_ @ 23 NONAME + _ZThn4_N16CImageResolution14GetresolutionLER5TSize @ 24 NONAME ; ## diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/group/mediamanagementservice.mmp --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/group/mediamanagementservice.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/group/mediamanagementservice.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -33,7 +33,14 @@ SOURCEPATH ../src SOURCE mgservice.cpp SOURCE mgpostfilter.cpp -SOURCE mgclfoperationobserver.cpp mgthumbobserver.cpp mgthumbnailgeneration.cpp mgmresolution.cpp mgimageresolution.cpp mgvideoresolution.cpp mgmediacontainer.cpp +SOURCE mgclfoperationobserver.cpp +SOURCE mgthumbobserver.cpp +SOURCE mgthumbnailgeneration.cpp +SOURCE mgmresolution.cpp +SOURCE mgimageresolution.cpp +SOURCE mgvideoresolution.cpp +SOURCE mgmediacontainer.cpp +SOURCE asynchrequestmanager.cpp USERINCLUDE ../inc diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/asynchrequestmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/asynchrequestmanager.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __ASYNCHREQUESTMANAGER_H +#define __ASYNCHREQUESTMANAGER_H + +class CClfOperationObserver; + +/** + * Structure for storing transaction id and associated active object. +*/ +class TAsyncRequestInfo + { + + + public: + /** + * Constructor + * @since Series60 v3.2 + * @param void + * @return void + */ + TAsyncRequestInfo():iTransactionId( 0 ), + iAsyncObj( NULL ) + { + + } + + /** + * TransactionId + */ + TUint iTransactionId; + +// Instance of observer + CClfOperationObserver* iAsyncObj; + }; + + + + +/** +* This Class provides the core functionality of +* MediaManagement SAPI +* +* @since Series60 v3.2 +*/ +class CAsynchRequestManager : public CBase + { + + public: + + /** + * Returns the instance of CAsynchRequestManager. + * @since Series60 v3.2 + * @param void + * @return CAsynchRequestManager* return the instance of CAsynchRequestManager class + */ + IMPORT_C static CAsynchRequestManager* NewL(); + + /** + * Destructor. + */ + virtual ~CAsynchRequestManager(); + + + + /** + * Cancel the pending asynchronous request + * @since Series60 v3.2 + * @param aTransactionID Unique number to identify the request + * @return TInt System wide error code + */ + IMPORT_C TInt Cancel( TInt32 aTransactionID ); + + + + /** + * This function delete the callback object from the array + * corresponding to the given transaction id + * @since Series60 v3.2 + * @param aTransactionID Unique number to identify the callback + * @return void + */ + void RequestComplete( TInt32 aTransactionID ); + + + + + /** + * This function add the callback object for support multiple cancle operation + * @param aServiceObserver observer interface pointer provided by user for informing event. + * @return The observer for actually observing the underlying class events + * @since Series60 v3.2 + */ + void AddObserverL( CClfOperationObserver* aServiceObserver, TUint aTransactionID ); + + + private: + + /** + * Contains handles of all asynchronous requests + */ + RArray iAsyncObjArray; + + + }; + +#endif __ASYNCHREQUESTMANAGER_H diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgclfoperationobserver.h --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgclfoperationobserver.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgclfoperationobserver.h Thu Aug 27 07:43:07 2009 +0300 @@ -26,7 +26,9 @@ class MCLFItemListModel; class MMgOperationObserver; class CMgService; - +class CAsynchRequestManager; +class CPostFilter; +class MCLFSortingStyle; // CLASS DECLARATION @@ -85,7 +87,8 @@ void SetMemberVar(TUint aTransactionID, MMgOperationObserver* aServiceObserver, MCLFItemListModel* aListModel, - CMgService* aMGService); + CMgService* aMGService,CAsynchRequestManager* aAsyncReqManager, + CPostFilter* aFilter,MCLFSortingStyle* aSortingStyle); /** * Cancel the pending asynchronous request @@ -118,6 +121,23 @@ * stores the TransactionID */ TUint iTransactionID; + + /** + * stores AsyncRequestManager instance + */ + CAsynchRequestManager* iAsyncRequestManager; + + /** + * store the instance of CPostfilter which filters the result + * as per the set filter criteria + */ + CPostFilter* iFilter; + + /** + * store the instance of sorting style which sorts the result + * as per the set sort criteria + */ + MCLFSortingStyle* iSortingStyle; }; #endif __MGCLFOPERATIONOBSERVER_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgmresolution.h --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgmresolution.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgmresolution.h Thu Aug 27 07:43:07 2009 +0300 @@ -34,7 +34,7 @@ *@ return TBool If it gets the resolution then ETrue or else EFalse */ - virtual TBool GetresolutionL(TSize& aSize) = 0 ; + IMPORT_C virtual TBool GetresolutionL(TSize& aSize) = 0 ; public: /** @@ -54,7 +54,7 @@ class MediaResolutionFactory { public: - static MResolution* CreateMediaResolutionobjL(TDesC& aMedia, TDesC& aUrl); + IMPORT_C static MResolution* CreateMediaResolutionobjL(TDesC& aMedia, TDesC& aUrl); }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgservice.h --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/inc/mgservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -25,6 +25,7 @@ #include "mgservice.hrh" +class CAsynchRequestManager; class CPostFilter; class MCLFSortingStyle; class MMgOperationObserver; @@ -178,7 +179,8 @@ void SetSortingFieldL( const TDesC8& aSortField , const TDesC8& aOrder , const RArray& aMediaTypes, - MCLFItemListModel* alistModel ); + MCLFItemListModel* alistModel, + MCLFSortingStyle* aSortingStyle ); /** * It will set the metadata field and values on which the result @@ -191,12 +193,14 @@ * @param aEndVal End Value of the filter criteria * @param aMediaTypes specify the media type for which this * filtering should be performed + * @param aFilter It is instance of filter */ void SetFilterMetaDataL( const TDesC8& aFilterField, const TDesC& aStartVal, const TDesC& aEndVal, const RArray& aMediaTypes, - MCLFItemListModel* alistModel ); + MCLFItemListModel* alistModel, + CPostFilter* aFilter); /** * Two-phased constructor @@ -236,6 +240,9 @@ * @param aEndVal It specifies the end value for filter criteria * @param aSortField It specifies the field for sorting the result * @param aOrder It specifies the sorting order Ascending/Descending + * @param aListModel It stores the instance of Listmodel object + * @param aFilter It stores the instance of filter param + * @param aSortingStyle It stores the instance of MCLSortingStyle * @return System wide error code if the operation did not * succeed. */ @@ -245,7 +252,9 @@ const TDesC& aEndVal, const TDesC8& aSortField, const TDesC8& aOrder, - MCLFItemListModel* listModel ); + MCLFItemListModel* aListModel, + CPostFilter* aFilter, + MCLFSortingStyle* aSortingStyle ); /** * This function will check whether metadata is supported for @@ -289,18 +298,18 @@ * store the instance of CPostfilter which filters the result * as per the set filter criteria */ - CPostFilter* iFilter; + //CPostFilter* iFilter; /** * store the instance of sorting style which sorts the result * as per the set sort criteria */ - MCLFSortingStyle* iSortingStyle; + //MCLFSortingStyle* iSortingStyle; /** * store the instance of class which observes CLF event */ - CClfOperationObserver* iClfObserver; + //CClfOperationObserver* iClfObserver; /** * stores the Cuurent TransactionID @@ -308,10 +317,14 @@ TUint iTransactionID; /** - * stors the instance of iTumbnailGeneration + * stores the instance of TumbnailGeneration */ CThumbnailGeneration* iTumbnailGeneration; + /** + * stores the instance of AsyncRequestManager + */ + CAsynchRequestManager* iAsyncRequestManager; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/src/asynchrequestmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/asynchrequestmanager.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#include +#include + +#include "asynchrequestmanager.h" +#include "mgclfoperationobserver.h" + +// ----------------------------------------------------------------------------- +// CCAsynchRequestManager ::NewLC +// Returns the instance of CCAsynchRequestManager class. +// ----------------------------------------------------------------------------- +CAsynchRequestManager * CAsynchRequestManager ::NewL() + { + CAsynchRequestManager * self = new ( ELeave )CAsynchRequestManager (); + return self; + } + + +// ----------------------------------------------------------------------------- +// CCAsynchRequestManager ::~CCAsynchRequestManager +// Destructor +// ----------------------------------------------------------------------------- + +CAsynchRequestManager ::~CAsynchRequestManager () + { + + //Cancel All pending request + + TInt pos = iAsyncObjArray.Count() - 1; + TAsyncRequestInfo obj; + for ( ; pos >= 0; pos-- ) + { + obj = iAsyncObjArray[pos]; + //No need to inform for this cancel + + obj.iAsyncObj->CancelL(); + delete obj.iAsyncObj; + } + iAsyncObjArray.Close(); + + } + + + +// ----------------------------------------------------------------------------- +// CCAsynchRequestManager ::Cancel +// Cancel the pending asynchronous request +// ----------------------------------------------------------------------------- +TInt CAsynchRequestManager ::Cancel( TInt32 aTransactionID ) + { + + TInt pos = iAsyncObjArray.Count() - 1; + TAsyncRequestInfo obj; + for ( ; pos >= 0; pos-- ) + { + obj = iAsyncObjArray[pos]; + if( obj.iTransactionId == aTransactionID ) + { + obj.iAsyncObj->CancelL(); + delete obj.iAsyncObj; + return KErrNone; + } + } + return KErrNotFound; + + } + + +// ----------------------------------------------------------------------------- +// CCAsynchRequestManager ::RequestComplete +// This is called by the observer when asynch request complete +// ----------------------------------------------------------------------------- +void CAsynchRequestManager ::RequestComplete( TInt32 aTransactionID ) + + { + TInt pos = iAsyncObjArray.Count()-1; + TAsyncRequestInfo obj; + for ( ; pos >= 0; pos-- ) + { + obj = iAsyncObjArray[pos]; + if( obj.iTransactionId == aTransactionID ) + { + iAsyncObjArray.Remove(pos); + iAsyncObjArray.Compress(); + return; + } + } + } + +// ----------------------------------------------------------------------------- +// CAsynchRequestManager ::AddObserverL +// AddObserever +// ----------------------------------------------------------------------------- +void CAsynchRequestManager ::AddObserverL(CClfOperationObserver* aServiceObserver, TUint aTransactionID) + + { + // Add the given observer in array and return the laucher observer + // strutcure for binding the transaction ID and callback object + + TAsyncRequestInfo asyncRequestInfo; + asyncRequestInfo.iTransactionId = aTransactionID; + + //observer for observering underlying classes + asyncRequestInfo.iAsyncObj = aServiceObserver; + + User::LeaveIfError( iAsyncObjArray.Append( asyncRequestInfo ) ); + + } + + + + + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgclfoperationobserver.cpp --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgclfoperationobserver.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgclfoperationobserver.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -17,10 +17,13 @@ #include +#include #include "mgclfoperationobserver.h" #include "mgservice.h" #include "mgoperationobserver.h" +#include "asynchrequestmanager.h" +#include "mgpostfilter.h" // ----------------------------------------------------------------------------- @@ -59,6 +62,9 @@ { iServiceObserver->MgNotifyL( iTransactionID,iListModel, mgEvent, aError ); + + // calling request complete on asyncrequestmanager + iAsyncRequestManager->RequestComplete( iTransactionID ); //Ownership of the List model is transfered to the Iterator class iListModel = NULL; @@ -67,6 +73,8 @@ iServiceObserver = NULL; iMGService = NULL; + delete this; + } } @@ -81,14 +89,18 @@ void CClfOperationObserver::SetMemberVar( TUint aTransactionID, MMgOperationObserver* aServiceObserver, MCLFItemListModel* aListModel, - CMgService* aMGService ) + CMgService* aMGService,CAsynchRequestManager* aAsyncReqManager, + CPostFilter* aFilter,MCLFSortingStyle* aSortingStyle) { iServiceObserver = aServiceObserver; iListModel = aListModel; iMGService = aMGService; iTransactionID = aTransactionID; - + iAsyncRequestManager = aAsyncReqManager; + iFilter = aFilter; + iSortingStyle= aSortingStyle; + } @@ -124,7 +136,7 @@ CClfOperationObserver::~CClfOperationObserver() { - + // If this observer is waiting for response // then cancel the request if( iListModel ) @@ -134,10 +146,22 @@ iListModel = NULL;*/ CancelL(); } - + if(iAsyncRequestManager) + { + iAsyncRequestManager = NULL; + } + + if(iFilter) + { + delete iFilter; + } + if(iSortingStyle) + { + delete iSortingStyle; + } //In future at the time of supporting // back to back Calls we have to delete the iServiceOberver - + iServiceObserver = NULL; } // ----------------------------------------------------------------------------- diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgimageresolution.cpp --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgimageresolution.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgimageresolution.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -77,7 +77,7 @@ // CImageResolution::GetresolutionL // This method gets the resolution of image // ----------------------------------------------------------------------------- - TBool CImageResolution::GetresolutionL(TSize& aSize) + EXPORT_C TBool CImageResolution::GetresolutionL(TSize& aSize) { iFrameInfo = iImageDecoder->FrameInfo(); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgmresolution.cpp --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgmresolution.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgmresolution.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -37,7 +37,7 @@ // ----------------------------------------------------------------------------- -MResolution* MediaResolutionFactory::CreateMediaResolutionobjL(TDesC& aMedia, TDesC& aUrl) +EXPORT_C MResolution* MediaResolutionFactory::CreateMediaResolutionobjL(TDesC& aMedia, TDesC& aUrl) { MResolution* object = NULL; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgservice.cpp --- a/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgservice.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/mediamanagementservice/src/mgservice.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -29,6 +29,7 @@ #include "mgoperationobserver.h" #include "mgclfoperationobserver.h" #include "mgconsts.h" +#include"asynchrequestmanager.h" // Inclusion for thumbnail generation @@ -41,7 +42,8 @@ _LIT8( KMgImage ,"Image" ); _LIT8( KMgVideo ,"Video" ); _LIT8( KMgStreamingURL ,"StreamingURL" ); - +_LIT8(KAudio,"Audio"); +_LIT8(KAll,"All"); //SortingOrder _LIT8( KMgDescending, "Descending" ); @@ -70,7 +72,7 @@ { //release filter class - if(iFilter) + /* if(iFilter) { delete iFilter; } @@ -80,13 +82,13 @@ { delete iSortingStyle; } - + */ // release clf observer class - if(iClfObserver) + /* if(iClfObserver) { delete iClfObserver; } - + */ //release iEngine; if(iEngine) { @@ -98,6 +100,12 @@ { delete iTumbnailGeneration; } + + // deleting the instance of iAsyncRequestManager + if(iAsyncRequestManager) + { + delete iAsyncRequestManager; + } } @@ -117,19 +125,33 @@ //This has already been verified by SAPI interface class ,still this condition //is checked keeping in mind that this class may be called directly by a //Series60 application in future - if( EMgFree == iState ) - { - - - if( NULL != aServiceObserver )//Asynchronous request { + + //create the instance of clf observer + CClfOperationObserver* clfObserver = CClfOperationObserver::NewL(); + CleanupStack::PushL(clfObserver); + // create the instance of CLF list Model for the current request MCLFItemListModel* listModel = iEngine-> - CreateListModelLC( *iClfObserver ); + CreateListModelLC( *clfObserver ); +// CleanupStack::Pop(); + // CleanupStack::PushL(listModel); + // adding observer to asynrequestmanager + + //iAsyncRequestManager->AddObserverL(clfObserver,aInParameters.iTransactionID); + + // We need to make post filter and sorting style each for each call + + // create the instance of CPostFilter and store it in member data + CPostFilter* filter = CPostFilter::NewL(); + CleanupStack::PushL(filter); - + // Get the sorting style from CLF + MCLFSortingStyle* sortingStyle = ContentListingFactory::NewSortingStyleLC(); + + SendRequestToClfL( aInParameters.iFileType, aInParameters.iFilterField, @@ -137,31 +159,29 @@ aInParameters.iEndVal, aInParameters.iSortField, aInParameters.iOrder, - listModel ); + listModel,filter,sortingStyle ); - CleanupStack::Pop(); + CleanupStack::Pop();//sortingStyle + CleanupStack::Pop(filter); + CleanupStack::Pop(); //listModel + CleanupStack::Pop(clfObserver); //clfObserver + + iAsyncRequestManager->AddObserverL(clfObserver,aInParameters.iTransactionID); - iTransactionID = aInParameters.iTransactionID; - iClfObserver->SetMemberVar( aInParameters.iTransactionID, - aServiceObserver, - listModel, - this ); - - + // Adding aServiceObserver, listmodel instance , filter and sorting instance to observer + clfObserver->SetMemberVar( aInParameters.iTransactionID, + aServiceObserver, + listModel, + this ,iAsyncRequestManager, + filter,sortingStyle ); + } else { //Synchronous request handling is currently not supported User::Leave( KErrNotSupported ); - } - - }//SAPI State - else - { - User::Leave( KErrServerBusy ); // busy in previous request - } - + } } @@ -176,8 +196,9 @@ // but in future we have to find the iClfObserver // coresponding to this Transaction ID and Call cancel // on that observer - if( EMgBusy == iState ) +/* if( EMgBusy == iState ) { + // Need to change the implementation of cancel here LOK if( aTransactionID == iTransactionID ) { iClfObserver->CancelL( ); @@ -185,17 +206,30 @@ return KErrNone; } } - +*/ + TInt ret = KErrNone; + + ret = iAsyncRequestManager->Cancel(aTransactionID); + + if(KErrNotFound == ret ) + { + // Cancel request if for thumbnail + ret = CancelThumbnailReq(aTransactionID); + + } + + return ret ; // Calling cancel of thumbnail - if(aTransactionID != iTransactionID) + /*if(aTransactionID != iTransactionID) // Need to check this condion LOK { return CancelThumbnailReq(aTransactionID); } - return KErrArgument; + return KErrArgument;*/ } + // ----------------------------------------------------------------------------- // CMgService::CancelThumbnailReq // Cancel the pending asynchronous request for thumbnail generation @@ -212,7 +246,7 @@ void CMgService::Clear() { - iFilter->Clear(); + //iFilter->Clear(); iState = EMgFree; iTransactionID = 0; } @@ -244,7 +278,8 @@ void CMgService::SetSortingFieldL(const TDesC8& aSortField , const TDesC8& aOrder , const RArray& aMediaTypes, - MCLFItemListModel* alistModel ) + MCLFItemListModel* alistModel, + MCLFSortingStyle* aSortingStyle ) { // Default sorting as per file name @@ -269,22 +304,22 @@ } } - iSortingStyle->ResetL(); + aSortingStyle->ResetL(); //Set the field on which sorting has to perform - iSortingStyle->AddFieldL( metaDataId ); + aSortingStyle->AddFieldL( metaDataId ); // Set the sorting field data type - iSortingStyle->SetSortingDataType( metaDataType ); + aSortingStyle->SetSortingDataType( metaDataType ); if( 0 == aOrder.CompareF( KMgDescending ) ) { - iSortingStyle->SetOrdering( ECLFOrderingDescending ); + aSortingStyle->SetOrdering( ECLFOrderingDescending ); } else if( 0 == aOrder.CompareF( KMgAscending) ) { - iSortingStyle->SetOrdering( ECLFOrderingAscending ); + aSortingStyle->SetOrdering( ECLFOrderingAscending ); } else { @@ -292,10 +327,10 @@ } //Items with undefined fields are placed after items with defined fields - iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd ); + aSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd ); // set sorting style in CLF. - alistModel->SetSortingStyle( iSortingStyle ); + alistModel->SetSortingStyle( aSortingStyle ); } @@ -309,7 +344,8 @@ const TDesC& aStartVal, const TDesC& aEndVal, const RArray& aMediaTypes, - MCLFItemListModel* alistModel ) + MCLFItemListModel* alistModel, + CPostFilter* aFilter) { TCLFDefaultFieldId metaDataId; TCLFItemDataType metaDataType; @@ -322,7 +358,7 @@ { metaDataId = ECLFFieldIdNull; metaDataType = ECLFItemDataTypeDesC; // Blank Descriptor - iFilter->SetFilterMetaData( metaDataId, metaDataType ); + aFilter->SetFilterMetaData( metaDataId, metaDataType ); } else { @@ -338,13 +374,13 @@ } - iFilter->SetFilterMetaData( metaDataId, metaDataType ); + aFilter->SetFilterMetaData( metaDataId, metaDataType ); // set filter value of CLF - iFilter->SetFilterValueL( aStartVal,aEndVal ); + aFilter->SetFilterValueL( aStartVal,aEndVal ); // Set Post Filter in CLF - alistModel->SetPostFilter( iFilter ); + alistModel->SetPostFilter( aFilter ); } @@ -363,18 +399,11 @@ CleanupStack::Pop(); - // create the instance of CPostFilter and store it in member data - iFilter = CPostFilter::NewL(); - - // Get the sorting style from CLF - iSortingStyle = ContentListingFactory::NewSortingStyleLC(); - CleanupStack::Pop(); - - //create the instance of clf observer - iClfObserver = CClfOperationObserver::NewL(); + // creates instance for thumbnailgeneration calss + iTumbnailGeneration = CThumbnailGeneration::NewL(); - // creates instance for async requestmanager for thumbnail - iTumbnailGeneration = CThumbnailGeneration::NewL(); + //creates the instance of async request manager for getlist + iAsyncRequestManager = CAsynchRequestManager::NewL(); } @@ -388,15 +417,12 @@ CMgService::CMgService() : iState( EMgFree ), iEngine( NULL ), - iFilter( NULL ), - iSortingStyle( NULL ), - iClfObserver( NULL ), - iTransactionID( 0 ), - iTumbnailGeneration(NULL) - { + iTransactionID( 0 ), + iTumbnailGeneration(NULL), + iAsyncRequestManager(NULL) + { - } - + } // ----------------------------------------------------------------------------- @@ -408,8 +434,15 @@ void CMgService::SetMediaTypeL (const TDesC8& aFileType, RArray& aMediaType) { - - if( 0 == aFileType.CompareF( KMgMusic ) ) + if(0 == aFileType.CompareF( KAll )) + { + aMediaType.AppendL( ECLFMediaTypeMusic ); + aMediaType.AppendL( ECLFMediaTypeSound ); + aMediaType.AppendL( ECLFMediaTypeImage ); + aMediaType.AppendL( ECLFMediaTypeVideo ); + //aMediaType.AppendL( ECLFMediaTypeStreamingURL ); Not supported by MDS till now + } + else if( 0 == aFileType.CompareF( KMgMusic ) ) { aMediaType.AppendL( ECLFMediaTypeMusic ); } @@ -432,6 +465,11 @@ { aMediaType.AppendL( ECLFMediaTypeStreamingURL ); } + else if(0 == aFileType.CompareF( KAudio )) + { + aMediaType.AppendL( ECLFMediaTypeMusic ); + aMediaType.AppendL( ECLFMediaTypeSound ); + } else { User::Leave ( KErrArgument ); // Media Type Not suuported @@ -458,7 +496,9 @@ const TDesC& aEndVal, const TDesC8& aSortField, const TDesC8& aOrder, - MCLFItemListModel* alistModel ) + MCLFItemListModel* alistModel , + CPostFilter* aFilter, + MCLFSortingStyle* aSortingStyle) { @@ -475,12 +515,12 @@ // Set Filter Meta Data and Value - SetFilterMetaDataL( aFilterField,aStartVal,aEndVal,mediaTypes,alistModel); + SetFilterMetaDataL( aFilterField,aStartVal,aEndVal,mediaTypes,alistModel,aFilter); // call set sorting field of CLF - SetSortingFieldL( aSortField,aOrder,mediaTypes,alistModel ); + SetSortingFieldL( aSortField,aOrder,mediaTypes,alistModel ,aSortingStyle); // set the state = Busy // till this request is complete diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/src/mginterface.cpp --- a/serviceproviders/sapi_mediamanagement/src/mginterface.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/src/mginterface.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -125,8 +125,8 @@ { //Release the instance of service observer class - delete iServiceObserver; - iServiceObserver = NULL; + // delete iServiceObserver; + // iServiceObserver = NULL; //Release the instance of core class delete iCoreClass; @@ -255,26 +255,15 @@ || ( 0 == dsName.CompareF( KFile ) ) ) { // check if core class ready to accept request - if( EMgFree == iCoreClass->State() ) - { + /* if( EMgFree == iCoreClass->State() ) + {*/ if( aCmdOptions & KLiwOptASyncronous ) //Asynchronous request { if( NULL != aCallBack ) // Asynchronous call { transactionID = aCallBack->GetTransactionID(); - if( 0 == dsName.CompareF( KFileInfo ) ) - { - iServiceObserver->SetMemberVar( EMgGetFilesInfo, - NULL,aCallBack ); - } - else - { - iServiceObserver->SetMemberVar( EMgGetFiles, - NULL,aCallBack ); - } - //Sending request to core class - TRAP (errCode,SendRequestL( aInParamList , transactionID ,postionbasedsearching )); + TRAP (errCode,SendRequestL( aInParamList , transactionID ,postionbasedsearching,aCallBack )); } else //Callback missing @@ -291,12 +280,12 @@ errCode = KErrNotFound; }//synchronous request - }//Sapi status + /*}//Sapi status else { AppendErrorMessageL( aCmdName, KNullDesC8, KServerBusy ); errCode = KErrServerBusy; - } + }*/ }//Data Source support else @@ -378,8 +367,8 @@ // ----------------------------------------------------------------------------- CMgInterface::CMgInterface() - :iCoreClass( NULL ), - iServiceObserver( NULL ) + :iCoreClass( NULL ) + { } @@ -396,7 +385,7 @@ iCoreClass = CMgService::NewL(); //Create the instance of service observer class - iServiceObserver = CMgServiceObserver::NewL(); + //iServiceObserver = CMgServiceObserver::NewL(); } @@ -407,7 +396,7 @@ // This function will send the request to Core class // ----------------------------------------------------------------------------- -void CMgInterface::SendRequestL(const CLiwGenericParamList& aInParamList , TUint aTransactionID , TBool aPostionBasedSearching ) +void CMgInterface::SendRequestL(const CLiwGenericParamList& aInParamList , TUint aTransactionID , TBool aPostionBasedSearching , MLiwNotifyCallback* aCallBack) { TInt pos=0; @@ -653,8 +642,18 @@ }//sort map - iCoreClass->GetListL( requestParam,iServiceObserver ) ; - + // Need to give seperate observer for each call + + // Creating instance of serviceobserver for back to back callback support + + CMgServiceObserver* serviceObserver = CMgServiceObserver::NewL(); + CleanupStack::PushL(serviceObserver); + // For supporting back to back callback + serviceObserver->SetMemberVar( EMgBlankCmdId, + NULL,aCallBack ); + + iCoreClass->GetListL( requestParam,serviceObserver ) ; + CleanupStack::Pop(serviceObserver); //Sorting is an optional parameter, if it is present only then sorting fields and order present in stack diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/src/mgmediaitem.cpp --- a/serviceproviders/sapi_mediamanagement/src/mgmediaitem.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/src/mgmediaitem.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -19,7 +19,7 @@ #include #include #include - +#include "mgmresolution.h" #include "mgmediaitem.h" @@ -32,11 +32,15 @@ _LIT8( KMgMediaType, "MediaType" ); _LIT8( KMgMimeType, "MimeType" ); _LIT8( KType, "Type"); +_LIT8(KXPixels, "XPixels"); +_LIT8(KYPixels, "YPixels"); _LIT( EMgPhoneMemory,"C:" ); _LIT( EMgMmc,"E:" ); _LIT( KMediaType, "Media"); +_LIT( KImageType, "image"); const TInt KMemoryNameLength = 2; +const TInt KImgLen = 20; // --------------------------------------------------------------------------- // CMgMediaItem::FillCommonAttributesL @@ -55,6 +59,8 @@ TInt32 size; TPtrC mimeType; TInt32 mediaType; + TBuf mediaImage; + mediaImage.Append( KImageType ); if( KErrNone == aClfItem.GetField( ECLFFieldIdFileNameAndPath, fullName ) ) @@ -91,9 +97,19 @@ aOutputMap->InsertL( KMgFileDate,TLiwVariant( time ) ); aOutputMap->InsertL( KMgFileSize,TLiwVariant( size ) ); + if ( mediaType == ECLFMediaTypeImage ) + { + TSize imageRes( 0,0 ); + MResolution* mediaResObj = MediaResolutionFactory::CreateMediaResolutionobjL( mediaImage,fullName ); + CleanupStack::PushL( mediaResObj ); + mediaResObj->GetresolutionL( imageRes ); + aOutputMap->InsertL( KXPixels,(TInt32)imageRes.iWidth ); + aOutputMap->InsertL( KYPixels,(TInt32)imageRes.iHeight ); + CleanupStack::Pop( mediaResObj ); + delete mediaResObj; + } } - diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/src/mgserviceobserver.cpp --- a/serviceproviders/sapi_mediamanagement/src/mgserviceobserver.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/src/mgserviceobserver.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -131,7 +131,10 @@ iCmdId = EMgBlankCmdId; iCallBack = NULL; iInput=NULL; - + + // For back to back call observer instance should be deleted here + delete this; + } @@ -170,6 +173,9 @@ iInput = NULL; iCmdId= EMgBlankCmdId; } + // For back to back call support + delete this; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/performance/s60_perf/src/mgservice.cpp --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/performance/s60_perf/src/mgservice.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/performance/s60_perf/src/mgservice.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -68,14 +68,14 @@ delete iEngine; //release filter class - delete iFilter; + //delete iFilter; // release sorting style - delete iSortingStyle; + // delete iSortingStyle; // release clf observer class - delete iClfObserver; + // delete iClfObserver; } @@ -212,7 +212,8 @@ void CMgService::SetSortingFieldL(const TDesC8& aSortField , const TDesC8& aOrder , const RArray& aMediaTypes, - MCLFItemListModel* alistModel ) + MCLFItemListModel* alistModel , + MCLFSortingStyle* aSortingStyle ) { // Default sorting as per file name @@ -236,30 +237,36 @@ User::Leave( KErrArgument ); } } - - iSortingStyle->ResetL(); + aSortingStyle->ResetL(); + //iSortingStyle->ResetL(); //Set the field on which sorting has to perform - iSortingStyle->AddFieldL( metaDataId ); + aSortingStyle->AddFieldL( metaDataId ); + //iSortingStyle->AddFieldL( metaDataId ); // Set the sorting field data type - iSortingStyle->SetSortingDataType( metaDataType ); + aSortingStyle->SetSortingDataType( metaDataType ); + //iSortingStyle->SetSortingDataType( metaDataType ); if( 0 == aOrder.CompareF( KMgDescending ) ) { - iSortingStyle->SetOrdering( ECLFOrderingDescending ); + + aSortingStyle->SetOrdering( ECLFOrderingDescending ); + //iSortingStyle->SetOrdering( ECLFOrderingDescending ); } else { - iSortingStyle->SetOrdering( ECLFOrderingAscending ); + aSortingStyle->SetOrdering( ECLFOrderingAscending ); + //iSortingStyle->SetOrdering( ECLFOrderingAscending ); } //Items with undefined fields are placed after items with defined fields - iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd ); + aSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd ); + //iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd ); // set sorting style in CLF. - alistModel->SetSortingStyle( iSortingStyle ); + alistModel->SetSortingStyle( aSortingStyle ); } @@ -273,7 +280,8 @@ const TDesC& aStartVal, const TDesC& aEndVal, const RArray& aMediaTypes, - MCLFItemListModel* alistModel ) + MCLFItemListModel* alistModel, + CPostFilter* aFilter) { TCLFDefaultFieldId metaDataId; TCLFItemDataType metaDataType; @@ -286,7 +294,8 @@ { metaDataId = ECLFFieldIdNull; metaDataType = ECLFItemDataTypeDesC; // Blank Descriptor - iFilter->SetFilterMetaData( metaDataId, metaDataType ); + aFilter->SetFilterMetaData( metaDataId, metaDataType ); + //iFilter->SetFilterMetaData( metaDataId, metaDataType ); } else { @@ -301,14 +310,15 @@ User::Leave( KErrNotSupported ); } - - iFilter->SetFilterMetaData( metaDataId, metaDataType ); + aFilter->SetFilterMetaData( metaDataId, metaDataType ); + //iFilter->SetFilterMetaData( metaDataId, metaDataType ); // set filter value of CLF - iFilter->SetFilterValueL( aStartVal,aEndVal ); + aFilter->SetFilterValueL( aStartVal,aEndVal ); + //iFilter->SetFilterValueL( aStartVal,aEndVal ); // Set Post Filter in CLF - alistModel->SetPostFilter( iFilter ); + alistModel->SetPostFilter( aFilter ); } @@ -328,14 +338,14 @@ // create the instance of CPostFilter and store it in member data - iFilter = CPostFilter::NewL(); +// iFilter = CPostFilter::NewL(); // Get the sorting style from CLF - iSortingStyle = ContentListingFactory::NewSortingStyleLC(); - CleanupStack::Pop(); +// iSortingStyle = ContentListingFactory::NewSortingStyleLC(); + // CleanupStack::Pop(); //create the instance of clf observer - iClfObserver = CClfOperationObserver::NewL(); + // iClfObserver = CClfOperationObserver::NewL(); } @@ -349,9 +359,6 @@ CMgService::CMgService() : iState( EMgFree ), iEngine( NULL ), - iFilter( NULL ), - iSortingStyle( NULL ), - iClfObserver( NULL ), iTransactionID( 0 ) { @@ -418,7 +425,9 @@ const TDesC& aEndVal, const TDesC8& aSortField, const TDesC8& aOrder, - MCLFItemListModel* alistModel ) + MCLFItemListModel* alistModel , + CPostFilter* aFilter, + MCLFSortingStyle* aSortingStyle) { @@ -435,12 +444,12 @@ // Set Filter Meta Data and Value - SetFilterMetaDataL( aFilterField,aStartVal,aEndVal,mediaTypes,alistModel); + SetFilterMetaDataL( aFilterField,aStartVal,aEndVal,mediaTypes,alistModel,aFilter); // call set sorting field of CLF - SetSortingFieldL( aSortField,aOrder,mediaTypes,alistModel ); + SetSortingFieldL( aSortField,aOrder,mediaTypes,alistModel, aSortingStyle); // set the state = Busy // till this request is complete diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/conf/tmediamgmttest_BackToBackCall.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/conf/tmediamgmttest_BackToBackCall.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,127 @@ +################################################################ Sound #################################################### +/* +NOTE: +1. NULL input means not passing any value for the placeholder +2. NullValue means a NULL is passed as value to the placeholder +3. "NULL" as input to a parameter means a Null string or a string of value "NULL" is passed as input +4. All the fields in input is mandatory, if no value is to be passed for any field, a value NULL can be passed. And if NULL is to be passed as value, then + value "NULLVALUE" needs to be passed. +5. The key-value pair in Expected output can be in any order and all are optional. + + +Requirements: +The following sound files are expected to be present at the mentioned locations. All the cases below are written based on this assumption. +The expected output is as per this list. + +The Expected output is of the form where all fields of each map is written in between two keys StartMap and EndMap +All the maps are written between two key words ExpectedStart and ExpectedEnd, as shown below + +FileNameAndPath: Expected o/p format for each file: +c:\data\others\music.wav StartMap Type Media FileName music FileExtension .wav Drive c: FileSize 22965 FileDate 20081019:033638 FileNameAndPath c:\data\others\music.wav MimeType AUDIO/WAV EndMap +e:\data\sound\digital\noise.amr StartMap Type Media FileName noise FileExtension .amr Drive e: FileSize 25031 FileDate 20081109:085028 FileNameAndPath e:\data\sounds\digital\noise.amr MimeType AUDIO/AMR EndMap +c:\data\sound\digital\raaga.wav startMap Type Media FileName raaga FileExtension .wav Drive c: FileSize 22965 FileDate 20081019:033638 FileNameAndPath c:\data\sounds\digital\raaga.wav MimeType AUDIO/WAV EndMap +e:\data\sound\digital\rock_on.wav StartMap Type Media FileName rock_on FileExtension .wav Drive e: FileSize 22965 FileDate 20081019:033638 FileNameAndPath e:\data\sounds\digital\rock_on.wav MimeType AUDIO/WAV EndMap +c:\data\sound\digital\sound.amr StartMap Type Media FileName sound FileExtension .amr Drive c: FileSize 25031 FileDate 20081109:085028 FileNameAndPath c:\data\sounds\digital\sound.amr MimeType AUDIO/AMR EndMap +c:\data\sound\digital\tempo.wav StartMap Type Media FileName tempo FileExtension .wav Drive c: FileSize 22965 FileDate 20081019:033638 FileNameAndPath c:\data\sounds\digital\tempo.wav MimeType AUDIO/WAV EndMap + + + +//Testcase format: +//Description of the testcase +//Input: Input values +//Expected:(+ve/-ve case) Expected output or behaviour +[Test] +title Sample +create tmediaprovidertesting foobar +//foobar GetFilesListL ExpectedStart StartMap Type FileName Drive FileSize FileDate FileNameAndPath MimeType EndMap ExpectedEnd +foobar GetFilesListL FileInfo Sound FileName tempo NULL NULL NULL 0 ExpectedStart StartMap Type Media FileName tempo FileExtension .wav Drive c: FileSize 22965 FileDate 20081019:033638 FileNameAndPath c:\data\sounds\digital\tempo.wav MimeType AUDIO/WAV EndMap ExpectedEnd +delete foobar +[Endtest] + +*/ + +############################################### Test cases starts ############################################### + +#########################################Type==“FileInfo” + Passing Filter Map with FileType==Sound + Key+Start Range############################ + + +//First back to back call for getlist +//Input: Image files with Ascending sort order and Music type with Filter FileName Music1 +//Expected: list of Image and music files , Image files in ascending order and Music file with FileName music1.mp3 +//FileInfo Image NULL NULL NULL FileName Ascending 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap ExpectedEnd FileInfo Music SongName music1.mp3 NULL NULL NULL 0 ExpectedStart StartMap FileName music1 SongName music1.mp3 EndMap ExpectedEnd +[Test] +title BToB_ImageAndMusic +create tmediaprovidertesting foobar +foobar GetListBackToBackCall FileInfo Image NULL NULL NULL FileName Ascending 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap ExpectedEnd FileInfo Music SongName music1.mp3 NULL NULL NULL 0 ExpectedStart StartMap FileName music1 SongName music1.mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + +//Second back to back call for getlist +//Input: Image type with Ascending Order , sound files with FileName tempo +//Expected: list of Image and Sound type filter FileName tempo +//FileInfo Image NULL NULL NULL FileName Ascending 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap ExpectedEnd FileInfo Sound FileName tempo NULL NULL NULL 0 ExpectedStart StartMap FileName tempo EndMap ExpectedEnd +[Test] +title BToB_ImageAndSound +create tmediaprovidertesting foobar +foobar GetListBackToBackCall FileInfo Image NULL NULL NULL FileName Ascending 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap ExpectedEnd FileInfo Sound FileName tempo NULL NULL NULL 0 ExpectedStart StartMap FileName tempo EndMap ExpectedEnd +delete foobar +[Endtest] + +//Third back to back call for getlist +//Input: Image type with Ascending Order , Video file with .3gp FileExtension +//Expected: list of Image in Ascending order and Video type filter FileExtension .3gp +//FileInfo Image NULL NULL NULL FileName Ascending 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video2 FileExtension .3gp EndMap StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +[Test] +title BToB_ImageAndVideo +create tmediaprovidertesting foobar +foobar GetListBackToBackCall FileInfo Image NULL NULL NULL FileName Ascending 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video5 FileExtension .3gp EndMap StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +delete foobar +[Endtest] + +//Fourth back to back call for getlist +//Input: Image type with Descending Order , Video file with .3gp FileExtension +//Expected: list of Image in Descending order and Video type filter FileExtension .3gp +//FileInfo Image NULL NULL NULL FileName Descending 0 ExpectedStart StartMap FileName blue EndMap StartMap FileName ant EndMap StartMap FileName a EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video2 FileExtension .3gp EndMap StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +[Test] +title BToB_ImageDesAndVideo +create tmediaprovidertesting foobar +foobar GetListBackToBackCall FileInfo Image NULL NULL NULL FileName Descending 0 ExpectedStart StartMap FileName blue EndMap StartMap FileName ant EndMap StartMap FileName a EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +delete foobar +[Endtest] + +//Fifth back to back call for getlist +//Input: Image type FileName blue , Video file with .3gp FileExtension +//Expected: list of Image in Descending order and Video type filter FileExtension .3gp +//FileInfo Image FileName blue NULL NULL NULL 0 ExpectedStart StartMap FileName blue EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video2 FileExtension .3gp EndMap StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +[Test] +title BToB_ImageBlueAndVideo +create tmediaprovidertesting foobar +foobar GetListBackToBackCall FileInfo Image FileName blue NULL NULL NULL 0 ExpectedStart StartMap FileName blue EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +delete foobar +[Endtest] + +//Sixth back to back call for getlist +//Input: Type Sound FileSize 25031 , Music files present in C: Drive and sorted by Artist in Ascending order +//Expected: list of Image in Descending order and Music +//FileInfo Image FileName blue NULL NULL NULL 0 ExpectedStart StartMap FileName blue EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video2 FileExtension .3gp EndMap StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +[Test] +title BToB_SoundFileSizeAndVideo +create tmediaprovidertesting foobar +foobar GetListBackToBackCall FileInfo Sound FileSize 25031 NULL NULL NULL 0 ExpectedStart StartMap FileName sound FileSize 25031 EndMap ExpectedEnd FileInfo music Drive c: NULL Artist Ascending 0 ExpectedStart StartMap FileName music1 Artist Lata EndMap StartMap FileName music2 Artist Rafi EndMap StartMap FileName music3 Artist Sonu EndMap ExpectedEnd +delete foobar +[Endtest] + +//Seven back to back call for getlist +//Input: Type is Null , Sound file with FileNameAndPath c:\data\sounds\digital\tempo.wav +//Expected: list of Image in Descending order and Music +//FileInfo Image FileName blue NULL NULL NULL 0 ExpectedStart StartMap FileName blue EndMap ExpectedEnd FileInfo Video FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video2 FileExtension .3gp EndMap StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +[Test] +title BToB_EmptyTypeAndSoundFlnPath +create tmediaprovidertesting foobar +//foobar GetListBackToBackCall FileInfo "" NULL NULL NULL NULL NULL 1002 FileInfo Sound FileNameAndPath c:\data\sounds\digital\tempo.wav NULL NULL NULL 0 ExpectedStart StartMap FileNameAndPath c:\data\sounds\digital\tempo.wav EndMap ExpectedEnd +foobar GetListBackToBackCall FileInfo "" NULL NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + +############################################ End Sound ################################################# \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/conf/tmediamgmttest_all.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/conf/tmediamgmttest_all.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,2124 @@ + /* =========================================================================== + * Copyright © 2006-2007 Nokia Corporation. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia Corporation. All rights are reserved. Copying, + * including reproducing, storing, adapting or translating, any + * or All of this material requires the prior written consent of + * Nokia Corporation. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia Corporation. + * ============================================================================ + Expected aaaa aaaa aaaa aaaa aaaa aaaa aaaa Next Bbbb bbb bbb bbb bbb bbb bbb End + + */ + +/*key startRange endRange sortKey sortOrder errorcode +[Expected type fileName fileExtension drive fileSize fileDate fileNameAndPath mimeType +[Next "next map data" End]]. +*/ +################################################## All ################################################### +/* +NOTE: +1. NULL input means not passing any value for the placeholder +2. NULLVALUE means a NULL is passed as value to the placeholder +3. "NULL" as input to a parameter means a Null string or a string of value "NULL" is passed as input +4. All the fields in input is mandatory, if no value is to be passed for any field, a value NULL can be passed. And if NULL is to be passed as value, then + value "NULLVALUE" needs to be passed. +5. The key-value pair in Expected output can be in any order and All are optional. + + +Requirements: +The following image files are expected to be present at the mentioned locations. All the cases below are written based on this assumption. +The expected output is as per this list. + +The Expected output is of the form where All fields of each map is written in between two keys StartMap and EndMap +All the maps are written between two key words ExpectedStart and ExpectedEnd, as shown below + +FileNameAndPath: Expected o/p for the file in format mentioned below: +c:\data\Images\a.jpg StartMap Type Media FileName a FileExtension .jpg Drive c: FileSize 31097 FileDate 20070920:053905 FileNameAndPath c:\data\Images\a.jpg MimeType image/jpeg EndMap +c:\data\Images\ant.jpg StartMap Type Media FileName ant FileExtension .jpg Drive c: FileSize 8474 FileDate 20060819:102426 FileNameAndPath c:\data\Images\ant.jpg MimeType image/jpeg EndMap +c:\data\Images\blue.png StartMap Type Media FileName blue FileExtension .png Drive c: FileSize 4796 FileDate 20070302:120443 FileNameAndPath c:\data\Images\blue.png MimeType image/png EndMap +c:\data\Images\pictures\dreams.bmp StartMap Type Media FileName dreams FileExtension .bmp Drive c: FileSize 73105 FileDate 20070108:015537 FileNameAndPath c:\data\Images\pictures\dreams.bmp MimeType image/bmp EndMap +e:\data\Images\stars.jpg StartMap Type Media FIleName stars FileExtension .jpg Drive e: FileSize 24790 FileDate 20081019:033638 FileNameAndPath e:\data\Images\stars.jpg MimeType image/jpeg EndMap + + + +//Testcase format: +//Description of the testcase +//Input: Input values +//Expected:(+ve/-ve case) Expected output or behaviour +[Test] +title Sample +create tmediaprovidertesting foobar +//foobar GetFilesListL ExpectedStart StartMap Type FileName Drive FileSize FileDate FileNameAndPath MimeType EndMap ExpectedEnd +foobar GetFilesListL FileInfo Image FileName a NULL NULL NULL 0 ExpectedStart StartMap Type Media FileName a FileExtension .jpg Drive c: FileSize 31097 FileDate 20070920:053905 FileNameAndPath c:\data\Images\a.jpg MimeType image/jpeg EndMap ExpectedEnd +delete foobar +[Endtest] + +*/ +############################################### Test cases starts ############################################### + +//GetList with value "FileInfo" for Type input and no other input parameters +//Input: FileInfo as Type, other inputs are NULL +//Expected: errorcode 1003- MissingArgumentType error as the mandatory FileType input is missing +[Test] +title All_FileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName tempo NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList of All files by FileName, no startrange +//Input: FileName as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType is expected o/p as the startrange is mandatory when Key is mentioned +[Test] +title AllNeg_FileNameKeywithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList of All files by key SongName, no startrange +//Input: SongName as key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AllNeg_SongNameKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All SongName NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList of All files by key Artist, no startrange +//Input: Artist as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AllNeg_ArtistKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Artist NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList of All files by key Album, no startrange +//Input: Album as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AllNeg_AlbumKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Album NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList of All files by key TrackNumber, no startrange +//Input: TrackNumber as Key and Null startrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title AllNeg_TrackNumberKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All TrackNumber NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of All files by key Genre, no startrange +//Input: Genre as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AllNeg_GenreKey_WithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Genre NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList of All files by key Composer, no startrange +//Input: Composer as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AllNeg_ComposerKey_WithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Composer NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList with startrange for FileName +//Input: FileName as Key, music1 as startrange +//Expected: list of All files with FileName music1, sorted in ascending order based on FileName, which is the default sort key and order +[Test] +title All_FileNameKeyWithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName tempo NULL NULL NULL 0 ExpectedStart StartMap FileName tempo EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of All files by MimeType +//Input: MimeType as Key, AUDIO/MPEG as startrange +//Expected: list of All files with MimeType AUDIO/MPEG are expected +[Test] +title All_MimeTypeKey_Audio/mpegStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType AUDIO/MPEG NULL NULL NULL 0 ExpectedStart StartMap FileName music1 MimeType AUDIO/MPEG EndMap StartMap FileName music2 MimeType AUDIO/MPEG EndMap StartMap FileName music3 MimeType AUDIO/MPEG EndMap StartMap FileName music4 MimeType AUDIO/MPEG EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of All files by FileNameAndPath +//Input: FileNameAndPath as Key and c:\data\sounds\digital\music2.mp3 as startrange +//Expected: list of All files with file path c:\data\sounds\digital\music2.mp3 is expected +[Test] +title All_FileNameAndPathKey_WithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath c:\data\sounds\digital\music2.mp3 NULL NULL NULL 0 ExpectedStart StartMap FileNameAndPath c:\data\sounds\digital\music2.mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + + //This case is removed as we are not able to get SongName field from the underlying +//A bug with ID: RCHA-7N2938 has been raised for the same +//GetList of All files by key SongName +//Input: SongName as Key and music1 as startrange +//Expected: list of All files with SongName as music1 is expected +[Test] +title All_SongNameKey_music1.mp3StartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All SongName music1.mp3 NULL NULL NULL 0 ExpectedStart StartMap FileName music1 SongName music1.mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList of All files by key Artist +//Input: Artist as Key Rafi as startrange +//Expected: list of All files with Artist Rafi is expected +[Test] +title All_ArtistKey_WithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Artist Rafi NULL NULL NULL 0 ExpectedStart StartMap FileName music2 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of All files by key Album +//Input: Album as Key and Shaheed as startrange +//Expected: list of All files with Album value as Shaheed is expected +[Test] +title All_AlbumKey_WithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Album Shaheed NULL NULL NULL 0 ExpectedStart StartMap FileName music2 Album Shaheed EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of All files by key Genre +//Input: Genre as Key and Rock as startrange +//Expected: list of All files with Genre as Rock is expected +[Test] +title All_GenreKeyWithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Genre Rock NULL NULL NULL 0 ExpectedStart StartMap FileName music1 Genre Rock EndMap StartMap FileName music4 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of All files by key Composer +//Input: Composer as Key and malik as startrange +//Expected: list of All with Composer as Malik +[Test] +title All_ComposerKeyWithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Composer Malik NULL NULL NULL 0 ExpectedStart StartMap FileName music4 Composer Malik EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with null string as value for FileNameAndPath +//Input: FileNameAndPath as Key and a null string "null" as startrange +//Expected: errorcode 0 and empty list +[Test] +title All_FileNameAndPathKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with integer value for FileName +//Input: FileName as Key and an integer value 12 as startrange +//Expected: errorcode 0 and empty list as there are no All files with this name +[Test] +title All_IntegerStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName 12 NULL NULL NULL 0 +delete foobar +[Endtest] + +##################################### Type==“FileInfo” + Passing Filter Map with FileType==All + Sort Map ################################# + +//GetList with Ascending order for a given drive +//Input: Drive as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on drive +[Test] +title All_SortAscendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Genre Rock NULL Drive Ascending 0 ExpectedStart StartMap FileName music1 Genre Rock EndMap StartMap FileName music4 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given drive +//Input: Drive as SortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on drive +[Test] +title All_SortDescendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Genre Rock NULL Drive Descending 0 ExpectedStart StartMap FileName music4 Genre Rock EndMap StartMap FileName music1 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileExtension +//Input: FileExtension as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on FileExtension +[Test] +title All_SortAscendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileExtension Ascending 0 ExpectedStart StartMap FileName music4 FileExtension .mp3 EndMap StartMap FileName music5 FileExtension .rm EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileExtension +//Input: FileExtension as SortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on FileExtensions +[Test] +title All_SortDescendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileExtension Descending 0 ExpectedStart StartMap FileName music5 FileExtension .rm EndMap StartMap FileName music4 FileExtension .mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given MimeType +//Input: MimeType as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on MimeType +[Test] +title All_SortAscendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL MimeType Ascending 0 ExpectedStart StartMap FileName music4 MimeType AUDIO/MPEG EndMap StartMap FileName music5 MimeType audio/x-pn-realaudio EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given MimeType +//Input: MimeType as sortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on MimeType +[Test] +title All_SortDescendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL MimeType Descending 0 ExpectedStart StartMap FileName music5 MimeType audio/x-pn-realaudio EndMap StartMap FileName music4 MimeType AUDIO/MPEG EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileSize +//Input: FileSize as sortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on FileSize +[Test] +title All_SortAscendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileSize Ascending 0 ExpectedStart StartMap FileName music4 FileSize 434288 EndMap StartMap FileName music5 FileSize 1381291 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileSize +//Input: FileSize as sortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on FileSize +[Test] +title All_SortDescendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileSize Descending 0 ExpectedStart StartMap FileName music5 FileSize 1381291 EndMap StartMap FileName music4 FileSize 434288 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileDate +//Input: FileDate as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on FileDate +[Test] +title All_SortAscendingOnFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Genre Rock NULL FileDate Ascending 0 ExpectedStart StartMap FileName music1 FileDate 20090116:091802 EndMap StartMap FileName music4 FileDate 20090117:111341 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileDate +//Input: FileDate as SortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on FileDate +[Test] +title All_SortDescendingOnFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Genre Rock NULL FileDate Descending 0 ExpectedStart StartMap FileName music4 FileDate 20090117:111341 EndMap StartMap FileName music1 FileDate 20090116:091802 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given Artist +//Input: Artist as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on Artist +[Test] +title All_SortAscendingOnArtist +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL Artist Ascending 0 ExpectedStart StartMap FileName music1 Artist Lata EndMap StartMap FileName music2 Artist Rafi EndMap StartMap FileName music3 Artist Sonu EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given Artist +//Input: Artist as SortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on Artist +[Test] +title All_SortDescendingOnArtist +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL Artist Descending 0 ExpectedStart StartMap FileName music3 Artist Sonu EndMap StartMap FileName music2 Artist Rafi EndMap StartMap FileName music1 Artist Lata EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Ascending order for a given Genre +//Input: Genre as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on Genre +[Test] +title All_SortAscendingOnGenre +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 400000 500000 Genre Ascending 0 ExpectedStart StartMap FileName music3 Genre Classical EndMap StartMap FileName music4 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given Genre +//Input: Genre as SortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on Genre +[Test] +title All_SortDescendingOnGenre +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 400000 500000 Genre Descending 0 ExpectedStart StartMap FileName music4 Genre Rock EndMap StartMap FileName music3 Genre Classical EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given Composer +//Input: Composer as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on Composer +[Test] +title All_SortAscendingOnComposer +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL Composer Ascending 0 ExpectedStart StartMap FileName music1 Composer Anu EndMap StartMap FileName music2 Composer Dhawan EndMap StartMap FileName music3 Composer Rahman EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given Composer +//Input: Composer as SortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on Composer +[Test] +title All_SortDescendingOnComposer +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL Composer Descending 0 ExpectedStart StartMap FileName music3 Composer Rahman EndMap StartMap FileName music2 Composer Dhawan EndMap StartMap FileName music1 Composer Anu EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Ascending order for a given Album +//Input: Album as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on Album +[Test] +title All_SortAscendingOnAlbum +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL Album Ascending 0 ExpectedStart StartMap FileName music3 Album Album1 EndMap StartMap FileName music1 Album Album2 EndMap StartMap FileName music2 Album Shaheed EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Nokia as SortOrder +//Input: FileDate as SortKey and Nokia as SortOrder +//Expected: errorcode 1002-BadArgumentType +[Test] +title AllNeg_NokiaSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL NULL NULL FileDate Nokia 1002 +delete foobar +[Endtest] + + +//GetList ascending(case sensitive) as sort order +//Input: FileName as SortKey and ascending as SortOrder +//Expected: list of music files sorted in ascending order based on FileName +[Test] +title All_WithLowercaseascendingAsSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileName ascending 0 ExpectedStart StartMap FileName music1 EndMap StartMap FileName music2 EndMap StartMap FileName music3 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Ascending sort order for FileNameAndPath +//Input: FileNameAndPath as SortKey and Ascending as SortOrder +//Expected: list of music files sorted in ascending order based on FileNameAndPath +[Test] +title All_SortAscendingOnFileNameAndPath +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileNameAndPath Ascending 0 ExpectedStart StartMap FileNameAndPath c:\data\others\music3.mp3 EndMap StartMap FileNameAndPath c:\data\sounds\digital\music1.mp3 EndMap StartMap FileNameAndPath c:\data\sounds\digital\music2.mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Descending order for FileName +//Input: FileName as SortKey and Descending as SortOrder +//Expected: list of music files sorted in descending order based on FileName +[Test] +title All_SortDescendingOnFileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileName Descending 0 ExpectedStart StartMap FileName music3 EndMap StartMap FileName music2 EndMap StartMap FileName music1 EndMap ExpectedEnd +delete foobar +[Endtest] +############################################################################ End Music cases ############################################################# +//GetList with value "FileInfo" for Type input and no other input parameters +//Input: FileInfo as Type, other inputs are NULL +//Expected: errorcode 1003- MissingArgumentType error as the mandatory FileType input is missing +[Test] +title AllNeg_FileInfoType_NoFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo NULL NULL NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList with value other than "FileInfo" for Type input +//Input: FolderInfo inplace of Type input where valid value to be passed is FileInfo +//Expected: errorcode 1004- ServiceNotSupported +[Test] +title AllNeg_FolderInfoType +create tmediaprovidertesting foobar +foobar GetFilesListL FolderInfo All FileName a NULL NULL NULL 1004 +delete foobar +[Endtest] + +//GetList with "FileInfo" as value for Type with a FileType input +//Input: "FileInfo" as value for Type and Image as value for FileType, FileName as Key, "a" as startrange +//Expected: list of details of All image files named 'a' are returned +[Test] +title All_NoOptionalInputs +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL NULL NULL NULL NULL 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap StartMap FileName dreams EndMap StartMap FileName stars EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with lower case "fileinfo" as value for Type input +//Input: lowercase "fileinfo" as value for Type +//Expected: image list based on the filter key and value +[Test] +title All_fileinfoType +create tmediaprovidertesting foobar +foobar GetFilesListL fileinfo All FileName a NULL NULL NULL 0 ExpectedStart StartMap Type Media FileName a FileExtension .jpg Drive c: FileSize 31097 FileDate 20070920:053905 FileNameAndPath c:\data\Images\a.jpg MimeType image/jpeg EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with NULL as Type input +//Input: NULLVALUE as value for Type(Note: Passing NULLVALUE means that a value null is passed as input to Type), Image as FileType +//Expected: errorcode 1004- ServiceNotSupported error is expected as the value FileInfo is expected as input for Type and not NULLVALUE +[Test] +title AllNeg_NullType +create tmediaprovidertesting foobar +foobar GetFilesListL NULLVALUE All NULL NULL NULL NULL NULL 1004 +delete foobar +[Endtest] + + +//GetList with no input for Type +//Input: NULL as value for Type(Note: Passing NULL means that no input is passed), Image as FileType +//Expected: errorcode 1003- MissingArgument error is expected as the Type is mandatory input +[Test] +title AllNeg_NoType +create tmediaprovidertesting foobar +foobar GetFilesListL NULL All NULL NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList with integer value for Type input +//Input: integer value 12 for Type, Image as FileType +//Expected: errorcode 1004- ServiceNotSupported +[Test] +title AllNeg_IntegerType +create tmediaprovidertesting foobar +foobar GetFilesListL 12 All NULL NULL NULL NULL NULL 1004 +delete foobar +[Endtest] + +//GetList with lowercase value "image" for FileType input +//Input: "image"(1st letter lowercase) as value for FileType, FileName as Key and a as value for startrange +//Expected: list of image files filtered based on Filter Key and Value. The list of All files with name a is returned. The expected result has All the details of the expected file named a +//The output is in terms of a map starting and ending with keywords StartMap and EndMap respectively +[Test] +title All_imageFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName a NULL NULL NULL 0 ExpectedStart StartMap Type Media FileName a FileExtension .jpg Drive c: FileSize 31097 FileDate 20070920:053905 FileNameAndPath c:\data\Images\a.jpg MimeType image/jpeg EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with img as value to FileType input +//Input: img as value for FileType and no values(NULL) for All other inputs +//Expected errorcode 1002- BadArgumentType error +[Test] +title AllNeg_imgFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo al NULL NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with Nokia as input to FileType input +//Input: Nokia as value for FileType and no values(NULL) for All other inputs +//Expected: errorcode 1002- BadArgumentType error +[Test] +title AllNeg_NokiaFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Nokia NULL NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with E:\Image as value to FileType input +//Input: E:\Image as FIleType and no value (NULL) for All other values +/Expected: errorcode 1002- BadArgumentType error +[Test] +title AllNeg_E:\ImageFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo E:\Image NULL NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + + +//GetList with empty string as FileType +//Input: empty string as FileType and no values(NULL) for All other inputs +/Expected: errorcode 1002- BadArgumentType error +[Test] +title AllNeg_EmptyStringFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo "" NULL NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with NULL as FileType +//Input: NULLVALUE as FileType(Note this means that we are passing NULL as input to FileType),All other inputs are not passed +/Expected: errorcode 1002- BadArgumentType error +[Test] +title AllNeg_NullFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo NULLVALUE NULL NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with integer value input to FileType +//Input: 12 as value for FileType and no values for All other inputs +/Expected: errorcode 1002- BadArgumentType error as invalid value is passed for FileType +[Test] +title AllNeg_IntegerFileType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo 12 NULL NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + +###################################################################Type==“FileInfo” + Passing Filter Map with FileType==Image + [Key]############################################################################ + +//GetList with FileName as key, no StartRange +//Input: FileName as key, All other values are not passed +/Expected: errorcode 1003- MissingArgumentType +[Test] +title All_ImgNeg_FileNameKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList with no FilterKey +//Input: NULL(means no value being passed) as Key ,All other inputs are not passed +//Expected: list of All images present in the device, The expected output has the FileName of All files expected to be retrieved. +[Test] +title All_Img_NoOptionalFields +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL NULL NULL NULL NULL 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap StartMap FileName dreams EndMap StartMap FileName stars EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with FileExtension as key, but no StartRange +//Input: FileExtension as Key and no value for All other keys +//Expected: errorcode 1003- MissingArgumentType as the StartRange is mandatory when Key is mentioned +[Test] +title All_ImgNeg_FileExtensionKey_NoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList with Drive as key and no startrange +//Input: Drive as Key and no input for All other input parameters +//Expected: errorcode 1003- MissingArgumentType as the StartRange is mandatory when Key is mentioned +[Test] +title All_ImgNeg_DriveKey_NoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList with FileSize as key and no startrange +//Input: FileSize as Key and no input for All other input parameters +//Expected: errorcode 1002- BadArgumentType as the StartRange is mandatory when Key is mentioned +[Test] +title All_ImgNeg_FileSizeKey_NoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with FileDate as key and no startrange +//Input: FileDate as Key and no input for All other input parameters +//Expected: errorcode 1002- BadArgumentType as the StartRange is mandatory when Key is mentioned +[Test] +title All_ImgNeg_FileDateKey_NoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with MimeType as key and no startrange +//Input: MimeType as Key and no input for All other input parameters +//Expected: errorcode 1003- MissingArgumentType as the StartRange is mandatory when Key is mentioned +[Test] +title All_ImgNeg_MimeTypeKey_NoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList with FileNameAndPath as key and no startrange +//Input: FileNameAndPath as Key and no input for All other input parameters +//Expected: errorcode 1003- MissingArgumentType as the StartRange is mandatory when Key is mentioned +[Test] +title All_ImgNeg_FileNameAndPathKey_NoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList with Nokia as key +//Input: Nokia as key and a valid value c:\data\Images\a.jpg as value for startrange, and no input for All other parameters +//Expected: errorcode 1002- BadArgumentType is expected as the value for key is invalid +[Test] +title All_ImgNeg_NokiaKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Nokia c:\data\Images\a.jpg NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with NULL value as key +//Input: NULLVALUE as input for Key(means a value NULL is input to Key),and a valid c:\data\Images\a.jpg as value for startrange and no value for other inputs +//Expected: 1002-BadArgumentType errorcode is returned as NULL is invalid value for Key +[Test] +title All_Img_NullKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULLVALUE c:\data\Images\a.jpg NULL NULL NULL 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap StartMap FileName dreams EndMap StartMap FileName stars EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Empty string as key +//Input: empty string "" as value for Key and a valid value "c:\data\Images\a.jpg" as value for startrange and other inputs are not passed +//Expected: errorcode 1002- BadArgumentType +[Test] +title All_ImgNeg_EmptyStringKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All "" c:\data\Images\a.jpg NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with invalid case as key +//Input: filename(1st letter lowercase) as Key and a as value for startrange +//returns list of images based on the filter key and value. details of files named a is expected as output +[Test] +title All_Img_filenameKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All filename a NULL NULL NULL 0 ExpectedStart StartMap FileName a EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Sapi as value for filter key +//Input: Sapi as Key and a valid c:\data\Images\a.jpg as value for startrange +//Expected: errorcode 1002- BadArgumentType as Sapi is invalid key +[Test] +title All_ImgNeg_SapiKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Sapi c:\data\Images\a.jpg NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with integer value for Filter key +//Input: 12 as Key, and a valid value "c:\data\Images\a.jpg" as value for startrange +//Expected: errorcode 1002- BadArgumentType as the value expected is out of type string and integer is input +[Test] +title All_ImgNeg_IntegerKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All 12 c:\data\Images\a.jpg NULL NULL NULL 1002 +delete foobar +[Endtest] + +##########################Type==“FileInfo” + Passing Filter Map with FileType==Image + Key+Start Range############################### +//GetList with NULL StartRange +//Input: FileName as Key and NULLVALUE as startrange(means we are passing NULL as value for startrange) +//Expected: errorcode- 1003 MissingArgumenterror, as the startrange is mandatory when key is input +[Test] +title All_ImgNeg_NoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName NULLVALUE NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList with FileName StartRange +//Input: FileName as Key and value a as startrange +//Expected list of images filtered based on FileName. Details of All files named a is expected output +[Test] +title All_Img_FileNameKeyWithStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName a NULL NULL NULL 0 ExpectedStart StartMap FileName a EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with FileExtension StartRange +//Input: FileExtension as Key and .jpg as value for startrange +//Expected list of images filtered based on FileExtension. details of All files with extension .jpg is the expected output +[Test] +title All_Img_FileExtensionKeyWithStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension .jpg NULL NULL NULL 0 ExpectedStart StartMap FileName a FileExtension .jpg EndMap StartMap FileName ant FileExtension .jpg EndMap StartMap FileName stars FileExtension .jpg EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Drive StartRange +//Input: Drive as Key and c: as value for startrange +//Expected list of images filtered based on Drive. details of All files with drive value c: is expected +[Test] +title All_Img_DriveKey_c:StartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL NULL NULL 0 ExpectedStart StartMap FileName a Drive c: EndMap StartMap FileName ant Drive c: EndMap StartMap FileName blue Drive c: EndMap StartMap FileName dreams Drive c: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with FileSize StartRange +//Input: FileSize as Key and 70000 as value for startrange +//Expected: list of images filtered based on FileSize. details of All files with size 70000 is expected +[Test] +title All_Img_FileSizeKeyWithStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 70000 NULL NULL NULL 0 ExpectedStart StartMap FileSize dreams FileSize 73105 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with FileDate StartRange +//Input: FileDate as Key and 20081019:033638 as value for startrange +//Expected: list of images filtered based on FileDate 20081019:033638. The details of All files with date 20081019:033638 is the output +[Test] +title All_Img_FileDateKeyWithStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20081019:033638 NULL NULL NULL 0 ExpectedStart StartMap FileName stars FileDate 20081019:033638 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with MimeType StartRange +//Input: MimeType as Key and image/jpeg as value for startrange +//Expected: list of images filtered based on MimeType image/jpeg. +[Test] +title All_Img_MimeTypeKeyWithStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType image/jpeg NULL NULL NULL 0 ExpectedStart StartMap FileName a MimeType image/jpeg EndMap StartMap FileName ant MimeType image/jpeg EndMap StartMap FileName stars MimeType image/jpeg EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with FileNameAndPath StartRange +//Input: FileNameAndPath as StartRange and c:\data\Images\a.jpg as value for startrange +//Expected: list of images filtered based on FileNameAndPath, i.e., returns the details about file a.jpg at c:\data\Images\a.jpg +[Test] +title All_Img_FileNameAndPathKeyWithStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath c:\data\Images\a.jpg NULL NULL NULL 0 ExpectedStart StartMap FileNameAndPath c:\data\Images\a.jpg EndMap ExpectedEnd +delete foobar +[Endtest] + +//FIleSize startrange with value greater than the values of a file +//Input: FileSize as Key and 95000 as startrange +//Expected: should return errocode as 0 and empty list +[Test] +title All_Img_FileSizeKeyWithStartRange_NoExpectedo/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 95000 NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with FileDate StartRange +//Input: FileDate as Key and 20091019:033638 as value for startrange +//Expected: should return errocode as 0 and empty list +[Test] +title All_Img_FileDateWithStartRange_NoExpectedo/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20091019:033638 NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with negative FileSize StartRange +//Input: FileSize as Key and -12 as value for StartRange +//Expected: errorcode 1002- BadArgumentType as the value is out of range +[Test] +title All_ImgNeg_NegativeFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize -12 NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with negative FileDate StartRange +//Input: FileDate as Key and -12 as value for StartRange +//Expected: errorcode 1002- BadArgumentType as the value is out of range +[Test] +title All_Img_NegativeFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate -12 NULL NULL NULL 1002 +delete foobar +[Endtest] + + +//GetList with FileDate StartRange +//Input: FileDate as Key and an invalid value 20093045:450990 as startrange +//Expected: errorcode 1002- BadArgumentType as the value is invalid +[Test] +title All_Img_InvalidFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20093045:450990 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList with no Key input, but with values for start and endrange +//Input: NULL as Key(no input for Key) and 70000 as StartRange and 80000 as endrange +//Expected: list of All image files +[Test] +title All_Img_NoFilterKeyWithStartRangeValues +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL 70000 80000 NULL NULL 0 +delete foobar +[Endtest] + +//GetList with empty string StartRange for FileName +//Input: FileName as Key and empty string as value for StartRange +//Expected: 0 as errorcode and empty list +[Test] +title All_Img_EmptyStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName "" NULL NULL NULL 0 +delete foobar +[Endtest] + + +//GetList with integer StartRange for FileName +//Input: FileName as Key and integer value 23 as value for StartRange +//Expected: 0 errocode and empty list is returned +[Test] +title All_Img_IntegerStartRangea +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName 23 NULL NULL NULL 0 +delete foobar +[Endtest] + + +//GetList with Null string as value for FileName +//Input: FileName as Key and null string "NULL" as value for startrange +//Expected: 0 errorcode and empty list +[Test] +title All_Img_FileNameKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with Null string as value for FileExtension +//Input: FileExtension as Key and null string "NULL" as value for startrange +//Expected: 0 errorcode and empty list +[Test] +title All_Img_FileExtensionKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with Null string as value for Drive +//Input: Drive as Key and null string "NULL" as value for startrange +//Expected: 0 errorcode and empty list +[Test] +title All_Img_DriveKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with Null string as value for MimeType +//Input: MimeType as Key and null string "NULL" as value for startrange +//Expected: 0 errorcode and empty list +[Test] +title All_Img_MimeTypeKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with Null string for FileNameAndPath +//Input: FileNameAndPath as Key and "Null" as value for StartRange +//Expected: 0 errorcode and empty list +[Test] +title All_Img_FileNameAndPathKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +#########################Type==“FileInfo” + Passing Filter Map with FileType==Image + Key+Start Range + End Range############################# + +//GetList with FileSize end range less than start range +//Input: FileSize as key, 40000 as StartRange and 20000 as EndRange +//Expected: 1002-BadArgumentType +[Test] +title All_ImgNeg_StartRangeGTEndRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 40000 20000 NULL NULL 1002 +delete foobar +[Endtest] + +//GetList with Negative end range for FileSize +//Input: FileSize as key, valid value of 200 for StartRange and a value -400 as value for EndRange +//Expected: 1002-BadArgumentType as the value of endrange is invalid and not within the range +[Test] +title All_ImgNeg_NegativeFileSizeEndRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 20000 -40000 NULL NULL 1002 +delete foobar +[Endtest] + +//GetList with Negative end range for FileDate +//Input: FileDate as key, valid startrange and a value -400 as value for EndRange +//Expected: 1002-BadArgumentType as the value of endrange is invalid and not within the range +[Test] +title All_ImgNeg_NegativeFileDateEndRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20070920:053905 -400 NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of images filtered by FileName with EndRange being mentioned +//Input: FileName as Key, value a as StartRange and value z as EndRange +//Expected: returns list based on StartRange alone and ignores the EndRange +[Test] +title All_Img_FileNameKeyWithStartAndEndRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName a z NULL NULL 0 ExpectedStart StartMap FileName a EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with valid start and end range for FileSize +//Input: FileSize as key, valid value of 30000 for StartRange and a value 40000 as value for EndRange +//Expected: file with size in the range 30000 to 40000 is expected. FileName and FileSize is verified in the result +[Test] +title All_Img_FileSizeKeyWithValidRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 30000 40000 NULL NULL 0 ExpectedStart StartMap FileName a FileSize 31097 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Negative end range for FileDate +//Input: FileDate as key, valid startrange and a value -400 as value for EndRange +//Expected: 1002-BadArgumentType as the value of endrange is invalid and not within the range +[Test] +title All_Img_FileDateKeyWithValidRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20070920:053905 20071020:060000 NULL NULL 0 ExpectedStart StartMap FileName a FileDate 20070920:053905 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with valid start and end range for FileSize, but no such file is present in the expected list +//Input: FileSize as key, valid value of 95000 for StartRange and a value 98000 as value for EndRange +//Expected: file with size in the range 30000 to 40000 is expected.But no such file exists in the expected list +[Test] +title All_Img_FileSizeWithValidRange_WithNoExpectedOutput +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 95000 98000 NULL NULL 0 +delete foobar +[Endtest] + +######################### Type==“FileInfo” + Passing Filter Map with FileType==Image + Sort Map######################### + +//GetList of image file sorted in Ascending order of Drive +//Input: Drive as SortKey and Ascending as SortOrder, FileSize as Key with startrange of 20000 and 40000 as end range +//Expected: list of images in ascending order of drive +[Test] +title All_Img_SortAscendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 20000 40000 Drive Ascending 0 ExpectedStart StartMap FileName a Drive c: EndMap StartMap FileName stars Drive e: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image file sorted in Descending order of Drive +//Input: Drive as SortKey and Descending as SortOrder, FileSize as Key with startrange of 20000 and 40000 as end range +//Expected: list of images in descending order of drive +[Test] +title All_Img_SortDescendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 20000 40000 Drive Descending 0 ExpectedStart StartMap FileName stars Drive e: EndMap StartMap FileName a Drive c: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image file sorted in Ascending order of FileExtension +//Input: FileExtension as SortKey and Ascending as SortOrder, FileSize as Key with 4000 and 9000 start and end range values respectively +//Expected: list of images in ascending order of FileExtension +[Test] +title All_Img_SortAscendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 4000 9000 FileExtension Ascending 0 ExpectedStart StartMap FileName ant FileExtension .jpg EndMap StartMap FileName blue FileExtension .png EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image file sorted in Descending order of FileExtension +//Input: FileExtension as SortKey and Descending as SortOrder, FileSize as Key with 4000 and 9000 start and end range values respectively +//Expected: list of images in descending order of FileExtension +[Test] +title All_Img_DescendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 4000 9000 FileExtension Descending 0 ExpectedStart StartMap FileName blue FileExtension .png EndMap StartMap FileName ant FileExtension .jpg EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image files in Ascending order of MimeType +//Input: MimeType as SortKey and Ascending as SortOrder, FileSize as Key with 4000 and 9000 start and end range values respectively +//Expected: list of images in ascending order of MimeType +[Test] +title All_Img_SortAscendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 4000 9000 MimeType Ascending 0 ExpectedStart StartMap FileName ant MimeType image/jpeg EndMap StartMap FileName blue MimeType image/png EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image files in Descending order of MimeType +//Input: MimeType as SortKey and Descending as SortOrder, FileSize as Key with 4000 and 9000 start and end range values respectively +//Expected: list of images in descending order of MimeType +[Test] +title All_Img_SortDescendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 4000 9000 MimeType Descending 0 ExpectedStart StartMap FileName blue MimeType image/png EndMap StartMap FileName ant MimeType image/jpeg EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image files in Ascending order of FileSize +//Input: FileSize as SortKey and Ascending as SortOrder +//Expected: list of images in ascending order of FileSize +[Test] +title All_Img_SortAscendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileSize Ascending 0 ExpectedStart StartMap FileName blue FileSize 4796 EndMap StartMap FileName ant FileSize 8474 EndMap StartMap FileName a FileSize 31097 EndMap StartMap FileName dreams FileSize 73105 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image files in Descending order of FileSize +//Input: FileSize as SortKey and Descending as SortOrder +//Expected: list of images in descending order of FileSize +[Test] +title All_Img_SortDescendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileSize Descending 0 ExpectedStart StartMap FileName dreams FileSize 73105 EndMap StartMap FileName a FileSize 31097 EndMap StartMap FileName ant FileSize 8474 EndMap StartMap FileName blue FileSize 4796 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of image files sorted in Ascending order of FileDate +//Input: FileDate as SortKey and Ascending as SortOrder,MimeType as FilterKey and image/jpeg as startvalue +//Expected: list of images in ascending order of FileDate +[Test] +title All_Img_SortAscendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType image/jpeg NULL FileDate Ascending 0 ExpectedStart StartMap FileName ant FileDate 20060819:102426 EndMap StartMap FileName a FileDate 20070920:053905 EndMap StartMap FileName stars FileDate 20081019:033638 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of images sorted in Descending order based on FileDate +//Input: FileDate as SortKey and Descending as SortOrder +//Expected: list of images in descending order of FileDate,MimeType as FilterKey and image/jpeg as startvalue +[Test] +title All_SortDescendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType image/jpeg NULL FileDate Descending 0 ExpectedStart StartMap FileName stars FileDate 20081019:033638 EndMap StartMap FileName a FileDate 20070920:053905 EndMap StartMap FileName ant FileDate 20060819:102426 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with no SortOrder +//Input: Pass NULL as SortOrder and any valid SortKey like FileName +//Expected list of images in ascending order(default) based on SortKey(FileName) mentioned. The list is sorted in ascending order as Ascending is the default order +[Test] +title All_NoSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileName NULL 0 ExpectedStart StartMap FileName a EndMap StartMap FileName ant EndMap StartMap FileName blue EndMap StartMap FileName dreams EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Nokia as SortOrder +//Input: Nokia as value for SortOrder and any valid value eg.FileDate as value for SortKey +//Expected: 1002-BadArgumentType as Nokia is not a valid SortOrder +[Test] +title All_NokiaSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL NULL NULL FileDate Nokia 1002 +delete foobar +[Endtest] + + +//GetList ascending(case sensitive) as sort order +//Input: lowercase "ascending" as value for SortOrder and FIleSize as value for SortKey +//Expected: list of images in ascending order, sorted based on Filesize +[Test] +title All_ascendingSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileSize ascending 0 ExpectedStart StartMap FileName blue FileSize 4796 EndMap StartMap FileName ant FileSize 8474 EndMap StartMap FileName a FileSize 31097 EndMap StartMap FileName dreams FileSize 73105 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Ascending sort order for FileNameAndPath +//Input: FileNameAndPath as SortKey and Ascending as SortOrder +//Expected: list of image files in ascending order sorted based on FileNameAndPath +[Test] +title All_SortAscendingOnFileNameAndPath +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileNameAndPath Ascending 0 ExpectedStart StartMap FileNameAndPath c:\data\Images\a.jpg EndMap StartMap FileNameAndPath c:\data\Images\ant.jpg EndMap StartMap FileNameAndPath c:\data\Images\blue.png EndMap StartMap FileNameAndPath c:\data\Images\pictures\dreams.bmp EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Descending order of files sorted based on FileName +//Input: FileName as SortKey and Descending as SortOrder +//Expected: list of images sorted in descending order based on FileName +[Test] +title All_SortDescendingOnFileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileName Descending 0 ExpectedStart StartMap FileName dreams EndMap StartMap FileName blue EndMap StartMap FileName ant EndMap StartMap FileName a EndMap ExpectedEnd +delete foobar +[Endtest] + + +//Case to check for All fields in output +//Input: Drive as FilterKey, e: as startrange +//Expected: list of All images files in e: drive +[Test] +title All_DriveKey_e:StartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL NULL NULL 0 ExpectedStart StartMap Type Media FileName stars FileExtension .jpg Drive e: FileSize 24790 FileDate 20081019:033638 FileNameAndPath e:\data\Images\stars.jpg MimeType image/jpeg EndMap ExpectedEnd +delete foobar +[Endtest] + + + +################################################################ Image Ends #################################################### +//GetList of sound files with startrange for FileName +//Input: FileName as Key and value tempo as startrange, All other inputs are NULL(means no value is passed) +//Expected: list of sound files with filename tempo +[Test] +title All_Sound_FileNameKeyWithvalidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName tempo NULL NULL NULL 0 ExpectedStart StartMap FileName tempo EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of sound files with startrange for FileExtension +//Input: FileExtension as Key and value .wav as startrange, All other inputs are NULL(means no value is passed) +//Expected: list of All sound files with .wav as FileExtension are expected +[Test] +title All_Sound_FileExtensionKeyWithvalidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension .wav NULL NULL NULL 0 ExpectedStart StartMap FileName music FileExtension .wav EndMap StartMap FileName raaga FileExtension .wav EndMap StartMap FileName rock_on FileExtension .wav EndMap StartMap FileName tempo FileExtension .wav EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of sound files with startrange for Drive +//Input: Drive as Key and value e: as startrange +//Expected: list of sound files filtered by Drive +[Test] +title All_Sound_DriveKey_e:StartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL NULL NULL 0 ExpectedStart StartMap FileName noise Drive e: EndMap StartMap FileName rock_on Drive e: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of sound files with startrange for FileSize +//Input: FileSize as Key and value 25301 as startrange +//Expected: list of sound files filtered by FileSize +[Test] +title All_Sound_FileSizeKeyWithvalidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 25031 NULL NULL NULL 0 ExpectedStart StartMap FileName noise FileSize 25031 EndMap StartMap FileName sound FileSize 25031 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of sound files with startrange for FileDate +//Input: FileDate as Key and value 20081109:085028 as startrange +//Expected: list of sound files filtered by FileDate +[Test] +title All_Sound_FileDateKeyWithvalidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20081109:085028 NULL NULL NULL 0 ExpectedStart StartMap FileName noise FileDate 20081109:085028 EndMap StartMap FileName sound FileDate 20081109:085028 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of sound files with startrange for MimeType +//Input: MimeType as Key and value AUDIO/WAV as startrange +//Expected: list of sound files filtered by MimeType +[Test] +title All_Sound_MimeTypeKey_audio/wavStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType AUDIO/WAV NULL NULL NULL 0 ExpectedStart StartMap FileName music MimeType AUDIO/WAV EndMap StartMap FileName raaga MimeType AUDIO/WAV EndMap StartMap FileName rock_on MimeType AUDIO/WAV EndMap StartMap FileName tempo MimeType AUDIO/WAV EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of sound files with startrange for FileNameAndPath +//Input: FileNameAndPath as Key and value c:\data\sounds\digital\tempo.wav as startrange +//Expected: list of sound files filtered by FileNameAndPath +[Test] +title All_Sound_FileNameAndPathKeyWithvalidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath c:\data\sounds\digital\tempo.wav NULL NULL NULL 0 ExpectedStart StartMap FileNameAndPath c:\data\sounds\digital\tempo.wav EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList of sound files with negative startrange for FileSize +//Input: FileSize as key and -400 as value for startrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_SoundNeg_NegativeFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize -400 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of sound files with negative startrange for FileDate +//Input: FileDate as key and -12 as value for startrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_SoundNeg_NegativeFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate -12 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList with FileSize with value more than the value of All files expected +//Input: FileSize as key and 40000 as value for startrange +//Expected: errorcode 0 and empty list as output +[Test] +title All_Sound_ValidFileSize_NoExpectedo/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 40000 NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with FileDate with value more than the value of aAll files expected +//Input: FileDate as key and 20091010:040404 as value for startrange +//Expected: errorcode 0 and empty list as output +[Test] +title All_Sound_ValidFileDate_NoExpectedo/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20091010:040404 NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with FileDate having invalid value +//Input: FileDate as key and 20094545:909834 as value for startrange +//Expected: errorcode 1002- BadArgumentType +[Test] +title All_SoundNeg_InvalidFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20094545:909834 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList with startrange and no key +//Input: NULL as Key and 20000 and 30000 as start and end range values respectively +//Expected: list of All sound files is expected +[Test] +title All_Sound_NoKeyWithRangeValues +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL 20000 30000 NULL NULL 0 +delete foobar +[Endtest] + + +//GetList with empty string as startrange +//Input: FileName as Key and empty string as startrange +//Expected: errorcode 0 is returned and empty list is returned +[Test] +title All_Sound_FileNameKey_EmptyStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName "" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with integer as startrange +//Input: FileName as Key and integer value 12 as startrange +//Expected: errorcode 0 and empty list is returned +[Test] +title All_Sound_IntegerStartRangeForFileNameKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName 12 NULL NULL NULL 0 +delete foobar +[Endtest] + + +//GetList of sound files with a Null string as staratrange for FileName +//Input: FileName as Key and null string "NULL" as startrange +//Expected: errorcode 0 and empty list is returned +[Test] +title All_Sound_NullStringStartRangeForFileNameKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList of sound files with a Null string as staratrange for FileExtension +//Input: FileExtension as Key and null string "NULL" as startrange +//Expected: errorcode 0 and empty list is returned +[Test] +title All_Sound_NullStringStartRangeForFileExtensionKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList of sound files with a Null string as staratrange for Drive +//Input: Drive as Key and null string "NULL" as startrange +//Expected: errorcode 0 and empty list is returned +[Test] +title All_Sound_NullStringKeyForDriveKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + + +//GetList of sound files with a Null string as staratrange for MimeType +//Input: MimeType as Key and null string "NULL" as startrange +//Expected: errorcode 0 and empty list is returned +[Test] +title All_Sound_NullStringStartRangeForMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList of sound files with a Null string as staratrange for FileNameAndPath +//Input: FileNameAndPath as Key and null string "NULL" as startrange +//Expected: errorcode 0 and empty list is returned +[Test] +title All_Sound_NullStringStartRangeForFileNameAndPath +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +################################# Type==“FileInfo” + Passing Filter Map with FileType==Sound + Key+Start Range + End Range ###################### + +//GetList of sound files with endrange less than startrange for FileSize +//Input: FileSize as Key and 22400 as startrange and 2000 as endrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_SoundNeg_StartRangeGTEndRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 22400 2000 NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of sound files with negative endrange for FileSize +//Input: FileSize as Key and -12 as value for endrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_SoundNeg_NegativeFileSizeEndRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 22400 -12 NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of sound files with negative endrange for FileDate +//Input: FileDate as Key and -24 as end range +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_SoundNeg_NegativeFileDateEndRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20090103:075032 -24 NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of sound files with endrange where it is not applicable +//Input: FileName as Key and raaga as startrange and tempo as endrange +//Expected: the details of file named raaga is expected and the endrange is ignored +[Test] +title All_Sound_EndRangeForFileNameKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName raaga tempo NULL NULL 0 ExpectedStart StartMap FileName raaga EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with valid startrange for FileSize Key +//Input: FileSize as Key and 20000 and 25000 as start and end range values respectively +//Expected: list of All sound files in the file size range 20000 to 25000 is expected +[Test] +title All_Sound_ValidRangeForFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 20000 25000 NULL NULL 0 ExpectedStart StartMap FileName music FileSize 22965 EndMap StartMap FileName raaga FileSize 22965 EndMap StartMap FileName rock_on FileSize 22965 EndMap StartMap FileName tempo FileSize 22965 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with valid startrange for FileDate Key +//Input: FileDate as Key and 20081022:030000 and 20081110:090000 as start and end range values respectively +//Expected: list of All sound files in the file date range mentioned are expected +[Test] +title All_Sound_ValidRangeForFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20081022:030000 20081110:090000 NULL NULL 0 ExpectedStart StartMap FileName noise FileDate 20081109:085028 EndMap StartMap FileName sound FileDate 20081109:085028 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with valid startrange for FileSize Key, but no files being present in that range +//Input: FileSize as Key and 40000 and 50000 as start and end range values respectively +//Expected: 0 errorcode and empty list is expected +[Test] +title All_Sound_ValidRangeForFileSize_NoExpectedo/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 40000 50000 NULL NULL 0 +delete foobar +[Endtest] + +######################## Type==“FileInfo” + Passing Filter Map with FileType==Sound + Sort Map ######################## + + +//GetList with Ascending order for a given drive +//Input: FileExtension as Key .amr as startrange, Drive as SortKey and Ascending as SortOrder +//Expected: list of sound files with file extension .amr,in ascending order of drive +[Test] +title All_Sound_SortAscendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension .amr NULL Drive Ascending 0 ExpectedStart StartMap FileName sound Drive c: EndMap StartMap FileName noise Drive e: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given drive +//Input: FileExtension as Key .amr as startrange, Drive as SortKey and Descending as SortOrder +//Expected: list of sound files with .amr file extension, in descending order of drive +[Test] +title All_Sound_SortDescendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension .amr NULL Drive Descending 0 ExpectedStart StartMap FileName noise FileExtension .amr Drive e: EndMap StartMap FileName sound FileExtension .amr Drive c: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileExtension +////Input: Drive as Key e: as startrange, FileExtension as SortKey and Ascending as SortOrder +//Expected: list of sound files, in e: drive, in ascending order of FileExtension +[Test] +title All_Sound_SortAscendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileExtension Ascending 0 ExpectedStart StartMap FileName noise FileExtension .amr EndMap StartMap FileName rock_on FileExtension .wav EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileExtension +//Input: Drive as Key e: as startrange, FileExtension as SortKey and Descending as SortOrder +//Expected: list of sound files, in e: drive, in descending order of FileExtension +[Test] +title All_Sound_SortDescendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileExtension Descending 0 ExpectedStart StartMap FileName rock_on FileExtension .wav EndMap StartMap FileName noise FileExtension .amr EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given MimeType +//Input: Drive as Key, e: as value for startrange, MimeType as SortKey, Ascending as SortOrder +//Expected: list of sound files,in e: drive, in ascending order of MimeType +[Test] +title All_Sound_SortAscendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL MimeType Ascending 0 ExpectedStart StartMap FileName noise MimeType AUDIO/AMR EndMap StartMap FileName rock_on MimeType AUDIO/WAV EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given MimeType +//Input: Drive as Key, e: as value for startrange, MimeType as SortKey, Descending as SortOrder +//Expected: list of sound files,in e: drive, in descending order of MimeType +[Test] +title All_Sound_SortDescendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL MimeType Descending 0 ExpectedStart StartMap FileName rock_on MimeType AUDIO/WAV EndMap StartMap FileName noise MimeType AUDIO/AMR EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileSize +//Input: Drive as Key, e: as value for startrange, FileSize as SortKey, Ascending as SortOrder +//Expected: list of sound files,in e: drive, in ascending order of FileSize +[Test] +title All_Sound_SortAscendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileSize Ascending 0 ExpectedStart StartMap FileName rock_on FileSize 22965 EndMap StartMap FileName noise FileSize 25031 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileSize +//Input: Drive as Key, e: as value for startrange, FileSize as SortKey, Descending as SortOrder +//Expected: list of sound files in descending order of FileSize +[Test] +title All_Sound_SortDescendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileSize Descending 0 ExpectedStart StartMap FileName noise FileSize 25031 EndMap StartMap FileName rock_on FileSize 22965 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileDate +//Input: Drive as Key, e: as value for startrange, FileDate as SortKey, Ascending as SortOrder +//Expected: list of sound files,in e: drive, in ascending order of FileDate +[Test] +title All_Sound_SortAscendingOnFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileDate Ascending 0 ExpectedStart StartMap FileName rock_on FileDate 20081019:033638 EndMap StartMap FileName noise FileDate 20081109:085028 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileDate +//Input: Drive as Key, e: as value for startrange, FileDate as SortKey, Descending as SortOrder +//Expected: list of sound files,in e: drive, in descending order of FileDate +[Test] +title All_Sound_SortDescendingOnFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileDate Descending 0 ExpectedStart StartMap FileName noise FileDate 20081109:085028 EndMap StartMap FileName rock_on FileDate 20081019:033638 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with no sort order +//Input: Drive as Key, e: as value for startrange, FileName as SortKey, no sortorder(NULL as sortorder) +//Expected: list of sound files,in e: drive, in ascending order(default order) of FileName +[Test] +title All_Sound_NoSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileName NULL 0 ExpectedStart StartMap FileName noise EndMap StartMap FileName rock_on EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList Nokia as SortOrder +//Input: FileDate as SortKey and Nokia as SortOrder +//Expected: errorcode 1002-BadArgumentType is expected output, as the value for SortOrder is invalid +[Test] +title All_Sound_NokiaSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL NULL NULL FileDate Nokia 1002 +delete foobar +[Endtest] + + +//GetList ascending(case sensitive) as sort order +//Input: Drive as Key, e: as value for startrange, FileDate as value for SortKey and ascending(lower case) as value for SortOrder +//filters as per the filter key and order mentioned +[Test] +title All_Sound_lowercase_ascendingSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileDate ascending 0 ExpectedStart StartMap FileName rock_on FileDate 20081019:033638 EndMap StartMap FileName noise FileDate 20081109:085028 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Ascending sort order for FileNameAndPath +//Input: FileNameAndPath as SortKey and Ascending as SortOrder +//Expected: list of sound files in ascending order of FileNameAndPath +[Test] +title All_Sound_SortAscendingOnFileNameAndPath +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive c: NULL FileNameAndPath Ascending 0 ExpectedStart StartMap FileNameAndPath c:\data\others\music.wav EndMap StartMap FileNameAndPath c:\data\sounds\digital\raaga.wav EndMap StartMap FileNameAndPath c:\data\sounds\digital\sound.amr EndMap StartMap FileNameAndPath c:\data\sounds\digital\tempo.wav EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Descending order for FileName +//Input: FileName as SortKey and Descending as value for SortOrder +//Expected: list of sound files in descending order of FileName +[Test] +title All_Sound_SortDescendingOnFileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType AUDIO/AMR NULL FileName Descending 0 ExpectedStart StartMap FileName sound MimeType AUDIO/AMR EndMap StartMap FileName noise MimeType AUDIO/AMR EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList to check for All fields +//Input: Drive as FilterKey and e: as startrange FileName as SortKey and Descending as value for SortOrder +//Expected: list of sound files in e: drive, in descending order of FileName +[Test] +title All_Sound_DriveKey_e:StartRange_CheckForAllKeysInExpectedO/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL FileName Descending 0 ExpectedStart StartMap Type Media FileName rock_on FileExtension .wav Drive e: FileSize 22965 FileDate 20081019:033638 FileNameAndPath e:\data\sounds\digital\rock_on.wav MimeType AUDIO/WAV EndMap StarMap Type Media FileName noise FileExtension .amr Drive e: FileSize 25031 FileDate 20081109:085028 FileNameAndPath e:\data\sounds\digital\noise.amr MimeType AUDIO/AMR EndMap ExpectedEnd +delete foobar +[Endtest] + +############################################ End Sound ################################################# + +//GetList of video files with startrange for FileName +//Input: FileName as Key and video1 as startrange +//Expected: list of video files filtered by FileName. Thus details of All files named video1 is expected as o/p +[Test] +title All_video_WithValidFileNameStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName video1 NULL NULL NULL 0 ExpectedStart StartMap FileName video1 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of video files with startrange for FileExtension +//Input: FileExtension as Key and .3gp as startrange +//Expected: list of video files filtered by FileExtension. All files with extension .3gp is expected +[Test] +title All_video_WithValidFileExtensionStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension .3gp NULL NULL NULL 0 ExpectedStart StartMap FileName video2 FileExtension .3gp EndMap StartMap FileName video5 FileExtension .3gp EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of video files with startrange for Drive +//Input: Drive as Key and e: as startrange +//Expected: list of video files filtered by Drive. Details of All files in e: drive is expected +[Test] +title All_video_DriveKey_e:StartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive e: NULL NULL NULL 0 ExpectedStart StartMap FileName video2 Drive e: EndMap StartMap FileName video3 Drive e: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of video files with startrange for FileSize +//Input: FileSize as Key and 71599 as startrange +//Expected: list of video files filtered by FileSize. Details of All files with size 71599 is expected o/p +[Test] +title All_video_WithValidFileSizeStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 71559 NULL NULL NULL 0 ExpectedStart StartMap FileName video1 FileSize 71559 EndMap StartMap FileName video2 FileSize 71559 EndMap StartMap FileName video5 FileSize 71559 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of video files with startrange for FileDate +//Input: FileDate as Key and 20081019:033638 as startrange +///Expected: list of video files filtered by FileDate. All files with date 20081019:033638 is expected as o/p +[Test] +title All_video_WithValidFileDateStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20081019:033638 NULL NULL NULL 0 ExpectedStart StartMap FileName video1 FileDate 20081019:033638 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of video files with startrange for MimeType +//Input: MimeType as Key and video/3gpp as startrange +//Expected: list of video files filtered by MimeType. All files with MimeType as video/3gpp is expected +[Test] +title All_video_WithValidMimeTypeStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType Video/3gpp NULL NULL NULL 0 ExpectedStart StartMap FileName video2 MimeType VIDEO/3GPP EndMap StartMap FileName video5 MimeType VIDEO/3GPP EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of video files with startrange for FileNameAndPath +//Input: FileNameAndPath as Key and c:\data\videos\video1.mp4 as startrange +//Expected: list of video files filtered by FileNameAndPath. All files with path c:\data\videos\video1.mp4 are the expected o/p +[Test] +title All_video_WithValidFileNameAndPathStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath c:\data\videos\video1.mp4 NULL NULL NULL 0 ExpectedStart StartMap FileNameAndPath c:\data\Videos\video1.mp4 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList of video files with negative startrange for FileSize +//Input: FileSize as Key and a negative value -400 as startrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_videoNeg_WithNegativeFileSizeStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize -400 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of video files with negative startrange for FileDate +//Input: FileDate as Key and a negative value -12 as startrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_videoNeg_WithNegativeFileDateStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate -12 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of video files with startrange for FileSize such that no files with that value exists +//Input: FileSize as Key and a valid value 2000000 as startrange +//Expected: errorcode 0 and empty list is expected +[Test] +title All_video_WithValidFileSizeSartRange_NoExpectedO/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileSize 2000000 NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList of video files with startrange for FileDate such that no files with that value exists +//Input: FileDate as Key and a value 20090201:050000 as startrange +//Expected: errorcode 0 and empty list is expected +[Test] +title All_video_WithVsalidFileDate_NoExpectedO/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20090201:050000 NULL NULL NULL 0 +delete foobar +[Endtest] + + +//GetList of video files with invalid value for startrange for FileDate +//Input: FileDate as Key and a value 20094545:909834 as startrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title All_videoNeg_InvalidFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileDate 20094545:909834 NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList with startrange and no key +//Input: NULL as Key and 20000 and 30000 as start and end range values respectively +//Expected: list of All video files is expected +[Test] +title All_video_NullKey +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All NULL 20000 30000 NULL NULL 0 +delete foobar +[Endtest] + + +//GetList with empty string as startrange +//Input: FileName as Key and empty string as startrange +//Expected: errorcode 0 is returned and empty list is returned +[Test] +title All_video_EmptyStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName "" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with integer as startrange +//Input: FileName as Key and integer value 12 as startrange +//Expected: errorcode 0 and empty list is returned +[Test] +title All_video_IntegerFileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName 12 NULL NULL NULL 0 +delete foobar +[Endtest] + + +//GetList of video files with a Null string as startrange for FileName +//Input: FileName as Key and a null string "NULL" as startrange +//Expected: errorcode 0 and empty list, as the file named NULL may not be present in the list +[Test] +title All_video_FileNameKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileName "NULL" NULL NULL NULL 0 //1002 +delete foobar +[Endtest] + +//GetList of video files with a Null string as startrange for FileExtension +//Input: FileExtension as Key and a null string "NULL" as startrange +//Expected: errorcode 0 and empty list +[Test] +title All_video_FileExtensionKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileExtension "NULL" NULL NULL NULL 0 //1002 +delete foobar +[Endtest] + +//GetList of video files with a Null string as startrange for Drive +//Input: Drive as Key and a null string "NULL" as startrange +//Expected: errorcode 0 and empty list +[Test] +title All_video_DriveKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All Drive "NULL" NULL NULL NULL 0 //1002 +delete foobar +[Endtest] + + +//GetList of video files with a Null string as startrange for MimeType +//Input: MimeType as Key and a null string "NULL" as startrange +//Expected: errorcode 0 and empty list +[Test] +title All_video_MimeTypeKey__NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All MimeType "NULL" NULL NULL NULL 0 // 1002 +delete foobar +[Endtest] + +//GetList of video files with a Null string as startrange for FileNameAndPath +//Input: FileNameAndPath as Key and a null string "NULL" as startrange +//Expected: errorcode 0 and empty list +[Test] +title All_video_FileNameAndPathKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo All FileNameAndPath "NULL" NULL NULL NULL 0 //1002 +delete foobar +[Endtest] + +################################# Type==“FileInfo” + Passing Filter Map with FileType==video + Key+Start Range + End Range ###################### + +//GetList of video files with endrange less than startrange for FileSize +//Input: FileSize as Key, 70000 as startrange and 20000 ( ExpectedStart StartMap Next/End +foobar GetFilesListL FileInfo Music FileName music1 NULL NULL NULL 0 Expected Media music1 .mp3 c: 271890 20090006:031914 c:\data\sounds\digital\music1.mp3 Audio/MPEG music1.mp3 Lata Album2 1 Rock Anu EndMap ExpectedEnd +delete foobar +[Endtest] + +*/ + + +###################################################################### Test cases starts ######################################################################## + + +//GetList of Audio files by FileName, no startrange +//Input: FileName as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType is expected o/p as the startrange is mandatory when Key is mentioned +[Test] +title Audio_FileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileName music1 NULL NULL NULL 0 Expected Media music1 .mp3 c: 271890 20090006:031914 c:\data\sounds\digital\music1.mp3 Audio/MPEG music1.mp3 Lata Album2 1 Rock Anu EndMap ExpectedEnd +delete foobar +[Endtest] + + + +//GetList of Audio files by key SongName, no startrange +//Input: SongName as key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AudioNeg_SongNameKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio SongName NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList of Audio files by key Artist, no startrange +//Input: Artist as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AudioNeg_ArtistKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Artist NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +//GetList of Audio files by key Album, no startrange +//Input: Album as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AudioNeg_AlbumKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Album NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList of Audio files by key TrackNumber, no startrange +//Input: TrackNumber as Key and Null startrange +//Expected: errorcode 1002-BadArgumentType +[Test] +title AudioNeg_TrackNumberKeyWithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio TrackNumber NULL NULL NULL NULL 1002 +delete foobar +[Endtest] + +//GetList of Audio files by key Genre, no startrange +//Input: Genre as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AudioNeg_GenreKey_WithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Genre NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + +//GetList of Audio files by key Composer, no startrange +//Input: Composer as Key and Null startrange +//Expected: errorcode 1003-MissingArgumentType +[Test] +title AudioNeg_ComposerKey_WithNoStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Composer NULL NULL NULL NULL 1003 +delete foobar +[Endtest] + + +################################### Type==“FileInfo” + Passing Filter Map with FileType==Audio + Key+Start Range ######################## + + +//GetList with startrange for FileName +//Input: FileName as Key, music1 as startrange +//Expected: list of music files with FileName music1, sorted in ascending order based on FileName, which is the default sort key and order +[Test] +title Audio_FileNameKeyWithValidStartRange +create tmediaprovidertesting foobar + +foobar GetFilesListL FileInfo Audio FileName music1 NULL NULL NULL 0 Expected Media music1 .mp3 c: 271890 20090006:031914 c:\data\sounds\digital\music1.mp3 Audio/MPEG music1.mp3 Lata Album2 1 Rock Anu EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with startrange for FileName +//Input: FileName as Key, music1 as startrange +//Expected: list of music files with FileName music1, sorted in ascending order based on FileName, which is the default sort key and order +[Test] +title Audio_FileNameKeyforMusicAndSoundWithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileName music2 NULL NULL NULL 0 Expected StartMap FileName music2 .mp3 MimeType Audio/MPEG EndMap StartMap FileName music2 .wav MimeType Audio/AMR EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of Audio files by MimeType +//Input: MimeType as Key, Audio/MPEG as startrange +//Expected: list of Audio files with MimeType Audio/MPEG are expected +[Test] +title Audio_MimeTypeKey_Audio/mpegStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio MimeType Audio/MPEG NULL NULL NULL 0 ExpectedStart StartMap FileName music1 MimeType Audio/MPEG EndMap StartMap FileName music2 MimeType Audio/MPEG EndMap StartMap FileName music3 MimeType Audio/MPEG EndMap StartMap FileName music4 MimeType Audio/MPEG EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of Audio files by FileNameAndPath +//Input: FileNameAndPath as Key and c:\data\sounds\digital\music2.mp3 as startrange +//Expected: list of Audio files with file path c:\data\sounds\digital\music2.mp3 is expected +[Test] +title Audio_FileNameAndPathKey_WithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileNameAndPath c:\data\sounds\digital\music2.mp3 NULL NULL NULL 0 ExpectedStart StartMap FileNameAndPath c:\data\sounds\digital\music2.mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + + //This case is removed as we are not able to get SongName field from the underlying +//A bug with ID: RCHA-7N2938 has been raised for the same +//GetList of music files by key SongName +//Input: SongName as Key and music1 as startrange +//Expected: list of music files with SongName as music1 is expected +[Test] +title Audio_SongNameKey_music1.mp3StartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio SongName music1.mp3 NULL NULL NULL 0 ExpectedStart StartMap FileName music1 SongName music1.mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList of Audio files by key Artist +//Input: Artist as Key Rafi as startrange +//Expected: list of music files with Artist Rafi is expected +[Test] +title Audio_ArtistKey_WithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Artist Rafi NULL NULL NULL 0 ExpectedStart StartMap FileName music2 Artist Rafi EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList of Audio files by key Album +//Input: Album as Key and Shaheed as startrange +//Expected: list of music files with Album value as Shaheed is expected +[Test] +title Audio_AlbumKey_WithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Album Shaheed NULL NULL NULL 0 ExpectedStart StartMap FileName music2 Album Shaheed EndMap ExpectedEnd +delete foobar +[Endtest] + +/* + //This case is removed as we are not able to get TrackNumber field from the underlying framework +//A bug with ID: RCHA-7N2938 has been raised for the same +//GetList of music files by key TrackNumber +//Input: TrackNumber as Key and 3 as value for startrange +//Expected: list of music files with 3 as TrackNumber +[Test] +title Audio_TrackNumberKeyWithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio TrackNumber 3 NULL NULL NULL 0 ExpectedStart StartMap FileName music3 TrackNumber 3 EndMap ExpectedEnd +delete foobar +[Endtest] +*/ + + +//GetList of Audio files by key Genre +//Input: Genre as Key and Rock as startrange +//Expected: list of music files with Genre as Rock is expected +[Test] +title Audio_GenreKeyWithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Genre Rock NULL NULL NULL 0 ExpectedStart StartMap FileName music1 Genre Rock EndMap StartMap FileName music4 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList of music files by key Composer +//Input: Composer as Key and malik as startrange +//Expected: list of music with Composer as Malik +[Test] +title Audio_ComposerKeyWithValidStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Composer Malik NULL NULL NULL 0 ExpectedStart StartMap FileName music4 Composer Malik EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with null string as value for FileNameAndPath +//Input: FileNameAndPath as Key and a null string "null" as startrange +//Expected: errorcode 0 and empty list +[Test] +title Audio_FileNameAndPathKey_NullStringStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileNameAndPath "NULL" NULL NULL NULL 0 +delete foobar +[Endtest] + +//GetList with integer value for FileName +//Input: FileName as Key and an integer value 12 as startrange +//Expected: errorcode 0 and empty list as there are no music files with this name +[Test] +title Audio_IntegerStartRange +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileName 12 NULL NULL NULL 0 +delete foobar +[Endtest] + + +##################################### Type==“FileInfo” + Passing Filter Map with FileType==Audio + Sort Map ################################# + +//GetList with Ascending order for a given drive +//Input: Drive as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on drive +[Test] +title Audio_SortAscendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Genre Rock NULL Drive Ascending 0 ExpectedStart StartMap FileName music1 Genre Rock EndMap StartMap FileName music4 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given drive +//Input: Drive as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on drive +[Test] +title Audio_SortDescendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Genre Rock NULL Drive Descending 0 ExpectedStart StartMap FileName music4 Genre Rock EndMap StartMap FileName music1 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileExtension +//Input: FileExtension as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on FileExtension +[Test] +title Audio_SortAscendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileExtension Ascending 0 ExpectedStart StartMap FileName music4 FileExtension .mp3 EndMap StartMap FileName music5 FileExtension .rm EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileExtension +//Input: FileExtension as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on FileExtensions +[Test] +title Audio_SortDescendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileExtension Descending 0 ExpectedStart StartMap FileName music5 FileExtension .rm EndMap StartMap FileName music4 FileExtension .mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given MimeType +//Input: MimeType as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on MimeType +[Test] +title Audio_SortAscendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL MimeType Ascending 0 ExpectedStart StartMap FileName music4 MimeType Audio/MPEG EndMap StartMap FileName music5 MimeType Audio/x-pn-realAudio EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given MimeType +//Input: MimeType as sortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on MimeType +[Test] +title Audio_SortDescendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL MimeType Descending 0 ExpectedStart StartMap FileName music5 MimeType Audio/x-pn-realAudio EndMap StartMap FileName music4 MimeType Audio/MPEG EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileSize +//Input: FileSize as sortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on FileSize +[Test] +title Audio_SortAscendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileSize Ascending 0 ExpectedStart StartMap FileName music4 FileSize 434288 EndMap StartMap FileName music5 FileSize 1381291 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileSize +//Input: FileSize as sortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on FileSize +[Test] +title Audio_SortDescendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileSize Descending 0 ExpectedStart StartMap FileName music5 FileSize 1381291 EndMap StartMap FileName music4 FileSize 434288 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileDate +//Input: FileDate as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on FileDate +[Test] +title Audio_SortAscendingOnFileDate +create tmediaprovidertesting foobar +//foobar GetFilesListL FileInfo Audio Genre Classical NULL FileDate Ascending 0 ExpectedStart StartMap FileName music2 FileDate 20090006:052103 EndMap StartMap FileName music3 FileDate 20090028:010527 EndMap StartMap FileName music5 FileDate 20090103:100223 EndMap ExpectedEnd //org +foobar GetFilesListL FileInfo Audio Genre Rock NULL FileDate Ascending 0 ExpectedStart StartMap FileName music1 FileDate 20090116:091802 EndMap StartMap FileName music4 FileDate 20090117:111341 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileDate +//Input: FileDate as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on FileDate +[Test] +title Audio_SortDescendingOnFileDate +create tmediaprovidertesting foobar +//foobar GetFilesListL FileInfo Audio Genre Classical NULL FileDate Descending 0 ExpectedStart StartMap FileName music5 FileDate 20090103:100223 EndMap StartMap FileName music3 FileDate 20090028:010527 EndMap StartMap FileName music2 FileDate 20090006:052103 EndMap ExpectedEnd //org +foobar GetFilesListL FileInfo Audio Genre Rock NULL FileDate Descending 0 ExpectedStart StartMap FileName music4 FileDate 20090117:111341 EndMap StartMap FileName music1 FileDate 20090116:091802 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given Artist +//Input: Artist as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on Artist +[Test] +title Audio_SortAscendingOnArtist +create tmediaprovidertesting foobar +//foobar GetFilesListL FileInfo Audio Drive e: NULL Artist Ascending 0 ExpectedStart StartMap FileName music4 Artist Kk EndMap StartMap FileName music5 Artist Shreya EndMap ExpectedEnd //org +foobar GetFilesListL FileInfo Audio Drive c: NULL Artist Ascending 0 ExpectedStart StartMap FileName music1 Artist Lata EndMap StartMap FileName music2 Artist Rafi EndMap StartMap FileName music3 Artist Sonu EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given Artist +//Input: Artist as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on Artist +[Test] +title Audio_SortDescendingOnArtist +create tmediaprovidertesting foobar +//foobar GetFilesListL FileInfo Audio Drive e: NULL Artist Descending 0 ExpectedStart StartMap FileName music5 Artist Shreya EndMap StartMap FileName music4 Artist Kk EndMap ExpectedEnd //org +foobar GetFilesListL FileInfo Audio Drive c: NULL Artist Descending 0 ExpectedStart StartMap FileName music3 Artist Sonu EndMap StartMap FileName music2 Artist Rafi EndMap StartMap FileName music1 Artist Lata EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Ascending order for a given Genre +//Input: Genre as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on Genre +[Test] +title Audio_SortAscendingOnGenre +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileSize 400000 500000 Genre Ascending 0 ExpectedStart StartMap FileName music3 Genre Classical EndMap StartMap FileName music4 Genre Rock EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given Genre +//Input: Genre as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on Genre +[Test] +title Audio_SortDescendingOnGenre +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileSize 400000 500000 Genre Descending 0 ExpectedStart StartMap FileName music4 Genre Rock EndMap StartMap FileName music3 Genre Classical EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given Composer +//Input: Composer as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on Composer +[Test] +title Audio_SortAscendingOnComposer +create tmediaprovidertesting foobar +//foobar GetFilesListL FileInfo Audio Drive e: NULL Composer Ascending 0 ExpectedStart StartMap FileName music4 Composer Malik EndMap StartMap FileName music5 Composer Rahman EndMap ExpectedEnd //org +foobar GetFilesListL FileInfo Audio Drive c: NULL Composer Ascending 0 ExpectedStart StartMap FileName music1 Composer Anu EndMap StartMap FileName music2 Composer Dhawan EndMap StartMap FileName music3 Composer Rahman EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given Composer +//Input: Composer as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on Composer +[Test] +title Audio_SortDescendingOnComposer +create tmediaprovidertesting foobar +//foobar GetFilesListL FileInfo Audio Drive e: NULL Composer Descending 0 ExpectedStart StartMap FileName music5 Composer Rahman EndMap StartMap FileName music4 Composer Malik EndMap ExpectedEnd //org +foobar GetFilesListL FileInfo Audio Drive c: NULL Composer Descending 0 ExpectedStart StartMap FileName music3 Composer Rahman EndMap StartMap FileName music2 Composer Dhawan EndMap StartMap FileName music1 Composer Anu EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Ascending order for a given Album +//Input: Album as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on Album +[Test] +title Audio_SortAscendingOnAlbum +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive c: NULL Album Ascending 0 ExpectedStart StartMap FileName music3 Album Album1 EndMap StartMap FileName music1 Album Album2 EndMap StartMap FileName music2 Album Shaheed EndMap ExpectedEnd +delete foobar +[Endtest] + +/* + //This case is removed as we are not able to get TrackNumber field from the underlying framework +//A bug with ID: RCHA-7N2938 has been raised for the same +//GetList with Descending order for a given TrackNumber +//Input: TrackNumber as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on TrackNumber +[Test] +title Audio_SortDescendingOnTrackNumber +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive c: NULL TrackNumber Descending 0 ExpectedStart StartMap FileName music3 TrackNumber 3 EndMap StartMap FileName music2 TrackNumber 2 EndMap StartMap FileName music1 TrackNumber 1 EndMap ExpectedEnd +delete foobar +[Endtest]*/ + + +//GetList Nokia as SortOrder +//Input: FileDate as SortKey and Nokia as SortOrder +//Expected: errorcode 1002-BadArgumentType +[Test] +title AudioNeg_NokiaSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio NULL NULL NULL FileDate Nokia 1002 +delete foobar +[Endtest] + + +//GetList ascending(case sensitive) as sort order +//Input: FileName as SortKey and ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on FileName +[Test] +title Audio_WithLowercaseascendingAsSortOrder +create tmediaprovidertesting foobar +//foobar GetFilesListL FileInfo Audio Genre Classical NULL FileDate ascending 0 ExpectedStart StartMap FileName music2 FileDate 20090006:052103 EndMap StartMap FileName music3 FileDate 20090028:010527 EndMap StartMap FileName music5 FileDate 20090103:100223 EndMap ExpectedEnd //org +foobar GetFilesListL FileInfo Audio Drive c: NULL FileName ascending 0 ExpectedStart StartMap FileName music1 EndMap StartMap FileName music2 EndMap StartMap FileName music3 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Ascending sort order for FileNameAndPath +//Input: FileNameAndPath as SortKey and Ascending as SortOrder +//Expected: list of Audio files sorted in ascending order based on FileNameAndPath +[Test] +title Audio_SortAscendingOnFileNameAndPath +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive c: NULL FileNameAndPath Ascending 0 ExpectedStart StartMap FileNameAndPath c:\data\others\music3.mp3 EndMap StartMap FileNameAndPath c:\data\sounds\digital\music1.mp3 EndMap StartMap FileNameAndPath c:\data\sounds\digital\music2.mp3 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Descending order for FileName +//Input: FileName as SortKey and Descending as SortOrder +//Expected: list of Audio files sorted in descending order based on FileName +[Test] +title Audio_SortDescendingOnFileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive c: NULL FileName Descending 0 ExpectedStart StartMap FileName music3 EndMap StartMap FileName music2 EndMap StartMap FileName music1 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with Ascending order for a given drive +//Input: FileExtension as Key .amr as startrange, Drive as SortKey and Ascending as SortOrder +//Expected: list of sound files with file extension .amr,in ascending order of drive +[Test] +title Audio_Sound_SortAscendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileExtension .amr NULL Drive Ascending 0 ExpectedStart StartMap FileName sound Drive c: EndMap StartMap FileName noise Drive e: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given drive +//Input: FileExtension as Key .amr as startrange, Drive as SortKey and Descending as SortOrder +//Expected: list of sound files with .amr file extension, in descending order of drive +[Test] +title Audio_Sound_SortDescendingOnDrive +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio FileExtension .amr NULL Drive Descending 0 ExpectedStart StartMap FileName noise FileExtension .amr Drive e: EndMap StartMap FileName sound FileExtension .amr Drive c: EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileExtension +////Input: Drive as Key e: as startrange, FileExtension as SortKey and Ascending as SortOrder +//Expected: list of sound files, in e: drive, in ascending order of FileExtension +[Test] +title Audio_Sound_SortAscendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileExtension Ascending 0 ExpectedStart StartMap FileName noise FileExtension .amr EndMap StartMap FileName rock_on FileExtension .wav EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileExtension +//Input: Drive as Key e: as startrange, FileExtension as SortKey and Descending as SortOrder +//Expected: list of sound files, in e: drive, in descending order of FileExtension +[Test] +title Audio_Sound_SortDescendingOnFileExtension +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileExtension Descending 0 ExpectedStart StartMap FileName rock_on FileExtension .wav EndMap StartMap FileName noise FileExtension .amr EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given MimeType +//Input: Drive as Key, e: as value for startrange, MimeType as SortKey, Ascending as SortOrder +//Expected: list of sound files,in e: drive, in ascending order of MimeType +[Test] +title Audio_Sound_SortAscendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL MimeType Ascending 0 ExpectedStart StartMap FileName noise MimeType Audio/AMR EndMap StartMap FileName rock_on MimeType Audio/WAV EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given MimeType +//Input: Drive as Key, e: as value for startrange, MimeType as SortKey, Descending as SortOrder +//Expected: list of sound files,in e: drive, in descending order of MimeType +[Test] +title Audio_Sound_SortDescendingOnMimeType +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL MimeType Descending 0 ExpectedStart StartMap FileName rock_on MimeType Audio/WAV EndMap StartMap FileName noise MimeType Audio/AMR EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileSize +//Input: Drive as Key, e: as value for startrange, FileSize as SortKey, Ascending as SortOrder +//Expected: list of sound files,in e: drive, in ascending order of FileSize +[Test] +title Audio_Sound_SortAscendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileSize Ascending 0 ExpectedStart StartMap FileName rock_on FileSize 22965 EndMap StartMap FileName noise FileSize 25031 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileSize +//Input: Drive as Key, e: as value for startrange, FileSize as SortKey, Descending as SortOrder +//Expected: list of sound files in descending order of FileSize +[Test] +title Audio_Sound_SortDescendingOnFileSize +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileSize Descending 0 ExpectedStart StartMap FileName noise FileSize 25031 EndMap StartMap FileName rock_on FileSize 22965 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Ascending order for a given FileDate +//Input: Drive as Key, e: as value for startrange, FileDate as SortKey, Ascending as SortOrder +//Expected: list of sound files,in e: drive, in ascending order of FileDate +[Test] +title Audio_Sound_SortAscendingOnFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileDate Ascending 0 ExpectedStart StartMap FileName rock_on FileDate 20081019:033638 EndMap StartMap FileName noise FileDate 20081109:085028 EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList with Descending order for a given FileDate +//Input: Drive as Key, e: as value for startrange, FileDate as SortKey, Descending as SortOrder +//Expected: list of sound files,in e: drive, in descending order of FileDate +[Test] +title Audio_Sound_SortDescendingOnFileDate +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileDate Descending 0 ExpectedStart StartMap FileName noise FileDate 20081109:085028 EndMap StartMap FileName rock_on FileDate 20081019:033638 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList with no sort order +//Input: Drive as Key, e: as value for startrange, FileName as SortKey, no sortorder(NULL as sortorder) +//Expected: list of sound files,in e: drive, in ascending order(default order) of FileName +[Test] +title Audio_Sound_NoSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileName NULL 0 ExpectedStart StartMap FileName noise EndMap StartMap FileName rock_on EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList Nokia as SortOrder +//Input: FileDate as SortKey and Nokia as SortOrder +//Expected: errorcode 1002-BadArgumentType is expected output, as the value for SortOrder is invalid +[Test] +title Audio_Sound_NokiaSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio NULL NULL NULL FileDate Nokia 1002 +delete foobar +[Endtest] + + +//GetList ascending(case sensitive) as sort order +//Input: Drive as Key, e: as value for startrange, FileDate as value for SortKey and ascending(lower case) as value for SortOrder +//filters as per the filter key and order mentioned +[Test] +title Audio_Sound_lowercase_ascendingSortOrder +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileDate ascending 0 ExpectedStart StartMap FileName rock_on FileDate 20081019:033638 EndMap StartMap FileName noise FileDate 20081109:085028 EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Ascending sort order for FileNameAndPath +//Input: FileNameAndPath as SortKey and Ascending as SortOrder +//Expected: list of sound files in ascending order of FileNameAndPath +[Test] +title Audio_Sound_SortAscendingOnFileNameAndPath +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive c: NULL FileNameAndPath Ascending 0 ExpectedStart StartMap FileNameAndPath c:\data\others\music.wav EndMap StartMap FileNameAndPath c:\data\sounds\digital\raaga.wav EndMap StartMap FileNameAndPath c:\data\sounds\digital\sound.amr EndMap StartMap FileNameAndPath c:\data\sounds\digital\tempo.wav EndMap ExpectedEnd +delete foobar +[Endtest] + + +//GetList Descending order for FileName +//Input: FileName as SortKey and Descending as value for SortOrder +//Expected: list of sound files in descending order of FileName +[Test] +title Audio_Sound_SortDescendingOnFileName +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio MimeType Audio/AMR NULL FileName Descending 0 ExpectedStart StartMap FileName sound MimeType Audio/AMR EndMap StartMap FileName noise MimeType Audio/AMR EndMap ExpectedEnd +delete foobar +[Endtest] + +//GetList to check for all fields +//Input: Drive as FilterKey and e: as startrange FileName as SortKey and Descending as value for SortOrder +//Expected: list of sound files in e: drive, in descending order of FileName +[Test] +title Audio_Sound_DriveKey_e:StartRange_CheckForAllKeysInExpectedO/p +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Audio Drive e: NULL FileName Descending 0 ExpectedStart StartMap Type Media FileName rock_on FileExtension .wav Drive e: FileSize 22965 FileDate 20081019:033638 FileNameAndPath e:\data\sounds\digital\rock_on.wav MimeType Audio/WAV EndMap StarMap Type Media FileName noise FileExtension .amr Drive e: FileSize 25031 FileDate 20081109:085028 FileNameAndPath e:\data\sounds\digital\noise.amr MimeType Audio/AMR EndMap ExpectedEnd +delete foobar +[Endtest] + +############################################ Audio Ends ################################################# + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/conf/tmediamgmttest_image.cfg --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/conf/tmediamgmttest_image.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/conf/tmediamgmttest_image.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -811,7 +811,7 @@ [Test] title Img_SortDescendingOnFileName create tmediaprovidertesting foobar -foobar GetFilesListL FileInfo Image Drive c: NULL FileName Descending 0 ExpectedStart StartMap FileName dreams EndMap StartMap FileName blue EndMap StartMap FileName ant EndMap StartMap FileName a EndMap ExpectedEnd +foobar GetFilesListL FileInfo Image Drive c: NULL FileName Descending 0 ExpectedStart StartMap FileName dreams XPixels 800 YPixels 600 EndMap StartMap FileName blue XPixels 318 YPixels 301 EndMap StartMap FileName ant XPixels 329 YPixels 220 EndMap StartMap FileName a XPixels 1152 YPixels 864 EndMap ExpectedEnd delete foobar [Endtest] @@ -827,5 +827,14 @@ [Endtest] +//Case to check for the new output field resolution for Images only added for CJSE 2.0 +//Input: Image as FileType +//Expected: list of all images files with Resolution map as output +[Test] +title Img_Resolution +create tmediaprovidertesting foobar +foobar GetFilesListL FileInfo Image Drive c: NULL NULL NULL 0 ExpectedStart StartMap Type Media FileName a FileExtension .jpg Drive c: FileSize 31097 FileDate 20070920:053905 FileNameAndPath c:\data\Images\a.jpg MimeType image/jpeg XPixels 1152 YPixels 864 EndMap StartMap Type Media FileName ant FileExtension .jpg Drive c: FileSize 8474 FileDate 20060819:102426 FileNameAndPath c:\data\Images\ant.jpg MimeType image/jpeg XPixels 329 YPixels 220 EndMap StartMap Type Media FileName blue FileExtension .png Drive c: FileSize 4796 FileDate 20070302:120443 FileNameAndPath c:\data\Images\blue.png MimeType image/png XPixels 318 YPixels 301 EndMap StartMap Type Media FileName dreams FileExtension .bmp Drive c: FileSize 73105 FileDate 20070108:015537 FileNameAndPath c:\data\Images\pictures\dreams.bmp MimeType image/bmp XPixels 800 YPixels 600 EndMap ExpectedEnd +delete foobar +[Endtest] ################################################################ Image Ends #################################################### diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/eabi/tmediaprovidertestingu.def --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/eabi/tmediaprovidertestingu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/eabi/tmediaprovidertestingu.def Thu Aug 27 07:43:07 2009 +0300 @@ -1,3 +1,5 @@ EXPORTS _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI14CMediaObserver @ 2 NONAME ; ## + _ZTV14CMediaObserver @ 3 NONAME ; ## diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/group/tmediaprovidertesting.mmp --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/group/tmediaprovidertesting.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/group/tmediaprovidertesting.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -24,6 +24,7 @@ CAPABILITY ALL -TCB DEFFILE tmediaprovidertesting.def +EPOCALLOWDLLDATA USERINCLUDE ../inc USERINCLUDE ../../../../mediamanagementservice/inc @@ -33,12 +34,13 @@ SOURCE tmediaprovidertesting.cpp SOURCE tmediaprovidertestingBlocks.cpp SOURCE tmediaprovidertestingImpl.cpp +SOURCE tmediaobserver.cpp LIBRARY euser.lib LIBRARY stiftestinterface.lib LIBRARY stiftestengine.lib LIBRARY liwServiceHandler.lib - +LIBRARY efsrv.lib LANG SC // End of File \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaobserver.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,164 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +#ifndef _TMEDIAPROVIDERTESTING_H__ +#define _TMEDIAPROVIDERTESTING_H__ + +#include +#include +#include +#include +extern TInt count; +class CMediaObserver : public CBase , public MLiwNotifyCallback +{ + public : + enum TFileType + { + EOtherFile, + EMusicFile, + EStreamingURLFile + }; + public: + + static CMediaObserver* NewL(); + + /** + * Destructor. + */ + virtual ~CMediaObserver(); + + private : + void ConstructL(); + + CMediaObserver(); + + public: // New functions + /** + * A static method which compares two result maps. This mehtod compares image,sound and video maps. + * @return ETrue OR EFalse. + */ + TBool CMediaObserver::CompareMaps(CLiwMap* aExpectedMap, + const CLiwMap* aResultMap); + /** + * A static method which compares two strings from the maps. + * @param aKey key value to be compared. + * @param aExpectedMap the expected result map. + * @param aResultMap the fetched result map. + * @return ETrue OR EFalse. + */ + TBool CMediaObserver::CompareStringResult(const TDesC8& aKey, + CLiwMap* aExpectedMap, + const CLiwMap* aResultMap); + + /** + * A static method which compares two TTime values from the maps. + * @param aKey key value to be compared. + * @param aExpectedMap the expected result map. + * @param aResultMap the fetched result map. + * @return ETrue OR EFalse. + */ + TBool CMediaObserver::CompareTTimeResult(const TDesC8& aKey, + CLiwMap* aExpectedMap, + const CLiwMap* aResultMap); + + /** + * A static method which compares two TTime values from the maps. + * @param aKey key value to be compared. + * @param aExpectedMap the expected result map. + * @param aResultMap the fetched result map. + * @return ETrue OR EFalse. + */ + TBool CMediaObserver::CompareTIntResult(const TDesC8& aKey, + CLiwMap* aExpectedMap, + const CLiwMap* aResultMap); + + + +public: + /** + * From the MLiwNotifyCallback interface it is called by the media management service. + * @param aCmdId Script line containing method name and parameters. + * @return Symbian OS error code. + */ + TInt HandleNotifyL(TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList); +public: + + /** + * This method checks whether the obtained result and the expected results match. + * @param aResultlist a list of maps as iterator to be compared with expected output. + * @return Symbian OS error code. + */ + TBool IsExpectedResult(CLiwIterable* aResultlist); + + + /** + * This method parses the input from cfg file and prepare the input list. + * @param aItem input list contaning input params from cfg file. + * @return Symbian OS error code. + */ + void ParseStiffInput(CStifItemParser& aItem); + /** + * This method parses the input from cfg file and prepare the Expected out put list. + * @param aItem input list contaning input params from cfg file. + * @return Symbian OS error code. + */ + void SetExpectedOutputMap(CStifItemParser& aItem); + + + + public: + //An array to hold the expected result maps. + RPointerArray iExpectedOutPutArray; + //input parameter list + CLiwGenericParamList* iInList; + + //input parameter list + CLiwGenericParamList* iOutList; + + + //the expected output error code + TInt iExpErrorCode; + //result of the test case. + TInt iResult; + //file type + TFileType iFiletype; + //Filename + HBufC* iFilename; + RFs iFs; + RFile iFile; + + +}; + + + + + + + + + + + + + + + +#endif // _TMEDIAPROVIDERTESTING_H__ diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaprovidertesting.h --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaprovidertesting.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaprovidertesting.h Thu Aug 27 07:43:07 2009 +0300 @@ -61,7 +61,8 @@ { EOtherFile, EMusicFile, - EStreamingURLFile + EStreamingURLFile, + EImageFile }; public: // Constructors and destructor @@ -157,6 +158,17 @@ * @return Symbian OS error code. */ TInt GetFilesListL(CStifItemParser& aItem); + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + TInt GetListBackToBackCallL(CStifItemParser& aItem); + + + /** * loades the media management service. * @return MLiwInterface pointer. @@ -200,7 +212,10 @@ //interface handle MLiwInterface* iIface; //file type - TFileType iFiletype; + TFileType iFiletype; + + // Number of back to back async request given + TInt iNumberApiCall ; }; #endif // TMEDIAPROVIDERTESTING_H // End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaprovidertesting.hrh --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaprovidertesting.hrh Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/inc/tmediaprovidertesting.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -63,6 +63,8 @@ _LIT8( KMgMediaType, "MediaType" ); _LIT8( KMgMimeType, "MimeType" ); _LIT8( KMgFileNameAndPath, "FileNameAndPath"); +_LIT8(KXPixels, "XPixels"); +_LIT8(KYPixels, "YPixels"); //additional keys for music map. _LIT8( KMgSongName, "SongName" ); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaobserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaobserver.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,696 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include + + +#include "tmediaprovidertesting.h" +#include "tmediaprovidertesting.hrh" +#include "tmediaobserver.h" + +_LIT(KFilenm,"C:\\Data\\Output"); +/* -------------------------------------------------------------------------- + CMediaObserver :: SetInput + Fills the input parameter list. + The format of the cfg input is + key startRange endRange sortKey sortOrder errorcode + [Expected fileName fileExtension drive fileSize fileDate fileNameAndPath mimeType + [Next "next map data"]]. +----------------------------------------------------------------------------- +*/ +void CMediaObserver::ParseStiffInput(CStifItemParser& aItem) + { + + iFile.Write(_L8("In ParseStiffInput parsing input \n")); + + TPtrC16 expectedStart(KNullDesC); + TPtrC16 key(KNullDesC); + TPtrC16 startRange(KNullDesC); + TPtrC16 endRange(KNullDesC); + TPtrC16 sortKey(KNullDesC); + TPtrC16 sortOrder(KNullDesC); + TPtrC16 inpType(KNullDesC); + TPtrC16 inpFileType(KNullDesC); + + aItem.GetNextString(inpType); + aItem.GetNextString(inpFileType); + aItem.GetNextString(key); + aItem.GetNextString(startRange); + aItem.GetNextString(endRange); + aItem.GetNextString(sortKey); + aItem.GetNextString(sortOrder); + aItem.GetNextInt(iExpErrorCode); + aItem.GetNextString(expectedStart); + + TBuf8<100> buf; + buf.Copy(inpType); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + + buf.Copy(inpFileType); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + buf.Copy(key); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + buf.Copy(startRange); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + buf.Copy(endRange); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + buf.Copy(sortKey); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + buf.Copy(sortOrder); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + buf.Num(iExpErrorCode); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + buf.Copy(expectedStart); + buf.Append(_L8("\n")); + iFile.Write(buf); + buf.Zero(); + + if(inpFileType.CompareF(KFileTypeStreamingURL) == 0) + { + iFiletype = EStreamingURLFile; + } + else if(inpFileType.CompareF(KFileTypeMusic) == 0) + { + iFiletype = EMusicFile; + } + //check for expected key + //if it is there then get the expected result and put it into the map. + if(expectedStart.CompareF(KExpectedStart) == 0) + { + SetExpectedOutputMap(aItem); + } + /* iLog->Log(_L("The Input Parameters are:")); + iLog->Log(key); + iLog->Log(startRange); + iLog->Log(endRange); + iLog->Log(sortKey); + iLog->Log(sortOrder); + */ + CLiwDefaultMap *sortMap = NULL; + + //set the content type to the fileinfo. + if(inpType.Compare(_L("NULL")) != 0) + { + if(inpType.Compare(_L("NULLVALUE")) == 0) inpType.Set(KNullDesC); + const TLiwGenericParam paramContentType(KType, TLiwVariant(inpType)); + iInList->AppendL(paramContentType); + } + + CLiwDefaultMap *filterMap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(filterMap); + + TLiwGenericParam filterParam(KFilter, TLiwVariant(filterMap)); + iInList->AppendL(filterParam); + filterMap->DecRef(); + + //Set the file type to image. + if(inpFileType.Compare(_L("NULL")) != 0) + { + if(inpFileType.Compare(_L("NULLVALUE")) == 0) inpFileType.Set(KNullDesC); + filterMap->InsertL(KFileType,TLiwVariant(inpFileType)); + } + //Get the key if it is specified. + if(key.Compare(_L("NULL")) != 0) + { + if(key.Compare(_L("NULLVALUE")) == 0) key.Set(KNullDesC); + filterMap->InsertL(KKey,TLiwVariant(key)); + } + //Get the startRange if it is specified. + if(startRange.Compare(_L("NULL")) != 0) + { + if(startRange.Compare(_L("NULLVALUE")) == 0) startRange.Set(KNullDesC); + filterMap->InsertL(KStartRange,TLiwVariant(startRange)); + } + //Get the endRange if it is specified. + if(endRange.Compare(_L("NULL")) != 0) + { + if(endRange.Compare(_L("NULLVALUE")) == 0) endRange.Set(KNullDesC); + filterMap->InsertL(KEndRange,TLiwVariant(endRange)); + } + //only if the sort key is specified create the map + if(sortKey.Compare(_L("NULL")) != 0) + { + sortMap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(sortMap); + if(sortKey.Compare(_L("NULLVALUE"))== 0) sortKey.Set(KNullDesC); + sortMap->InsertL(KKey,TLiwVariant(sortKey)); + TLiwGenericParam sortParam(KSort, TLiwVariant(sortMap)); + iInList->AppendL(sortParam); + sortMap->DecRef(); + } + //get the sort order if it is specified. + if(sortOrder.Compare(_L("NULL")) != 0) + { + if(!sortMap) + { + sortMap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(sortMap); + if(sortOrder.Compare(_L("NULLVALUE"))== 0) sortOrder.Set(KNullDesC); + TLiwGenericParam sortParam(KSort, TLiwVariant(sortMap)); + iInList->AppendL(sortParam); + sortMap->DecRef(); + } + sortMap->InsertL(KOrder,TLiwVariant(sortOrder)); + } + //end of input params now look for expected params + if(sortMap) + { + CleanupStack::Pop(sortMap); + } + CleanupStack::Pop(filterMap); +} + +/* -------------------------------------------------------------------------- + CMediaObserver :: SetExpectedImageOutputMap. + This method fills the expected output map. +----------------------------------------------------------------------------- +*/ +void CMediaObserver :: SetExpectedOutputMap(CStifItemParser& aItem) + { + TPtrC16 nextString(KNullDesC); + + iFile.Write(_L8("Inside SetExpectedOutputMap\n")); + // iLog->Log(_L("Inside SetExpectedOutputMap")); + + aItem.GetNextString(nextString); + /* + * The expected output is in the format. + * [ExpectredStart StartMap Key Value[...]EndMap[...]ExpectedEnd]. + */ + while(nextString.CompareF(KExpectedEnd)!=0) + { + if(nextString.CompareF(KMapStart) == 0) + { + CLiwDefaultMap* expectedOutPutMap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(expectedOutPutMap); + aItem.GetNextString(nextString); + + while(nextString.CompareF(KMapEnd)!= 0) + { + TPtrC key; + TPtrC value; + TBuf8<255> insertKey; + + key.Set(nextString); + insertKey.Copy(key); + iFile.Write(_L8("Key : ")); + iFile.Write(insertKey); + iFile.Write(_L8("\n")); + if(key.CompareF(_L("FileSize"))==0) + { + TInt fileSize = -1; + aItem.GetNextInt(fileSize); + expectedOutPutMap->InsertL(insertKey, (TInt32)fileSize); + } + else + { + aItem.GetNextString(nextString); + value.Set(nextString); + TBuf8<70> buf; + buf.Append(value); + buf.Append(_L8("\n")); + iFile.Write(buf); + + expectedOutPutMap->InsertL(insertKey, value); + } + aItem.GetNextString(nextString); + } + + iExpectedOutPutArray.Append(expectedOutPutMap); + CleanupStack::Pop(expectedOutPutMap); + } + aItem.GetNextString(nextString); + } + } + +/* -------------------------------------------------------------------------- + CMediaObserver :: IsExpectedResult. + This method checks whether the obtained result and the expected results match. . +----------------------------------------------------------------------------- +*/ +TBool CMediaObserver::IsExpectedResult(CLiwIterable* aResultlist) + { + TLiwVariant fileDetails; + TBool foundMap = EFalse; + TInt prevFoundIndex = -1; + TInt index = 0; + iFile.Write(_L8("Inside IsExpectedResult\n")); + // iLog->Log(_L("Inside IsExpectedResult")); + + for(TInt i = 0; iNextL(fileDetails)) + { + const CLiwMap* map = fileDetails.AsMap(); + if(map) + { + iFile.Write(_L8("Map found from iterator\n")); + // iLog->Log(_L("Map found from iterator"));// Lok + //compare the two maps the result and the expected one. + if(CMediaObserver :: CompareMaps(iExpectedOutPutArray[i], map)) + { + aResultlist->Reset(); + foundMap = ETrue; + if(indexLog(_L("Result Not in Expected sort order")); + User::Leave(KErrGeneral); + } + iFile.Write(_L8("Map is in sorted order with position\n")); + // iLog->Log(_L("Map is in sorted order with positio ")); // Lok + TBuf8<10>buf; + buf.Num(index); + iFile.Write(buf); + // iLog->Log(buf); + buf.Zero(); + prevFoundIndex = index; + break; + } + } + index++; + } + if(foundMap) + { + foundMap = EFalse; + } + else + { + iFile.Write(_L8("Expected map not found in the result list\n")); + // iLog->Log(_L("Expected map not found in the result list")); + return EFalse; + } + } + return ETrue; + } + +/* -------------------------------------------------------------------------- + CMediaObserver :: CompareMaps. + A static method which compares two maps. +----------------------------------------------------------------------------- +*/ +TBool CMediaObserver::CompareMaps(CLiwMap* aExpectedMap, + const CLiwMap* aResultMap) + { + iFile.Write(_L8("Inside CompareMaps\n")); + // iLog->Log(_L("Inside CompareMaps")); + if(!CompareStringResult(KType, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareStringResult(KMgFileName, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareStringResult(KMgDrive, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareTIntResult(KMgFileSize, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareStringResult(KMgMimeType, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareStringResult(KMgFileNameAndPath, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareTTimeResult(KMgFileDate, aExpectedMap, aResultMap)) + { + return EFalse; + } + //In case of streamingURL file check for few additional keys. + if(iFiletype == EStreamingURLFile) + { + if(!CompareStringResult(KMgLinkFirstURL, aExpectedMap, aResultMap)) + { + return EFalse; + } + } + //In case of Music file check for few additional keys. + if(iFiletype == EMusicFile) + { + if(!CompareStringResult(KMgComposer, aExpectedMap, aResultMap)) + { + return EFalse; + } + + if(!CompareStringResult(KMgArtist, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareStringResult(KMgAlbum, aExpectedMap, aResultMap)) + { + return EFalse; + } + + if(!CompareStringResult(KMgGenre, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareTIntResult(KMgTrackNumber, aExpectedMap, aResultMap)) + { + return EFalse; + } + if(!CompareStringResult(KMgSongName, aExpectedMap, aResultMap)) + { + return EFalse; + } + } + return ETrue; + } + + +/* -------------------------------------------------------------------------- + CMediaObserver :: CompareStringResult. + A static method which compares two string results from the maps. +----------------------------------------------------------------------------- +*/ +TBool CMediaObserver::CompareStringResult(const TDesC8& aKey, + CLiwMap* aExpectedMap, + const CLiwMap* aResultMap) + { + TLiwVariant expValue; + TLiwVariant resValue; + TBool equal = EFalse; + + iFile.Write(_L8("Inside CompareStringResult\n")); + // iLog->Log(_L("Inside CompareStringResult")); + + if(!aExpectedMap->FindL(aKey, expValue)) + { + return ETrue; + } + aResultMap->FindL(aKey, resValue); + + TPtrC expPtr = expValue.AsDes(); + TPtrC resPtr = resValue.AsDes(); + TBuf8<100> buf; + buf.Copy(expPtr); + iFile.Write(_L8("Expected Value\n")); + iFile.Write(buf); + buf.Zero(); + buf.Copy(resPtr); + iFile.Write(_L8("\nResult Value\n")); + iFile.Write(buf); + iFile.Write(_L8("\n")); + buf.Zero(); + + if(expPtr.CompareF(_L("NULL"))!=0) + { + if(expPtr.CompareF(resPtr) == 0) + { + equal = ETrue; + } + } + + expValue.Reset(); + resValue.Reset(); + + return equal; + } + +/* -------------------------------------------------------------------------- + CMediaObserver :: CompareTTimeResult. + A static method which compares two TTime results from the maps. +----------------------------------------------------------------------------- +*/ +TBool CMediaObserver::CompareTTimeResult(const TDesC8& aKey, + CLiwMap* aExpectedMap, + const CLiwMap* aResultMap) + { + // iLog->Log(_L("Inside CompareStringResult")); + TLiwVariant expValue; + TLiwVariant resValue; + TBool equal = EFalse; + TBuf<255> timeString; + + if(!aExpectedMap->FindL(aKey, expValue)) + { + return ETrue; + } + aResultMap->FindL(aKey, resValue); + + TTime expTime(expValue.AsDes()); + + /* iLog->Log(_L("Expected Value")); + iLog->Log(expValue.AsDes()); + */ + TTime resTime = resValue.AsTTime(); + + //resTime.FormatL(timeString, _L("%:0%J%:1%T%:2%S%.%*C3%:3%+B %*E%*D%X%*N%*Y %1 %2 '%3")); + resTime.FormatL(timeString, _L("%F%Y%M%D%:0%H%T%S")); + + /* iLog->Log(_L("Result Value")); + iLog->Log(timeString); + */ + if(expTime.DateTime().Day() == resTime.DateTime().Day()) + { + if(expTime.DateTime().Month() == resTime.DateTime().Month()) + if(expTime.DateTime().Year() == resTime.DateTime().Year()) + //these things can be ignored + /*if(expTime.DateTime().Hour() == resTime.DateTime().Hour()) + if(expTime.DateTime().Minute() == resTime.DateTime().Minute()) + if(expTime.DateTime().Second() == resTime.DateTime().Second())*/ + { + equal = ETrue; + } + } + expValue.Reset(); + resValue.Reset(); + return equal; + } + +/* -------------------------------------------------------------------------- + CMediaObserver :: CompareTIntResult. + A static method which compares two TInt results from the maps. +----------------------------------------------------------------------------- +*/ +TBool CMediaObserver::CompareTIntResult(const TDesC8& aKey, + CLiwMap* aExpectedMap, + const CLiwMap* aResultMap) + { + TLiwVariant expValue; + TLiwVariant resValue; + TBool equal = EFalse; + TBuf<255> expIntStr; + TBuf<255> resIntStr; + + if(!aExpectedMap->FindL(aKey, expValue)) + { + return ETrue; + } + aResultMap->FindL(aKey, resValue); + + TInt expRes = expValue.AsTInt32(); + TInt resRes = resValue.AsTInt32(); + + expIntStr.AppendNum(expRes); + resIntStr.AppendNum(resRes); + + /* iLog->Log(_L("Expected Value")); + iLog->Log(expIntStr); + + iLog->Log(_L("Result Value")); + iLog->Log(resIntStr); + */ + if(expRes == resRes) + { + equal = ETrue; + } + expValue.Reset(); + resValue.Reset(); + return equal; + } +/* -------------------------------------------------------------------------- + CMediaObserver :: NewL. + Two phase construction +----------------------------------------------------------------------------- +*/ + +CMediaObserver* CMediaObserver::NewL() + { + CMediaObserver* self = new(ELeave)CMediaObserver(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/* -------------------------------------------------------------------------- + CMediaObserver :: CMediaObserver. + Constructor +----------------------------------------------------------------------------- +*/ +CMediaObserver::CMediaObserver():iInList(NULL),iOutList(NULL), + iExpErrorCode(-1), + iResult(0), + iFiletype(EOtherFile), + iFilename(NULL) + { + } + +/* -------------------------------------------------------------------------- + CMediaObserver :: ConstructL + +----------------------------------------------------------------------------- +*/ +void CMediaObserver::ConstructL() + { + + iInList = CLiwGenericParamList::NewL(); + iOutList = CLiwGenericParamList::NewL(); + + User::LeaveIfError(iFs.Connect()); + count++; + TBuf<50> filnm; + filnm.Append(KFilenm); + filnm.AppendNum(count); + filnm.Append(_L(".txt")); + iFilename = filnm.Alloc(); + User::LeaveIfError(iFile.Replace(iFs,*iFilename,EFileWrite)); + + } + +/* -------------------------------------------------------------------------- + CMediaObserver :: ~CMediaObserver. + Destructor +----------------------------------------------------------------------------- +*/ +CMediaObserver::~CMediaObserver() + { + TInt count = iExpectedOutPutArray.Count(); + for(TInt index =0 ;indexDecRef(); + } + iExpectedOutPutArray.Close(); + delete iInList; + delete iOutList; + if(iFilename) + delete iFilename; + iFile.Close(); + iFs.Close(); + } +// ----------------------------------------------------------------------------- +// CMediaObserver:: HandleNotifyL +// Call Back Function Called by the Media Management SAPI. +// ----------------------------------------------------------------------------- +// + TInt CMediaObserver:: HandleNotifyL(TInt /*aCmdId*/, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& /*aInParamList*/) + { + + + + TInt pos = 0; + TInt error = KErrGeneral; + iResult = KErrGeneral; + count--; + TBuf<25> errorcodedes(KNullDesC); + const TLiwGenericParam* errorCode = NULL; + const TLiwGenericParam* resultList = NULL; + CLiwIterable* iterator = NULL; + + if( 0 == count) + CActiveScheduler::Stop(); + + errorCode = aEventParamList.FindFirst(pos, KErrorCode); // Finding Error Code + resultList = aEventParamList.FindFirst(pos, KResponse); // Finding Iterator for the result list + + TBuf8<100> flbuf; + + if(errorCode) + { + error = errorCode->Value().AsTInt32(); + errorcodedes.Num(error); + iFile.Write(_L8("Error code:")); + //flbuf.AppendNum(error); + // flbuf.Append(_L8("\n")); + // file.Write(flbuf); + // flbuf.Zero(); + // iLog->Log(_L("Error code:")); + // iLog->Log(errorcodedes); + } + if(iExpErrorCode != error) + { + // iLog->Log(_L("Expected Error code does not match")); + iFile.Write(_L8("Expected Error code does not match \n")); + + User::Leave(KErrGeneral); + } + if(resultList) + { + iterator = resultList->Value().AsIterable(); + if(IsExpectedResult(iterator)) + { + iResult = KErrNone; + } + } + else + { + if(iExpectedOutPutArray.Count() != 0) + { + // iLog->Log(_L("Result Iterator Not Found")); + iFile.Write(_L8("Result Iterator Not Found \n")); + + + User::Leave(KErrNotFound); + } + } + + iFile.Write(_L8("End of observer")); + + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertesting.cpp --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertesting.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertesting.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -42,7 +42,8 @@ iOutList(NULL), iServicehandler(NULL), iIface(NULL), - iFiletype(EOtherFile) + iFiletype(EOtherFile), + iNumberApiCall(0) { } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertestingBlocks.cpp --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertestingBlocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertestingBlocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -21,14 +21,17 @@ #include #include #include - +#include #include "tmediaprovidertesting.h" #include "tmediaprovidertesting.hrh" +#include "tmediaobserver.h" using namespace LIW; +TInt count = 0; + // ============================ MEMBER FUNCTIONS =============================== // ----------------------------------------------------------------------------- @@ -60,7 +63,8 @@ { static TStifFunctionInfo const KFunctions[] = { - ENTRY("GetFilesListL", Ctmediaprovidertesting::GetFilesListL) + ENTRY("GetFilesListL", Ctmediaprovidertesting::GetFilesListL) , + ENTRY("GetListBackToBackCall",Ctmediaprovidertesting::GetListBackToBackCallL) }; const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); @@ -190,6 +194,7 @@ criteria->SetServiceClass(TUid::Uid(KLiwClassBase)); RCriteriaArray critArray; + CleanupClosePushL(critArray); critArray.AppendL(criteria); iServicehandler->AttachL(critArray); @@ -208,6 +213,118 @@ } iInList->Reset(); iOutList->Reset(); + CleanupStack :: PopAndDestroy(); CleanupStack :: PopAndDestroy(criteria); - critArray.Close(); } + +/*-------------------------------------------------------------------------- + Ctmediaprovidertesting :: LoadServiceL + Loads the mediamanagement service. +----------------------------------------------------------------------------- +*/ +TInt Ctmediaprovidertesting::GetListBackToBackCallL( CStifItemParser& aItem ) + { + TInt error = KErrGeneral; + + LoadServiceL(); + //__UHEAP_MARK; + // Creating callback instance + TInt a =User::CountAllocCells(); + CMediaObserver* observer = CMediaObserver::NewL(); + CleanupStack::PushL(observer); + //Parsing stiff input + observer->ParseStiffInput(aItem); + + //Creating another callback + CMediaObserver* observer2 = CMediaObserver::NewL(); + CleanupStack::PushL(observer2); + //Parsing stiff input + observer2->ParseStiffInput(aItem); + + // Giving first call + iIface->ExecuteCmdL(command8, + *(observer->iInList), + *(observer->iOutList), + KLiwOptASyncronous, + observer); + TInt pos = 0; + const TLiwGenericParam* p = observer->iOutList->FindFirst(pos, + KErrorCode); // Finding Error Code + //count++; + if(p) + { + TInt retcode = p->Value().AsTInt32(); + if(KErrNone == retcode) + { + // CActiveScheduler::Start(); + //give second call + + iIface->ExecuteCmdL(command8, + *(observer2->iInList), + *(observer2->iOutList), + KLiwOptASyncronous, + observer2); + //count++; + pos =0 ; + + const TLiwGenericParam* p = observer2->iOutList->FindFirst(pos, + KErrorCode); // Finding Error Code + + + if(p) + { + TInt retcode = p->Value().AsTInt32(); + if(KErrNone == retcode) + { + CActiveScheduler::Start(); + } + else + { + if(observer2->iExpErrorCode == retcode) + { + observer2->iResult = KErrNone; + } + else + { + User::Leave(KErrGeneral); + } + } + + } + + + } + else + { if(observer->iExpErrorCode == retcode) + { + observer->iResult = KErrNone; + } + else + { + User::Leave(KErrGeneral); + } + } + } + + if( (KErrNone == observer->iResult) && (KErrNone == observer2->iResult) ) + { + error = KErrNone ; + } + else + { + error = KErrGeneral; + } + +observer->iInList->Reset(); +observer->iOutList->Reset(); + +observer2->iInList->Reset(); +observer2->iOutList->Reset(); + +CleanupStack::PopAndDestroy(observer2); +CleanupStack::PopAndDestroy(observer); +a =User::CountAllocCells(); +a = error; +//__UHEAP_MARKEND; + return a; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertestingImpl.cpp --- a/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertestingImpl.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_mediamanagement/tsrc/testing/tmediaprovidertesting/src/tmediaprovidertestingImpl.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -64,6 +64,11 @@ { iFiletype = EMusicFile; } + else if(inpFileType.CompareF(KFileTypeImage) == 0) + { + iFiletype = EImageFile; + iLog->Log(_L("file type is image")); + } //check for expected key //if it is there then get the expected result and put it into the map. if(expectedStart.CompareF(KExpectedStart) == 0) @@ -190,6 +195,12 @@ aItem.GetNextInt(fileSize); expectedOutPutMap->InsertL(insertKey, (TInt32)fileSize); } + else if(key.CompareF(_L("XPixels"))==0 || key.CompareF(_L("YPixels"))==0) + { + TInt resolution = -1; + aItem.GetNextInt(resolution); + expectedOutPutMap->InsertL(insertKey, (TInt32)resolution); + } else { aItem.GetNextString(nextString); @@ -239,7 +250,7 @@ iLog->Log(_L("Result Not in Expected sort order")); User::Leave(KErrGeneral); } - iLog->Log(_L("Map is in sorted order with positio ")); // Lok + iLog->Log(_L("Map is in sorted order with position ")); // Lok TBuf<10>buf; buf.Num(index); iLog->Log(buf); @@ -299,7 +310,24 @@ if(!CompareTTimeResult(KMgFileDate, aExpectedMap, aResultMap)) { return EFalse; - } + } + + //Image Files + if(iFiletype == EImageFile) + { + if(!CompareTIntResult(KXPixels, aExpectedMap, aResultMap)) + { + iLog->Log(_L("Expected and Returned XPixel values do not match")); + return EFalse; + } + + if(!CompareTIntResult(KYPixels, aExpectedMap, aResultMap)) + { + iLog->Log(_L("Expected and Returned YPixel values do not match")); + return EFalse; + } + } + //In case of streamingURL file check for few additional keys. if(iFiletype == EStreamingURLFile) { @@ -395,7 +423,7 @@ CLiwMap* aExpectedMap, const CLiwMap* aResultMap) { - iLog->Log(_L("Inside CompareStringResult")); + iLog->Log(_L("Inside CompareTTimeResult")); TLiwVariant expValue; TLiwVariant resValue; TBool equal = EFalse; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/inc/messaginginterface.h --- a/serviceproviders/sapi_messaging/inc/messaginginterface.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/inc/messaginginterface.h Thu Aug 27 07:43:07 2009 +0300 @@ -323,9 +323,19 @@ * Gives the result of asynchronous SAPI * @param aErrCode errcode * @param aResult Result - * @return void */ void NotifyResultL(TInt aErrCode, TAny* aResult); + + /** + * Gives the result of asynchronous SAPI + * @param aErrCode errcode + * @param aEntrySelection Entryselection + * @param aFilter Filter + */ + + void HandleGetlistL (TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter); + + }; /** @@ -339,7 +349,7 @@ * Two-phase Constructor * @return CMsgCallbackHeader* */ - static CMsgCallbackHeader* NewL(); + static CMsgCallbackHeader* NewL(CMessagingService* aMsgService); /** * Destructor @@ -351,17 +361,32 @@ /** * Constructor */ - CMsgCallbackHeader(); - + CMsgCallbackHeader(CMessagingService* aMsgService); + public: /** * Gives the result of asynchronous SAPI * @param aErrCode errcode * @param aResult Result - * @return void */ virtual void NotifyResultL(TInt aErrCode, TAny* aResult); + + /** + * Gives the result of asynchronous SAPI + * @param aErrCode errcode + * @param aEntrySelection Entryselection + * @param aFilter Filter + */ + + virtual void HandleGetlistL (TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter); + + private: + + /** + * CMessagingService class pointer + */ + CMessagingService* iMsg; }; /** diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/messagingservice/inc/accessfolder.h --- a/serviceproviders/sapi_messaging/messagingservice/inc/accessfolder.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/messagingservice/inc/accessfolder.h Thu Aug 27 07:43:07 2009 +0300 @@ -25,7 +25,7 @@ * in a sorted order present in a folder . Message Headers are * retrieved as per searching options provided by user. */ -class CMessagingAccessFolder : public CBase +class CMessagingAccessFolder : public CActive { public: @@ -56,6 +56,16 @@ public: + + /** + * Sets message input parameters + * Ownership is transferred to this class + * @param aNotifyCallback Bydefault it is NULL to make function + * call synchronous , if provided then function call is asynchronous + * @param aAsyncRequestObserver Asynchronous request observer + */ + void SetInputParamsL( CMsgCallbackBase* aNotifyCallback = NULL, + MAsyncRequestObserver* aAsyncRequestObserver = NULL); /** * Gives Message id list of messages @@ -136,6 +146,26 @@ * @return TBool ETrue if filter on date is set and entry matches with filter */ TBool FilterDate( const TMsvEntry& aEntry ) const; + + /** + * Inherited from CActive class + */ + virtual void DoCancel(); + + /** + * Inherited from CActive class + */ + virtual void RunL(); + + /** + * Activates the request and call SetActive() function + */ + void ActivateRequest(TInt aReason); + + /** + * Gives the result for notification request. + */ + void NotifyRequestResult(TInt aReason, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ); private: @@ -165,6 +195,23 @@ * Filter variable */ CFilterParamInfo* iFilter; + + /** + * A callback notification for asynchronous function + */ + CMsgCallbackBase* iNotifyCallback; + + /** + * Asynchronous request observer, Used to get infromed of completion or request + */ + MAsyncRequestObserver* iAsyncRequestObserver; + + /** + * Flag which specifies to cancel the request + * but not to call the NotifyResultL + * If false doesnot call the NotifyResultL + **/ + TBool iCallNotifyForCancelFlag; }; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/messagingservice/inc/messageheader.h --- a/serviceproviders/sapi_messaging/messagingservice/inc/messageheader.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/messagingservice/inc/messageheader.h Thu Aug 27 07:43:07 2009 +0300 @@ -948,6 +948,15 @@ * @return void */ virtual void NotifyResultL(TInt aErrCode, TAny* aResult) = 0; + + /** + * Gives the result + * @param aErrCode Error code + * @param aEntrySelection EntrySelection + * @param aFilter Filter + * @return void + */ + virtual void HandleGetlistL ( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) = 0; /** * Input param diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/messagingservice/src/accessfolder.cpp --- a/serviceproviders/sapi_messaging/messagingservice/src/accessfolder.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/messagingservice/src/accessfolder.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -46,11 +46,17 @@ { iEntrySelection->Reset(); } + if ( IsActive() ) + { + iCallNotifyForCancelFlag = EFalse; + Cancel(); + } iMtmArrayId.Reset(); delete iEntrySelection; delete iFilter; + delete iNotifyCallback; } // --------------------------------------------------------------------------- @@ -58,9 +64,94 @@ // --------------------------------------------------------------------------- // CMessagingAccessFolder::CMessagingAccessFolder( CMsvSession& aServerSession ): - iServerSession(aServerSession) + iServerSession(aServerSession), + CActive( EPriorityStandard ), + iCallNotifyForCancelFlag(ETrue) { } + +// --------------------------------------------------------------------------- +// Activates the asynchronous request +// --------------------------------------------------------------------------- +// +void CMessagingAccessFolder::ActivateRequest( TInt aReason ) + { + iStatus = KRequestPending; + SetActive(); + TRequestStatus* temp = &iStatus; + User::RequestComplete( temp, aReason ); + } + +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +// +void CMessagingAccessFolder::DoCancel() + { + NotifyRequestResult( KErrCancel,iEntrySelection, iFilter ); + } + +// --------------------------------------------------------------------------- +// Inherited from CActive class +// --------------------------------------------------------------------------- +// +void CMessagingAccessFolder::RunL() + { + TInt err = iStatus.Int(); + if ( err == KErrNone ) + { + TInt groupingKey = KMsvNoGrouping; + TMsvSelectionOrdering order( groupingKey, iFilter->SortType() ); + CMsvEntry* entry = iServerSession.GetEntryL( iFolderId ); + CleanupStack::PushL( entry ); + + // Getlist can be performed on Folders entries only + if ( entry->Entry().iType != KUidMsvFolderEntry ) + { + User::Leave( KErrArgument ); + } + + entry->SetSortTypeL( order ); + + InitializeMtmArray(); + + if ( iEntrySelection ) + { + iEntrySelection->Reset(); + delete iEntrySelection; + iEntrySelection = NULL; + } + + if ( iMtmArrayId.Count() == 1 ) + { + iEntrySelection = entry->ChildrenWithMtmL( iMtmArrayId[0] ); + } + else + { + iEntrySelection = entry->ChildrenL(); + } + + CleanupStack::PopAndDestroy( entry ); + NotifyRequestResult( KErrNone, iEntrySelection, iFilter); + } + else + { + NotifyRequestResult( err, iEntrySelection, iFilter); + } + } + +// --------------------------------------------------------------------------- +// Sets message input parameters +// aMessageParam/aNotifyCallback ownership is passed to this +// --------------------------------------------------------------------------- +// +void CMessagingAccessFolder::SetInputParamsL(CMsgCallbackBase* aNotifyCallback , + MAsyncRequestObserver* aAsyncRequestObserver ) + { + + iNotifyCallback = aNotifyCallback; + iAsyncRequestObserver = aAsyncRequestObserver; + } void CMessagingAccessFolder::GetIdListL(TMsvId aFolderId , CFilterParamInfo* aFilter, @@ -104,39 +195,71 @@ // void CMessagingAccessFolder::GetListL() { - TInt groupingKey = KMsvNoGrouping; - TMsvSelectionOrdering order( groupingKey, iFilter->SortType() ); - CMsvEntry* entry = iServerSession.GetEntryL( iFolderId ); - CleanupStack::PushL( entry ); - - // Getlist can be performed on Folders entries only - if ( entry->Entry().iType != KUidMsvFolderEntry ) - { - User::Leave( KErrArgument ); - } - - entry->SetSortTypeL( order ); - - InitializeMtmArray(); - - if ( iEntrySelection ) - { - iEntrySelection->Reset(); - delete iEntrySelection; - iEntrySelection = NULL; - } - - if ( iMtmArrayId.Count() == 1 ) - { - iEntrySelection = entry->ChildrenWithMtmL( iMtmArrayId[0] ); - } + if ( iNotifyCallback ) // making call as asynchronous + { + CActiveScheduler::Add( this ); + ActivateRequest( KErrNone ); + } else - { - iEntrySelection = entry->ChildrenL(); - } + { + TInt groupingKey = KMsvNoGrouping; + TMsvSelectionOrdering order( groupingKey, iFilter->SortType() ); + CMsvEntry* entry = iServerSession.GetEntryL( iFolderId ); + CleanupStack::PushL( entry ); + + // Getlist can be performed on Folders entries only + if ( entry->Entry().iType != KUidMsvFolderEntry ) + { + User::Leave( KErrArgument ); + } + + entry->SetSortTypeL( order ); + + InitializeMtmArray(); + + if ( iEntrySelection ) + { + iEntrySelection->Reset(); + delete iEntrySelection; + iEntrySelection = NULL; + } + + if ( iMtmArrayId.Count() == 1 ) + { + iEntrySelection = entry->ChildrenWithMtmL( iMtmArrayId[0] ); + } + else + { + iEntrySelection = entry->ChildrenL(); + } + + CleanupStack::PopAndDestroy( entry ); + } + } - CleanupStack::PopAndDestroy( entry ); - } +// --------------------------------------------------------------------------- +// Notifies callback the result for asynchronous request. +// --------------------------------------------------------------------------- +// +void CMessagingAccessFolder::NotifyRequestResult( TInt aReason,CMsvEntrySelection* aEntrySelection ,CFilterParamInfo* aFilter ) + + { + if ( iNotifyCallback ) + { + iEntrySelection=NULL; + iFilter=NULL; + iAsyncRequestObserver->RequestComplete( iNotifyCallback->iTransactionId ); + + if( iCallNotifyForCancelFlag ) + { + TRAPD( err, iNotifyCallback->HandleGetlistL( aReason, aEntrySelection, aFilter )); + } + + } + // caller will delete the object in case of cancel + if ( aReason != KErrCancel ) + delete this; + } // --------------------------------------------------------------------------- // Initializes the MtmID array by the Mtm string passed diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/messagingservice/src/messagingservice.cpp --- a/serviceproviders/sapi_messaging/messagingservice/src/messagingservice.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/messagingservice/src/messagingservice.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -20,6 +20,7 @@ #include #include #include +#include #include "messageheader.h" #include "messagingservice.h" @@ -96,6 +97,18 @@ { CMessageDetail* detailObj = NULL; + CMsvEntry * messageEntry = iMsgServerSession->GetEntryL( aMessageParam->TemplateId() ); + + CleanupStack::PushL(messageEntry); + + if ( aMessageParam->MessageType() == KSenduiMtmSmsUid && + messageEntry->Entry().iMtm == KSenduiMtmMmsUid ) + { + User::Leave( KErrNotSupported ); + } + + CleanupStack::PopAndDestroy(messageEntry); + detailObj = CMessageDetail::NewL( *iMsgServerSession ); CleanupStack::PushL( detailObj ); @@ -204,7 +217,7 @@ // EXPORT_C void CMessagingService::GetIdListL( CFilterParamInfo* aFilterParams, TMsvId /*aFolderId*/, - CMsgCallbackBase* /*aCallback*/, + CMsgCallbackBase* aCallback, CMsvEntrySelection*& aEntrySelection ) { // Hard coding for Inbox/Draft @@ -215,9 +228,19 @@ CleanupStack::PushL( obj ); + obj->SetInputParamsL(aCallback,this); + + if ( aCallback ) + { + AddAsyncObjL( aCallback->iTransactionId,obj); + } + obj->GetIdListL( folderId, aFilterParams, aEntrySelection ); - CleanupStack::PopAndDestroy( obj ); + CleanupStack::Pop( obj ); + + if ( !aCallback ) + delete obj; } EXPORT_C void CMessagingService::GetNextHeaderL( CFilterParamInfo* aFilterParams, diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/src/messaginginterface.cpp --- a/serviceproviders/sapi_messaging/src/messaginginterface.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/src/messaginginterface.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -435,7 +435,7 @@ TUint aCmdOptions, MLiwNotifyCallback* aCallback ) { - LeaveIfAsynchronousL( aCmdOptions, aCallback, KCmdGetHeaderList, KAsyncNotSupported ); + const TLiwGenericParam* param = NULL; @@ -483,17 +483,36 @@ CMsvEntrySelection* entrySelection = NULL; - + CMsgCallbackBase* callback = NULL; + + if ( aCallback && ( KLiwOptASyncronous & aCmdOptions )) + { + callback = CMsgCallbackHeader::NewL(iMsgService); + CleanupStack::PushL( callback ); + callback->iPtrInParamList = &aInParamList; + callback->iPtrNotifyCallback = aCallback; + callback->iTransactionId = aCallback->GetTransactionID(); + + aOutParamList.AppendL(TLiwGenericParam( KTransactionID, + TLiwVariant( callback->iTransactionId ))); + } iMsgService->GetIdListL( filterParam, folderId, - NULL/*Callback*/, + callback/*Callback*/, entrySelection ); + if ( callback ) + { + CleanupStack::Pop( callback ); + CleanupStack::PopAndDestroy(filterParam); + } + if(!callback) CleanupStack::Pop( filterParam ); // Successfull completion // filterParam and entrySelection ownership passed to called function + if(!callback) UpdateOutputAsIdListL( &aOutParamList, entrySelection, iMsgService, filterParam ); } @@ -518,7 +537,7 @@ GetNotificationTypeL( aInParamList, notificationType, KCmdRegNotification ); CMsgCallbackBase* callback = NULL; - callback = CMsgCallbackHeader::NewL(); + callback = CMsgCallbackHeader::NewL(iMsgService); callback->iPtrInParamList = &aInParamList; callback->iPtrNotifyCallback = aCallback; callback->iTransactionId = aCallback->GetTransactionID(); @@ -1370,12 +1389,13 @@ // Two-phase Constructor // --------------------------------------------------------------------------- // -CMsgCallbackHeader* CMsgCallbackHeader::NewL() +CMsgCallbackHeader* CMsgCallbackHeader::NewL(CMessagingService* aMsgService) { - CMsgCallbackHeader* self = new (ELeave) CMsgCallbackHeader(); + CMsgCallbackHeader* self = new (ELeave) CMsgCallbackHeader(aMsgService); + return self; } - + // --------------------------------------------------------------------------- // Destructor // --------------------------------------------------------------------------- @@ -1388,7 +1408,7 @@ // Constructor // --------------------------------------------------------------------------- // -CMsgCallbackHeader::CMsgCallbackHeader() +CMsgCallbackHeader::CMsgCallbackHeader(CMessagingService* aMsgService):iMsg(aMsgService) { } @@ -1428,7 +1448,57 @@ CleanupStack::PopAndDestroy( outParams ); } - + +// --------------------------------------------------------------------------- +// Gives the result of getlist asynchronous SAPI +// --------------------------------------------------------------------------- +// +void CMsgCallbackHeader::HandleGetlistL( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) + { + CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); + + CleanupStack::PushL( outParams ); + + outParams->AppendL(TLiwGenericParam(KErrorCode, + TLiwVariant(ErrCodeConversion(aErrCode)))); + + if ( aErrCode==KErrNone ) + { + CIterableIdList* iter = CIterableIdList::NewL( aEntrySelection, iMsg, aFilter ); + + CleanupStack::PushL( iter ); + + TLiwVariant listVal; + + listVal.Set( iter ); + + outParams->AppendL( TLiwGenericParam( KReturnValue/*KMessageList*/, listVal )); + + CleanupStack::Pop( iter ); + + listVal.Reset(); + + iter->DecRef(); + } + + TInt event = KLiwEventCompleted; + + if ( aErrCode == KErrCancel ) + { + event = KLiwEventCanceled; + } + else if ( aErrCode != KErrNone ) + { + event = KLiwEventStopped; + } + + ((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, + event, + *(outParams), + *((CLiwGenericParamList*)iPtrInParamList) ); + + CleanupStack::PopAndDestroy( outParams ); + } // --------------------------------------------------------------------------- // Two-phase Constructor @@ -1478,6 +1548,11 @@ CleanupStack::PopAndDestroy( outParams ); } +void CMsgCallbackInt::HandleGetlistL( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) + { + //Dummy Function + } + // --------------------------------------------------------------------------- // Updates the output for message header // --------------------------------------------------------------------------- diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/group/bld.inf --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/group/bld.inf Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/group/bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -25,6 +25,7 @@ #include "../tmsg_sendmessageiter3/group/bld.inf" #include "../tmsg_negitivecases/group/bld.inf" #include "../tmsg_misccases/group/bld.inf" +#include "../tmsgget_async/group/bld.inf" PRJ_PLATFORMS DEFAULT diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/conf/tmsg_sendmessageiter3.cfg --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/conf/tmsg_sendmessageiter3.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/conf/tmsg_sendmessageiter3.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -81,3 +81,10 @@ foobar sendmessage_test10 delete foobar [Endtest] + +[Test] +title sendmessage11 +create tmsg_sendmessageiter3 foobar +foobar sendmessage_test11 +delete foobar +[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/inc/sendmessage.h --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/inc/sendmessage.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/inc/sendmessage.h Thu Aug 27 07:43:07 2009 +0300 @@ -37,7 +37,7 @@ extern int sendmessage_test8(int, char**); extern int sendmessage_test9(int, char**); extern int sendmessage_test10(int, char**); - +extern int sendmessage_test11(int, char**); @@ -168,6 +168,7 @@ virtual TInt sendmessage_test8L( CStifItemParser& aItem ); virtual TInt sendmessage_test9L( CStifItemParser& aItem ); virtual TInt sendmessage_test10L( CStifItemParser& aItem ); + virtual TInt sendmessage_test11L( CStifItemParser& aItem ); public: // Data // ?one_line_short_description_of_data diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/src/send_messageblocks.cpp --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/src/send_messageblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/src/send_messageblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -111,6 +111,7 @@ ENTRY( "sendmessage_test8", Csapi_sendmessage::sendmessage_test8L ), ENTRY( "sendmessage_test9", Csapi_sendmessage::sendmessage_test9L ), ENTRY( "sendmessage_test10", Csapi_sendmessage::sendmessage_test10L ), + ENTRY( "sendmessage_test11", Csapi_sendmessage::sendmessage_test11L ) }; @@ -220,7 +221,12 @@ TInt Csapi_sendmessage::sendmessage_test10L( CStifItemParser& /*aItem*/ ) { return sendmessage_test10(0, NULL); - } + } + +TInt Csapi_sendmessage::sendmessage_test11L( CStifItemParser& /*aItem*/ ) + { + return sendmessage_test11(0, NULL); + } // ----------------------------------------------------------------------------- // Csapi_sendmessage::?member_function // ?implementation_description diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/src/tsendmessage1.cpp --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/src/tsendmessage1.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsg_sendmessageiter3/src/tsendmessage1.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -40,7 +40,8 @@ _LIT8(KBodyText, "BodyText"); _LIT8(KAttachmentname, "Attachment"); _LIT8(KMimeType, "MimeType"); -_LIT8(KMessageParam, "Messageparam"); +_LIT8(KMessageParam, "MessageParam"); +_LIT8(KType, "MessageType"); _LIT8(KErrCode,"ErrorCode"); // Positive test case with Type, Number and BodyText @@ -928,6 +929,101 @@ } +int sendmessage_test11(int, char**) + { + __UHEAP_MARK; + + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + TInt pos = 0; + MLiwInterface* interface = NULL; + _LIT8(KDataSource, "IMessaging"); + outParamList->FindFirst(pos,KDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + inParamList->Reset(); + outParamList->Reset(); + delete crit; + crit = NULL; + a.Reset(); + + TInt32 tmplateId = GetTemplateId( interface, inParamList, outParamList, EFalse ); + + inParamList->AppendL(TLiwGenericParam( KType, TLiwVariant( _L("SMS") ))); + inParamList->AppendL(TLiwGenericParam( KTo, TLiwVariant( _L("9008032761") ))); + inParamList->AppendL(TLiwGenericParam( KBodyText, TLiwVariant( _L("SMS with MMS template ID ") ))); + + + if(tmplateId > 0) + { + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + TLiwVariant liwmessageid(tmplateId); + map->InsertL(_L8("TemplateId"),liwmessageid); + liwmessageid.Reset(); + + CLiwDefaultList* reclist = CLiwDefaultList::NewL(); + CleanupStack::PushL(reclist); + reclist->AppendL(TLiwVariant(_L("9008032762"))); + + TLiwVariant recps(reclist); + map->InsertL(_L8("To"),recps); + recps.Reset(); + reclist->DecRef(); + CleanupStack::Pop(reclist); + + inParamList->AppendL(TLiwGenericParam( KMessageParam, TLiwVariant( map )));// Null mimetype + map->DecRef(); + CleanupStack::Pop(map); + } + + TRAPD(err,interface->ExecuteCmdL( KCmd, *inParamList ,*outParamList,0,NULL )); + + if(err == KErrNone) + { + TInt index = 0; + const TLiwGenericParam* err1 = outParamList->FindFirst(index,KErrCode); + err = err1->Value().AsTInt32(); + } + + + inParamList->Reset(); + outParamList->Reset(); + + interface->Close(); + iServiceHandler->Reset(); + delete iServiceHandler; + + __UHEAP_MARKEND; + if(tmplateId) + { + if( err==1004 ) + return KErrNone; + else + return KErrGeneral; + } + else + return err; + + } + TInt32 GetTemplateId(MLiwInterface *aObj ,CLiwGenericParamList* aInputlist, CLiwGenericParamList* aOutputlist, TBool aSMS ) { _LIT8(KCmd,"GetList"); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/bwins/tmsgget_asyncu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/bwins/tmsgget_asyncu.def Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/conf/tmsgget_async.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/conf/tmsgget_async.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,35 @@ +/* =========================================================================== + * Copyright ? 2006-2007 Nokia Corporation. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia Corporation. All rights are reserved. Copying, + * including reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia Corporation. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia Corporation. + * ============================================================================ + */ + +[Test] +title getlist_asyncsms +create tmsgget_async foobar +foobar getlist_asyncsms +delete foobar +[Endtest] + +[Test] +title getlist_asyncmms +create tmsgget_async foobar +foobar getlist_asyncmms +delete foobar +[Endtest] + +[Test] +title getlist_asyncstress +create tmsgget_async foobar +foobar getlist_asyncstress +delete foobar +[Endtest] + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/eabi/tmsgget_asyncu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/eabi/tmsgget_asyncu.def Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/group/Bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/group/Bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +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' +../conf/tmsgget_async.cfg /epoc32/winscw/c/testframework/tmsgget_async.cfg + +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 +tmsgget_async.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 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/group/tmsgget_async.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/group/tmsgget_async.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +#include "../../../../../../group/sapiincludes.mmpi" + +TARGET tmsgget_async.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 tmsgget_async.def + +USERINCLUDE ../inc + + + +SOURCEPATH ../src + +SOURCE tmsgget_async.cpp +SOURCE tmsgget_asyncBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestengine.lib +LIBRARY stiftestinterface.lib +LIBRARY messagingservice.lib +//LIBRARY messagingprovider.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY LiwServiceHandler.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 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/group/tmsgget_async.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/group/tmsgget_async.pkg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,43 @@ +; ============================================================================ +; 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 the License "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: package file for Service API package +; ============================================================================ + +; Languages +&EN + +; Provide value for uid +#{"MessagingTest"},(0x342834AB),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" + +;SAPI Binaries to Install + +;Messagingservice binaries +;"..\..\..\..\..\..\..\..\..\epoc32\release\armv5\urel\messagingservice.dll"-"C:\sys\bin\messagingservice.dll" +"..\..\..\..\..\..\..\..\..\epoc32\release\armv5\urel\tmsgget_async.dll"-"C:\sys\bin\tmsgget_async.dll" + + +;ini file +"..\init\Testframework.ini"-"c:\Testframework\Testframework.ini" + +;cfg file +"..\conf\tmsgget_async.cfg"-"c:\Testframework\tmsgget_async.cfg" \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/inc/tmsgget_async.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/inc/tmsgget_async.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,204 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef TMSGGET_ASYNC_H +#define TMSGGET_ASYNC_H + +// INCLUDES +#include +#include +#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( Ktmsgget_asyncLogPath, "\\logs\\testframework\\tmsgget_async\\" ); +// Log file +_LIT( Ktmsgget_asyncLogFile, "tmsgget_async.txt" ); +_LIT( Ktmsgget_asyncLogFileWithTitle, "tmsgget_async_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Ctmsgget_async; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Ctmsgget_async test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Ctmsgget_async) : public CScriptBase,public MLiwNotifyCallback + { + public: // Constructors and destructor + + enum AsyncTestID + { + ESMS, + EMMS, + }; + /** + * Two-phased constructor. + */ + static Ctmsgget_async* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Ctmsgget_async(); + + 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. + */ + Ctmsgget_async( 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 getlist_asyncsmsL( CStifItemParser& aItem ); + virtual TInt getlist_asyncmmsL( CStifItemParser& aItem ); + virtual TInt getlist_asyncstressL( CStifItemParser& aItem ); + //void CreateInterfaceL(CLiwServiceHandler*& aHandler, + // MLiwInterface*& aInterface); + /** + * 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 + // CLiwServiceHandler* iServiceHandler; + // MLiwInterface* interface; + TInt iResult; + AsyncTestID iTestid; + // ?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; + TInt HandleNotifyL( + TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInputParam); + private: // Friend classes + //?friend_class_declaration; + + }; + +#endif // TMSGGET_ASYNC_H + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/init/testframework.ini Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,161 @@ +# +# This is STIFTestFramework 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'. +# +# - 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. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: + # 'Summary', 'Environment', 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +[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= YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= NormalCases.txt +# TestCaseFile= SmokeCases.txt +# TestCaseFile= 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 +IniFile= c:\testframework\TestFramework.ini +TestCaseFile= c:\testframework\tmsgget_async.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework 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. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +#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 + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/src/tmsgget_async.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/src/tmsgget_async.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,214 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// INCLUDE FILES +#include +#include "tmsgget_async.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 =============================== + +// ----------------------------------------------------------------------------- +// Ctmsgget_async::Ctmsgget_async +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Ctmsgget_async::Ctmsgget_async( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Ctmsgget_async::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Ctmsgget_async::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(Ktmsgget_asyncLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Ktmsgget_asyncLogFile); + } + + iLog = CStifLogger::NewL( Ktmsgget_asyncLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + //SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Ctmsgget_async::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Ctmsgget_async* Ctmsgget_async::NewL( + CTestModuleIf& aTestModuleIf ) + { + Ctmsgget_async* self = new (ELeave) Ctmsgget_async( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Ctmsgget_async::~Ctmsgget_async() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Ctmsgget_async::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Ctmsgget_async::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("tmsgget_async.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* ) Ctmsgget_async::NewL( aTestModuleIf ); + + } + +// ----------------------------------------------------------------------------- +// E32Dll is a DLL entry point function. +// Returns: KErrNone +// ----------------------------------------------------------------------------- +// +#ifndef EKA2 // Hide Dll entry point to EKA2 +GLDEF_C TInt E32Dll( + TDllReason /*aReason*/) // Reason code + { + return(KErrNone); + + } +#endif // EKA2 + + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/src/tmsgget_asyncBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingprovidertest/tmsgget_async/src/tmsgget_asyncBlocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,818 @@ +/* +* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "tmsgget_async.h" + +// 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 + +_LIT8(KService, "Service.Messaging"); +_LIT8(KIDataSource,"IMessaging"); +_LIT(KMessageTypeSMS,"SMS"); +_LIT8(KErrCode,"ErrorCode"); +_LIT(KMessageTypeMMS,"MMS"); + + +// 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 =============================== + +// ----------------------------------------------------------------------------- +// Ctmsgget_async::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Ctmsgget_async::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Ctmsgget_async::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Ctmsgget_async::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", Ctmsgget_async::ExampleL ), + ENTRY( "getlist_asyncsms", Ctmsgget_async::getlist_asyncsmsL ), + ENTRY( "getlist_asyncmms", Ctmsgget_async::getlist_asyncmmsL ), + ENTRY( "getlist_asyncstress", Ctmsgget_async::getlist_asyncstressL ) + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +TInt Ctmsgget_async::HandleNotifyL(TInt aCmdId, + TInt aEventId, + CLiwGenericParamList& aEventParamList, + const CLiwGenericParamList& aInParamList) + { + TInt pos = 0; + const TLiwGenericParam* output = aEventParamList.FindFirst( pos,_L8("ReturnValue")); + + TInt val=0; + if(output) + { + //RFile fs; + //RFs rFs; + //rFs.Connect(); + //rFs.Delete(_L("c:\\getheaderiter3_1.txt")); + //fs.Create(r//fs, _L("c:\\getheaderiter3_1.txt"), EFileShareExclusive|EFileWrite) ; + + CLiwIterable* iterlist = output->Value().AsIterable(); + + TLiwVariant data; + + while( iterlist->NextL(data)) + { + + const CLiwMap* Map = data.AsMap(); + + TLiwVariant mtmtype; + Map->FindL(_L8("MessageType"),mtmtype); + TPtrC mtm = mtmtype.AsDes(); + if(iTestid==ESMS) + { + if(mtm.FindF(_L("SMS")) == KErrNotFound ) + val++; + } + + if(iTestid==EMMS) + { + if(mtm.FindF(_L("MMS")) == KErrNotFound ) + val++; + } + + + TBuf8<50> buf; + buf.Copy(mtm) ; + //fs.Write(_L8("Mtm Id :")); + //fs.Write(buf); + //fs.Write(_L8("\n")); /// writing mtm type + mtmtype.Reset(); + + TLiwVariant sender; + Map->FindL(_L8("Sender"),sender); + TPtrC send = sender.AsDes(); + + //if(send.FindF(_L("9008032761")) == KErrNotFound) + // val++; + + + buf.Copy(send) ; + //fs.Write(_L8("Sender :")); + //fs.Write(buf); + //fs.Write(_L8("\n")); /// writing sender + sender.Reset(); + TLiwVariant messageid; + Map->FindL(_L8("MessageId"),messageid); + TInt id = (TInt)messageid.AsTInt32(); + + + + buf.Num(id) ; + //fs.Write(_L8("Message id :")); + //fs.Write(buf); + //fs.Write(_L8("\n")); /// writing messageid + messageid.Reset(); + + TLiwVariant date; + Map->FindL(_L8("Time"),date); + + + TTime date1 =(TTime) date.AsTTime(); + + + TDateTime date2 = date1.DateTime(); + + buf.Num(date2.Day()); + //fs.Write(_L8("Day:")); + //fs.Write(buf); + //fs.Write(_L8("\t")); /// writing day + + buf.Num(date2.Month()); + //fs.Write(_L8("Month:")); + //fs.Write(buf); + //fs.Write(_L8("\t")); /// writing month + + buf.Num(date2.Year()); + //fs.Write(_L8("Year:")); + //fs.Write(buf); + //fs.Write(_L8("\n")); /// writing year + date.Reset(); + + TLiwVariant unreadflag; + Map->FindL(_L8("Unread"),unreadflag); + TBool unread = (TBool)unreadflag.AsTBool(); + + + + buf.Num(unread) ; + //fs.Write(_L8("Unread flag :")); + //fs.Write(buf); + //fs.Write(_L8("\n")); /// writing unread + unreadflag.Reset(); + TLiwVariant priorityflag; + Map->FindL(_L8("Priority"),priorityflag); + TPtrC priority = priorityflag.AsDes(); + + + TLiwVariant bodytext; + Map->FindL(_L8("BodyText"),bodytext); + TPtrC bodytxt = bodytext.AsDes(); + bodytext.Reset(); + + buf.Copy(priority) ; + //fs.Write(_L8("Priority Flag :")); + //fs.Write(buf); + //fs.Write(_L8("\n")); /// writing priority + priorityflag.Reset(); + data.Reset(); /// upto here we get map by iterable list + + } + //fs.Close(); + //rfs.Close(); + + } + + CActiveScheduler::Stop(); + if(0==val) + iResult= KErrNone; + else + iResult= KErrGeneral; + + + } + +// ----------------------------------------------------------------------------- +// Ctmsgget_async::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Ctmsgget_async::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Ktmsgget_async, "tmsgget_async" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Ktmsgget_async, 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, Ktmsgget_async, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + + +TInt Ctmsgget_async::getlist_asyncsmsL(CStifItemParser& aItem ) + { + iTestid = ESMS; + __UHEAP_MARK; + // Iter-3 test work + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + _LIT8(KDataSource, "IMessaging"); + outParamList->FindFirst(pos,KDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + outParamList->Reset(); + // Iter-2 same + inParamList->Reset(); + + + _LIT8(KCmd,"GetList"); + + // Newly added code + TLiwVariant content(_L("Inbox")); + TLiwGenericParam element1 ; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); + CleanupStack::PushL(mtmtypelist); + + + TLiwVariant smsmtm(KMessageTypeSMS); // how the user wud gv this param + mtmtypelist->AppendL(smsmtm); + smsmtm.Reset(); + TLiwVariant mmsmtm(KMessageTypeMMS);// how the user wud gv this param + //mtmtypelist->AppendL(mmsmtm); + mmsmtm.Reset(); + + TLiwVariant add1(mtmtypelist); + + map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added + mtmtypelist->DecRef(); + CleanupStack::Pop(mtmtypelist); + add1.Reset(); + + CLiwDefaultList* senderlist = CLiwDefaultList::NewL(); + CleanupStack::PushL(senderlist); + + HBufC* address1 = HBufC::NewL(20) ; + CleanupStack::PushL(address1); + address1->Des().Copy(_L("9008032761")); + TLiwVariant addres1(address1); + //senderlist->AppendL(addres1); + addres1.Reset(); + CleanupStack::PopAndDestroy(address1); + + TLiwVariant from(senderlist); + map->InsertL(_L8("SenderList"),from); // Sender list + from.Reset(); + + CleanupStack::Pop(senderlist); + senderlist->DecRef(); + + + + + TDateTime start(2009,EJanuary,22,0,0,0,0); + TTime startdate(start); + TLiwVariant date1(startdate); + map->InsertL(_L8("StartDate"),date1); + date1.Reset(); + + TDateTime end(2010,EDecember,23,0,0,0,0); + TTime enddate(end) ; + TLiwVariant date2(enddate); + map->InsertL(_L8("EndDate"),date2); + date2.Reset(); + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + CLiwDefaultMap* sortmap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(sortmap); + + HBufC* sort1 = HBufC::NewL(20) ; + CleanupStack::PushL(sort1); + sort1->Des().Copy(_L("Date")); + TLiwVariant sort(sort1); + sortmap->InsertL(_L8("Key"), sort); + sort.Reset(); + CleanupStack::PopAndDestroy(sort1); + + + HBufC* order1 = HBufC::NewL(20) ; + CleanupStack::PushL(order1); + order1->Des().Copy(_L("Ascending")); + TLiwVariant order(order1); + sortmap->InsertL(_L8("Order"), order); + order.Reset(); + CleanupStack::PopAndDestroy(order1); + + + TLiwVariant sortordermap(sortmap); + TLiwGenericParam element2 ; + element2.SetNameAndValueL(_L8("SortOrder"),sortordermap); + sortordermap.Reset(); + + + inParamList->AppendL(element2); + element2.Reset(); + + + sortmap->DecRef(); + CleanupStack::Pop(sortmap); + + + interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,KLiwOptASyncronous,this); + pos = 0 ; + const TLiwGenericParam* errcode=outParamList->FindFirst(pos,KErrCode); + TInt err = errcode->Value().AsTInt32(); + if(!err) + CActiveScheduler::Start(); + else + iResult = KErrGeneral; + + TInt index=0; + + interface->Close(); + iServiceHandler->Reset(); + delete iServiceHandler; + + __UHEAP_MARKEND; + + if(0 == iResult) + return KErrNone; + else + return KErrGeneral; + + + } + +TInt Ctmsgget_async::getlist_asyncmmsL(CStifItemParser& aItem ) + { + iTestid = EMMS; + __UHEAP_MARK; + // Iter-3 test work + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + _LIT8(KDataSource, "IMessaging"); + outParamList->FindFirst(pos,KDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + outParamList->Reset(); + // Iter-2 same + inParamList->Reset(); + + + _LIT8(KCmd,"GetList"); + + // Newly added code + TLiwVariant content(_L("Inbox")); + TLiwGenericParam element1 ; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); + CleanupStack::PushL(mtmtypelist); + + TLiwVariant mmsmtm(KMessageTypeMMS);// how the user wud gv this param + mtmtypelist->AppendL(mmsmtm); + mmsmtm.Reset(); + + TLiwVariant add1(mtmtypelist); + + map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added + mtmtypelist->DecRef(); + CleanupStack::Pop(mtmtypelist); + add1.Reset(); + + CLiwDefaultList* senderlist = CLiwDefaultList::NewL(); + CleanupStack::PushL(senderlist); + + HBufC* address1 = HBufC::NewL(20) ; + CleanupStack::PushL(address1); + address1->Des().Copy(_L("9008032761")); + TLiwVariant addres1(address1); + //senderlist->AppendL(addres1); + addres1.Reset(); + CleanupStack::PopAndDestroy(address1); + + TLiwVariant from(senderlist); + map->InsertL(_L8("SenderList"),from); // Sender list + from.Reset(); + + CleanupStack::Pop(senderlist); + senderlist->DecRef(); + + + + + TDateTime start(2009,EJanuary,22,0,0,0,0); + TTime startdate(start); + TLiwVariant date1(startdate); + map->InsertL(_L8("StartDate"),date1); + date1.Reset(); + + TDateTime end(2010,EDecember,23,0,0,0,0); + TTime enddate(end) ; + TLiwVariant date2(enddate); + map->InsertL(_L8("EndDate"),date2); + date2.Reset(); + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + CLiwDefaultMap* sortmap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(sortmap); + + HBufC* sort1 = HBufC::NewL(20) ; + CleanupStack::PushL(sort1); + sort1->Des().Copy(_L("Date")); + TLiwVariant sort(sort1); + sortmap->InsertL(_L8("Key"), sort); + sort.Reset(); + CleanupStack::PopAndDestroy(sort1); + + + HBufC* order1 = HBufC::NewL(20) ; + CleanupStack::PushL(order1); + order1->Des().Copy(_L("Ascending")); + TLiwVariant order(order1); + sortmap->InsertL(_L8("Order"), order); + order.Reset(); + CleanupStack::PopAndDestroy(order1); + + + TLiwVariant sortordermap(sortmap); + TLiwGenericParam element2 ; + element2.SetNameAndValueL(_L8("SortOrder"),sortordermap); + sortordermap.Reset(); + + + inParamList->AppendL(element2); + element2.Reset(); + + + sortmap->DecRef(); + CleanupStack::Pop(sortmap); + + interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,KLiwOptASyncronous,this); + pos = 0 ; + const TLiwGenericParam* errcode=outParamList->FindFirst(pos,KErrCode); + TInt err = errcode->Value().AsTInt32(); + if(!err) + CActiveScheduler::Start(); + else + iResult = KErrGeneral; + + TInt index=0; + + interface->Close(); + iServiceHandler->Reset(); + delete iServiceHandler; + + __UHEAP_MARKEND; + + if(0 == iResult) + return KErrNone; + else + return KErrGeneral; + + + } + + +TInt Ctmsgget_async::getlist_asyncstressL(CStifItemParser& aItem ) + { + iTestid = ESMS; + __UHEAP_MARK; + // Iter-3 test work + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + + CLiwGenericParamList* inParamList = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outParamList = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inParamList, *outParamList); + + delete crit; + crit = NULL; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + _LIT8(KDataSource, "IMessaging"); + outParamList->FindFirst(pos,KDataSource ); + if(pos != KErrNotFound) + { + interface = (*outParamList)[pos].Value().AsInterface(); + } + + outParamList->Reset(); + // Iter-2 same + inParamList->Reset(); + + + _LIT8(KCmd,"GetList"); + + // Newly added code + TLiwVariant content(_L("Inbox")); + TLiwGenericParam element1 ; + element1.SetNameAndValueL(_L8("Type"),content); + inParamList->AppendL(element1); + content.Reset(); + element1.Reset(); + + CLiwDefaultMap* map = CLiwDefaultMap::NewL(); + CleanupStack::PushL(map); + + CLiwDefaultList* mtmtypelist = CLiwDefaultList::NewL(); + CleanupStack::PushL(mtmtypelist); + + + TLiwVariant smsmtm(KMessageTypeSMS); // how the user wud gv this param + mtmtypelist->AppendL(smsmtm); + smsmtm.Reset(); + TLiwVariant mmsmtm(KMessageTypeMMS);// how the user wud gv this param + //mtmtypelist->AppendL(mmsmtm); + mmsmtm.Reset(); + + TLiwVariant add1(mtmtypelist); + + map->InsertL(_L8("MessageTypeList"), add1); // Mtmtype is added + mtmtypelist->DecRef(); + CleanupStack::Pop(mtmtypelist); + add1.Reset(); + + CLiwDefaultList* senderlist = CLiwDefaultList::NewL(); + CleanupStack::PushL(senderlist); + + HBufC* address1 = HBufC::NewL(20) ; + CleanupStack::PushL(address1); + address1->Des().Copy(_L("9008032761")); + TLiwVariant addres1(address1); + //senderlist->AppendL(addres1); + addres1.Reset(); + CleanupStack::PopAndDestroy(address1); + + TLiwVariant from(senderlist); + map->InsertL(_L8("SenderList"),from); // Sender list + from.Reset(); + + CleanupStack::Pop(senderlist); + senderlist->DecRef(); + + + + + TDateTime start(2009,EJanuary,22,0,0,0,0); + TTime startdate(start); + TLiwVariant date1(startdate); + map->InsertL(_L8("StartDate"),date1); + date1.Reset(); + + TDateTime end(2010,EDecember,23,0,0,0,0); + TTime enddate(end) ; + TLiwVariant date2(enddate); + map->InsertL(_L8("EndDate"),date2); + date2.Reset(); + TLiwVariant filterparam(map); + TLiwGenericParam element ; + element.SetNameAndValueL(_L8("Filter"),filterparam); + filterparam.Reset(); + + + inParamList->AppendL(element); + element.Reset(); + map->DecRef(); + CleanupStack::Pop(map); + + CLiwDefaultMap* sortmap = CLiwDefaultMap::NewL(); + CleanupStack::PushL(sortmap); + + HBufC* sort1 = HBufC::NewL(20) ; + CleanupStack::PushL(sort1); + sort1->Des().Copy(_L("Date")); + TLiwVariant sort(sort1); + sortmap->InsertL(_L8("Key"), sort); + sort.Reset(); + CleanupStack::PopAndDestroy(sort1); + + + HBufC* order1 = HBufC::NewL(20) ; + CleanupStack::PushL(order1); + order1->Des().Copy(_L("Ascending")); + TLiwVariant order(order1); + sortmap->InsertL(_L8("Order"), order); + order.Reset(); + CleanupStack::PopAndDestroy(order1); + + + TLiwVariant sortordermap(sortmap); + TLiwGenericParam element2 ; + element2.SetNameAndValueL(_L8("SortOrder"),sortordermap); + sortordermap.Reset(); + + + inParamList->AppendL(element2); + element2.Reset(); + + + sortmap->DecRef(); + CleanupStack::Pop(sortmap); + TInt i=0; + pos = 0 ; + for(i=0;i<20;i++) + { + interface->ExecuteCmdL( KCmd ,*inParamList ,*outParamList,KLiwOptASyncronous,this); + + const TLiwGenericParam* errcode=outParamList->FindFirst(pos,KErrCode); + TInt err = errcode->Value().AsTInt32(); + if(!err) + CActiveScheduler::Start(); + else + iResult = KErrGeneral; + } + + TInt index=0; + + interface->Close(); + iServiceHandler->Reset(); + delete iServiceHandler; + + __UHEAP_MARKEND; + + if(0 == iResult) + return KErrNone; + else + return KErrGeneral; + + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/conf/tmsg_getheaderlistiter1.cfg --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/conf/tmsg_getheaderlistiter1.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/conf/tmsg_getheaderlistiter1.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -47,3 +47,19 @@ delete foobar [Endtest] +[Test] +title getheadersmsasync_test4 +create tmsg_getheaderlistiter1 foobar +foobar getheadersmsasync_test4 +delete foobar +[Endtest] + +[Test] +title getheadermmsasync_test3 +create tmsg_getheaderlistiter1 foobar +foobar getheadermmsasync_test3 +delete foobar +[Endtest] + + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/group/tmsg_getheaderlistiter1.mmp --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/group/tmsg_getheaderlistiter1.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/group/tmsg_getheaderlistiter1.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -39,11 +39,13 @@ SOURCEPATH ../src SOURCE getheader.cpp SOURCE get_headerblocks.cpp -SOURCE tgetheaderlistsms1.cpp +SOURCE tgetheaderlistsms1.cpp SOURCE tgetheaderlistsms2.cpp SOURCE tgetheaderlistsms3.cpp SOURCE tgetheaderlistmms1.cpp -SOURCE tgetheaderlistmms2.cpp +SOURCE tgetheaderlistmms2.cpp +SOURCE tgetheaderlistsms4.cpp +SOURCE tgetheaderlistmms3.cpp //RESOURCE resource_file //RESOURCE resource_file2 diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/inc/getheader.h --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/inc/getheader.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/inc/getheader.h Thu Aug 27 07:43:07 2009 +0300 @@ -32,6 +32,8 @@ extern int getheader_test3(int, char**); extern int getheadermms_test1(int, char**); extern int getheadermms_test2(int, char**); +extern int getheadersmsasync_test4(int, char**); +extern int getheadermmsasync_test3(int, char**); //extern int accum2_test(int, char**); @@ -156,7 +158,8 @@ virtual TInt getheader_test3L( CStifItemParser& aItem ); virtual TInt getheadermms_test1L( CStifItemParser& aItem ); virtual TInt getheadermms_test2L( CStifItemParser& aItem ); - + virtual TInt getheadersmsasync_test4L( CStifItemParser& aItem ); + virtual TInt getheadermmsasync_test3L( CStifItemParser& aItem ); public: // Data // ?one_line_short_description_of_data diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/src/get_headerblocks.cpp --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/src/get_headerblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/src/get_headerblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -101,7 +101,9 @@ ENTRY( "getheader_test2", Csapi_getheader::getheader_test2L ), ENTRY( "getheader_test3", Csapi_getheader::getheader_test3L ), ENTRY( "getheadermms_test1", Csapi_getheader::getheadermms_test1L ), - ENTRY( "getheadermms_test2", Csapi_getheader::getheadermms_test2L ), + ENTRY( "getheadermms_test2", Csapi_getheader::getheadermms_test2L ), + ENTRY( "getheadersmsasync_test4", Csapi_getheader::getheadersmsasync_test4L ), + ENTRY( "getheadermmsasync_test3", Csapi_getheader::getheadermmsasync_test3L ) }; const TInt count = sizeof( KFunctions ) / @@ -197,7 +199,44 @@ else return KErrGeneral; - } /* + } +// ----------------------------------------------------------------------------- +// Csapi_getheader:getheadersmsasync_test4L +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Csapi_getheader::getheadersmsasync_test4L( CStifItemParser& ) + { + int ret=0; + ret = getheadersmsasync_test4(0, NULL); + + if(ret==0) + return KErrNone; + else + return KErrGeneral; + + } +// ----------------------------------------------------------------------------- +// Csapi_getheader:getheadermmsasync_test3L +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Csapi_getheader::getheadermmsasync_test3L( CStifItemParser& ) + { + int ret=0; + ret = getheadermmsasync_test3(0, NULL); + + if(ret==0) + return KErrNone; + else + return KErrGeneral; + + } + + +/* // ----------------------------------------------------------------------------- // Csapi_getheader:getheader6_testL // Example test method function. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/src/tgetheaderlistmms3.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/src/tgetheaderlistmms3.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,268 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 "messagingservice.h" +#include +#include "getheader.h" +#include +//#include "messageheader.h" +#ifdef MAIN +#define getheadermmsasync_test3 main +#endif + +class CTestAsync; +/** + * Callback class for asynchronous SAPI message header +*/ +class CMsgCallbackHeader : public CMsgCallbackBase + { + public: + + static CMsgCallbackHeader* NewL(CActiveSchedulerWait* aWaitSchedular, CMessagingService*s); + + virtual ~CMsgCallbackHeader(){} + + virtual void HandleGetlistL (TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter); + + virtual void NotifyResultL(TInt aErrCode, TAny* aResult); + + + + private: + + CMsgCallbackHeader(CActiveSchedulerWait* aWaitSchedular, CMessagingService*s):iWaitSchedular(aWaitSchedular), iservice(s){ } + CTestAsync *testasync; + CActiveSchedulerWait* iWaitSchedular; + CMessagingService* iservice; + + }; + +class CTestAsync : public CActive +{ +public: + static CTestAsync* NewL(); + ~CTestAsync(); + void Start(); + TInt Result(); + void setCallbackresult(TInt res); + + +private: + void ConstructL(); + CTestAsync(); + + virtual void DoCancel(); + virtual void RunL(); + + + void TestFunc(); + + + +private: + CActiveSchedulerWait* iWaitSchedular; + CMessagingService* iMessagingService; + CMsgCallbackHeader* iCallBack; + TInt iResult; + TInt iCallbackresult; + +}; + + +void CMsgCallbackHeader::NotifyResultL( TInt aErrCode, TAny* aResult ) + { + + } + +void CMsgCallbackHeader::HandleGetlistL( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) + { + + testasync = CTestAsync::NewL(); + CFilterParamInfo* filterParams = aFilter; + CMsvEntrySelection* en=aEntrySelection; + TInt iter=0; + TInt val=0; + TInt index = 0; + TTime startdate=filterParams->StartDate(); + TTime enddate = filterParams->EndDate(); + for(;;) + { + CMessageHeader* header = NULL; + iservice->GetNextHeaderL(filterParams, en, index, NULL, header); + if(header) + { + iter++; + TTime temp =header->Time(); + + if((header->Mtm().FindF(_L("MMS")) != KErrNotFound ) && (startdate <= temp && temp <= enddate ) ) + val++; + + + delete header; + } + else + break; + + } + delete filterParams; + + delete en; + + if(iter==val) + testasync->setCallbackresult(KErrNone); + else + testasync->setCallbackresult(KErrGeneral); + delete testasync; + + iWaitSchedular->AsyncStop(); + } + +CMsgCallbackHeader* CMsgCallbackHeader::NewL(CActiveSchedulerWait* aWaitSchedular, CMessagingService* s) + { + CMsgCallbackHeader* self = new (ELeave) CMsgCallbackHeader(aWaitSchedular, s); + return self; + } + +CTestAsync* CTestAsync::NewL() + { + CTestAsync* self = new(ELeave) CTestAsync(); + self->ConstructL(); + return self; + } + +CTestAsync::~CTestAsync() + { + Cancel(); + + if(iWaitSchedular->IsStarted() ) + iWaitSchedular->AsyncStop(); + + if(iMessagingService ) + delete iMessagingService; + + if(iWaitSchedular ) + delete iWaitSchedular; + } + +void CTestAsync::ConstructL() + { + CActiveScheduler::Add(this); + iMessagingService = CMessagingService::NewL(); + iWaitSchedular = new(ELeave) CActiveSchedulerWait(); + } + +CTestAsync::CTestAsync() : +CActive(EPriorityStandard) + { + } + +void CTestAsync::DoCancel() + { + + } + +void CTestAsync::RunL() + { + TestFunc(); + } + +void CTestAsync::Start() + { + iCallBack = CMsgCallbackHeader::NewL(iWaitSchedular, iMessagingService); + SetActive(); + TRequestStatus* temp = &iStatus; + User::RequestComplete(temp, KErrNone); + iWaitSchedular->Start(); + } + +void CTestAsync::setCallbackresult(TInt res) + { + if(res==KErrNone) + iCallbackresult=KErrNone; + else + iCallbackresult=KErrGeneral; + } +TInt CTestAsync::Result() + { + + if(iCallbackresult==KErrNone && iResult==KErrNone) + return KErrNone; + else + return KErrGeneral; + } + + +void CTestAsync::TestFunc() + { + CFilterParamInfo* filterParams = CFilterParamInfo::NewL(); + CleanupStack::PushL(filterParams); + + filterParams->SetSortType(EMsvSortByDate); + + filterParams->AddMtmL(_L("MMS")); + + TDateTime start(2008,EMarch,22,0,0,0,0); + TInt startyear = start.Year(); + TInt startmonth = start.Month(); + TInt startday = start.Day(); + + TTime startdate(start); + + filterParams->SetStartDateFilter(startdate); + + TDateTime end(2010,EJune,23,0,0,0,0); + TInt endyear = end.Year(); + TInt endmonth = end.Month(); + TInt endday = end.Day(); + + + TTime enddate(end) ; + + filterParams->SetEndDate(enddate); + + + CMsvEntrySelection* entryselection = NULL ; + TRAPD(err, iMessagingService->GetIdListL(filterParams,0,iCallBack,entryselection)); + if(err==KErrNone ) + iResult=KErrNone; + else + iResult=KErrGeneral; + CleanupStack::PopAndDestroy(filterParams); + + } + + +int getheadermmsasync_test3(int, char**) + { + TInt result; + __UHEAP_MARK; + CTestAsync* test = CTestAsync::NewL(); + test->Start(); + result=test->Result(); + delete test; + __UHEAP_MARKEND; + if(result==KErrNone) + return KErrNone; + else + return KErrGeneral; + + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/src/tgetheaderlistsms4.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_getheaderlistiter1/src/tgetheaderlistsms4.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,268 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 "messagingservice.h" +#include +#include "getheader.h" +#include +//#include "messageheader.h" +#ifdef MAIN +#define getheadersmsasync_test4 main +#endif + +class CTestAsync1; +/** + * Callback class for asynchronous SAPI message header +*/ +class CMsgCallbackHeader1 : public CMsgCallbackBase + { + public: + + static CMsgCallbackHeader1* NewL(CActiveSchedulerWait* aWaitSchedular, CMessagingService*s); + + virtual ~CMsgCallbackHeader1(){} + + virtual void HandleGetlistL (TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter); + + virtual void NotifyResultL(TInt aErrCode, TAny* aResult); + + + + private: + + CMsgCallbackHeader1(CActiveSchedulerWait* aWaitSchedular, CMessagingService*s):iWaitSchedular(aWaitSchedular), iservice(s){ } + CTestAsync1 *testasync; + CActiveSchedulerWait* iWaitSchedular; + CMessagingService* iservice; + + }; + +class CTestAsync1 : public CActive +{ +public: + static CTestAsync1* NewL(); + ~CTestAsync1(); + void Start(); + TInt Result(); + void setCallbackresult(TInt res); + + +private: + void ConstructL(); + CTestAsync1(); + + virtual void DoCancel(); + virtual void RunL(); + + + void TestFunc(); + + + +private: + CActiveSchedulerWait* iWaitSchedular; + CMessagingService* iMessagingService; + CMsgCallbackHeader1* iCallBack; + TInt iResult; + TInt iCallbackresult; + +}; + + +void CMsgCallbackHeader1::NotifyResultL( TInt aErrCode, TAny* aResult ) + { + + } + +void CMsgCallbackHeader1::HandleGetlistL( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) + { + + testasync = CTestAsync1::NewL(); + CFilterParamInfo* filterParams = aFilter; + CMsvEntrySelection* en=aEntrySelection; + TInt iter=0; + TInt val=0; + TInt index = 0; + TTime startdate=filterParams->StartDate(); + TTime enddate = filterParams->EndDate(); + for(;;) + { + CMessageHeader* header = NULL; + iservice->GetNextHeaderL(filterParams, en, index, NULL, header); + if(header) + { + iter++; + TTime temp =header->Time(); + + if((header->Mtm().FindF(_L("SMS")) != KErrNotFound ) && (startdate <= temp && temp <= enddate ) ) + val++; + + + delete header; + } + else + break; + + } + delete filterParams; + + delete en; + + if(iter==val) + testasync->setCallbackresult(KErrNone); + else + testasync->setCallbackresult(KErrGeneral); + delete testasync; + + iWaitSchedular->AsyncStop(); + } + +CMsgCallbackHeader1* CMsgCallbackHeader1::NewL(CActiveSchedulerWait* aWaitSchedular, CMessagingService* s) + { + CMsgCallbackHeader1* self = new (ELeave) CMsgCallbackHeader1(aWaitSchedular, s); + return self; + } + +CTestAsync1* CTestAsync1::NewL() + { + CTestAsync1* self = new(ELeave) CTestAsync1(); + self->ConstructL(); + return self; + } + +CTestAsync1::~CTestAsync1() + { + Cancel(); + + if(iWaitSchedular->IsStarted() ) + iWaitSchedular->AsyncStop(); + + if(iMessagingService ) + delete iMessagingService; + + if(iWaitSchedular ) + delete iWaitSchedular; + } + +void CTestAsync1::ConstructL() + { + CActiveScheduler::Add(this); + iMessagingService = CMessagingService::NewL(); + iWaitSchedular = new(ELeave) CActiveSchedulerWait(); + } + +CTestAsync1::CTestAsync1() : +CActive(EPriorityStandard) + { + } + +void CTestAsync1::DoCancel() + { + + } + +void CTestAsync1::RunL() + { + TestFunc(); + } + +void CTestAsync1::Start() + { + iCallBack = CMsgCallbackHeader1::NewL(iWaitSchedular, iMessagingService); + SetActive(); + TRequestStatus* temp = &iStatus; + User::RequestComplete(temp, KErrNone); + iWaitSchedular->Start(); + } + +void CTestAsync1::setCallbackresult(TInt res) + { + if(res==KErrNone) + iCallbackresult=KErrNone; + else + iCallbackresult=KErrGeneral; + } +TInt CTestAsync1::Result() + { + + if(iCallbackresult==KErrNone && iResult==KErrNone) + return KErrNone; + else + return KErrGeneral; + } + + +void CTestAsync1::TestFunc() + { + CFilterParamInfo* filterParams = CFilterParamInfo::NewL(); + CleanupStack::PushL(filterParams); + + filterParams->SetSortType(EMsvSortByDate); + + filterParams->AddMtmL(_L("SMS")); + + TDateTime start(2008,EMarch,22,0,0,0,0); + TInt startyear = start.Year(); + TInt startmonth = start.Month(); + TInt startday = start.Day(); + + TTime startdate(start); + + filterParams->SetStartDateFilter(startdate); + + TDateTime end(2010,EJune,23,0,0,0,0); + TInt endyear = end.Year(); + TInt endmonth = end.Month(); + TInt endday = end.Day(); + + + TTime enddate(end) ; + + filterParams->SetEndDate(enddate); + + + CMsvEntrySelection* entryselection = NULL ; + TRAPD(err, iMessagingService->GetIdListL(filterParams,0,iCallBack,entryselection)); + if(err==KErrNone ) + iResult=KErrNone; + else + iResult=KErrGeneral; + CleanupStack::PopAndDestroy(filterParams); + + } + + +int getheadersmsasync_test4(int, char**) + { + TInt result; + __UHEAP_MARK; + CTestAsync1* test = CTestAsync1::NewL(); + test->Start(); + result=test->Result(); + delete test; + __UHEAP_MARKEND; + if(result==KErrNone) + return KErrNone; + else + return KErrGeneral; + + + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/conf/tmsg_sendmessageiter1.cfg --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/conf/tmsg_sendmessageiter1.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/conf/tmsg_sendmessageiter1.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -54,3 +54,10 @@ foobar sendmessage_test9 delete foobar [Endtest] + +[Test] +title sendmessage11 +create tmsg_sendmessageiter1 foobar +foobar sendmessage_test11 +delete foobar +[Endtest] diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/group/tmsg_sendmessageiter1.mmp --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/group/tmsg_sendmessageiter1.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/group/tmsg_sendmessageiter1.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -48,7 +48,8 @@ SOURCE sendmessage7.cpp SOURCE sendmessage8.cpp SOURCE sendmessage9.cpp -SOURCE sendmessage10.cpp +SOURCE sendmessage10.cpp +SOURCE sendmessage11.cpp //RESOURCE resource_file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/inc/sendmessage.h --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/inc/sendmessage.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/inc/sendmessage.h Thu Aug 27 07:43:07 2009 +0300 @@ -37,6 +37,7 @@ extern int sendmessage_test8(int, char**); extern int sendmessage_test9(int, char**); extern int sendmessage_test10(int, char**); +extern int sendmessage_test11(int, char**); //extern int accum2_test(int, char**); @@ -166,6 +167,7 @@ virtual TInt sendmessage_test8L( CStifItemParser& aItem ); virtual TInt sendmessage_test9L( CStifItemParser& aItem ); virtual TInt sendmessage_test10L( CStifItemParser& aItem ); + virtual TInt sendmessage_test11L( CStifItemParser& aItem ); public: // Data // ?one_line_short_description_of_data diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/src/send_messageblocks.cpp --- a/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/src/send_messageblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/src/send_messageblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -111,6 +111,7 @@ ENTRY( "sendmessage_test8", Csapi_sendmessage::sendmessage_test8L ), ENTRY( "sendmessage_test9", Csapi_sendmessage::sendmessage_test9L ), ENTRY( "sendmessage_test10", Csapi_sendmessage::sendmessage_test10L ), + ENTRY( "sendmessage_test11", Csapi_sendmessage::sendmessage_test11L ) }; @@ -290,7 +291,24 @@ else return KErrGeneral; - } + } +// ----------------------------------------------------------------------------- +// Csapi_sendmessage::accum11_testL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Csapi_sendmessage::sendmessage_test11L( CStifItemParser& /*aItem*/ ) + { + int ret=0; + ret = sendmessage_test11(0, NULL); + + if(ret==0) + return KErrNone; + else + return KErrGeneral; + + } // ----------------------------------------------------------------------------- // Csapi_sendmessage::?member_function // ?implementation_description diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/src/sendmessage11.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/dev/tmessagingtest/tmsg_sendmessageiter1/src/sendmessage11.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,82 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// STLport regression testsuite component. +// To compile as a separate example, please #define MAIN. + +#include + +#include "messagingservice.h" +#include "sendmessage.h" + +#ifdef MAIN +#define sendmessage_test11 main +#endif + + + +int sendmessage_test11(int, char**) + { + __UHEAP_MARK; + TInt result = KErrNone; + TMsvId messageid = 0; + CFilterParamInfo* filterParams = CFilterParamInfo::NewL(); + CleanupStack::PushL(filterParams); + filterParams->AddMtmL(_L("MMS")); + CMsvEntrySelection* entryselection = NULL ; + CMessagingService* test = (CMessagingService*) CMessagingService::NewL() ; + CleanupStack::PushL( test ); + TRAPD(err, test->GetIdListL(filterParams,0,NULL,entryselection)); + if(err==KErrNone) + { + CMessageHeader* header = NULL; + TInt index=0; + test->GetNextHeaderL(filterParams, entryselection, index, NULL, header); + if(header) + { + messageid = header->MessageId(); + } + delete header; + } + delete entryselection; + + CSendMessageParams* messageParam = CSendMessageParams::NewL(); + CleanupStack::PushL(messageParam); + messageParam->AddRecipientL(_L("9008032761")); + messageParam->AddRecipientL(_L("9008032762")); + messageParam->SetMessageTypeL(_L("SMS")); + messageParam->SetBodyTextL(_L("Hi How are you!!! Its the first sms from imessaging")); + if(messageid > 0) + messageParam->SetTemplateId(messageid); + + TRAP(result, test->SendMessageL(messageParam, NULL)); + + CleanupStack::PopAndDestroy(2, test) ; + CleanupStack::PopAndDestroy(filterParams) ; + + __UHEAP_MARKEND; + if(messageid) + { + if(result==KErrNotSupported) + return KErrNone; + else + return KErrGeneral; + } + else + return result; + } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/group/bld.inf --- a/serviceproviders/sapi_messaging/tsrc/testing/group/bld.inf Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/testing/group/bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -28,6 +28,7 @@ #include "../tmessagingtest/get_header_message/group/bld.inf" #include "../tmessagingtest/register_message/group/bld.inf" #include "../tmessagingtest/send_message/group/bld.inf" +#include "../tmessagingtest/get_message_async/group/bld.inf" PRJ_PLATFORMS diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_header_message/src/get_header_messageblocks.cpp --- a/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_header_message/src/get_header_messageblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_header_message/src/get_header_messageblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -290,6 +290,7 @@ headerarr->GetMessageId(message_id); filter->SetMessageIdFilter(message_id); delete headerarr; + marray->Reset(); delete marray; delete mfilter; CleanupStack::PopAndDestroy(mservice); @@ -475,9 +476,9 @@ TTime time; headers->GetTime(time); - headers->SetPriorityFlag(TMsvPriority(0)); - headers->SetPriorityFlag(TMsvPriority(2)); - headers->SetPriorityFlag(TMsvPriority(6)); + //headers->SetPriorityFlag(TMsvPriority(0)); + //headers->SetPriorityFlag(TMsvPriority(2)); + //headers->SetPriorityFlag(TMsvPriority(6)); TMsvId id_l = headers->MessageId(); TBool fl_l = headers->AttachFlag(); @@ -504,6 +505,8 @@ } else { + delete headers; + headers = NULL; test = FALSE; break; } diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/bwins/get_message_asyncu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/bwins/get_message_asyncu.def Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/conf/get_message_async.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/conf/get_message_async.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,122 @@ +/* =========================================================================== + * Copyright © 2006-2007 Nokia Corporation. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia Corporation. All rights are reserved. Copying, + * including reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia Corporation. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia Corporation. + * ============================================================================ + */ + +// message-id fromarray subject sort-type uid-type start-date end-date positive/negative 0-negative 1-positive + +[Test] +title Null Filter +create get_message_async foobar +foobar test_1 0 NULL NULL 0 NULL 0 0 1 +delete foobar +[Endtest] + +[Test] +title Non existent Messageid +create get_message_async foobar +foobar test_1 128 NULL NULL 0 NULL 0 0 0 +delete foobar +[Endtest] + +[Test] +title Invalid Messageid +create get_message_async foobar +foobar test_1 -657 NULL NULL 0 NULL 0 0 0 +delete foobar +[Endtest] + +[Test] +title Valid Messageid +create get_message_async foobar +foobar test_1 1 NULL NULL 0 NULL 0 0 1 +delete foobar +[Endtest] + + +[Test] +title Valid FromArray +create get_message_async foobar +foobar test_1 0 20 AddrEnd NULL 0 NULL 0 0 1 +delete foobar +[Endtest] + +[Test] +title Invalid FromArray +create get_message_async foobar +foobar test_1 0 -7 AddrEnd NULL 0 NULL 0 0 0 +delete foobar +[Endtest] + +[Test] +title Non Existent FromArray +create get_message_async foobar +foobar test_1 0 917 AddrEnd NULL 0 NULL 0 0 0 +delete foobar +[Endtest] + +[Test] +title Non Existent Subject +create get_message_async foobar +foobar test_1 0 NULL zd 0 NULL 0 0 0 +delete foobar +[Endtest] + +[Test] +title Valid SortOrder +create get_message_async foobar +foobar test_1 0 NULL NULL 10 NULL 0 0 1 +delete foobar +[Endtest] + +[Test] +title Valid uid(sms) +create get_message_async foobar +foobar test_1 0 NULL NULL 0 SMS MtmEnd 0 0 1 +delete foobar +[Endtest] + + +[Test] +title Valid uid(mms) +create get_message_async foobar +foobar test_1 0 NULL NULL 0 MMS MtmEnd 0 0 1 +delete foobar +[Endtest] + +[Test] +title Start date>End date +create get_message_async foobar +foobar test_1 0 NULL NULL 0 NULL 1 2009 5 23 0 0 0 0 1 2009 5 22 0 0 0 0 0 +delete foobar +[Endtest] + +[Test] +title Start date>Current date +create get_message_async foobar +foobar test_1 0 NULL NULL 0 NULL 1 2909 9 14 0 0 0 0 0 0 +delete foobar +[Endtest] + + +[Test] +title End date# + _ZTI18CMsgCallbackHeader @ 3 NONAME ; ## + _ZTV12Cheader_test @ 4 NONAME ; ## + _ZTV18CMsgCallbackHeader @ 5 NONAME ; ## + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/group/Bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/group/Bld.inf Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,61 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +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' +../conf/get_message_async.cfg /epoc32/winscw/c/testframework/get_message_async.cfg + +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 + + get_message_async.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 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/group/get_message_async.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/group/get_message_async.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,76 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 "../../../../../../group/sapiincludes.mmpi" + +TARGET get_message_async.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +EpocAllowDllData + +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 get_message_async.def + +USERINCLUDE ../inc + + + +SOURCEPATH ../src + +SOURCE get_message_async.cpp +SOURCE get_message_asyncBlocks.cpp + +//RESOURCE resource_file +//RESOURCE resource_file2 + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY messagingservice.lib +LIBRARY bafl.lib +LIBRARY efsrv.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 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/group/get_message_async.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/group/get_message_async.pkg Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,39 @@ +; ============================================================================ +; 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 the License "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: package file for Service API package +; ============================================================================ + +; Languages +&EN + +; Provide value for uid +#{"Messagingtest"},(0x098934AB),1,1,0,TYPE=SA + +; Series60 product id for S60 3.0 +[0x101F7961], 0, 0, 0, {"Series60ProductID"} + +;SAPI Binaries to Install + +;Messagingservice binaries +;"..\..\..\..\..\..\..\..\..\epoc32\release\armv5\urel\messagingservice.dll"-"C:\sys\bin\messagingservice.dll" +"..\..\..\..\..\..\..\..\..\epoc32\release\armv5\urel\get_message_async.dll"-"C:\sys\bin\get_message_async.dll" + + +;ini file +"..\init\Testframework.ini"-"c:\Testframework\Testframework.ini" + +;cfg file +"..\conf\get_message_async.cfg"-"c:\Testframework\get_message_async.cfg" + + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/accessfolder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/accessfolder.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,172 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defination of class CMessagingAccessFolder +* +*/ + + + +#ifndef __ACCESSFOLDER_H +#define __ACCESSFOLDER_H + + +/** + * This class provides function to get a list of measage header + * in a sorted order present in a folder . Message Headers are + * retrieved as per searching options provided by user. +*/ +class CMessagingAccessFolder : public CBase + { + + public: + + /** + * Two-phased constructor. + * @param aServerSession Object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread. + */ + static CMessagingAccessFolder* NewL( CMsvSession& aServerSession ); + + /** + * Destructor. + */ + ~CMessagingAccessFolder(); + + private: + + /** + * Constructor. + * @param aServerSession Object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread . + * @return void + */ + CMessagingAccessFolder( CMsvSession& aServerSession ); + + + public: + + /** + * Gives Message id list of messages + * @param aFolderId Folder to be used (Inbox/outbox/send/...) + * @param aFilterParams Filter parameters + * @param aEntrySelection output pararmeter for the result id array + */ + void GetIdListL(TMsvId aFolderId , + CFilterParamInfo* aFilterParams, + CMsvEntrySelection*& aEntrySelection ); + + /** + * Gives next header based on inputs + * @param aFilterParams Filter parameters + * @param aEntrySelection array of message ids on which filteration to be done + * @param aIndex starting position on aEntrySelection to be start search + * @param aHeader output pararmeter for the result header + */ + void GetNextHeaderL( CFilterParamInfo* aFilterParams, + CMsvEntrySelection* aEntrySelection, + TInt& aIndex, + CMessageHeader*& aHeader ); + private: + + /** + * Gives the list of message headers + * @return void + */ + void GetListL(); + + /** + * Gets next header which matches filter criteria + * @param aEntrySelection Message Id list to be filtered for headers + * @param aIndex starting position for filterting + * @param aHeader return parameter for message header + * @return void + */ + void GetNextFilteredHeaderL( CMsvEntrySelection* aEntrySelection, + TInt& aIndex, + CMessageHeader*& aHeader ); + + /** + * Initializes the MtmID array by the Mtm string passed by user.\ + */ + void InitializeMtmArray(); + + /** + * Checks whether filter on message id is set + * @param aMessageId The message id to which user want to apply filter + * @return TBool ETrue if filter on message id is set and entry matches with filter + */ + TBool FilterId( const TMsvId aMessageId) const; + + /** + * Checks whether filter on Mtm is set + * @param aEntry The message entry to which user want to apply filter + * @return TBool ETrue if filter on mtm is set and entry matches with filter + */ + TBool FilterMtm( const TMsvEntry& aEntry ) const; + + /** + * Checks whether filter on sender is set + * @param aEntry The message entry to which user want to apply filter + * @return TBool ETrue if filter on sender is set and entry matches with filter + */ + TBool FilterFrom( const TMsvEntry& aEntry ) const; + + /** + * Checks whether filter on subject is set + * @param aEntry The message entry to which user want to apply filter + * @return TBool ETrue if filter on subject is set and entry matches with filter + */ + TBool FilterSubject( const TMsvEntry& aEntry ) const; + + /** + * Checks whether filter on date is set + * @param aEntry The message entry to which user want to apply filter + * @return TBool ETrue if filter on date is set and entry matches with filter + */ + TBool FilterDate( const TMsvEntry& aEntry ) const; + + + private: + + /** + * Represents a channel of communication between a client thread + * and the Message Server thread + */ + CMsvSession& iServerSession; + + /** + * Message Id list + */ + CMsvEntrySelection* iEntrySelection; + + /** + * Folder id from which list of message headers can be retrieved + */ + TMsvId iFolderId; + + /** + * Folder id from which list of message headers can be retrieved + */ + RArray iMtmArrayId; + + /** + * Filter variable + */ + CFilterParamInfo* iFilter; + + }; + +#endif __ACCESSFOLDER_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/async.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/async.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,101 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 +//#include +#include +#include "messagingservice.h" +#include "messageheader.h" + + +#ifndef __ASYNC_H__ +#define __ASYNC_H__ + +class Cheader_test; + +class CMsgCallbackHeader : public CMsgCallbackBase + { + public: + enum TestCaseCallbackId + { + ESMS, + EMMS, + }; + + static CMsgCallbackHeader* NewL(CActiveSchedulerWait* aWaitSchedular, CMessagingService*s); + + virtual ~CMsgCallbackHeader(){} + + virtual void HandleGetlistL (TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter); + + virtual void NotifyResultL(TInt aErrCode, TAny* aResult); + + void setcallbackid(TestCaseCallbackId id); + + private: + + CMsgCallbackHeader(CActiveSchedulerWait* aWaitSchedular, CMessagingService*s):iWaitSchedular(aWaitSchedular), iservice(s){ } + // Cheader_test *testasync; + CActiveSchedulerWait* iWaitSchedular; + CMessagingService* iservice; + TestCaseCallbackId iCid; + }; + + +class Cheader_test : public CActive +{ +public: + + TInt pick2,attcnt,canflag,exflag,posnegflag; + TPtrC b,s,r[20]; + TMsvId iD; + CFilterParamInfo* v; + static Cheader_test* NewL(); + ~Cheader_test(); + void Start(); + CFilterParamInfo* get(void); + TInt getposneg(void); + void set(CFilterParamInfo* p); + void setposneg(TInt aFlag); + +private: + void ConstructL(); + Cheader_test(); + + virtual void DoCancel(); + virtual void RunL(); + + + + void TestFunc(); + //void HandleGetlistL(TInt aErrCode,CMsvEntrySelection* aEntryselection, CFilterParamInfo* aFilterParams); + //void NotifyResultL(TInt aErrCode,TAny* aResult); + +private: + CMsgCallbackHeader* iCallBack; + + +private: + CActiveSchedulerWait* iWaitSchedular; + CMessagingService* iMessagingService; + +}; + + +#endif diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/changestatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/changestatus.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,130 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 __CHANGESTATUS_H +#define __CHANGESTATUS_H + +/** + * This class implements ChangeStatus SAPI core logic.It includes + * methods for changing the status of message flag and deleting a message. + * + */ +class CMessageChangeStatus : public CBase +{ + + public: + + /* + * Creates a new instance of a @ref CMessageChangeStatus + * @param CMsvSession + * @return The newly created CMessageChangeStatus + */ + static CMessageChangeStatus* NewL( CMsvSession& aSession ); + + /* + * Creates a new instance of a @ref CMessageChangeStatus + * @param CMsvSession + * @return The newly created CMessageChangeStatus + */ + static CMessageChangeStatus* NewLC( CMsvSession& aSession ); + + /** + * Destructor. + */ + ~CMessageChangeStatus(); + + /** + * Deletes the message of specified ID + * @param aMsgId It is ID of message to be deleted + * @param aNotifyCallback a callback object + */ + void DeleteMessageL( const TMsvId& aMsgId ); + + /** + * Changes the message flag to the value specified + * @param aMsgId It is ID of message + * @param aStatusFlag Message status flag + * @param aValue Message status flag value + * @param aNotifyCallback a callback object + */ + void ChangeStatusL(const TMsvId& aMsgId, + const TMessageStatusFlag aStatusFlag, + const TBool aValue ); + + private: + + /** + * Default constructor. + * @param aSession It is an object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread . + */ + CMessageChangeStatus(CMsvSession& aSession); + + /** + * Initializer + */ + void InitializeL(); + + /** + * changes the message status + */ + void ChangeStatusL(); + + /** + * completes delete request + */ + void DeleteMessageL(); + + private: + + /** + * Message server session. + */ + CMsvSession& iServerSession; + + /** + * Message ID + */ + TMsvId iMessageId; + + /** + * Message entry + */ + CMsvEntry* iEntry; + + /** + * Index entry + */ + TMsvEntry iIndexEntry; + + /** + * Message Status Flag + */ + TMessageStatusFlag iStatusFlag; + + /** + * status flag value. + */ + TBool iFlagValue; + +}; + + +#endif __CHANGESTATUS_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/get_message_async.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/get_message_async.h Thu Aug 27 07:43:07 2009 +0300 @@ -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 the License "Eclipse Public License v1.0" +* which accompanies 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 GET_MESSAGE_ASYNC_H +#define GET_MESSAGE_ASYNC_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( Kget_message_asyncLogPath, "\\logs\\testframework\\get_message_async\\" ); +// Log file +_LIT( Kget_message_asyncLogFile, "get_message_async.txt" ); +_LIT( Kget_message_asyncLogFileWithTitle, "get_message_async_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class Cget_message_async; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* Cget_message_async test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(Cget_message_async) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static Cget_message_async* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~Cget_message_async(); + + 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. + */ + Cget_message_async( 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 Test1L( CStifItemParser& aItem ); + + TInt Cget_message_async::messageid_func(CStifItemParser& aItem,TInt& id); + TInt Cget_message_async::fromarray_func(CStifItemParser& aItem,TPtrC& fromarray); + TInt Cget_message_async::subject_func(CStifItemParser& aItem,TPtrC& subj); + TInt Cget_message_async::sort_func(CStifItemParser& aItem,TInt& sorttype); + TInt Cget_message_async::mtm_func(CStifItemParser& aItem,TPtrC& mtmtype); + TInt Cget_message_async::date_func(CStifItemParser& aItem,TInt& year,TInt& month,TInt& day,TInt& hour,TInt& min,TInt& sec,TInt& microsec); + TInt Cget_message_async::getsub_func(CStifItemParser& aItem,TPtrC& sub); + TInt Cget_message_async::flag_func(CStifItemParser& aItem,TInt& flag); + TInt Cget_message_async::posneg_func(CStifItemParser& aItem,TInt& posneg); + /** + * 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 // GET_MESSAGE_ASYNC_H + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagedetail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagedetail.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,113 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Defination of class CMessageDetail +* +*/ + + + +#ifndef __MESSAGEDETAIL_H +#define __MESSAGEDETAIL_H + + +/** + * This class provides function to get the message details. + * For SMS message, it gives bodytext, sender and recipient info. + * For MMS, it gives list of attachment information, recipient, sender. + */ +class CMessageDetail : public CBase + { + + public: + /** + * Two-phased constructor. + * @param aServerSession It is an object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread . + * @return CMessageDetail + */ + + static CMessageDetail* NewL( CMsvSession& aServerSession ); + + /** + * Destructor. + */ + ~CMessageDetail(); + + private: + + /** + * Constructor. + * @param aServerSession It is an object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread . + */ + CMessageDetail( CMsvSession& aServerSession ); + + + public: + + /** + * Gets the message details. + * Issues the synchronous or asynchronous request for function call + * depending on the aNotifyCallback. + * @param aMessageId Message Entry Id + * @param aMessageDetail Return parameter for synchronous call + * @return void + */ + void GetMessageDetailL( TMsvId aMessageId, + CMessageDetailInfo*& aMessageDetail ); + + private: + + /** + * Starts get detail request + * @return void + */ + void ProcessRequestL(); + + /** + * Gets the Sender Recipient information for SMS + * @return void + */ + void GetSmsSenderRecipientL(); + + /** + * Gets the Sender Recipient information for MMS + * @return void + */ + void GetMmsSenderRecipientL(); + + + private: + + /** + * Represents a channel of communication between a client thread + * and the Message Server thread + */ + CMsvSession& iServerSession; + + /** + * Message Id + */ + TMsvId iMessageId; + + /** + * Message detail + */ + CMessageDetailInfo* iMessageDetail; + }; + + +#endif __MESSAGEDETAIL_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messageheader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messageheader.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,1006 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Support for header information retrieval +* +*/ + + + +#ifndef __MESSAGEHEADER_H +#define __MESSAGEHEADER_H + +#include +#include +#include +#include + +class CMsvAttachment; +class CRecipientList; + +const TInt KArrayGranularity = 4; + +_LIT(KMessageTypeMMS, "MMS"); +_LIT(KMessageTypeSMS, "SMS"); +_LIT(KUnknown, "unknown"); +_LIT(KPriorityHigh, "High"); +_LIT(KPriorityMedium, "Medium"); +_LIT(KPriorityLow, "Low"); + +/** + * TMessageStatusFlag enum for status of message +*/ +enum TMessageStatusFlag + { + EUnread = 0, + EReplied, + EForward, + EDelete + }; + +/** + * TNotificationType enum for notification of new arrival of message +*/ +enum TNotificationType + { + ENewMessage = 0 + }; + +/** + * TMessageFilter enum is provided to filtering out search options +*/ +enum TMessageFilter + { + EFilterId = 0x1, + EFilterMtm = 0x2, + EFilterFrom = 0x4, + EFilterSubject = 0x8, + EFilterStartDate = 0x10, + EFilterEndDate = 0x20 + }; + +/** + * CFilterParamInfo Contains filter and sorting information required for getting header list +*/ +class CFilterParamInfo : public CBase + { + public: + + /** + * Two Phase Constructor + */ + IMPORT_C static CFilterParamInfo* NewL(); + + /** + * Destructor + */ + ~CFilterParamInfo(); + + /** + * Adds the sender address as a filter + * @param aFrom It is sender address + * @return void + */ + IMPORT_C void AddFromL( const TDesC& aFrom ); + + /** + * Gets the sender address list + * @return CDesCArray* + */ + IMPORT_C const CDesCArray* From() const ; + + /** + * Adds the mtm as a filter + * @param aMtm It is mtm type + * @return void + */ + IMPORT_C TInt AddMtmL( const TDesC& aMtm ); + + /** + * Gets the mtm list + * @return CDesCArray* + */ + IMPORT_C const CDesCArray* Mtm() const; + + /** + * Sets the subject filter + * @param aSubject It is the subject which user want to set as filter + * @return void + */ + IMPORT_C void SetSubjectL( const TDesC& aSubject ); + + /** + * Gets the subject filter + * @return TPtrC + */ + IMPORT_C TPtrC Subject() const; + + /** + * Sets the sorting order + * @param aSortType It could be { @c EMsvSortByNone , @c EMsvSortByDate ,@c EMsvSortByDateReverse , + @c EMsvSortBySize ,@c EMsvSortBySizeReverse, @c EMsvSortByDetails , + @c EMsvSortByDetailsReverse ,@c EMsvSortByDescription ,@c EMsvSortByDescriptionReverse , + @c EMsvSortById ,@c EMsvSortByIdReverse } defined in @c MSVSTD.H + * @return void + */ + IMPORT_C void SetSortType( const TMsvSorting aSortType ); + + /** + * Gets the sorting order + * @return TMsvSorting + */ + IMPORT_C TMsvSorting SortType() const; + + /** + * Sets the message id as filter + * @param aMessageId It is the message id which user want to set as filter + * @return void + */ + IMPORT_C void SetMessageIdFilter( const TMsvId aMessageId ); + + /** + * Gets the message id filter + * @return TMsvId + */ + IMPORT_C TMsvId MessageId() const; + + /** + * Sets the starting date for date range as a filter + * @param aStartDate It is the date to which we want + * to set as starting date for date range + * @return void + */ + IMPORT_C void SetStartDateFilter( const TTime& aStartDate ); + + /** + * Gets the starting date for date range as a filter + * @return TTime& + */ + IMPORT_C const TTime& StartDate() const; + + /** + * Sets the ending date for date range as a filter + * @param aEndDate It is the date to which we want + * to set as ending date for date range + * @return void + */ + IMPORT_C void SetEndDate( const TTime& aEndDate ); + + /** + * Gets the ending date for date range as a filter + * @return TTime& + */ + IMPORT_C const TTime& EndDate() const; + + /** + * Gives the iFilter + * @return TInt + */ + IMPORT_C TInt Filter() const; + + /** + * Resets the filterinfo object + * @return void + */ + IMPORT_C void Reset(); + + /** + * Assignment operator. + * @param aFilterParamInfo Item to assign. + * @return The source object. + */ + CFilterParamInfo& operator=(const CFilterParamInfo& aFilterParamInfo); + + private: + + /** + * Constructor + */ + CFilterParamInfo(); + + + private: + + /** + * Sender Array + */ + CDesCArray* iFromArray; + + /** + * Mtm Array + */ + CDesCArray* iMtmArray; + + /** + * Subject + */ + HBufC* iSubject; + + /** + * Sort type + */ + TMsvSorting iSortType; + + /** + * Message Id + */ + TMsvId iMessageId; + + /** + * Starting date of date range + */ + TTime iStartDate; + + /** + * End date of date range + */ + TTime iEndDate; + + /** + * Filter options + */ + TInt iFilter; + }; + + +/** + * CMessageAttachInfo Structure for attachment information +*/ +class CMessageAttachInfo : public CBase + { + public: + + /** + * Two Phase Constructor + */ + IMPORT_C static CMessageAttachInfo* NewL(); + + /** + * Destructor + */ + ~CMessageAttachInfo(); + + /** + * Sets the Attachment Name + * @param aName Attachment Name + * @return void + */ + IMPORT_C void SetNameL(const TDesC& aName); + + /** + * Gets the Attachment Name + * @return TPtrC Attachment Name + */ + IMPORT_C const TPtrC Name() const; + + /** + * Sets the File handle + * @param aFile File handle + * @return void + */ + IMPORT_C void SetFileHandle( RFile aFile); + + /** + * Gets the File handle + * @return RFile File handle + */ + IMPORT_C RFile FileHandle() const; + + /** + * Sets the File size + * @param aSize File size + * @return void + */ + IMPORT_C void SetSize( TInt32 aSize); + + /** + * Gets the File size + * @return File size + */ + IMPORT_C TInt32 Size() const; + + /** + * Sets the Mime type + * @param aMimeType Mime type + * @return void + */ + IMPORT_C void SetMimeTypeL(const TDesC& aMimeType); + + /** + * Gets the Mime type + * @return TPtrC Mime type + */ + IMPORT_C const TPtrC MimeType() const; + + + private: + + /** + * Constructor + */ + CMessageAttachInfo(); + + private: + + /** + * Attachment name + */ + HBufC* iName; + + /** + * File Handle for attachment + */ + RFile iFile; + + /** + * Size of attachment + */ + TInt32 iSize; + + /** + * Mimetype + */ + HBufC* iMimeType; + }; + +/** + * CMessageDetailInfo Structure for message detail information +*/ +class CMessageDetailInfo : public CBase + { + public: + + /** + * Two Phase Constructor + */ + IMPORT_C static CMessageDetailInfo* NewL(); + + /** + * Destructor + */ + ~CMessageDetailInfo(); + + /** + * Adds Recipient + * @param aRecipient recipient address + * @param aType recipient type + */ + IMPORT_C void AddRecipientL( const TDesC& aRecipient, + TMsvRecipientType aType = EMsvRecipientTo ); + + /** + * Gives the receipient array + * @return CRecipientList* + */ + IMPORT_C const CRecipientList* RecipientArray() const; + + /** + * Sets the sender address + * @param aFrom Sender address + * @return void + */ + IMPORT_C void SetFromL(const TDesC& aFrom); + + /** + * Gets the sender address + * @return TPtrC Sender address + */ + IMPORT_C const TPtrC From() const; + + /** + * Sets the body for message + * @param aMsg Body for message + */ + IMPORT_C void SetBodyTextL( const TDesC& aMsg ); + + /** + * Gets the body text + * @return TPtrC + */ + IMPORT_C const TPtrC BodyText() const; + + /** + * Sets the message id + * @param aMessageID Message ID + * @return void + */ + IMPORT_C void SetMessageId(const TMsvId aMessageID); + + /** + * Gets the message id + * @return TMsvId Message ID + */ + IMPORT_C TMsvId MessageId() const; + + /** + * Adds attachment + * @param aAttachment attachment information + */ + IMPORT_C void AddAttachmentInfoL( CMessageAttachInfo* aAttachment ); + + /** + * Gives the attachment array + * @return CArrayPtr* + */ + IMPORT_C const CArrayPtr* AttachmentInfoArray(); + + private: + + /** + * Constructor + */ + CMessageDetailInfo(); + + private: + + /** + * Message ID + */ + TMsvId iMessageId; + + /** + * Message Body text + */ + HBufC* iBodyText; + + /** + * Sender address + */ + HBufC* iFrom; + + /** + * Receipient List + */ + CRecipientList* iRecipientList; + + /** + * Array of Attachments + */ + CArrayPtr* iAttachEntries; + }; + +/** + * CSendMessageParams Contains parameters required for sending a message +*/ +class CSendMessageParams : public CBase + { + public: + + /** + * Two Phase Constructor + */ + IMPORT_C static CSendMessageParams* NewL(); + + /** + * Destructor + */ + ~CSendMessageParams(); + + /** + * Adds Recipient + * @param aRecipient recipient address + * @param aType recipient type + */ + IMPORT_C void AddRecipientL( const TDesC& aRecipient, + TMsvRecipientType aType = EMsvRecipientTo ); + + /** + * Gives the receipient array + * @return CRecipientList* + */ + IMPORT_C const CRecipientList* RecipientArray() const; + + /** + * Adds attachment + * @param aAttachment attachment information + */ + IMPORT_C void AddAttachmentL( CMsvAttachment* aAttachment ); + + /** + * Gives the attachment array + * @return CArrayPtr* + */ + IMPORT_C const CArrayPtr* AttachmentArray(); + + /** + * Sets the message subject + * @param aSubject Message Subject + */ + IMPORT_C void SetSubjectL( const TDesC& aSubject ); + + /** + * Gives message subject + * @return TPtrC + */ + IMPORT_C const TPtrC Subject() const; + + /** + * Sets the body for message + * @param aMsg Body for message + */ + IMPORT_C void SetBodyTextL( const TDesC& aMsg ); + + /** + * Appends the message to the existing bodytext + * @param aMsg Body for message + */ + void AppendBodyTextL( const TDesC& aMsg ); + + /** + * Gets the body text + * @return TPtrC + */ + IMPORT_C const TPtrC BodyText() const; + + /** + * Sets the templateid + * @param aTemplateId template id + */ + IMPORT_C void SetTemplateId( const TMsvId aTemplateId ); + + /** + * Gets the template id + * @return TMsvId + */ + IMPORT_C TMsvId TemplateId() const; + + /** + * Sets paramter to launch editor depends on argument value + * if ETrue then launches editor or if EFalse the don't launch editor. + * @param aLaunchEditor Boolean param + */ + IMPORT_C void SetLaunchEditor( const TBool aLaunchEditor = ETrue ); + + /** + * Gets the LaunchEditor value + * @return TBool + */ + IMPORT_C TBool LaunchEditor() const; + + /** + * Sets the message type + * @param aMessageType Describing message type (SMS/MMS) + */ + IMPORT_C TInt SetMessageTypeL( const TDesC& aMessageType ); + + /** + * Gets the messagetype + * @return TUid + */ + IMPORT_C TUid MessageType() const; + + /** + * Assignment operator. + * @param aSendMessageParams Item to assign. + * @return The source object. + */ + CSendMessageParams& operator=(const CSendMessageParams& aSendMessageParams); + + private: + + /** + * Constructor + */ + CSendMessageParams(); + + private: + + /** + * Message Type + */ + TUid iMessageType; + + /** + * Template id + */ + TMsvId iTemplateId; + + /** + * Receipient Array + */ + CRecipientList* iRecipientArray; + + /** + * Attachment Array + */ + CArrayPtr* iAttachmentArray; + + /** + * Subject of message + */ + HBufC* iSubject; + + /** + * Bpodytext + */ + HBufC* iBodyText; + + /** + * Launch editor variable + */ + TBool iLaunchEditor; + }; + +/** + * Contains recipients information +*/ +class CRecipientList : public CBase +{ + public: + + /** + * Two-phased constructor. + * @return CRecipientList* + */ + IMPORT_C static CRecipientList* CRecipientList::NewL(); + + /** + * Destructor. + */ + ~CRecipientList(); + + /** + * Appends the recipient type + * @param aValue Recipient Type + * @param aPtr recipient address + * @return void + */ + IMPORT_C void AppendL(TMsvRecipientType aType, const TDesC& aRecipient); + + /** + * Gives the number of elements in recipient list + * @return TInt + */ + IMPORT_C TInt Count() const; + + /** + * Gives the recipient type + * @param aPos position + * @return TMsvRecipientType + */ + IMPORT_C TMsvRecipientType Type(TInt aPos) const; + + /** + * Gives the recipient address + * @param aIndex index + * @return TDesC recipient address + */ + IMPORT_C const TDesC& operator[](TInt aIndex) const; + + /** + * Resets the recipient list + * @return void + */ + IMPORT_C void Reset(); + + private: + + /** + * Symbian Constructor. + */ + void ConstructL(); + + /** + * Constructor + */ + CRecipientList(); + + + private: + + /** + * Recipient type + */ + RArray iRecipientType; + + /** + * Recipients + */ + CDesCArrayFlat* iRecipients; +}; + +/** + * Gives Message header +*/ +class CMessageHeader : public CBase + { + public: + + /** + * Two-phased constructor. + * @return CMessageHeader* + */ + IMPORT_C static CMessageHeader* NewL(); + + /** + * Destructor. + */ + virtual ~CMessageHeader(); + + private: + + /** + * Symbain constructor. + */ + CMessageHeader(); + + public: + + /** + * Sets the unread flag + * @param aUnread unread flag + * @return void + */ + IMPORT_C void SetUnreadFlag(const TBool aUnread); + + /** + * Gets the unread flag + * @param aUnead Unread flag + * @return void + */ + IMPORT_C void GetUnreadFlag(TBool& aUnread) const; + + /** + * Gets the unread flag + * @return TBool unread flag + */ + IMPORT_C TBool UnreadFlag() const; + + /** + * Sets the attahment flag + * @param aAttachment Attachment flag + * @return void + */ + IMPORT_C void SetAttachFlag(const TBool aAttachment); + + /** + * Gets the attachment flag + * @param aAttachment Attachment flag + * @return void + */ + IMPORT_C void GetAttachFlag(TBool& aAttachment) const; + + /** + * Gets the Attachment flag + * @return TBool Attachment flag + */ + IMPORT_C TBool AttachFlag() const; + + /** + * Sets the priority flag + * @param aPriority Priority flag + * @return void + */ + IMPORT_C void SetPriorityFlag(const TMsvPriority aPriority); + + /** + * Gets the priority flag + * @param aPriority Priority flag + * @return void + */ + IMPORT_C void GetPriorityFlag(TMsvPriority& aPriority) const; + + /** + * Gets the priority + * @return TPtrC Priority + */ + IMPORT_C TPtrC Priority() const; + + /** + * Sets the mtm type + * @param aMtm Mtm id + * @return void + */ + IMPORT_C void SetMtmId(const TUid aMtm); + + /** + * Gets the mtm type + * @param aMtm Mtm id + * @return void + */ + IMPORT_C void GetMtmId(TUid& aMtm) const; + + /** + * Gets the mtm type + * @return TPtrC Message Type + */ + IMPORT_C TPtrC Mtm() const; + + /** + * Sets the message id + * @param aMessageID Message ID + * @return void + */ + IMPORT_C void SetMessageId(const TMsvId aMessageID); + + /** + * Gets the message id + * @param aMessageID Message ID + * @return void + */ + IMPORT_C void GetMessageId(TMsvId& aMessageID) const; + + /** + * Gets the message id + * @return TMsvId Message ID + */ + IMPORT_C TMsvId MessageId() const; + + /** + * Sets the time + * @param aTime Time + * @return void + */ + IMPORT_C void SetTime(const TTime& aTime); + + /** + * Gets the time + * @param aTime Time + * @return void + */ + IMPORT_C void GetTime(TTime& aTime) const; + + /** + * Gets the time + * @return TTime + */ + IMPORT_C const TTime& Time() const; + + /** + * Sets the sender address + * @param aFrom Sender address + * @return void + */ + IMPORT_C void SetFromL(const TDesC& aFrom); + + /** + * Gets the sender address + * @return TPtrC Sender address + */ + IMPORT_C const TPtrC From() const; + + /** + * Sets the message subject + * @param aSubject Subject of message + * @return void + */ + IMPORT_C void SetSubjectL(const TDesC& aSubject); + + /** + * Gets the message + * @return TPtrC Subject of message + */ + IMPORT_C const TPtrC Subject() const; + + private: + + /** + * Unread flag + */ + TBool iUnread; + + /** + * Attachment flag + */ + TBool iAttachment; + + /** + * Priority + */ + TMsvPriority iPriority; + + /** + * Priority as string + */ + HBufC* iPriAsString; + + /** + * Mtm + */ + TUid iMtm; + + /** + * Mtm + */ + HBufC* iMtmAsString; + + /** + * Message subject + */ + HBufC* iSubject; + + /** + * Address of sender + */ + HBufC* iFrom; + + /** + * Time + */ + TTime iTime; + + /** + * Entry id of message + */ + TMsvId iMessageID; + }; + +/** + * Messaging Callback base class +*/ +class CMsgCallbackBase : public CBase + { + public: + + /** + * Gives the result + * @param aErrCode Error code + * @param aResult Result + * @return void + */ + virtual void NotifyResultL(TInt aErrCode, TAny* aResult) = 0; + + /** + * Input param + */ + const TAny* iPtrInParamList; + + /** + * Callback + */ + TAny* iPtrNotifyCallback; + + /** + * Transaction Id + */ + TInt32 iTransactionId; + }; + +/** + * Interface used to get callback notification from async request module + * about completion of request. Implemented by the CMessagingService class, + * which is used by the service modules to notify about request completion. +*/ +class MAsyncRequestObserver + { + public: + + /** + * Notifies Messaging service about the completeion of the request + * @param aTransactionId Asynchronous request transaction ID + * @return void + */ + virtual void RequestComplete( TInt32 aTransactionId ) = 0; + }; + + +/** + * Structure for storing transaction id and associated active object. +*/ +struct TAsyncRequestInfo + { + + /** + * TransactionId + */ + TInt32 iTransactionId; + + /** + * Active object pointer + */ + CActive* iAsyncObj; + }; + + + +#endif __MESSAGEHEADER_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagenotify.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagenotify.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,117 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 __MESSAGENOTIFY_H +#define __MESSAGENOTIFY_H + +class CMsgCallbackBase; +class CMessageHeader; + +#include + +/** + *This class implements MessageNotify SAPI core logic.It includes + * methods for notification of new messages. + * + */ +class CMessageObserver : public CBase, public MMsvSessionObserver + { + public: + + /** + * Two-phased constructor. + * @param CMsvSession* a message server session. + * @param CMsgCallbackBase* + */ + static CMessageObserver* NewL( CMsvSession* aSession = NULL, + CMsgCallbackBase* aNotifyCallback = NULL ); + + /** + * Destructor. + */ + virtual ~CMessageObserver(); + + /** + * Inherited from MMsvSessionObserver class + */ + virtual void HandleSessionEventL( TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, + TAny* aArg3 ); + + /** + * Sets the message server session + * @param aSession It is a message server session. + */ + void SetSession( CMsvSession* aSession ); + + /** + * Sets the callback object + * @param aCallback It is callback object to be registered + * @return Old callback object + */ + CMsgCallbackBase* SetCallback( CMsgCallbackBase* aCallback ); + + /** + * Checks if Notification is activated + * + * @return True if notification request is active. + */ + TBool IsActive(); + + private: + + /** + * Default constructor. + * @param aSession It is an object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread . + * @param aNotifyCallback It is a callback notification + */ + CMessageObserver( CMsvSession* aSession, CMsgCallbackBase* aNotifyCallback ); + + /** + * Sets the message header fields + * @param aMessageId It is the ID of message whose header fields are to be set + */ + CMessageHeader* MessageHeaderL( TMsvId aMessageId ); + + private: + + /** + * Message server session + * Not own. + */ + CMsvSession* iServerSession; + + /** + * Callback Object + * Not own. + */ + CMsgCallbackBase* iNotifyCallback; + + /** + * Message ID + */ + TMsvId iNewMessageId; + }; + + + +#endif __MESSAGENOTIFY_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagingservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagingservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,190 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 __MESSAGINGSERVICE_H +#define __MESSAGINGSERVICE_H + +#include "messageheader.h" + +class CMessageObserver; + + +/** + * Messaging Service class +*/ +class CMessagingService : public CBase, public MAsyncRequestObserver + { + public: + + /** + * Two Phase Constructor + */ + IMPORT_C static CMessagingService* NewL(); + + /** + * Destructor + */ + virtual ~CMessagingService(); + + private: + + /** + * Constructor + */ + CMessagingService(); + + /** + * Constructor + */ + void ConstructL(); + + /** + * Adds asynchronous request object + * @param aTransactionId Transcation Id os Async object + * @param aAsyncObj Async object + */ + void AddAsyncObjL( const TInt32 aTransactionId, CActive* aAsyncObj ); + + /** + * Deletes all the Asynchronous request objects + */ + void DeleteAsyncObjects(); + + public: + + /** + * Sends Message + * @param aMessageParam Structure containing details about the message + * which is being send + * @param aCallback CallBack object for asynchronous operation + */ + IMPORT_C void SendMessageL( CSendMessageParams* aMessageParam, + CMsgCallbackBase* aCallback = NULL ); + + /** + * Deletes Message + * @param aMessageId Message Id of message which is to be deleted + * @param aCallback CallBack object for asynchronous operation + */ + IMPORT_C void DeleteMessageL( const TMsvId aMessageId, + CMsgCallbackBase* aCallback = NULL ); + + /** + * Changes Status + * @param aMessageId Message Id of message which is to be deleted + * @param aStatusFlag Status flag + * @param aFlagValue Flag value + * @param aCallback CallBack object for asynchronous operation + */ + IMPORT_C void ChangeStatusL( const TMsvId aMessageId, + const TMessageStatusFlag aStatusFlag, + const TBool aFlagValue, + CMsgCallbackBase* aCallback = NULL ); + + /** + * Gives notification + * @param aNotification Notification type + * @param aCallback CallBack object for asynchronous operation + */ + IMPORT_C TInt RequestNotification( const TNotificationType aNotification, + CMsgCallbackBase* aCallback ); + + /** + * Cancels notification + * @param aNotification Notification type + * @param aCallback CallBack object for asynchronous operation + */ + IMPORT_C TInt CancelNotification( const TNotificationType aNotification, + CMsgCallbackBase* aCallback = NULL ); + + + /** + * Gives list of message ids + * @param aFilterParams Filter parameters + * @param aFolderId Folder to be used (Inbox/outbox/send/...) + * @param aCallback CallBack object for asynchronous operation + * @param aEntrySelection output pararmeter for the result id array + */ + IMPORT_C void GetIdListL( CFilterParamInfo* aFilterParams, + TMsvId aFolderId, + CMsgCallbackBase* /*aCallback*/, + CMsvEntrySelection*& aEntrySelection ); + + /** + * Gives next header based on inputs + * @param aFilterParams Filter parameters + * @param aEntrySelection array of message ids on which filteration to be done + * @param aIndex starting position on aEntrySelection to be start search + * @param aCallback CallBack object for asynchronous operation + * @param aHeader output pararmeter for the result header + */ + IMPORT_C void GetNextHeaderL( CFilterParamInfo* aFilterParams, + CMsvEntrySelection* aEntrySelection, + TInt& aIndex, + CMsgCallbackBase* /*aCallback*/, + CMessageHeader*& aHeader ); + /** + * Gives message details + * @param aMessageId Message id + * @param aCallback CallBack object for asynchronous operation + * @param aResult Output parameter containing requested message details + */ + IMPORT_C void GetMessageDetailL( const TMsvId aMessageId, + CMsgCallbackBase* aCallback, + CMessageDetailInfo*& aResult ); + + /** + * Cancels asynchronous request + * @param aTransactionId asynchronous transaction id + * @param aResult error code + */ + IMPORT_C TInt Cancel( const TInt32 aTransactionId ); + + + //MAsyncRequestObserver drived + public: + + /** + * Notifies Messaging service about the completeion of the request + * @param aTransactionId TransactionId of Asynchronous request object + * @return void + */ + void RequestComplete( const TInt32 aTransactionId ); + + private: + + /** + * Represents a channel of communication between a client thread + * and the Message Server thread. + */ + CMsvSession* iMsgServerSession; + + /** + * Provides the interface for notification of events from a Message Server session. + */ + CMessageObserver* iSessionObserver; + + /** + * Contains handles of all asynchronous requests + */ + RArray iAsyncObjArray; + }; + + +#endif __MESSAGINGSERVICE_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/sendmessage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/sendmessage.h Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,221 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 __SENDMESSAGE_H +#define __SENDMESSAGE_H + +#include +#include + +class CMsvAttachment; +class CRecipientList; +class CMsgCallbackBase; + +/** + * This class provides functionality for sending SMS/MMS messages. +*/ +class CSendMessage : public CActive + { + + /** + * TMessageState enum represents the message states for asynchronous requests. + */ + enum TMessageState + { + EInitialize = 0, + EValidate, + ESend, + EComplete + }; + + + public: + + /** + * Two-phased constructor. + * @param aServerSession Object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread. + * @return CSendMessage object + */ + static CSendMessage* NewL( CMsvSession& aServerSession ); + + /** + * Destructor. + */ + virtual ~CSendMessage(); + + + private: + + /** + * Constructor. + * @param aServerSession Object of CMsvSession Class which + * represents a channel of communication between a client thread + * and the Message Server thread . + */ + CSendMessage( CMsvSession& aServerSession ); + + + public: + + /** + * Sets message input parameters + * Ownership is transferred to this class + * @param aMessageParam Message Input Parameters + * @param aTemplateDetail + * @param aNotifyCallback Bydefault it is NULL to make function + * call synchronous , if provided then function call is asynchronous + * @param aAsyncRequestObserver Asynchronous request observer + */ + void SetInputParamsL( CSendMessageParams* aMessageParam, + CMessageDetailInfo* aTemplateDetail = NULL, + CMsgCallbackBase* aNotifyCallback = NULL, + MAsyncRequestObserver* aAsyncRequestObserver = NULL); + + /** + * Sends the message + */ + void SendMessageL(); + + private: + + /** + * Inherited from CActive class + */ + virtual void DoCancel(); + + /** + * Inherited from CActive class + */ + virtual void RunL(); + + /** + * Internal function + */ + void InitializeL(); + + /** + * Internal function + */ + void ValidateL(); + + /** + * Internal function + */ + void SendL(); + + /** + * Activates the request and call SetActive() function + */ + void ActivateRequest(TInt aReason); + + /** + * Gives the result for notification request. + */ + void NotifyRequestResult(TInt aReason); + + /** + * Sets the subject for message + */ + void AddSubjectL(); + + /** + * Sets the recipient address + */ + void AddRecipientL(); + + /** + * Sets body text to message + */ + void AddBodyTextL(); + + /** + * Adds attachments to message + */ + void AddAttachmentL(); + + private: + + /** + * Represents a channel of communication between a client thread + * and the Message Server thread + */ + CMsvSession& iServerSession; + + /** + * Asynchronous request observer, Used to get infromed of completion or request + */ + MAsyncRequestObserver* iAsyncRequestObserver; + + /** + * Represents a session with the SendAs Server + */ + RSendAs iSendAs; + + /** + * RSendAsMessage class object which encapsulates creating and + * sending a message. + */ + RSendAsMessage iMessage; + + /** + * State of message + */ + TMessageState iMessageState; + + /** + * A callback notification for asynchronous function + */ + CMsgCallbackBase* iNotifyCallback; + + /** + * Message input parameters + */ + CSendMessageParams* iMessageParam; + + /** + * Message detail for template message id + */ + CMessageDetailInfo* iTemplateDetail; + + /** + * Flag which specifies to cancel the request + * but not to call the NotifyResultL + * If false doesnot call the NotifyResultL + **/ + TBool iCallNotifyForCancelFlag; + + /* + * Flag information specifying whether the body text file + * in case of MMS is created or not, if created need to be + * cleaned up checking this flag at the end + */ + TBool iBodyTextFileFlag; + + /* + * FileName of the Body Text file used in case of MMS + */ + TFileName iBodyTextFileName; + }; + + + + +#endif __SENDMESSAGE_H \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/init/testframework.ini Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,161 @@ +# +# This is STIFTestFramework 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'. +# +# - 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. + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: + # 'Summary', 'Environment', 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +[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= YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= NormalCases.txt +# TestCaseFile= SmokeCases.txt +# TestCaseFile= 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 +IniFile= c:\testframework\TestFramework.ini +TestCaseFile= c:\testframework\get_message_async.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIFTestFramework 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. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' + +#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 + +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/src/get_message_async.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/src/get_message_async.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,199 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 FILES +#include +#include "get_message_async.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 =============================== + +// ----------------------------------------------------------------------------- +// Cget_message_async::Cget_message_async +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +Cget_message_async::Cget_message_async( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// Cget_message_async::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void Cget_message_async::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(Kget_message_asyncLogFileWithTitle, &title); + } + else + { + logFileName.Copy(Kget_message_asyncLogFile); + }*/ + + iLog = CStifLogger::NewL( Kget_message_asyncLogPath, + Kget_message_asyncLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + //SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// Cget_message_async::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +Cget_message_async* Cget_message_async::NewL( + CTestModuleIf& aTestModuleIf ) + { + Cget_message_async* self = new (ELeave) Cget_message_async( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +Cget_message_async::~Cget_message_async() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// Cget_message_async::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void Cget_message_async::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("get_message_async.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* ) Cget_message_async::NewL( aTestModuleIf ); + + } + + +// End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/src/get_message_asyncBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/src/get_message_asyncBlocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -0,0 +1,668 @@ +/* +* 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 the License "Eclipse Public License v1.0" +* which accompanies 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 FILES] - do not remove +#include +#include +#include +#include +#include +#include "get_message_async.h" +#include "messagingservice.h" +#include "messageheader.h" +#include "async.h" + +// 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 =============================== + +TInt iResult; +TInt iPosneg; + +TInt Cget_message_async::messageid_func(CStifItemParser& aItem,TInt& id) + { + TInt err = aItem.GetNextInt(id); + if(err) + { + ////iLog->Log(_L("Failed to Get message id")); + return KErrGeneral; + }; + return KErrNone; + } + +TInt Cget_message_async::fromarray_func(CStifItemParser& aItem,TPtrC& fromarray) + { + TInt err = aItem.GetNextString(fromarray); + if(err) + { + //iLog->Log(_L("Failed to Get from array")); + return KErrGeneral; + }; + return KErrNone; + } + +TInt Cget_message_async::subject_func(CStifItemParser& aItem,TPtrC& subj) + { + TInt err = aItem.GetNextString(subj); + if(err) + { + //iLog->Log(_L("Failed to Get subject")); + return KErrGeneral; + }; + return KErrNone; + } + +TInt Cget_message_async::sort_func(CStifItemParser& aItem,TInt& sorttype) + { + TInt err = aItem.GetNextInt(sorttype); + if(err) + { + //iLog->Log(_L("Failed to Get sort type")); + return KErrGeneral; + }; + return KErrNone; + } + +TInt Cget_message_async::mtm_func(CStifItemParser& aItem,TPtrC& mtmtype) + { + TInt err = aItem.GetNextString(mtmtype); + if(err) + { + //iLog->Log(_L("Failed to Get mtm type")); + return KErrGeneral; + }; + return KErrNone; + } + +TInt Cget_message_async::flag_func(CStifItemParser& aItem,TInt& flag) + { + TInt err = aItem.GetNextInt(flag); + if(err) + { + //iLog->Log(_L("Failed to Get date flag or err code")); + return KErrGeneral; + }; + return KErrNone; + } + +TInt Cget_message_async::date_func(CStifItemParser& aItem,TInt& year,TInt& month,TInt& day,TInt& hour,TInt& min,TInt& sec,TInt& microsec) + { + + TInt err = aItem.GetNextInt(year); + if(err) + { + //iLog->Log(_L("Failed to Get year")); + return KErrGeneral; + }; + + err = aItem.GetNextInt(month); + if(err) + { + //iLog->Log(_L("Failed to Get month")); + return KErrGeneral; + }; + + err = aItem.GetNextInt(day); + if(err) + { + //iLog->Log(_L("Failed to Get day")); + return KErrGeneral; + }; + + err = aItem.GetNextInt(hour); + if(err) + { + //iLog->Log(_L("Failed to Get hour")); + return KErrGeneral; + }; + + err = aItem.GetNextInt(min); + if(err) + { + //iLog->Log(_L("Failed to Get min")); + return KErrGeneral; + }; + + err = aItem.GetNextInt(sec); + if(err) + { + //iLog->Log(_L("Failed to Get sec")); + return KErrGeneral; + }; + + err = aItem.GetNextInt(microsec); + if(err) + { + //iLog->Log(_L("Failed to Get microsec")); + return KErrGeneral; + }; + return KErrNone; + } + + TInt Cget_message_async::getsub_func(CStifItemParser& aItem,TPtrC& sub) + { + TInt err = aItem.GetNextString(sub); + if(err) + { + //iLog->Log(_L("Failed to Get message subject to verify")); + return KErrGeneral; + }; + return KErrNone; + } + + TInt Cget_message_async::posneg_func(CStifItemParser& aItem,TInt& posneg) + { + TInt err = aItem.GetNextInt(posneg); + if(err) + { + //iLog->Log(_L("Failed to Get date flag or err code")); + return KErrGeneral; + }; + return KErrNone; + } + + void CMsgCallbackHeader::NotifyResultL( TInt aErrCode, TAny* aResult ) + { + + } + + void CMsgCallbackHeader::HandleGetlistL( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) + { + TInt err=aErrCode; + Cheader_test* test2 = Cheader_test::NewL(); + CFilterParamInfo* f=aFilter; + CMsvEntrySelection* e=aEntrySelection; + TInt index=0; + CMessageHeader* header = NULL; + TInt checkposneg = test2->getposneg(); + iservice->GetNextHeaderL(f, e, index, NULL, header); + if(!iPosneg) + { + if(header) + iResult=KErrGeneral; + else + iResult=KErrNone; + } + + else if(aErrCode==KErrNone) + iResult=KErrNone; + else + iResult=KErrNone; + delete header; + delete test2; + delete f; + delete e; + + iWaitSchedular->AsyncStop(); + } + + CMsgCallbackHeader* CMsgCallbackHeader::NewL(CActiveSchedulerWait* aWaitSchedular, CMessagingService* s) + { + CMsgCallbackHeader* self = new (ELeave) CMsgCallbackHeader(aWaitSchedular, s); + return self; + } + + + Cheader_test* Cheader_test::NewL() + { + Cheader_test* self = new(ELeave)Cheader_test(); + self->ConstructL(); + return self; + } + + + Cheader_test::~Cheader_test() + { + Cancel(); + + if(iWaitSchedular->IsStarted()) + iWaitSchedular->AsyncStop(); + + if(iMessagingService) + delete iMessagingService; + + if(iWaitSchedular) + delete iWaitSchedular; + } + + + void Cheader_test::ConstructL() + { + CActiveScheduler::Add(this); + iMessagingService = CMessagingService::NewL(); + iWaitSchedular = new(ELeave) CActiveSchedulerWait(); + } + + + Cheader_test::Cheader_test() : + CActive(EPriorityStandard) + { + } + + + void Cheader_test::DoCancel() + { + + } + + + void Cheader_test::RunL() + { + TestFunc(); + } + + + void Cheader_test::Start() + { + iCallBack = CMsgCallbackHeader::NewL(iWaitSchedular, iMessagingService); + SetActive(); + TRequestStatus* temp = &iStatus; + User::RequestComplete(temp, KErrNone); + iWaitSchedular->Start(); + } + + + + void Cheader_test::set(CFilterParamInfo* pi) + { + v = pi; + } + + void Cheader_test::setposneg(TInt aFlag) + { + posnegflag = aFlag; + } + + CFilterParamInfo* Cheader_test::get(void) + { + return v; + } + + TInt Cheader_test::getposneg(void) + { + return posnegflag; + } + /*void Cheader_test::HandleGetlistL(TInt aErrCode, CMsvEntrySelection* aEntryselection,CFilterParamInfo* aFilterParams) + { + + iResult=KErrNone; + iWaitSchedular->AsyncStop(); + } + void Cheader_test::NotifyResultL(TInt aErrCode,TAny* aResult) + { + + }*/ + + int memorycleanflag = 0; + + void Cheader_test::TestFunc() + { + + CFilterParamInfo* arg = get(); + CMsvEntrySelection* en = NULL; + + TRAPD(err, iMessagingService->GetIdListL(arg ,0,iCallBack,en)); + + if(err!=0) + { + memorycleanflag = 1; + iResult = KErrNone; + iWaitSchedular->AsyncStop(); + } + delete arg; + } + + + + +// ----------------------------------------------------------------------------- +// Cget_message_async::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void Cget_message_async::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// Cget_message_async::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt Cget_message_async::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", Cget_message_async::ExampleL ), + ENTRY( "test_1",Cget_message_async::Test1L) + //ADD NEW ENTRY HERE + // [test cases entries] - Do not remove + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// Cget_message_async::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt Cget_message_async::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( Kget_message_async, "get_message_async" ); + _LIT( KExample, "In Example" ); + TestModuleIf().Printf( 0, Kget_message_async, 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, Kget_message_async, + KParam, i, &string ); + i++; + } + + return KErrNone; + + } + +// ----------------------------------------------------------------------------- +// Cget_message_async::?member_function +// ?implementation_description +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// + +TInt Cget_message_async::Test1L( CStifItemParser& aItem ) + { + + + + TInt id,sorttype,flag,year,month,day,hour,min,sec,microsec,posneg; + TPtrC subj,mtmtype,fromarray; + bool test = TRUE; + __UHEAP_MARK; + CFilterParamInfo* filter = CFilterParamInfo::NewL(); + + + TInt err1 = messageid_func(aItem,id); + if(err1) + { + return KErrGeneral; + } + + if(id == 1) + { + CMessagingService* mservice = (CMessagingService*)CMessagingService::NewL(); + CleanupStack::PushL(mservice); + CFilterParamInfo* mfilter = CFilterParamInfo::NewL(); + CMsvEntrySelection* marray = NULL ; + TRAPD(err,mservice->GetIdListL(mfilter,0,NULL ,marray)); + TInt index = 0; + CMessageHeader* headerarr = NULL; + mservice->GetNextHeaderL(mfilter, marray, index, NULL, headerarr); + TMsvId message_id; + headerarr->GetMessageId(message_id); + filter->SetMessageIdFilter(message_id); + delete headerarr; + delete marray; + delete mfilter; + CleanupStack::PopAndDestroy(mservice); + } + else if(id == 0) + { + filter->SetMessageIdFilter(NULL); + } + else + { + TMsvId iD = id; + filter->SetMessageIdFilter(iD); // message id filter + } + + + err1 = fromarray_func(aItem,fromarray); + if(err1) + { + return KErrGeneral; + } + + _LIT(Knull,"NULL"); + if(fromarray.CompareF(Knull)) + { + _LIT(Kaddr,"AddrEnd"); + while(fromarray != Kaddr) + { + filter->AddFromL(fromarray); // from address filter + err1 = fromarray_func(aItem,fromarray); + if(err1) + { + return KErrGeneral; + } + } + } + else + { + // filter->AddFromL(NULL); + } + + + + + err1 = subject_func(aItem,subj); + if(err1) + { + return KErrGeneral; + } + if(subj.CompareF(Knull)) + { + filter->SetSubjectL(subj); // subject filter + } + else + { + // filter->SetSubjectL(NULL); + } + + + + err1 = sort_func(aItem,sorttype); + if(err1) + { + return KErrGeneral; + } + + TMsvSorting sort= (TMsvSorting)sorttype ; + filter->SetSortType(sort) ; // sort filter + + + + + err1 = mtm_func(aItem,mtmtype); + if(err1) + { + return KErrGeneral; + } + + if(mtmtype.CompareF(Knull)) + { + _LIT(Kmt,"MtmEnd"); + while(mtmtype != Kmt) + { + if( filter->AddMtmL(mtmtype) == KErrNone ) //code changed by Venkat + { + err1 = mtm_func(aItem,mtmtype); + if(err1) + { + return KErrGeneral; + } + }// message type filter + else + { + delete filter; + return KErrNone; + } + } + } + else + { + // filter.iMtmArray(NULL); + } + + + + + err1 = flag_func(aItem,flag); // start date as a filter(1) or not(0) + if(err1) + { + return KErrGeneral; + } + + if(flag) + { + err1 = date_func(aItem,year,month,day,hour,min,sec,microsec); + if(err1) + { + return KErrGeneral; + } + TDateTime start(year,(TMonth)month,day,hour,min,sec,microsec); + TTime startdate(start); + filter->SetStartDateFilter(startdate); // start date filter + } + else + { + // filter->SetStartDateFilter(NULL) ; + } + + + + + err1 = flag_func(aItem,flag); // end date as a filter(1) or not(0) + if(err1) + { + return KErrGeneral; + } + + if(flag) + { + err1 = date_func(aItem,year,month,day,hour,min,sec,microsec); + if(err1) + { + return KErrGeneral; + } + + TDateTime end(year,(TMonth)month,day,hour,min,sec,microsec); + TTime enddate(end) ; + filter->SetEndDate(enddate) ; // end date filter + } + else + { + // filter->SetEndDate(NULL) ; + } + err1=posneg_func(aItem,posneg); + if(err1) + { + return KErrGeneral; + } + iPosneg=posneg; + Cheader_test* test1 = Cheader_test::NewL(); + + test1->set(filter); + test1->setposneg(posneg); + test1->Start(); + delete test1; + __UHEAP_MARKEND; + return iResult; + + } +/* +TInt Cget_message_async::?member_function( + CItemParser& aItem ) + { + + ?code + + } +*/ + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/inc/sysinfoaiwparams.hrh --- a/serviceproviders/sapi_sysinfo/inc/sysinfoaiwparams.hrh Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/inc/sysinfoaiwparams.hrh Thu Aug 27 07:43:07 2009 +0300 @@ -15,7 +15,6 @@ * */ - #ifndef __SYSINFO_AIWPARAMS_HRH_ #define __SYSINFO_AIWPARAMS_HRH_ @@ -142,6 +141,10 @@ // DriveList identifier // _LIT8(KDriveList,"DriveList"); + +_LIT8(KCamResList,"ResolutionList"); + +_LIT8(KCamMimeTypesList,"MimeTypeList"); } #endif //__SYSINFO_AIWPARAMS_HRH_ \ No newline at end of file diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/src/sysinfointerface.cpp --- a/serviceproviders/sapi_sysinfo/src/sysinfointerface.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/src/sysinfointerface.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -845,6 +845,37 @@ CleanupStack::PopAndDestroy(stringlist); } break; + case CSysData::ECameraInfo: + { + CLiwList* camResList = CLiwDefaultList::NewL(); + CleanupClosePushL( *camResList ); + CLiwList* camMimeTypesList = CLiwDefaultList::NewL(); + CleanupClosePushL( *camMimeTypesList ); + const CCameraInfo* camInfo = ((CCameraInfo*) aInSysData); + count = camInfo->ResolutionList()->Count(); + + for ( int index=0; indexResolutionList()->At( index, 0, val ); + resMap->InsertL( KXPixels, (TInt32)val ); + camInfo->ResolutionList()->At( index, 1, val ); + resMap->InsertL( KYPixels, (TInt32)val ); + camResList->AppendL( resMap ); + CleanupStack::Pop( resMap ); + resMap->Close(); + TPtrC string; + camInfo->MimeTypesList()->At( index, string ); + camMimeTypesList->AppendL( string ); + } + aOutMapParam->InsertL( KCamResList, camResList ); + aOutMapParam->InsertL( KCamMimeTypesList, camMimeTypesList ); + CleanupStack::PopAndDestroy( camMimeTypesList ); + CleanupStack::PopAndDestroy( camResList ); + } + break; default: User::Leave(KErrArgument); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/bwins/sysinfoserviceu.def --- a/serviceproviders/sapi_sysinfo/sysinfoservice/bwins/sysinfoserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/bwins/sysinfoserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -55,4 +55,9 @@ ?ValidLocationAreaCode@CNetworkInfo@@QBEHXZ @ 54 NONAME ; int CNetworkInfo::ValidLocationAreaCode(void) const ?XPixels@CResolution@@QBEHXZ @ 55 NONAME ; int CResolution::XPixels(void) const ?YPixels@CResolution@@QBEHXZ @ 56 NONAME ; int CResolution::YPixels(void) const + ??ACCameraResolutionList@@QBEPBVCResolution@@H@Z @ 57 NONAME ; class CResolution const * CCameraResolutionList::operator[](int) const + ?At@CCameraResolutionList@@QBEHHHAAH@Z @ 58 NONAME ; int CCameraResolutionList::At(int, int, int &) const + ?Count@CCameraResolutionList@@QBEHXZ @ 59 NONAME ; int CCameraResolutionList::Count(void) const + ?MimeTypesList@CCameraInfo@@QBEPAVCStringList@@XZ @ 60 NONAME ; class CStringList * CCameraInfo::MimeTypesList(void) const + ?ResolutionList@CCameraInfo@@QBEPAVCCameraResolutionList@@XZ @ 61 NONAME ; class CCameraResolutionList * CCameraInfo::ResolutionList(void) const diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/eabi/sysinfoserviceu.def --- a/serviceproviders/sapi_sysinfo/sysinfoservice/eabi/sysinfoserviceu.def Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/eabi/sysinfoserviceu.def Thu Aug 27 07:43:07 2009 +0300 @@ -55,4 +55,9 @@ _ZNK8CVersion12MajorVersionEv @ 54 NONAME _ZNK8CVersion12MinorVersionEv @ 55 NONAME _ZNK15CConnectionInfo15ConnectionStateEv @ 56 NONAME + _ZNK11CCameraInfo13MimeTypesListEv @ 57 NONAME + _ZNK11CCameraInfo14ResolutionListEv @ 58 NONAME + _ZNK21CCameraResolutionList2AtEiiRi @ 59 NONAME + _ZNK21CCameraResolutionList5CountEv @ 60 NONAME + _ZNK21CCameraResolutionListixEi @ 61 NONAME diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/group/sysinfoservice.mmp --- a/serviceproviders/sapi_sysinfo/sysinfoservice/group/sysinfoservice.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/group/sysinfoservice.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -64,6 +64,9 @@ LIBRARY btengsettings.lib LIBRARY aknswallpaperutils.lib LIBRARY PlatformEnv.lib +LIBRARY ImagingConfigManager.lib +LIBRARY Avkon.lib // PhoneLanguage +LIBRARY estlib.lib //strlen function paged diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/inc/entitykeys.h --- a/serviceproviders/sapi_sysinfo/sysinfoservice/inc/entitykeys.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/inc/entitykeys.h Thu Aug 27 07:43:07 2009 +0300 @@ -29,6 +29,7 @@ _LIT(KDisplay, "Display"); _LIT(KMemory, "Memory"); _LIT(KDevice, "Device"); +_LIT(KCameraInfo, "Camera"); _LIT(KSignalStrength, "SignalStrength"); @@ -45,6 +46,7 @@ _LIT(KAccessoryStatus, "AccessoryStatus"); _LIT(KConnectedAccessories, "ConnectedAccessories"); _LIT(KInputLanguage, "InputLanguage"); +_LIT(KDisplayLanguage, "DisplayLanguage"); _LIT(KSupportedLanguages, "SupportedLanguages"); _LIT(KPridictiveText, "PredictiveText"); _LIT(KVibraActive, "VibraActive"); @@ -100,6 +102,8 @@ _LIT(KPhoneModel, "PhoneModel"); _LIT(KIMEI, "IMEI"); +_LIT(KCameraProperties, "CameraProperties"); + enum TStatus { EUnknown = -1, diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/inc/sysinfo.h --- a/serviceproviders/sapi_sysinfo/sysinfoservice/inc/sysinfo.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/inc/sysinfo.h Thu Aug 27 07:43:07 2009 +0300 @@ -53,6 +53,7 @@ EResolution, EStringList, EStringData, + ECameraInfo }; public: /** @@ -814,4 +815,112 @@ }; +/** + * @ref CCameraResolutionList this class lists different + * resolutions supported + * + * @lib sysinfoservice.lib + * @since S60 3.2 + */ +NONSHARABLE_CLASS(CCameraResolutionList) : public CSysData + { +public: + /** + * Two-phased constructor. + * + * @return A new instance of this class. + */ + static CCameraResolutionList* NewL( RPointerArray& aCamResArray ); + /** + * Two-phased constructor. + * + * @return A new instance of this class. + */ + static CCameraResolutionList* NewLC( RPointerArray& aCamResArray ); + + /** + * On return val contains supported resolution XPixel or YPixel + * depending upon whether flag is 0 or 1. + */ + IMPORT_C TBool At( TInt aIndex, TInt flag, TInt& val ) const; + + /** + * @return resolution at index. + */ + IMPORT_C const CResolution* operator[]( TInt aIndex ) const; + /** + * @return number of supported resolutions. + */ + IMPORT_C TInt Count() const; + + /** + * Destructor. + */ + ~CCameraResolutionList(); + +private: + /** + * C++ default constructor. + */ + CCameraResolutionList(); + /** + * Symbian 2nd phase constructor. + */ + void ConstructL( RPointerArray& aCamResArray ); + +private: + RPointerArray iresArray; + TInt iCount; + }; + +/** + * @ref CCameraInfo details about Resolutions Supported and + * MimeTypes supported by a device + * @lib sysinfoservice.lib + * @since S60 3.2 + */ +NONSHARABLE_CLASS(CCameraInfo) : public CSysData + { +public: + /** + * Two-phased constructor. + * @return A new instance of this class. + */ + static CCameraInfo* NewL( CCameraResolutionList* aCamResList, CStringList* aMimeTypesList ); + /** + * Two-phased constructor. + * @return A new instance of this class. + */ + static CCameraInfo* NewLC( CCameraResolutionList* aCamResList, CStringList* aMimeTypes ); + + /** + * On return List of supported Resolutions + */ + IMPORT_C CCameraResolutionList* ResolutionList() const; + + /** + * On return List of supported MimeTypes + */ + IMPORT_C CStringList* MimeTypesList() const; + + /** + * Destructor. + */ + ~CCameraInfo(); + +private: + /** + * C++ default constructor. + */ + CCameraInfo(); + /** + * Symbian 2nd phase constructor. + */ + void ConstructL( CCameraResolutionList* aCamResList, CStringList* aMimeTypes ); + +private: + CCameraResolutionList* iResList; + CStringList* iMimeTypesList; + }; + #endif __SYSINFO_H__ diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/inc/sysinfoservice.h --- a/serviceproviders/sapi_sysinfo/sysinfoservice/inc/sysinfoservice.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/inc/sysinfoservice.h Thu Aug 27 07:43:07 2009 +0300 @@ -22,6 +22,7 @@ // INCLUDES #include "sysinfo.h" #include "sysrequest.h" +#include "imagingconfigmanager.h" // FORWORD CLASS DECLARATION class CSysData; @@ -272,6 +273,11 @@ * Retrieves Device Entity attribute values. */ void GetDeviceInfoL(TPtrC aKey,CSysData*& aSysData); + + /* + * Retrieves Camera Entity attribute values. + */ + void GetCameraDataL(TPtrC aKey,CSysData*& aSysData); private: //DATA diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/src/sysinfo.cpp --- a/serviceproviders/sapi_sysinfo/sysinfoservice/src/sysinfo.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/src/sysinfo.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -1199,5 +1199,192 @@ { return TPtrC(*iConnectionName); } + + +// -------------------------------------------------------------------- +// CCameraResolutionList::CCameraResolutionList() +// Constructor. +// -------------------------------------------------------------------- +// +CCameraResolutionList::CCameraResolutionList() : + CSysData( ECameraInfo ) + { + } + +// -------------------------------------------------------------------- +// CConnectionList::~CConnectionList() +// Destructor +// -------------------------------------------------------------------- +// +CCameraResolutionList::~CCameraResolutionList() + { + iresArray.ResetAndDestroy(); + iresArray.Close(); + } + +// -------------------------------------------------------------------- +// CCameraResolutionList::NewL() +// Two-phased constructor. returns new instance of this class. +// -------------------------------------------------------------------- +// +CCameraResolutionList* CCameraResolutionList::NewL( RPointerArray& aCamResArray ) + { + CCameraResolutionList* self = CCameraResolutionList::NewLC( aCamResArray ); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------- +// CCameraResolutionList::NewLC() +// Two-phased constructor. returns new instance of this class. +// -------------------------------------------------------------------- +// +CCameraResolutionList* CCameraResolutionList::NewLC( RPointerArray& aCamResArray ) + { + CCameraResolutionList* self = new (ELeave) CCameraResolutionList(); + CleanupStack::PushL( self ); + self->ConstructL( aCamResArray ); + return self; + } + +// -------------------------------------------------------------------- +// CCameraResolutionList::ConstructL() +// 2nd phase construtor +// -------------------------------------------------------------------- +// +void CCameraResolutionList::ConstructL( RPointerArray& aCamResArray ) + { + iCount = aCamResArray.Count(); + if ( iCount > 0 ) + { + for ( TInt index = 0; index < iCount; index++ ) + { + iresArray.AppendL( aCamResArray[index] ); + } + } + } + +// -------------------------------------------------------------------- +// CCameraResolutionList::At() +// On return val contains supported resolution XPixel or YPixel depending upon whether flag is 0 or 1. +// -------------------------------------------------------------------- +// +EXPORT_C TBool CCameraResolutionList::At( TInt aIndex, TInt aFlag, TInt& aVal ) const + { + if ( 0 <= aIndex && aIndexXPixels(); + } + else if ( aFlag == 1 ) + { + aVal = iresArray[aIndex]->YPixels(); + } + else + { + return EFalse; + } + return ETrue; + } + return EFalse; + } + +// -------------------------------------------------------------------- +// CCameraResolutionList::[] +// gets Resolution at specified index. +// -------------------------------------------------------------------- +// +EXPORT_C const CResolution* CCameraResolutionList::operator[]( TInt aIndex ) const + { + return iresArray[aIndex]; + } + +// -------------------------------------------------------------------- +// CCameraResolutionList::Count() +// returns number of resolutions supported. +// -------------------------------------------------------------------- +// +EXPORT_C TInt CCameraResolutionList::Count() const + { + return iCount; + } + +// -------------------------------------------------------------------- +// CCameraInfo::CCameraInfo() +// Constructor. +// -------------------------------------------------------------------- +// +CCameraInfo::CCameraInfo() : + CSysData( ECameraInfo ) + { + } + +// -------------------------------------------------------------------- +// CCameraInfo::~CCameraInfo() +// Destructor +// -------------------------------------------------------------------- +// +CCameraInfo::~CCameraInfo() + { + delete iResList; + delete iMimeTypesList; + } + +// -------------------------------------------------------------------- +// CCameraInfo::NewL() +// Two-phased constructor. returns new instance of this class. +// -------------------------------------------------------------------- +// +CCameraInfo* CCameraInfo::NewL( CCameraResolutionList* aCamResList, CStringList* aMimeTypesList ) + { + CCameraInfo* self = CCameraInfo::NewLC( aCamResList, aMimeTypesList ); + CleanupStack::Pop( self ); + return self; + } + +// -------------------------------------------------------------------- +// CCameraInfo::NewLC() +// Two-phased constructor. returns new instance of this class. +// -------------------------------------------------------------------- +// +CCameraInfo* CCameraInfo::NewLC( CCameraResolutionList* aCamResList, CStringList* aMimeTypesList ) + { + CCameraInfo* self = new (ELeave) CCameraInfo(); + CleanupStack::PushL( self ); + self->ConstructL( aCamResList, aMimeTypesList ); + return self; + } + +// -------------------------------------------------------------------- +// CCameraInfo::ConstructL() +// 2nd phase construtor +// -------------------------------------------------------------------- +// +void CCameraInfo::ConstructL( CCameraResolutionList* aCamResList, CStringList* aMimeTypesList ) + { + iResList = aCamResList; + iMimeTypesList = aMimeTypesList; + } + +// -------------------------------------------------------------------- +// CCameraInfo::ResolutionList() +// Gives a list containing supported resolutions +// -------------------------------------------------------------------- +// +EXPORT_C CCameraResolutionList* CCameraInfo::ResolutionList() const + { + return iResList; + } + +// -------------------------------------------------------------------- +// CCameraInfo::MimeTypesList() +// Gives a list containing supported mime types +// -------------------------------------------------------------------- +// +EXPORT_C CStringList* CCameraInfo::MimeTypesList() const + { + return iMimeTypesList; + } // End of file. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/sysinfoservice/src/sysinfoservice.cpp --- a/serviceproviders/sapi_sysinfo/sysinfoservice/src/sysinfoservice.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/sysinfoservice/src/sysinfoservice.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -43,6 +43,7 @@ #include #include +#include #include "sysinfoservice.h" #include "sysinfo.h" @@ -52,6 +53,7 @@ #include "deviceinfo.h" #include "sysrange.h" +#include using namespace SysInfo; @@ -59,7 +61,10 @@ const TInt KGranularity(2); const TInt KPhoneWlanMacAddressLength = 50; const TChar KPhoneWlanSeparator (':'); +const TUint KPrimaryCameraDisplayID = 2; _LIT(KWLanMACDataFormat, "%02x"); +const TInt KPhoneLanguageLength = 20; +const TInt KMimeTypeLength = 20; // -------------------------------------------------------------------- // CSysInfoService::CSysInfoService() @@ -340,6 +345,9 @@ else if( !aEntity.CompareF(KFeatures) ) GetFeatureInfoL(aKey,aOutput); + + else if ( !aEntity.CompareF( KCameraInfo ) ) + GetCameraDataL( aKey,aOutput ); else User::Leave(KErrNotFound); @@ -681,6 +689,15 @@ RepositoryUtil::GetRepositoryKeyL(KCRUidAknFep, KAknFepInputTxtLang,inputLang); aSysData = CStatus::NewL(inputLang); + } + else if ( !aKey.CompareF( KDisplayLanguage ) ) + { + HBufC* phoneLang = NULL; + TBuf language; + TRAP_IGNORE(phoneLang = AknLangUtils::DisplayLanguageTagL()); + language.Copy( phoneLang->Des() ); + delete phoneLang; + aSysData = CStringData::NewL( language ); } else if( !aKey.CompareF(KSupportedLanguages) ) { @@ -914,4 +931,62 @@ CleanupStack::PopAndDestroy(2,&usbsessn); } +// -------------------------------------------------------------------- +// CSysInfoService::GetACameraDataL() +// Returns the readonly properties of camera - Media Types and Sizes Supported. +// returns CSysData. +// -------------------------------------------------------------------- +// +void CSysInfoService::GetCameraDataL( TPtrC aKey, CSysData*& aSysData ) + { + if ( !aKey.CompareF( KCameraProperties ) ) + { + CImagingConfigManager* cfgMgr = CImagingConfigManager::NewL(); + CleanupStack::PushL( cfgMgr ); + TImageQualitySet set; + RPointerArray camResArr( KGranularity ); + CDesCArray* mimeArray= NULL; + mimeArray = new (ELeave) CDesCArrayFlat( KGranularity ); + CleanupStack::PushL( mimeArray ); + + CCameraResolutionList* resList= NULL; + CStringList* mimeList= NULL; + + TInt totalLevels = cfgMgr->NumberOfImageQualityLevels(); + CArrayFixFlat* levels = new (ELeave) CArrayFixFlat( totalLevels ); + CleanupStack::PushL( levels ); + + cfgMgr->GetImageQualityLevelsL( *levels, KPrimaryCameraDisplayID ); + TInt numLevels(levels->Count() ); + for ( int i=0; iGetImageQualitySet( set, levels->At(i), KPrimaryCameraDisplayID ); + if ( set.iCamcorderVisible > 0 ) + { + CResolution* camRes = CResolution::NewL( set.iImageWidth, set.iImageHeight ); + CleanupStack::PushL( camRes ); + camResArr.AppendL( camRes ); + CleanupStack::Pop( camRes ); + + TText8* mimeType = set.iImageFileMimeType; + TInt length = strlen( (const char *)mimeType ); + TPtrC8 mimeTypePtr( mimeType, length ); + TBuf8 mimeTypeBuf = mimeTypePtr; + TBuf16 imageMimeType; + imageMimeType.Copy( mimeTypeBuf ); + mimeArray->AppendL( imageMimeType ); + } + } + resList = CCameraResolutionList::NewL( camResArr ); //Ownership of camResArr is transferred to CCameraResolutionList + mimeList = CStringList::NewL( mimeArray ); //Ownership of mimeArray is transferred to CStringList + CleanupStack::PopAndDestroy( levels ); + CleanupStack::Pop( mimeArray ); + CleanupStack::PopAndDestroy( cfgMgr ); + camResArr.Reset(); + aSysData = CCameraInfo::NewL( resList, mimeList ); //Ownership of resList and mimeList is transferred to CCameraInfo + } + else + User::Leave( KErrNotFound ); + } + // End of file. diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/conf/tsysinfoprovidernegativetests.cfg --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/conf/tsysinfoprovidernegativetests.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/conf/tsysinfoprovidernegativetests.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -1,3 +1,45 @@ + +[Test] +title GetCameraInfoWrongEntity test +create tsysinfoprovidernegativetests foobar +foobar GetCameraInfoTestNegative CameraEntity CameraProperties 1012 +delete foobar +[Endtest] + +[Test] +title GetCameraInfoWrongKey test +create tsysinfoprovidernegativetests foobar +foobar GetCameraInfoTestNegative CameraInfo CameraKey 1012 +delete foobar +[Endtest] + +[Test] +title GetCameraInfoNullKey test +create tsysinfoprovidernegativetests foobar +foobar GetCameraInfoTestNegative CameraInfo NULL 1003 +delete foobar +[Endtest] + +[Test] +title GetCameraInfoNullEntity test +create tsysinfoprovidernegativetests foobar +foobar GetCameraInfoTestNegative NULL CameraProperties 1003 +delete foobar +[Endtest] + +[Test] +title GetCameraInfoTestWrongEntityName test +create tsysinfoprovidernegativetests foobar +foobar GetCameraInfoTestWrongEntityName CameraInfo CameraProperties 1003 +delete foobar +[Endtest] + +[Test] +title GetCameraInfoTestWrongKeyName test +create tsysinfoprovidernegativetests foobar +foobar GetCameraInfoTestWrongKeyName CameraInfo CameraProperties 1003 +delete foobar +[Endtest] [Test] title SetVibraInvalidParamSysDataList test diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/group/tsysinfoprovidernegativetests.mmp --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/group/tsysinfoprovidernegativetests.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/group/tsysinfoprovidernegativetests.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -70,6 +70,7 @@ LIBRARY liwservicehandler.lib LIBRARY hal.lib LIBRARY efsrv.lib +LIBRARY cone.lib LANG SC diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/inc/tsysinfoprovidertests.h --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/inc/tsysinfoprovidertests.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/inc/tsysinfoprovidertests.h Thu Aug 27 07:43:07 2009 +0300 @@ -157,6 +157,9 @@ virtual TInt GetDriveInfoL(CStifItemParser &aItem ); virtual TInt UserInactivityNotify(CStifItemParser &aItem ); + virtual TInt GetCameraInfoTestNegative(CStifItemParser &aItem ); // During CJSE 2.0 + virtual TInt GetCameraInfoNegEntity(CStifItemParser &aItem ); // During CJSE 2.0 + virtual TInt GetCameraInfoNegKey(CStifItemParser &aItem ); // During CJSE 2.0 public: CLiwServiceHandler* iServiceHandler; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/src/tsysinfoprovidertestsblocks.cpp --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/src/tsysinfoprovidertestsblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidernegativetests/src/tsysinfoprovidertestsblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -26,6 +26,7 @@ #include #include #include +#include #include "tsysinfoprovidertests.h" #include "entitykeys.h" @@ -112,6 +113,9 @@ ENTRY( "GetDriveInfoL", Ctsysinfoprovidertests::GetDriveInfoL), ENTRY( "UserInactivityNotify", Ctsysinfoprovidertests::UserInactivityNotify), + ENTRY("GetCameraInfoTestNegative", Ctsysinfoprovidertests::GetCameraInfoTestNegative), // During CJSE 2.0 + ENTRY("GetCameraInfoTestWrongEntityName", Ctsysinfoprovidertests::GetCameraInfoNegEntity),// During CJSE 2.0 + ENTRY("GetCameraInfoTestWrongKeyName", Ctsysinfoprovidertests::GetCameraInfoNegKey),// During CJSE 2.0 }; const TInt count = sizeof( KFunctions ) / @@ -1591,138 +1595,146 @@ // // ----------------------------------------------------------------------------- // -TInt Ctsysinfoprovidertests::SetDisplayLang(CStifItemParser& /*aItem*/) - { - - TInt result =KErrNone; - - _LIT( KExample, "SetDisplayLang:" ); - iLog->Log( KExample ); - - TInt32 oldDisplayLang = 0 ,newDisplayLang = 0,changedDisplayLang = 0; - - __UHEAP_MARK; - - - _LIT(KDisplayLanguage,"DisplayLanguage"); - - CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); - CleanupStack::PushL(iServiceHandler); - CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); - CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); - - TInt err = KErrNone; - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - iServiceHandler->AttachL(a); - - iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); - - delete crit; - a.Reset(); - - TInt pos = 0; - MLiwInterface* interface = NULL; - outparam->FindFirst( pos, KIDataSource ); - if(pos != KErrNotFound) - { - //getting the interface handle - interface = (*outparam)[pos].Value().AsInterface(); - } - - outparam->Reset(); - inparam->Reset(); - - if(interface) - { - TLiwGenericParam entity; - TLiwVariant entityname; - TLiwGenericParam key; - TLiwVariant keyname; - - entityname.Set(KGeneral); - entity.SetNameAndValueL(KEntity,entityname); - - keyname.Set(KDisplayLanguage); - key.SetNameAndValueL(KKey,keyname); - - inparam->AppendL(entity); - - inparam->AppendL(key); - - entity.Reset(); - entityname.Reset(); - key.Reset(); - keyname.Reset(); - - //get current display language - TRAPD(err, interface->ExecuteCmdL(KGetInfo,*inparam,*outparam)); - pos = 0 ; - outparam->FindFirst( pos, KErrorCode ); - if(pos != KErrNotFound) - { - err = (TInt)((*outparam)[pos].Value().AsTInt32()); - } - - - if( err != SErrNotFound ) - { - iLog->Log( _L("Failed,Get Display language found ret err: %d"),err ); - result = KErrGeneral; - } - else - { - result = KErrNone; - iLog->Log( _L("Passed Get Display language not found") ); - } - - - outparam->Reset(); - CLiwDefaultMap* sysdatamap = CLiwDefaultMap::NewL(); - CleanupClosePushL(*sysdatamap); - sysdatamap->InsertL(KStatus,(TInt32)10); - inparam->AppendL(TLiwGenericParam(KSysData,TLiwVariant(sysdatamap))); - CleanupStack::PopAndDestroy(sysdatamap); - - TRAPD(err1, interface->ExecuteCmdL(KSetInfo,*inparam,*outparam)); - - pos = 0 ; - outparam->FindFirst( pos, KErrorCode ); - if(pos != KErrNotFound) - { - err = (TInt)((*outparam)[pos].Value().AsTInt32()); - } - - if( err != SErrNotFound ) - { - iLog->Log( _L("Failed, Set Display language found ret err: %d"),err ); - result = KErrGeneral; - } - else - { - result = KErrNone; - iLog->Log( _L("Passed, Set Display language not found") ); - } - } - - inparam->Reset(); - outparam->Reset(); - - interface->Close(); - - CleanupStack::PopAndDestroy( iServiceHandler ); - - return result; - __UHEAP_MARKEND; - - } - - +TInt Ctsysinfoprovidertests::SetDisplayLang(CStifItemParser& /*aItem*/) + { + CCoeEnv* coeSupported = NULL; + coeSupported = CCoeEnv::Static(); + if (coeSupported) + { + + TInt result =KErrNone; + + _LIT(KExample, "SetDisplayLang:"); + iLog->Log(KExample); + + TInt32 oldDisplayLang = 0, newDisplayLang = 0, changedDisplayLang = 0; + + __UHEAP_MARK; + + _LIT(KDisplayLanguage, "DisplayLanguage"); + + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + CleanupStack::PushL(iServiceHandler); + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + TInt err = KErrNone; + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, + KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + delete crit; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + outparam->FindFirst(pos, KIDataSource); + if (pos != KErrNotFound) + { + //getting the interface handle + interface = (*outparam)[pos].Value().AsInterface(); + } + + outparam->Reset(); + inparam->Reset(); + + if (interface) + { + TLiwGenericParam entity; + TLiwVariant entityname; + TLiwGenericParam key; + TLiwVariant keyname; + + entityname.Set(KGeneral); + entity.SetNameAndValueL(KEntity, entityname); + + keyname.Set(KDisplayLanguage); + key.SetNameAndValueL(KKey, keyname); + + inparam->AppendL(entity); + + inparam->AppendL(key); + + entity.Reset(); + entityname.Reset(); + key.Reset(); + keyname.Reset(); + + //get current display language + TRAPD(err, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); + pos = 0; + outparam->FindFirst(pos, KErrorCode); + if (pos != KErrNotFound) + { + err = (TInt)((*outparam)[pos].Value().AsTInt32()); + } + + if (err != SErrNotFound) + { + iLog->Log(_L("Failed,Get Display language found ret err: %d"),err); + result = KErrGeneral; + } + else + { + result = KErrNone; + iLog->Log(_L("Passed Get Display language not found") ); + } + + outparam->Reset(); + CLiwDefaultMap* sysdatamap = CLiwDefaultMap::NewL(); + CleanupClosePushL(*sysdatamap); + sysdatamap->InsertL(KStatus, (TInt32)10); + inparam->AppendL(TLiwGenericParam(KSysData, + TLiwVariant(sysdatamap))); + CleanupStack::PopAndDestroy(sysdatamap); + + TRAPD(err1, interface->ExecuteCmdL(KSetInfo, *inparam, *outparam)); + + pos = 0; + outparam->FindFirst(pos, KErrorCode); + if (pos != KErrNotFound) + { + err = (TInt)((*outparam)[pos].Value().AsTInt32()); + } + + if (err != SErrNotFound) + { + iLog->Log(_L("Failed, Set Display language found ret err: %d"),err); + result = KErrGeneral; + } + else + { + result = KErrNone; + iLog->Log(_L("Passed, Set Display language not found") ); + } + } + + inparam->Reset(); + outparam->Reset(); + + interface->Close(); + + CleanupStack::PopAndDestroy(iServiceHandler); + + return result; + __UHEAP_MARKEND; + } + else + { + iLog->Log(_L("CCoeEnv not supported . Hence passing the test case") ); + return 0; + } + + } + // ----------------------------------------------------------------------------- // Ctsysinfoprovidertests::SetInputLang // @@ -3784,3 +3796,493 @@ return KErrGeneral; } +// ----------------------------------------------------------------------------- +// Ctsysinfoprovidertests::GetCameraInfoTestNegative +// negative test case general +// ----------------------------------------------------------------------------- +// +TInt Ctsysinfoprovidertests::GetCameraInfoTestNegative(CStifItemParser& aItem) + { + TInt retcode; + iLog->Log(_L("GetCameraInfoTest - Negative Test") ); + + __UHEAP_MARK; + TInt error = KErrNone; + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + CleanupStack::PushL(iServiceHandler); + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + iServiceHandler->AttachL(a); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + delete crit; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + outparam->FindFirst(pos, KIDataSource); + if (pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + outparam->Reset(); + inparam->Reset(); + + if (interface) + { + TLiwGenericParam entity; + TLiwVariant entityValue; + TLiwGenericParam key; + TLiwVariant keyValue; + TPtrC16 Entity(KNullDesC); + TPtrC16 Key(KNullDesC); + TInt expectedError = 0; + + aItem.GetNextString(Entity); + aItem.GetNextString(Key); + aItem.GetNextInt(expectedError); + + if (Entity.Compare(_L("NULL")) == 0) + { + keyValue.Set(Key); + key.SetNameAndValueL(KKey, keyValue); + inparam->AppendL(key); + } + else + if (Key.Compare(_L("NULL")) == 0) + { + entityValue.Set(Entity); + entity.SetNameAndValueL(KEntity, entityValue); + inparam->AppendL(entity); + } + else + { + entityValue.Set(Entity); + entity.SetNameAndValueL(KEntity, entityValue); + keyValue.Set(Key); + key.SetNameAndValueL(KKey, keyValue); + inparam->AppendL(entity); + inparam->AppendL(key); + } + entity.Reset(); + entityValue.Reset(); + key.Reset(); + keyValue.Reset(); + + //Get Image Data + TRAP(error, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); + + pos = 0; + const TLiwGenericParam* errorCode = outparam->FindFirst(pos, + KErrorCode); + if (errorCode) + { + retcode = errorCode->Value().AsTInt32(); + if (retcode == expectedError) + { + iLog->Log(_L("Got expected error code %d"), retcode); + pos = 0; + const TLiwGenericParam* output = outparam->FindFirst(pos, + KReturnValue); + if (output) + { + const CLiwMap* Map = output->Value().AsMap(); + if (Map) + { + TLiwVariant data1; + TLiwVariant data2; + if (EFalse != Map->FindL(KCamResList, data1)) + { + const CLiwList* resolutionList = data1.AsList(); + TInt width; + TInt height; + if (resolutionList) + { + TInt count = resolutionList->Count(); + for (TInt i=0; i < count; i++) + { + TLiwVariant resolutionData; + resolutionList->AtL(i, resolutionData); + const CLiwMap* resolutionDataMap = resolutionData.AsMap(); + TLiwVariant xPix; + resolutionDataMap->FindL(KXPixels, xPix); + width = xPix.AsTInt32(); + xPix.Reset(); + iLog->Log(_L("Supported XPixel %d is %d -"),i, width); + + TLiwVariant yPix; + resolutionDataMap->FindL(KYPixels, yPix); + height = yPix.AsTInt32(); + yPix.Reset(); + iLog->Log(_L("Supported YPixel %d is %d -"),i, height); + + resolutionData.Reset(); + }//for + } //resolutionList + }//FindL + if (EFalse != Map->FindL(KCamMimeTypesList, data2)) + { + const CLiwList* mimeList = data2.AsList(); + if (mimeList) + { + for (TInt i=0; i != mimeList->Count(); i++) + { + TLiwVariant mimeData; + TPtrC16 mimeType; + mimeList->AtL(i, mimeData); + mimeType.Set(mimeData.AsDes()); + + iLog->Log(_L("Mimetype %d is - %s"), i,mimeType.Ptr()); + mimeData.Reset(); + }//for + } //mimeList + }//FindL + data1.Reset(); + data2.Reset(); + }//Map + }//output + retcode = KErrNone; + iLog->Log(_L("Test Completed")); + iLog->Log(_L("PASS")); + }//retcode == expected error + else + { + iLog->Log(_L("Error Code Returned = %d"), retcode); + iLog->Log(_L("Error Code Expected = %d"), expectedError); + iLog->Log(_L("Test Completed")); + iLog->Log(_L("FAIL")); + } + }//errorCode + }//interface + inparam->Reset(); + outparam->Reset(); + interface->Close(); + CleanupStack::PopAndDestroy(iServiceHandler); + __UHEAP_MARKEND; + iLog->Log(_L("END")); + return retcode; + } + +// ----------------------------------------------------------------------------- +// Ctsysinfoprovidertests::GetCameraInfoNegEntity +// negative test case - Wrong Entity +// ----------------------------------------------------------------------------- +// +TInt Ctsysinfoprovidertests::GetCameraInfoNegEntity(CStifItemParser& aItem) + { + _LIT8(KEntity1, "Entity1"); + TInt retcode; + iLog->Log(_L("GetCameraInfoNegEntity - Negative Test") ); + + __UHEAP_MARK; + TInt error = KErrNone; + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + CleanupStack::PushL(iServiceHandler); + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + iServiceHandler->AttachL(a); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + delete crit; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + outparam->FindFirst(pos, KIDataSource); + if (pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + outparam->Reset(); + inparam->Reset(); + + if (interface) + { + TLiwGenericParam entity; + TLiwVariant entityName; + TLiwVariant entityValue; + TLiwGenericParam key; + TLiwGenericParam keyName; + TLiwVariant keyValue; + TPtrC16 Entity(KNullDesC); + TPtrC16 Key(KNullDesC); + TInt expectedError = 0; + + aItem.GetNextString(Entity); + aItem.GetNextString(Key); + aItem.GetNextInt(expectedError); + + entityValue.Set(Entity); + entity.SetNameAndValueL(KEntity1, entityValue); + keyValue.Set(Key); + key.SetNameAndValueL(KKey, keyValue); + inparam->AppendL(entity); + inparam->AppendL(key); + + entity.Reset(); + entityValue.Reset(); + key.Reset(); + keyValue.Reset(); + + //Get Image Data + TRAP(error, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); + + pos = 0; + const TLiwGenericParam* errorCode = outparam->FindFirst(pos, + KErrorCode); + if (errorCode) + { + retcode = errorCode->Value().AsTInt32(); + if (retcode == expectedError) + { + iLog->Log(_L("Got expected error code %d"), retcode); + pos = 0; + const TLiwGenericParam* output = outparam->FindFirst(pos, + KReturnValue); + if (output) + { + const CLiwMap* Map = output->Value().AsMap(); + if (Map) + { + TLiwVariant data1; + TLiwVariant data2; + if (EFalse != Map->FindL(KCamResList, data1)) + { + const CLiwList* resolutionList = data1.AsList(); + TInt width; + TInt height; + if (resolutionList) + { + TInt count = resolutionList->Count(); + for (TInt i=0; i < count; i++) + { + TLiwVariant resolutionData; + resolutionList->AtL(i, resolutionData); + const CLiwMap* resolutionDataMap = resolutionData.AsMap(); + TLiwVariant xPix; + resolutionDataMap->FindL(KXPixels, xPix); + width = xPix.AsTInt32(); + xPix.Reset(); + iLog->Log(_L("Supported XPixel %d is %d -"),i, width); + + TLiwVariant yPix; + resolutionDataMap->FindL(KYPixels, yPix); + height = yPix.AsTInt32(); + yPix.Reset(); + iLog->Log(_L("Supported YPixel %d is %d -"),i, height); + + resolutionData.Reset(); + }//for + } //resolutionList + }//FindL + if (EFalse != Map->FindL(KCamMimeTypesList, data2)) + { + const CLiwList* mimeList = data2.AsList(); + if (mimeList) + { + for (TInt i=0; i != mimeList->Count(); i++) + { + TLiwVariant mimeData; + TPtrC16 mimeType; + mimeList->AtL(i, mimeData); + mimeType.Set(mimeData.AsDes()); + + iLog->Log(_L("Mimetype %d is - %s"), i,mimeType.Ptr()); + mimeData.Reset(); + }//for + } //mimeList + }//FindL + data1.Reset(); + data2.Reset(); + }//Map + }//output + retcode = KErrNone; + iLog->Log(_L("Test Completed")); + iLog->Log(_L("PASS")); + }//retcode == expected error + else + { + iLog->Log(_L("Error Code Returned = %d"), retcode); + iLog->Log(_L("Error Code Expected = %d"), expectedError); + iLog->Log(_L("Test Completed")); + iLog->Log(_L("FAIL")); + } + }//errorCode + }//interface + inparam->Reset(); + outparam->Reset(); + interface->Close(); + CleanupStack::PopAndDestroy(iServiceHandler); + __UHEAP_MARKEND; + iLog->Log(_L("END")); + return retcode; + } + +// ----------------------------------------------------------------------------- +// Ctsysinfoprovidertests::GetCameraInfoNegKey +// negative test case - Wrong Key +// ----------------------------------------------------------------------------- +// +TInt Ctsysinfoprovidertests::GetCameraInfoNegKey(CStifItemParser& aItem) + { + _LIT8(KKey1, "Key1"); + TInt retcode; + iLog->Log(_L("GetCameraInfoNegKey - Negative Test") ); + + __UHEAP_MARK; + TInt error = KErrNone; + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + CleanupStack::PushL(iServiceHandler); + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + iServiceHandler->AttachL(a); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + delete crit; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + outparam->FindFirst(pos, KIDataSource); + if (pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + outparam->Reset(); + inparam->Reset(); + + if (interface) + { + TLiwGenericParam entity; + TLiwVariant entityValue; + TLiwGenericParam key; + TLiwVariant keyValue; + TPtrC16 Entity(KNullDesC); + TPtrC16 Key(KNullDesC); + TInt expectedError = 0; + + aItem.GetNextString(Entity); + aItem.GetNextString(Key); + aItem.GetNextInt(expectedError); + + entityValue.Set(Entity); + entity.SetNameAndValueL(KEntity, entityValue); + keyValue.Set(Key); + key.SetNameAndValueL(KKey1, keyValue); + inparam->AppendL(entity); + inparam->AppendL(key); + + entity.Reset(); + entityValue.Reset(); + key.Reset(); + keyValue.Reset(); + + //Get Image Data + TRAP(error, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); + + pos = 0; + const TLiwGenericParam* errorCode = outparam->FindFirst(pos, + KErrorCode); + if (errorCode) + { + retcode = errorCode->Value().AsTInt32(); + if (retcode == expectedError) + { + iLog->Log(_L("Got expected error code %d"), retcode); + pos = 0; + const TLiwGenericParam* output = outparam->FindFirst(pos, + KReturnValue); + if (output) + { + const CLiwMap* Map = output->Value().AsMap(); + if (Map) + { + TLiwVariant data1; + TLiwVariant data2; + if (EFalse != Map->FindL(KCamResList, data1)) + { + const CLiwList* resolutionList = data1.AsList(); + TInt width; + TInt height; + if (resolutionList) + { + TInt count = resolutionList->Count(); + for (TInt i=0; i < count; i++) + { + TLiwVariant resolutionData; + resolutionList->AtL(i, resolutionData); + const CLiwMap* resolutionDataMap = resolutionData.AsMap(); + TLiwVariant xPix; + resolutionDataMap->FindL(KXPixels, xPix); + width = xPix.AsTInt32(); + xPix.Reset(); + iLog->Log(_L("Supported XPixel %d is %d -"),i, width); + + TLiwVariant yPix; + resolutionDataMap->FindL(KYPixels, yPix); + height = yPix.AsTInt32(); + yPix.Reset(); + iLog->Log(_L("Supported YPixel %d is %d -"),i, height); + + resolutionData.Reset(); + }//for + } //resolutionList + }//FindL + if (EFalse != Map->FindL(KCamMimeTypesList, data2)) + { + const CLiwList* mimeList = data2.AsList(); + if (mimeList) + { + for (TInt i=0; i != mimeList->Count(); i++) + { + TLiwVariant mimeData; + TPtrC16 mimeType; + mimeList->AtL(i, mimeData); + mimeType.Set(mimeData.AsDes()); + + iLog->Log(_L("Mimetype %d is - %s"), i,mimeType.Ptr()); + mimeData.Reset(); + }//for + } //mimeList + }//FindL + data1.Reset(); + data2.Reset(); + }//Map + }//output + retcode = KErrNone; + iLog->Log(_L("Test Completed")); + iLog->Log(_L("PASS")); + }//retcode == expected error + else + { + iLog->Log(_L("Error Code Returned = %d"), retcode); + iLog->Log(_L("Error Code Expected = %d"), expectedError); + iLog->Log(_L("Test Completed")); + iLog->Log(_L("FAIL")); + } + }//errorCode + }//interface + inparam->Reset(); + outparam->Reset(); + interface->Close(); + CleanupStack::PopAndDestroy(iServiceHandler); + __UHEAP_MARKEND; + iLog->Log(_L("END")); + return retcode; + } + diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/conf/tsysinfoprovidertests.cfg --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/conf/tsysinfoprovidertests.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/conf/tsysinfoprovidertests.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -1,3 +1,10 @@ +[Test] +title GetCameraInfoPositive test +create tsysinfoprovidertests foobar +foobar GetCameraInfo Camera CameraProperties 0 +delete foobar +[Endtest] + [Test] title GetDriveInfoNegTest test create tsysinfoprovidertests foobar diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/group/tsysinfoprovidertests.mmp --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/group/tsysinfoprovidertests.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/group/tsysinfoprovidertests.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -71,6 +71,7 @@ LIBRARY liwservicehandler.lib LIBRARY hal.lib LIBRARY efsrv.lib btengsettings.lib +LIBRARY cone.lib LANG SC diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/inc/tsysinfoprovidertests.h --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/inc/tsysinfoprovidertests.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/inc/tsysinfoprovidertests.h Thu Aug 27 07:43:07 2009 +0300 @@ -144,6 +144,7 @@ virtual TInt GetActiveConnections(CStifItemParser &aItem ); virtual TInt BTAsyncRequestCancel(CStifItemParser &aItem ); virtual TInt GetActiveConnectionsReqCancel(CStifItemParser &aItem ); + virtual TInt GetCameraInfoTest(CStifItemParser &aItem ); public: diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/src/tsysinfoprovidertestsblocks.cpp --- a/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/src/tsysinfoprovidertestsblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/providertests/tsysinfoprovidertests/src/tsysinfoprovidertestsblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -26,6 +26,7 @@ #include #include #include +#include #include "tsysinfoprovidertests.h" #include "entitykeys.h" @@ -37,7 +38,6 @@ using namespace LIW ; using namespace SysInfo; using namespace sysinfoaiwparams; -_LIT(KDisplayLanguage,"DisplayLanguage"); _LIT(KROMInstallDir,"\\system\\install\\"); _LIT(KS60ProductIdFile,"Series60v*.sis"); @@ -101,6 +101,7 @@ ENTRY( "GetActiveConnections", Ctsysinfoprovidertests::GetActiveConnections), ENTRY( "BTAsyncRequestCancel", Ctsysinfoprovidertests::BTAsyncRequestCancel), ENTRY( "GetActiveConnectionsReqCancel", Ctsysinfoprovidertests::GetActiveConnectionsReqCancel), + ENTRY("GetCameraInfo", Ctsysinfoprovidertests::GetCameraInfoTest), // During CJSE 2.0 }; @@ -2597,129 +2598,137 @@ // // ----------------------------------------------------------------------------- // -TInt Ctsysinfoprovidertests::SetDisplayLang(CStifItemParser& /*aItem*/) - { - - TInt result =KErrNone; - - _LIT( KExample, "SupportedLang:" ); - iLog->Log( KExample ); - - TInt32 oldDisplayLang = 0 ,newDisplayLang = 0,changedDisplayLang = 0; - - __UHEAP_MARK; - - CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); - CleanupStack::PushL(iServiceHandler); - CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); - CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); - - TInt err = KErrNone; - - CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource,KService); - crit->SetServiceClass(TUid::Uid(KLiwClassBase)); - - RCriteriaArray a; - a.AppendL(crit); - - iServiceHandler->AttachL(a); - - iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); - - delete crit; - a.Reset(); - - TInt pos = 0; - MLiwInterface* interface = NULL; - outparam->FindFirst( pos, KIDataSource ); - if(pos != KErrNotFound) - { - //getting the interface handle - interface = (*outparam)[pos].Value().AsInterface(); - } - - outparam->Reset(); - inparam->Reset(); - - if(interface) - { - TLiwGenericParam entity; - TLiwVariant entityname; - TLiwGenericParam key; - TLiwVariant keyname; - - entityname.Set(KGeneral); - entity.SetNameAndValueL(KEntity,entityname); - - keyname.Set(KDisplayLanguage); - key.SetNameAndValueL(KKey,keyname); - - inparam->AppendL(entity); - - inparam->AppendL(key); - - entity.Reset(); - entityname.Reset(); - key.Reset(); - keyname.Reset(); - TInt32 err(KErrNone); - - //get current display language - interface->ExecuteCmdL(KGetInfo,*inparam,*outparam); - - result |= CheckErrorCode(*outparam,err); - iLog->Log( _L("GetInfo retured error : %d"),err ); - - if( err != SErrNotFound ) - { - iLog->Log( _L("Failed,Get Display language found ret err: %d"),err ); - result = KErrGeneral; - } - else - { - result = KErrNone; - iLog->Log( _L("Passed Get Display language not found") ); - } - - outparam->Reset(); - CLiwDefaultMap* sysdatamap = CLiwDefaultMap::NewL(); - CleanupClosePushL(*sysdatamap); - sysdatamap->InsertL(KStatus,(TInt32)10); - inparam->AppendL(TLiwGenericParam(KSysData,TLiwVariant(sysdatamap))); - CleanupStack::PopAndDestroy(sysdatamap); - - - interface->ExecuteCmdL(KSetInfo,*inparam,*outparam); - - result |= CheckErrorCode(*outparam,err); - iLog->Log( _L("GetInfo retured error : %d"),err ); - - - if( err != SErrNotFound ) - { - iLog->Log( _L("Failed, Set Display language found ret err: %d"),err ); - result = KErrGeneral; - } - else - { - result = KErrNone; - iLog->Log( _L("Passed, Set Display language not found") ); - } - } - - inparam->Reset(); - outparam->Reset(); - - interface->Close(); - - CleanupStack::PopAndDestroy( iServiceHandler ); - - return result; - __UHEAP_MARKEND; - - - - } +TInt Ctsysinfoprovidertests::SetDisplayLang(CStifItemParser& /*aItem*/) + { + CCoeEnv* coeSupported = NULL; + coeSupported = CCoeEnv::Static(); + if (coeSupported) + { + TInt result =KErrNone; + + _LIT(KExample, "SupportedLang:"); + iLog->Log(KExample); + + TInt32 oldDisplayLang = 0, newDisplayLang = 0, changedDisplayLang = 0; + + __UHEAP_MARK; + + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + CleanupStack::PushL(iServiceHandler); + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + TInt err = KErrNone; + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, + KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + + iServiceHandler->AttachL(a); + + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + + delete crit; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + outparam->FindFirst(pos, KIDataSource); + if (pos != KErrNotFound) + { + //getting the interface handle + interface = (*outparam)[pos].Value().AsInterface(); + } + + outparam->Reset(); + inparam->Reset(); + + if (interface) + { + TLiwGenericParam entity; + TLiwVariant entityname; + TLiwGenericParam key; + TLiwVariant keyname; + + entityname.Set(KGeneral); + entity.SetNameAndValueL(KEntity, entityname); + + keyname.Set(KDisplayLanguage); + key.SetNameAndValueL(KKey, keyname); + + inparam->AppendL(entity); + + inparam->AppendL(key); + + entity.Reset(); + entityname.Reset(); + key.Reset(); + keyname.Reset(); + TInt32 err(KErrNone); + + //get current display language + interface->ExecuteCmdL(KGetInfo, *inparam, *outparam); + + result |= CheckErrorCode(*outparam, err); + iLog->Log(_L("GetInfo retured error : %d"), err); + + if (err != SErrNotFound) + { + iLog->Log(_L("Failed,Get Display language found ret err: %d"),err); + result = KErrGeneral; + } + else + { + result = KErrNone; + iLog->Log(_L("Passed Get Display language not found") ); + } + + outparam->Reset(); + CLiwDefaultMap* sysdatamap = CLiwDefaultMap::NewL(); + CleanupClosePushL(*sysdatamap); + sysdatamap->InsertL(KStatus, (TInt32)10); + inparam->AppendL(TLiwGenericParam(KSysData, + TLiwVariant(sysdatamap))); + CleanupStack::PopAndDestroy(sysdatamap); + + interface->ExecuteCmdL(KSetInfo, *inparam, *outparam); + + result |= CheckErrorCode(*outparam, err); + iLog->Log(_L("GetInfo retured error : %d"), err); + + if (err != SErrNotFound) + { + iLog->Log(_L("Failed, Set Display language found ret err: %d"), + err); + result = KErrGeneral; + } + else + { + result = KErrNone; + iLog->Log(_L("Passed, Set Display language not found") ); + } + } + + inparam->Reset(); + outparam->Reset(); + + interface->Close(); + + CleanupStack::PopAndDestroy(iServiceHandler); + + return result; + __UHEAP_MARKEND; + } + else + { + iLog->Log(_L("CCoeEnv not supported . Hence passing the test case") ); + return 0; + } + + } // ----------------------------------------------------------------------------- @@ -3307,9 +3316,163 @@ else return KErrGeneral; } - - - - - + +// ----------------------------------------------------------------------------- +// Ctsysinfoprovidertests::GetCameraInfoTest +// Positive Test +// ----------------------------------------------------------------------------- +// +TInt Ctsysinfoprovidertests::GetCameraInfoTest(CStifItemParser& aItem) + { + TInt retcode; + iLog->Log(_L("GetCameraInfoTest - Positive Test") ); + + __UHEAP_MARK; + TInt error = KErrNone; + CLiwServiceHandler* iServiceHandler = CLiwServiceHandler::NewL(); + CleanupStack::PushL(iServiceHandler); + CLiwGenericParamList* inparam = &(iServiceHandler->InParamListL()); + CLiwGenericParamList* outparam = &(iServiceHandler->OutParamListL()); + + CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL(1, KIDataSource, KService); + crit->SetServiceClass(TUid::Uid(KLiwClassBase)); + + RCriteriaArray a; + a.AppendL(crit); + iServiceHandler->AttachL(a); + iServiceHandler->ExecuteServiceCmdL(*crit, *inparam, *outparam); + delete crit; + a.Reset(); + + TInt pos = 0; + MLiwInterface* interface = NULL; + outparam->FindFirst(pos, KIDataSource); + if (pos != KErrNotFound) + { + interface = (*outparam)[pos].Value().AsInterface(); + } + outparam->Reset(); + inparam->Reset(); + + if (interface) + { + TLiwGenericParam entity; + TLiwVariant entityValue; + TLiwGenericParam key; + TLiwVariant keyValue; + TPtrC16 Entity(KNullDesC); + TPtrC16 Key(KNullDesC); + TInt expectedError = 0; + + aItem.GetNextString(Entity); + aItem.GetNextString(Key); + aItem.GetNextInt(expectedError); + + entityValue.Set(Entity); + entity.SetNameAndValueL(KEntity, entityValue); + keyValue.Set(Key); + key.SetNameAndValueL(KKey, keyValue); + + inparam->AppendL(entity); + inparam->AppendL(key); + + entity.Reset(); + entityValue.Reset(); + key.Reset(); + keyValue.Reset(); + + //Get Image Data + TRAP(error, interface->ExecuteCmdL(KGetInfo, *inparam, *outparam)); + + pos = 0; + const TLiwGenericParam* errorCode = outparam->FindFirst(pos, + KErrorCode); + if (errorCode) + { + retcode = errorCode->Value().AsTInt32(); + if (retcode == expectedError) + { + iLog->Log(_L("Got expected error code %d"), retcode); + pos = 0; + const TLiwGenericParam* output = outparam->FindFirst(pos, + KReturnValue); + if (output) + { + const CLiwMap* Map = output->Value().AsMap(); + if (Map) + { + TLiwVariant data1; + TLiwVariant data2; + if (EFalse != Map->FindL(KCamResList, data1)) + { + const CLiwList* resolutionList = data1.AsList(); + TInt width; + TInt height; + if (resolutionList) + { + TInt count = resolutionList->Count(); + for (TInt i=0; i < count; i++) + { + TLiwVariant resolutionData; + resolutionList->AtL(i, resolutionData); + const CLiwMap* resolutionDataMap = resolutionData.AsMap(); + TLiwVariant xPix; + resolutionDataMap->FindL(KXPixels, xPix); + width = xPix.AsTInt32(); + xPix.Reset(); + iLog->Log(_L("Supported XPixel %d is - %d "),i, width); + + TLiwVariant yPix; + resolutionDataMap->FindL(KYPixels, yPix); + height = yPix.AsTInt32(); + yPix.Reset(); + iLog->Log(_L("Supported YPixel %d is - %d "),i, height); + + resolutionData.Reset(); + }//for + } //resolutionList + }//FindL + if (EFalse != Map->FindL(KCamMimeTypesList, data2)) + { + const CLiwList* mimeList = data2.AsList(); + if (mimeList) + { + for (TInt i=0; i != mimeList->Count(); i++) + { + TLiwVariant mimeData; + TPtrC16 mimeType; + mimeList->AtL(i, mimeData); + mimeType.Set(mimeData.AsDes()); + + iLog->Log(_L("Mimetype %d is - %s"), i,mimeType.Ptr()); + mimeData.Reset(); + }//for + } //mimeList + }//FindL + data1.Reset(); + data2.Reset(); + }//Map + }//output + retcode = KErrNone; + iLog->Log(_L("Test Completed")); + iLog->Log(_L("PASS")); + }//retcode == expected error + else + { + iLog->Log(_L("Error Code Returned = %d"), retcode); + iLog->Log(_L("Error Code Expected = %d"), expectedError); + iLog->Log(_L("Test Completed")); + iLog->Log(_L("FAIL")); + } + }//errorCode + }//interface + inparam->Reset(); + outparam->Reset(); + interface->Close(); + CleanupStack::PopAndDestroy(iServiceHandler); + __UHEAP_MARKEND; + iLog->Log(_L("END")); + return retcode; + } + // End of File diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/conf/tsysinfoservicetests.cfg --- a/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/conf/tsysinfoservicetests.cfg Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/conf/tsysinfoservicetests.cfg Thu Aug 27 07:43:07 2009 +0300 @@ -1,3 +1,24 @@ +[Test] +title CameraData test +create tsysinfoservicetests foobar +foobar CameraData +delete foobar +[Endtest] + +[Test] +title CameraDataWrongEntity test +create tsysinfoservicetests foobar +foobar CameraDataWrongEntity +delete foobar +[Endtest] + +[Test] +title CameraDataWrongKey test +create tsysinfoservicetests foobar +foobar CameraDataWrongKey +delete foobar +[Endtest] + [Test] title GetSetBrightness test create tsysinfoservicetests foobar diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/group/tsysinfoservicetests.mmp --- a/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/group/tsysinfoservicetests.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/group/tsysinfoservicetests.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -82,6 +82,7 @@ LIBRARY stiftestengine.lib LIBRARY hal.lib LIBRARY efsrv.lib btengsettings.lib +LIBRARY cone.lib LANG SC diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/inc/tsysinfoservicetests.h --- a/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/inc/tsysinfoservicetests.h Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/inc/tsysinfoservicetests.h Thu Aug 27 07:43:07 2009 +0300 @@ -156,6 +156,9 @@ virtual TInt AvailableUSBModes(CStifItemParser &aItem ); virtual TInt ActiveUSBModes(CStifItemParser &aItem ); virtual TInt NotificationCancelVibra(CStifItemParser &aItem ); + virtual TInt CameraData(CStifItemParser &aItem ); + virtual TInt CameraDataNegativeEntity(CStifItemParser &aItem ); + virtual TInt CameraDataNegativeKey(CStifItemParser &aItem ); virtual TInt IRStatus(CStifItemParser &aItem ); virtual TInt ConnBluetooth(CStifItemParser &aItem ); diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/src/tsysinfoservicetestsblocks.cpp --- a/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/src/tsysinfoservicetestsblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/dev/servicetests/tsysinfoservicetests/src/tsysinfoservicetestsblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -30,11 +30,11 @@ #include "sysinfoservice.h" #include "entitykeys.h" +#include using namespace SysInfo; _LIT(KROMInstallDir,"\\system\\install\\"); _LIT(KS60ProductIdFile,"Series60v*.sis"); -_LIT(KDisplayLanguage,"DisplayLanguage"); const TPtrC KFeature[] = { @@ -107,6 +107,9 @@ ENTRY( "AvailableUSBModes", Ctsysinfoservicetests::AvailableUSBModes), ENTRY( "ActiveUSBModes", Ctsysinfoservicetests::ActiveUSBModes), ENTRY( "NotificationCancelVibra", Ctsysinfoservicetests::NotificationCancelVibra), + ENTRY( "CameraData", Ctsysinfoservicetests::CameraData), + ENTRY( "CameraDataWrongEntity", Ctsysinfoservicetests::CameraDataNegativeEntity), + ENTRY( "CameraDataWrongKey", Ctsysinfoservicetests::CameraDataNegativeKey), //Connectivity ENTRY( "ConnBluetooth", Ctsysinfoservicetests::ConnBluetooth), ENTRY( "IRStatus", Ctsysinfoservicetests::IRStatus), @@ -2183,99 +2186,101 @@ // // ----------------------------------------------------------------------------- // -TInt Ctsysinfoservicetests::GetDisplayLang(CStifItemParser& /*aItem*/) - { - - TInt result = KErrNone; - __UHEAP_MARK; - +TInt Ctsysinfoservicetests::GetDisplayLang(CStifItemParser& /*aItem*/) + { + CCoeEnv* coeSupported = NULL; + coeSupported = CCoeEnv::Static(); + if (coeSupported) + { + TInt result = KErrNone; + __UHEAP_MARK; - _LIT( KExample, "GetDisplayLang:" ); - iLog->Log( KExample ); - - - CSysInfoService* iSysInfoService = CSysInfoService::NewL(); + _LIT(KExample, "GetDisplayLang:"); + iLog->Log(KExample); - CleanupStack::PushL(iSysInfoService); + CSysInfoService* iSysInfoService = CSysInfoService::NewL(); - - CSysData* data2 = NULL; + CleanupStack::PushL(iSysInfoService); + + CSysData* data2 = NULL; - TRAPD(err,iSysInfoService->GetInfoL(KGeneral,KDisplayLanguage,data2)); - if( err != KErrNotFound ) - { - iLog->Log( _L("Failed,Get Display language found ret err: %d"),err ); - result = KErrGeneral; - } - else - { - result = KErrNone; - iLog->Log( _L("Passed Get Display language not found") ); - } - - delete data2; - - CleanupStack::PopAndDestroy(1); - __UHEAP_MARKEND; + TRAPD(err, iSysInfoService->GetInfoL(KGeneral, KDisplayLanguage, + data2)); + if (err != KErrNotFound) + { + iLog->Log(_L("Failed,Get Display language found ret err: %d"), + err); + result = KErrGeneral; + } + else + { + result = KErrNone; + iLog->Log(_L("Passed Get Display language not found") ); + } - return result; - - - } + delete data2; + + CleanupStack::PopAndDestroy(1); + __UHEAP_MARKEND; + + return result; + + } + else + { + iLog->Log(_L("CCoeEnv not supported . Hence passing the test case") ); + return 0; + } + } // ----------------------------------------------------------------------------- // Ctsysinfoservicetests::SetDisplayLang // // ----------------------------------------------------------------------------- // -TInt Ctsysinfoservicetests::SetDisplayLang(CStifItemParser& /*aItem*/) - { - - TInt result = KErrNone; - - __UHEAP_MARK; - - CSysInfoService* iSysInfoService = CSysInfoService::NewL(); - - CleanupStack::PushL(iSysInfoService); - +TInt Ctsysinfoservicetests::SetDisplayLang(CStifItemParser& /*aItem*/) + { + TInt result = KErrNone; + __UHEAP_MARK; + CSysInfoService* iSysInfoService = CSysInfoService::NewL(); + CleanupStack::PushL(iSysInfoService); + CStatus* data = CStatus::NewL(10); + CleanupStack::PushL(data); + TRAPD(err, iSysInfoService->SetInfoL(KGeneral, KDisplayLanguage, data)); + if (err != KErrNotFound) + { + iLog->Log(_L("Failed,Set Display language found ret err: %d"), err); + result = KErrGeneral; + } + else + { + result = KErrNone; + iLog->Log(_L("Passed Set Display language not found") ); + } + CleanupStack::PopAndDestroy(data); - CStatus* data = CStatus::NewL(10); - CleanupStack::PushL(data); - TRAPD(err,iSysInfoService->SetInfoL(KGeneral,KDisplayLanguage,data)); - if( err != KErrNotFound ) - { - iLog->Log( _L("Failed,Set Display language found ret err: %d"),err ); - result = KErrGeneral; - } - else - { - result = KErrNone; - iLog->Log( _L("Passed Set Display language not found") ); - } - CleanupStack::PopAndDestroy(data); - - CSysData *data1 = NULL; - TRAPD(err1,iSysInfoService->GetInfoL(KGeneral,KDisplayLanguage,data1)); - if( err1 != KErrNotFound ) - { - iLog->Log( _L("Failed,Set Display language found ret err: %d"),err ); - result = KErrGeneral; - } - else - { - result = KErrNone; - iLog->Log( _L("Passed Set Display language not found") ); - } - delete data1; - - CleanupStack::PopAndDestroy(1); - __UHEAP_MARKEND; - - return result; - - - } + CCoeEnv* coeSupported = NULL; + coeSupported = CCoeEnv::Static(); + if (coeSupported) + { + CSysData *data1 = NULL; + TRAPD(err1, iSysInfoService->GetInfoL(KGeneral, KDisplayLanguage,data1)); + if (err1 != KErrNotFound) + { + iLog->Log(_L("Failed,Set Display language found ret err: %d"),err); + result = KErrGeneral; + } + else + { + result = KErrNone; + iLog->Log(_L("Passed Set Display language not found") ); + } + delete data1; + } + CleanupStack::PopAndDestroy(1); + __UHEAP_MARKEND; + return result; + } // ----------------------------------------------------------------------------- // Ctsysinfoservicetests::SetInputLang // @@ -2569,7 +2574,159 @@ else return KErrGeneral; } - + +// ----------------------------------------------------------------------------- +// Ctsysinfoservicetests::CameraData +// Positive Test for Core Class +// ----------------------------------------------------------------------------- +// +TInt Ctsysinfoservicetests::CameraData(CStifItemParser& /*aItem*/) + { + TInt result = 0; + _LIT( KExample, "CameraData" ); + iLog->Log( KExample ); + + __UHEAP_MARK; + + CSysInfoService *obj = CSysInfoService::NewL(); + CleanupStack::PushL(obj); + + CSysData* output=NULL; + TRAPD(err,obj->GetInfoL(KCameraInfo,KCameraProperties,output)); + result = err; + if (result == KErrNone) + { + iLog->Log(_L("Got Expected error code %d "),result); + if(!output) + { + iLog->Log( _L("Output data Set to NULL") ); + result = -1; + } + else + { + CleanupStack::PushL(output); + iLog->Log( _L("Output data Obtained") ); + if( CSysData::ECameraInfo != output->DataType() ) + { + iLog->Log( _L("Invalid output data type") ); + result = -1; + } + else + { + iLog->Log( _L("Valid output data type - ECameraInfo") ); + const CCameraInfo* camInfoTest = ((CCameraInfo*) output); + TInt count = camInfoTest->ResolutionList()->Count(); + + iLog->Log( _L("Count is - %d"),count ); + for(TInt i=0; iResolutionList()->At(i,0,val); + iLog->Log( _L("Width %d is - %d"),i+1,val ); + camInfoTest->ResolutionList()->At(i,1,val); + iLog->Log( _L("Height %d is - %d"),i+1,val ); + camInfoTest->MimeTypesList()->At(i,string); + iLog->Log( _L("MimeType %d is %s"),i+1,string.Ptr()); + } + iLog->Log(_L("Test Completed")); + iLog->Log( _L("PASS")); + }//datatype - ECameraInfo + CleanupStack::PopAndDestroy(output); + }//output + }//err + else + { + iLog->Log( _L("GetInfo API for Camera returned error %d"),result ); + iLog->Log(_L("Test Completed")); + iLog->Log( _L("FAIL")); + } + + CleanupStack::PopAndDestroy(obj); + __UHEAP_MARKEND; + return result; + } + +// ----------------------------------------------------------------------------- +// Ctsysinfoservicetests::CameraDataNegativeEntity +// negative test case for core class - Wrong Entity +// ----------------------------------------------------------------------------- +// +TInt Ctsysinfoservicetests::CameraDataNegativeEntity(CStifItemParser& /*aItem*/) + { + TInt result; + TInt expectedError = KErrNotFound; + _LIT( KExample, "CameraDataNegativeEntity" ); + iLog->Log( KExample ); + + _LIT( KCameraEntity, "CameraEntity" ); + __UHEAP_MARK; + + CSysInfoService *obj = CSysInfoService::NewL(); + CleanupStack::PushL(obj); + + CSysData* output=NULL; + TRAPD(err,obj->GetInfoL(KCameraEntity,KCameraProperties,output)); + result = err; + if (result == expectedError) + { + iLog->Log(_L("Got Expected error code %d "),result); + result = KErrNone; + iLog->Log(_L("Test Completed")); + iLog->Log( _L("PASS")); + }//err + else + { + iLog->Log( _L("GetInfo API for Camera returned unexpected error") ); + iLog->Log(_L("Test Completed")); + iLog->Log( _L("FAIL")); + } + + CleanupStack::PopAndDestroy(obj); + __UHEAP_MARKEND; + return result; + } + +// ----------------------------------------------------------------------------- +// Ctsysinfoservicetests::CameraDataNegativeKey +// negative test case for core class - Wrong Key +// ----------------------------------------------------------------------------- +// +TInt Ctsysinfoservicetests::CameraDataNegativeKey(CStifItemParser& /*aItem*/) + { + TInt result; + TInt expectedError = KErrNotFound; + _LIT( KExample, "CameraDataNegativeKey" ); + iLog->Log( KExample ); + + _LIT( KCameraKey, "CameraKey" ); + __UHEAP_MARK; + + CSysInfoService *obj = CSysInfoService::NewL(); + CleanupStack::PushL(obj); + + CSysData* output=NULL; + TRAPD(err,obj->GetInfoL(KCameraInfo,KCameraKey,output)); + result = err; + if (result == expectedError) + { + iLog->Log(_L("Got Expected error code %d "),result); + result = KErrNone; + iLog->Log(_L("Test Completed")); + iLog->Log( _L("PASS")); + }//err + else + { + iLog->Log( _L("GetInfo API for Camera returned unexpected error") ); + iLog->Log(_L("Test Completed")); + iLog->Log( _L("FAIL")); + } + + CleanupStack::PopAndDestroy(obj); + __UHEAP_MARKEND; + return result; + } + TInt Ctsysinfoservicetests::ConnBluetooth(CStifItemParser& /*aItem*/) { int ret=0; diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/testing/tsysgeneral/group/tsysgeneral.mmp --- a/serviceproviders/sapi_sysinfo/tsrc/testing/tsysgeneral/group/tsysgeneral.mmp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/testing/tsysgeneral/group/tsysgeneral.mmp Thu Aug 27 07:43:07 2009 +0300 @@ -63,6 +63,7 @@ LIBRARY euser.lib LIBRARY stiftestinterface.lib LIBRARY sysinfoservice.lib +LIBRARY cone.lib LANG SC diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/testing/tsysgeneral/src/tsysgeneralblocks.cpp --- a/serviceproviders/sapi_sysinfo/tsrc/testing/tsysgeneral/src/tsysgeneralblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/testing/tsysgeneral/src/tsysgeneralblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -23,6 +23,7 @@ #include #include #include "tsysgeneral.h" +#include // EXTERNAL DATA STRUCTURES //extern ?external_data; @@ -127,50 +128,52 @@ // TInt Ctsysgeneral::GetDisplayLanguage( CStifItemParser& aItem ) { + CCoeEnv* coeSupported = NULL; + coeSupported = CCoeEnv::Static(); + if (coeSupported) + { + __UHEAP_MARK; + _LIT(KEntity, "General") ; + _LIT(KKey, "DisplayLanguage") ; - __UHEAP_MARK; - - _LIT(KEntity,"General") ; - _LIT(KKey,"DisplayLanguage") ; - - TInt returnCode = KErrNone ; - TInt expLanguage = 0 ; - TInt expDataType = 0 ; - aItem.GetNextInt (expLanguage) ; - - CSysInfoService *CoreObj = CSysInfoService :: NewL() ; - - if( NULL == CoreObj) - { - iLog->Log(_L8("Failed.. @Core")) ; - return KErrGeneral ; - } + TInt returnCode = KErrNone; + TInt expLanguage = 0; + TInt expDataType = 0; + aItem.GetNextInt(expLanguage) ; + CSysInfoService *CoreObj = CSysInfoService::NewL() ; + if (NULL == CoreObj) + { + iLog->Log(_L8("Failed.. @Core")) ; + return KErrGeneral; + } + CSysData *sysData = NULL; - CSysData *sysData = NULL; - - iLog->Log(_L8("DisplayLanguage : %d"),expLanguage) ; - TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; - if(KErrNotFound != leaveCode) - { - iLog->Log( _L("Failed, Set Display language found ret err: %d"),leaveCode ); - returnCode = KErrGeneral; - } + iLog->Log(_L8("DisplayLanguage : %d"), expLanguage) ; + TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData)) ; + if (KErrNotFound != leaveCode) + { + iLog->Log(_L("Failed, Set Display language found ret err: %d"), + leaveCode); + returnCode = KErrGeneral; + } + else + { + returnCode = KErrNone; + iLog->Log(_L8("P.. @TRAPD")) ; + } + + delete sysData; + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; + } else - { - returnCode = KErrNone ; - iLog->Log(_L8("P.. @TRAPD")) ; - } - - delete sysData ; - delete CoreObj ; - __UHEAP_MARKEND ; - return returnCode ; - + { + iLog->Log(_L("CCoeEnv not supported . So passing the test case")); + return 0; + } } - - - // ----------------------------------------------------------------------------- // Ctsysgeneral::SetWrongDataType // Test method for setting Wrong DataType diff -r 989d2f495d90 -r fc9cf246af83 serviceproviders/sapi_sysinfo/tsrc/testing/tsysmanualtest/src/tsysmanualtestblocks.cpp --- a/serviceproviders/sapi_sysinfo/tsrc/testing/tsysmanualtest/src/tsysmanualtestblocks.cpp Fri Jul 03 15:51:24 2009 +0100 +++ b/serviceproviders/sapi_sysinfo/tsrc/testing/tsysmanualtest/src/tsysmanualtestblocks.cpp Thu Aug 27 07:43:07 2009 +0300 @@ -956,83 +956,45 @@ // Test method for setting DisplayLanguage // ----------------------------------------------------------------------------- // -TInt Ctsysmanualtest::SetDisplayLanguage( CStifItemParser& aItem ) +TInt Ctsysmanualtest::SetDisplayLanguage(CStifItemParser& aItem) { - __UHEAP_MARK; - - _LIT(KEntity,"General") ; - _LIT(KKey,"DisplayLanguage") ; - - TInt returnCode = KErrNone ; - TInt expLanguage = 0 ; - TInt expDataType = 0 ; - aItem.GetNextInt (expLanguage) ; - - CSysInfoService *CoreObj = CSysInfoService :: NewL() ; - - if( NULL == CoreObj) - { - iLog->Log(_L8("Failed.. @Core")) ; - return KErrGeneral ; - } - - CStatus *sysData = CStatus::NewL(expLanguage) ; - - iLog->Log(_L8("DisplayLanguage : %d"),expLanguage) ; - - TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,sysData)) ; - - if(KErrNone == leaveCode) - { - - CSysData *outData ; - - TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,outData)) ; - - if(KErrNone == leaveCode) - { - - TInt retType = outData->DataType() ; - - if(expDataType == retType) - { - - CStatus *status = (CStatus*)outData ; - TInt retStatus = status->Status() ; - - if(expLanguage != retStatus) - { - returnCode = KErrGeneral ; - iLog->Log(_L8("Failed.. @retStatus")) ; - } - else - { - iLog->Log(_L8("Passed..")) ; - } - - delete outData ; - - } - } - else - { - returnCode = KErrGeneral ; - iLog->Log(_L8("Failed.. @2 TRAPD")) ; - } - } + + _LIT(KEntity, "General") ; + _LIT(KKey, "DisplayLanguage") ; + + TInt returnCode = KErrNone; + TInt expLanguage = 0; + TInt expDataType = 0; + aItem.GetNextInt(expLanguage) ; + + CSysInfoService *CoreObj = CSysInfoService::NewL() ; + + if (NULL == CoreObj) + { + iLog->Log(_L8("Failed.. @Core")) ; + return KErrGeneral; + } + + CStatus *sysData = CStatus::NewL(expLanguage) ; + + iLog->Log(_L8("DisplayLanguage : %d"), expLanguage) ; + + TRAPD(leaveCode, CoreObj->SetInfoL(KEntity, KKey, sysData)) ; + + if (KErrNotFound == leaveCode) + { + returnCode = KErrNone; + } else - { - returnCode = KErrGeneral ; - iLog->Log(_L8("Failed.. @TRAPD")) ; - } - - delete sysData ; - delete CoreObj ; - - - __UHEAP_MARKEND ; - return returnCode ; + { + returnCode = KErrGeneral; + iLog->Log(_L8("Failed.. @TRAPD")) ; + } + delete sysData; + delete CoreObj; + __UHEAP_MARKEND; + return returnCode; }